meta-cloud-api 0.2.22 → 0.2.24
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/{chunk-EYGUX4EA.js → chunk-2NCV35XS.js} +2 -2
- package/dist/{chunk-EYGUX4EA.js.map → chunk-2NCV35XS.js.map} +1 -1
- package/dist/chunk-FYHBS7Q5.js +4 -0
- package/dist/chunk-FYHBS7Q5.js.map +1 -0
- package/dist/chunk-M2GC5VFJ.js +2 -0
- package/dist/{chunk-4C666HHU.js.map → chunk-M2GC5VFJ.js.map} +1 -1
- package/dist/{chunk-BSNA6RYF.js → chunk-XQDM2WBV.js} +3 -3
- package/dist/{chunk-BSNA6RYF.js.map → chunk-XQDM2WBV.js.map} +1 -1
- package/dist/core/webhook/index.d.ts +191 -10
- package/dist/core/webhook/index.js +1 -1
- package/dist/core/whatsapp/index.js +1 -1
- package/dist/features/encryption/index.js +1 -1
- package/dist/features/flow/index.js +1 -1
- package/dist/features/media/index.js +1 -1
- package/dist/features/messages/index.js +1 -1
- package/dist/features/phone/index.js +1 -1
- package/dist/features/profile/index.js +1 -1
- package/dist/features/qrCode/index.js +1 -1
- package/dist/features/registration/index.js +1 -1
- package/dist/features/template/index.js +1 -1
- package/dist/features/twoStepVerification/index.js +1 -1
- package/dist/features/waba/index.js +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/shared/types/enums.js +1 -1
- package/dist/shared/utils/isMetaError.js +1 -1
- package/package.json +43 -1
- package/dist/chunk-2QZCD34C.js +0 -3
- package/dist/chunk-2QZCD34C.js.map +0 -1
- package/dist/chunk-4C666HHU.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var F=Object.create;var p=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var C=(a,b)=>(b=Symbol[a])?b:Symbol.for("Symbol."+a),o=a=>{throw TypeError(a)};var H=(a,b,c)=>b in a?p(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c;var z=(a,b)=>p(a,"name",{value:b,configurable:true});var M=(a,b)=>{for(var c in b)p(a,c,{get:b[c],enumerable:true});};var N=a=>[,,,F(a?.[C("metadata")]??null)],D=["class","method","getter","setter","accessor","field","value","get","set"],n=a=>a!==void 0&&typeof a!="function"?o("Function expected"):a,I=(a,b,c,i,e)=>({kind:D[a],name:b,metadata:i,addInitializer:f=>c._?o("Already initialized"):e.push(n(f||null))}),J=(a,b)=>H(b,C("metadata"),a[3]),O=(a,b,c,i)=>{for(var e=0,f=a[b>>1],l=f&&f.length;e<l;e++)b&1?f[e].call(c):i=f[e].call(c,i);return i},P=(a,b,c,i,e,f)=>{var l,h,w,m,q,d=b&7,r=!!(b&8),k=!!(b&16),s=d>3?a.length+1:d?r?1:2:0,x=D[d+5],y=d>3&&(a[s-1]=[]),E=a[s]||(a[s]=[]),j=d&&(!k&&!r&&(e=e.prototype),d<5&&(d>3||!k)&&G(d<4?e:{get[c](){return A(this,f)},set[c](g){return B(this,f,g)}},c));d?k&&d<4&&z(f,(d>2?"set ":d>1?"get ":"")+c):z(e,c);for(var t=i.length-1;t>=0;t--)m=I(d,c,w={},a[3],E),d&&(m.static=r,m.private=k,q=m.access={has:k?g=>K(e,g):g=>c in g},d^3&&(q.get=k?g=>(d^1?A:L)(g,e,d^4?f:j.get):g=>g[c]),d>2&&(q.set=k?(g,u)=>B(g,e,u,d^4?f:j.set):(g,u)=>g[c]=u)),h=(0, i[t])(d?d<4?k?f:j[x]:d>4?void 0:{get:j.get,set:j.set}:e,m),w._=1,d^4||h===void 0?n(h)&&(d>4?y.unshift(h):d?k?f=h:j[x]=h:e=h):typeof h!="object"||h===null?o("Object expected"):(n(l=h.get)&&(j.get=l),n(l=h.set)&&(j.set=l),n(l=h.init)&&y.unshift(l));return d||J(a,e),j&&p(e,c,j),k?d^4?f:j:e};var v=(a,b,c)=>b.has(a)||o("Cannot "+c),K=(a,b)=>Object(b)!==b?o('Cannot use the "in" operator on this value'):a.has(b),A=(a,b,c)=>(v(a,b,"read from private field"),c?c.call(a):b.get(a));var B=(a,b,c,i)=>(v(a,b,"write to private field"),i?i.call(a,c):b.set(a,c),c),L=(a,b,c)=>(v(a,b,"access private method"),c);export{M as a,N as b,O as c,P as d};//# sourceMappingURL=chunk-M2GC5VFJ.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-M2GC5VFJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-M2GC5VFJ.js"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {a as a$3}from'./chunk-3MO3BTBC.js';import {a as a$1}from'./chunk-R36L2XYO.js';import {a as a$2}from'./chunk-GT3XQN7Y.js';import {b as b$4}from'./chunk-O2OTHNWM.js';import {b as b$2}from'./chunk-7NQLQPLH.js';import {b as b$3}from'./chunk-UQPD6GIF.js';import {b as b$6}from'./chunk-5JGM556C.js';import {b}from'./chunk-2NJVBJUN.js';import {b as b$5}from'./chunk-XPPDOFBN.js';import {b as b$8}from'./chunk-KFPOVYEJ.js';import {b as b$7}from'./chunk-A264MT4Q.js';import {b as b$1}from'./chunk-GIQLIMOD.js';import {a}from'./chunk-VW3LGHTJ.js';import {z}from'./chunk-
|
|
2
|
-
export{N as a,l as b};//# sourceMappingURL=chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a as a$3}from'./chunk-3MO3BTBC.js';import {a as a$1}from'./chunk-R36L2XYO.js';import {a as a$2}from'./chunk-GT3XQN7Y.js';import {b as b$4}from'./chunk-O2OTHNWM.js';import {b as b$2}from'./chunk-7NQLQPLH.js';import {b as b$3}from'./chunk-UQPD6GIF.js';import {b as b$6}from'./chunk-5JGM556C.js';import {b}from'./chunk-2NJVBJUN.js';import {b as b$5}from'./chunk-XPPDOFBN.js';import {b as b$8}from'./chunk-KFPOVYEJ.js';import {b as b$7}from'./chunk-A264MT4Q.js';import {b as b$1}from'./chunk-GIQLIMOD.js';import {a}from'./chunk-VW3LGHTJ.js';import {z}from'./chunk-2NCV35XS.js';import {Agent}from'https';var D="UTILS",M=false,W=new a(D,process.env.DEBUG==="true"||M),U=3e3,k=30,q=2e4,v=s=>{if(!process.env.CLOUD_API_ACCESS_TOKEN&&!s?.accessToken)throw W.log("Environmental variable: CLOUD_API_ACCESS_TOKEN and/or access token argument is undefined."),new Error("Missing WhatsApp access token.")},N=s=>{v(s);let e={M4D_APP_ID:s?.appId||process.env.M4D_APP_ID||"",M4D_APP_SECRET:s?.appSecret||process.env.M4D_APP_SECRET||"",WA_PHONE_NUMBER_ID:s?.phoneNumberId||Number(process.env.WA_PHONE_NUMBER_ID),WA_BUSINESS_ACCOUNT_ID:s?.businessAcctId||process.env.WA_BUSINESS_ACCOUNT_ID||"",CLOUD_API_VERSION:s?.apiVersion||process.env.CLOUD_API_VERSION||"",CLOUD_API_ACCESS_TOKEN:s?.accessToken||process.env.CLOUD_API_ACCESS_TOKEN||"",WEBHOOK_ENDPOINT:s?.webhookEndpoint||process.env.WEBHOOK_ENDPOINT||"",WEBHOOK_VERIFICATION_TOKEN:s?.webhookVerificationToken||process.env.WEBHOOK_VERIFICATION_TOKEN||"",LISTENER_PORT:s?.listenerPort||parseInt(process.env.LISTENER_PORT||"")||U,MAX_RETRIES_AFTER_WAIT:s?.maxRetriesAfterWait||parseInt(process.env.MAX_RETRIES_AFTER_WAIT||"")||k,REQUEST_TIMEOUT:s?.requestTimeout||parseInt(process.env.REQUEST_TIMEOUT||"")||q,DEBUG:s?.debug||process.env.DEBUG==="true",FLOW_API_PRIVATE_PEM:s?.privatePem||process.env.FLOW_API_PRIVATE_PEM||"",FLOW_API_PASSPHRASE:s?.passphrase||process.env.FLOW_API_PASSPHRASE||""};return W.log(`Configuration loaded for App Id ${e.M4D_APP_ID}`),e};var B="HttpsClient",$=false,L=new a(B,process.env.DEBUG==="true"||$),u=class{agent;constructor(){this.agent=new Agent({keepAlive:true});}clearSockets(){return this.agent.destroy(),true}async sendRequest(e,r,t,o,i,m){let a=`https://${e}/${r}`,g=new AbortController,n=setTimeout(()=>g.abort(),i);try{let p=await fetch(a,{method:t,headers:o,body:m,signal:g.signal});return L.log(`${t} : ${a} - ${JSON.stringify(p)}`),clearTimeout(n),new A(p)}catch(p){throw L.error(`${t} : ${a} - ${JSON.stringify(p)}`),p}}},A=class{res;respStatusCode;respHeaders;constructor(e){this.res=e,this.respStatusCode=e.status,this.respHeaders=Object.fromEntries(e.headers.entries());}statusCode(){return this.respStatusCode}headers(){return this.respHeaders}rawResponse(){return this.res}async json(){try{return await this.res.json()}catch(e){throw new Error("Failed to parse response body to JSON: "+e.message)}}};var G="REQUESTER",K=false,F=new a(G,process.env.DEBUG==="true"||K),d=class{client;accessToken;phoneNumberId;businessAcctId;apiVersion;userAgent;host;protocol="https:";constructor(e,r,t,o,i){this.client=new u,this.host="graph.facebook.com",this.apiVersion=e||"22",this.phoneNumberId=r,this.accessToken=t,this.businessAcctId=o,this.userAgent=i;}buildHeader(e,r){let t={Authorization:`Bearer ${this.accessToken}`,"User-Agent":this.userAgent};return e!=="multipart/form-data"&&(t["Content-Type"]=e),r&&Object.assign(t,r),t}buildCAPIPath(e){return `v${this.apiVersion}.0/${e}`}async sendRequest(e,r,t,o,i="application/json",m){let a=i;o instanceof FormData?a="multipart/form-data":typeof o=="string"&&o.startsWith("<?xml")&&(a="application/xml");let g=`${this.protocol.toLowerCase()}//${this.host}/${this.buildCAPIPath(r)}`;F.log(`${e} : ${g} (${a})`);try{let n=await this.client.sendRequest(this.host,this.buildCAPIPath(r),e,this.buildHeader(a,m),t,e==="POST"||e==="PUT"?o:void 0);if(!n.rawResponse().ok){let p=await n.json();throw a$3(p)?p:{name:"MetaError",message:"Unknown error occurred",error:{message:p.message||"Unknown error occurred",type:"UnknownError",code:n.statusCode(),fbtrace_id:""}}}return n}catch(n){throw a$3(n)?n:{name:"MetaError",message:n instanceof Error?n.message:"Network error occurred",error:{message:n instanceof Error?n.message:"Network error occurred",type:"NetworkError",code:500,fbtrace_id:""}}}}async getJson(e,r,t,o,i){return await(await this.sendRequest(e,r,t,o,"application/json",i)).json()}async sendFormData(e,r,t,o,i){return await(await this.sendRequest(e,r,t,o,"multipart/form-data",i)).json()}async sendUrlEncodedForm(e,r,t,o,i){let m=new URLSearchParams(o).toString();return await(await this.sendRequest(e,r,t,m,"application/x-www-form-urlencoded",i)).json()}};var V="WHATSAPP",x=false,h=new a(V,process.env.DEBUG==="true"||x),j="WA_SDK",l=class{config;requester;messages;templates;phoneNumber;qrCode;encryption;twoStepVerification;registration;media;waba;flow;businessProfile;static Enums=z;constructor(e){this.config=N(e),this.requester=new d(this.config.CLOUD_API_VERSION,this.config.WA_PHONE_NUMBER_ID,this.config.CLOUD_API_ACCESS_TOKEN,this.config.WA_BUSINESS_ACCOUNT_ID,this.userAgent()),this.messages=new b(this.config,this.requester),this.templates=new a$1(this.config,this.requester),this.phoneNumber=new b$1(this.config,this.requester),this.qrCode=new a$2(this.config,this.requester),this.encryption=new b$2(this.config,this.requester),this.twoStepVerification=new b$3(this.config,this.requester),this.registration=new b$4(this.config,this.requester),this.media=new b$5(this.config,this.requester),this.waba=new b$6(this.config,this.requester),this.flow=new b$7(this.config,this.requester),this.businessProfile=new b$8(this.config,this.requester),h.log("WhatsApp Node.js SDK instantiated!");}userAgent(){return `${j}/0.0.1 (Node.js ${process.version})`}updateTimeout(e){return this.config.REQUEST_TIMEOUT=e,h.log(`Updated request timeout to ${e}ms`),true}updatePhoneNumberId(e){return this.config.WA_PHONE_NUMBER_ID=e,h.log(`Updated sender phone number id to ${e}`),true}updateAccessToken(e){return this.config.CLOUD_API_ACCESS_TOKEN=e,h.log("Updated access token"),true}updateWabaId(e){return this.config.WA_BUSINESS_ACCOUNT_ID=e,h.log(`Updated business account id to ${e}`),true}};
|
|
2
|
+
export{N as a,l as b};//# sourceMappingURL=chunk-XQDM2WBV.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-XQDM2WBV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shared/config/importConfig.ts","../src/shared/http/httpsClient.ts","../src/shared/http/request.ts","../src/core/whatsapp/WhatsApp.ts"],"names":["LIB_NAME","LOG_LOCAL","LOGGER","Logger","DEFAULT_LISTENER_PORT","DEFAULT_MAX_RETRIES_AFTER_WAIT","DEFAULT_REQUEST_TIMEOUT","emptyConfigChecker","config","importConfig","inputConfig","wabaConfig","HttpsClient","Agent","hostname","path","method","headers","timeout","body","url","controller","timeoutId","response","HttpsClientResponse","error","resp","err","Requester","apiVersion","phoneNumberId","accessToken","businessAcctId","userAgent","contentType","additionalHeaders","endpoint","effectiveContentType","errorData","isMetaError","formData","urlEncodedBody","headerPrefix","WhatsApp","enums_exports","messages_default","TemplateApi","phone_default","QrCodeApi","encryption_default","twoStepVerification_default","registration_default","media_default","waba_default","flow_default","profile_default","ms","wabaId"],"mappings":"+lBAIMA,IAAAA,CAAAA,CAAW,OACXC,CAAAA,CAAAA,CAAY,KACZC,CAAAA,CAAAA,CAAS,IAAIC,CAAOH,CAAAA,CAAAA,CAAU,OAAQ,CAAA,GAAA,CAAI,KAAU,GAAA,MAAA,EAAUC,CAAS,CACvEG,CAAAA,CAAAA,CAAwB,GACxBC,CAAAA,CAAAA,CAAiC,EACjCC,CAAAA,CAAAA,CAA0B,GAE1BC,CAAAA,CAAAA,CAAsBC,CAAuC,EAAA,CAC/D,GAAI,CAAC,OAAQ,CAAA,GAAA,CAAI,wBAA+B,CAACA,CAAAA,EAAQ,WACrD,CAAA,MAAAN,CAAO,CAAA,GAAA,CAAI,2FAA2F,CAChG,CAAA,IAAI,KAAM,CAAA,gCAAgC,CAExD,CAAA,CAEaO,EAAgBC,CAAiC,EAAA,CAC1DH,CAAmBG,CAAAA,CAAW,CAE9B,CAAA,IAAMC,CAA6B,CAAA,CAC9B,UAAuBD,CAAAA,CAAAA,E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AK,CAAA,SAAS,CACnD,CAAA,IAAA,CAAK,eAAkB,CAAA,IAAIC,GAAmB,CAAA,IAAA,CAAK,MAAQ,CAAA,IAAA,CAAK,SAAS,CAAA,CACzErD,EAAO,GAAI,CAAA,oCAAoC,EACnD,CAEQ,SAAoB,EAAA,CAExB,OADwB,CAAA,EAAGwC,CAAY,CAAA,gBAAA,EAAwB,OAAQ,CAAA,OAAO,CAElF,CAAA,CAAA,CAEA,cAAcc,CAAqB,CAAA,CAC/B,OAAK,IAAA,CAAA,MAAA,CAAO,eAA0CA,CAAAA,CAAAA,CACtDtD,EAAO,GAAI,CAAA,CAAA,2BAAA,EAA8BsD,CAAE,CAAA,EAAA,CAAI,CACxC,CAAA,IACX,CAEA,mBAAoB1B,CAAAA,CAAAA,CAAgC,CAChD,OAAA,IAAA,CAAK,MAAO,CAAA,kBAAA,CAAyCA,CACrD5B,CAAAA,CAAAA,CAAO,GAAI,CAAA,CAAA,kCAAA,EAAqC4B,CAAa,CAAA,CAAE,CACxD,CAAA,IACX,CAEA,iBAAkBC,CAAAA,CAAAA,CAA8B,CAC5C,OAAA,IAAA,CAAK,MAAO,CAAA,sBAAA,CAAuCA,CACnD7B,CAAAA,CAAAA,CAAO,GAAI,CAAA,sBAAsB,CAC1B,CAAA,IACX,CAEA,YAAA,CAAauD,EAAyB,CAClC,OAAA,IAAA,CAAK,MAAO,CAAA,sBAAA,CAA0CA,CACtDvD,CAAAA,CAAAA,CAAO,GAAI,CAAA,CAAA,+BAAA,EAAkCuD,CAAM,CAAA,CAAE,CAC9C,CAAA,IACX,CACJ","file":"chunk-BSNA6RYF.js","sourcesContent":["import type { WabaConfigType, WhatsAppConfig } from '../types/config';\nimport { WabaConfigEnum } from '../types/enums';\nimport Logger from '../utils/logger';\n\nconst LIB_NAME = 'UTILS';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\nconst DEFAULT_LISTENER_PORT = 3000;\nconst DEFAULT_MAX_RETRIES_AFTER_WAIT = 30;\nconst DEFAULT_REQUEST_TIMEOUT = 20000;\n\nconst emptyConfigChecker = (config: WhatsAppConfig | undefined) => {\n if (!process.env[WabaConfigEnum.AccessToken] && !config?.accessToken) {\n LOGGER.log(`Environmental variable: CLOUD_API_ACCESS_TOKEN and/or access token argument is undefined.`);\n throw new Error('Missing WhatsApp access token.');\n }\n};\n\nexport const importConfig = (inputConfig?: WhatsAppConfig) => {\n emptyConfigChecker(inputConfig);\n\n const wabaConfig: WabaConfigType = {\n [WabaConfigEnum.AppId]: inputConfig?.appId || process.env.M4D_APP_ID || '',\n [WabaConfigEnum.AppSecret]: inputConfig?.appSecret || process.env.M4D_APP_SECRET || '',\n [WabaConfigEnum.PhoneNumberId]: inputConfig?.phoneNumberId || Number(process.env.WA_PHONE_NUMBER_ID),\n [WabaConfigEnum.BusinessAcctId]: inputConfig?.businessAcctId || process.env.WA_BUSINESS_ACCOUNT_ID || '',\n [WabaConfigEnum.APIVersion]: inputConfig?.apiVersion || process.env.CLOUD_API_VERSION || '',\n [WabaConfigEnum.AccessToken]: inputConfig?.accessToken || process.env.CLOUD_API_ACCESS_TOKEN || '',\n [WabaConfigEnum.WebhookEndpoint]: inputConfig?.webhookEndpoint || process.env.WEBHOOK_ENDPOINT || '',\n [WabaConfigEnum.WebhookVerificationToken]:\n inputConfig?.webhookVerificationToken || process.env.WEBHOOK_VERIFICATION_TOKEN || '',\n [WabaConfigEnum.ListenerPort]:\n inputConfig?.listenerPort || parseInt(process.env.LISTENER_PORT || '') || DEFAULT_LISTENER_PORT,\n [WabaConfigEnum.MaxRetriesAfterWait]:\n inputConfig?.maxRetriesAfterWait ||\n parseInt(process.env.MAX_RETRIES_AFTER_WAIT || '') ||\n DEFAULT_MAX_RETRIES_AFTER_WAIT,\n [WabaConfigEnum.RequestTimeout]:\n inputConfig?.requestTimeout || parseInt(process.env.REQUEST_TIMEOUT || '') || DEFAULT_REQUEST_TIMEOUT,\n [WabaConfigEnum.Debug]: inputConfig?.debug || process.env.DEBUG === 'true',\n [WabaConfigEnum.PrivatePem]: inputConfig?.privatePem || process.env.FLOW_API_PRIVATE_PEM || '',\n [WabaConfigEnum.Passphrase]: inputConfig?.passphrase || process.env.FLOW_API_PASSPHRASE || '',\n };\n\n LOGGER.log(`Configuration loaded for App Id ${wabaConfig[WabaConfigEnum.AppId]}`);\n\n return wabaConfig;\n};\n","import { Agent } from 'https';\n\nimport { HttpMethodsEnum } from '../types/enums';\nimport { HttpsClientClass, HttpsClientResponseClass, ResponseHeaders, ResponseJSONBody } from '../types/httpsClient';\nimport Logger from '../utils/logger';\n\nconst LIB_NAME = 'HttpsClient';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class HttpsClient implements HttpsClientClass {\n agent: Agent;\n\n constructor() {\n this.agent = new Agent({ keepAlive: true });\n }\n\n clearSockets(): boolean {\n this.agent.destroy();\n return true;\n }\n\n async sendRequest(\n hostname: string,\n path: string,\n method: HttpMethodsEnum,\n headers: HeadersInit,\n timeout: number,\n body?: BodyInit | null,\n ): Promise<HttpsClientResponseClass> {\n const url = `https://${hostname}/${path}`;\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n try {\n const response = await fetch(url, {\n method,\n headers,\n body,\n signal: controller.signal,\n });\n LOGGER.log(`${method} : ${url} - ${JSON.stringify(response)}`);\n\n clearTimeout(timeoutId);\n return new HttpsClientResponse(response);\n } catch (error) {\n LOGGER.error(`${method} : ${url} - ${JSON.stringify(error)}`);\n throw error;\n }\n }\n}\n\nexport class HttpsClientResponse implements HttpsClientResponseClass {\n res: Response;\n respStatusCode: number;\n respHeaders: ResponseHeaders;\n\n constructor(resp: Response) {\n this.res = resp;\n this.respStatusCode = resp.status;\n this.respHeaders = Object.fromEntries(resp.headers.entries());\n }\n\n statusCode(): number {\n return this.respStatusCode;\n }\n\n headers(): ResponseHeaders {\n return this.respHeaders;\n }\n\n rawResponse(): Response {\n return this.res;\n }\n\n async json(): Promise<ResponseJSONBody> {\n try {\n return (await this.res.json()) as ResponseJSONBody;\n } catch (err) {\n // TODO Error Handling\n throw new Error('Failed to parse response body to JSON: ' + (err as Error).message);\n }\n }\n}\n","import type { HttpMethodsEnum } from '../types/enums';\nimport type { RequesterClass } from '../types/request';\nimport { isMetaError, MetaError } from '../utils/isMetaError';\nimport Logger from '../utils/logger';\nimport HttpsClient from './httpsClient';\n\nconst LIB_NAME = 'REQUESTER';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class Requester implements RequesterClass {\n client: Readonly<HttpsClient>;\n accessToken: Readonly<string>;\n phoneNumberId: Readonly<number>;\n businessAcctId: Readonly<string>;\n apiVersion: Readonly<string>;\n userAgent: Readonly<string>;\n host: Readonly<string>;\n protocol: Readonly<string> = 'https:';\n\n constructor(\n apiVersion: string,\n phoneNumberId: number,\n accessToken: string,\n businessAcctId: string,\n userAgent: string,\n ) {\n this.client = new HttpsClient();\n this.host = 'graph.facebook.com';\n this.apiVersion = apiVersion || '22';\n this.phoneNumberId = phoneNumberId;\n this.accessToken = accessToken;\n this.businessAcctId = businessAcctId;\n this.userAgent = userAgent;\n }\n\n buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit {\n const headers: HeadersInit = {\n Authorization: `Bearer ${this.accessToken}`,\n 'User-Agent': this.userAgent,\n };\n\n if (contentType !== 'multipart/form-data') {\n headers['Content-Type'] = contentType;\n }\n\n if (additionalHeaders) {\n Object.assign(headers, additionalHeaders);\n }\n\n return headers;\n }\n\n buildCAPIPath(endpoint: string): string {\n return `v${this.apiVersion}.0/${endpoint}`;\n }\n\n async sendRequest(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n body?: any,\n contentType: string = 'application/json',\n additionalHeaders?: Record<string, string>,\n ) {\n let effectiveContentType = contentType;\n\n if (body instanceof FormData) {\n effectiveContentType = 'multipart/form-data';\n } else if (typeof body === 'string' && body.startsWith('<?xml')) {\n effectiveContentType = 'application/xml';\n }\n\n const path = `${this.protocol.toLowerCase()}//${this.host}/${this.buildCAPIPath(endpoint)}`;\n\n LOGGER.log(`${method} : ${path} (${effectiveContentType})`);\n\n try {\n const response = await this.client.sendRequest(\n this.host,\n this.buildCAPIPath(endpoint),\n method,\n this.buildHeader(effectiveContentType, additionalHeaders),\n timeout,\n method === 'POST' || method === 'PUT' ? body : undefined,\n );\n\n if (!response.rawResponse().ok) {\n const errorData = await response.json();\n if (isMetaError(errorData)) {\n throw errorData;\n }\n // If the error doesn't match Meta's format, create a generic MetaError\n throw {\n name: 'MetaError',\n message: 'Unknown error occurred',\n error: {\n message: errorData.message || 'Unknown error occurred',\n type: 'UnknownError',\n code: response.statusCode(),\n fbtrace_id: '',\n },\n } as MetaError;\n }\n\n return response;\n } catch (error) {\n if (isMetaError(error)) {\n throw error;\n }\n // Handle network errors or other unexpected errors\n throw {\n name: 'MetaError',\n message: error instanceof Error ? error.message : 'Network error occurred',\n error: {\n message: error instanceof Error ? error.message : 'Network error occurred',\n type: 'NetworkError',\n code: 500,\n fbtrace_id: '',\n },\n } as MetaError;\n }\n }\n\n async getJson<T>(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n body?: any,\n additionalHeaders?: Record<string, string>,\n ): Promise<T> {\n const res = await this.sendRequest(method, endpoint, timeout, body, 'application/json', additionalHeaders);\n return (await res.json()) as T;\n }\n\n async sendFormData<T>(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n formData: FormData,\n additionalHeaders?: Record<string, string>,\n ): Promise<T> {\n const res = await this.sendRequest(\n method,\n endpoint,\n timeout,\n formData,\n 'multipart/form-data',\n additionalHeaders,\n );\n return (await res.json()) as T;\n }\n\n async sendUrlEncodedForm<T>(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n formData: Record<string, string>,\n additionalHeaders?: Record<string, string>,\n ): Promise<T> {\n const urlEncodedBody = new URLSearchParams(formData).toString();\n const res = await this.sendRequest(\n method,\n endpoint,\n timeout,\n urlEncodedBody,\n 'application/x-www-form-urlencoded',\n additionalHeaders,\n );\n return (await res.json()) as T;\n }\n}\n","import { WabaConfigType, WhatsAppConfig } from '@shared/types/config';\nimport * as SDKEnums from '@shared/types/enums';\nimport Logger from '@shared/utils/logger';\n\nimport EncryptionApi from '@features/encryption';\nimport FlowApi from '@features/flow';\nimport MediaApi from '@features/media';\nimport MessagesApi from '@features/messages';\nimport PhoneNumberApi from '@features/phone';\nimport BusinessProfileApi from '@features/profile';\nimport QrCodeApi from '@features/qrCode/QrCodeApi';\nimport RegistrationApi from '@features/registration';\nimport TemplateApi from '@features/template/TemplateApi';\nimport TwoStepVerificationApi from '@features/twoStepVerification';\nimport WabaApi from '@features/waba';\nimport { importConfig } from '@shared/config/importConfig';\nimport Requester from '@shared/http/request';\nimport { WhatsAppClass } from './types';\n\nconst LIB_NAME = 'WHATSAPP';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nconst headerPrefix = 'WA_SDK';\n\nexport default class WhatsApp implements WhatsAppClass {\n config: WabaConfigType;\n\n requester: Readonly<Requester>;\n\n readonly messages: MessagesApi;\n readonly templates: TemplateApi;\n readonly phoneNumber: PhoneNumberApi;\n readonly qrCode: QrCodeApi;\n readonly encryption: EncryptionApi;\n readonly twoStepVerification: TwoStepVerificationApi;\n readonly registration: RegistrationApi;\n readonly media: MediaApi;\n readonly waba: WabaApi;\n readonly flow: FlowApi;\n readonly businessProfile: BusinessProfileApi;\n static readonly Enums = SDKEnums;\n\n constructor(config?: WhatsAppConfig) {\n this.config = importConfig(config);\n this.requester = new Requester(\n this.config[SDKEnums.WabaConfigEnum.APIVersion],\n this.config[SDKEnums.WabaConfigEnum.PhoneNumberId],\n this.config[SDKEnums.WabaConfigEnum.AccessToken],\n this.config[SDKEnums.WabaConfigEnum.BusinessAcctId],\n this.userAgent(),\n );\n\n this.messages = new MessagesApi(this.config, this.requester);\n this.templates = new TemplateApi(this.config, this.requester);\n this.phoneNumber = new PhoneNumberApi(this.config, this.requester);\n this.qrCode = new QrCodeApi(this.config, this.requester);\n this.encryption = new EncryptionApi(this.config, this.requester);\n this.twoStepVerification = new TwoStepVerificationApi(this.config, this.requester);\n this.registration = new RegistrationApi(this.config, this.requester);\n this.media = new MediaApi(this.config, this.requester);\n this.waba = new WabaApi(this.config, this.requester);\n this.flow = new FlowApi(this.config, this.requester);\n this.businessProfile = new BusinessProfileApi(this.config, this.requester);\n LOGGER.log('WhatsApp Node.js SDK instantiated!');\n }\n\n private userAgent(): string {\n const userAgentString = `${headerPrefix}/${'0.0.1'} (Node.js ${process.version})`;\n return userAgentString;\n }\n\n updateTimeout(ms: number): boolean {\n this.config[SDKEnums.WabaConfigEnum.RequestTimeout] = ms;\n LOGGER.log(`Updated request timeout to ${ms}ms`);\n return true;\n }\n\n updatePhoneNumberId(phoneNumberId: number): boolean {\n this.config[SDKEnums.WabaConfigEnum.PhoneNumberId] = phoneNumberId;\n LOGGER.log(`Updated sender phone number id to ${phoneNumberId}`);\n return true;\n }\n\n updateAccessToken(accessToken: string): boolean {\n this.config[SDKEnums.WabaConfigEnum.AccessToken] = accessToken;\n LOGGER.log(`Updated access token`);\n return true;\n }\n\n updateWabaId(wabaId: string): boolean {\n this.config[SDKEnums.WabaConfigEnum.BusinessAcctId] = wabaId;\n LOGGER.log(`Updated business account id to ${wabaId}`);\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/shared/config/importConfig.ts","../src/shared/http/httpsClient.ts","../src/shared/http/request.ts","../src/core/whatsapp/WhatsApp.ts"],"names":["LIB_NAME","LOG_LOCAL","LOGGER","Logger","DEFAULT_LISTENER_PORT","DEFAULT_MAX_RETRIES_AFTER_WAIT","DEFAULT_REQUEST_TIMEOUT","emptyConfigChecker","config","importConfig","inputConfig","wabaConfig","HttpsClient","Agent","hostname","path","method","headers","timeout","body","url","controller","timeoutId","response","HttpsClientResponse","error","resp","err","Requester","apiVersion","phoneNumberId","accessToken","businessAcctId","userAgent","contentType","additionalHeaders","endpoint","effectiveContentType","errorData","isMetaError","formData","urlEncodedBody","headerPrefix","WhatsApp","enums_exports","messages_default","TemplateApi","phone_default","QrCodeApi","encryption_default","twoStepVerification_default","registration_default","media_default","waba_default","flow_default","profile_default","ms","wabaId"],"mappings":"+lBAIMA,IAAAA,CAAAA,CAAW,OACXC,CAAAA,CAAAA,CAAY,KACZC,CAAAA,CAAAA,CAAS,IAAIC,CAAOH,CAAAA,CAAAA,CAAU,OAAQ,CAAA,GAAA,CAAI,KAAU,GAAA,MAAA,EAAUC,CAAS,CACvEG,CAAAA,CAAAA,CAAwB,GACxBC,CAAAA,CAAAA,CAAiC,EACjCC,CAAAA,CAAAA,CAA0B,GAE1BC,CAAAA,CAAAA,CAAsBC,CAAuC,EAAA,CAC/D,GAAI,CAAC,OAAQ,CAAA,GAAA,CAAI,wBAA+B,CAACA,CAAAA,EAAQ,WACrD,CAAA,MAAAN,CAAO,CAAA,GAAA,CAAI,2FAA2F,CAChG,CAAA,IAAI,KAAM,CAAA,gCAAgC,CAExD,CAAA,CAEaO,EAAgBC,CAAiC,EAAA,CAC1DH,CAAmBG,CAAAA,CAAW,CAE9B,CAAA,IAAMC,CAA6B,CAAA,CAC9B,UAAuBD,CAAAA,CAAAA,EAAa,KAAS,EAAA,OAAA,CAAQ,GAAI,CAAA,UAAA,EAAc,GACvE,cAA2BA,CAAAA,CAAAA,EAAa,SAAa,EAAA,OAAA,CAAQ,GAAI,CAAA,cAAA,EAAkB,GACnF,kBAA+BA,CAAAA,CAAAA,EAAa,aAAiB,EAAA,MAAA,CAAO,OAAQ,CAAA,GAAA,CAAI,kBAAkB,CAClG,CAAA,sBAAA,CAAgCA,CAAa,EAAA,cAAA,EAAkB,OAAQ,CAAA,GAAA,CAAI,sBAA0B,EAAA,EAAA,CACrG,iBAA4BA,C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A,CAAAA,CACtDtD,EAAO,GAAI,CAAA,CAAA,2BAAA,EAA8BsD,CAAE,CAAA,EAAA,CAAI,CACxC,CAAA,IACX,CAEA,mBAAoB1B,CAAAA,CAAAA,CAAgC,CAChD,OAAA,IAAA,CAAK,MAAO,CAAA,kBAAA,CAAyCA,CACrD5B,CAAAA,CAAAA,CAAO,GAAI,CAAA,CAAA,kCAAA,EAAqC4B,CAAa,CAAA,CAAE,CACxD,CAAA,IACX,CAEA,iBAAkBC,CAAAA,CAAAA,CAA8B,CAC5C,OAAA,IAAA,CAAK,MAAO,CAAA,sBAAA,CAAuCA,CACnD7B,CAAAA,CAAAA,CAAO,GAAI,CAAA,sBAAsB,CAC1B,CAAA,IACX,CAEA,YAAA,CAAauD,EAAyB,CAClC,OAAA,IAAA,CAAK,MAAO,CAAA,sBAAA,CAA0CA,CACtDvD,CAAAA,CAAAA,CAAO,GAAI,CAAA,CAAA,+BAAA,EAAkCuD,CAAM,CAAA,CAAE,CAC9C,CAAA,IACX,CACJ","file":"chunk-XQDM2WBV.js","sourcesContent":["import type { WabaConfigType, WhatsAppConfig } from '../types/config';\nimport { WabaConfigEnum } from '../types/enums';\nimport Logger from '../utils/logger';\n\nconst LIB_NAME = 'UTILS';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\nconst DEFAULT_LISTENER_PORT = 3000;\nconst DEFAULT_MAX_RETRIES_AFTER_WAIT = 30;\nconst DEFAULT_REQUEST_TIMEOUT = 20000;\n\nconst emptyConfigChecker = (config: WhatsAppConfig | undefined) => {\n if (!process.env[WabaConfigEnum.AccessToken] && !config?.accessToken) {\n LOGGER.log(`Environmental variable: CLOUD_API_ACCESS_TOKEN and/or access token argument is undefined.`);\n throw new Error('Missing WhatsApp access token.');\n }\n};\n\nexport const importConfig = (inputConfig?: WhatsAppConfig) => {\n emptyConfigChecker(inputConfig);\n\n const wabaConfig: WabaConfigType = {\n [WabaConfigEnum.AppId]: inputConfig?.appId || process.env.M4D_APP_ID || '',\n [WabaConfigEnum.AppSecret]: inputConfig?.appSecret || process.env.M4D_APP_SECRET || '',\n [WabaConfigEnum.PhoneNumberId]: inputConfig?.phoneNumberId || Number(process.env.WA_PHONE_NUMBER_ID),\n [WabaConfigEnum.BusinessAcctId]: inputConfig?.businessAcctId || process.env.WA_BUSINESS_ACCOUNT_ID || '',\n [WabaConfigEnum.APIVersion]: inputConfig?.apiVersion || process.env.CLOUD_API_VERSION || '',\n [WabaConfigEnum.AccessToken]: inputConfig?.accessToken || process.env.CLOUD_API_ACCESS_TOKEN || '',\n [WabaConfigEnum.WebhookEndpoint]: inputConfig?.webhookEndpoint || process.env.WEBHOOK_ENDPOINT || '',\n [WabaConfigEnum.WebhookVerificationToken]:\n inputConfig?.webhookVerificationToken || process.env.WEBHOOK_VERIFICATION_TOKEN || '',\n [WabaConfigEnum.ListenerPort]:\n inputConfig?.listenerPort || parseInt(process.env.LISTENER_PORT || '') || DEFAULT_LISTENER_PORT,\n [WabaConfigEnum.MaxRetriesAfterWait]:\n inputConfig?.maxRetriesAfterWait ||\n parseInt(process.env.MAX_RETRIES_AFTER_WAIT || '') ||\n DEFAULT_MAX_RETRIES_AFTER_WAIT,\n [WabaConfigEnum.RequestTimeout]:\n inputConfig?.requestTimeout || parseInt(process.env.REQUEST_TIMEOUT || '') || DEFAULT_REQUEST_TIMEOUT,\n [WabaConfigEnum.Debug]: inputConfig?.debug || process.env.DEBUG === 'true',\n [WabaConfigEnum.PrivatePem]: inputConfig?.privatePem || process.env.FLOW_API_PRIVATE_PEM || '',\n [WabaConfigEnum.Passphrase]: inputConfig?.passphrase || process.env.FLOW_API_PASSPHRASE || '',\n };\n\n LOGGER.log(`Configuration loaded for App Id ${wabaConfig[WabaConfigEnum.AppId]}`);\n\n return wabaConfig;\n};\n","import { Agent } from 'https';\n\nimport { HttpMethodsEnum } from '../types/enums';\nimport { HttpsClientClass, HttpsClientResponseClass, ResponseHeaders, ResponseJSONBody } from '../types/httpsClient';\nimport Logger from '../utils/logger';\n\nconst LIB_NAME = 'HttpsClient';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class HttpsClient implements HttpsClientClass {\n agent: Agent;\n\n constructor() {\n this.agent = new Agent({ keepAlive: true });\n }\n\n clearSockets(): boolean {\n this.agent.destroy();\n return true;\n }\n\n async sendRequest(\n hostname: string,\n path: string,\n method: HttpMethodsEnum,\n headers: HeadersInit,\n timeout: number,\n body?: BodyInit | null,\n ): Promise<HttpsClientResponseClass> {\n const url = `https://${hostname}/${path}`;\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n try {\n const response = await fetch(url, {\n method,\n headers,\n body,\n signal: controller.signal,\n });\n LOGGER.log(`${method} : ${url} - ${JSON.stringify(response)}`);\n\n clearTimeout(timeoutId);\n return new HttpsClientResponse(response);\n } catch (error) {\n LOGGER.error(`${method} : ${url} - ${JSON.stringify(error)}`);\n throw error;\n }\n }\n}\n\nexport class HttpsClientResponse implements HttpsClientResponseClass {\n res: Response;\n respStatusCode: number;\n respHeaders: ResponseHeaders;\n\n constructor(resp: Response) {\n this.res = resp;\n this.respStatusCode = resp.status;\n this.respHeaders = Object.fromEntries(resp.headers.entries());\n }\n\n statusCode(): number {\n return this.respStatusCode;\n }\n\n headers(): ResponseHeaders {\n return this.respHeaders;\n }\n\n rawResponse(): Response {\n return this.res;\n }\n\n async json(): Promise<ResponseJSONBody> {\n try {\n return (await this.res.json()) as ResponseJSONBody;\n } catch (err) {\n // TODO Error Handling\n throw new Error('Failed to parse response body to JSON: ' + (err as Error).message);\n }\n }\n}\n","import type { HttpMethodsEnum } from '../types/enums';\nimport type { RequesterClass } from '../types/request';\nimport { isMetaError, MetaError } from '../utils/isMetaError';\nimport Logger from '../utils/logger';\nimport HttpsClient from './httpsClient';\n\nconst LIB_NAME = 'REQUESTER';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class Requester implements RequesterClass {\n client: Readonly<HttpsClient>;\n accessToken: Readonly<string>;\n phoneNumberId: Readonly<number>;\n businessAcctId: Readonly<string>;\n apiVersion: Readonly<string>;\n userAgent: Readonly<string>;\n host: Readonly<string>;\n protocol: Readonly<string> = 'https:';\n\n constructor(\n apiVersion: string,\n phoneNumberId: number,\n accessToken: string,\n businessAcctId: string,\n userAgent: string,\n ) {\n this.client = new HttpsClient();\n this.host = 'graph.facebook.com';\n this.apiVersion = apiVersion || '22';\n this.phoneNumberId = phoneNumberId;\n this.accessToken = accessToken;\n this.businessAcctId = businessAcctId;\n this.userAgent = userAgent;\n }\n\n buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit {\n const headers: HeadersInit = {\n Authorization: `Bearer ${this.accessToken}`,\n 'User-Agent': this.userAgent,\n };\n\n if (contentType !== 'multipart/form-data') {\n headers['Content-Type'] = contentType;\n }\n\n if (additionalHeaders) {\n Object.assign(headers, additionalHeaders);\n }\n\n return headers;\n }\n\n buildCAPIPath(endpoint: string): string {\n return `v${this.apiVersion}.0/${endpoint}`;\n }\n\n async sendRequest(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n body?: any,\n contentType: string = 'application/json',\n additionalHeaders?: Record<string, string>,\n ) {\n let effectiveContentType = contentType;\n\n if (body instanceof FormData) {\n effectiveContentType = 'multipart/form-data';\n } else if (typeof body === 'string' && body.startsWith('<?xml')) {\n effectiveContentType = 'application/xml';\n }\n\n const path = `${this.protocol.toLowerCase()}//${this.host}/${this.buildCAPIPath(endpoint)}`;\n\n LOGGER.log(`${method} : ${path} (${effectiveContentType})`);\n\n try {\n const response = await this.client.sendRequest(\n this.host,\n this.buildCAPIPath(endpoint),\n method,\n this.buildHeader(effectiveContentType, additionalHeaders),\n timeout,\n method === 'POST' || method === 'PUT' ? body : undefined,\n );\n\n if (!response.rawResponse().ok) {\n const errorData = await response.json();\n if (isMetaError(errorData)) {\n throw errorData;\n }\n // If the error doesn't match Meta's format, create a generic MetaError\n throw {\n name: 'MetaError',\n message: 'Unknown error occurred',\n error: {\n message: errorData.message || 'Unknown error occurred',\n type: 'UnknownError',\n code: response.statusCode(),\n fbtrace_id: '',\n },\n } as MetaError;\n }\n\n return response;\n } catch (error) {\n if (isMetaError(error)) {\n throw error;\n }\n // Handle network errors or other unexpected errors\n throw {\n name: 'MetaError',\n message: error instanceof Error ? error.message : 'Network error occurred',\n error: {\n message: error instanceof Error ? error.message : 'Network error occurred',\n type: 'NetworkError',\n code: 500,\n fbtrace_id: '',\n },\n } as MetaError;\n }\n }\n\n async getJson<T>(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n body?: any,\n additionalHeaders?: Record<string, string>,\n ): Promise<T> {\n const res = await this.sendRequest(method, endpoint, timeout, body, 'application/json', additionalHeaders);\n return (await res.json()) as T;\n }\n\n async sendFormData<T>(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n formData: FormData,\n additionalHeaders?: Record<string, string>,\n ): Promise<T> {\n const res = await this.sendRequest(\n method,\n endpoint,\n timeout,\n formData,\n 'multipart/form-data',\n additionalHeaders,\n );\n return (await res.json()) as T;\n }\n\n async sendUrlEncodedForm<T>(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n formData: Record<string, string>,\n additionalHeaders?: Record<string, string>,\n ): Promise<T> {\n const urlEncodedBody = new URLSearchParams(formData).toString();\n const res = await this.sendRequest(\n method,\n endpoint,\n timeout,\n urlEncodedBody,\n 'application/x-www-form-urlencoded',\n additionalHeaders,\n );\n return (await res.json()) as T;\n }\n}\n","import { WabaConfigType, WhatsAppConfig } from '@shared/types/config';\nimport * as SDKEnums from '@shared/types/enums';\nimport Logger from '@shared/utils/logger';\n\nimport EncryptionApi from '@features/encryption';\nimport FlowApi from '@features/flow';\nimport MediaApi from '@features/media';\nimport MessagesApi from '@features/messages';\nimport PhoneNumberApi from '@features/phone';\nimport BusinessProfileApi from '@features/profile';\nimport QrCodeApi from '@features/qrCode/QrCodeApi';\nimport RegistrationApi from '@features/registration';\nimport TemplateApi from '@features/template/TemplateApi';\nimport TwoStepVerificationApi from '@features/twoStepVerification';\nimport WabaApi from '@features/waba';\nimport { importConfig } from '@shared/config/importConfig';\nimport Requester from '@shared/http/request';\nimport { WhatsAppClass } from './types';\n\nconst LIB_NAME = 'WHATSAPP';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nconst headerPrefix = 'WA_SDK';\n\nexport default class WhatsApp implements WhatsAppClass {\n config: WabaConfigType;\n\n requester: Readonly<Requester>;\n\n readonly messages: MessagesApi;\n readonly templates: TemplateApi;\n readonly phoneNumber: PhoneNumberApi;\n readonly qrCode: QrCodeApi;\n readonly encryption: EncryptionApi;\n readonly twoStepVerification: TwoStepVerificationApi;\n readonly registration: RegistrationApi;\n readonly media: MediaApi;\n readonly waba: WabaApi;\n readonly flow: FlowApi;\n readonly businessProfile: BusinessProfileApi;\n static readonly Enums = SDKEnums;\n\n constructor(config?: WhatsAppConfig) {\n this.config = importConfig(config);\n this.requester = new Requester(\n this.config[SDKEnums.WabaConfigEnum.APIVersion],\n this.config[SDKEnums.WabaConfigEnum.PhoneNumberId],\n this.config[SDKEnums.WabaConfigEnum.AccessToken],\n this.config[SDKEnums.WabaConfigEnum.BusinessAcctId],\n this.userAgent(),\n );\n\n this.messages = new MessagesApi(this.config, this.requester);\n this.templates = new TemplateApi(this.config, this.requester);\n this.phoneNumber = new PhoneNumberApi(this.config, this.requester);\n this.qrCode = new QrCodeApi(this.config, this.requester);\n this.encryption = new EncryptionApi(this.config, this.requester);\n this.twoStepVerification = new TwoStepVerificationApi(this.config, this.requester);\n this.registration = new RegistrationApi(this.config, this.requester);\n this.media = new MediaApi(this.config, this.requester);\n this.waba = new WabaApi(this.config, this.requester);\n this.flow = new FlowApi(this.config, this.requester);\n this.businessProfile = new BusinessProfileApi(this.config, this.requester);\n LOGGER.log('WhatsApp Node.js SDK instantiated!');\n }\n\n private userAgent(): string {\n const userAgentString = `${headerPrefix}/${'0.0.1'} (Node.js ${process.version})`;\n return userAgentString;\n }\n\n updateTimeout(ms: number): boolean {\n this.config[SDKEnums.WabaConfigEnum.RequestTimeout] = ms;\n LOGGER.log(`Updated request timeout to ${ms}ms`);\n return true;\n }\n\n updatePhoneNumberId(phoneNumberId: number): boolean {\n this.config[SDKEnums.WabaConfigEnum.PhoneNumberId] = phoneNumberId;\n LOGGER.log(`Updated sender phone number id to ${phoneNumberId}`);\n return true;\n }\n\n updateAccessToken(accessToken: string): boolean {\n this.config[SDKEnums.WabaConfigEnum.AccessToken] = accessToken;\n LOGGER.log(`Updated access token`);\n return true;\n }\n\n updateWabaId(wabaId: string): boolean {\n this.config[SDKEnums.WabaConfigEnum.BusinessAcctId] = wabaId;\n LOGGER.log(`Updated business account id to ${wabaId}`);\n return true;\n }\n}\n"]}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { M as MessageTypesEnum } from '../../enums-CI7vzKhn.js';
|
|
2
|
-
import { WhatsAppConfig } from '../../shared/types/config.js';
|
|
2
|
+
import { WhatsAppConfig, WabaConfigType } from '../../shared/types/config.js';
|
|
3
3
|
import { IncomingMessage } from 'http';
|
|
4
4
|
import { c as FlowEndpointRequest, m as FlowTypeEnum } from '../../FlowApi-BhpWbli2.js';
|
|
5
5
|
import { WhatsApp } from '../whatsapp/index.js';
|
|
6
|
+
import { Request as Request$1, Response as Response$1 } from 'express';
|
|
7
|
+
import { FastifyRequest, FastifyReply } from 'fastify';
|
|
8
|
+
import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
|
|
9
|
+
import { Observable } from 'rxjs';
|
|
10
|
+
import { NextApiRequest, NextApiResponse } from 'next';
|
|
11
|
+
import { NextRequest } from 'next/server';
|
|
6
12
|
import '../../base--LmzWHx3.js';
|
|
7
13
|
import '../../MessageApi-Cr3Q6qg4.js';
|
|
8
14
|
import '../../MediaApi-DM3WohTN.js';
|
|
@@ -493,14 +499,6 @@ interface WebhookEvent {
|
|
|
493
499
|
*/
|
|
494
500
|
timestamp: number;
|
|
495
501
|
}
|
|
496
|
-
/**
|
|
497
|
-
* Message handler function type
|
|
498
|
-
*/
|
|
499
|
-
type MessageHandler = (message: WebhookMessage) => void | Promise<void>;
|
|
500
|
-
/**
|
|
501
|
-
* Event handler function type
|
|
502
|
-
*/
|
|
503
|
-
type EventHandler = (event: WebhookEvent) => void | Promise<void>;
|
|
504
502
|
/**
|
|
505
503
|
* Message status enum
|
|
506
504
|
*/
|
|
@@ -627,4 +625,187 @@ declare class WebhookHandler {
|
|
|
627
625
|
onFlow(type: FlowTypeEnum, handler: (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>): void;
|
|
628
626
|
}
|
|
629
627
|
|
|
630
|
-
|
|
628
|
+
declare const generateXHub256Sig: (body: string, appSecret: string) => string;
|
|
629
|
+
|
|
630
|
+
interface WebhookRequest {
|
|
631
|
+
method: string;
|
|
632
|
+
query: Record<string, any>;
|
|
633
|
+
body: any;
|
|
634
|
+
headers: Record<string, string | string[] | undefined>;
|
|
635
|
+
rawBody?: string;
|
|
636
|
+
}
|
|
637
|
+
interface WebhookResponse {
|
|
638
|
+
statusCode: number;
|
|
639
|
+
body?: any;
|
|
640
|
+
headers?: Record<string, string>;
|
|
641
|
+
}
|
|
642
|
+
type MessageHandler = (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>;
|
|
643
|
+
type EventHandler = (event: WebhookEvent) => void | Promise<void>;
|
|
644
|
+
type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
|
|
645
|
+
/**
|
|
646
|
+
* Pure function to handle webhook verification
|
|
647
|
+
*/
|
|
648
|
+
declare function verifyWebhook(request: WebhookRequest, verificationToken: string): WebhookResponse;
|
|
649
|
+
/**
|
|
650
|
+
* Pure function to process webhook messages
|
|
651
|
+
*/
|
|
652
|
+
declare function processWebhookMessages(request: WebhookRequest, whatsapp: WhatsApp, handlers: {
|
|
653
|
+
messageHandlers: Map<MessageTypesEnum, MessageHandler>;
|
|
654
|
+
eventHandlers: Map<string, EventHandler>;
|
|
655
|
+
preProcessHandler?: MessageHandler;
|
|
656
|
+
postProcessHandler?: MessageHandler;
|
|
657
|
+
}): Promise<WebhookResponse>;
|
|
658
|
+
/**
|
|
659
|
+
* Pure function to handle flow requests
|
|
660
|
+
*/
|
|
661
|
+
declare function processFlowRequest(request: WebhookRequest, config: WabaConfigType, whatsapp: WhatsApp, flowHandlers: Map<FlowTypeEnum, FlowHandler>): Promise<WebhookResponse>;
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Create Express.js adapter for webhook handlers
|
|
665
|
+
*/
|
|
666
|
+
declare function createExpressAdapter(): {
|
|
667
|
+
/**
|
|
668
|
+
* Handle webhook verification requests
|
|
669
|
+
*/
|
|
670
|
+
handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: Request$1, res: Response$1) => void;
|
|
671
|
+
/**
|
|
672
|
+
* Handle webhook POST requests
|
|
673
|
+
*/
|
|
674
|
+
handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request$1, res: Response$1) => Promise<void>;
|
|
675
|
+
/**
|
|
676
|
+
* Handle flow requests
|
|
677
|
+
*/
|
|
678
|
+
handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request$1, res: Response$1) => Promise<void>;
|
|
679
|
+
/**
|
|
680
|
+
* Universal handler that routes based on method
|
|
681
|
+
*/
|
|
682
|
+
handleRequest: (handlers: {
|
|
683
|
+
verification: (request: WebhookRequest) => WebhookResponse;
|
|
684
|
+
webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
|
|
685
|
+
}) => (req: Request$1, res: Response$1) => Promise<void>;
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Create Fastify adapter for webhook handlers
|
|
690
|
+
*/
|
|
691
|
+
declare function createFastifyAdapter(): {
|
|
692
|
+
/**
|
|
693
|
+
* Handle webhook verification requests
|
|
694
|
+
*/
|
|
695
|
+
handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
696
|
+
/**
|
|
697
|
+
* Handle webhook POST requests
|
|
698
|
+
*/
|
|
699
|
+
handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
700
|
+
/**
|
|
701
|
+
* Handle flow requests
|
|
702
|
+
*/
|
|
703
|
+
handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
704
|
+
/**
|
|
705
|
+
* Universal handler that routes based on method
|
|
706
|
+
*/
|
|
707
|
+
handleRequest: (handlers: {
|
|
708
|
+
verification: (request: WebhookRequest) => WebhookResponse;
|
|
709
|
+
webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
|
|
710
|
+
}) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Custom parameter decorator to inject WebhookRequest
|
|
715
|
+
*/
|
|
716
|
+
declare const WebhookReq: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
717
|
+
/**
|
|
718
|
+
* Interceptor to handle WebhookResponse conversion
|
|
719
|
+
*/
|
|
720
|
+
declare class WebhookResponseInterceptor implements NestInterceptor<WebhookResponse, void> {
|
|
721
|
+
intercept(context: ExecutionContext, next: CallHandler<WebhookResponse>): Observable<void>;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Create NestJS adapter for webhook handlers
|
|
725
|
+
*/
|
|
726
|
+
declare function createNestJSAdapter(): {
|
|
727
|
+
/**
|
|
728
|
+
* Handle webhook verification requests
|
|
729
|
+
*/
|
|
730
|
+
handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: Request$1, res: Response$1) => void;
|
|
731
|
+
/**
|
|
732
|
+
* Handle webhook POST requests
|
|
733
|
+
*/
|
|
734
|
+
handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request$1, res: Response$1) => Promise<void>;
|
|
735
|
+
/**
|
|
736
|
+
* Handle flow requests
|
|
737
|
+
*/
|
|
738
|
+
handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request$1, res: Response$1) => Promise<void>;
|
|
739
|
+
/**
|
|
740
|
+
* Universal handler that routes based on method
|
|
741
|
+
*/
|
|
742
|
+
handleRequest: (handlers: {
|
|
743
|
+
verification: (request: WebhookRequest) => WebhookResponse;
|
|
744
|
+
webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
|
|
745
|
+
}) => (req: Request$1, res: Response$1) => Promise<void>;
|
|
746
|
+
/**
|
|
747
|
+
* Create controller method decorator for webhook verification
|
|
748
|
+
*/
|
|
749
|
+
createVerificationHandler: (handler: (request: WebhookRequest) => WebhookResponse) => (target: any, propertyName: string, descriptor: PropertyDescriptor) => void;
|
|
750
|
+
/**
|
|
751
|
+
* Create controller method decorator for webhook POST handling
|
|
752
|
+
*/
|
|
753
|
+
createWebhookHandler: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (target: any, propertyName: string, descriptor: PropertyDescriptor) => void;
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Create Next.js Pages Router adapter for webhook handlers
|
|
758
|
+
* For App Router, use createNextJSRouteHandlerAdapter instead
|
|
759
|
+
*/
|
|
760
|
+
declare function createNextJSAdapter(): {
|
|
761
|
+
/**
|
|
762
|
+
* Handle webhook verification requests
|
|
763
|
+
*/
|
|
764
|
+
handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: NextApiRequest, res: NextApiResponse) => void;
|
|
765
|
+
/**
|
|
766
|
+
* Handle webhook POST requests
|
|
767
|
+
*/
|
|
768
|
+
handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
|
|
769
|
+
/**
|
|
770
|
+
* Handle flow requests
|
|
771
|
+
*/
|
|
772
|
+
handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
|
|
773
|
+
/**
|
|
774
|
+
* Universal handler that routes based on method
|
|
775
|
+
*/
|
|
776
|
+
handleRequest: (handlers: {
|
|
777
|
+
verification: (request: WebhookRequest) => WebhookResponse;
|
|
778
|
+
webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
|
|
779
|
+
}) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Create Next.js Route Handler adapter for webhook handlers
|
|
784
|
+
*/
|
|
785
|
+
declare function createNextJSRouteHandlerAdapter(): {
|
|
786
|
+
/**
|
|
787
|
+
* Handle webhook verification requests (GET)
|
|
788
|
+
*/
|
|
789
|
+
handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: NextRequest) => Response;
|
|
790
|
+
/**
|
|
791
|
+
* Handle webhook POST requests
|
|
792
|
+
*/
|
|
793
|
+
handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request) => Promise<Response>;
|
|
794
|
+
/**
|
|
795
|
+
* Handle flow requests
|
|
796
|
+
*/
|
|
797
|
+
handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request) => Promise<Response>;
|
|
798
|
+
/**
|
|
799
|
+
* Universal handler that creates separate GET and POST handlers
|
|
800
|
+
* Usage: export const { GET, POST } = adapter.createHandlers({ verification, webhook })
|
|
801
|
+
*/
|
|
802
|
+
createHandlers: (handlers: {
|
|
803
|
+
verification: (request: WebhookRequest) => WebhookResponse;
|
|
804
|
+
webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
|
|
805
|
+
}) => {
|
|
806
|
+
GET: (req: NextRequest) => Response;
|
|
807
|
+
POST: (req: Request) => Promise<Response>;
|
|
808
|
+
};
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
export { EventField, type EventHandler, type FlowHandler, type IRequest, type IResponse, type MessageHandler, MessageStatus, type WebhookContact, type WebhookEvent, WebhookHandler, type WebhookMessage, WebhookReq, type WebhookRequest, type WebhookResponse, WebhookResponseInterceptor, createExpressAdapter, createFastifyAdapter, createNestJSAdapter, createNextJSAdapter, createNextJSRouteHandlerAdapter, generateXHub256Sig, processFlowRequest, processWebhookMessages, verifyWebhook };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as EventField,a as MessageStatus,c as WebhookHandler}from'../../chunk-
|
|
1
|
+
export{b as EventField,a as MessageStatus,c as WebhookHandler,j as WebhookReq,k as WebhookResponseInterceptor,h as createExpressAdapter,i as createFastifyAdapter,l as createNestJSAdapter,m as createNextJSAdapter,n as createNextJSRouteHandlerAdapter,d as generateXHub256Sig,g as processFlowRequest,f as processWebhookMessages,e as verifyWebhook}from'../../chunk-FYHBS7Q5.js';import'../../chunk-XQDM2WBV.js';import'../../chunk-3MO3BTBC.js';import'../../chunk-R36L2XYO.js';import'../../chunk-GT3XQN7Y.js';import'../../chunk-O2OTHNWM.js';import'../../chunk-7NQLQPLH.js';import'../../chunk-UQPD6GIF.js';import'../../chunk-5JGM556C.js';import'../../chunk-2NJVBJUN.js';import'../../chunk-XPPDOFBN.js';import'../../chunk-KFPOVYEJ.js';import'../../chunk-7GL74SXM.js';import'../../chunk-A264MT4Q.js';import'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as WhatsApp}from'../../chunk-
|
|
1
|
+
export{b as WhatsApp}from'../../chunk-XQDM2WBV.js';import'../../chunk-3MO3BTBC.js';import'../../chunk-R36L2XYO.js';import'../../chunk-GT3XQN7Y.js';import'../../chunk-O2OTHNWM.js';import'../../chunk-7NQLQPLH.js';import'../../chunk-UQPD6GIF.js';import'../../chunk-5JGM556C.js';import'../../chunk-2NJVBJUN.js';import'../../chunk-XPPDOFBN.js';import'../../chunk-KFPOVYEJ.js';import'../../chunk-7GL74SXM.js';import'../../chunk-A264MT4Q.js';import'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as EncryptionApi,b as default}from'../../chunk-7NQLQPLH.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as EncryptionApi,b as default}from'../../chunk-7NQLQPLH.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as FlowApi,b as default}from'../../chunk-A264MT4Q.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as FlowApi,b as default}from'../../chunk-A264MT4Q.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as MediaApi,b as default}from'../../chunk-XPPDOFBN.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as MediaApi,b as default}from'../../chunk-XPPDOFBN.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as MessageApi,b as default}from'../../chunk-2NJVBJUN.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as MessageApi,b as default}from'../../chunk-2NJVBJUN.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as PhoneNumberApi,b as default}from'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as PhoneNumberApi,b as default}from'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as BusinessProfileApi,b as default}from'../../chunk-KFPOVYEJ.js';import'../../chunk-7GL74SXM.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as BusinessProfileApi,b as default}from'../../chunk-KFPOVYEJ.js';import'../../chunk-7GL74SXM.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as default}from'../../chunk-I222VSWK.js';export{a as QrCodeApi}from'../../chunk-GT3XQN7Y.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as default}from'../../chunk-I222VSWK.js';export{a as QrCodeApi}from'../../chunk-GT3XQN7Y.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as RegistrationApi,b as default}from'../../chunk-O2OTHNWM.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as RegistrationApi,b as default}from'../../chunk-O2OTHNWM.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as default}from'../../chunk-H55VIWDI.js';export{a as TemplateApi}from'../../chunk-R36L2XYO.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as default}from'../../chunk-H55VIWDI.js';export{a as TemplateApi}from'../../chunk-R36L2XYO.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as TwoStepVerificationApi,b as default}from'../../chunk-UQPD6GIF.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as TwoStepVerificationApi,b as default}from'../../chunk-UQPD6GIF.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as WabaApi,b as default}from'../../chunk-5JGM556C.js';import'../../chunk-7GL74SXM.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-
|
|
1
|
+
export{a as WabaApi,b as default}from'../../chunk-5JGM556C.js';import'../../chunk-7GL74SXM.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { EventField, EventHandler, MessageHandler, MessageStatus, WebhookContact, WebhookEvent, WebhookHandler, WebhookMessage } from './core/webhook/index.js';
|
|
1
|
+
export { EventField, EventHandler, FlowHandler, IRequest, IResponse, MessageHandler, MessageStatus, WebhookContact, WebhookEvent, WebhookHandler, WebhookMessage, WebhookReq, WebhookRequest, WebhookResponse, WebhookResponseInterceptor, createExpressAdapter, createFastifyAdapter, createNestJSAdapter, createNextJSAdapter, createNextJSRouteHandlerAdapter, generateXHub256Sig, processFlowRequest, processWebhookMessages, verifyWebhook } from './core/webhook/index.js';
|
|
2
2
|
export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, M as MessagesApi, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from './MessageApi-Cr3Q6qg4.js';
|
|
3
3
|
export { WabaConfigType, WhatsAppConfig } from './shared/types/config.js';
|
|
4
4
|
export { A as AudioMediaTypesEnum, k as BusinessVerticalEnum, a as ButtonPositionEnum, B as ButtonTypesEnum, C as CategoryEnum, b as ComponentTypesEnum, c as ConversationTypesEnum, i as CurrencyCodesEnum, j as DataLocalizationRegionEnum, D as DocumentMediaTypesEnum, H as HttpMethodsEnum, e as ImageMediaTypesEnum, I as InteractiveTypesEnum, L as LanguagesEnum, M as MessageTypesEnum, P as ParametersTypesEnum, R as ReferralSourceTypesEnum, h as RequestCodeMethodsEnum, S as StatusEnum, d as StickerMediaTypesEnum, g as SystemChangeTypesEnum, T as TemplateStatusEnum, V as VideoMediaTypesEnum, W as WabaConfigEnum, f as WebhookTypesEnum } from './enums-CI7vzKhn.js';
|
|
@@ -14,6 +14,12 @@ export { T as TwoStepVerificationApi } from './TwoStepVerificationApi-nJ12648J.j
|
|
|
14
14
|
export { b as WABAClass, a as WabaAccount, W as WabaApi } from './WabaApi-BIP6G4pB.js';
|
|
15
15
|
import { WhatsApp } from './core/whatsapp/index.js';
|
|
16
16
|
import 'http';
|
|
17
|
+
import 'express';
|
|
18
|
+
import 'fastify';
|
|
19
|
+
import '@nestjs/common';
|
|
20
|
+
import 'rxjs';
|
|
21
|
+
import 'next';
|
|
22
|
+
import 'next/server';
|
|
17
23
|
import './base--LmzWHx3.js';
|
|
18
24
|
import 'https';
|
|
19
25
|
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as TemplateApi}from'./chunk-H55VIWDI.js';export{a as QrCodeApi}from'./chunk-I222VSWK.js';import'./chunk-W2U7MN7M.js';export{c as WebhookHandler}from'./chunk-
|
|
1
|
+
export{a as TemplateApi}from'./chunk-H55VIWDI.js';export{a as QrCodeApi}from'./chunk-I222VSWK.js';import'./chunk-W2U7MN7M.js';export{b as EventField,a as MessageStatus,c as WebhookHandler,j as WebhookReq,k as WebhookResponseInterceptor,h as createExpressAdapter,i as createFastifyAdapter,l as createNestJSAdapter,m as createNextJSAdapter,n as createNextJSRouteHandlerAdapter,d as generateXHub256Sig,g as processFlowRequest,f as processWebhookMessages,e as verifyWebhook}from'./chunk-FYHBS7Q5.js';import {b}from'./chunk-XQDM2WBV.js';import'./chunk-3MO3BTBC.js';import'./chunk-R36L2XYO.js';import'./chunk-GT3XQN7Y.js';export{b as RegistrationApi}from'./chunk-O2OTHNWM.js';export{b as EncryptionApi}from'./chunk-7NQLQPLH.js';export{b as TwoStepVerificationApi}from'./chunk-UQPD6GIF.js';export{b as WabaApi}from'./chunk-5JGM556C.js';export{b as MessagesApi}from'./chunk-2NJVBJUN.js';import'./chunk-XPPDOFBN.js';export{b as BusinessProfileApi}from'./chunk-KFPOVYEJ.js';import'./chunk-7GL74SXM.js';export{b as FlowApi}from'./chunk-A264MT4Q.js';export{b as PhoneNumberApi}from'./chunk-GIQLIMOD.js';import'./chunk-BZ5QDXNR.js';import'./chunk-VW3LGHTJ.js';export{q as AudioMediaTypesEnum,y as BusinessVerticalEnum,h as ButtonPositionEnum,g as ButtonTypesEnum,a as CategoryEnum,i as ComponentTypesEnum,k as ConversationTypesEnum,w as CurrencyCodesEnum,x as DataLocalizationRegionEnum,p as DocumentMediaTypesEnum,c as HttpMethodsEnum,o as ImageMediaTypesEnum,f as InteractiveTypesEnum,v as LanguagesEnum,d as MessageTypesEnum,e as ParametersTypesEnum,t as ReferralSourceTypesEnum,u as RequestCodeMethodsEnum,l as StatusEnum,n as StickerMediaTypesEnum,s as SystemChangeTypesEnum,b as TemplateStatusEnum,m as VideoMediaTypesEnum,j as WabaConfigEnum,r as WebhookTypesEnum}from'./chunk-2NCV35XS.js';import'./chunk-M2GC5VFJ.js';var le=b;export{le as default};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["src_default","WhatsApp"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["src_default","WhatsApp"],"mappings":"oxDAGA,IAAOA,EAAQC,CAAAA","file":"index.js","sourcesContent":["import { WebhookHandler } from './core/webhook';\nimport { WhatsApp } from './core/whatsapp';\n\nexport default WhatsApp;\n\nexport * from './core/webhook';\n\nexport { WebhookHandler };\n\nexport {\n BusinessProfileApi,\n EncryptionApi,\n FlowApi,\n MessagesApi,\n PhoneNumberApi,\n QrCodeApi,\n RegistrationApi,\n TemplateApi,\n TwoStepVerificationApi,\n WabaApi,\n} from './features';\n\nexport type {\n AudioMediaObject,\n BusinessProfileClass,\n BusinessProfileResponse,\n ContactObject,\n DocumentMediaObject,\n Flow,\n FlowClass,\n FlowEndpointRequest,\n FlowEndpointResponse,\n ImageMediaObject,\n InteractiveObject,\n LocationObject,\n MediaClass,\n MediaResponse,\n MediasResponse,\n MessageRequestParams,\n MessagesResponse,\n MessageTemplateObject,\n PhoneNumberClass,\n PhoneNumberResponse,\n QrCodeClass,\n QrCodeResponse,\n ReactionParams,\n RegistrationClass,\n StatusParams,\n StickerMediaObject,\n TemplateClass,\n TemplateResponse,\n TextMessageParams,\n TextObject,\n UploadMediaResponse,\n VideoMediaObject,\n WabaAccount,\n WABAClass,\n} from './features';\n\nexport * from './shared/types/config';\nexport * from './shared/types/enums';\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{q as AudioMediaTypesEnum,y as BusinessVerticalEnum,h as ButtonPositionEnum,g as ButtonTypesEnum,a as CategoryEnum,i as ComponentTypesEnum,k as ConversationTypesEnum,w as CurrencyCodesEnum,x as DataLocalizationRegionEnum,p as DocumentMediaTypesEnum,c as HttpMethodsEnum,o as ImageMediaTypesEnum,f as InteractiveTypesEnum,v as LanguagesEnum,d as MessageTypesEnum,e as ParametersTypesEnum,t as ReferralSourceTypesEnum,u as RequestCodeMethodsEnum,l as StatusEnum,n as StickerMediaTypesEnum,s as SystemChangeTypesEnum,b as TemplateStatusEnum,m as VideoMediaTypesEnum,j as WabaConfigEnum,r as WebhookTypesEnum}from'../../chunk-
|
|
1
|
+
export{q as AudioMediaTypesEnum,y as BusinessVerticalEnum,h as ButtonPositionEnum,g as ButtonTypesEnum,a as CategoryEnum,i as ComponentTypesEnum,k as ConversationTypesEnum,w as CurrencyCodesEnum,x as DataLocalizationRegionEnum,p as DocumentMediaTypesEnum,c as HttpMethodsEnum,o as ImageMediaTypesEnum,f as InteractiveTypesEnum,v as LanguagesEnum,d as MessageTypesEnum,e as ParametersTypesEnum,t as ReferralSourceTypesEnum,u as RequestCodeMethodsEnum,l as StatusEnum,n as StickerMediaTypesEnum,s as SystemChangeTypesEnum,b as TemplateStatusEnum,m as VideoMediaTypesEnum,j as WabaConfigEnum,r as WebhookTypesEnum}from'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=enums.js.map
|
|
2
2
|
//# sourceMappingURL=enums.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as isMetaError}from'../../chunk-3MO3BTBC.js';import'../../chunk-
|
|
1
|
+
export{a as isMetaError}from'../../chunk-3MO3BTBC.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=isMetaError.js.map
|
|
2
2
|
//# sourceMappingURL=isMetaError.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meta-cloud-api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.24",
|
|
4
4
|
"description": "TypeScript wrapper for Meta's Cloud API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -144,6 +144,38 @@
|
|
|
144
144
|
"engines": {
|
|
145
145
|
"node": ">=18"
|
|
146
146
|
},
|
|
147
|
+
"peerDependencies": {
|
|
148
|
+
"@nestjs/common": ">=8.0.0",
|
|
149
|
+
"express": ">=4.0.0",
|
|
150
|
+
"fastify": ">=4.0.0",
|
|
151
|
+
"next": ">=12.0.0",
|
|
152
|
+
"react": ">=16.8.0",
|
|
153
|
+
"react-dom": ">=16.8.0",
|
|
154
|
+
"rxjs": ">=7.0.0"
|
|
155
|
+
},
|
|
156
|
+
"peerDependenciesMeta": {
|
|
157
|
+
"@nestjs/common": {
|
|
158
|
+
"optional": true
|
|
159
|
+
},
|
|
160
|
+
"express": {
|
|
161
|
+
"optional": true
|
|
162
|
+
},
|
|
163
|
+
"fastify": {
|
|
164
|
+
"optional": true
|
|
165
|
+
},
|
|
166
|
+
"next": {
|
|
167
|
+
"optional": true
|
|
168
|
+
},
|
|
169
|
+
"react": {
|
|
170
|
+
"optional": true
|
|
171
|
+
},
|
|
172
|
+
"react-dom": {
|
|
173
|
+
"optional": true
|
|
174
|
+
},
|
|
175
|
+
"rxjs": {
|
|
176
|
+
"optional": true
|
|
177
|
+
}
|
|
178
|
+
},
|
|
147
179
|
"devDependencies": {
|
|
148
180
|
"@changesets/cli": "^2.28.1",
|
|
149
181
|
"@commitlint/cli": "^19.6.1",
|
|
@@ -152,10 +184,16 @@
|
|
|
152
184
|
"@commitlint/types": "^19.5.0",
|
|
153
185
|
"@eslint/eslintrc": "^3.2.0",
|
|
154
186
|
"@eslint/js": "^9.17.0",
|
|
187
|
+
"@nestjs/common": "^10.0.0",
|
|
155
188
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
156
189
|
"@types/eslint__eslintrc": "^2.1.2",
|
|
190
|
+
"@types/express": "^5.0.0",
|
|
157
191
|
"@types/node": "^22.15.29",
|
|
192
|
+
"@types/react": "^19.1.7",
|
|
193
|
+
"@types/react-dom": "^19.1.3",
|
|
158
194
|
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
|
195
|
+
"express": "^4.21.2",
|
|
196
|
+
"fastify": "^5.2.0",
|
|
159
197
|
"@typescript-eslint/parser": "^8.15.0",
|
|
160
198
|
"commitizen": "^4.3.1",
|
|
161
199
|
"dotenv": "^16.4.7",
|
|
@@ -166,7 +204,11 @@
|
|
|
166
204
|
"husky": "^9.1.7",
|
|
167
205
|
"lint-staged": "^15.3.0",
|
|
168
206
|
"msw": "^2.9.0",
|
|
207
|
+
"next": "^15.1.6",
|
|
169
208
|
"prettier": "^3.5.0",
|
|
209
|
+
"react": "^19.1.0",
|
|
210
|
+
"react-dom": "^19.1.0",
|
|
211
|
+
"rxjs": "^7.8.1",
|
|
170
212
|
"tsup": "^8.3.6",
|
|
171
213
|
"typescript": "^5.7.3",
|
|
172
214
|
"typescript-eslint": "^8.23.0",
|