x-fidelity 4.1.2 → 4.1.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/dist/index.js +1 -1
- package/dist/xfidelity +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -354,7 +354,7 @@ ${"".padEnd(e)}${"^".repeat(i)}`}function fP(t){return KJ(vx,t)}function Pi(t){i
|
|
|
354
354
|
${(0,Xx.stringify)(e.metadata?.results?.XFI_RESULT||"No results available")}`,a=await i.sendMail({from:this.config.from,to:e.recipients.join(", "),subject:e.subject,html:e.content,text:n});g.info({messageId:a.messageId,response:a.response,accepted:a.accepted,rejected:a.rejected},"Email sent successfully")}catch(i){g.error({error:i instanceof Error?{message:i.message,stack:i.stack,name:i.name}:i,notification:{recipients:e.recipients,subject:e.subject}},"Failed to send email notification")}}formatResults(e){return e.metadata?.results?`
|
|
355
355
|
## X-Fidelity Analysis Results
|
|
356
356
|
|
|
357
|
-
${(0,Xx.stringify)(e.metadata.results.XFI_RESULT)}`:"No results available"}}});var Od,yA=R(()=>{"use strict";ye();Od=class{constructor(e){this.name="slack";this.config=e}async getRecipients(){return[]}async initialize(e){this.config=e}async send(e){if(!this.config.webhookUrl||this.config.webhookUrl.trim()==="")throw new Error("Slack webhook URL is required");try{new URL(this.config.webhookUrl)}catch{throw new Error("Invalid Slack webhook URL format")}try{let i={channel:this.config.channel,username:this.config.username||"X-Fidelity",text:e.content,attachments:[{color:e.type==="success"?"good":"danger",title:e.title,text:e.message,fields:[{title:"Type",value:e.type,short:!0}]}]},r=await fetch(this.config.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(`Slack API error: ${r.status} ${r.statusText}`);g.info("Slack notification sent successfully")}catch(i){throw g.error("Failed to send Slack notification:",i),i}}}});var Ld,xA=R(()=>{"use strict";ye();Ld=class{constructor(e){this.name="teams";this.config=e}async getRecipients(){return[]}async initialize(e){this.config=e}async send(e){if(!this.config.webhookUrl||this.config.webhookUrl.trim()==="")throw new Error("Teams webhook URL is required");try{new URL(this.config.webhookUrl)}catch{throw new Error("Invalid Teams webhook URL format")}try{let i=e.metadata?.results?.XFI_RESULT?.fatalityCount||0,r=e.metadata?.results?.XFI_RESULT?.warningCount||0,n={"@type":"MessageCard","@context":"http://schema.org/extensions",themeColor:i>0?"FF0000":r>0?"FFA500":"00FF00",summary:e.title,sections:[{activityTitle:e.title,activitySubtitle:e.message,facts:[{name:"Type",value:e.type},{name:"Recipients",value:e.recipients.join(", ")}],markdown:!0}]},a=await fetch(this.config.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`Teams API error: ${a.status} ${a.statusText}`);g.info("Teams notification sent successfully")}catch(i){throw g.error("Failed to send Teams notification:",i),i}}}});async function bA(t){if(!t.enabled)return g.info("Notifications are disabled"),new uc;let e=new uc;if(t.providers)for(let i of Object.keys(t.providers))switch(i){case"email":let r=WQ();r&&e.registerProvider("email",new Id(r));break;case"slack":let n=KQ();n&&e.registerProvider("slack",new Od(n));break;case"teams":let a=XQ();a&&e.registerProvider("teams",new Ld(a));break;default:g.warn(`Unknown notification provider: ${i}`)}return e}function WQ(){try{let t={host:process.env.NOTIFICATION_EMAIL_HOST||"",port:parseInt(process.env.NOTIFICATION_EMAIL_PORT||"587"),secure:process.env.NOTIFICATION_EMAIL_SECURE==="true",auth:{user:process.env.NOTIFICATION_EMAIL_USER||"",pass:process.env.NOTIFICATION_EMAIL_PASS||""},from:process.env.NOTIFICATION_EMAIL_FROM||"x-fidelity@noreply.com"};return g.debug({emailConfig:{...t,auth:{user:t.auth.user,pass:"****"}}},"Email configuration loaded"),!t.host||!t.auth.user||!t.auth.pass?(g.warn("Missing required email configuration fields",{hasHost:!!t.host,hasUser:!!t.auth.user,hasPass:!!t.auth.pass}),null):t}catch(t){return g.error(t,"Failed to load email configuration"),null}}function KQ(){try{let t=process.env.NOTIFICATION_SLACK_WEBHOOK;return t?{webhookUrl:t,channel:process.env.NOTIFICATION_SLACK_CHANNEL}:(g.warn("Slack webhook URL not configured"),null)}catch(t){return g.error(t,"Failed to load Slack configuration"),null}}function XQ(){try{let t=process.env.NOTIFICATION_TEAMS_WEBHOOK;return t?{webhookUrl:t}:(g.warn("Teams webhook URL not configured"),null)}catch(t){return g.error(t,"Failed to load Teams configuration"),null}}var Jx=R(()=>{"use strict";Q3();vA();yA();xA();ye()});function wA(){return process.env.XFI_DEBUG==="true"||!1||process.env.XFI_LOG_LEVEL==="debug"||process.env.XFI_LOG_LEVEL==="trace"}function JQ(){return process.env.XFI_VERBOSE==="true"||wA()}function YQ(t,e,i){let r=t.startOperation(e);try{let n=i();return n instanceof Promise?n.then(a=>(t.endOperation(r,{success:!0}),a)).catch(a=>{throw t.endOperation(r,{success:!1,error:a.message}),a}):(t.endOperation(r,{success:!0}),n)}catch(n){throw t.endOperation(r,{success:!1,error:n.message}),n}}function QQ(t,e,i){let r=t.createCorrelation(i);try{let n=e(r);return n instanceof Promise?n.finally(()=>t.endCorrelation(r)):(t.endCorrelation(r),n)}catch(n){throw t.endCorrelation(r),n}}var Dc,Yx,EA=R(()=>{"use strict";Lg();Dc=class{constructor(e){this.activeOperations=new Map;this.correlationStack=[];this.baseLogger=e.baseLogger,this.component=e.component,this.sessionId=e.sessionId||this.generateSessionId(),this.context=e.context||{},this.structured=e.structured!==!1,this.enablePerformanceTracking=e.enablePerformanceTracking!==!1,this.enableCorrelation=e.enableCorrelation!==!1}trace(e,i){this.log("trace",e,i)}debug(e,i){this.log("debug",e,i)}info(e,i){this.log("info",e,i)}warn(e,i){this.log("warn",e,i)}error(e,i){this.log("error",e,i)}fatal(e,i){this.log("fatal",e,i)}setLevel(e){this.baseLogger.setLevel(e)}getLevel(){return this.baseLogger.getLevel()}isLevelEnabled(e){return this.baseLogger.isLevelEnabled(e)}dispose(){this.baseLogger.dispose&&this.baseLogger.dispose()}startOperation(e){if(!this.enablePerformanceTracking)return e;let i=`${e}-${Date.now()}-${Math.random().toString(36).substring(2)}`;return this.activeOperations.set(i,Date.now()),this.debug("Operation started",{operation:e,operationId:i,timestamp:new Date().toISOString()}),i}endOperation(e,i){if(!this.enablePerformanceTracking||!this.activeOperations.has(e))return;let r=this.activeOperations.get(e),n=Date.now()-r;this.activeOperations.delete(e),this.info("Operation completed",{operationId:e,duration:`${n}ms`,...i})}createCorrelation(e){if(!this.enableCorrelation)return"";let i=e||`corr-${Date.now()}-${Math.random().toString(36).substring(2)}`;return this.correlationStack.push(i),this.debug("Correlation started",{correlationId:i}),i}endCorrelation(e){if(!this.enableCorrelation)return;let i=this.correlationStack.indexOf(e);i!==-1&&(this.correlationStack.splice(i,1),this.debug("Correlation ended",{correlationId:e}))}log(e,i,r){if(!this.isLevelEnabled(e))return;let n=this.createLogEntry(e,i,r);this.structured?this.logStructured(n):this.logFormatted(n)}createLogEntry(e,i,r){let n,a={};typeof i=="string"?(n=i,r&&typeof r=="object"&&(a=r)):typeof i=="object"?(n=r||JSON.stringify(i),a=i):n=String(i);let s={timestamp:new Date().toISOString(),level:e,message:n,component:this.component,sessionId:this.sessionId,metadata:{...this.context,...a}};return a.function&&(s.function=a.function),a.filePath&&(s.filePath=a.filePath),a.ruleName&&(s.ruleName=a.ruleName),a.pluginName&&(s.pluginName=a.pluginName),(a.duration||a.operation)&&(s.timing={duration:a.duration,operation:a.operation,startTime:a.startTime}),a.error&&(s.error={message:a.error.message||a.error,stack:a.error.stack,code:a.error.code}),s}logStructured(e){let i={"@timestamp":e.timestamp,"@level":e.level.toUpperCase(),"@component":e.component,"@session":e.sessionId,message:e.message,...e.metadata};e.function&&(i["@function"]=e.function),e.filePath&&(i["@file"]=e.filePath),e.ruleName&&(i["@rule"]=e.ruleName),e.pluginName&&(i["@plugin"]=e.pluginName),e.timing&&(i["@timing"]=e.timing),e.error&&(i["@error"]=e.error),this.baseLogger[e.level](e.message,i)}logFormatted(e){let i=[],r=[e.component];e.function&&r.push(e.function),e.pluginName&&r.push(`plugin:${e.pluginName}`),e.filePath&&r.push(`file:${this.getShortFilePath(e.filePath)}`),e.ruleName&&r.push(`rule:${e.ruleName}`);let n=r.join("::"),a="";e.timing?.duration&&(a=` [${e.timing.duration}ms]`);let s=`[${this.getShortTimestamp(e.timestamp)}] ${e.level.toUpperCase().padEnd(5)} [${n}] ${e.message}${a}`,o=e.metadata||{};e.error&&(o.error=e.error),this.baseLogger[e.level](s,o)}generateSessionId(){return`sess-${Date.now()}-${Math.random().toString(36).substring(2)}`}getShortTimestamp(e){return new Date(e).toISOString().substring(11,23)}getShortFilePath(e){let i=e.split(/[/\\]/);return i.length>2?`.../${i.slice(-2).join("/")}`:e}},Yx=class{static create(e,i,r={}){return new Dc({baseLogger:e,component:i,...r})}static createWithDebugContext(e,i,r,n){let a=new Dc({baseLogger:e,component:i,context:{operation:r,...n},structured:!0,enablePerformanceTracking:!0,enableCorrelation:!0});return wa.setDebugContext({operation:r,state:n||{},config:{},environment:{platform:process.platform,version:process.version,nodeVersion:process.version,vscodeVersion:process.env.VSCODE_VERSION},metrics:{startTime:Date.now(),memoryUsage:process.memoryUsage().heapUsed,activeOperations:[]}}),a}}});function Rd(t,e,i){if(!t)return"";if(t.length<=4)return"*".repeat(t.length);let r=e!==void 0&&i!==void 0?t.slice(e,e+i):t;if(r.length>16)return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,6)+"***"+r.slice(-6)+t.slice(e+i):r.slice(0,6)+"***"+r.slice(-6);if(r.length>8)return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,3)+"**"+r.slice(-3)+t.slice(e+i):r.slice(0,3)+"**"+r.slice(-3);let n=Math.floor(r.length/2),a=Math.max(1,r.length-4);return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,n)+"*".repeat(a)+r.slice(-n)+t.slice(e+i):r.slice(0,n)+"*".repeat(a)+r.slice(-n)}function cr(t){if(typeof t=="string")return Qx.some(i=>i.test(t))?Rd(t):t;if(typeof t!="object"||t===null)return t;let e=Array.isArray(t)?[]:{};for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&!Qx.some(r=>{let n=r.exec(i);return n?(e[i]=typeof t[i]=="string"?Rd(t[i],n.index,n[0].length):Rd(JSON.stringify(t[i]),n.index,n[0].length),!0):!1}))if(typeof t[i]=="string"){let r=t[i],n=!1;for(let a of Qx){let s=a.exec(r);s&&(r=Rd(r,s.index,s[0].length),n=!0)}e[i]=n?r:t[i]}else typeof t[i]=="object"&&t[i]!==null?e[i]=cr(t[i]):e[i]=t[i];return e}var Qx,SA=R(()=>{"use strict";Qx=[/x-shared-secret/gi,/password/gi,/api[_-]?key/gi,/auth[_-]?token/gi,/access[_-]?token/gi,/secret[_-]?key/gi,/private[_-]?key/gi,/ssh[_-]?key/gi,/oauth[_-]?token/gi,/jwt[_-]?token/gi,/db[_-]?password/gi,/connection[_-]?string/gi,/credentials/gi,/session[_-]?token/gi,/bearer/gi]});function iZ(t){if(t==null)return{isValid:!1,errors:["Input is undefined or null"]};if(typeof t!="string")return{isValid:!1,errors:["Input must be a string"]};if(t.length>1e3)return{isValid:!1,errors:["Input exceeds maximum length"]};for(let[e,i]of Object.entries(Zx))for(let r of i)if(r.test(t))return g.warn(`Potential ${e} attack detected in input`),{isValid:!1,errors:[`Potential ${e} attack detected`]};return/\(.*\+.*\)\+/.test(t)||/\(.*\|.*\+.*\)\+/.test(t)?{isValid:!1,errors:["Potential regex DoS pattern detected"]}:/(.)\1{99,}/.test(t)?{isValid:!1,errors:["Potential DoS via repeated characters detected"]}:{isValid:!0}}function Ti(t){if(!t||typeof t!="string")return{isValid:!1,errors:["URL is required and must be a string"]};try{let e=new URL(t);return ZQ.includes(e.protocol)?Zx.xss.some(i=>i.test(t))?{isValid:!1,errors:["Potential XSS detected in URL"]}:Zx.directoryTraversal.some(i=>i.test(t))?{isValid:!1,errors:["Potential path traversal detected in URL"]}:{isValid:!0}:{isValid:!1,errors:["Invalid URL protocol"]}}catch{return{isValid:!1,errors:["Invalid URL format"]}}}function qc(t){if(!t||typeof t!="object")return{isValid:!1,errors:["Telemetry data must be an object"]};if(!t.eventType||typeof t.eventType!="string"||t.eventType.trim()==="")return{isValid:!1,errors:["Event type is required"]};if(!eZ.includes(t.eventType))return{isValid:!1,errors:["Invalid event type"]};if(t.metadata!==void 0){if(typeof t.metadata!="object"||t.metadata===null)return{isValid:!1,errors:["Metadata must be an object"]};let e=Object.keys(t.metadata).map(i=>i.toLowerCase());for(let i of tZ)if(e.some(r=>r.includes(i)))return{isValid:!1,errors:["Sensitive information detected in metadata"]}}return{isValid:!0}}function os(t,e,i){g.warn({msg:"Validation error occurred",function:t,error:i,input:JSON.stringify(e)})}var Zx,ZQ,eZ,tZ,_A=R(()=>{"use strict";ye();Zx={directoryTraversal:[/\.\./,/~\//,/\.\.\\/,/C:\\Windows/i,/\/etc\/passwd/i,/%2e%2e%2f/i,/%252f/i,/%c0%af/i],commandInjection:[/[;&|`$(){}[\]<>*?]/,/\$\(/,/`[^`]*`/,/\$\{[^}]*\}/,/&&/,/\|\|/],sqlInjection:[/['";]/,/\bDROP\s+TABLE\b/i,/\bUNION\s+SELECT\b/i,/\bWAITFOR\s+DELAY\b/i,/\bOR\s+['"]?1['"]?\s*=\s*['"]?1['"]?/i],xss:[/<script[^>]*>/i,/javascript:/i,/onerror\s*=/i,/onload\s*=/i,/alert\s*\(/i,/"><script/i,/'><script/i],templateInjection:[/\$\{[^}]*\}/,/\{\{[^}]*\}\}/,/<%[^%]*%>/,/\$\{process\.env\}/i],nosqlInjection:[/\{\s*['"]\$gt['"]\s*:/,/\{\s*['"]\$ne['"]\s*:/,/\{\s*['"]\$where['"]\s*:/],ldapInjection:[/\*\)\(uid=\*\)\)\(\|\(uid=\*/,/\*\)\(\|\(objectclass=\*/,/\*\)\(\|\(password=\*/],xmlInjection:[/<!DOCTYPE[^>]*>/i,/<!ENTITY[^>]*>/i,/<\?xml[^>]*>/i],nullByte:[/\0/,/%00/,/\u0000/],unicodeNormalization:[/fi/,/[\u0300-\u036F]/],homograph:[/[а-я]/i]},ZQ=["http:","https:"],eZ=["test","execution","error","warning","info"],tZ=["password","apikey","token","secret","key","auth"]});var Y=R(()=>{"use strict";Ea();E0();b0();np();c6();qg();Tr();Ri();u6();_0();C0();Jx();EA();ye();ei();Zu();Hu();SA();xo();na();w0();tl();ip();_A();Rg();Bu();ra();ye();ei();Zu();Hu();E0();na();Tr();Ri();Ea();xn();Jx();Kl();Xl()});var Nd=y((A1e,rZ)=>{rZ.exports={name:"x-fidelity",version:"4.1.2",description:"CLI tool for opinionated framework adherence checks with performance optimizations and caching",main:"dist/index",types:"dist/index.d.ts",private:!1,bin:{xfidelity:"./dist/xfidelity"},files:["dist/**/*","README.md","LICENSE"],module:"dist/index.js",exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./*":"./dist/*"},scripts:{clean:"rimraf dist/",prebuild:"yarn clean",build:"yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && node esbuild.config.js","build:production":"yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && node esbuild.config.js --production","build:fresh":"yarn workspaces run clean && yarn build",prepublishOnly:"yarn build:production","build:watch":"node esbuild.config.js --watch",start:"NODE_ENV=test OPENAI_API_KEY= jest --watch",test:"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --testPathIgnorePatterns=vscode-extension","test:unit":"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --testPathIgnorePatterns=vscode-extension","test:integration":"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --config jest.integration.config.js","test:all":"yarn test:unit && yarn test:integration","test:coverage":"NODE_ENV=test OPENAI_API_KEY= jest --coverage",commit:"yarn test && git-cz",release:"yarn semantic-release","test-bin-install":"yarn build && npm link","build-run":"yarn build && node . --dir ../x-fidelity-fixtures/node-fullstack | jq -R -r '. as $line | try fromjson catch $line' ","start-server":"ts-node src/index.ts --mode server",lint:"eslint .","lint:fix":"eslint . --fix","perftest:install":"npm install -g artillery",perftest:"perftest:install && artillery run src/server/configServer.performance.test.yml","perftest:cloud":"perftest:install && echo 'expecting env var ARTILLERY_CLOUD_API_KEY from artillery.io' && artillery run src/server/configServer.performance.test.yml --record","bats:install":"cd ./cli-testing && ./installBatsTesting.sh","bats:test":"cd ./cli-testing && bats *.bats","validate-demo-config":"yarn build && node . --dir ../x-fidelity-fixtures/node-fullstack -x node-fullstack -o true","global:setup":"cd ../../global-install-testing && ./scripts/setup-test-env.sh","global:test:published":"yarn build:fresh && yarn global:setup && cd ../../global-install-testing && ./scripts/test-published.sh","global:test:local":"yarn build:fresh && yarn global:setup && cd ../../global-install-testing && ./scripts/test-local.sh","global:test":"yarn global:test:local && yarn global:test:published"},repository:"git@github.com:zotoio/x-fidelity.git",author:"wyvern8 <io@zoto.io>",license:"MIT",engines:{node:">=22.16.0",yarn:">=1.22.0"},devDependencies:{"@jest/globals":"^30.0.2","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^11.0.3","@semantic-release/npm":"^12.0.1","@semantic-release/release-notes-generator":"^14.0.3","@types/cli-progress":"^3.11.6","@types/fs-extra":"^11.0.4","@types/inquirer":"^9.0.7","@types/jest":"^30.0.0","@types/js-yaml":"^4.0.9","@types/lodash":"^4.17.13","@types/node":"^22.10.5","@types/uuid":"^10.0.0","@types/yauzl":"^2.10.3","@typescript-eslint/eslint-plugin":"^8.35.0","@typescript-eslint/parser":"^8.35.0",commitizen:"^4.3.1","conventional-changelog-conventionalcommits":"^8.0.0","cz-conventional-changelog":"^3.3.0",eslint:"^9.29.0",jest:"^30.0.2",nodemon:"^3.1.9",rimraf:"^6.0.1","semantic-release":"^24.2.5","ts-jest":"^29.4.0","ts-node":"^10.9.2",typescript:"^5.7.2","@x-fidelity/core":"file:../x-fidelity-core","@x-fidelity/types":"file:../x-fidelity-types","@x-fidelity/plugins":"file:../x-fidelity-plugins","@x-fidelity/server":"file:../x-fidelity-server","@x-fidelity/democonfig":"file:../x-fidelity-democonfig",esbuild:"^0.25.5"},dependencies:{commander:"^14.0.0","fs-extra":"^11.3.0",glob:"11.0.3",ora:"^8.2.0",prettyjson:"^1.2.5",pino:"^9.7.0","pino-pretty":"^13.0.0",chokidar:"^3.6.0","tree-sitter":"^0.22.4","tree-sitter-javascript":"^0.23.1","tree-sitter-typescript":"^0.23.2","@babel/parser":"^7.23.0","@babel/types":"^7.23.0","@yarnpkg/lockfile":"^1.1.0",axios:"^1.8.1",dotenv:"^16.4.7",esprima:"^4.0.1",lodash:"^4.17.21",openai:"^4.86.1",semver:"^7.7.1"},config:{commitizen:{path:"./node_modules/cz-conventional-changelog"}},publishConfig:{access:"public"}}});var Xi=y((T1e,TA)=>{var nZ=require("path").relative;TA.exports=uZ;var aZ=process.cwd();function PA(t,e){for(var i=t.split(/[ ,]+/),r=String(e).toLowerCase(),n=0;n<i.length;n++){var a=i[n];if(a&&(a==="*"||a.toLowerCase()===r))return!0}return!1}function sZ(t,e,i){var r=Object.getOwnPropertyDescriptor(t,e),n=r.value;return r.get=function(){return n},r.writable&&(r.set=function(s){return n=s}),delete r.value,delete r.writable,Object.defineProperty(t,e,r),r}function oZ(t){for(var e="",i=0;i<t;i++)e+=", arg"+i;return e.substr(2)}function cZ(t){var e=this.name+": "+this.namespace;this.message&&(e+=" deprecated "+this.message);for(var i=0;i<t.length;i++)e+=`
|
|
357
|
+
${(0,Xx.stringify)(e.metadata.results.XFI_RESULT)}`:"No results available"}}});var Od,yA=R(()=>{"use strict";ye();Od=class{constructor(e){this.name="slack";this.config=e}async getRecipients(){return[]}async initialize(e){this.config=e}async send(e){if(!this.config.webhookUrl||this.config.webhookUrl.trim()==="")throw new Error("Slack webhook URL is required");try{new URL(this.config.webhookUrl)}catch{throw new Error("Invalid Slack webhook URL format")}try{let i={channel:this.config.channel,username:this.config.username||"X-Fidelity",text:e.content,attachments:[{color:e.type==="success"?"good":"danger",title:e.title,text:e.message,fields:[{title:"Type",value:e.type,short:!0}]}]},r=await fetch(this.config.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(`Slack API error: ${r.status} ${r.statusText}`);g.info("Slack notification sent successfully")}catch(i){throw g.error("Failed to send Slack notification:",i),i}}}});var Ld,xA=R(()=>{"use strict";ye();Ld=class{constructor(e){this.name="teams";this.config=e}async getRecipients(){return[]}async initialize(e){this.config=e}async send(e){if(!this.config.webhookUrl||this.config.webhookUrl.trim()==="")throw new Error("Teams webhook URL is required");try{new URL(this.config.webhookUrl)}catch{throw new Error("Invalid Teams webhook URL format")}try{let i=e.metadata?.results?.XFI_RESULT?.fatalityCount||0,r=e.metadata?.results?.XFI_RESULT?.warningCount||0,n={"@type":"MessageCard","@context":"http://schema.org/extensions",themeColor:i>0?"FF0000":r>0?"FFA500":"00FF00",summary:e.title,sections:[{activityTitle:e.title,activitySubtitle:e.message,facts:[{name:"Type",value:e.type},{name:"Recipients",value:e.recipients.join(", ")}],markdown:!0}]},a=await fetch(this.config.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`Teams API error: ${a.status} ${a.statusText}`);g.info("Teams notification sent successfully")}catch(i){throw g.error("Failed to send Teams notification:",i),i}}}});async function bA(t){if(!t.enabled)return g.info("Notifications are disabled"),new uc;let e=new uc;if(t.providers)for(let i of Object.keys(t.providers))switch(i){case"email":let r=WQ();r&&e.registerProvider("email",new Id(r));break;case"slack":let n=KQ();n&&e.registerProvider("slack",new Od(n));break;case"teams":let a=XQ();a&&e.registerProvider("teams",new Ld(a));break;default:g.warn(`Unknown notification provider: ${i}`)}return e}function WQ(){try{let t={host:process.env.NOTIFICATION_EMAIL_HOST||"",port:parseInt(process.env.NOTIFICATION_EMAIL_PORT||"587"),secure:process.env.NOTIFICATION_EMAIL_SECURE==="true",auth:{user:process.env.NOTIFICATION_EMAIL_USER||"",pass:process.env.NOTIFICATION_EMAIL_PASS||""},from:process.env.NOTIFICATION_EMAIL_FROM||"x-fidelity@noreply.com"};return g.debug({emailConfig:{...t,auth:{user:t.auth.user,pass:"****"}}},"Email configuration loaded"),!t.host||!t.auth.user||!t.auth.pass?(g.warn("Missing required email configuration fields",{hasHost:!!t.host,hasUser:!!t.auth.user,hasPass:!!t.auth.pass}),null):t}catch(t){return g.error(t,"Failed to load email configuration"),null}}function KQ(){try{let t=process.env.NOTIFICATION_SLACK_WEBHOOK;return t?{webhookUrl:t,channel:process.env.NOTIFICATION_SLACK_CHANNEL}:(g.warn("Slack webhook URL not configured"),null)}catch(t){return g.error(t,"Failed to load Slack configuration"),null}}function XQ(){try{let t=process.env.NOTIFICATION_TEAMS_WEBHOOK;return t?{webhookUrl:t}:(g.warn("Teams webhook URL not configured"),null)}catch(t){return g.error(t,"Failed to load Teams configuration"),null}}var Jx=R(()=>{"use strict";Q3();vA();yA();xA();ye()});function wA(){return process.env.XFI_DEBUG==="true"||!1||process.env.XFI_LOG_LEVEL==="debug"||process.env.XFI_LOG_LEVEL==="trace"}function JQ(){return process.env.XFI_VERBOSE==="true"||wA()}function YQ(t,e,i){let r=t.startOperation(e);try{let n=i();return n instanceof Promise?n.then(a=>(t.endOperation(r,{success:!0}),a)).catch(a=>{throw t.endOperation(r,{success:!1,error:a.message}),a}):(t.endOperation(r,{success:!0}),n)}catch(n){throw t.endOperation(r,{success:!1,error:n.message}),n}}function QQ(t,e,i){let r=t.createCorrelation(i);try{let n=e(r);return n instanceof Promise?n.finally(()=>t.endCorrelation(r)):(t.endCorrelation(r),n)}catch(n){throw t.endCorrelation(r),n}}var Dc,Yx,EA=R(()=>{"use strict";Lg();Dc=class{constructor(e){this.activeOperations=new Map;this.correlationStack=[];this.baseLogger=e.baseLogger,this.component=e.component,this.sessionId=e.sessionId||this.generateSessionId(),this.context=e.context||{},this.structured=e.structured!==!1,this.enablePerformanceTracking=e.enablePerformanceTracking!==!1,this.enableCorrelation=e.enableCorrelation!==!1}trace(e,i){this.log("trace",e,i)}debug(e,i){this.log("debug",e,i)}info(e,i){this.log("info",e,i)}warn(e,i){this.log("warn",e,i)}error(e,i){this.log("error",e,i)}fatal(e,i){this.log("fatal",e,i)}setLevel(e){this.baseLogger.setLevel(e)}getLevel(){return this.baseLogger.getLevel()}isLevelEnabled(e){return this.baseLogger.isLevelEnabled(e)}dispose(){this.baseLogger.dispose&&this.baseLogger.dispose()}startOperation(e){if(!this.enablePerformanceTracking)return e;let i=`${e}-${Date.now()}-${Math.random().toString(36).substring(2)}`;return this.activeOperations.set(i,Date.now()),this.debug("Operation started",{operation:e,operationId:i,timestamp:new Date().toISOString()}),i}endOperation(e,i){if(!this.enablePerformanceTracking||!this.activeOperations.has(e))return;let r=this.activeOperations.get(e),n=Date.now()-r;this.activeOperations.delete(e),this.info("Operation completed",{operationId:e,duration:`${n}ms`,...i})}createCorrelation(e){if(!this.enableCorrelation)return"";let i=e||`corr-${Date.now()}-${Math.random().toString(36).substring(2)}`;return this.correlationStack.push(i),this.debug("Correlation started",{correlationId:i}),i}endCorrelation(e){if(!this.enableCorrelation)return;let i=this.correlationStack.indexOf(e);i!==-1&&(this.correlationStack.splice(i,1),this.debug("Correlation ended",{correlationId:e}))}log(e,i,r){if(!this.isLevelEnabled(e))return;let n=this.createLogEntry(e,i,r);this.structured?this.logStructured(n):this.logFormatted(n)}createLogEntry(e,i,r){let n,a={};typeof i=="string"?(n=i,r&&typeof r=="object"&&(a=r)):typeof i=="object"?(n=r||JSON.stringify(i),a=i):n=String(i);let s={timestamp:new Date().toISOString(),level:e,message:n,component:this.component,sessionId:this.sessionId,metadata:{...this.context,...a}};return a.function&&(s.function=a.function),a.filePath&&(s.filePath=a.filePath),a.ruleName&&(s.ruleName=a.ruleName),a.pluginName&&(s.pluginName=a.pluginName),(a.duration||a.operation)&&(s.timing={duration:a.duration,operation:a.operation,startTime:a.startTime}),a.error&&(s.error={message:a.error.message||a.error,stack:a.error.stack,code:a.error.code}),s}logStructured(e){let i={"@timestamp":e.timestamp,"@level":e.level.toUpperCase(),"@component":e.component,"@session":e.sessionId,message:e.message,...e.metadata};e.function&&(i["@function"]=e.function),e.filePath&&(i["@file"]=e.filePath),e.ruleName&&(i["@rule"]=e.ruleName),e.pluginName&&(i["@plugin"]=e.pluginName),e.timing&&(i["@timing"]=e.timing),e.error&&(i["@error"]=e.error),this.baseLogger[e.level](e.message,i)}logFormatted(e){let i=[],r=[e.component];e.function&&r.push(e.function),e.pluginName&&r.push(`plugin:${e.pluginName}`),e.filePath&&r.push(`file:${this.getShortFilePath(e.filePath)}`),e.ruleName&&r.push(`rule:${e.ruleName}`);let n=r.join("::"),a="";e.timing?.duration&&(a=` [${e.timing.duration}ms]`);let s=`[${this.getShortTimestamp(e.timestamp)}] ${e.level.toUpperCase().padEnd(5)} [${n}] ${e.message}${a}`,o=e.metadata||{};e.error&&(o.error=e.error),this.baseLogger[e.level](s,o)}generateSessionId(){return`sess-${Date.now()}-${Math.random().toString(36).substring(2)}`}getShortTimestamp(e){return new Date(e).toISOString().substring(11,23)}getShortFilePath(e){let i=e.split(/[/\\]/);return i.length>2?`.../${i.slice(-2).join("/")}`:e}},Yx=class{static create(e,i,r={}){return new Dc({baseLogger:e,component:i,...r})}static createWithDebugContext(e,i,r,n){let a=new Dc({baseLogger:e,component:i,context:{operation:r,...n},structured:!0,enablePerformanceTracking:!0,enableCorrelation:!0});return wa.setDebugContext({operation:r,state:n||{},config:{},environment:{platform:process.platform,version:process.version,nodeVersion:process.version,vscodeVersion:process.env.VSCODE_VERSION},metrics:{startTime:Date.now(),memoryUsage:process.memoryUsage().heapUsed,activeOperations:[]}}),a}}});function Rd(t,e,i){if(!t)return"";if(t.length<=4)return"*".repeat(t.length);let r=e!==void 0&&i!==void 0?t.slice(e,e+i):t;if(r.length>16)return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,6)+"***"+r.slice(-6)+t.slice(e+i):r.slice(0,6)+"***"+r.slice(-6);if(r.length>8)return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,3)+"**"+r.slice(-3)+t.slice(e+i):r.slice(0,3)+"**"+r.slice(-3);let n=Math.floor(r.length/2),a=Math.max(1,r.length-4);return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,n)+"*".repeat(a)+r.slice(-n)+t.slice(e+i):r.slice(0,n)+"*".repeat(a)+r.slice(-n)}function cr(t){if(typeof t=="string")return Qx.some(i=>i.test(t))?Rd(t):t;if(typeof t!="object"||t===null)return t;let e=Array.isArray(t)?[]:{};for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&!Qx.some(r=>{let n=r.exec(i);return n?(e[i]=typeof t[i]=="string"?Rd(t[i],n.index,n[0].length):Rd(JSON.stringify(t[i]),n.index,n[0].length),!0):!1}))if(typeof t[i]=="string"){let r=t[i],n=!1;for(let a of Qx){let s=a.exec(r);s&&(r=Rd(r,s.index,s[0].length),n=!0)}e[i]=n?r:t[i]}else typeof t[i]=="object"&&t[i]!==null?e[i]=cr(t[i]):e[i]=t[i];return e}var Qx,SA=R(()=>{"use strict";Qx=[/x-shared-secret/gi,/password/gi,/api[_-]?key/gi,/auth[_-]?token/gi,/access[_-]?token/gi,/secret[_-]?key/gi,/private[_-]?key/gi,/ssh[_-]?key/gi,/oauth[_-]?token/gi,/jwt[_-]?token/gi,/db[_-]?password/gi,/connection[_-]?string/gi,/credentials/gi,/session[_-]?token/gi,/bearer/gi]});function iZ(t){if(t==null)return{isValid:!1,errors:["Input is undefined or null"]};if(typeof t!="string")return{isValid:!1,errors:["Input must be a string"]};if(t.length>1e3)return{isValid:!1,errors:["Input exceeds maximum length"]};for(let[e,i]of Object.entries(Zx))for(let r of i)if(r.test(t))return g.warn(`Potential ${e} attack detected in input`),{isValid:!1,errors:[`Potential ${e} attack detected`]};return/\(.*\+.*\)\+/.test(t)||/\(.*\|.*\+.*\)\+/.test(t)?{isValid:!1,errors:["Potential regex DoS pattern detected"]}:/(.)\1{99,}/.test(t)?{isValid:!1,errors:["Potential DoS via repeated characters detected"]}:{isValid:!0}}function Ti(t){if(!t||typeof t!="string")return{isValid:!1,errors:["URL is required and must be a string"]};try{let e=new URL(t);return ZQ.includes(e.protocol)?Zx.xss.some(i=>i.test(t))?{isValid:!1,errors:["Potential XSS detected in URL"]}:Zx.directoryTraversal.some(i=>i.test(t))?{isValid:!1,errors:["Potential path traversal detected in URL"]}:{isValid:!0}:{isValid:!1,errors:["Invalid URL protocol"]}}catch{return{isValid:!1,errors:["Invalid URL format"]}}}function qc(t){if(!t||typeof t!="object")return{isValid:!1,errors:["Telemetry data must be an object"]};if(!t.eventType||typeof t.eventType!="string"||t.eventType.trim()==="")return{isValid:!1,errors:["Event type is required"]};if(!eZ.includes(t.eventType))return{isValid:!1,errors:["Invalid event type"]};if(t.metadata!==void 0){if(typeof t.metadata!="object"||t.metadata===null)return{isValid:!1,errors:["Metadata must be an object"]};let e=Object.keys(t.metadata).map(i=>i.toLowerCase());for(let i of tZ)if(e.some(r=>r.includes(i)))return{isValid:!1,errors:["Sensitive information detected in metadata"]}}return{isValid:!0}}function os(t,e,i){g.warn({msg:"Validation error occurred",function:t,error:i,input:JSON.stringify(e)})}var Zx,ZQ,eZ,tZ,_A=R(()=>{"use strict";ye();Zx={directoryTraversal:[/\.\./,/~\//,/\.\.\\/,/C:\\Windows/i,/\/etc\/passwd/i,/%2e%2e%2f/i,/%252f/i,/%c0%af/i],commandInjection:[/[;&|`$(){}[\]<>*?]/,/\$\(/,/`[^`]*`/,/\$\{[^}]*\}/,/&&/,/\|\|/],sqlInjection:[/['";]/,/\bDROP\s+TABLE\b/i,/\bUNION\s+SELECT\b/i,/\bWAITFOR\s+DELAY\b/i,/\bOR\s+['"]?1['"]?\s*=\s*['"]?1['"]?/i],xss:[/<script[^>]*>/i,/javascript:/i,/onerror\s*=/i,/onload\s*=/i,/alert\s*\(/i,/"><script/i,/'><script/i],templateInjection:[/\$\{[^}]*\}/,/\{\{[^}]*\}\}/,/<%[^%]*%>/,/\$\{process\.env\}/i],nosqlInjection:[/\{\s*['"]\$gt['"]\s*:/,/\{\s*['"]\$ne['"]\s*:/,/\{\s*['"]\$where['"]\s*:/],ldapInjection:[/\*\)\(uid=\*\)\)\(\|\(uid=\*/,/\*\)\(\|\(objectclass=\*/,/\*\)\(\|\(password=\*/],xmlInjection:[/<!DOCTYPE[^>]*>/i,/<!ENTITY[^>]*>/i,/<\?xml[^>]*>/i],nullByte:[/\0/,/%00/,/\u0000/],unicodeNormalization:[/fi/,/[\u0300-\u036F]/],homograph:[/[а-я]/i]},ZQ=["http:","https:"],eZ=["test","execution","error","warning","info"],tZ=["password","apikey","token","secret","key","auth"]});var Y=R(()=>{"use strict";Ea();E0();b0();np();c6();qg();Tr();Ri();u6();_0();C0();Jx();EA();ye();ei();Zu();Hu();SA();xo();na();w0();tl();ip();_A();Rg();Bu();ra();ye();ei();Zu();Hu();E0();na();Tr();Ri();Ea();xn();Jx();Kl();Xl()});var Nd=y((A1e,rZ)=>{rZ.exports={name:"x-fidelity",version:"4.1.3",description:"CLI tool for opinionated framework adherence checks with performance optimizations and caching",main:"dist/index",types:"dist/index.d.ts",private:!1,bin:{xfidelity:"./dist/xfidelity"},files:["dist/**/*","README.md","LICENSE"],module:"dist/index.js",exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./*":"./dist/*"},scripts:{clean:"rimraf dist/",prebuild:"yarn clean",build:"yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && node esbuild.config.js","build:production":"yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && node esbuild.config.js --production","build:fresh":"yarn workspaces run clean && yarn build",prepublishOnly:"yarn build:production","build:watch":"node esbuild.config.js --watch",start:"NODE_ENV=test OPENAI_API_KEY= jest --watch",test:"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --testPathIgnorePatterns=vscode-extension","test:unit":"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --testPathIgnorePatterns=vscode-extension","test:integration":"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --config jest.integration.config.js","test:all":"yarn test:unit && yarn test:integration","test:coverage":"NODE_ENV=test OPENAI_API_KEY= jest --coverage",commit:"yarn test && git-cz",release:"yarn semantic-release","test-bin-install":"yarn build && npm link","build-run":"yarn build && node . --dir ../x-fidelity-fixtures/node-fullstack | jq -R -r '. as $line | try fromjson catch $line' ","start-server":"ts-node src/index.ts --mode server",lint:"eslint .","lint:fix":"eslint . --fix","perftest:install":"npm install -g artillery",perftest:"perftest:install && artillery run src/server/configServer.performance.test.yml","perftest:cloud":"perftest:install && echo 'expecting env var ARTILLERY_CLOUD_API_KEY from artillery.io' && artillery run src/server/configServer.performance.test.yml --record","bats:install":"cd ./cli-testing && ./installBatsTesting.sh","bats:test":"cd ./cli-testing && bats *.bats","validate-demo-config":"yarn build && node . --dir ../x-fidelity-fixtures/node-fullstack -x node-fullstack -o true","global:setup":"cd ../../global-install-testing && ./scripts/setup-test-env.sh","global:test:published":"yarn build:fresh && yarn global:setup && cd ../../global-install-testing && ./scripts/test-published.sh","global:test:local":"yarn build:fresh && yarn global:setup && cd ../../global-install-testing && ./scripts/test-local.sh","global:test":"yarn global:test:local && yarn global:test:published"},repository:"git@github.com:zotoio/x-fidelity.git",author:"wyvern8 <io@zoto.io>",license:"MIT",engines:{node:">=22.16.0",yarn:">=1.22.0"},devDependencies:{"@jest/globals":"^30.0.2","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^11.0.3","@semantic-release/npm":"^12.0.1","@semantic-release/release-notes-generator":"^14.0.3","@types/cli-progress":"^3.11.6","@types/fs-extra":"^11.0.4","@types/inquirer":"^9.0.7","@types/jest":"^30.0.0","@types/js-yaml":"^4.0.9","@types/lodash":"^4.17.13","@types/node":"^22.10.5","@types/uuid":"^10.0.0","@types/yauzl":"^2.10.3","@typescript-eslint/eslint-plugin":"^8.35.0","@typescript-eslint/parser":"^8.35.0",commitizen:"^4.3.1","conventional-changelog-conventionalcommits":"^8.0.0","cz-conventional-changelog":"^3.3.0",eslint:"^9.29.0",jest:"^30.0.2",nodemon:"^3.1.9",rimraf:"^6.0.1","semantic-release":"^24.2.5","ts-jest":"^29.4.0","ts-node":"^10.9.2",typescript:"^5.7.2","@x-fidelity/core":"file:../x-fidelity-core","@x-fidelity/types":"file:../x-fidelity-types","@x-fidelity/plugins":"file:../x-fidelity-plugins","@x-fidelity/server":"file:../x-fidelity-server","@x-fidelity/democonfig":"file:../x-fidelity-democonfig",esbuild:"^0.25.5"},dependencies:{commander:"^14.0.0","fs-extra":"^11.3.0",glob:"11.0.3",ora:"^8.2.0",prettyjson:"^1.2.5",pino:"^9.7.0","pino-pretty":"^13.0.0",chokidar:"^3.6.0","tree-sitter":"^0.22.4","tree-sitter-javascript":"^0.23.1","tree-sitter-typescript":"^0.23.2","@babel/parser":"^7.23.0","@babel/types":"^7.23.0","@yarnpkg/lockfile":"^1.1.0",axios:"^1.8.1",dotenv:"^16.4.7",esprima:"^4.0.1",lodash:"^4.17.21",openai:"^4.86.1",semver:"^7.7.1"},config:{commitizen:{path:"./node_modules/cz-conventional-changelog"}},publishConfig:{access:"public"}}});var Xi=y((T1e,TA)=>{var nZ=require("path").relative;TA.exports=uZ;var aZ=process.cwd();function PA(t,e){for(var i=t.split(/[ ,]+/),r=String(e).toLowerCase(),n=0;n<i.length;n++){var a=i[n];if(a&&(a==="*"||a.toLowerCase()===r))return!0}return!1}function sZ(t,e,i){var r=Object.getOwnPropertyDescriptor(t,e),n=r.value;return r.get=function(){return n},r.writable&&(r.set=function(s){return n=s}),delete r.value,delete r.writable,Object.defineProperty(t,e,r),r}function oZ(t){for(var e="",i=0;i<t;i++)e+=", arg"+i;return e.substr(2)}function cZ(t){var e=this.name+": "+this.namespace;this.message&&(e+=" deprecated "+this.message);for(var i=0;i<t.length;i++)e+=`
|
|
358
358
|
at `+t[i].toString();return e}function uZ(t){if(!t)throw new TypeError("argument namespace is required");var e=Dd(),i=cs(e[1]),r=i[0];function n(a){$d.call(n,a)}return n._file=r,n._ignored=pZ(t),n._namespace=t,n._traced=dZ(t),n._warned=Object.create(null),n.function=gZ,n.property=vZ,n}function lZ(t,e){var i=typeof t.listenerCount!="function"?t.listeners(e).length:t.listenerCount(e);return i>0}function pZ(t){if(process.noDeprecation)return!0;var e=process.env.NO_DEPRECATION||"";return PA(e,t)}function dZ(t){if(process.traceDeprecation)return!0;var e=process.env.TRACE_DEPRECATION||"";return PA(e,t)}function $d(t,e){var i=lZ(process,"deprecation");if(!(!i&&this._ignored)){var r,n,a,s,o=0,c=!1,u=Dd(),l=this._file;for(e?(s=e,a=cs(u[1]),a.name=s.name,l=a[0]):(o=2,s=cs(u[o]),a=s);o<u.length;o++)if(r=cs(u[o]),n=r[0],n===l)c=!0;else if(n===this._file)l=this._file;else if(c)break;var p=r?s.join(":")+"__"+r.join(":"):void 0;if(!(p!==void 0&&p in this._warned)){this._warned[p]=!0;var d=t;if(d||(d=a===s||!a.name?CA(s):CA(a)),i){var f=AA(this._namespace,d,u.slice(o));process.emit("deprecation",f);return}var h=process.stderr.isTTY?mZ:fZ,m=h.call(this,d,r,u.slice(o));process.stderr.write(m+`
|
|
359
359
|
`,"utf8")}}}function cs(t){var e=t.getFileName()||"<anonymous>",i=t.getLineNumber(),r=t.getColumnNumber();t.isEval()&&(e=t.getEvalOrigin()+", "+e);var n=[e,i,r];return n.callSite=t,n.name=t.getFunctionName(),n}function CA(t){var e=t.callSite,i=t.name;i||(i="<anonymous@"+eb(t)+">");var r=e.getThis(),n=r&&e.getTypeName();return n==="Object"&&(n=void 0),n==="Function"&&(n=r.name||n),n&&e.getMethodName()?n+"."+i:i}function fZ(t,e,i){var r=new Date().toUTCString(),n=r+" "+this._namespace+" deprecated "+t;if(this._traced){for(var a=0;a<i.length;a++)n+=`
|
|
360
360
|
at `+i[a].toString();return n}return e&&(n+=" at "+eb(e)),n}function mZ(t,e,i){var r="\x1B[36;1m"+this._namespace+"\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m"+t+"\x1B[39m";if(this._traced){for(var n=0;n<i.length;n++)r+=`
|
package/dist/xfidelity
CHANGED
|
@@ -354,7 +354,7 @@ ${"".padEnd(e)}${"^".repeat(i)}`}function fP(t){return KJ(vx,t)}function Pi(t){i
|
|
|
354
354
|
${(0,Xx.stringify)(e.metadata?.results?.XFI_RESULT||"No results available")}`,a=await i.sendMail({from:this.config.from,to:e.recipients.join(", "),subject:e.subject,html:e.content,text:n});g.info({messageId:a.messageId,response:a.response,accepted:a.accepted,rejected:a.rejected},"Email sent successfully")}catch(i){g.error({error:i instanceof Error?{message:i.message,stack:i.stack,name:i.name}:i,notification:{recipients:e.recipients,subject:e.subject}},"Failed to send email notification")}}formatResults(e){return e.metadata?.results?`
|
|
355
355
|
## X-Fidelity Analysis Results
|
|
356
356
|
|
|
357
|
-
${(0,Xx.stringify)(e.metadata.results.XFI_RESULT)}`:"No results available"}}});var Od,yA=R(()=>{"use strict";ye();Od=class{constructor(e){this.name="slack";this.config=e}async getRecipients(){return[]}async initialize(e){this.config=e}async send(e){if(!this.config.webhookUrl||this.config.webhookUrl.trim()==="")throw new Error("Slack webhook URL is required");try{new URL(this.config.webhookUrl)}catch{throw new Error("Invalid Slack webhook URL format")}try{let i={channel:this.config.channel,username:this.config.username||"X-Fidelity",text:e.content,attachments:[{color:e.type==="success"?"good":"danger",title:e.title,text:e.message,fields:[{title:"Type",value:e.type,short:!0}]}]},r=await fetch(this.config.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(`Slack API error: ${r.status} ${r.statusText}`);g.info("Slack notification sent successfully")}catch(i){throw g.error("Failed to send Slack notification:",i),i}}}});var Ld,xA=R(()=>{"use strict";ye();Ld=class{constructor(e){this.name="teams";this.config=e}async getRecipients(){return[]}async initialize(e){this.config=e}async send(e){if(!this.config.webhookUrl||this.config.webhookUrl.trim()==="")throw new Error("Teams webhook URL is required");try{new URL(this.config.webhookUrl)}catch{throw new Error("Invalid Teams webhook URL format")}try{let i=e.metadata?.results?.XFI_RESULT?.fatalityCount||0,r=e.metadata?.results?.XFI_RESULT?.warningCount||0,n={"@type":"MessageCard","@context":"http://schema.org/extensions",themeColor:i>0?"FF0000":r>0?"FFA500":"00FF00",summary:e.title,sections:[{activityTitle:e.title,activitySubtitle:e.message,facts:[{name:"Type",value:e.type},{name:"Recipients",value:e.recipients.join(", ")}],markdown:!0}]},a=await fetch(this.config.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`Teams API error: ${a.status} ${a.statusText}`);g.info("Teams notification sent successfully")}catch(i){throw g.error("Failed to send Teams notification:",i),i}}}});async function bA(t){if(!t.enabled)return g.info("Notifications are disabled"),new uc;let e=new uc;if(t.providers)for(let i of Object.keys(t.providers))switch(i){case"email":let r=WQ();r&&e.registerProvider("email",new Id(r));break;case"slack":let n=KQ();n&&e.registerProvider("slack",new Od(n));break;case"teams":let a=XQ();a&&e.registerProvider("teams",new Ld(a));break;default:g.warn(`Unknown notification provider: ${i}`)}return e}function WQ(){try{let t={host:process.env.NOTIFICATION_EMAIL_HOST||"",port:parseInt(process.env.NOTIFICATION_EMAIL_PORT||"587"),secure:process.env.NOTIFICATION_EMAIL_SECURE==="true",auth:{user:process.env.NOTIFICATION_EMAIL_USER||"",pass:process.env.NOTIFICATION_EMAIL_PASS||""},from:process.env.NOTIFICATION_EMAIL_FROM||"x-fidelity@noreply.com"};return g.debug({emailConfig:{...t,auth:{user:t.auth.user,pass:"****"}}},"Email configuration loaded"),!t.host||!t.auth.user||!t.auth.pass?(g.warn("Missing required email configuration fields",{hasHost:!!t.host,hasUser:!!t.auth.user,hasPass:!!t.auth.pass}),null):t}catch(t){return g.error(t,"Failed to load email configuration"),null}}function KQ(){try{let t=process.env.NOTIFICATION_SLACK_WEBHOOK;return t?{webhookUrl:t,channel:process.env.NOTIFICATION_SLACK_CHANNEL}:(g.warn("Slack webhook URL not configured"),null)}catch(t){return g.error(t,"Failed to load Slack configuration"),null}}function XQ(){try{let t=process.env.NOTIFICATION_TEAMS_WEBHOOK;return t?{webhookUrl:t}:(g.warn("Teams webhook URL not configured"),null)}catch(t){return g.error(t,"Failed to load Teams configuration"),null}}var Jx=R(()=>{"use strict";Q3();vA();yA();xA();ye()});function wA(){return process.env.XFI_DEBUG==="true"||!1||process.env.XFI_LOG_LEVEL==="debug"||process.env.XFI_LOG_LEVEL==="trace"}function JQ(){return process.env.XFI_VERBOSE==="true"||wA()}function YQ(t,e,i){let r=t.startOperation(e);try{let n=i();return n instanceof Promise?n.then(a=>(t.endOperation(r,{success:!0}),a)).catch(a=>{throw t.endOperation(r,{success:!1,error:a.message}),a}):(t.endOperation(r,{success:!0}),n)}catch(n){throw t.endOperation(r,{success:!1,error:n.message}),n}}function QQ(t,e,i){let r=t.createCorrelation(i);try{let n=e(r);return n instanceof Promise?n.finally(()=>t.endCorrelation(r)):(t.endCorrelation(r),n)}catch(n){throw t.endCorrelation(r),n}}var Dc,Yx,EA=R(()=>{"use strict";Lg();Dc=class{constructor(e){this.activeOperations=new Map;this.correlationStack=[];this.baseLogger=e.baseLogger,this.component=e.component,this.sessionId=e.sessionId||this.generateSessionId(),this.context=e.context||{},this.structured=e.structured!==!1,this.enablePerformanceTracking=e.enablePerformanceTracking!==!1,this.enableCorrelation=e.enableCorrelation!==!1}trace(e,i){this.log("trace",e,i)}debug(e,i){this.log("debug",e,i)}info(e,i){this.log("info",e,i)}warn(e,i){this.log("warn",e,i)}error(e,i){this.log("error",e,i)}fatal(e,i){this.log("fatal",e,i)}setLevel(e){this.baseLogger.setLevel(e)}getLevel(){return this.baseLogger.getLevel()}isLevelEnabled(e){return this.baseLogger.isLevelEnabled(e)}dispose(){this.baseLogger.dispose&&this.baseLogger.dispose()}startOperation(e){if(!this.enablePerformanceTracking)return e;let i=`${e}-${Date.now()}-${Math.random().toString(36).substring(2)}`;return this.activeOperations.set(i,Date.now()),this.debug("Operation started",{operation:e,operationId:i,timestamp:new Date().toISOString()}),i}endOperation(e,i){if(!this.enablePerformanceTracking||!this.activeOperations.has(e))return;let r=this.activeOperations.get(e),n=Date.now()-r;this.activeOperations.delete(e),this.info("Operation completed",{operationId:e,duration:`${n}ms`,...i})}createCorrelation(e){if(!this.enableCorrelation)return"";let i=e||`corr-${Date.now()}-${Math.random().toString(36).substring(2)}`;return this.correlationStack.push(i),this.debug("Correlation started",{correlationId:i}),i}endCorrelation(e){if(!this.enableCorrelation)return;let i=this.correlationStack.indexOf(e);i!==-1&&(this.correlationStack.splice(i,1),this.debug("Correlation ended",{correlationId:e}))}log(e,i,r){if(!this.isLevelEnabled(e))return;let n=this.createLogEntry(e,i,r);this.structured?this.logStructured(n):this.logFormatted(n)}createLogEntry(e,i,r){let n,a={};typeof i=="string"?(n=i,r&&typeof r=="object"&&(a=r)):typeof i=="object"?(n=r||JSON.stringify(i),a=i):n=String(i);let s={timestamp:new Date().toISOString(),level:e,message:n,component:this.component,sessionId:this.sessionId,metadata:{...this.context,...a}};return a.function&&(s.function=a.function),a.filePath&&(s.filePath=a.filePath),a.ruleName&&(s.ruleName=a.ruleName),a.pluginName&&(s.pluginName=a.pluginName),(a.duration||a.operation)&&(s.timing={duration:a.duration,operation:a.operation,startTime:a.startTime}),a.error&&(s.error={message:a.error.message||a.error,stack:a.error.stack,code:a.error.code}),s}logStructured(e){let i={"@timestamp":e.timestamp,"@level":e.level.toUpperCase(),"@component":e.component,"@session":e.sessionId,message:e.message,...e.metadata};e.function&&(i["@function"]=e.function),e.filePath&&(i["@file"]=e.filePath),e.ruleName&&(i["@rule"]=e.ruleName),e.pluginName&&(i["@plugin"]=e.pluginName),e.timing&&(i["@timing"]=e.timing),e.error&&(i["@error"]=e.error),this.baseLogger[e.level](e.message,i)}logFormatted(e){let i=[],r=[e.component];e.function&&r.push(e.function),e.pluginName&&r.push(`plugin:${e.pluginName}`),e.filePath&&r.push(`file:${this.getShortFilePath(e.filePath)}`),e.ruleName&&r.push(`rule:${e.ruleName}`);let n=r.join("::"),a="";e.timing?.duration&&(a=` [${e.timing.duration}ms]`);let s=`[${this.getShortTimestamp(e.timestamp)}] ${e.level.toUpperCase().padEnd(5)} [${n}] ${e.message}${a}`,o=e.metadata||{};e.error&&(o.error=e.error),this.baseLogger[e.level](s,o)}generateSessionId(){return`sess-${Date.now()}-${Math.random().toString(36).substring(2)}`}getShortTimestamp(e){return new Date(e).toISOString().substring(11,23)}getShortFilePath(e){let i=e.split(/[/\\]/);return i.length>2?`.../${i.slice(-2).join("/")}`:e}},Yx=class{static create(e,i,r={}){return new Dc({baseLogger:e,component:i,...r})}static createWithDebugContext(e,i,r,n){let a=new Dc({baseLogger:e,component:i,context:{operation:r,...n},structured:!0,enablePerformanceTracking:!0,enableCorrelation:!0});return wa.setDebugContext({operation:r,state:n||{},config:{},environment:{platform:process.platform,version:process.version,nodeVersion:process.version,vscodeVersion:process.env.VSCODE_VERSION},metrics:{startTime:Date.now(),memoryUsage:process.memoryUsage().heapUsed,activeOperations:[]}}),a}}});function Rd(t,e,i){if(!t)return"";if(t.length<=4)return"*".repeat(t.length);let r=e!==void 0&&i!==void 0?t.slice(e,e+i):t;if(r.length>16)return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,6)+"***"+r.slice(-6)+t.slice(e+i):r.slice(0,6)+"***"+r.slice(-6);if(r.length>8)return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,3)+"**"+r.slice(-3)+t.slice(e+i):r.slice(0,3)+"**"+r.slice(-3);let n=Math.floor(r.length/2),a=Math.max(1,r.length-4);return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,n)+"*".repeat(a)+r.slice(-n)+t.slice(e+i):r.slice(0,n)+"*".repeat(a)+r.slice(-n)}function cr(t){if(typeof t=="string")return Qx.some(i=>i.test(t))?Rd(t):t;if(typeof t!="object"||t===null)return t;let e=Array.isArray(t)?[]:{};for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&!Qx.some(r=>{let n=r.exec(i);return n?(e[i]=typeof t[i]=="string"?Rd(t[i],n.index,n[0].length):Rd(JSON.stringify(t[i]),n.index,n[0].length),!0):!1}))if(typeof t[i]=="string"){let r=t[i],n=!1;for(let a of Qx){let s=a.exec(r);s&&(r=Rd(r,s.index,s[0].length),n=!0)}e[i]=n?r:t[i]}else typeof t[i]=="object"&&t[i]!==null?e[i]=cr(t[i]):e[i]=t[i];return e}var Qx,SA=R(()=>{"use strict";Qx=[/x-shared-secret/gi,/password/gi,/api[_-]?key/gi,/auth[_-]?token/gi,/access[_-]?token/gi,/secret[_-]?key/gi,/private[_-]?key/gi,/ssh[_-]?key/gi,/oauth[_-]?token/gi,/jwt[_-]?token/gi,/db[_-]?password/gi,/connection[_-]?string/gi,/credentials/gi,/session[_-]?token/gi,/bearer/gi]});function iZ(t){if(t==null)return{isValid:!1,errors:["Input is undefined or null"]};if(typeof t!="string")return{isValid:!1,errors:["Input must be a string"]};if(t.length>1e3)return{isValid:!1,errors:["Input exceeds maximum length"]};for(let[e,i]of Object.entries(Zx))for(let r of i)if(r.test(t))return g.warn(`Potential ${e} attack detected in input`),{isValid:!1,errors:[`Potential ${e} attack detected`]};return/\(.*\+.*\)\+/.test(t)||/\(.*\|.*\+.*\)\+/.test(t)?{isValid:!1,errors:["Potential regex DoS pattern detected"]}:/(.)\1{99,}/.test(t)?{isValid:!1,errors:["Potential DoS via repeated characters detected"]}:{isValid:!0}}function Ti(t){if(!t||typeof t!="string")return{isValid:!1,errors:["URL is required and must be a string"]};try{let e=new URL(t);return ZQ.includes(e.protocol)?Zx.xss.some(i=>i.test(t))?{isValid:!1,errors:["Potential XSS detected in URL"]}:Zx.directoryTraversal.some(i=>i.test(t))?{isValid:!1,errors:["Potential path traversal detected in URL"]}:{isValid:!0}:{isValid:!1,errors:["Invalid URL protocol"]}}catch{return{isValid:!1,errors:["Invalid URL format"]}}}function qc(t){if(!t||typeof t!="object")return{isValid:!1,errors:["Telemetry data must be an object"]};if(!t.eventType||typeof t.eventType!="string"||t.eventType.trim()==="")return{isValid:!1,errors:["Event type is required"]};if(!eZ.includes(t.eventType))return{isValid:!1,errors:["Invalid event type"]};if(t.metadata!==void 0){if(typeof t.metadata!="object"||t.metadata===null)return{isValid:!1,errors:["Metadata must be an object"]};let e=Object.keys(t.metadata).map(i=>i.toLowerCase());for(let i of tZ)if(e.some(r=>r.includes(i)))return{isValid:!1,errors:["Sensitive information detected in metadata"]}}return{isValid:!0}}function os(t,e,i){g.warn({msg:"Validation error occurred",function:t,error:i,input:JSON.stringify(e)})}var Zx,ZQ,eZ,tZ,_A=R(()=>{"use strict";ye();Zx={directoryTraversal:[/\.\./,/~\//,/\.\.\\/,/C:\\Windows/i,/\/etc\/passwd/i,/%2e%2e%2f/i,/%252f/i,/%c0%af/i],commandInjection:[/[;&|`$(){}[\]<>*?]/,/\$\(/,/`[^`]*`/,/\$\{[^}]*\}/,/&&/,/\|\|/],sqlInjection:[/['";]/,/\bDROP\s+TABLE\b/i,/\bUNION\s+SELECT\b/i,/\bWAITFOR\s+DELAY\b/i,/\bOR\s+['"]?1['"]?\s*=\s*['"]?1['"]?/i],xss:[/<script[^>]*>/i,/javascript:/i,/onerror\s*=/i,/onload\s*=/i,/alert\s*\(/i,/"><script/i,/'><script/i],templateInjection:[/\$\{[^}]*\}/,/\{\{[^}]*\}\}/,/<%[^%]*%>/,/\$\{process\.env\}/i],nosqlInjection:[/\{\s*['"]\$gt['"]\s*:/,/\{\s*['"]\$ne['"]\s*:/,/\{\s*['"]\$where['"]\s*:/],ldapInjection:[/\*\)\(uid=\*\)\)\(\|\(uid=\*/,/\*\)\(\|\(objectclass=\*/,/\*\)\(\|\(password=\*/],xmlInjection:[/<!DOCTYPE[^>]*>/i,/<!ENTITY[^>]*>/i,/<\?xml[^>]*>/i],nullByte:[/\0/,/%00/,/\u0000/],unicodeNormalization:[/fi/,/[\u0300-\u036F]/],homograph:[/[а-я]/i]},ZQ=["http:","https:"],eZ=["test","execution","error","warning","info"],tZ=["password","apikey","token","secret","key","auth"]});var Y=R(()=>{"use strict";Ea();E0();b0();np();c6();qg();Tr();Ri();u6();_0();C0();Jx();EA();ye();ei();Zu();Hu();SA();xo();na();w0();tl();ip();_A();Rg();Bu();ra();ye();ei();Zu();Hu();E0();na();Tr();Ri();Ea();xn();Jx();Kl();Xl()});var Nd=y((A1e,rZ)=>{rZ.exports={name:"x-fidelity",version:"4.1.2",description:"CLI tool for opinionated framework adherence checks with performance optimizations and caching",main:"dist/index",types:"dist/index.d.ts",private:!1,bin:{xfidelity:"./dist/xfidelity"},files:["dist/**/*","README.md","LICENSE"],module:"dist/index.js",exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./*":"./dist/*"},scripts:{clean:"rimraf dist/",prebuild:"yarn clean",build:"yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && node esbuild.config.js","build:production":"yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && node esbuild.config.js --production","build:fresh":"yarn workspaces run clean && yarn build",prepublishOnly:"yarn build:production","build:watch":"node esbuild.config.js --watch",start:"NODE_ENV=test OPENAI_API_KEY= jest --watch",test:"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --testPathIgnorePatterns=vscode-extension","test:unit":"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --testPathIgnorePatterns=vscode-extension","test:integration":"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --config jest.integration.config.js","test:all":"yarn test:unit && yarn test:integration","test:coverage":"NODE_ENV=test OPENAI_API_KEY= jest --coverage",commit:"yarn test && git-cz",release:"yarn semantic-release","test-bin-install":"yarn build && npm link","build-run":"yarn build && node . --dir ../x-fidelity-fixtures/node-fullstack | jq -R -r '. as $line | try fromjson catch $line' ","start-server":"ts-node src/index.ts --mode server",lint:"eslint .","lint:fix":"eslint . --fix","perftest:install":"npm install -g artillery",perftest:"perftest:install && artillery run src/server/configServer.performance.test.yml","perftest:cloud":"perftest:install && echo 'expecting env var ARTILLERY_CLOUD_API_KEY from artillery.io' && artillery run src/server/configServer.performance.test.yml --record","bats:install":"cd ./cli-testing && ./installBatsTesting.sh","bats:test":"cd ./cli-testing && bats *.bats","validate-demo-config":"yarn build && node . --dir ../x-fidelity-fixtures/node-fullstack -x node-fullstack -o true","global:setup":"cd ../../global-install-testing && ./scripts/setup-test-env.sh","global:test:published":"yarn build:fresh && yarn global:setup && cd ../../global-install-testing && ./scripts/test-published.sh","global:test:local":"yarn build:fresh && yarn global:setup && cd ../../global-install-testing && ./scripts/test-local.sh","global:test":"yarn global:test:local && yarn global:test:published"},repository:"git@github.com:zotoio/x-fidelity.git",author:"wyvern8 <io@zoto.io>",license:"MIT",engines:{node:">=22.16.0",yarn:">=1.22.0"},devDependencies:{"@jest/globals":"^30.0.2","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^11.0.3","@semantic-release/npm":"^12.0.1","@semantic-release/release-notes-generator":"^14.0.3","@types/cli-progress":"^3.11.6","@types/fs-extra":"^11.0.4","@types/inquirer":"^9.0.7","@types/jest":"^30.0.0","@types/js-yaml":"^4.0.9","@types/lodash":"^4.17.13","@types/node":"^22.10.5","@types/uuid":"^10.0.0","@types/yauzl":"^2.10.3","@typescript-eslint/eslint-plugin":"^8.35.0","@typescript-eslint/parser":"^8.35.0",commitizen:"^4.3.1","conventional-changelog-conventionalcommits":"^8.0.0","cz-conventional-changelog":"^3.3.0",eslint:"^9.29.0",jest:"^30.0.2",nodemon:"^3.1.9",rimraf:"^6.0.1","semantic-release":"^24.2.5","ts-jest":"^29.4.0","ts-node":"^10.9.2",typescript:"^5.7.2","@x-fidelity/core":"file:../x-fidelity-core","@x-fidelity/types":"file:../x-fidelity-types","@x-fidelity/plugins":"file:../x-fidelity-plugins","@x-fidelity/server":"file:../x-fidelity-server","@x-fidelity/democonfig":"file:../x-fidelity-democonfig",esbuild:"^0.25.5"},dependencies:{commander:"^14.0.0","fs-extra":"^11.3.0",glob:"11.0.3",ora:"^8.2.0",prettyjson:"^1.2.5",pino:"^9.7.0","pino-pretty":"^13.0.0",chokidar:"^3.6.0","tree-sitter":"^0.22.4","tree-sitter-javascript":"^0.23.1","tree-sitter-typescript":"^0.23.2","@babel/parser":"^7.23.0","@babel/types":"^7.23.0","@yarnpkg/lockfile":"^1.1.0",axios:"^1.8.1",dotenv:"^16.4.7",esprima:"^4.0.1",lodash:"^4.17.21",openai:"^4.86.1",semver:"^7.7.1"},config:{commitizen:{path:"./node_modules/cz-conventional-changelog"}},publishConfig:{access:"public"}}});var Xi=y((T1e,TA)=>{var nZ=require("path").relative;TA.exports=uZ;var aZ=process.cwd();function PA(t,e){for(var i=t.split(/[ ,]+/),r=String(e).toLowerCase(),n=0;n<i.length;n++){var a=i[n];if(a&&(a==="*"||a.toLowerCase()===r))return!0}return!1}function sZ(t,e,i){var r=Object.getOwnPropertyDescriptor(t,e),n=r.value;return r.get=function(){return n},r.writable&&(r.set=function(s){return n=s}),delete r.value,delete r.writable,Object.defineProperty(t,e,r),r}function oZ(t){for(var e="",i=0;i<t;i++)e+=", arg"+i;return e.substr(2)}function cZ(t){var e=this.name+": "+this.namespace;this.message&&(e+=" deprecated "+this.message);for(var i=0;i<t.length;i++)e+=`
|
|
357
|
+
${(0,Xx.stringify)(e.metadata.results.XFI_RESULT)}`:"No results available"}}});var Od,yA=R(()=>{"use strict";ye();Od=class{constructor(e){this.name="slack";this.config=e}async getRecipients(){return[]}async initialize(e){this.config=e}async send(e){if(!this.config.webhookUrl||this.config.webhookUrl.trim()==="")throw new Error("Slack webhook URL is required");try{new URL(this.config.webhookUrl)}catch{throw new Error("Invalid Slack webhook URL format")}try{let i={channel:this.config.channel,username:this.config.username||"X-Fidelity",text:e.content,attachments:[{color:e.type==="success"?"good":"danger",title:e.title,text:e.message,fields:[{title:"Type",value:e.type,short:!0}]}]},r=await fetch(this.config.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(`Slack API error: ${r.status} ${r.statusText}`);g.info("Slack notification sent successfully")}catch(i){throw g.error("Failed to send Slack notification:",i),i}}}});var Ld,xA=R(()=>{"use strict";ye();Ld=class{constructor(e){this.name="teams";this.config=e}async getRecipients(){return[]}async initialize(e){this.config=e}async send(e){if(!this.config.webhookUrl||this.config.webhookUrl.trim()==="")throw new Error("Teams webhook URL is required");try{new URL(this.config.webhookUrl)}catch{throw new Error("Invalid Teams webhook URL format")}try{let i=e.metadata?.results?.XFI_RESULT?.fatalityCount||0,r=e.metadata?.results?.XFI_RESULT?.warningCount||0,n={"@type":"MessageCard","@context":"http://schema.org/extensions",themeColor:i>0?"FF0000":r>0?"FFA500":"00FF00",summary:e.title,sections:[{activityTitle:e.title,activitySubtitle:e.message,facts:[{name:"Type",value:e.type},{name:"Recipients",value:e.recipients.join(", ")}],markdown:!0}]},a=await fetch(this.config.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`Teams API error: ${a.status} ${a.statusText}`);g.info("Teams notification sent successfully")}catch(i){throw g.error("Failed to send Teams notification:",i),i}}}});async function bA(t){if(!t.enabled)return g.info("Notifications are disabled"),new uc;let e=new uc;if(t.providers)for(let i of Object.keys(t.providers))switch(i){case"email":let r=WQ();r&&e.registerProvider("email",new Id(r));break;case"slack":let n=KQ();n&&e.registerProvider("slack",new Od(n));break;case"teams":let a=XQ();a&&e.registerProvider("teams",new Ld(a));break;default:g.warn(`Unknown notification provider: ${i}`)}return e}function WQ(){try{let t={host:process.env.NOTIFICATION_EMAIL_HOST||"",port:parseInt(process.env.NOTIFICATION_EMAIL_PORT||"587"),secure:process.env.NOTIFICATION_EMAIL_SECURE==="true",auth:{user:process.env.NOTIFICATION_EMAIL_USER||"",pass:process.env.NOTIFICATION_EMAIL_PASS||""},from:process.env.NOTIFICATION_EMAIL_FROM||"x-fidelity@noreply.com"};return g.debug({emailConfig:{...t,auth:{user:t.auth.user,pass:"****"}}},"Email configuration loaded"),!t.host||!t.auth.user||!t.auth.pass?(g.warn("Missing required email configuration fields",{hasHost:!!t.host,hasUser:!!t.auth.user,hasPass:!!t.auth.pass}),null):t}catch(t){return g.error(t,"Failed to load email configuration"),null}}function KQ(){try{let t=process.env.NOTIFICATION_SLACK_WEBHOOK;return t?{webhookUrl:t,channel:process.env.NOTIFICATION_SLACK_CHANNEL}:(g.warn("Slack webhook URL not configured"),null)}catch(t){return g.error(t,"Failed to load Slack configuration"),null}}function XQ(){try{let t=process.env.NOTIFICATION_TEAMS_WEBHOOK;return t?{webhookUrl:t}:(g.warn("Teams webhook URL not configured"),null)}catch(t){return g.error(t,"Failed to load Teams configuration"),null}}var Jx=R(()=>{"use strict";Q3();vA();yA();xA();ye()});function wA(){return process.env.XFI_DEBUG==="true"||!1||process.env.XFI_LOG_LEVEL==="debug"||process.env.XFI_LOG_LEVEL==="trace"}function JQ(){return process.env.XFI_VERBOSE==="true"||wA()}function YQ(t,e,i){let r=t.startOperation(e);try{let n=i();return n instanceof Promise?n.then(a=>(t.endOperation(r,{success:!0}),a)).catch(a=>{throw t.endOperation(r,{success:!1,error:a.message}),a}):(t.endOperation(r,{success:!0}),n)}catch(n){throw t.endOperation(r,{success:!1,error:n.message}),n}}function QQ(t,e,i){let r=t.createCorrelation(i);try{let n=e(r);return n instanceof Promise?n.finally(()=>t.endCorrelation(r)):(t.endCorrelation(r),n)}catch(n){throw t.endCorrelation(r),n}}var Dc,Yx,EA=R(()=>{"use strict";Lg();Dc=class{constructor(e){this.activeOperations=new Map;this.correlationStack=[];this.baseLogger=e.baseLogger,this.component=e.component,this.sessionId=e.sessionId||this.generateSessionId(),this.context=e.context||{},this.structured=e.structured!==!1,this.enablePerformanceTracking=e.enablePerformanceTracking!==!1,this.enableCorrelation=e.enableCorrelation!==!1}trace(e,i){this.log("trace",e,i)}debug(e,i){this.log("debug",e,i)}info(e,i){this.log("info",e,i)}warn(e,i){this.log("warn",e,i)}error(e,i){this.log("error",e,i)}fatal(e,i){this.log("fatal",e,i)}setLevel(e){this.baseLogger.setLevel(e)}getLevel(){return this.baseLogger.getLevel()}isLevelEnabled(e){return this.baseLogger.isLevelEnabled(e)}dispose(){this.baseLogger.dispose&&this.baseLogger.dispose()}startOperation(e){if(!this.enablePerformanceTracking)return e;let i=`${e}-${Date.now()}-${Math.random().toString(36).substring(2)}`;return this.activeOperations.set(i,Date.now()),this.debug("Operation started",{operation:e,operationId:i,timestamp:new Date().toISOString()}),i}endOperation(e,i){if(!this.enablePerformanceTracking||!this.activeOperations.has(e))return;let r=this.activeOperations.get(e),n=Date.now()-r;this.activeOperations.delete(e),this.info("Operation completed",{operationId:e,duration:`${n}ms`,...i})}createCorrelation(e){if(!this.enableCorrelation)return"";let i=e||`corr-${Date.now()}-${Math.random().toString(36).substring(2)}`;return this.correlationStack.push(i),this.debug("Correlation started",{correlationId:i}),i}endCorrelation(e){if(!this.enableCorrelation)return;let i=this.correlationStack.indexOf(e);i!==-1&&(this.correlationStack.splice(i,1),this.debug("Correlation ended",{correlationId:e}))}log(e,i,r){if(!this.isLevelEnabled(e))return;let n=this.createLogEntry(e,i,r);this.structured?this.logStructured(n):this.logFormatted(n)}createLogEntry(e,i,r){let n,a={};typeof i=="string"?(n=i,r&&typeof r=="object"&&(a=r)):typeof i=="object"?(n=r||JSON.stringify(i),a=i):n=String(i);let s={timestamp:new Date().toISOString(),level:e,message:n,component:this.component,sessionId:this.sessionId,metadata:{...this.context,...a}};return a.function&&(s.function=a.function),a.filePath&&(s.filePath=a.filePath),a.ruleName&&(s.ruleName=a.ruleName),a.pluginName&&(s.pluginName=a.pluginName),(a.duration||a.operation)&&(s.timing={duration:a.duration,operation:a.operation,startTime:a.startTime}),a.error&&(s.error={message:a.error.message||a.error,stack:a.error.stack,code:a.error.code}),s}logStructured(e){let i={"@timestamp":e.timestamp,"@level":e.level.toUpperCase(),"@component":e.component,"@session":e.sessionId,message:e.message,...e.metadata};e.function&&(i["@function"]=e.function),e.filePath&&(i["@file"]=e.filePath),e.ruleName&&(i["@rule"]=e.ruleName),e.pluginName&&(i["@plugin"]=e.pluginName),e.timing&&(i["@timing"]=e.timing),e.error&&(i["@error"]=e.error),this.baseLogger[e.level](e.message,i)}logFormatted(e){let i=[],r=[e.component];e.function&&r.push(e.function),e.pluginName&&r.push(`plugin:${e.pluginName}`),e.filePath&&r.push(`file:${this.getShortFilePath(e.filePath)}`),e.ruleName&&r.push(`rule:${e.ruleName}`);let n=r.join("::"),a="";e.timing?.duration&&(a=` [${e.timing.duration}ms]`);let s=`[${this.getShortTimestamp(e.timestamp)}] ${e.level.toUpperCase().padEnd(5)} [${n}] ${e.message}${a}`,o=e.metadata||{};e.error&&(o.error=e.error),this.baseLogger[e.level](s,o)}generateSessionId(){return`sess-${Date.now()}-${Math.random().toString(36).substring(2)}`}getShortTimestamp(e){return new Date(e).toISOString().substring(11,23)}getShortFilePath(e){let i=e.split(/[/\\]/);return i.length>2?`.../${i.slice(-2).join("/")}`:e}},Yx=class{static create(e,i,r={}){return new Dc({baseLogger:e,component:i,...r})}static createWithDebugContext(e,i,r,n){let a=new Dc({baseLogger:e,component:i,context:{operation:r,...n},structured:!0,enablePerformanceTracking:!0,enableCorrelation:!0});return wa.setDebugContext({operation:r,state:n||{},config:{},environment:{platform:process.platform,version:process.version,nodeVersion:process.version,vscodeVersion:process.env.VSCODE_VERSION},metrics:{startTime:Date.now(),memoryUsage:process.memoryUsage().heapUsed,activeOperations:[]}}),a}}});function Rd(t,e,i){if(!t)return"";if(t.length<=4)return"*".repeat(t.length);let r=e!==void 0&&i!==void 0?t.slice(e,e+i):t;if(r.length>16)return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,6)+"***"+r.slice(-6)+t.slice(e+i):r.slice(0,6)+"***"+r.slice(-6);if(r.length>8)return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,3)+"**"+r.slice(-3)+t.slice(e+i):r.slice(0,3)+"**"+r.slice(-3);let n=Math.floor(r.length/2),a=Math.max(1,r.length-4);return e!==void 0&&i!==void 0?t.slice(0,e)+r.slice(0,n)+"*".repeat(a)+r.slice(-n)+t.slice(e+i):r.slice(0,n)+"*".repeat(a)+r.slice(-n)}function cr(t){if(typeof t=="string")return Qx.some(i=>i.test(t))?Rd(t):t;if(typeof t!="object"||t===null)return t;let e=Array.isArray(t)?[]:{};for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&!Qx.some(r=>{let n=r.exec(i);return n?(e[i]=typeof t[i]=="string"?Rd(t[i],n.index,n[0].length):Rd(JSON.stringify(t[i]),n.index,n[0].length),!0):!1}))if(typeof t[i]=="string"){let r=t[i],n=!1;for(let a of Qx){let s=a.exec(r);s&&(r=Rd(r,s.index,s[0].length),n=!0)}e[i]=n?r:t[i]}else typeof t[i]=="object"&&t[i]!==null?e[i]=cr(t[i]):e[i]=t[i];return e}var Qx,SA=R(()=>{"use strict";Qx=[/x-shared-secret/gi,/password/gi,/api[_-]?key/gi,/auth[_-]?token/gi,/access[_-]?token/gi,/secret[_-]?key/gi,/private[_-]?key/gi,/ssh[_-]?key/gi,/oauth[_-]?token/gi,/jwt[_-]?token/gi,/db[_-]?password/gi,/connection[_-]?string/gi,/credentials/gi,/session[_-]?token/gi,/bearer/gi]});function iZ(t){if(t==null)return{isValid:!1,errors:["Input is undefined or null"]};if(typeof t!="string")return{isValid:!1,errors:["Input must be a string"]};if(t.length>1e3)return{isValid:!1,errors:["Input exceeds maximum length"]};for(let[e,i]of Object.entries(Zx))for(let r of i)if(r.test(t))return g.warn(`Potential ${e} attack detected in input`),{isValid:!1,errors:[`Potential ${e} attack detected`]};return/\(.*\+.*\)\+/.test(t)||/\(.*\|.*\+.*\)\+/.test(t)?{isValid:!1,errors:["Potential regex DoS pattern detected"]}:/(.)\1{99,}/.test(t)?{isValid:!1,errors:["Potential DoS via repeated characters detected"]}:{isValid:!0}}function Ti(t){if(!t||typeof t!="string")return{isValid:!1,errors:["URL is required and must be a string"]};try{let e=new URL(t);return ZQ.includes(e.protocol)?Zx.xss.some(i=>i.test(t))?{isValid:!1,errors:["Potential XSS detected in URL"]}:Zx.directoryTraversal.some(i=>i.test(t))?{isValid:!1,errors:["Potential path traversal detected in URL"]}:{isValid:!0}:{isValid:!1,errors:["Invalid URL protocol"]}}catch{return{isValid:!1,errors:["Invalid URL format"]}}}function qc(t){if(!t||typeof t!="object")return{isValid:!1,errors:["Telemetry data must be an object"]};if(!t.eventType||typeof t.eventType!="string"||t.eventType.trim()==="")return{isValid:!1,errors:["Event type is required"]};if(!eZ.includes(t.eventType))return{isValid:!1,errors:["Invalid event type"]};if(t.metadata!==void 0){if(typeof t.metadata!="object"||t.metadata===null)return{isValid:!1,errors:["Metadata must be an object"]};let e=Object.keys(t.metadata).map(i=>i.toLowerCase());for(let i of tZ)if(e.some(r=>r.includes(i)))return{isValid:!1,errors:["Sensitive information detected in metadata"]}}return{isValid:!0}}function os(t,e,i){g.warn({msg:"Validation error occurred",function:t,error:i,input:JSON.stringify(e)})}var Zx,ZQ,eZ,tZ,_A=R(()=>{"use strict";ye();Zx={directoryTraversal:[/\.\./,/~\//,/\.\.\\/,/C:\\Windows/i,/\/etc\/passwd/i,/%2e%2e%2f/i,/%252f/i,/%c0%af/i],commandInjection:[/[;&|`$(){}[\]<>*?]/,/\$\(/,/`[^`]*`/,/\$\{[^}]*\}/,/&&/,/\|\|/],sqlInjection:[/['";]/,/\bDROP\s+TABLE\b/i,/\bUNION\s+SELECT\b/i,/\bWAITFOR\s+DELAY\b/i,/\bOR\s+['"]?1['"]?\s*=\s*['"]?1['"]?/i],xss:[/<script[^>]*>/i,/javascript:/i,/onerror\s*=/i,/onload\s*=/i,/alert\s*\(/i,/"><script/i,/'><script/i],templateInjection:[/\$\{[^}]*\}/,/\{\{[^}]*\}\}/,/<%[^%]*%>/,/\$\{process\.env\}/i],nosqlInjection:[/\{\s*['"]\$gt['"]\s*:/,/\{\s*['"]\$ne['"]\s*:/,/\{\s*['"]\$where['"]\s*:/],ldapInjection:[/\*\)\(uid=\*\)\)\(\|\(uid=\*/,/\*\)\(\|\(objectclass=\*/,/\*\)\(\|\(password=\*/],xmlInjection:[/<!DOCTYPE[^>]*>/i,/<!ENTITY[^>]*>/i,/<\?xml[^>]*>/i],nullByte:[/\0/,/%00/,/\u0000/],unicodeNormalization:[/fi/,/[\u0300-\u036F]/],homograph:[/[а-я]/i]},ZQ=["http:","https:"],eZ=["test","execution","error","warning","info"],tZ=["password","apikey","token","secret","key","auth"]});var Y=R(()=>{"use strict";Ea();E0();b0();np();c6();qg();Tr();Ri();u6();_0();C0();Jx();EA();ye();ei();Zu();Hu();SA();xo();na();w0();tl();ip();_A();Rg();Bu();ra();ye();ei();Zu();Hu();E0();na();Tr();Ri();Ea();xn();Jx();Kl();Xl()});var Nd=y((A1e,rZ)=>{rZ.exports={name:"x-fidelity",version:"4.1.3",description:"CLI tool for opinionated framework adherence checks with performance optimizations and caching",main:"dist/index",types:"dist/index.d.ts",private:!1,bin:{xfidelity:"./dist/xfidelity"},files:["dist/**/*","README.md","LICENSE"],module:"dist/index.js",exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./*":"./dist/*"},scripts:{clean:"rimraf dist/",prebuild:"yarn clean",build:"yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && node esbuild.config.js","build:production":"yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && node esbuild.config.js --production","build:fresh":"yarn workspaces run clean && yarn build",prepublishOnly:"yarn build:production","build:watch":"node esbuild.config.js --watch",start:"NODE_ENV=test OPENAI_API_KEY= jest --watch",test:"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --testPathIgnorePatterns=vscode-extension","test:unit":"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --testPathIgnorePatterns=vscode-extension","test:integration":"cd ../../ && yarn workspace @x-fidelity/types build && yarn workspace @x-fidelity/core build && yarn workspace @x-fidelity/plugins build && cd packages/x-fidelity-cli && NODE_ENV=test yarn lint:fix && NODE_ENV=test OPENAI_API_KEY= jest --config jest.integration.config.js","test:all":"yarn test:unit && yarn test:integration","test:coverage":"NODE_ENV=test OPENAI_API_KEY= jest --coverage",commit:"yarn test && git-cz",release:"yarn semantic-release","test-bin-install":"yarn build && npm link","build-run":"yarn build && node . --dir ../x-fidelity-fixtures/node-fullstack | jq -R -r '. as $line | try fromjson catch $line' ","start-server":"ts-node src/index.ts --mode server",lint:"eslint .","lint:fix":"eslint . --fix","perftest:install":"npm install -g artillery",perftest:"perftest:install && artillery run src/server/configServer.performance.test.yml","perftest:cloud":"perftest:install && echo 'expecting env var ARTILLERY_CLOUD_API_KEY from artillery.io' && artillery run src/server/configServer.performance.test.yml --record","bats:install":"cd ./cli-testing && ./installBatsTesting.sh","bats:test":"cd ./cli-testing && bats *.bats","validate-demo-config":"yarn build && node . --dir ../x-fidelity-fixtures/node-fullstack -x node-fullstack -o true","global:setup":"cd ../../global-install-testing && ./scripts/setup-test-env.sh","global:test:published":"yarn build:fresh && yarn global:setup && cd ../../global-install-testing && ./scripts/test-published.sh","global:test:local":"yarn build:fresh && yarn global:setup && cd ../../global-install-testing && ./scripts/test-local.sh","global:test":"yarn global:test:local && yarn global:test:published"},repository:"git@github.com:zotoio/x-fidelity.git",author:"wyvern8 <io@zoto.io>",license:"MIT",engines:{node:">=22.16.0",yarn:">=1.22.0"},devDependencies:{"@jest/globals":"^30.0.2","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^11.0.3","@semantic-release/npm":"^12.0.1","@semantic-release/release-notes-generator":"^14.0.3","@types/cli-progress":"^3.11.6","@types/fs-extra":"^11.0.4","@types/inquirer":"^9.0.7","@types/jest":"^30.0.0","@types/js-yaml":"^4.0.9","@types/lodash":"^4.17.13","@types/node":"^22.10.5","@types/uuid":"^10.0.0","@types/yauzl":"^2.10.3","@typescript-eslint/eslint-plugin":"^8.35.0","@typescript-eslint/parser":"^8.35.0",commitizen:"^4.3.1","conventional-changelog-conventionalcommits":"^8.0.0","cz-conventional-changelog":"^3.3.0",eslint:"^9.29.0",jest:"^30.0.2",nodemon:"^3.1.9",rimraf:"^6.0.1","semantic-release":"^24.2.5","ts-jest":"^29.4.0","ts-node":"^10.9.2",typescript:"^5.7.2","@x-fidelity/core":"file:../x-fidelity-core","@x-fidelity/types":"file:../x-fidelity-types","@x-fidelity/plugins":"file:../x-fidelity-plugins","@x-fidelity/server":"file:../x-fidelity-server","@x-fidelity/democonfig":"file:../x-fidelity-democonfig",esbuild:"^0.25.5"},dependencies:{commander:"^14.0.0","fs-extra":"^11.3.0",glob:"11.0.3",ora:"^8.2.0",prettyjson:"^1.2.5",pino:"^9.7.0","pino-pretty":"^13.0.0",chokidar:"^3.6.0","tree-sitter":"^0.22.4","tree-sitter-javascript":"^0.23.1","tree-sitter-typescript":"^0.23.2","@babel/parser":"^7.23.0","@babel/types":"^7.23.0","@yarnpkg/lockfile":"^1.1.0",axios:"^1.8.1",dotenv:"^16.4.7",esprima:"^4.0.1",lodash:"^4.17.21",openai:"^4.86.1",semver:"^7.7.1"},config:{commitizen:{path:"./node_modules/cz-conventional-changelog"}},publishConfig:{access:"public"}}});var Xi=y((T1e,TA)=>{var nZ=require("path").relative;TA.exports=uZ;var aZ=process.cwd();function PA(t,e){for(var i=t.split(/[ ,]+/),r=String(e).toLowerCase(),n=0;n<i.length;n++){var a=i[n];if(a&&(a==="*"||a.toLowerCase()===r))return!0}return!1}function sZ(t,e,i){var r=Object.getOwnPropertyDescriptor(t,e),n=r.value;return r.get=function(){return n},r.writable&&(r.set=function(s){return n=s}),delete r.value,delete r.writable,Object.defineProperty(t,e,r),r}function oZ(t){for(var e="",i=0;i<t;i++)e+=", arg"+i;return e.substr(2)}function cZ(t){var e=this.name+": "+this.namespace;this.message&&(e+=" deprecated "+this.message);for(var i=0;i<t.length;i++)e+=`
|
|
358
358
|
at `+t[i].toString();return e}function uZ(t){if(!t)throw new TypeError("argument namespace is required");var e=Dd(),i=cs(e[1]),r=i[0];function n(a){$d.call(n,a)}return n._file=r,n._ignored=pZ(t),n._namespace=t,n._traced=dZ(t),n._warned=Object.create(null),n.function=gZ,n.property=vZ,n}function lZ(t,e){var i=typeof t.listenerCount!="function"?t.listeners(e).length:t.listenerCount(e);return i>0}function pZ(t){if(process.noDeprecation)return!0;var e=process.env.NO_DEPRECATION||"";return PA(e,t)}function dZ(t){if(process.traceDeprecation)return!0;var e=process.env.TRACE_DEPRECATION||"";return PA(e,t)}function $d(t,e){var i=lZ(process,"deprecation");if(!(!i&&this._ignored)){var r,n,a,s,o=0,c=!1,u=Dd(),l=this._file;for(e?(s=e,a=cs(u[1]),a.name=s.name,l=a[0]):(o=2,s=cs(u[o]),a=s);o<u.length;o++)if(r=cs(u[o]),n=r[0],n===l)c=!0;else if(n===this._file)l=this._file;else if(c)break;var p=r?s.join(":")+"__"+r.join(":"):void 0;if(!(p!==void 0&&p in this._warned)){this._warned[p]=!0;var d=t;if(d||(d=a===s||!a.name?CA(s):CA(a)),i){var f=AA(this._namespace,d,u.slice(o));process.emit("deprecation",f);return}var h=process.stderr.isTTY?mZ:fZ,m=h.call(this,d,r,u.slice(o));process.stderr.write(m+`
|
|
359
359
|
`,"utf8")}}}function cs(t){var e=t.getFileName()||"<anonymous>",i=t.getLineNumber(),r=t.getColumnNumber();t.isEval()&&(e=t.getEvalOrigin()+", "+e);var n=[e,i,r];return n.callSite=t,n.name=t.getFunctionName(),n}function CA(t){var e=t.callSite,i=t.name;i||(i="<anonymous@"+eb(t)+">");var r=e.getThis(),n=r&&e.getTypeName();return n==="Object"&&(n=void 0),n==="Function"&&(n=r.name||n),n&&e.getMethodName()?n+"."+i:i}function fZ(t,e,i){var r=new Date().toUTCString(),n=r+" "+this._namespace+" deprecated "+t;if(this._traced){for(var a=0;a<i.length;a++)n+=`
|
|
360
360
|
at `+i[a].toString();return n}return e&&(n+=" at "+eb(e)),n}function mZ(t,e,i){var r="\x1B[36;1m"+this._namespace+"\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m"+t+"\x1B[39m";if(this._traced){for(var n=0;n<i.length;n++)r+=`
|