UNPKG

meta-cloud-api

Version:
3 lines 3 kB
import {readFileSync}from'fs';import {join}from'path';var s=class{name;debug;constructor(t,o=false){this.name=t,this.debug=o;}log(...t){if(this.debug){let o=`[ ${Date.now()} ]`;this.name&&(o+=` - ${this.name}`),console.log.apply(console,[o,": ",...t]);}}error(...t){let o=`[ ${Date.now()} ] - ERROR`;this.name&&(o+=` - ${this.name}`),console.error.apply(console,[o,": ",...t]);}warn(...t){let o=`[ ${Date.now()} ] - WARN`;this.name&&(o+=` - ${this.name}`),console.warn.apply(console,[o,": ",...t]);}info(...t){let o=`[ ${Date.now()} ] - INFO`;this.name&&(o+=` - ${this.name}`),console.info.apply(console,[o,": ",...t]);}};function y(e){let t=[["App ID",e.M4D_APP_ID||"Not Set"],["Phone Number ID",e.WA_PHONE_NUMBER_ID?.toString()||"Not Set"],["Business Account ID",e.WA_BUSINESS_ACCOUNT_ID||"Not Set"],["API Version",e.CLOUD_API_VERSION||"Not Set"],["Access Token",e.CLOUD_API_ACCESS_TOKEN?`${e.CLOUD_API_ACCESS_TOKEN.substring(0,20)}...`:"Not Set"],["Webhook Endpoint",e.WEBHOOK_ENDPOINT||"Not Set"],["Webhook Verification Token",e.WEBHOOK_VERIFICATION_TOKEN?`${e.WEBHOOK_VERIFICATION_TOKEN.substring(0,10)}...`:"Not Set"],["Listener Port",e.LISTENER_PORT?.toString()||"Not Set"],["Debug Mode",e.DEBUG?"Enabled":"Disabled"],["Max Retries",e.MAX_RETRIES_AFTER_WAIT?.toString()||"Not Set"],["Request Timeout",e.REQUEST_TIMEOUT?`${e.REQUEST_TIMEOUT}ms`:"Not Set"],["Private PEM",e.FLOW_API_PRIVATE_PEM?"Configured":"Not Set"],["Passphrase",e.FLOW_API_PASSPHRASE?"Configured":"Not Set"]],o=Math.max(...t.map(([a])=>a?.length||0)),i=Math.max(...t.map(([,a])=>a?.length||0)),r=Math.max(o,20),n=Math.max(i,30),p=`\u250C${"\u2500".repeat(r+2)}\u252C${"\u2500".repeat(n+2)}\u2510`,c=`\u251C${"\u2500".repeat(r+2)}\u253C${"\u2500".repeat(n+2)}\u2524`,d=`\u2514${"\u2500".repeat(r+2)}\u2534${"\u2500".repeat(n+2)}\u2518`,m=`\u2502 ${"Configuration".padEnd(r)} \u2502 ${"Value".padEnd(n)} \u2502`,u=t.map(([a,l])=>`\u2502 ${a?.padEnd(r)} \u2502 ${l?.padEnd(n)} \u2502`);return [p,m,c,...u,d].join(` `)}function x(e){return e!=null&&typeof e=="object"&&"error"in e&&typeof e.error=="object"&&e.error!=null&&"message"in e.error&&typeof e.error.message=="string"&&"type"in e.error&&typeof e.error.type=="string"&&"code"in e.error&&typeof e.error.code=="number"&&"fbtrace_id"in e.error&&typeof e.error.fbtrace_id=="string"&&(!("error_data"in e.error)||typeof e.error.error_data=="object"&&e.error.error_data!=null&&"messaging_product"in e.error.error_data&&e.error.error_data.messaging_product==="whatsapp"&&"details"in e.error.error_data&&typeof e.error.error_data.details=="string")&&(!("error_subcode"in e.error)||typeof e.error.error_subcode=="number")}function h(){try{let e=join(__dirname,"../../package.json");return JSON.parse(readFileSync(e,"utf-8")).version}catch{return "unknown"}}function k(){let e=h(),t=process.version;return `WhatsApp-Nodejs-SDK/${e} (Node.js ${t})`}export{s as a,y as b,x as c,h as d,k as e};//# sourceMappingURL=chunk-FKXSL2JK.js.map //# sourceMappingURL=chunk-FKXSL2JK.js.map