@visulima/notification 1.0.0-alpha.2 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -11
- package/dist/packem_shared/{discordProvider-ewPfe-J7.js → discordProvider-BhfXcCcI.js} +1 -1
- package/dist/packem_shared/{expoProvider-CXq101FD.js → expoProvider-DsZR4sUk.js} +1 -1
- package/dist/packem_shared/{fcmProvider-WdJGZ55l.js → fcmProvider-DWRx8XBv.js} +1 -1
- package/dist/packem_shared/http-DT3tyixg.js +1 -0
- package/dist/packem_shared/{messageBirdProvider-CHUFB0hd.js → messageBirdProvider-BfiTaNLn.js} +1 -1
- package/dist/packem_shared/{msTeamsProvider-DBhrmuSd.js → msTeamsProvider-DrmL3RYX.js} +1 -1
- package/dist/packem_shared/{plivoProvider-CIOl6DWw.js → plivoProvider-Dr8d5yD3.js} +1 -1
- package/dist/packem_shared/{slackProvider-N1wNtAZ3.js → slackProvider-DPG1IlA0.js} +1 -1
- package/dist/packem_shared/{slackWebhook-GEx_GdcV.js → slackWebhook-Cpmm_0El.js} +1 -1
- package/dist/packem_shared/{snsProvider-KCciJ-nj.js → snsProvider-C2T2UxDK.js} +1 -1
- package/dist/packem_shared/{snsWebhook-ChZnBBT3.js → snsWebhook-BKBTQyEW.js} +1 -1
- package/dist/packem_shared/{standardWebhook-B-LxP8U7.js → standardWebhook-Bk0UUeDW.js} +1 -1
- package/dist/packem_shared/{telegramProvider-jqR5BhJL.js → telegramProvider-wyx3ksVm.js} +1 -1
- package/dist/packem_shared/{telnyxProvider-C8TMPir1.js → telnyxProvider-jgpEwgPh.js} +1 -1
- package/dist/packem_shared/{twilioProvider-BxI0e6LX.js → twilioProvider-DMYWqvgZ.js} +1 -1
- package/dist/packem_shared/twilioWebhook-C-Iwuv7y.js +1 -0
- package/dist/packem_shared/{vonageProvider-BF76ca89.js → vonageProvider-CT4KoWXu.js} +1 -1
- package/dist/packem_shared/{webPushProvider-B962RwsA.js → webPushProvider-DwjmWASr.js} +1 -1
- package/dist/packem_shared/{webhookProvider-BALSb2pc.js → webhookProvider-CPA1nKXJ.js} +1 -1
- package/dist/providers/chat/discord/index.js +1 -1
- package/dist/providers/chat/msteams/index.js +1 -1
- package/dist/providers/chat/slack/index.js +1 -1
- package/dist/providers/chat/telegram/index.js +1 -1
- package/dist/providers/push/expo/index.js +1 -1
- package/dist/providers/push/fcm/index.js +1 -1
- package/dist/providers/push/web-push/index.js +1 -1
- package/dist/providers/sms/messagebird/index.js +1 -1
- package/dist/providers/sms/plivo/index.js +1 -1
- package/dist/providers/sms/sns/index.js +1 -1
- package/dist/providers/sms/telnyx/index.js +1 -1
- package/dist/providers/sms/twilio/index.js +1 -1
- package/dist/providers/sms/vonage/index.js +1 -1
- package/dist/providers/webhook/index.js +1 -1
- package/dist/webhooks/index.js +1 -1
- package/package.json +4 -4
- package/dist/packem_shared/http-BMYcUNBU.js +0 -1
- package/dist/packem_shared/twilioWebhook-F0mTmGXD.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,35 +1,65 @@
|
|
|
1
|
+
## @visulima/notification [1.0.0-alpha.4](https://github.com/visulima/visulima/compare/@visulima/notification@1.0.0-alpha.3...@visulima/notification@1.0.0-alpha.4) (2026-06-30)
|
|
2
|
+
|
|
3
|
+
### Styles
|
|
4
|
+
|
|
5
|
+
* cs fixes ([2a960bb](https://github.com/visulima/visulima/commit/2a960bb1772c9dc70080e2d75d3a0d827034e294))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* add fallow code-intelligence across all packages ([a3b4821](https://github.com/visulima/visulima/commit/a3b48215002e86fed20f2973038b5d4a0aa1ce04))
|
|
10
|
+
|
|
11
|
+
### Code Refactoring
|
|
12
|
+
|
|
13
|
+
* resolve fallow dead-code across 13 packages ([8c458d2](https://github.com/visulima/visulima/commit/8c458d2eb17225ed48fc4bee4569e522912e8c3d))
|
|
14
|
+
|
|
15
|
+
### Continuous Integration
|
|
16
|
+
|
|
17
|
+
* **fallow:** make fallow:health advisory (--report-only) ([d57148e](https://github.com/visulima/visulima/commit/d57148ea0e3556b4c24d8d336b9fa14987f5dc7d))
|
|
18
|
+
* **lint:** raise eslint job timeout and cache slow per-package eslint runs ([#717](https://github.com/visulima/visulima/issues/717)) ([c93878d](https://github.com/visulima/visulima/commit/c93878dbfa1888cc834704448ae6eefd3098597e)), closes [#713](https://github.com/visulima/visulima/issues/713)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Dependencies
|
|
22
|
+
|
|
23
|
+
* **@visulima/email:** upgraded to 1.0.0-alpha.44
|
|
24
|
+
* **@visulima/error:** upgraded to 6.0.0-alpha.35
|
|
25
|
+
* **@visulima/workflow:** upgraded to 1.0.0-alpha.2
|
|
26
|
+
|
|
27
|
+
## @visulima/notification [1.0.0-alpha.3](https://github.com/visulima/visulima/compare/@visulima/notification@1.0.0-alpha.2...@visulima/notification@1.0.0-alpha.3) (2026-06-23)
|
|
28
|
+
|
|
29
|
+
### Dependencies
|
|
30
|
+
|
|
31
|
+
- **@visulima/email:** upgraded to 1.0.0-alpha.43
|
|
32
|
+
|
|
1
33
|
## @visulima/notification [1.0.0-alpha.2](https://github.com/visulima/visulima/compare/@visulima/notification@1.0.0-alpha.1...@visulima/notification@1.0.0-alpha.2) (2026-06-23)
|
|
2
34
|
|
|
3
35
|
### Features
|
|
4
36
|
|
|
5
|
-
|
|
37
|
+
- **notification:** add workflow steps and digest subsystems ([#698](https://github.com/visulima/visulima/issues/698)) ([81e2551](https://github.com/visulima/visulima/commit/81e2551b00508e1b5b50e96cb2aec248d938f8fc))
|
|
6
38
|
|
|
7
39
|
### Bug Fixes
|
|
8
40
|
|
|
9
|
-
|
|
10
|
-
|
|
41
|
+
- fixed hoisted package ([45d4062](https://github.com/visulima/visulima/commit/45d40626dc6930fcd457ae90d6d4293cfad92595))
|
|
11
42
|
|
|
12
43
|
### Dependencies
|
|
13
44
|
|
|
14
|
-
|
|
15
|
-
|
|
45
|
+
- **@visulima/email:** upgraded to 1.0.0-alpha.42
|
|
46
|
+
- **@visulima/workflow:** upgraded to 1.0.0-alpha.1
|
|
16
47
|
|
|
17
48
|
## @visulima/notification 1.0.0-alpha.1 (2026-06-20)
|
|
18
49
|
|
|
19
50
|
### Features
|
|
20
51
|
|
|
21
|
-
|
|
52
|
+
- **notification:** add multi-channel notification package ([88fe816](https://github.com/visulima/visulima/commit/88fe81690763e334aa403b4baa455a77557f5880))
|
|
22
53
|
|
|
23
54
|
### Bug Fixes
|
|
24
55
|
|
|
25
|
-
|
|
56
|
+
- **notification:** harden webhook verifiers + dedupe crypto helpers ([22a7b74](https://github.com/visulima/visulima/commit/22a7b74504619d2c513ef3e5954a0c92d4aea972))
|
|
26
57
|
|
|
27
58
|
### Tests
|
|
28
59
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
60
|
+
- **notification:** cover provider + middleware error/guard branches ([9eff3fb](https://github.com/visulima/visulima/commit/9eff3fbf6c72f1154ec942280622f5cb9fc5f8f5))
|
|
61
|
+
- **notification:** cover webhook provider, unstorage queue, worker, middleware ([6a4bbb5](https://github.com/visulima/visulima/commit/6a4bbb569787f0f4a3138ed854ba89a4c7df04dd))
|
|
32
62
|
|
|
33
63
|
### Dependencies
|
|
34
64
|
|
|
35
|
-
|
|
65
|
+
- **@visulima/email:** upgraded to 1.0.0-alpha.41
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import s from"./NotificationError-DVfMJQ1u.js";import c from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as l}from"./defineProvider-C9q-7iwt.js";import{r as m}from"./http-
|
|
1
|
+
import s from"./NotificationError-DVfMJQ1u.js";import c from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as l}from"./defineProvider-C9q-7iwt.js";import{r as m}from"./http-DT3tyixg.js";import{n as u}from"./id-C_FRCsUM.js";const k=l(a=>{const e=a??{};if(!e.webhookUrl)throw new c("discord","webhookUrl");const i=e.retries??3,d=e.timeout??3e4,n=e.webhookUrl.includes("?")?`${e.webhookUrl}&wait=true`:`${e.webhookUrl}?wait=true`;return{channel:"chat",endpoint:e.webhookUrl,features:{batchSending:!1,richContent:!0},id:"discord",initialize:()=>{},isAvailable:()=>!!e.webhookUrl,options:e,send:async r=>{const o={content:r.text,embeds:r.blocks,username:e.username};r.threadId&&(o.thread_id=r.threadId);const t=await m(n,{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST",timeout:d},i);return!t.success||!t.data?{error:new s("discord",t.error instanceof Error?t.error.message:"Request failed"),success:!1}:t.data.status>=400?{error:new s("discord",t.data.body.message??`HTTP ${String(t.data.status)}`),success:!1}:{data:{channel:"chat",messageId:t.data.body.id??u("discord"),provider:"discord",sent:!0,timestamp:new Date},success:!0}},validateCredentials:()=>!!e.webhookUrl}});export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import d from"./NotificationError-DVfMJQ1u.js";import{defineProvider as x}from"./defineProvider-C9q-7iwt.js";import{t as T}from"./credentials-CG0zkn-W.js";import{r as w}from"./http-
|
|
1
|
+
import d from"./NotificationError-DVfMJQ1u.js";import{defineProvider as x}from"./defineProvider-C9q-7iwt.js";import{t as T}from"./credentials-CG0zkn-W.js";import{r as w}from"./http-DT3tyixg.js";import{n as A}from"./id-C_FRCsUM.js";const $="https://exp.host",R=x(l=>{const t=l??{},u=t.endpoint??$,f=t.retries??3,h=t.timeout??3e4,g=`${u}/--/api/v2/push/send`;return{channel:"push",endpoint:u,features:{batchSending:!0,media:!0,richContent:!0},id:"expo",initialize:()=>{},isAvailable:()=>!0,options:t,send:async s=>{const p=T(s.to),y=p.map(r=>({badge:s.badge,body:s.body,data:s.data,sound:s.sound??"default",title:s.title,to:r})),c={"Content-Type":"application/json"};t.accessToken&&(c.Authorization=`Bearer ${t.accessToken}`);const e=await w(g,{body:JSON.stringify(y),headers:c,method:"POST",timeout:h},f);if(!e.success||!e.data)return{error:new d("expo",e.error instanceof Error?e.error.message:"Request failed"),success:!1};if(e.data.status>=400)return{error:new d("expo",`HTTP ${String(e.data.status)}`),success:!1};const a=e.data.body.data;let n;Array.isArray(a)?n=a:n=a?[a]:[];const i=p.map((r,b)=>{const o=n[b];return o?.status==="error"?{error:o.details?.error??o.message??"error",id:r,status:"failed"}:{id:r,messageId:o?.id,status:"sent"}}),m=i.filter(r=>r.status==="sent");return m.length===0?{error:new d("expo",i[0]?.error??"All tokens failed"),success:!1}:{data:{channel:"push",messageId:m[0]?.messageId??A("expo"),provider:"expo",recipients:i,sent:!0,timestamp:new Date},success:!0}}}});export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"./NotificationError-DVfMJQ1u.js";import d from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as h}from"./defineProvider-C9q-7iwt.js";import{t as y}from"./credentials-CG0zkn-W.js";import{r as T}from"./http-
|
|
1
|
+
import c from"./NotificationError-DVfMJQ1u.js";import d from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as h}from"./defineProvider-C9q-7iwt.js";import{t as y}from"./credentials-CG0zkn-W.js";import{r as T}from"./http-DT3tyixg.js";const I=h(m=>{const e=m??{};if(!e.projectId)throw new d("fcm","projectId");if(!e.accessToken&&!e.getAccessToken)throw new d("fcm",["accessToken","getAccessToken"]);const i=e.endpoint??"https://fcm.googleapis.com",f=e.retries??3,u=e.timeout??3e4,p=`${i}/v1/projects/${e.projectId}/messages:send`,l=s=>{if(s)return Object.fromEntries(Object.entries(s).map(([r,o])=>[r,typeof o=="string"?o:JSON.stringify(o)]))},g=async(s,r,o)=>{const a={data:l(r.data),notification:{body:r.body,image:r.imageUrl,title:r.title},token:s},t=await T(p,{body:JSON.stringify({message:a}),headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},method:"POST",timeout:u},f);return!t.success||!t.data?{error:t.error instanceof Error?t.error.message:"Request failed",id:s,status:"failed"}:t.data.status>=400?{error:t.data.body.error?.message??`HTTP ${String(t.data.status)}`,id:s,status:"failed"}:{id:s,messageId:t.data.body.name,status:"sent"}};return{channel:"push",endpoint:i,features:{batchSending:!1,media:!0,richContent:!0},id:"fcm",initialize:()=>{},isAvailable:()=>!!(e.projectId&&(e.accessToken??e.getAccessToken)),options:e,send:async s=>{let r;try{r=e.getAccessToken?await e.getAccessToken():e.accessToken}catch(n){return{error:new c("fcm","Failed to obtain access token",{cause:n}),success:!1}}const o=y(s.to),a=[];for(const n of o)a.push(await g(n,s,r));const t=a.filter(n=>n.status==="sent");return t.length===0?{error:new c("fcm",a[0]?.error??"All tokens failed"),success:!1}:{data:{channel:"push",messageId:t[0]?.messageId??"",provider:"fcm",recipients:a,sent:!0,timestamp:new Date},success:!0}}}});export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=async(a,s={})=>{const u=new AbortController,c=s.timeout??3e4,e=setTimeout(()=>{u.abort()},c);try{const t=await fetch(a,{body:s.body,headers:s.headers,method:s.method??"GET",signal:u.signal}),r=await t.text();let o=r;if(r.length>0)try{o=JSON.parse(r)}catch{o=r}const n={};return t.headers.forEach((d,h)=>{n[h]=d}),{data:{body:o,headers:n,status:t.status,statusText:t.statusText},success:!0}}catch(t){return{error:t,success:!1}}finally{clearTimeout(e)}},l=a=>a===408||a===429||a>=500,m=async(a,s={},u=3,c=250)=>{let e=await i(a,s);for(let t=0;t<u;t+=1){if(!(!e.success||e.data!==void 0&&l(e.data.status)))return e;const r=c*2**t+Math.floor(Math.random()*c);await new Promise(o=>setTimeout(o,r)),e=await i(a,s)}return e};export{i as m,m as r};
|
package/dist/packem_shared/{messageBirdProvider-CHUFB0hd.js → messageBirdProvider-BfiTaNLn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"./NotificationError-DVfMJQ1u.js";import g from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as l}from"./defineProvider-C9q-7iwt.js";import{t as y}from"./credentials-CG0zkn-W.js";import{r as b}from"./http-
|
|
1
|
+
import t from"./NotificationError-DVfMJQ1u.js";import g from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as l}from"./defineProvider-C9q-7iwt.js";import{t as y}from"./credentials-CG0zkn-W.js";import{r as b}from"./http-DT3tyixg.js";import{b as h}from"./sms-CU-OZvNU.js";const v="https://rest.messagebird.com",$=l(n=>{const e=n??{};if(!e.accessKey)throw new g("messagebird","accessKey");const i=e.endpoint??v,d=e.retries??3,c=e.timeout??3e4,m=`${i}/messages`;return{channel:"sms",endpoint:i,features:{batchSending:!0,deliveryReceipts:!0,media:!1},id:"messagebird",initialize:()=>{},isAvailable:()=>!!e.accessKey,options:e,send:async r=>{const a=y(r.to),o=r.from??e.from;if(!o)return{error:new t("messagebird","Missing originator: provide `from` on the payload or provider config"),success:!1};const s=await b(m,{body:JSON.stringify({body:r.text,originator:o,recipients:a}),headers:{Authorization:`AccessKey ${e.accessKey}`,"Content-Type":"application/json"},method:"POST",timeout:c},d);if(!s.success||!s.data)return{error:new t("messagebird",s.error instanceof Error?s.error.message:"Request failed"),success:!1};if(s.data.status>=400)return{error:new t("messagebird",s.data.body.errors?.[0]?.description??`HTTP ${String(s.data.status)}`),success:!1};const f=s.data.body.id??"",p=a.map(u=>({id:u,messageId:f,status:"sent"}));return h("messagebird",p)},validateCredentials:()=>!!e.accessKey}});export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./NotificationError-DVfMJQ1u.js";import m from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as c}from"./defineProvider-C9q-7iwt.js";import{r as d}from"./http-
|
|
1
|
+
import r from"./NotificationError-DVfMJQ1u.js";import m from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as c}from"./defineProvider-C9q-7iwt.js";import{r as d}from"./http-DT3tyixg.js";import{n as l}from"./id-C_FRCsUM.js";const b=c(a=>{const e=a??{};if(!e.webhookUrl)throw new m("msteams","webhookUrl");const o=e.retries??3,n=e.timeout??3e4;return{channel:"chat",endpoint:e.webhookUrl,features:{batchSending:!1,richContent:!0},id:"msteams",initialize:()=>{},isAvailable:()=>!!e.webhookUrl,options:e,send:async s=>{const i=s.blocks??{"@context":"https://schema.org/extensions","@type":"MessageCard",text:s.text},t=await d(e.webhookUrl,{body:JSON.stringify(i),headers:{"Content-Type":"application/json"},method:"POST",timeout:n},o);return!t.success||!t.data?{error:new r("msteams",t.error instanceof Error?t.error.message:"Request failed"),success:!1}:t.data.status>=400?{error:new r("msteams",`HTTP ${String(t.data.status)}: ${t.data.body}`),success:!1}:{data:{channel:"chat",messageId:l("msteams"),provider:"msteams",sent:!0,timestamp:new Date},success:!0}},validateCredentials:()=>!!e.webhookUrl}});export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"./NotificationError-DVfMJQ1u.js";import d from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as w}from"./defineProvider-C9q-7iwt.js";import{b as y,t as T}from"./credentials-CG0zkn-W.js";import{r as b}from"./http-
|
|
1
|
+
import o from"./NotificationError-DVfMJQ1u.js";import d from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as w}from"./defineProvider-C9q-7iwt.js";import{b as y,t as T}from"./credentials-CG0zkn-W.js";import{r as b}from"./http-DT3tyixg.js";import{b as I}from"./sms-CU-OZvNU.js";const S="https://api.plivo.com",q=w(p=>{const e=p??{};if(!e.authId)throw new d("plivo","authId");if(!e.authToken)throw new d("plivo","authToken");const a=e.endpoint??S,m=e.retries??3,c=e.timeout??3e4,f=`${a}/v1/Account/${e.authId}/Message/`,l=y(e.authId,e.authToken);return{channel:"sms",endpoint:a,features:{batchSending:!0,deliveryReceipts:!0,media:!0},id:"plivo",initialize:()=>{},isAvailable:()=>!!(e.authId&&e.authToken),options:e,send:async s=>{const r=T(s.to),i=s.from??e.from;if(!i)return{error:new o("plivo","Missing sender: provide `from` on the payload or provider config"),success:!1};const t=await b(f,{body:JSON.stringify({dst:r.join("<"),src:i,text:s.text}),headers:{Authorization:l,"Content-Type":"application/json"},method:"POST",timeout:c},m);if(!t.success||!t.data)return{error:new o("plivo",t.error instanceof Error?t.error.message:"Request failed"),success:!1};if(t.data.status>=400)return{error:new o("plivo",t.data.body.error??`HTTP ${String(t.data.status)}`),success:!1};const{body:n}=t.data,h=n.message_uuid?.[0]??"",u=r.map((v,g)=>({id:v,messageId:n.message_uuid?.[g],status:"sent"}));return I("plivo",u.length>0?u:[{id:r[0]??"",messageId:h,status:"sent"}])},validateCredentials:()=>!!(e.authId&&e.authToken)}});export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./NotificationError-DVfMJQ1u.js";import{defineProvider as b}from"./defineProvider-C9q-7iwt.js";import{r as m}from"./http-
|
|
1
|
+
import r from"./NotificationError-DVfMJQ1u.js";import{defineProvider as b}from"./defineProvider-C9q-7iwt.js";import{r as m}from"./http-DT3tyixg.js";import{n as d}from"./id-C_FRCsUM.js";const w="https://slack.com/api",S=b(h=>{const e=h??{};if(!e.token&&!e.webhookUrl)throw new r("slack","Provide either `token` (Web API) or `webhookUrl`",{hint:"Set one of token/webhookUrl in the provider config"});const n=e.endpoint??w,k=e.retries??3,u=e.timeout??3e4;return{channel:"chat",endpoint:n,features:{batchSending:!1,richContent:!0},id:"slack",initialize:()=>{},isAvailable:()=>!!(e.token??e.webhookUrl),options:e,send:async s=>{const o=!!e.webhookUrl,f=o?e.webhookUrl:`${n}/chat.postMessage`,i=s.to??e.defaultChannel;if(!o&&!i)return{error:new r("slack","Missing channel: provide `to` or `defaultChannel`"),success:!1};const c={blocks:s.blocks,text:s.text,thread_ts:s.threadId};o||(c.channel=i);const l={"Content-Type":"application/json"};o||(l.Authorization=`Bearer ${e.token??""}`);const t=await m(f,{body:JSON.stringify(c),headers:l,method:"POST",timeout:u},k);if(!t.success||!t.data)return{error:new r("slack",t.error instanceof Error?t.error.message:"Request failed"),success:!1};if(o){if(t.data.status>=400||t.data.body!=="ok"){const p=typeof t.data.body=="string"?t.data.body:JSON.stringify(t.data.body);return{error:new r("slack",`Webhook failed: ${p}`),success:!1}}return{data:{channel:"chat",messageId:d("slack"),provider:"slack",sent:!0,timestamp:new Date},success:!0}}const a=t.data.body;return a.ok?{data:{channel:"chat",messageId:a.ts??d("slack"),provider:"slack",response:a,sent:!0,timestamp:new Date},success:!0}:{error:new r("slack",a.error??"Slack API error"),success:!1}},validateCredentials:()=>!!(e.token??e.webhookUrl)}});export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isWithinReplayWindow as o,REPLAY_WINDOW_SECONDS as c,hmacHex as l,timingSafeEqual as
|
|
1
|
+
import{isWithinReplayWindow as o,REPLAY_WINDOW_SECONDS as c,hmacHex as l,timingSafeEqual as m}from"./hmacBase64-BhhoX0uo.js";import{getHeader as a,tryParseObject as p}from"./getHeader-C_gkdnMQ.js";const d="X-Slack-Signature",f="X-Slack-Request-Timestamp",y={parse:r=>{const e=p(r);if(e===void 0)return;const t=e.event??e,n=typeof t.channel=="string"?t.channel:void 0,i=typeof t.ts=="string"?t.ts:"";return{channel:"chat",messageId:typeof e.event_id=="string"?e.event_id:i,provider:"slack",recipient:n,timestamp:new Date,type:"delivered"}},verify:async(r,e,t)=>{if(t.trim()==="")return!1;const n=a(e,d),i=a(e,f);if(n===void 0||i===void 0||!o(i,c))return!1;const s=await l(t,`v0:${i}:${r}`,"SHA-256");return m(`v0=${s}`,n)}};export{y as slackWebhook};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import x from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as K}from"./defineProvider-C9q-7iwt.js";import{t as z}from"./credentials-CG0zkn-W.js";import{r as C}from"./http-
|
|
1
|
+
import x from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as K}from"./defineProvider-C9q-7iwt.js";import{t as z}from"./credentials-CG0zkn-W.js";import{r as C}from"./http-DT3tyixg.js";import{n as R}from"./id-C_FRCsUM.js";import{s as j,b as P}from"./sms-CU-OZvNU.js";import{b as w,d as h,u as c,e as p}from"./webcrypto-bY7wJCB5.js";const b="sns",T="us-east-1",H=/<Message>([\s\S]*?)<\/Message>/,q=/<MessageId>([\s\S]*?)<\/MessageId>/,D=t=>{const e=t.toISOString().replaceAll(/[:-]|\.\d{3}/g,"");return{amzDate:e,dateStamp:e.slice(0,8)}},O=async(t,e,o)=>{const i=await p(c(`AWS4${t}`),c(e)),m=await p(i,c(o)),d=await p(m,c(b));return p(d,c("aws4_request"))},k=t=>{const{pathname:e}=new URL(t);return e===""||e==="/"?"/":e.split("/").map(o=>encodeURIComponent(o).replaceAll("*","%2A").replaceAll("'","%27").replaceAll("(","%28").replaceAll(")","%29").replaceAll("!","%21")).join("/")},L=async(t,e,o,i,m)=>{const{amzDate:d,dateStamp:S}=D(new Date),f=w(await h(c(m))),a={"Content-Type":"application/x-www-form-urlencoded",host:o,"x-amz-content-sha256":f,"x-amz-date":d};t.sessionToken&&(a["x-amz-security-token"]=t.sessionToken);const n={};for(const[l,g]of Object.entries(a))n[l.toLowerCase()]=g.trim();const s=Object.keys(n).toSorted((l,g)=>l.localeCompare(g)),u=s.join(";"),y=s.map(l=>`${l}:${n[l]??""}
|
|
2
2
|
`).join(""),r=["POST",k(i),"",y,u,f].join(`
|
|
3
3
|
`),A=`${S}/${e}/${b}/aws4_request`,$=["AWS4-HMAC-SHA256",d,A,w(await h(c(r)))].join(`
|
|
4
4
|
`),I=await O(t.secretAccessKey,S,e),M=w(await p(I,c($)));return a.Authorization=`AWS4-HMAC-SHA256 Credential=${t.accessKeyId}/${A}, SignedHeaders=${u}, Signature=${M}`,{headers:a,url:i}},B=K(t=>{const e=t??{};if(!e.accessKeyId||!e.secretAccessKey)throw new x("sns",["accessKeyId","secretAccessKey"]);const o=e.region??T,i=e.endpoint??`https://sns.${o}.amazonaws.com/`,{host:m}=new URL(i),d=e.retries??3,S=e.timeout??3e4,f=async(a,n)=>{const s=new URLSearchParams;s.set("Action","Publish"),s.set("Version","2010-03-31"),s.set("PhoneNumber",a),s.set("Message",n.text),n.from&&(s.set("MessageAttributes.entry.1.Name","AWS.SNS.SMS.SenderID"),s.set("MessageAttributes.entry.1.Value.DataType","String"),s.set("MessageAttributes.entry.1.Value.StringValue",n.from));const u=s.toString(),y=await L(e,o,m,i,u),r=await C(y.url,{body:u,headers:y.headers,method:"POST",timeout:S},d);if(!r.success||!r.data)return{error:r.error instanceof Error?r.error.message:"Request failed",id:a,status:"failed"};if(r.data.status>=400)return{error:H.exec(r.data.body)?.[1]??`HTTP ${String(r.data.status)}`,id:a,status:"failed"};const A=q.exec(r.data.body)?.[1];return{id:a,messageId:A??R("sns"),status:"sent"}};return{channel:"sms",endpoint:i,features:{batchSending:!1,deliveryReceipts:!1,media:!1,scheduling:!1},id:"sns",initialize:()=>{},isAvailable:()=>!!(e.accessKeyId&&e.secretAccessKey),options:e,send:async a=>{const n=await j(z(a.to),async s=>f(s,a));return P("sns",n)},validateCredentials:()=>!!(e.accessKeyId&&e.secretAccessKey)}});export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{tryParseObject as t}from"./getHeader-C_gkdnMQ.js";const i=s=>t(s),
|
|
1
|
+
import{tryParseObject as t}from"./getHeader-C_gkdnMQ.js";const i=s=>t(s),a={parse:s=>{const e=i(s);if(e?.Type===void 0)return;const r={type:e.Type};return e.Type==="SubscriptionConfirmation"||e.Type==="UnsubscribeConfirmation"?r.subscribeUrl=e.SubscribeURL:e.Message!==void 0&&(r.message=e.Message),{messageId:e.MessageId??"",metadata:r,provider:"sns",timestamp:e.Timestamp===void 0?new Date:new Date(e.Timestamp),type:"delivered"}},verify:()=>Promise.resolve(!1)};export{a as snsWebhook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isWithinReplayWindow as m,REPLAY_WINDOW_SECONDS as v,hmacBase64 as w,hmacHex as y,timingSafeEqual as p}from"./hmacBase64-BhhoX0uo.js";import{getHeader as s,tryParseObject as g}from"./getHeader-C_gkdnMQ.js";const b="webhook-id",k="webhook-timestamp",A="webhook-signature",S=new Set(["bounced","clicked","delivered","failed","interacted","queued","read","sent"]),W=r=>{const e=atob(r),t=new Uint8Array(e.length);for(let i=0;i<e.length;i+=1)t[i]=e.codePointAt(i)??0;return t},
|
|
1
|
+
import{isWithinReplayWindow as m,REPLAY_WINDOW_SECONDS as v,hmacBase64 as w,hmacHex as y,timingSafeEqual as p}from"./hmacBase64-BhhoX0uo.js";import{getHeader as s,tryParseObject as g}from"./getHeader-C_gkdnMQ.js";const b="webhook-id",k="webhook-timestamp",A="webhook-signature",S=new Set(["bounced","clicked","delivered","failed","interacted","queued","read","sent"]),W=r=>{const e=atob(r),t=new Uint8Array(e.length);for(let i=0;i<e.length;i+=1)t[i]=e.codePointAt(i)??0;return t},D={parse:r=>{const e=g(r);if(e===void 0)return;const t=typeof e.type=="string"?e.type:void 0,i=t!==void 0&&S.has(t)?t:"delivered";return{messageId:typeof e.id=="string"?e.id:"",provider:"standard-webhooks",recipient:typeof e.recipient=="string"?e.recipient:void 0,timestamp:new Date,type:i}},verify:async(r,e,t)=>{if(t.trim()==="")return!1;const i=s(e,b),o=s(e,k),a=s(e,A);if(i===void 0||o===void 0||a===void 0||!m(o,v))return!1;const d=t.startsWith("whsec_")?W(t.slice(6)):t,c=`${i}.${o}.${r}`,l=await w(d,c,"SHA-256"),u=await y(d,c,"SHA-256"),h=a.split(" ");for(const n of h){const f=n.includes(",")?n.split(",")[1]??"":n;if(p(l,f)||p(u,f))return!0}return!1}};export{D as standardWebhook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./NotificationError-DVfMJQ1u.js";import m from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as p}from"./defineProvider-C9q-7iwt.js";import{r as u}from"./http-
|
|
1
|
+
import r from"./NotificationError-DVfMJQ1u.js";import m from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as p}from"./defineProvider-C9q-7iwt.js";import{r as u}from"./http-DT3tyixg.js";const f="https://api.telegram.org",T=p(i=>{const e=i??{};if(!e.botToken)throw new m("telegram","botToken");const o=e.endpoint??f,d=e.retries??3,c=e.timeout??3e4,l=`${o}/bot${e.botToken}/sendMessage`;return{channel:"chat",endpoint:o,features:{batchSending:!1,richContent:!0},id:"telegram",initialize:()=>{},isAvailable:()=>!!e.botToken,options:e,send:async a=>{const s=a.to??e.defaultChatId;if(s===void 0)return{error:new r("telegram","Missing chat id: provide `to` or `defaultChatId`"),success:!1};const n={chat_id:s,text:a.text};e.parseMode&&(n.parse_mode=e.parseMode);const t=await u(l,{body:JSON.stringify(n),headers:{"Content-Type":"application/json"},method:"POST",timeout:c},d);return!t.success||!t.data?{error:new r("telegram",t.error instanceof Error?t.error.message:"Request failed"),success:!1}:t.data.body.ok?{data:{channel:"chat",messageId:String(t.data.body.result?.message_id??""),provider:"telegram",response:t.data.body,sent:!0,timestamp:new Date},success:!0}:{error:new r("telegram",t.data.body.description??`HTTP ${String(t.data.status)}`),success:!1}},validateCredentials:()=>!!e.botToken}});export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import u from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as p}from"./defineProvider-C9q-7iwt.js";import{t as g}from"./credentials-CG0zkn-W.js";import{r as c}from"./http-
|
|
1
|
+
import u from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as p}from"./defineProvider-C9q-7iwt.js";import{t as g}from"./credentials-CG0zkn-W.js";import{r as c}from"./http-DT3tyixg.js";import{s as y,b as h}from"./sms-CU-OZvNU.js";const x="https://api.telnyx.com",I=p(n=>{const e=n??{};if(!e.apiKey)throw new u("telnyx","apiKey");const o=e.endpoint??x,d=e.retries??3,m=e.timeout??3e4,l=`${o}/v2/messages`,f=async(t,s)=>{const i=s.from??e.from;if(!i&&!e.messagingProfileId)return{error:"Missing sender: provide `from`, provider `from`, or `messagingProfileId`",id:t,status:"failed"};const a={text:s.text,to:t};i&&(a.from=i),e.messagingProfileId&&(a.messaging_profile_id=e.messagingProfileId),s.mediaUrls&&s.mediaUrls.length>0&&(a.media_urls=s.mediaUrls);const r=await c(l,{body:JSON.stringify(a),headers:{Authorization:`Bearer ${e.apiKey}`,"Content-Type":"application/json"},method:"POST",timeout:m},d);return!r.success||!r.data?{error:r.error instanceof Error?r.error.message:"Request failed",id:t,status:"failed"}:r.data.status>=400?{error:r.data.body.errors?.[0]?.detail??`HTTP ${String(r.data.status)}`,id:t,status:"failed"}:{id:t,messageId:r.data.body.data?.id,status:"sent"}};return{channel:"sms",endpoint:o,features:{batchSending:!1,deliveryReceipts:!0,media:!0,scheduling:!0},id:"telnyx",initialize:()=>{},isAvailable:()=>!!e.apiKey,options:e,send:async t=>{const s=await y(g(t.to),async i=>f(i,t));return h("telnyx",s)},validateCredentials:()=>!!e.apiKey}});export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as g}from"./defineProvider-C9q-7iwt.js";import{b as S,t as h}from"./credentials-CG0zkn-W.js";import{r as w}from"./http-
|
|
1
|
+
import n from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as g}from"./defineProvider-C9q-7iwt.js";import{b as S,t as h}from"./credentials-CG0zkn-W.js";import{r as w}from"./http-DT3tyixg.js";import{s as y,b as T}from"./sms-CU-OZvNU.js";const v="https://api.twilio.com",M=g(d=>{const e=d??{};if(!e.accountSid)throw new n("twilio","accountSid");if(!e.authToken)throw new n("twilio","authToken");const a=e.endpoint??v,c=e.retries??3,u=e.timeout??3e4,m=`${a}/2010-04-01/Accounts/${e.accountSid}/Messages.json`,l=S(e.accountSid,e.authToken),f=async(t,o)=>{const i=new URLSearchParams;i.set("To",t),i.set("Body",o.text);const r=o.from??e.from;if(e.messagingServiceSid)i.set("MessagingServiceSid",e.messagingServiceSid);else if(r)i.set("From",r);else return{error:"Missing sender: provide `from` on the payload or provider config",id:t,status:"failed"};for(const p of o.mediaUrls??[])i.append("MediaUrl",p);const s=await w(m,{body:i.toString(),headers:{Authorization:l,"Content-Type":"application/x-www-form-urlencoded"},method:"POST",timeout:u},c);return!s.success||!s.data?{error:s.error instanceof Error?s.error.message:"Request failed",id:t,status:"failed"}:s.data.status>=400?{error:s.data.body.error_message??`HTTP ${String(s.data.status)}`,id:t,status:"failed"}:{id:t,messageId:s.data.body.sid,status:"sent"}};return{channel:"sms",endpoint:a,features:{batchSending:!1,deliveryReceipts:!0,media:!0,scheduling:!0},id:"twilio",initialize:()=>{},isAvailable:()=>!!(e.accountSid&&e.authToken),options:e,send:async t=>{const o=await y(h(t.to),async i=>f(i,t));return T("twilio",o)},validateCredentials:()=>!!(e.accountSid&&e.authToken)}});export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hmacBase64 as u,timingSafeEqual as c}from"./hmacBase64-BhhoX0uo.js";import{getHeader as a}from"./getHeader-C_gkdnMQ.js";const m="X-Twilio-Signature",f={delivered:"delivered",failed:"failed",queued:"queued",sending:"queued",sent:"sent",undelivered:"failed"},S=(i,e)=>{const r=Object.keys(e).toSorted((o,s)=>o.localeCompare(s));let t=i;for(const o of r)t+=`${o}${e[o]??""}`;return t},n=i=>{const e={};return new URLSearchParams(i).forEach((r,t)=>{e[t]=r}),e},g={parse:i=>{const e=n(i),r=e.MessageStatus??e.SmsStatus??e.CallStatus;if(r===void 0)return;const t=f[r.toLowerCase()];return t===void 0?void 0:{channel:"sms",messageId:e.MessageSid??e.SmsSid??e.CallSid??"",provider:"twilio",recipient:e.To,timestamp:new Date,type:t}},verify:async(i,e,r)=>{if(r.trim()==="")return!1;const t=a(e,m),o=a(e,"x-twilio-signature-url");if(t===void 0||o===void 0)return!1;const s=n(i),d=S(o,s),l=await u(r,d,"SHA-1");return c(l,t)}};export{g as twilioWebhook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as l}from"./defineProvider-C9q-7iwt.js";import{t as g}from"./credentials-CG0zkn-W.js";import{r as y}from"./http-
|
|
1
|
+
import n from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as l}from"./defineProvider-C9q-7iwt.js";import{t as g}from"./credentials-CG0zkn-W.js";import{r as y}from"./http-DT3tyixg.js";import{s as v,b as w}from"./sms-CU-OZvNU.js";const S="https://rest.nexmo.com",P=l(d=>{const e=d??{};if(!e.apiKey)throw new n("vonage","apiKey");if(!e.apiSecret)throw new n("vonage","apiSecret");const o=e.endpoint??S,p=e.retries??3,c=e.timeout??3e4,m=`${o}/sms/json`,f=async(t,a)=>{const s=a.from??e.from;if(!s)return{error:"Missing sender: provide `from` on the payload or provider config",id:t,status:"failed"};const u=new URLSearchParams({api_key:e.apiKey,api_secret:e.apiSecret,from:s,text:a.text,to:t}),r=await y(m,{body:u.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",timeout:c},p);if(!r.success||!r.data)return{error:r.error instanceof Error?r.error.message:"Request failed",id:t,status:"failed"};const i=r.data.body.messages?.[0];return i?.status!=="0"?{error:i?.["error-text"]??`Vonage status ${i?.status??"unknown"}`,id:t,status:"failed"}:{id:t,messageId:i["message-id"],status:"sent"}};return{channel:"sms",endpoint:o,features:{batchSending:!1,deliveryReceipts:!0,media:!1},id:"vonage",initialize:()=>{},isAvailable:()=>!!(e.apiKey&&e.apiSecret),options:e,send:async t=>{const a=await v(g(t.to),async s=>f(s,t));return w("vonage",a)},validateCredentials:()=>!!(e.apiKey&&e.apiSecret)}});export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import K from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as C}from"./defineProvider-C9q-7iwt.js";import{t as A}from"./credentials-CG0zkn-W.js";import{m as E}from"./http-
|
|
1
|
+
import K from"./RequiredOptionError-CuL42XRq.js";import{defineProvider as C}from"./defineProvider-C9q-7iwt.js";import{t as A}from"./credentials-CG0zkn-W.js";import{m as E}from"./http-DT3tyixg.js";import{n as U}from"./id-C_FRCsUM.js";import{a as $}from"./sms-CU-OZvNU.js";import{u as y,f as S,t as f,s as d,r as k,c as g,h as P,a as T}from"./webcrypto-bY7wJCB5.js";const j=2419200,x=i=>{let e=i;if(typeof i=="string")try{e=JSON.parse(i)}catch{return}const t=e;if(!(!t||typeof t.endpoint!="string"||typeof t.keys?.p256dh!="string"||typeof t.keys.auth!="string"))return t},B=async(i,e)=>{const t=S(e),p=f(t.slice(1,33)),r=f(t.slice(33,65));return d().importKey("jwk",{crv:"P-256",d:i,ext:!0,key_ops:["sign"],kty:"EC",x:p,y:r},{name:"ECDSA",namedCurve:"P-256"},!1,["sign"])},D=async(i,e,t)=>{const p=f(y(JSON.stringify({alg:"ES256",typ:"JWT"}))),r=f(y(JSON.stringify({aud:i,exp:Math.floor(Date.now()/1e3)+720*60,sub:e}))),u=`${p}.${r}`,a=await d().sign({hash:"SHA-256",name:"ECDSA"},t,y(u));return`${u}.${f(new Uint8Array(a))}`},H=async(i,e)=>{const t=S(i.keys.p256dh),p=S(i.keys.auth),r=k(16),u=await d().generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveBits"]),a=new Uint8Array(await d().exportKey("raw",u.publicKey)),n=await d().importKey("raw",t,{name:"ECDH",namedCurve:"P-256"},!1,[]),m=new Uint8Array(await d().deriveBits({name:"ECDH",public:n},u.privateKey,256)),s=g(y("WebPush: info\0"),t,a),l=await P(p,m,s,32),v=await P(r,l,y("Content-Encoding: aes128gcm\0"),16),w=await P(r,l,y("Content-Encoding: nonce\0"),12),b=await d().importKey("raw",v,{name:"AES-GCM"},!1,["encrypt"]),h=g(e,new Uint8Array([2])),o=new Uint8Array(await d().encrypt({iv:w,name:"AES-GCM"},b,h)),c=g(r,T(4096,4),new Uint8Array([a.length]),a);return g(c,o)},z=C(i=>{const e=i??{};if(!e.vapidPublicKey||!e.vapidPrivateKey||!e.vapidSubject)throw new K("web-push",["vapidPublicKey","vapidPrivateKey","vapidSubject"]);const t=e.ttl??j,p=e.urgency??"normal",r=e.timeout??3e4,u=async(a,n,m)=>{const s=x(a);if(!s)return{error:"Invalid push subscription (expected { endpoint, keys: { p256dh, auth } })",id:a,status:"failed"};const{origin:l}=new URL(s.endpoint),v=await D(l,e.vapidSubject,m),w=JSON.stringify({badge:n.badge,body:n.body,data:n.data,image:n.imageUrl,title:n.title}),b=await H(s,y(w)),h={Authorization:`vapid t=${v},k=${e.vapidPublicKey}`,"Content-Encoding":"aes128gcm","Content-Type":"application/octet-stream",TTL:String(t),Urgency:p},o=await E(s.endpoint,{body:b,headers:h,method:"POST",timeout:r});if(!o.success||!o.data)return{error:o.error instanceof Error?o.error.message:"Request failed",id:a,status:"failed"};const{status:c}=o.data;return c===404||c===410?{error:`Subscription gone (HTTP ${String(c)}) — remove this subscription`,id:a,status:"failed"}:c>=400?{error:`HTTP ${String(c)}: ${typeof o.data.body=="string"?o.data.body:""}`.trim(),id:a,status:"failed"}:{id:a,messageId:U("web-push"),status:"sent"}};return{channel:"push",features:{batchSending:!1,media:!1,richContent:!0},id:"web-push",initialize:()=>{},isAvailable:()=>!!(e.vapidPublicKey&&e.vapidPrivateKey&&e.vapidSubject),options:e,send:async a=>{const n=A(a.to),m=await B(e.vapidPrivateKey,e.vapidPublicKey),s=[];for(const l of n)s.push(await u(l,a,m));return $("push","web-push",s)},validateCredentials:()=>!!(e.vapidPublicKey&&e.vapidPrivateKey&&e.vapidSubject)}});export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import s from"./NotificationError-DVfMJQ1u.js";import i from"./RequiredOptionError-CuL42XRq.js";import{r as d}from"./http-
|
|
1
|
+
import s from"./NotificationError-DVfMJQ1u.js";import i from"./RequiredOptionError-CuL42XRq.js";import{r as d}from"./http-DT3tyixg.js";import{n as u}from"./id-C_FRCsUM.js";const w=(t={})=>{const a=t.retries??3,n=t.timeout??3e4;return{channel:"webhook",endpoint:t.url,features:{},id:"webhook",initialize:()=>{},isAvailable:()=>!0,send:async o=>{const r=o.url??t.url;if(!r)throw new i("webhook","url");const e=await d(r,{body:typeof o.body=="string"?o.body:JSON.stringify(o.body),headers:{"Content-Type":"application/json",...t.headers,...o.headers},method:o.method??t.method??"POST",timeout:n},a);return!e.success||!e.data?{error:new s("webhook",e.error instanceof Error?e.error.message:"Request failed"),success:!1}:e.data.status>=400?{error:new s("webhook",`HTTP ${String(e.data.status)}`),success:!1}:{data:{channel:"webhook",messageId:u("webhook"),provider:"webhook",response:e.data.body,sent:!0,timestamp:new Date},success:!0}}}};export{w as webhookProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../../../packem_shared/discordProvider-
|
|
1
|
+
import{default as o}from"../../../packem_shared/discordProvider-BhfXcCcI.js";export{o as discordProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../../packem_shared/msTeamsProvider-
|
|
1
|
+
import{default as a}from"../../../packem_shared/msTeamsProvider-DrmL3RYX.js";export{a as msTeamsProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"../../../packem_shared/slackProvider-
|
|
1
|
+
import{default as e}from"../../../packem_shared/slackProvider-DPG1IlA0.js";export{e as slackProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../../packem_shared/telegramProvider-
|
|
1
|
+
import{default as a}from"../../../packem_shared/telegramProvider-wyx3ksVm.js";export{a as telegramProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../../packem_shared/expoProvider-
|
|
1
|
+
import{default as r}from"../../../packem_shared/expoProvider-DsZR4sUk.js";export{r as expoProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as f}from"../../../packem_shared/fcmProvider-
|
|
1
|
+
import{default as f}from"../../../packem_shared/fcmProvider-DWRx8XBv.js";export{f as fcmProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../../../packem_shared/webPushProvider-
|
|
1
|
+
import{default as o}from"../../../packem_shared/webPushProvider-DwjmWASr.js";export{o as webPushProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../../packem_shared/messageBirdProvider-
|
|
1
|
+
import{default as a}from"../../../packem_shared/messageBirdProvider-BfiTaNLn.js";export{a as messageBirdProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"../../../packem_shared/plivoProvider-
|
|
1
|
+
import{default as e}from"../../../packem_shared/plivoProvider-Dr8d5yD3.js";export{e as plivoProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../../../packem_shared/snsProvider-
|
|
1
|
+
import{default as o}from"../../../packem_shared/snsProvider-C2T2UxDK.js";export{o as snsProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../../../packem_shared/telnyxProvider-
|
|
1
|
+
import{default as o}from"../../../packem_shared/telnyxProvider-jgpEwgPh.js";export{o as telnyxProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"../../../packem_shared/twilioProvider-
|
|
1
|
+
import{default as e}from"../../../packem_shared/twilioProvider-DMYWqvgZ.js";export{e as twilioProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../../packem_shared/vonageProvider-
|
|
1
|
+
import{default as r}from"../../../packem_shared/vonageProvider-CT4KoWXu.js";export{r as vonageProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{webhookProvider as e}from"../../packem_shared/webhookProvider-
|
|
1
|
+
import{webhookProvider as e}from"../../packem_shared/webhookProvider-CPA1nKXJ.js";export{e as webhookProvider};
|
package/dist/webhooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hmacBase64 as
|
|
1
|
+
import{hmacBase64 as r,hmacHex as t,timingSafeEqual as a}from"../packem_shared/hmacBase64-BhhoX0uo.js";import{slackWebhook as f}from"../packem_shared/slackWebhook-Cpmm_0El.js";import{snsWebhook as h}from"../packem_shared/snsWebhook-BKBTQyEW.js";import{standardWebhook as k}from"../packem_shared/standardWebhook-Bk0UUeDW.js";import{twilioWebhook as b}from"../packem_shared/twilioWebhook-C-Iwuv7y.js";import{getHeader as W}from"../packem_shared/getHeader-C_gkdnMQ.js";export{W as getHeader,r as hmacBase64,t as hmacHex,f as slackWebhook,h as snsWebhook,k as standardWebhook,a as timingSafeEqual,b as twilioWebhook};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/notification",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.4",
|
|
4
4
|
"description": "A reusable, ESM-only, edge-ready multi-channel notification library with SMS, push, chat, in-app and webhook providers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"notification",
|
|
@@ -230,11 +230,11 @@
|
|
|
230
230
|
"peerDependencies": {
|
|
231
231
|
"@aws-sdk/client-sqs": "^3.0.0",
|
|
232
232
|
"@opentelemetry/api": "^1.0.0 || ^2.0.0",
|
|
233
|
-
"@visulima/email": "1.0.0-alpha.
|
|
234
|
-
"@visulima/workflow": "1.0.0-alpha.
|
|
233
|
+
"@visulima/email": "1.0.0-alpha.44",
|
|
234
|
+
"@visulima/workflow": "1.0.0-alpha.2",
|
|
235
235
|
"bullmq": "^5.0.0",
|
|
236
236
|
"croner": "^10.0.1",
|
|
237
|
-
"handlebars": "4.7.9",
|
|
237
|
+
"handlebars": ">=4.7.9",
|
|
238
238
|
"intl-messageformat": "^11.0.0",
|
|
239
239
|
"liquidjs": "^10.0.0",
|
|
240
240
|
"pg-boss": "^10.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const n=async(e,s={})=>{const u=new AbortController,c=s.timeout??3e4,a=setTimeout(()=>{u.abort()},c);try{const t=await fetch(e,{body:s.body,headers:s.headers,method:s.method??"GET",signal:u.signal}),r=await t.text();let o=r;if(r.length>0)try{o=JSON.parse(r)}catch{o=r}const i={};return t.headers.forEach((d,h)=>{i[h]=d}),{data:{body:o,headers:i,status:t.status,statusText:t.statusText},success:!0}}catch(t){return{error:t,success:!1}}finally{clearTimeout(a)}},l=e=>e===408||e===429||e>=500,m=async(e,s={},u=3,c=250)=>{let a=await n(e,s);for(let t=0;t<u;t+=1){if(!(!a.success||a.data!==void 0&&l(a.data.status)))return a;const r=c*2**t+Math.floor(Math.random()*c);await new Promise(o=>setTimeout(o,r)),a=await n(e,s)}return a};export{n as m,m as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hmacBase64 as u,timingSafeEqual as c}from"./hmacBase64-BhhoX0uo.js";import{getHeader as o}from"./getHeader-C_gkdnMQ.js";const f="X-Twilio-Signature",m={delivered:"delivered",failed:"failed",queued:"queued",sending:"queued",sent:"sent",undelivered:"failed"},S=(i,e)=>{const r=Object.keys(e).toSorted((a,s)=>a.localeCompare(s));let t=i;for(const a of r)t+=`${a}${e[a]??""}`;return t},n=i=>{const e={};return new URLSearchParams(i).forEach((r,t)=>{e[t]=r}),e},g={parse:i=>{const e=n(i),r=e.MessageStatus??e.SmsStatus??e.CallStatus;if(r===void 0)return;const t=m[r.toLowerCase()];return t===void 0?void 0:{channel:"sms",messageId:e.MessageSid??e.SmsSid??e.CallSid??"",provider:"twilio",recipient:e.To,timestamp:new Date,type:t}},verify:async(i,e,r)=>{if(r.trim()==="")return!1;const t=o(e,f),a=o(e,"x-twilio-signature-url");if(t===void 0||a===void 0)return!1;const s=n(i),d=S(a,s),l=await u(r,d,"SHA-1");return c(l,t)}};export{g as default,g as twilioWebhook};
|