@wraps.dev/cli 2.10.5 → 2.11.2

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.
@@ -1 +1 @@
1
- Built at: 2026-02-06T16:05:31.112Z
1
+ Built at: 2026-02-09T00:04:42.521Z
@@ -1 +1 @@
1
- Built at: 2026-02-06T16:05:31.190Z
1
+ Built at: 2026-02-09T00:04:42.612Z
@@ -67,7 +67,7 @@ ${$0(e.cont)}`}}function uc(e,x){return x.map((t,i,{length:u})=>ac(e,t,i===u-1))
67
67
  `),this.textAsHtml=u.textAsHtml=x.map(a=>this.textToHtml(a)).join(`<br/>
68
68
  `)),u}processChunk(x,t){let i=null;switch(x._parentBoundary&&(i=this._getPartId(x._parentBoundary)),x.type){case"node":{let u=this.createNode(x);if(u===this.tree&&(["subject","references","date","to","from","to","cc","bcc","message-id","in-reply-to","reply-to"].forEach(a=>{u.headers.has(a)&&(this[a.replace(/-([a-z])/g,(r,E)=>E.toUpperCase())]=u.headers.get(a))}),this.emit("headers",u.headers),u.headerLines&&this.emit("headerLines",u.headerLines)),x.contentType==="message/rfc822"&&x.messageNode)break;if(x.parentNode&&x.parentNode.contentType==="message/rfc822"&&(u.showMeta=!0),u.isAttachment){let a=u.contentType;u.contentType==="application/octet-stream"&&x.filename&&(a=this.libmime.detectMimeType(x.filename)||"application/octet-stream");let r={type:"attachment",content:null,contentType:a,partId:i,release:()=>{r.release=null,this.waitUntilAttachmentEnd&&typeof this.attachmentCallback=="function"&&setImmediate(this.attachmentCallback),this.attachmentCallback=!1,this.waitUntilAttachmentEnd=!1}},E=this.options.checksumAlgo||"md5",n=new M1(r,E);if(u.decoder.on("error",s=>{n.emit("error",s)}),u.decoder.on("readable",()=>{let s;for(;(s=u.decoder.read())!==null;)n.write(s)}),u.decoder.once("end",()=>{n.end()}),r.content=n,this.waitUntilAttachmentEnd=!0,x.disposition&&(r.contentDisposition=x.disposition),x.filename&&(r.filename=x.filename),u.headers.has("content-id")){r.contentId=[].concat(u.headers.get("content-id")||[]).shift(),r.cid=r.contentId.trim().replace(/^<|>$/g,"").trim();let s=u;for(;s=s.parent;)s.contentType==="multipart/related"&&(r.related=!0)}r.headers=u.headers,this.push(r),this.attachmentList.push(r)}else if(u.disposition==="inline"){let a=[],r=0;if(u.contentStream=u.decoder,u.contentType==="text/plain"?this.hasText=!0:u.contentType==="text/html"?this.hasHtml=!0:u.contentType==="message/delivery-status"&&!this.options.keepDeliveryStatus&&(this.hasText=!0),u.node.flowed){let n=u.contentStream,s=new z1({delSp:u.node.delSp});n.on("error",o=>{s.emit("error",o)}),n.pipe(s),u.contentStream=s}let E=u.charset||"utf-8";if(!["ascii","usascii","utf8"].includes(E.toLowerCase().replace(/[^a-z0-9]+/g,"")))try{let n=u.contentStream,s=this.decoder.decodeStream(E);n.on("error",o=>{s.emit("error",o)}),n.pipe(s),u.contentStream=s}catch{}u.contentStream.on("readable",()=>{let n;for(;(n=u.contentStream.read())!==null;)typeof n=="string"&&(n=Buffer.from(n)),a.push(n),r+=n.length}),u.contentStream.once("end",()=>{u.textContent=Buffer.concat(a,r).toString().replace(/\r?\n/g,`
69
69
  `)}),u.contentStream.once("error",n=>{this.emit("error",n)})}break}case"data":if(this.curnode&&this.curnode.decoder&&this.curnode.decoder.end(),this.waitUntilAttachmentEnd){this.attachmentCallback=t;return}break;case"body":if(this.curnode&&this.curnode.decoder&&this.curnode.decoder.writable&&this.curnode.decoder.write(x.value)===!1)return this.curnode.decoder.once("drain",t);break}setImmediate(t)}_getPartId(x){let t=this.boundaries.findIndex(u=>u.name===x);t===-1?(this.boundaries.push({name:x,count:1}),t=this.boundaries.length-1):this.boundaries[t].count++;let i="1";for(let u=0;u<=t;u++)u===0?i=this.boundaries[u].count.toString():i+="."+this.boundaries[u].count.toString();return i}getAddressesHTML(x){let t=i=>i.map(u=>{let a='<span class="mp_address_group">';if(u.name&&(a+='<span class="mp_address_name">'+P0.encode(u.name)+(u.group?": ":"")+"</span>"),u.address){let r='<a href="mailto:'+P0.encode(u.address)+'" class="mp_address_email">'+P0.encode(u.address)+"</a>";u.name?a+=" &lt;"+r+"&gt;":a+=r}return u.group&&(a+=t(u.group)+";"),a+"</span>"}).join(", ");return t([].concat(x||[]))}getAddressesText(x){let t=i=>i.map(u=>{let a="";if(u.name&&(a+=`"${u.name}"`+(u.group?": ":"")),u.address){let r=u.address;u.name?a+=" <"+r+">":a+=r}return u.group&&(a+=t(u.group)+";"),a}).join(", ");return t([].concat(x||[]))}updateImageLinks(x,t){if(!this.html)return setImmediate(()=>t(null,!1));let i=new Map,u=(this.html||"").toString();if(this.options.skipImageLinks)return t(null,u);u.replace(/\bcid:([^'"\s]{1,256})/g,(n,s)=>{for(let o=0,c=this.attachmentList.length;o<c;o++)if(this.attachmentList[o].cid===s&&/^image\/[\w]+$/i.test(this.attachmentList[o].contentType)){i.set(s,{attachment:this.attachmentList[o]});break}return n});let a=[];i.forEach(n=>{a.push(n)});let r=0,E=()=>{if(r>=a.length)return u=u.replace(/\bcid:([^'"\s]{1,256})/g,(s,o)=>i.has(o)&&i.get(o).url?i.get(o).url:s),t(null,u);let n=a[r++];x(n.attachment,(s,o)=>{if(s)return setImmediate(()=>t(s));n.url=o,setImmediate(E)})};setImmediate(E)}textToHtml(x){if(this.options.skipTextToHtml)return"";x=(x||"").toString();let t,i=!1;if(!this.options.skipTextLinks)try{if(Zt.pretest(x)){i=!0;let a=Zt.match(x)||[],r=[],E=0;a.forEach(s=>{if(E<s.index){let o=P0.encode(x.slice(E,s.index),{useNamedReferences:!0});r.push(o)}r.push(`<a href="${s.url}">${s.text}</a>`),E=s.lastIndex});let n=P0.encode(x.slice(E),{useNamedReferences:!0});r.push(n),t=r.join("")}}catch{}return i||(t=P0.encode(x,{useNamedReferences:!0})),"<p>"+t.replace(/\r?\n/g,`
70
- `).trim().replace(/[ \t]+$/gm,"").trim().replace(/\n\n+/g,"</p><p>").trim().replace(/\n/g,"<br/>")+"</p>"}};z9.exports=cr});var H9=l((uB,M9)=>{"use strict";var W1=Ar();M9.exports=(e,x,t)=>{if(e==null)throw new TypeError("Input cannot be null or undefined.");!t&&typeof x=="function"&&(t=x,x=!1);let i;t||(i=new Promise((s,o)=>{t=$1(s,o)})),x=x||{};let u=!!x.keepCidLinks,a={attachments:[]},r=new W1(x);r.on("error",s=>{t(s)}),r.on("headers",s=>{a.headers=s,a.headerLines=r.headerLines});let E=!1,n=()=>{E=!0;let s=r.read();if(s===null){E=!1;return}if(s.type==="text"&&Object.keys(s).forEach(o=>{["text","html","textAsHtml"].includes(o)&&(a[o]=s[o])}),s.type==="attachment"){a.attachments.push(s);let o=[],c=0;s.content.on("readable",()=>{let p;for(;(p=s.content.read())!==null;)o.push(p),c+=p.length}),s.content.on("end",()=>{s.content=Buffer.concat(o,c),s.release(),n()})}else n()};return r.on("readable",()=>{E||n()}),r.on("end",()=>{if(["subject","references","date","to","from","to","cc","bcc","message-id","in-reply-to","reply-to"].forEach(s=>{a.headers&&a.headers.has(s)&&(a[s.replace(/-([a-z])/g,(o,c)=>c.toUpperCase())]=a.headers.get(s))}),u)return t(null,a);r.updateImageLinks((s,o)=>o(!1,"data:"+s.contentType+";base64,"+s.content.toString("base64")),(s,o)=>{if(s)return t(s);a.html=o,t(null,a)})}),typeof e=="string"?r.end(Buffer.from(e)):Buffer.isBuffer(e)?r.end(e):e.once("error",s=>{e.destroy(),r.destroy(),t(s)}).pipe(r),i};function $1(e,x){return function(...t){let i=t.shift();i?x(i):e(...t)}}});var G9=l((aB,V9)=>{"use strict";var Z1=Ar(),K1=H9();V9.exports={MailParser:Z1,simpleParser:K1}});var K9=u2(G9(),1);import{randomUUID as J9}from"node:crypto";import{EventBridgeClient as Y1,PutEventsCommand as Q1}from"@aws-sdk/client-eventbridge";import{GetObjectCommand as X1,PutObjectCommand as W9,S3Client as xl}from"@aws-sdk/client-s3";var Br=new xl({}),el=new Y1({}),$9=process.env.BUCKET_NAME,tl=process.env.INBOUND_EVENT_SOURCE||"wraps.inbound",Z9=200*1024;async function sB(e,x){let t=x.awsRequestId,i=J9().slice(0,8),u=(r,E)=>{console.log(JSON.stringify({requestId:t,batchId:i,msg:r,...E}))},a=(r,E,n)=>{console.error(JSON.stringify({requestId:t,batchId:i,msg:r,error:String(E),...n}))};u("Processing inbound email batch",{recordCount:e.Records.length});for(let r of e.Records){let E=decodeURIComponent(r.s3.object.key.replace(/\+/g," ")),n=r.s3.bucket.name;try{u("Processing raw email",{bucket:n,key:E});let o=await(await Br.send(new X1({Bucket:n,Key:E}))).Body.transformToString(),c=await(0,K9.simpleParser)(o),p=`inb_${J9().replace(/-/g,"").slice(0,12)}`,B={};if(c.headers)for(let[T,M]of c.headers){let R0=typeof M=="object"&&M!==null&&"text"in M?M.text:String(M);B[T]?B[T]=`${B[T]}, ${R0}`:B[T]=R0}let f=B["x-ses-spam-verdict"]||null,_=B["x-ses-virus-verdict"]||null,x0=[];if(c.attachments&&c.attachments.length>0)for(let T=0;T<c.attachments.length;T++){let M=c.attachments[T],R0=`att_${T}`,Qt=(M.filename||`attachment_${T}`).replace(/[^a-zA-Z0-9._-]/g,"_"),ge=`attachments/${p}/${R0}-${Qt}`;await Br.send(new W9({Bucket:$9,Key:ge,Body:M.content,ContentType:M.contentType||"application/octet-stream"})),x0.push({id:R0,filename:M.filename||`attachment_${T}`,contentType:M.contentType||"application/octet-stream",size:M.size,s3Key:ge,contentDisposition:M.contentDisposition||"attachment",cid:M.cid||null})}let ex=c.html||null,Vx=!1;ex&&ex.length>Z9&&(ex=ex.slice(0,Z9),Vx=!0);let Kt=c.to?(Array.isArray(c.to)?c.to:[c.to]).flatMap(T=>"value"in T?T.value:[T]).map(T=>({address:T.address||"",name:T.name||""})):[],Yt=c.from?.value?.[0]?{address:c.from.value[0].address||"",name:c.from.value[0].name||""}:{address:"",name:""},tx={emailId:p,messageId:c.messageId||E.replace("raw/",""),from:Yt,to:Kt,cc:c.cc?(Array.isArray(c.cc)?c.cc:[c.cc]).flatMap(T=>"value"in T?T.value:[T]).map(T=>({address:T.address||"",name:T.name||""})):[],subject:c.subject||"",date:c.date?.toISOString()||new Date().toISOString(),html:ex,htmlTruncated:Vx,text:c.text||null,headers:B,attachments:x0,spamVerdict:f,virusVerdict:_,rawS3Key:E,receivedAt:new Date().toISOString()};await Br.send(new W9({Bucket:$9,Key:`parsed/${p}.json`,Body:JSON.stringify(tx),ContentType:"application/json"})),u("Stored parsed email",{emailId:p,attachmentCount:x0.length}),await el.send(new Q1({Entries:[{Source:tl,DetailType:"email.received",Detail:JSON.stringify(tx)}]})),u("Published EventBridge event",{emailId:p})}catch(s){throw a("Error processing inbound email",s,{s3Key:E}),s}}return{statusCode:200,body:JSON.stringify({message:"Inbound emails processed"})}}export{sB as handler};
70
+ `).trim().replace(/[ \t]+$/gm,"").trim().replace(/\n\n+/g,"</p><p>").trim().replace(/\n/g,"<br/>")+"</p>"}};z9.exports=cr});var H9=l((uB,M9)=>{"use strict";var W1=Ar();M9.exports=(e,x,t)=>{if(e==null)throw new TypeError("Input cannot be null or undefined.");!t&&typeof x=="function"&&(t=x,x=!1);let i;t||(i=new Promise((s,o)=>{t=$1(s,o)})),x=x||{};let u=!!x.keepCidLinks,a={attachments:[]},r=new W1(x);r.on("error",s=>{t(s)}),r.on("headers",s=>{a.headers=s,a.headerLines=r.headerLines});let E=!1,n=()=>{E=!0;let s=r.read();if(s===null){E=!1;return}if(s.type==="text"&&Object.keys(s).forEach(o=>{["text","html","textAsHtml"].includes(o)&&(a[o]=s[o])}),s.type==="attachment"){a.attachments.push(s);let o=[],c=0;s.content.on("readable",()=>{let p;for(;(p=s.content.read())!==null;)o.push(p),c+=p.length}),s.content.on("end",()=>{s.content=Buffer.concat(o,c),s.release(),n()})}else n()};return r.on("readable",()=>{E||n()}),r.on("end",()=>{if(["subject","references","date","to","from","to","cc","bcc","message-id","in-reply-to","reply-to"].forEach(s=>{a.headers&&a.headers.has(s)&&(a[s.replace(/-([a-z])/g,(o,c)=>c.toUpperCase())]=a.headers.get(s))}),u)return t(null,a);r.updateImageLinks((s,o)=>o(!1,"data:"+s.contentType+";base64,"+s.content.toString("base64")),(s,o)=>{if(s)return t(s);a.html=o,t(null,a)})}),typeof e=="string"?r.end(Buffer.from(e)):Buffer.isBuffer(e)?r.end(e):e.once("error",s=>{e.destroy(),r.destroy(),t(s)}).pipe(r),i};function $1(e,x){return function(...t){let i=t.shift();i?x(i):e(...t)}}});var G9=l((aB,V9)=>{"use strict";var Z1=Ar(),K1=H9();V9.exports={MailParser:Z1,simpleParser:K1}});var K9=u2(G9(),1);import{randomUUID as J9}from"node:crypto";import{EventBridgeClient as Y1,PutEventsCommand as Q1}from"@aws-sdk/client-eventbridge";import{GetObjectCommand as X1,PutObjectCommand as W9,S3Client as xl}from"@aws-sdk/client-s3";var Br=new xl({}),el=new Y1({}),$9=process.env.BUCKET_NAME,tl=process.env.INBOUND_EVENT_SOURCE||"wraps.inbound",Z9=200*1024;async function sB(e,x){let t=x.awsRequestId,i=J9().slice(0,8),u=(r,E)=>{console.log(JSON.stringify({requestId:t,batchId:i,msg:r,...E}))},a=(r,E,n)=>{console.error(JSON.stringify({requestId:t,batchId:i,msg:r,error:String(E),...n}))};u("Processing inbound email batch",{recordCount:e.Records.length});for(let r of e.Records){let E=decodeURIComponent(r.s3.object.key.replace(/\+/g," ")),n=r.s3.bucket.name;try{u("Processing raw email",{bucket:n,key:E});let o=await(await Br.send(new X1({Bucket:n,Key:E}))).Body?.transformToString(),c=await(0,K9.simpleParser)(o),p=`inb_${J9().replace(/-/g,"").slice(0,12)}`,B={};if(c.headers)for(let[T,M]of c.headers){let R0=typeof M=="object"&&M!==null&&"text"in M?M.text:String(M);B[T]?B[T]=`${B[T]}, ${R0}`:B[T]=R0}let f=B["x-ses-spam-verdict"]||null,_=B["x-ses-virus-verdict"]||null,x0=[];if(c.attachments&&c.attachments.length>0)for(let T=0;T<c.attachments.length;T++){let M=c.attachments[T],R0=`att_${T}`,Qt=(M.filename||`attachment_${T}`).replace(/[^a-zA-Z0-9._-]/g,"_"),ge=`attachments/${p}/${R0}-${Qt}`;await Br.send(new W9({Bucket:$9,Key:ge,Body:M.content,ContentType:M.contentType||"application/octet-stream"})),x0.push({id:R0,filename:M.filename||`attachment_${T}`,contentType:M.contentType||"application/octet-stream",size:M.size,s3Key:ge,contentDisposition:M.contentDisposition||"attachment",cid:M.cid||null})}let ex=c.html||null,Vx=!1;ex&&ex.length>Z9&&(ex=ex.slice(0,Z9),Vx=!0);let Kt=c.to?(Array.isArray(c.to)?c.to:[c.to]).flatMap(T=>"value"in T?T.value:[T]).map(T=>({address:T.address||"",name:T.name||""})):[],Yt=c.from?.value?.[0]?{address:c.from.value[0].address||"",name:c.from.value[0].name||""}:{address:"",name:""},tx={emailId:p,messageId:c.messageId||E.replace("raw/",""),from:Yt,to:Kt,cc:c.cc?(Array.isArray(c.cc)?c.cc:[c.cc]).flatMap(T=>"value"in T?T.value:[T]).map(T=>({address:T.address||"",name:T.name||""})):[],subject:c.subject||"",date:c.date?.toISOString()||new Date().toISOString(),html:ex,htmlTruncated:Vx,text:c.text||null,headers:B,attachments:x0,spamVerdict:f,virusVerdict:_,rawS3Key:E,receivedAt:new Date().toISOString()};await Br.send(new W9({Bucket:$9,Key:`parsed/${p}.json`,Body:JSON.stringify(tx),ContentType:"application/json"})),u("Stored parsed email",{emailId:p,attachmentCount:x0.length}),await el.send(new Q1({Entries:[{Source:tl,DetailType:"email.received",Detail:JSON.stringify(tx)}]})),u("Published EventBridge event",{emailId:p})}catch(s){throw a("Error processing inbound email",s,{s3Key:E}),s}}return{statusCode:200,body:JSON.stringify({message:"Inbound emails processed"})}}export{sB as handler};
71
71
  /*! Bundled license information:
72
72
 
73
73
  he/he.js:
@@ -70,7 +70,7 @@ export async function handler(event: S3Event, context: Context) {
70
70
  const rawResponse = await s3.send(
71
71
  new GetObjectCommand({ Bucket: bucket, Key: s3Key })
72
72
  );
73
- const rawBody = await rawResponse.Body!.transformToString();
73
+ const rawBody = await rawResponse.Body?.transformToString();
74
74
 
75
75
  // 2. Parse MIME
76
76
  const parsed = await simpleParser(rawBody);
@@ -1 +1 @@
1
- Built at: 2026-02-06T16:05:31.116Z
1
+ Built at: 2026-02-09T00:04:42.525Z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wraps.dev/cli",
3
- "version": "2.10.5",
3
+ "version": "2.11.2",
4
4
  "description": "CLI for deploying Wraps email infrastructure to your AWS account",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -68,7 +68,7 @@
68
68
  "open": "^10.1.0",
69
69
  "picocolors": "^1.1.1",
70
70
  "react": "19.2.4",
71
- "@react-email/render": "2.0.0",
71
+ "@react-email/render": "2.0.4",
72
72
  "tabtab": "^3.0.2",
73
73
  "uuid": "^11.0.3"
74
74
  },