@lunora/mail 1.0.0-alpha.51 → 1.0.0-alpha.52
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/inbound/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createInboundEmailHandler as r,dispatchToLunoraFunction as a}from"../packem_shared/createInboundEmailHandler-
|
|
1
|
+
import{createInboundEmailHandler as r,dispatchToLunoraFunction as a}from"../packem_shared/createInboundEmailHandler-CTary3dz.mjs";import{parseInboundEmail as t}from"../packem_shared/parseInboundEmail-CqU52y3O.mjs";export{r as createInboundEmailHandler,a as dispatchToLunoraFunction,t as parseInboundEmail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as i}from"@lunora/errors";import{D as c,p as d}from"./shard-C0aRRoVy.mjs";const u=n=>{let r="";for(let e=0;e<n.length;e+=32768)r+=String.fromCharCode(...n.subarray(e,e+32768));return btoa(r)},h="message could not be processed",f=(n,r)=>{console.error("@lunora/mail/inbound: dropping message —",n),r.message.setReject(h)},N=n=>{const r=n.onError??f;return async(t,e,s)=>{const a={ctx:s,env:e,message:t};try{const o=await n.parse(t.raw);if(n.verify&&await n.verify(o,a)===!1)throw new i("INTERNAL","@lunora/mail/inbound: sender verification rejected the message");await n.dispatch(o,a)}catch(o){await r(o,a)}}},l=n=>n.attachments.length===0?n:{...n,attachments:n.attachments.map(r=>{const{content:t}=r;if(typeof t=="string")return r;const e=t instanceof Uint8Array?t:new Uint8Array(t);return{...r,content:u(e),encoding:"base64"}})},g=n=>{const r=n.shardKey??c,t=n.resolveArgs??(e=>l(e));return async(e,s)=>{const a=n.adminToken??(typeof s.env.LUNORA_ADMIN_TOKEN=="string"?s.env.LUNORA_ADMIN_TOKEN:void 0);if(a===void 0||a==="")throw new i("INTERNAL","@lunora/mail/inbound: missing LUNORA_ADMIN_TOKEN — cannot authorize inbound dispatch to the shard RPC.");const o={args:t(e,s),functionPath:n.functionPath,shardKey:r};await d(n.shard,{adminToken:a,envelope:o,jurisdiction:n.jurisdiction,label:`@lunora/mail/inbound: dispatch to \`${n.functionPath}\``,shardKey:r})}};export{N as createInboundEmailHandler,g as dispatchToLunoraFunction};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/mail",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.52",
|
|
4
4
|
"description": "Email for Lunora: Resend adapter, TSX templates, and queue-backed sends",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
57
|
+
"@lunora/errors": "1.0.0-alpha.23",
|
|
58
58
|
"@react-email/render": "2.1.0",
|
|
59
59
|
"@visulima/email": "2.1.8",
|
|
60
60
|
"postal-mime": "2.7.6"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as c}from"@lunora/errors";import{D as d,p as u}from"./shard-C0aRRoVy.mjs";const f="message could not be processed",h=(r,e)=>{console.error("@lunora/mail/inbound: dropping message —",r),e.message.setReject(f)},g=r=>{const e=r.onError??h;return async(n,t,s)=>{const a={ctx:s,env:t,message:n};try{const o=await r.parse(n.raw);if(r.verify&&await r.verify(o,a)===!1)throw new c("INTERNAL","@lunora/mail/inbound: sender verification rejected the message");await r.dispatch(o,a)}catch(o){await e(o,a)}}},i=32768,l=r=>{let e="";for(let n=0;n<r.length;n+=i)e+=String.fromCharCode(...r.subarray(n,n+i));return btoa(e)},E=r=>r.attachments.length===0?r:{...r,attachments:r.attachments.map(e=>{const{content:n}=e;if(typeof n=="string")return e;const t=n instanceof Uint8Array?n:new Uint8Array(n);return{...e,content:l(t),encoding:"base64"}})},y=r=>{const e=r.shardKey??d,n=r.resolveArgs??(t=>E(t));return async(t,s)=>{const a=r.adminToken??(typeof s.env.LUNORA_ADMIN_TOKEN=="string"?s.env.LUNORA_ADMIN_TOKEN:void 0);if(a===void 0||a==="")throw new c("INTERNAL","@lunora/mail/inbound: missing LUNORA_ADMIN_TOKEN — cannot authorize inbound dispatch to the shard RPC.");const o={args:n(t,s),functionPath:r.functionPath,shardKey:e};await u(r.shard,{adminToken:a,envelope:o,jurisdiction:r.jurisdiction,label:`@lunora/mail/inbound: dispatch to \`${r.functionPath}\``,shardKey:e})}};export{g as createInboundEmailHandler,y as dispatchToLunoraFunction};
|