@wraps.dev/cli 2.23.2 → 2.24.0
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/api-lambda.zip +0 -0
- package/dist/cli.js +633 -45
- package/dist/cli.js.map +1 -1
- package/dist/console/assets/{index-e_Wzcxes.js → index-5HGEQ1Ul.js} +58 -58
- package/dist/console/assets/index-BP4FpEpn.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/lambda/event-processor/.bundled +1 -1
- package/dist/lambda/event-processor/index.js +3 -2
- package/dist/lambda/inbound-processor/.bundled +1 -1
- package/dist/lambda/inbound-processor/index.js +60 -67
- package/dist/lambda/sms-event-processor/.bundled +1 -1
- package/dist/lambda/sms-event-processor/index.js +3 -2
- package/dist/selfhost-migrations/0059_message_send_claimed_at.sql +1 -0
- package/dist/selfhost-migrations/0060_harsh_nehzno.sql +1 -0
- package/dist/selfhost-migrations/0061_flashy_spirit.sql +1 -0
- package/dist/selfhost-migrations/0062_next_timeslip.sql +2 -0
- package/dist/selfhost-migrations/CLAUDE.md +49 -0
- package/dist/selfhost-migrations/meta/0055_snapshot.json +39 -3
- package/dist/selfhost-migrations/meta/0056_snapshot.json +39 -3
- package/dist/selfhost-migrations/meta/0057_snapshot.json +34 -2
- package/dist/selfhost-migrations/meta/0059_snapshot.json +6764 -0
- package/dist/selfhost-migrations/meta/0060_snapshot.json +7125 -0
- package/dist/selfhost-migrations/meta/0061_snapshot.json +7131 -0
- package/dist/selfhost-migrations/meta/0062_snapshot.json +7143 -0
- package/dist/selfhost-migrations/meta/_journal.json +29 -1
- package/package.json +35 -34
- package/dist/cli.d.ts +0 -1
- package/dist/console/assets/index-CXXcMD9d.css +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
"use strict";var ye=Object.create;var _=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var be=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty;var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ve=(t,e)=>{for(var n in e)_(t,n,{get:e[n],enumerable:!0})},z=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ee(e))!we.call(t,r)&&r!==n&&_(t,r,{get:()=>e[r],enumerable:!(s=Te(e,r))||s.enumerable});return t};var X=(t,e,n)=>(n=t!=null?ye(be(t)):{},z(e||!t||!t.__esModule?_(n,"default",{value:t,enumerable:!0}):n,t)),Ae=t=>z(_({},"__esModule",{value:!0}),t);var G=I(l=>{"use strict";l.HttpAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(l.HttpAuthLocation||(l.HttpAuthLocation={}));l.HttpApiKeyAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(l.HttpApiKeyAuthLocation||(l.HttpApiKeyAuthLocation={}));l.EndpointURLScheme=void 0;(function(t){t.HTTP="http",t.HTTPS="https"})(l.EndpointURLScheme||(l.EndpointURLScheme={}));l.AlgorithmId=void 0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(l.AlgorithmId||(l.AlgorithmId={}));var Se=t=>{let e=[];return t.sha256!==void 0&&e.push({algorithmId:()=>l.AlgorithmId.SHA256,checksumConstructor:()=>t.sha256}),t.md5!=null&&e.push({algorithmId:()=>l.AlgorithmId.MD5,checksumConstructor:()=>t.md5}),{addChecksumAlgorithm(n){e.push(n)},checksumAlgorithms(){return e}}},Ce=t=>{let e={};return t.checksumAlgorithms().forEach(n=>{e[n.algorithmId()]=n.checksumConstructor()}),e},Re=t=>Se(t),ke=t=>Ce(t);l.FieldPosition=void 0;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(l.FieldPosition||(l.FieldPosition={}));var He="__smithy_context";l.IniSectionType=void 0;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(l.IniSectionType||(l.IniSectionType={}));l.RequestHandlerProtocol=void 0;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(l.RequestHandlerProtocol||(l.RequestHandlerProtocol={}));l.SMITHY_CONTEXT_KEY=He;l.getDefaultClientConfiguration=Re;l.resolveDefaultRuntimeConfig=ke});var Z=I(C=>{"use strict";var De=G(),Ie=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,n){t.httpHandler?.updateHttpClientConfig(e,n)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),Pe=t=>({httpHandler:t.httpHandler()}),O=class{name;kind;values;constructor({name:e,kind:n=De.FieldPosition.HEADER,values:s=[]}){this.name=e,this.kind=n,this.values=s}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(n=>n!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}},j=class{entries={};encoding;constructor({fields:e=[],encoding:n="utf-8"}){e.forEach(this.setField.bind(this)),this.encoding=n}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(n=>n.kind===e)}},M=class t{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let n=new t({...e,headers:{...e.headers}});return n.query&&(n.query=xe(n.query)),n}static isInstance(e){if(!e)return!1;let n=e;return"method"in n&&"protocol"in n&&"hostname"in n&&"path"in n&&typeof n.query=="object"&&typeof n.headers=="object"}clone(){return t.clone(this)}};function xe(t){return Object.keys(t).reduce((e,n)=>{let s=t[n];return{...e,[n]:Array.isArray(s)?[...s]:s}},{})}var q=class{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let n=e;return typeof n.statusCode=="number"&&typeof n.headers=="object"}};function _e(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}C.Field=O;C.Fields=j;C.HttpRequest=M;C.HttpResponse=q;C.getHttpHandlerExtensionConfiguration=Ie;C.isValidHostname=_e;C.resolveHttpHandlerRuntimeConfig=Pe});var te=I(B=>{"use strict";var ee=t=>encodeURIComponent(t).replace(/[!'()*]/g,Le),Le=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`,Ue=t=>t.split("/").map(ee).join("/");B.escapeUri=ee;B.escapeUriPath=Ue});var se=I(ne=>{"use strict";var F=te();function Ne(t){let e=[];for(let n of Object.keys(t).sort()){let s=t[n];if(n=F.escapeUri(n),Array.isArray(s))for(let r=0,i=s.length;r<i;r++)e.push(`${n}=${F.escapeUri(s[r])}`);else{let r=n;(s||typeof s=="string")&&(r+=`=${F.escapeUri(s)}`),e.push(r)}}return e.join("&")}ne.buildQueryString=Ne});var me=I(P=>{"use strict";var ae=Z(),ue=se(),L=require("node:https"),de=require("node:stream"),Q=require("node:http2");function N(t){let e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){let r=new Error("Request aborted");return r.name="AbortError",r.cause=e,r}let s=new Error(String(e));return s.name="AbortError",s}let n=new Error("Request aborted");return n.name="AbortError",n}var $e=["ECONNRESET","EPIPE","ETIMEDOUT"],le=t=>{let e={};for(let n of Object.keys(t)){let s=t[n];e[n]=Array.isArray(s)?s.join(","):s}return e},E={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},oe=1e3,Oe=(t,e,n=0)=>{if(!n)return-1;let s=r=>{let i=E.setTimeout(()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${n} ms.`),{name:"TimeoutError"}))},n-r),c=u=>{u?.connecting?u.on("connect",()=>{E.clearTimeout(i)}):E.clearTimeout(i)};t.socket?c(t.socket):t.on("socket",c)};return n<2e3?(s(0),0):E.setTimeout(s.bind(null,oe),oe)},je=(t,e,n=0,s,r)=>n?E.setTimeout(()=>{let i=`@smithy/node-http-handler - [${s?"ERROR":"WARN"}] a request has exceeded the configured ${n} ms requestTimeout.`;if(s){let c=Object.assign(new Error(i),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(c),e(c)}else i+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",r?.warn?.(i)},n):-1,Me=3e3,qe=(t,{keepAlive:e,keepAliveMsecs:n},s=Me)=>{if(e!==!0)return-1;let r=()=>{t.socket?t.socket.setKeepAlive(e,n||0):t.on("socket",i=>{i.setKeepAlive(e,n||0)})};return s===0?(r(),0):E.setTimeout(r,s)},re=3e3,Be=(t,e,n=0)=>{let s=r=>{let i=n-r,c=()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${n} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};t.socket?(t.socket.setTimeout(i,c),t.on("close",()=>t.socket?.removeListener("timeout",c))):t.setTimeout(i,c)};return 0<n&&n<6e3?(s(0),0):E.setTimeout(s.bind(null,n===0?0:re),re)},ie=6e3;async function fe(t,e,n=ie,s=!1){let r=e.headers??{},i=r.Expect||r.expect,c=-1,u=!0;!s&&i==="100-continue"&&(u=await Promise.race([new Promise(a=>{c=Number(E.setTimeout(()=>a(!0),Math.max(ie,n)))}),new Promise(a=>{t.on("continue",()=>{E.clearTimeout(c),a(!0)}),t.on("response",()=>{E.clearTimeout(c),a(!1)}),t.on("error",()=>{E.clearTimeout(c),a(!1)})})])),u&&Fe(t,e.body)}function Fe(t,e){if(e instanceof de.Readable){e.pipe(t);return}if(e){let n=Buffer.isBuffer(e);if(n||typeof e=="string"){n&&e.byteLength===0?t.end():t.end(e);return}let r=e;if(typeof r=="object"&&r.buffer&&typeof r.byteOffset=="number"&&typeof r.byteLength=="number"){t.end(Buffer.from(r.buffer,r.byteOffset,r.byteLength));return}t.end(Buffer.from(e));return}t.end()}var Qe=0,U,ce,W=class t{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new t(e)}static checkSocketUsage(e,n,s=console){let{sockets:r,requests:i,maxSockets:c}=e;if(typeof c!="number"||c===1/0||Date.now()-15e3<n)return n;if(r&&i)for(let a in r){let m=r[a]?.length??0,o=i[a]?.length??0;if(m>=c&&o>=2*c)return s?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${m} and ${o} additional requests are enqueued.
|
|
1
|
+
"use strict";var Ps=Object.create;var Fe=Object.defineProperty;var Fs=Object.getOwnPropertyDescriptor;var Rs=Object.getOwnPropertyNames;var Is=Object.getPrototypeOf,ks=Object.prototype.hasOwnProperty;var m=(t,e)=>()=>(t&&(e=t(t=0)),e);var U=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Re=(t,e)=>{for(var r in e)Fe(t,r,{get:e[r],enumerable:!0})},Cr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Rs(e))!ks.call(t,o)&&o!==r&&Fe(t,o,{get:()=>e[o],enumerable:!(n=Fs(e,o))||n.enumerable});return t};var Ie=(t,e,r)=>(r=t!=null?Ps(Is(t)):{},Cr(e||!t||!t.__esModule?Fe(r,"default",{value:t,enumerable:!0}):r,t)),ke=t=>Cr(Fe({},"__esModule",{value:!0}),t);var Br,Dr=m(()=>{Br=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var ce,Ne,fe=m(()=>{Dr();ce=(t,e=0,r=t.byteLength-e)=>{if(!Br(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Buffer.from(t,e,r)},Ne=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Buffer.from(t,e):Buffer.from(t)}});var Ns,we,_r=m(()=>{fe();Ns=/^[A-Za-z0-9+/]*={0,2}$/,we=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!Ns.exec(t))throw new TypeError("Invalid base64 string.");let e=Ne(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}});var V,bt=m(()=>{fe();V=t=>{let e=Ne(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)}});var Se,Mr=m(()=>{fe();bt();Se=t=>{let e;if(typeof t=="string"?e=V(t):e=t,typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return ce(e.buffer,e.byteOffset,e.byteLength).toString("base64")}});function Or(t,e,r,n){return class Le extends Uint8Array{static fromString(s,i="utf-8"){if(typeof s=="string")return i==="base64"?Le.mutate(n(s)):Le.mutate(e(s));throw new Error(`Unsupported conversion from ${typeof s} to Uint8ArrayBlobAdapter.`)}static mutate(s){return Object.setPrototypeOf(s,Le.prototype),s}transformToString(s="utf-8"){return s==="base64"?r(this):t(this)}}}var Ur=m(()=>{});var W,Pr=m(()=>{fe();W=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return ce(t.buffer,t.byteOffset,t.byteLength).toString("utf8")}});function Fr(t){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?()=>crypto.randomUUID():()=>{let e=new Uint8Array(16);return t(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,B[e[0]]+B[e[1]]+B[e[2]]+B[e[3]]+"-"+B[e[4]]+B[e[5]]+"-"+B[e[6]]+B[e[7]]+"-"+B[e[8]]+B[e[9]]+"-"+B[e[10]]+B[e[11]]+B[e[12]]+B[e[13]]+B[e[14]]+B[e[15]]}}var B,Rr=m(()=>{B=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"))});function xt(t){let e=t.getUTCFullYear(),r=t.getUTCMonth(),n=t.getUTCDay(),o=t.getUTCDate(),s=t.getUTCHours(),i=t.getUTCMinutes(),a=t.getUTCSeconds(),f=o<10?`0${o}`:`${o}`,u=s<10?`0${s}`:`${s}`,c=i<10?`0${i}`:`${i}`,l=a<10?`0${a}`:`${a}`;return`${Ls[n]}, ${f} ${$s[r]} ${e} ${u}:${c}:${l} GMT`}var Ls,$s,za,qa,Ja,Va,Wa,Ga,Ir=m(()=>{Ls=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],$s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];za=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),qa=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),Ja=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Va=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Wa=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),Ga=50*365*24*60*60*1e3});var F,kr=m(()=>{F=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};F.from=t=>t&&typeof t=="object"&&(t instanceof F||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?F(String(t)):F(JSON.stringify(t));F.fromObject=F.from});function wt(t){return(t.includes(",")||t.includes('"'))&&(t=`"${t.replace(/"/g,'\\"')}"`),t}var Nr=m(()=>{});function $(t,e,r){let n=Number(t);if(n<e||n>r)throw new Error(`Value ${n} out of range [${e}, ${r}]`)}var St,Et,Tt,Lr,$r,js,Hs,zs,qs,Js,vt,At,Ct,jr=m(()=>{St="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",Et="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",Tt="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",Lr="(\\d?\\d)",$r="(\\d{4})",js=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),Hs=new RegExp(`^${St}, ${Lr} ${Et} ${$r} ${Tt} GMT$`),zs=new RegExp(`^${St}, ${Lr}-${Et}-(\\d\\d) ${Tt} GMT$`),qs=new RegExp(`^${St} ${Et} ( [1-9]|\\d\\d) ${Tt} ${$r}$`),Js=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],vt=t=>{if(t==null)return;let e=NaN;if(typeof t=="number")e=t;else if(typeof t=="string"){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else typeof t=="object"&&t.tag===1&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(e*1e3))},At=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC3339 timestamps must be strings");let e=js.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);let[,r,n,o,s,i,a,,f,u]=e;$(n,1,12),$(o,1,31),$(s,0,23),$(i,0,59),$(a,0,60);let c=new Date(Date.UTC(Number(r),Number(n)-1,Number(o),Number(s),Number(i),Number(a),Number(f)?Math.round(parseFloat(`0.${f}`)*1e3):0));if(c.setUTCFullYear(Number(r)),u.toUpperCase()!="Z"){let[,l,p,h]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],d=l==="-"?1:-1;c.setTime(c.getTime()+d*(Number(p)*60*60*1e3+Number(h)*60*1e3))}return c},Ct=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC7231 timestamps must be strings.");let e,r,n,o,s,i,a,f;if((f=Hs.exec(t))?[,e,r,n,o,s,i,a]=f:(f=zs.exec(t))?([,e,r,n,o,s,i,a]=f,n=(Number(n)+1900).toString()):(f=qs.exec(t))&&([,r,e,o,s,i,a,n]=f),n&&i){let u=Date.UTC(Number(n),Js.indexOf(r),Number(e),Number(o),Number(s),Number(i),a?Math.round(parseFloat(`0.${a}`)*1e3):0);$(e,1,31),$(o,0,23),$(s,0,59),$(i,0,60);let c=new Date(u);return c.setUTCFullYear(Number(n)),c}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)}});function Bt(t,e,r){if(r<=0||!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");let n=t.split(e);if(r===1)return n;let o=[],s="";for(let i=0;i<n.length;i++)s===""?s=n[i]:s+=e+n[i],(i+1)%r===0&&(o.push(s),s="");return s!==""&&o.push(s),o}var Hr=m(()=>{});var Ee,zr=m(()=>{Ee=t=>{let e=t.length,r=[],n=!1,o,s=0;for(let i=0;i<e;++i){let a=t[i];switch(a){case'"':o!=="\\"&&(n=!n);break;case",":n||(r.push(t.slice(s,i)),s=i+1);break;default:}o=a}return r.push(t.slice(s)),r.map(i=>{i=i.trim();let a=i.length;return a<2?i:(i[0]==='"'&&i[a-1]==='"'&&(i=i.slice(1,a-1)),i.replace(/\\"/g,'"'))})}});var qr,Te,Jr=m(()=>{qr=/^-?\d*(\.\d+)?$/,Te=class t{string;type;constructor(e,r){if(this.string=e,this.type=r,!qr.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;let r=e;return t.prototype.isPrototypeOf(e)||r.type==="bigDecimal"&&qr.test(r.string)}}});function _t(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let n=t.slice(r,r+2).toLowerCase();if(n in Dt)e[r/2]=Dt[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function R(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Vr[t[r]];return e}var Vr,Dt,Mt=m(()=>{Vr={},Dt={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Vr[t]=e,Dt[e]=t}});var Wr=U(T=>{"use strict";T.HttpAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(T.HttpAuthLocation||(T.HttpAuthLocation={}));T.HttpApiKeyAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(T.HttpApiKeyAuthLocation||(T.HttpApiKeyAuthLocation={}));T.EndpointURLScheme=void 0;(function(t){t.HTTP="http",t.HTTPS="https"})(T.EndpointURLScheme||(T.EndpointURLScheme={}));T.AlgorithmId=void 0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(T.AlgorithmId||(T.AlgorithmId={}));var Vs=t=>{let e=[];return t.sha256!==void 0&&e.push({algorithmId:()=>T.AlgorithmId.SHA256,checksumConstructor:()=>t.sha256}),t.md5!=null&&e.push({algorithmId:()=>T.AlgorithmId.MD5,checksumConstructor:()=>t.md5}),{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},Ws=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},Gs=t=>Vs(t),Qs=t=>Ws(t);T.FieldPosition=void 0;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(T.FieldPosition||(T.FieldPosition={}));var Ks="__smithy_context";T.IniSectionType=void 0;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(T.IniSectionType||(T.IniSectionType={}));T.RequestHandlerProtocol=void 0;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(T.RequestHandlerProtocol||(T.RequestHandlerProtocol={}));T.SMITHY_CONTEXT_KEY=Ks;T.getDefaultClientConfiguration=Gs;T.resolveDefaultRuntimeConfig=Qs});function Zs(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var O,Gr=m(()=>{O=class t{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Zs(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var te,Qr=m(()=>{te=class{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});function Ot(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}var Kr=m(()=>{});function ve(t){let e={};if(t=t.replace(/^\?/,""),t)for(let r of t.split("&")){let[n,o=null]=r.split("=");n=decodeURIComponent(n),o&&(o=decodeURIComponent(o)),n in e?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o}return e}var Ut=m(()=>{});var $e,Zr=m(()=>{Ut();$e=t=>{if(typeof t=="string")return $e(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:s}=t,i;return s&&(i=ve(s)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:i}}});var I=m(()=>{Gr();Qr();Kr();Ut();Zr()});var je,Pt=m(()=>{je=t=>typeof t=="function"?t():t});var Yr=m(()=>{});var Xr=m(()=>{});var P,re=m(()=>{P=class{name;namespace;traits;static assign(e,r){return Object.assign(e,r)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}getName(){return this.namespace+"#"+this.name}}});var en,tn=m(()=>{re();en=class t extends P{static symbol=Symbol.for("@smithy/lis");name;traits;valueSchema;symbol=t.symbol}});var rn,nn=m(()=>{re();rn=class t extends P{static symbol=Symbol.for("@smithy/map");name;traits;keySchema;valueSchema;symbol=t.symbol}});var on,sn=m(()=>{re();on=class t extends P{static symbol=Symbol.for("@smithy/ope");name;traits;input;output;symbol=t.symbol}});var He,Ft=m(()=>{re();He=class t extends P{static symbol=Symbol.for("@smithy/str");name;traits;memberNames;memberList;symbol=t.symbol}});var an,cn=m(()=>{Ft();an=class t extends He{static symbol=Symbol.for("@smithy/err");ctor;symbol=t.symbol}});function j(t){if(typeof t=="object")return t;if(t=t|0,Rt[t])return Rt[t];let e={},r=0;for(let n of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(t>>r++&1)===1&&(e[n]=1);return Rt[t]=e}var Rt,It=m(()=>{Rt=[]});function Ce(t,e){if(t instanceof v)return Object.assign(t,{memberName:e,_isMemberSchema:!0});let r=v;return new r(t,e)}var Ae,kt,Nt,v,Lt,Ys,fn=m(()=>{Pt();It();Ae={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},kt=[],Nt={},v=class t{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=t.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,r){this.ref=e,this.memberName=r;let n=[],o=e,s=e;for(this._isMemberSchema=!1;Lt(o);)n.push(o[1]),o=o[0],s=je(o),this._isMemberSchema=!0;if(n.length>0){this.memberTraits={};for(let i=n.length-1;i>=0;--i){let a=n[i];Object.assign(this.memberTraits,j(a))}}else this.memberTraits=0;if(s instanceof t){let i=this.memberTraits;Object.assign(this,s),this.memberTraits=Object.assign({},i,s.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=r??s.memberName;return}if(this.schema=je(s),Ys(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(s),this.traits=0),this._isMemberSchema&&!r)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}static of(e){let r=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if(kt[e])return kt[e]}else if(typeof e=="string"){if(Nt[e])return Nt[e]}else if(r&&e[Ae.ns])return e[Ae.ns];let n=je(e);if(n instanceof t)return n;if(Lt(n)){let[s,i]=n;if(s instanceof t)return Object.assign(s.getMergedTraits(),j(i)),s;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let o=new t(n);return r?e[Ae.ns]=o:typeof n=="string"?Nt[n]=o:typeof n=="number"?kt[n]=o:o}getSchema(){let e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){let{name:r}=this;return!e&&r&&r.includes("#")?r.split("#")[1]:r||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){let e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){let e=this.getSchema();if(typeof e!="object")return!1;let r=e[0];return r===3||r===-3||r===4}isUnionSchema(){let e=this.getSchema();return typeof e!="object"?!1:e[0]===4}isBlobSchema(){let e=this.getSchema();return e===21||e===42}isTimestampSchema(){let e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return j(this.memberTraits)}getOwnTraits(){return j(this.traits)}getKeySchema(){let[e,r]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!r)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let n=this.getSchema(),o=e?15:n[4]??0;return Ce([o,0],"key")}getValueSchema(){let e=this.getSchema(),[r,n,o]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],s=typeof e=="number"?63&e:e&&typeof e=="object"&&(n||o)?e[3+e[0]]:r?15:void 0;if(s!=null)return Ce([s,0],n?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){let r=this.getSchema();if(this.isStructSchema()&&r[4].includes(e)){let n=r[4].indexOf(e),o=r[5][n];return Ce(Lt(o)?o:[o,0],e)}if(this.isDocumentSchema())return Ce([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[r,n]of this.structIterator())e[r]=n}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,r]of this.structIterator())if(r.isStreaming()&&r.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");let e=this.getSchema(),r=e[4].length,n=e[Ae.it];if(n&&r===n.length){yield*n;return}n=Array(r);for(let o=0;o<r;++o){let s=e[4][o],i=Ce([e[5][o],0],s);yield n[o]=[s,i]}e[Ae.it]=n}};Lt=t=>Array.isArray(t)&&t.length===2,Ys=t=>Array.isArray(t)&&t.length>=5});var un,ln=m(()=>{re();un=class t extends P{static symbol=Symbol.for("@smithy/sim");name;schemaRef;traits;symbol=t.symbol}});var mn=m(()=>{});var ze,hn=m(()=>{ze=class t{namespace;schemas;exceptions;static registries=new Map;constructor(e,r=new Map,n=new Map){this.namespace=e,this.schemas=r,this.exceptions=n}static for(e){return t.registries.has(e)||t.registries.set(e,new t(e)),t.registries.get(e)}copyFrom(e){let{schemas:r,exceptions:n}=this;for(let[o,s]of e.schemas)r.has(o)||r.set(o,s);for(let[o,s]of e.exceptions)n.has(o)||n.set(o,s)}register(e,r){let n=this.normalizeShapeId(e);for(let o of[this,t.for(n.split("#")[0])])o.schemas.set(n,r)}getSchema(e){let r=this.normalizeShapeId(e);if(!this.schemas.has(r)){if(!e.includes("#")){let n="#"+e,o=[];for(let[s,i]of this.schemas.entries())s.endsWith(n)&&o.push(i);if(o.length===1)return o[0]}throw new Error(`@smithy/core/schema - schema not found for ${r}`)}return this.schemas.get(r)}registerError(e,r){let n=e,o=n[1];for(let s of[this,t.for(o)])s.schemas.set(o+"#"+n[2],n),s.exceptions.set(n,r)}getErrorCtor(e){let r=e;return this.exceptions.has(r)?this.exceptions.get(r):t.for(r[1]).exceptions.get(r)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,r,n]=e,o=r+"#"+n;if(o.startsWith("smithy.ts.sdk.synthetic.")&&o.endsWith("ServiceException"))return e}}find(e){for(let r of this.schemas.values())if(e(r))return r}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}});var G=m(()=>{Pt();Xr();tn();nn();sn();Yr();cn();fn();re();ln();Ft();mn();It();hn()});var $t,dn=m(()=>{$t=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var pn,yn=m(()=>{pn=t=>new TextEncoder().encode(t)});var gn,jt,bn,Q,ne,xn,Ht=m(()=>{gn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jt=Object.entries(gn).reduce((t,[e,r])=>(t[r]=Number(e),t),{}),bn=gn.split(""),Q=6,ne=8,xn=63});function wn(t){let e;typeof t=="string"?e=pn(t):e=t;let r=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let o="";for(let s=0;s<e.length;s+=3){let i=0,a=0;for(let u=s,c=Math.min(s+3,e.length);u<c;u++)i|=e[u]<<(c-u-1)*ne,a+=ne;let f=Math.ceil(a/Q);i<<=f*Q-a;for(let u=1;u<=f;u++){let c=(f-u)*Q;o+=bn[(i&xn<<c)>>c]}o+="==".slice(0,4-f)}return o}var Sn=m(()=>{yn();Ht()});var En,Tn=m(()=>{En=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var vn,An=m(()=>{Ht();vn=t=>{let e=t.length/4*3;t.slice(-2)==="=="?e-=2:t.slice(-1)==="="&&e--;let r=new ArrayBuffer(e),n=new DataView(r);for(let o=0;o<t.length;o+=4){let s=0,i=0;for(let u=o,c=o+3;u<=c;u++)if(t[u]!=="="){if(!(t[u]in jt))throw new TypeError(`Invalid character ${t[u]} in base64 string.`);s|=jt[t[u]]<<(c-u)*Q,i+=Q}else s>>=Q;let a=o/4*3;s>>=i%ne;let f=Math.floor(i/ne);for(let u=0;u<f;u++){let c=(f-u-1)*ne;n.setUint8(a+u,(s&255<<c)>>c)}}return new Uint8Array(r)}});async function Xs(t){let e=await ti(t),r=vn(e);return new Uint8Array(r)}async function ei(t){let e=[],r=t.getReader(),n=!1,o=0;for(;!n;){let{done:a,value:f}=await r.read();f&&(e.push(f),o+=f.length),n=a}let s=new Uint8Array(o),i=0;for(let a of e)s.set(a,i),i+=a.length;return s}function ti(t){return new Promise((e,r)=>{let n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return r(new Error("Reader aborted too early"));let o=n.result??"",s=o.indexOf(","),i=s>-1?s+1:o.length;e(o.substring(i))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}var Cn,Bn=m(()=>{An();Cn=async t=>typeof Blob=="function"&&t instanceof Blob||t.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await t.arrayBuffer()):Xs(t):ei(t)});var Dn,Mn,_n,On=m(()=>{Sn();Mt();Tn();Bn();dn();Dn="The stream has already been transformed.",Mn=t=>{if(!_n(t)&&!$t(t)){let o=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${o}`)}let e=!1,r=async()=>{if(e)throw new Error(Dn);return e=!0,await Cn(t)},n=o=>{if(typeof o.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
|
|
2
|
+
If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return o.stream()};return Object.assign(t,{transformToByteArray:r,transformToString:async o=>{let s=await r();if(o==="base64")return wn(s);if(o==="hex")return R(s);if(o===void 0||o==="utf8"||o==="utf-8")return En(s);if(typeof TextDecoder=="function")return new TextDecoder(o).decode(s);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(Dn);if(e=!0,_n(t))return n(t);if($t(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},_n=t=>typeof Blob=="function"&&t instanceof Blob});async function ni(t){let e=[],r=t.getReader(),n=!1,o=0;for(;!n;){let{done:a,value:f}=await r.read();f&&(e.push(f),o+=f.length),n=a}let s=new Uint8Array(o),i=0;for(let a of e)s.set(a,i),i+=a.length;return s}var Un,zt,ri,Pn,Fn=m(()=>{Un=require("node:stream"),zt=class extends Un.Writable{bufferedBytes=[];_write(e,r,n){this.bufferedBytes.push(e),n()}},ri=t=>typeof ReadableStream=="function"&&t instanceof ReadableStream;Pn=t=>ri(t)?ni(t):new Promise((e,r)=>{let n=new zt;t.pipe(n),t.on("error",o=>{n.end(),r(o)}),n.on("error",r),n.on("finish",function(){let o=new Uint8Array(Buffer.concat(this.bufferedBytes));e(o)})})});var qe,Rn,qt,In=m(()=>{qe=require("node:stream");fe();On();Fn();Rn="The stream has already been transformed.",qt=t=>{if(!(t instanceof qe.Readable))try{return Mn(t)}catch{let o=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${o}`)}let e=!1,r=async()=>{if(e)throw new Error(Rn);return e=!0,await Pn(t)};return Object.assign(t,{transformToByteArray:r,transformToString:async n=>{let o=await r();return n===void 0||Buffer.isEncoding(n)?ce(o.buffer,o.byteOffset,o.byteLength).toString(n):new TextDecoder(n).decode(o)},transformToWebStream:()=>{if(e)throw new Error(Rn);if(t.readableFlowing!==null)throw new Error("The stream has been consumed by other callbacks.");if(typeof qe.Readable.toWeb!="function")throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return e=!0,qe.Readable.toWeb(t)}})}});var kn,ue,oi,si,Nn,H=m(()=>{kn=require("node:crypto");_r();Mr();Ur();bt();Pr();Rr();Ir();kr();Nr();jr();Hr();zr();Jr();Mt();In();ue=class extends Or(W,V,Se,we){},oi=kn.getRandomValues,si=Fr(oi),Nn=si});var z,Je=m(()=>{H();z=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return ue.mutate(t);if(!t)return ue.mutate(new Uint8Array);let r=e.streamCollector(t);return ue.mutate(await r)}});function oe(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var Ve=m(()=>{});var k,le=m(()=>{k=class{serdeContext;setSerdeContext(e){this.serdeContext=e}}});var Gt={};Re(Gt,{__addDisposableResource:()=>fo,__assign:()=>We,__asyncDelegator:()=>to,__asyncGenerator:()=>eo,__asyncValues:()=>ro,__await:()=>me,__awaiter:()=>Gn,__classPrivateFieldGet:()=>io,__classPrivateFieldIn:()=>co,__classPrivateFieldSet:()=>ao,__createBinding:()=>Qe,__decorate:()=>jn,__disposeResources:()=>uo,__esDecorate:()=>zn,__exportStar:()=>Kn,__extends:()=>Ln,__generator:()=>Qn,__importDefault:()=>so,__importStar:()=>oo,__makeTemplateObject:()=>no,__metadata:()=>Wn,__param:()=>Hn,__propKey:()=>Jn,__read:()=>Wt,__rest:()=>$n,__rewriteRelativeImportExtension:()=>lo,__runInitializers:()=>qn,__setFunctionName:()=>Vn,__spread:()=>Zn,__spreadArray:()=>Xn,__spreadArrays:()=>Yn,__values:()=>Ge,default:()=>ci});function Ln(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Jt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function $n(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function jn(t,e,r,n){var o=arguments.length,s=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}function Hn(t,e){return function(r,n){e(r,n,t)}}function zn(t,e,r,n,o,s){function i(x){if(x!==void 0&&typeof x!="function")throw new TypeError("Function expected");return x}for(var a=n.kind,f=a==="getter"?"get":a==="setter"?"set":"value",u=!e&&t?n.static?t:t.prototype:null,c=e||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),l,p=!1,h=r.length-1;h>=0;h--){var d={};for(var y in n)d[y]=y==="access"?{}:n[y];for(var y in n.access)d.access[y]=n.access[y];d.addInitializer=function(x){if(p)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(x||null))};var g=(0,r[h])(a==="accessor"?{get:c.get,set:c.set}:c[f],d);if(a==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(l=i(g.get))&&(c.get=l),(l=i(g.set))&&(c.set=l),(l=i(g.init))&&o.unshift(l)}else(l=i(g))&&(a==="field"?o.unshift(l):c[f]=l)}u&&Object.defineProperty(u,n.name,c),p=!0}function qn(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function Jn(t){return typeof t=="symbol"?t:"".concat(t)}function Vn(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Wn(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Gn(t,e,r,n){function o(s){return s instanceof r?s:new r(function(i){i(s)})}return new(r||(r=Promise))(function(s,i){function a(c){try{u(n.next(c))}catch(l){i(l)}}function f(c){try{u(n.throw(c))}catch(l){i(l)}}function u(c){c.done?s(c.value):o(c.value).then(a,f)}u((n=n.apply(t,e||[])).next())})}function Qn(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,s,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(u){return function(c){return f([u,c])}}function f(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(r=0)),r;)try{if(n=1,o&&(s=u[0]&2?o.return:u[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;switch(o=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(c){u=[6,c],o=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Kn(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qe(e,t,r)}function Ge(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Wt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,s=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(a){i={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return s}function Zn(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Wt(arguments[e]));return t}function Yn(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var s=arguments[e],i=0,a=s.length;i<a;i++,o++)n[o]=s[i];return n}function Xn(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,s;n<o;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function me(t){return this instanceof me?(this.v=t,this):new me(t)}function eo(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(h){return function(d){return Promise.resolve(d).then(h,l)}}function a(h,d){n[h]&&(o[h]=function(y){return new Promise(function(g,x){s.push([h,y,g,x])>1||f(h,y)})},d&&(o[h]=d(o[h])))}function f(h,d){try{u(n[h](d))}catch(y){p(s[0][3],y)}}function u(h){h.value instanceof me?Promise.resolve(h.value.v).then(c,l):p(s[0][2],h)}function c(h){f("next",h)}function l(h){f("throw",h)}function p(h,d){h(d),s.shift(),s.length&&f(s[0][0],s[0][1])}}function to(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,s){e[o]=t[o]?function(i){return(r=!r)?{value:me(t[o](i)),done:!1}:s?s(i):i}:s}}function ro(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Ge=="function"?Ge(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(i){return new Promise(function(a,f){i=t[s](i),o(a,f,i.done,i.value)})}}function o(s,i,a,f){Promise.resolve(f).then(function(u){s({value:u,done:a})},i)}}function no(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function oo(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Vt(t),n=0;n<r.length;n++)r[n]!=="default"&&Qe(e,t,r[n]);return ii(e,t),e}function so(t){return t&&t.__esModule?t:{default:t}}function io(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function ao(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function co(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function fo(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(s){return Promise.reject(s)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function uo(t){function e(s){t.error=t.hasError?new ai(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(s).then(o,function(i){return e(i),o()})}else n|=1}catch(i){e(i)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}function lo(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,o,s,i){return n?e?".jsx":".js":o&&(!s||!i)?r:o+s+"."+i.toLowerCase()+"js"}):t}var Jt,We,Qe,ii,Vt,ai,ci,Qt=m(()=>{Jt=function(t,e){return Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Jt(t,e)};We=function(){return We=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},We.apply(this,arguments)};Qe=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});ii=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Vt=function(t){return Vt=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Vt(t)};ai=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};ci={__extends:Ln,__assign:We,__rest:$n,__decorate:jn,__param:Hn,__esDecorate:zn,__runInitializers:qn,__propKey:Jn,__setFunctionName:Vn,__metadata:Wn,__awaiter:Gn,__generator:Qn,__createBinding:Qe,__exportStar:Kn,__values:Ge,__read:Wt,__spread:Zn,__spreadArrays:Yn,__spreadArray:Xn,__await:me,__asyncGenerator:eo,__asyncDelegator:to,__asyncValues:ro,__makeTemplateObject:no,__importStar:oo,__importDefault:so,__classPrivateFieldGet:io,__classPrivateFieldSet:ao,__classPrivateFieldIn:co,__addDisposableResource:fo,__disposeResources:uo,__rewriteRelativeImportExtension:lo}});var po=U((Wf,ho)=>{var Ke=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,ui=Object.getOwnPropertyNames,li=Object.prototype.hasOwnProperty,mi=(t,e)=>Ke(t,"name",{value:e,configurable:!0}),hi=(t,e)=>{for(var r in e)Ke(t,r,{get:e[r],enumerable:!0})},di=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ui(e))!li.call(t,o)&&o!==r&&Ke(t,o,{get:()=>e[o],enumerable:!(n=fi(e,o))||n.enumerable});return t},pi=t=>di(Ke({},"__esModule",{value:!0}),t),mo={};hi(mo,{isArrayBuffer:()=>yi});ho.exports=pi(mo);var yi=mi(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var xo=U((Gf,bo)=>{var Ze=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,bi=Object.getOwnPropertyNames,xi=Object.prototype.hasOwnProperty,yo=(t,e)=>Ze(t,"name",{value:e,configurable:!0}),wi=(t,e)=>{for(var r in e)Ze(t,r,{get:e[r],enumerable:!0})},Si=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of bi(e))!xi.call(t,o)&&o!==r&&Ze(t,o,{get:()=>e[o],enumerable:!(n=gi(e,o))||n.enumerable});return t},Ei=t=>Si(Ze({},"__esModule",{value:!0}),t),go={};wi(go,{fromArrayBuffer:()=>vi,fromString:()=>Ai});bo.exports=Ei(go);var Ti=po(),Kt=require("buffer"),vi=yo((t,e=0,r=t.byteLength-e)=>{if(!(0,Ti.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Kt.Buffer.from(t,e,r)},"fromArrayBuffer"),Ai=yo((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Kt.Buffer.from(t,e):Kt.Buffer.from(t)},"fromString")});var vo=U((Qf,To)=>{var Ye=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Bi=Object.getOwnPropertyNames,Di=Object.prototype.hasOwnProperty,Zt=(t,e)=>Ye(t,"name",{value:e,configurable:!0}),_i=(t,e)=>{for(var r in e)Ye(t,r,{get:e[r],enumerable:!0})},Mi=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Bi(e))!Di.call(t,o)&&o!==r&&Ye(t,o,{get:()=>e[o],enumerable:!(n=Ci(e,o))||n.enumerable});return t},Oi=t=>Mi(Ye({},"__esModule",{value:!0}),t),wo={};_i(wo,{fromUtf8:()=>Eo,toUint8Array:()=>Ui,toUtf8:()=>Pi});To.exports=Oi(wo);var So=xo(),Eo=Zt(t=>{let e=(0,So.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),Ui=Zt(t=>typeof t=="string"?Eo(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),Pi=Zt(t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return(0,So.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var Ao=U(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.convertToBuffer=void 0;var Fi=vo(),Ri=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:Fi.fromUtf8;function Ii(t){return t instanceof Uint8Array?t:typeof t=="string"?Ri(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}Xe.convertToBuffer=Ii});var Co=U(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.isEmptyData=void 0;function ki(t){return typeof t=="string"?t.length===0:t.byteLength===0}et.isEmptyData=ki});var Bo=U(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.numToUint8=void 0;function Ni(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}tt.numToUint8=Ni});var Do=U(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.uint32ArrayFrom=void 0;function Li(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r<t.length;)e[r]=t[r],r+=1;return e}return Uint32Array.from(t)}rt.uint32ArrayFrom=Li});var Yt=U(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.uint32ArrayFrom=L.numToUint8=L.isEmptyData=L.convertToBuffer=void 0;var $i=Ao();Object.defineProperty(L,"convertToBuffer",{enumerable:!0,get:function(){return $i.convertToBuffer}});var ji=Co();Object.defineProperty(L,"isEmptyData",{enumerable:!0,get:function(){return ji.isEmptyData}});var Hi=Bo();Object.defineProperty(L,"numToUint8",{enumerable:!0,get:function(){return Hi.numToUint8}});var zi=Do();Object.defineProperty(L,"uint32ArrayFrom",{enumerable:!0,get:function(){return zi.uint32ArrayFrom}})});var Oo=U(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.AwsCrc32=void 0;var _o=(Qt(),ke(Gt)),Xt=Yt(),Mo=ot(),qi=(function(){function t(){this.crc32=new Mo.Crc32}return t.prototype.update=function(e){(0,Xt.isEmptyData)(e)||this.crc32.update((0,Xt.convertToBuffer)(e))},t.prototype.digest=function(){return _o.__awaiter(this,void 0,void 0,function(){return _o.__generator(this,function(e){return[2,(0,Xt.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new Mo.Crc32},t})();nt.AwsCrc32=qi});var ot=U(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.AwsCrc32=K.Crc32=K.crc32=void 0;var Ji=(Qt(),ke(Gt)),Vi=Yt();function Wi(t){return new Uo().update(t).digest()}K.crc32=Wi;var Uo=(function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=Ji.__values(e),s=o.next();!s.done;s=o.next()){var i=s.value;this.checksum=this.checksum>>>8^Qi[(this.checksum^i)&255]}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return this},t.prototype.digest=function(){return(this.checksum^4294967295)>>>0},t})();K.Crc32=Uo;var Gi=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],Qi=(0,Vi.uint32ArrayFrom)(Gi),Ki=Oo();Object.defineProperty(K,"AwsCrc32",{enumerable:!0,get:function(){return Ki.AwsCrc32}})});function Po(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var Z,er=m(()=>{H();Z=class t{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&Po(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&Po(e),parseInt(R(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var he,Fo,Ro,Zi,Yi,Xi,ea,ta,ra,na,oa,sa,tr=m(()=>{H();er();he=class{toUtf8;fromUtf8;constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let s of Object.keys(e)){let i=this.fromUtf8(s);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[s]))}let n=new Uint8Array(r.reduce((s,i)=>s+i.byteLength,0)),o=0;for(let s of r)n.set(s,o),o+=s.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":let o=new Uint8Array(9);return o[0]=5,o.set(e.value.bytes,1),o;case"binary":let s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);let i=new Uint8Array(s.buffer);return i.set(e.value,3),i;case"string":let a=this.fromUtf8(e.value),f=new DataView(new ArrayBuffer(3+a.byteLength));f.setUint8(0,7),f.setUint16(1,a.byteLength,!1);let u=new Uint8Array(f.buffer);return u.set(a,3),u;case"timestamp":let c=new Uint8Array(9);return c[0]=8,c.set(Z.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!sa.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let l=new Uint8Array(17);return l[0]=9,l.set(_t(e.value.replace(/\-/g,"")),1),l}}parse(e){let r={},n=0;for(;n<e.byteLength;){let o=e.getUint8(n++),s=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,o));switch(n+=o,e.getUint8(n++)){case 0:r[s]={type:Ro,value:!0};break;case 1:r[s]={type:Ro,value:!1};break;case 2:r[s]={type:Zi,value:e.getInt8(n++)};break;case 3:r[s]={type:Yi,value:e.getInt16(n,!1)},n+=2;break;case 4:r[s]={type:Xi,value:e.getInt32(n,!1)},n+=4;break;case 5:r[s]={type:ea,value:new Z(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let i=e.getUint16(n,!1);n+=2,r[s]={type:ta,value:new Uint8Array(e.buffer,e.byteOffset+n,i)},n+=i;break;case 7:let a=e.getUint16(n,!1);n+=2,r[s]={type:ra,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,a))},n+=a;break;case 8:r[s]={type:na,value:new Date(new Z(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let f=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,r[s]={type:oa,value:`${R(f.subarray(0,4))}-${R(f.subarray(4,6))}-${R(f.subarray(6,8))}-${R(f.subarray(8,10))}-${R(f.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(Fo||(Fo={}));Ro="boolean",Zi="byte",Yi="short",Xi="integer",ea="long",ta="binary",ra="string",na="timestamp",oa="uuid",sa=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});function No({byteLength:t,byteOffset:e,buffer:r}){if(t<ia)throw new Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,e,t),o=n.getUint32(0,!1);if(t!==o)throw new Error("Reported message length does not match received message length");let s=n.getUint32(ko,!1),i=n.getUint32(Y,!1),a=n.getUint32(t-se,!1),f=new Io.Crc32().update(new Uint8Array(r,e,Y));if(i!==f.digest())throw new Error(`The prelude checksum specified in the message (${i}) does not match the calculated CRC32 checksum (${f.digest()})`);if(f.update(new Uint8Array(r,e+Y,t-(Y+se))),a!==f.digest())throw new Error(`The message checksum (${f.digest()}) did not match the expected value of ${a}`);return{headers:new DataView(r,e+Y+se,s),body:new Uint8Array(r,e+Y+se+s,o-s-(Y+se+se))}}var Io,ko,Y,se,ia,Lo=m(()=>{Io=Ie(ot()),ko=4,Y=ko*2,se=4,ia=Y+se*2});var $o,de,rr=m(()=>{$o=Ie(ot());tr();Lo();de=class{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,r){this.headerMarshaller=new he(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let n=this.headerMarshaller.format(e),o=n.byteLength+r.byteLength+16,s=new Uint8Array(o),i=new DataView(s.buffer,s.byteOffset,s.byteLength),a=new $o.Crc32;return i.setUint32(0,o,!1),i.setUint32(4,n.byteLength,!1),i.setUint32(8,a.update(s.subarray(0,8)).digest(),!1),s.set(n,12),s.set(r,n.byteLength+12),i.setUint32(o-4,a.update(s.subarray(8,o-4)).digest(),!1),s}decode(e){let{headers:r,body:n}=No(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}}});var pe,nr=m(()=>{pe=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}});var ye,or=m(()=>{ye=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}}});var ge,sr=m(()=>{ge=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}}});var be,ir=m(()=>{be=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}});function st(t){let e=0,r=0,n=null,o=null,s=a=>{if(typeof a!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+a);e=a,r=4,n=new Uint8Array(a),new DataView(n.buffer).setUint32(0,a,!1)},i=async function*(){let a=t[Symbol.asyncIterator]();for(;;){let{value:f,done:u}=await a.next();if(u){if(e)if(e===r)yield n;else throw new Error("Truncated event message received.");else return;return}let c=f.length,l=0;for(;l<c;){if(!n){let h=c-l;o||(o=new Uint8Array(4));let d=Math.min(4-r,h);if(o.set(f.slice(l,l+d),r),r+=d,l+=d,r<4)break;s(new DataView(o.buffer).getUint32(0,!1)),o=null}let p=Math.min(e-r,c-l);n.set(f.slice(l,l+p),r),r+=p,l+=p,e&&e===r&&(yield n,n=null,e=0,r=0)}}};return{[Symbol.asyncIterator]:i}}var ar=m(()=>{});function jo(t,e){let r=Be(e.deserializer,e.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(let n of t){let o=e.eventStreamCodec.decode(n),s=await r(o);s!==void 0&&(yield s)}}}}function Be(t,e){return async function(r){let{value:n}=r.headers[":message-type"];if(n==="error"){let o=new Error(r.headers[":error-message"].value||"UnknownError");throw o.name=r.headers[":error-code"].value,o}else if(n==="exception"){let o=r.headers[":exception-type"].value,s={[o]:r},i=await t(s);if(i.$unknown){let a=new Error(e(r.body));throw a.name=o,a}throw i[o]}else if(n==="event"){let o={[r.headers[":event-type"].value]:r},s=await t(o);return s.$unknown?void 0:s}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}var cr=m(()=>{});var ie,Ho,fr=m(()=>{rr();nr();or();sr();ir();ar();cr();ie=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:r}){this.eventStreamCodec=new de(e,r),this.utfEncoder=e}deserialize(e,r){let n=st(e);return new ge({messageStream:new pe({inputStream:n,decoder:this.eventStreamCodec}),deserializer:Be(r,this.utfEncoder)})}serialize(e,r){return new ye({messageStream:new be({inputStream:e,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}},Ho=t=>new ie(t)});async function*aa(t){let e=!1,r=!1,n=new Array;for(t.on("error",o=>{if(e||(e=!0),o)throw o}),t.on("data",o=>{n.push(o)}),t.on("end",()=>{e=!0});!r;){let o=await new Promise(s=>setTimeout(()=>s(n.shift()),0));o&&(yield o),r=e&&n.length===0}}var zo,De,qo,Jo=m(()=>{zo=require("node:stream");fr();De=class{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:r}){this.universalMarshaller=new ie({utf8Decoder:r,utf8Encoder:e})}deserialize(e,r){let n=typeof e[Symbol.asyncIterator]=="function"?e:aa(e);return this.universalMarshaller.deserialize(n,r)}serialize(e,r){return zo.Readable.from(this.universalMarshaller.serialize(e,r))}},qo=t=>new De(t)});var Vo,Wo,Go=m(()=>{Vo=t=>({[Symbol.asyncIterator]:async function*(){let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)return;yield n}}finally{e.releaseLock()}}}),Wo=t=>{let e=t[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:n,value:o}=await e.next();if(n)return r.close();r.enqueue(o)}})}});var Qo,Ko=m(()=>{Qo=t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)})});var it,Zo=m(()=>{H();it=class{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:r,deserializer:n,serdeContext:o,defaultContentType:s}){this.marshaller=e,this.serializer=r,this.deserializer=n,this.serdeContext=o,this.defaultContentType=s}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n}){let o=this.marshaller,s=r.getEventStreamMember(),i=r.getMemberSchema(s),a=this.serializer,f=this.defaultContentType,u=Symbol("initialRequestMarker"),c={async*[Symbol.asyncIterator](){if(n){let l={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:f}};a.write(r,n);let p=a.flush();yield{[u]:!0,headers:l,body:p}}for await(let l of e)yield l}};return o.serialize(c,l=>{if(l[u])return{headers:l.headers,body:l.body};let p="";for(let b in l)if(b!=="__type"){p=b;break}let{additionalHeaders:h,body:d,eventType:y,explicitPayloadContentType:g}=this.writeEventBody(p,i,l);return{headers:{":event-type":{type:"string",value:y},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:g??f},...h},body:d}})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n}){let o=this.marshaller,s=r.getEventStreamMember(),a=r.getMemberSchema(s).getMemberSchemas(),f=Symbol("initialResponseMarker"),u=o.deserialize(e.body,async p=>{let h="";for(let y in p)if(y!=="__type"){h=y;break}let d=p[h].body;if(h==="initial-response"){let y=await this.deserializer.read(r,d);return delete y[s],{[f]:!0,...y}}else if(h in a){let y=a[h];if(y.isStructSchema()){let g={},x=!1;for(let[b,S]of y.structIterator()){let{eventHeader:D,eventPayload:C}=S.getMergedTraits();if(x=x||!!(D||C),C)S.isBlobSchema()?g[b]=d:S.isStringSchema()?g[b]=(this.serdeContext?.utf8Encoder??W)(d):S.isStructSchema()&&(g[b]=await this.deserializer.read(S,d));else if(D){let _=p[h].headers[b]?.value;_!=null&&(S.isNumericSchema()?_&&typeof _=="object"&&"bytes"in _?g[b]=BigInt(_.toString()):g[b]=Number(_):g[b]=_)}}if(x)return{[h]:g};if(d.byteLength===0)return{[h]:{}}}return{[h]:await this.deserializer.read(y,d)}}else return{$unknown:p}}),c=u[Symbol.asyncIterator](),l=await c.next();if(l.done)return u;if(l.value?.[f]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let p in l.value)n[p]=l.value[p]}return{async*[Symbol.asyncIterator](){for(l?.value?.[f]||(yield l.value);;){let{done:p,value:h}=await c.next();if(p)break;yield h}}}}writeEventBody(e,r,n){let o=this.serializer,s=e,i=null,a,f=r.getSchema()[4].includes(e),u={};if(f){let p=r.getMemberSchema(e);if(p.isStructSchema()){for(let[h,d]of p.structIterator()){let{eventHeader:y,eventPayload:g}=d.getMergedTraits();if(g)i=h;else if(y){let x=n[e][h],b="binary";d.isNumericSchema()?(-2)**31<=x&&x<=2**31-1?b="integer":b="long":d.isTimestampSchema()?b="timestamp":d.isStringSchema()?b="string":d.isBooleanSchema()&&(b="boolean"),x!=null&&(u[h]={type:b,value:x},delete n[e][h])}}if(i!==null){let h=p.getMemberSchema(i);h.isBlobSchema()?a="application/octet-stream":h.isStringSchema()&&(a="text/plain"),o.write(h,n[e][i])}else o.write(p,n[e])}else if(p.isUnitSchema())o.write(p,{});else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[p,h]=n[e];s=p,o.write(15,h)}let c=o.flush()??new Uint8Array;return{body:typeof c=="string"?(this.serdeContext?.utf8Decoder??V)(c):c,eventType:s,explicitPayloadContentType:a,additionalHeaders:u}}}});var Yo={};Re(Yo,{EventStreamCodec:()=>de,EventStreamMarshaller:()=>De,EventStreamSerde:()=>it,HeaderMarshaller:()=>he,Int64:()=>Z,MessageDecoderStream:()=>pe,MessageEncoderStream:()=>ye,SmithyMessageDecoderStream:()=>ge,SmithyMessageEncoderStream:()=>be,UniversalEventStreamMarshaller:()=>ie,eventStreamSerdeProvider:()=>qo,getChunkedStream:()=>st,getMessageUnmarshaller:()=>Be,getUnmarshalledStream:()=>jo,iterableToReadableStream:()=>Wo,readableStreamToIterable:()=>Vo,resolveEventStreamSerdeConfig:()=>Qo,universalEventStreamSerdeProvider:()=>Ho});var Xo=m(()=>{rr();tr();er();nr();or();sr();ir();Jo();Go();fr();ar();cr();Ko();Zo()});var ae,at=m(()=>{G();I();le();ae=class extends k{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=ze.for(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return O}getResponseType(){return te}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,r){if("url"in r){e.protocol=r.url.protocol,e.hostname=r.url.hostname,e.port=r.url.port?Number(r.url.port):void 0,e.path=r.url.pathname,e.fragment=r.url.hash||void 0,e.username=r.url.username||void 0,e.password=r.url.password||void 0,e.query||(e.query={});for(let[n,o]of r.url.searchParams.entries())e.query[n]=o;if(r.headers)for(let n in r.headers)e.headers[n]=r.headers[n].join(", ");return e}else{if(e.protocol=r.protocol,e.hostname=r.hostname,e.port=r.port?Number(r.port):void 0,e.path=r.path,e.query={...r.query},r.headers)for(let n in r.headers)e.headers[n]=r.headers[n];return e}}setHostPrefix(e,r,n){if(this.serdeContext?.disableHostPrefix)return;let o=v.of(r.input),s=j(r.traits??{});if(s.endpoint){let i=s.endpoint?.[0];if(typeof i=="string"){for(let[a,f]of o.structIterator()){if(!f.getMergedTraits().hostLabel)continue;let u=n[a];if(typeof u!="string")throw new Error(`@smithy/core/schema - ${a} in input must be a string as hostLabel.`);i=i.replace(`{${a}}`,u)}e.hostname=i+e.hostname}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:r}=await Promise.resolve().then(()=>(Xo(),Yo)),n=this.resolveEventStreamMarshaller(r);return new e({marshaller:n,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}resolveEventStreamMarshaller(e){let r=this.serdeContext;return r.eventStreamMarshaller?r.eventStreamMarshaller:e(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,n,o,s){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}});var ur,es=m(()=>{G();H();I();at();Je();Ve();ur=class extends ae{async serializeRequest(e,r,n){let o=r&&typeof r=="object"?r:{},s=this.serializer,i={},a={},f=await n.endpoint(),u=v.of(e?.input),c=[],l=[],p=!1,h,d=new O({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:i,headers:a,body:void 0});if(f){this.updateServiceEndpoint(d,f),this.setHostPrefix(d,e,o);let y=j(e.traits);if(y.http){d.method=y.http[0];let[g,x]=y.http[1].split("?");d.path=="/"?d.path=g:d.path+=g;let b=new URLSearchParams(x??"");for(let[S,D]of b)i[S]=D}}for(let[y,g]of u.structIterator()){let x=g.getMergedTraits()??{},b=o[y];if(b==null&&!g.isIdempotencyToken()){if(x.httpLabel&&(d.path.includes(`{${y}+}`)||d.path.includes(`{${y}}`)))throw new Error(`No value provided for input HTTP label: ${y}.`);continue}if(x.httpPayload)g.isStreaming()?g.isStructSchema()?o[y]&&(h=await this.serializeEventStream({eventStream:o[y],requestSchema:u})):h=b:(s.write(g,b),h=s.flush());else if(x.httpLabel){s.write(g,b);let S=s.flush();d.path.includes(`{${y}+}`)?d.path=d.path.replace(`{${y}+}`,S.split("/").map(oe).join("/")):d.path.includes(`{${y}}`)&&(d.path=d.path.replace(`{${y}}`,oe(S)))}else if(x.httpHeader)s.write(g,b),a[x.httpHeader.toLowerCase()]=String(s.flush());else if(typeof x.httpPrefixHeaders=="string")for(let S in b){let D=b[S],C=x.httpPrefixHeaders+S;s.write([g.getValueSchema(),{httpHeader:C}],D),a[C.toLowerCase()]=s.flush()}else x.httpQuery||x.httpQueryParams?this.serializeQuery(g,b,i):(p=!0,c.push(y),l.push(g))}if(p&&o){let[y,g]=(u.getName(!0)??"#Unknown").split("#"),x=u.getSchema()[6],b=[3,y,g,u.getMergedTraits(),c,l,void 0];x?b[6]=x:b.pop(),s.write(b,o),h=s.flush()}return d.headers=a,d.query=i,d.body=h,d}serializeQuery(e,r,n){let o=this.serializer,s=e.getMergedTraits();if(s.httpQueryParams){for(let i in r)if(!(i in n)){let a=r[i],f=e.getValueSchema();Object.assign(f.getMergedTraits(),{...s,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(f,a,n)}return}if(e.isListSchema()){let i=!!e.getMergedTraits().sparse,a=[];for(let f of r){o.write([e.getValueSchema(),s],f);let u=o.flush();(i||u!==void 0)&&a.push(u)}n[s.httpQuery]=a}else o.write([e,s],r),n[s.httpQuery]=o.flush()}async deserializeResponse(e,r,n){let o=this.deserializer,s=v.of(e.output),i={};if(n.statusCode>=300){let f=await z(n.body,r);throw f.byteLength>0&&Object.assign(i,await o.read(15,f)),await this.handleError(e,r,n,i,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let f in n.headers){let u=n.headers[f];delete n.headers[f],n.headers[f.toLowerCase()]=u}let a=await this.deserializeHttpMessage(s,r,n,i);if(a.length){let f=await z(n.body,r);if(f.byteLength>0){let u=await o.read(s,f);for(let c of a)u[c]!=null&&(i[c]=u[c])}}else a.discardResponseBody&&await z(n.body,r);return i.$metadata=this.deserializeMetadata(n),i}async deserializeHttpMessage(e,r,n,o,s){let i;o instanceof Set?i=s:i=o;let a=!0,f=this.deserializer,u=v.of(e),c=[];for(let[l,p]of u.structIterator()){let h=p.getMemberTraits();if(h.httpPayload){if(a=!1,p.isStreaming())p.isStructSchema()?i[l]=await this.deserializeEventStream({response:n,responseSchema:u}):i[l]=qt(n.body);else if(n.body){let y=await z(n.body,r);y.byteLength>0&&(i[l]=await f.read(p,y))}}else if(h.httpHeader){let d=String(h.httpHeader).toLowerCase(),y=n.headers[d];if(y!=null)if(p.isListSchema()){let g=p.getValueSchema();g.getMergedTraits().httpHeader=d;let x;g.isTimestampSchema()&&g.getSchema()===4?x=Bt(y,",",2):x=Ee(y);let b=[];for(let S of x)b.push(await f.read(g,S.trim()));i[l]=b}else i[l]=await f.read(p,y)}else if(h.httpPrefixHeaders!==void 0){i[l]={};for(let d in n.headers)if(d.startsWith(h.httpPrefixHeaders)){let y=n.headers[d],g=p.getValueSchema();g.getMergedTraits().httpHeader=d,i[l][d.slice(h.httpPrefixHeaders.length)]=await f.read(g,y)}}else h.httpResponseCode?i[l]=n.statusCode:c.push(l)}return c.discardResponseBody=a,c}}});var lr,ts=m(()=>{G();I();at();Je();lr=class extends ae{async serializeRequest(e,r,n){let o=this.serializer,s={},i={},a=await n.endpoint(),f=v.of(e?.input),u=f.getSchema(),c,l=r&&typeof r=="object"?r:{},p=new O({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:s,headers:i,body:void 0});if(a&&(this.updateServiceEndpoint(p,a),this.setHostPrefix(p,e,l)),l){let h=f.getEventStreamMember();if(h){if(l[h]){let d={};for(let[y,g]of f.structIterator())y!==h&&l[y]&&(o.write(g,l[y]),d[y]=o.flush());c=await this.serializeEventStream({eventStream:l[h],requestSchema:f,initialRequest:d})}}else o.write(u,l),c=o.flush()}return p.headers=Object.assign(p.headers,i),p.query=s,p.body=c,p.method="POST",p}async deserializeResponse(e,r,n){let o=this.deserializer,s=v.of(e.output),i={};if(n.statusCode>=300){let f=await z(n.body,r);throw f.byteLength>0&&Object.assign(i,await o.read(15,f)),await this.handleError(e,r,n,i,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let f in n.headers){let u=n.headers[f];delete n.headers[f],n.headers[f.toLowerCase()]=u}let a=s.getEventStreamMember();if(a)i[a]=await this.deserializeEventStream({response:n,responseSchema:s,initialResponseContainer:i});else{let f=await z(n.body,r);f.byteLength>0&&Object.assign(i,await o.read(s,f))}return i.$metadata=this.deserializeMetadata(n),i}}});var mr,hr=m(()=>{Ve();mr=(t,e,r,n,o,s)=>{if(e!=null&&e[r]!==void 0){let i=n();if(i==null||i.length<=0)throw new Error("Empty value provided for input HTTP label: "+r+".");t=t.replace(o,s?i.split("/").map(a=>oe(a)).join("/"):oe(i))}else throw new Error("No value provided for input HTTP label: "+r+".");return t}});function ca(t,e){return new ct(t,e)}var ct,rs=m(()=>{I();hr();ct=class{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,r){this.input=e,this.context=r}async build(){let{hostname:e,protocol:r="https",port:n,path:o}=await this.context.endpoint();this.path=o;for(let s of this.resolvePathStack)s(this.path);return new O({protocol:r,hostname:this.hostname||e,port:n,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(r=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,n,o){return this.resolvePathStack.push(s=>{this.path=mr(s,this.input,e,r,n,o)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}});function _e(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:n,httpHeader:o,httpQuery:s}=t.getMergedTraits();return(e.httpBindings?typeof n=="string"||o?6:s||r?5:void 0:void 0)??e.timestampFormat.default}var ft=m(()=>{});var Me,dr=m(()=>{G();H();le();ft();Me=class extends k{settings;constructor(e){super(),this.settings=e}read(e,r){let n=v.of(e);if(n.isListSchema())return Ee(r).map(o=>this.read(n.getValueSchema(),o));if(n.isBlobSchema())return(this.serdeContext?.base64Decoder??we)(r);if(n.isTimestampSchema())switch(_e(n,this.settings)){case 5:return At(r);case 6:return Ct(r);case 7:return vt(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(n.isStringSchema()){let o=n.getMergedTraits().mediaType,s=r;if(o)return n.getMergedTraits().httpHeader&&(s=this.base64ToUtf8(s)),(o==="application/json"||o.endsWith("+json"))&&(s=F.from(s)),s}return n.isNumericSchema()?Number(r):n.isBigIntegerSchema()?BigInt(r):n.isBigDecimalSchema()?new Te(r,"bigDecimal"):n.isBooleanSchema()?String(r).toLowerCase()==="true":r}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??W)((this.serdeContext?.base64Decoder??we)(e))}}});var pr,ns=m(()=>{G();H();le();dr();pr=class extends k{codecDeserializer;stringDeserializer;constructor(e,r){super(),this.codecDeserializer=e,this.stringDeserializer=new Me(r)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,r){let n=v.of(e),o=n.getMergedTraits(),s=this.serdeContext?.utf8Encoder??W;if(o.httpHeader||o.httpResponseCode)return this.stringDeserializer.read(n,s(r));if(o.httpPayload){if(n.isBlobSchema()){let i=this.serdeContext?.utf8Decoder??V;return typeof r=="string"?i(r):r}else if(n.isStringSchema())return"byteLength"in r?s(r):r}return this.codecDeserializer.read(n,r)}}});var Oe,yr=m(()=>{G();H();le();ft();Oe=class extends k{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,r){let n=v.of(e);switch(typeof r){case"object":if(r===null){this.stringBuffer="null";return}if(n.isTimestampSchema()){if(!(r instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${r} when schema expected Date in ${n.getName(!0)}`);switch(_e(n,this.settings)){case 5:this.stringBuffer=r.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=xt(r);break;case 7:this.stringBuffer=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",r),this.stringBuffer=String(r.getTime()/1e3)}return}if(n.isBlobSchema()&&"byteLength"in r){this.stringBuffer=(this.serdeContext?.base64Encoder??Se)(r);return}if(n.isListSchema()&&Array.isArray(r)){let i="";for(let a of r){this.write([n.getValueSchema(),n.getMergedTraits()],a);let f=this.flush(),u=n.getValueSchema().isTimestampSchema()?f:wt(f);i!==""&&(i+=", "),i+=u}this.stringBuffer=i;return}this.stringBuffer=JSON.stringify(r,null,2);break;case"string":let o=n.getMergedTraits().mediaType,s=r;if(o&&((o==="application/json"||o.endsWith("+json"))&&(s=F.from(s)),n.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??Se)(s.toString());return}this.stringBuffer=r;break;default:n.isIdempotencyToken()?this.stringBuffer=Nn():this.stringBuffer=String(r)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}}});var gr,os=m(()=>{G();yr();gr=class{codecSerializer;stringSerializer;buffer;constructor(e,r,n=new Oe(r)){this.codecSerializer=e,this.stringSerializer=n}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,r){let n=v.of(e),o=n.getMergedTraits();if(o.httpHeader||o.httpLabel||o.httpQuery){this.stringSerializer.write(n,r),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(n,r)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}});var ss,ut,is=m(()=>{ss=Ie(Wr()),ut=class{name;kind;values;constructor({name:e,kind:r=ss.FieldPosition.HEADER,values:n=[]}){this.name=e,this.kind=r,this.values=n}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}}});var lt,as=m(()=>{lt=class{entries={};encoding;constructor({fields:e=[],encoding:r="utf-8"}){e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}}});var cs,fs,us=m(()=>{cs=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),fs=t=>({httpHandler:t.httpHandler()})});function br(t){return e=>async r=>{let n=r.request;if(O.isInstance(n)){let{body:o,headers:s}=n;if(o&&Object.keys(s).map(i=>i.toLowerCase()).indexOf(ls)===-1)try{let i=t(o);n.headers={...n.headers,[ls]:String(i)}}catch{}}return e({...r,request:n})}}var ls,xr,ms,hs=m(()=>{I();ls="content-length";xr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},ms=t=>({applyToStack:e=>{e.add(br(t.bodyLengthChecker),xr)}})});var X,fa,mt=m(()=>{X=t=>encodeURIComponent(t).replace(/[!'()*]/g,fa),fa=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var ds,ps=m(()=>{mt();ds=t=>t.split("/").map(X).join("/")});function ys(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=X(r),Array.isArray(n))for(let o=0,s=n.length;o<s;o++)e.push(`${r}=${X(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${X(n)}`),e.push(o)}}return e.join("&")}var gs=m(()=>{mt()});var bs={};Re(bs,{Field:()=>ut,Fields:()=>lt,FromStringShapeDeserializer:()=>Me,HttpBindingProtocol:()=>ur,HttpInterceptingShapeDeserializer:()=>pr,HttpInterceptingShapeSerializer:()=>gr,HttpProtocol:()=>ae,HttpRequest:()=>O,HttpResponse:()=>te,RequestBuilder:()=>ct,RpcProtocol:()=>lr,SerdeContext:()=>k,ToStringShapeSerializer:()=>Oe,buildQueryString:()=>ys,collectBody:()=>z,contentLengthMiddleware:()=>br,contentLengthMiddlewareOptions:()=>xr,determineTimestampFormat:()=>_e,escapeUri:()=>X,escapeUriPath:()=>ds,extendedEncodeURIComponent:()=>oe,getContentLengthPlugin:()=>ms,getHttpHandlerExtensionConfiguration:()=>cs,isValidHostname:()=>Ot,parseQueryString:()=>ve,parseUrl:()=>$e,requestBuilder:()=>ca,resolveHttpHandlerRuntimeConfig:()=>fs,resolvedPath:()=>mr});var xs=m(()=>{Je();Ve();es();at();ts();rs();hr();dr();ns();os();yr();ft();le();is();as();I();I();I();us();hs();mt();ps();gs();I();I()});var _s=U(Pe=>{var{buildQueryString:As,HttpResponse:Cs}=(xs(),ke(bs)),ht=require("node:https"),{Readable:ua,Writable:la}=require("node:stream"),wr=require("node:http2");function pt(t){let e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){let o=new Error("Request aborted");return o.name="AbortError",o.cause=e,o}let n=new Error(String(e));return n.name="AbortError",n}let r=new Error("Request aborted");return r.name="AbortError",r}var ma=["ECONNRESET","EPIPE","ETIMEDOUT"],Bs=t=>{let e={};for(let r in t){let n=t[r];e[r]=Array.isArray(n)?n.join(","):n}return e},A={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},ws=1e3,ha=(t,e,r=0)=>{if(!r)return-1;let n=o=>{let s=A.setTimeout(()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-o),i=a=>{a?.connecting?a.on("connect",()=>{A.clearTimeout(s)}):A.clearTimeout(s)};t.socket?i(t.socket):t.on("socket",i)};return r<2e3?(n(0),0):A.setTimeout(n.bind(null,ws),ws)},da=(t,e,r=0,n,o)=>r?A.setTimeout(()=>{let s=`@smithy/node-http-handler - [${n?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(n){let i=Object.assign(new Error(s),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(i),e(i)}else s+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",o?.warn?.(s)},r):-1,pa=3e3,ya=(t,{keepAlive:e,keepAliveMsecs:r},n=pa)=>{if(e!==!0)return-1;let o=()=>{t.socket?t.socket.setKeepAlive(e,r||0):t.on("socket",s=>{s.setKeepAlive(e,r||0)})};return n===0?(o(),0):A.setTimeout(o,n)},Ss=3e3,ga=(t,e,r=0)=>{let n=o=>{let s=r-o,i=()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};t.socket?(t.socket.setTimeout(s,i),t.on("close",()=>t.socket?.removeListener("timeout",i))):t.setTimeout(s,i)};return 0<r&&r<6e3?(n(0),0):A.setTimeout(n.bind(null,r===0?0:Ss),Ss)},Es=6e3;async function Ds(t,e,r=Es,n=!1){let o=e.headers,s=o?o.Expect||o.expect:void 0,i=-1,a=!0;!n&&s==="100-continue"&&(a=await Promise.race([new Promise(f=>{i=Number(A.setTimeout(()=>f(!0),Math.max(Es,r)))}),new Promise(f=>{t.on("continue",()=>{A.clearTimeout(i),f(!0)}),t.on("response",()=>{A.clearTimeout(i),f(!1)}),t.on("error",()=>{A.clearTimeout(i),f(!1)})})])),a&&ba(t,e.body)}function ba(t,e){if(e instanceof ua){e.pipe(t);return}if(e){let r=Buffer.isBuffer(e);if(r||typeof e=="string"){r&&e.byteLength===0?t.end():t.end(e);return}let o=e;if(typeof o=="object"&&o.buffer&&typeof o.byteOffset=="number"&&typeof o.byteLength=="number"){t.end(Buffer.from(o.buffer,o.byteOffset,o.byteLength));return}t.end(Buffer.from(e));return}t.end()}var xa=0,dt,Ts,Sr=class t{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new t(e)}static checkSocketUsage(e,r,n=console){let{sockets:o,requests:s,maxSockets:i}=e;if(typeof i!="number"||i===1/0||Date.now()-15e3<r)return r;if(o&&s)for(let f in o){let u=o[f]?.length??0,c=s[f]?.length??0;if(u>=i&&c>=2*i)return n?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${u} and ${c} additional requests are enqueued.
|
|
2
3
|
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
3
|
-
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return n}constructor(e){this.configProvider=new Promise((n,s)=>{typeof e=="function"?e().then(r=>{n(this.resolveDefaultConfig(r))}).catch(s):n(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:n,requestTimeout:s}={}){this.config||(this.config=await this.configProvider);let r=this.config,i=e.protocol==="https:";return!i&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((c,u)=>{let a,m=[],o=async f=>{await a,m.forEach(E.clearTimeout),c(f)},d=async f=>{await a,m.forEach(E.clearTimeout),u(f)};if(n?.aborted){let f=N(n);d(f);return}let b=e.headers??{},v=(b.Expect??b.expect)==="100-continue",S=i?r.httpsAgent:r.httpAgent;v&&!this.externalAgent&&(S=new(i?L.Agent:U)({keepAlive:!1,maxSockets:1/0})),m.push(E.setTimeout(()=>{this.socketWarningTimestamp=t.checkSocketUsage(S,this.socketWarningTimestamp,r.logger)},r.socketAcquisitionWarningTimeout??(r.requestTimeout??2e3)+(r.connectionTimeout??1e3)));let R=ue.buildQueryString(e.query||{}),k;if(e.username!=null||e.password!=null){let f=e.username??"",g=e.password??"";k=`${f}:${g}`}let H=e.path;R&&(H+=`?${R}`),e.fragment&&(H+=`#${e.fragment}`);let p=e.hostname??"";p[0]==="["&&p.endsWith("]")?p=e.hostname.slice(1,-1):p=e.hostname;let T={headers:e.headers,host:p,method:e.method,path:H,port:e.port,agent:S,auth:k},h=(i?L.request:ce)(T,f=>{let g=new ae.HttpResponse({statusCode:f.statusCode||-1,reason:f.statusMessage,headers:le(f.headers),body:f});o({response:g})});if(h.on("error",f=>{$e.includes(f.code)?d(Object.assign(f,{name:"TimeoutError"})):d(f)}),n){let f=()=>{h.destroy();let g=N(n);d(g)};if(typeof n.addEventListener=="function"){let g=n;g.addEventListener("abort",f,{once:!0}),h.once("close",()=>g.removeEventListener("abort",f))}else n.onabort=f}let A=s??r.requestTimeout;m.push(Oe(h,d,r.connectionTimeout)),m.push(je(h,d,A,r.throwOnRequestTimeout,r.logger??console)),m.push(Be(h,d,r.socketTimeout));let D=T.agent;typeof D=="object"&&"keepAlive"in D&&m.push(qe(h,{keepAlive:D.keepAlive,keepAliveMsecs:D.keepAliveMsecs})),a=fe(h,e,A,this.externalAgent).catch(f=>(m.forEach(E.clearTimeout),u(f)))})}updateHttpClientConfig(e,n){this.config=void 0,this.configProvider=this.configProvider.then(s=>({...s,[e]:n}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:n,connectionTimeout:s,socketTimeout:r,socketAcquisitionWarningTimeout:i,httpAgent:c,httpsAgent:u,throwOnRequestTimeout:a,logger:m}=e||{},o=!0,d=50;return{connectionTimeout:s,requestTimeout:n,socketTimeout:r,socketAcquisitionWarningTimeout:i,throwOnRequestTimeout:a,httpAgentProvider:async()=>{let{Agent:b,request:v}=await import("node:http");return ce=v,U=b,c instanceof U||typeof c?.destroy=="function"?(this.externalAgent=!0,c):new U({keepAlive:o,maxSockets:d,...c})},httpsAgent:u instanceof L.Agent||typeof u?.destroy=="function"?(this.externalAgent=!0,u):new L.Agent({keepAlive:o,maxSockets:d,...u}),logger:m}}},K=class{sessions=[];constructor(e){this.sessions=e??[]}poll(){if(this.sessions.length>0)return this.sessions.shift()}offerLast(e){this.sessions.push(e)}contains(e){return this.sessions.includes(e)}remove(e){this.sessions=this.sessions.filter(n=>n!==e)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}destroy(e){for(let n of this.sessions)n===e&&(n.destroyed||n.destroy())}},J=class{constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw new RangeError("maxConcurrency must be greater than zero.")}config;sessionCache=new Map;lease(e,n){let s=this.getUrlString(e),r=this.sessionCache.get(s);if(r){let a=r.poll();if(a&&!this.config.disableConcurrency)return a}let i=Q.connect(s);this.config.maxConcurrency&&i.settings({maxConcurrentStreams:this.config.maxConcurrency},a=>{if(a)throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())}),i.unref();let c=()=>{i.destroy(),this.deleteSession(s,i)};i.on("goaway",c),i.on("error",c),i.on("frameError",c),i.on("close",()=>this.deleteSession(s,i)),n.requestTimeout&&i.setTimeout(n.requestTimeout,c);let u=this.sessionCache.get(s)||new K;return u.offerLast(i),this.sessionCache.set(s,u),i}deleteSession(e,n){let s=this.sessionCache.get(e);s&&s.contains(n)&&(s.remove(n),this.sessionCache.set(e,s))}release(e,n){let s=this.getUrlString(e);this.sessionCache.get(s)?.offerLast(n)}destroy(){for(let[e,n]of this.sessionCache){for(let s of n)s.destroyed||s.destroy(),n.remove(s);this.sessionCache.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw new RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}getUrlString(e){return e.destination.toString()}},V=class t{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new J({});static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){this.configProvider=new Promise((n,s)=>{typeof e=="function"?e().then(r=>{n(r||{})}).catch(s):n(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:n,requestTimeout:s}={}){this.config||(this.config=await this.configProvider,this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams||!1),this.config.maxConcurrentStreams&&this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams));let{requestTimeout:r,disableConcurrentStreams:i}=this.config,c=s??r;return new Promise((u,a)=>{let m=!1,o,d=async y=>{await o,u(y)},b=async y=>{await o,a(y)};if(n?.aborted){m=!0;let y=N(n);b(y);return}let{hostname:v,method:S,port:R,protocol:k,query:H}=e,p="";if(e.username!=null||e.password!=null){let y=e.username??"",w=e.password??"";p=`${y}:${w}@`}let T=`${k}//${p}${v}${R?`:${R}`:""}`,x={destination:new URL(T)},h=this.connectionManager.lease(x,{requestTimeout:this.config?.sessionTimeout,disableConcurrentStreams:i||!1}),A=y=>{i&&this.destroySession(h),m=!0,b(y)},D=ue.buildQueryString(H||{}),f=e.path;D&&(f+=`?${D}`),e.fragment&&(f+=`#${e.fragment}`);let g=h.request({...e.headers,[Q.constants.HTTP2_HEADER_PATH]:f,[Q.constants.HTTP2_HEADER_METHOD]:S});if(h.ref(),g.on("response",y=>{let w=new ae.HttpResponse({statusCode:y[":status"]||-1,headers:le(y),body:g});m=!0,d({response:w}),i&&(h.close(),this.connectionManager.deleteSession(T,h))}),c&&g.setTimeout(c,()=>{g.close();let y=new Error(`Stream timed out because of no activity for ${c} ms`);y.name="TimeoutError",A(y)}),n){let y=()=>{g.close();let w=N(n);A(w)};if(typeof n.addEventListener=="function"){let w=n;w.addEventListener("abort",y,{once:!0}),g.once("close",()=>w.removeEventListener("abort",y))}else n.onabort=y}g.on("frameError",(y,w,ge)=>{A(new Error(`Frame type id ${y} in stream id ${ge} has failed with code ${w}.`))}),g.on("error",A),g.on("aborted",()=>{A(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${g.rstCode}.`))}),g.on("close",()=>{h.unref(),i&&h.destroy(),m||A(new Error("Unexpected error: http2 request did not get a response"))}),o=fe(g,e,c)})}updateHttpClientConfig(e,n){this.config=void 0,this.configProvider=this.configProvider.then(s=>({...s,[e]:n}))}httpHandlerConfigs(){return this.config??{}}destroySession(e){e.destroyed||e.destroy()}},Y=class extends de.Writable{bufferedBytes=[];_write(e,n,s){this.bufferedBytes.push(e),s()}},We=t=>Ke(t)?Je(t):new Promise((e,n)=>{let s=new Y;t.pipe(s),t.on("error",r=>{s.end(),n(r)}),s.on("error",n),s.on("finish",function(){let r=new Uint8Array(Buffer.concat(this.bufferedBytes));e(r)})}),Ke=t=>typeof ReadableStream=="function"&&t instanceof ReadableStream;async function Je(t){let e=[],n=t.getReader(),s=!1,r=0;for(;!s;){let{done:u,value:a}=await n.read();a&&(e.push(a),r+=a.length),s=u}let i=new Uint8Array(r),c=0;for(let u of e)i.set(u,c),c+=u.length;return i}P.DEFAULT_REQUEST_TIMEOUT=Qe;P.NodeHttp2Handler=V;P.NodeHttpHandler=W;P.streamCollector=We});var Xe={};ve(Xe,{handler:()=>ze});module.exports=Ae(Xe);var he=require("node:crypto"),$=require("@aws-sdk/client-dynamodb"),pe=X(me(),1),Ve={requestHandler:new pe.NodeHttpHandler({requestTimeout:1e4,connectionTimeout:5e3}),maxAttempts:5},Ye=new $.DynamoDBClient(Ve);async function ze(t,e){let n=e.awsRequestId,s=(0,he.randomUUID)().slice(0,8),r=(a,m)=>{console.info(JSON.stringify({requestId:n,batchId:s,msg:a,...m}))},i=(a,m,o)=>{console.error(JSON.stringify({requestId:n,batchId:s,msg:a,error:String(m),...o}))};r("Processing SES batch",{recordCount:t.Records.length});let c=process.env.TABLE_NAME;if(!c)throw new Error("TABLE_NAME environment variable not set");let u=Number.parseInt(process.env.RETENTION_DAYS||"90",10);for(let a of t.Records)try{let o=JSON.parse(a.body).detail,d=o.eventType||o.notificationType,b=o.mail,v=b.messageId,S=new Date(b.timestamp).getTime(),R=b.source,k=b.destination||[],H=b.commonHeaders?.subject||"";r("Processing email event",{messageId:v,eventType:d,recipientCount:k.length});let p={},T=S;if(d==="Send"&&o.send)p={tags:b.tags||{}};else if(d==="Delivery"&&o.delivery)T=new Date(o.delivery.timestamp).getTime(),p={timestamp:o.delivery.timestamp,processingTimeMillis:o.delivery.processingTimeMillis,recipients:o.delivery.recipients,smtpResponse:o.delivery.smtpResponse,remoteMtaIp:o.delivery.remoteMtaIp};else if(d==="Open"&&o.open)T=new Date(o.open.timestamp).getTime(),p={timestamp:o.open.timestamp,userAgent:o.open.userAgent,ipAddress:o.open.ipAddress};else if(d==="Click"&&o.click)T=new Date(o.click.timestamp).getTime(),p={timestamp:o.click.timestamp,link:o.click.link,linkTags:o.click.linkTags||{},userAgent:o.click.userAgent,ipAddress:o.click.ipAddress};else if(d==="Bounce"&&o.bounce){let h=o.bounce.bounceSubType;h==="Suppressed"||h==="OnAccountSuppressionList"?(d="Suppressed",T=new Date(o.bounce.timestamp).getTime(),p={reason:h,suppressedRecipients:o.bounce.bouncedRecipients,timestamp:o.bounce.timestamp,feedbackId:o.bounce.feedbackId}):(T=new Date(o.bounce.timestamp).getTime(),p={bounceType:o.bounce.bounceType,bounceSubType:o.bounce.bounceSubType,bouncedRecipients:o.bounce.bouncedRecipients,timestamp:o.bounce.timestamp,feedbackId:o.bounce.feedbackId})}else d==="Complaint"&&o.complaint?(T=new Date(o.complaint.timestamp).getTime(),p={complainedRecipients:o.complaint.complainedRecipients,timestamp:o.complaint.timestamp,feedbackId:o.complaint.feedbackId,complaintFeedbackType:o.complaint.complaintFeedbackType,userAgent:o.complaint.userAgent}):d==="Reject"&&o.reject?p={reason:o.reject.reason}:d==="Rendering Failure"&&o.failure?p={errorMessage:o.failure.errorMessage,templateName:o.failure.templateName}:d==="DeliveryDelay"&&o.deliveryDelay?(T=new Date(o.deliveryDelay.timestamp).getTime(),p={timestamp:o.deliveryDelay.timestamp,delayType:o.deliveryDelay.delayType,expirationTime:o.deliveryDelay.expirationTime,delayedRecipients:o.deliveryDelay.delayedRecipients}):d==="Subscription"&&o.subscription&&(T=new Date(o.subscription.timestamp).getTime(),p={contactList:o.subscription.contactList,timestamp:o.subscription.timestamp,source:o.subscription.source,newTopicPreferences:o.subscription.newTopicPreferences,oldTopicPreferences:o.subscription.oldTopicPreferences});let x=u>0?Date.now()+u*24*60*60*1e3:Date.now()+365*24*60*60*1e3;await Ye.send(new $.PutItemCommand({TableName:c,Item:{messageId:{S:v},sentAt:{N:T.toString()},mailSentAt:{N:S.toString()},accountId:{S:process.env.AWS_ACCOUNT_ID||"unknown"},from:{S:R},to:{L:k.map(h=>({S:h}))},subject:{S:H},eventType:{S:d},eventData:{S:JSON.stringify(o)},additionalData:{S:JSON.stringify(p)},createdAt:{N:Date.now().toString()},expiresAt:{N:x.toString()}}})),r("Stored event",{eventType:d,messageId:v})}catch(m){i("Error processing record",m,{sqsMessageId:a.messageId})}return{statusCode:200,body:JSON.stringify({message:"Events processed successfully"})}}0&&(module.exports={handler});
|
|
4
|
+
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(e){this.configProvider=new Promise((r,n)=>{typeof e=="function"?e().then(o=>{r(this.resolveDefaultConfig(o))}).catch(n):r(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:r,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);let o=this.config,s=e.protocol==="https:";return!s&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((i,a)=>{let f,u=-1,c=-1,l=-1,p=-1,h=-1,d=()=>{A.clearTimeout(u),A.clearTimeout(c),A.clearTimeout(l),A.clearTimeout(p),A.clearTimeout(h)},y=async w=>{await f,d(),i(w)},g=async w=>{await f,d(),a(w)};if(r?.aborted){let w=pt(r);g(w);return}let x=e.headers,b=x?(x.Expect??x.expect)==="100-continue":!1,S=s?o.httpsAgent:o.httpAgent;b&&!this.externalAgent&&(S=new(s?ht.Agent:dt)({keepAlive:!1,maxSockets:1/0})),u=A.setTimeout(()=>{this.socketWarningTimestamp=t.checkSocketUsage(S,this.socketWarningTimestamp,o.logger)},o.socketAcquisitionWarningTimeout??(o.requestTimeout??2e3)+(o.connectionTimeout??1e3));let D=e.query?As(e.query):"",C;if(e.username!=null||e.password!=null){let w=e.username??"",E=e.password??"";C=`${w}:${E}`}let _=e.path;D&&(_+=`?${D}`),e.fragment&&(_+=`#${e.fragment}`);let q=e.hostname??"";q[0]==="["&&q.endsWith("]")?q=e.hostname.slice(1,-1):q=e.hostname;let ee={headers:e.headers,host:q,method:e.method,path:_,port:e.port,agent:S,auth:C},M=(s?ht.request:Ts)(ee,w=>{let E=new Cs({statusCode:w.statusCode||-1,reason:w.statusMessage,headers:Bs(w.headers),body:w});y({response:E})});if(M.on("error",w=>{ma.includes(w.code)?g(Object.assign(w,{name:"TimeoutError"})):g(w)}),r){let w=()=>{M.destroy();let E=pt(r);g(E)};if(typeof r.addEventListener=="function"){let E=r;E.addEventListener("abort",w,{once:!0}),M.once("close",()=>E.removeEventListener("abort",w))}else r.onabort=w}let xe=n??o.requestTimeout;c=ha(M,g,o.connectionTimeout),l=da(M,g,xe,o.throwOnRequestTimeout,o.logger??console),p=ga(M,g,o.socketTimeout);let J=ee.agent;typeof J=="object"&&"keepAlive"in J&&(h=ya(M,{keepAlive:J.keepAlive,keepAliveMsecs:J.keepAliveMsecs})),f=Ds(M,e,xe,this.externalAgent).catch(w=>(d(),a(w)))})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>({...n,[e]:r}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:r,connectionTimeout:n,socketTimeout:o,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:a,throwOnRequestTimeout:f,logger:u}=e||{},c=!0,l=50;return{connectionTimeout:n,requestTimeout:r,socketTimeout:o,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:f,httpAgentProvider:async()=>{let p=require("node:http"),{Agent:h,request:d}=p.default??p;return Ts=d,dt=h,i instanceof dt||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new dt({keepAlive:c,maxSockets:l,...i})},httpsAgent:a instanceof ht.Agent||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new ht.Agent({keepAlive:c,maxSockets:l,...a}),logger:u}}},wa=new Uint16Array(1),Ue=class{id=wa[0]++;total=0;max=0;session;refs=0;constructor(e){e.unref(),this.session=e}retain(){if(this.session.destroyed)throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");this.refs+=1,this.total+=1,this.max=Math.max(this.refs,this.max),this.session.ref()}free(){if(!this.session.destroyed&&(this.refs-=1,this.refs===0&&this.session.unref(),this.refs<0))throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}deref(){return this.session}close(){this.session.closed||this.session.close()}destroy(){this.refs=0,this.session.destroyed||this.session.destroy()}useCount(){return this.refs}},Er=class{sessions=[];maxConcurrency=0;constructor(e){this.sessions=(e??[]).map(r=>new Ue(r))}poll(){let e=!1;for(let r of this.sessions){if(r.deref().destroyed){e=!0;continue}if(!this.maxConcurrency||r.useCount()<this.maxConcurrency)return r}if(e)for(let r of this.sessions)r.deref().destroyed&&this.remove(r)}offerLast(e){this.sessions.push(e)}remove(e){let r=this.sessions.indexOf(e);r>-1&&this.sessions.splice(r,1)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(e){this.maxConcurrency=e}destroy(e){this.remove(e),e.destroy()}},Tr=class{config;connectOptions;connectionPools=new Map;constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw new RangeError("maxConcurrency must be greater than zero.")}lease(e,r){let n=this.getUrlString(e),o=this.getPool(n);if(!this.config.disableConcurrency&&!r.isEventStream){let u=o.poll();if(u)return u.retain(),u}let s=new Ue(this.connect(n)),i=s.deref();this.config.maxConcurrency&&i.settings({maxConcurrentStreams:this.config.maxConcurrency},u=>{if(u)throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});let a=()=>{this.removeFromPoolAndClose(n,s)},f=()=>{this.removeFromPoolAndCheckedDestroy(n,s)};return i.on("goaway",a),i.on("error",f),i.on("frameError",f),i.on("close",f),r.requestTimeout&&i.setTimeout(r.requestTimeout,f),o.offerLast(s),s.retain(),s}release(e,r){r.free()}createIsolatedSession(e,r){let n=this.getUrlString(e),o=new Ue(this.connect(n)),s=o.deref();s.settings({maxConcurrentStreams:1});let i=()=>{o.destroy()};return s.on("error",i),s.on("frameError",i),s.on("close",i),r.requestTimeout&&s.setTimeout(r.requestTimeout,i),o.retain(),o}destroy(){for(let[e,r]of this.connectionPools){for(let n of[...r])n.destroy();this.connectionPools.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw new RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e;for(let r of this.connectionPools.values())r.setMaxConcurrency(e)}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}setNodeHttp2ConnectOptions(e){this.connectOptions=e}debug(){let e={};for(let[r,n]of this.connectionPools){let o=[];for(let s of n)o.push({id:s.id,active:s.useCount(),maxConcurrent:s.max,totalRequests:s.total});e[r]={sessions:o}}return e}removeFromPoolAndClose(e,r){this.connectionPools.get(e)?.remove(r),r.close()}removeFromPoolAndCheckedDestroy(e,r){this.connectionPools.get(e)?.remove(r),r.destroy()}getPool(e){if(!this.connectionPools.has(e)){let r=new Er;this.config.maxConcurrency&&r.setMaxConcurrency(this.config.maxConcurrency),this.connectionPools.set(e,r)}return this.connectionPools.get(e)}getUrlString(e){return e.destination.toString()}connect(e){return this.connectOptions===void 0?wr.connect(e):wr.connect(e,this.connectOptions)}},{constants:vs}=wr,vr=class t{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new Tr({});static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){this.configProvider=new Promise((r,n)=>{typeof e=="function"?e().then(o=>{r(o||{})}).catch(n):r(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:r,requestTimeout:n,isEventStream:o}={}){if(!this.config){this.config=await this.configProvider;let{disableConcurrentStreams:u,maxConcurrentStreams:c,nodeHttp2ConnectOptions:l}=this.config;this.connectionManager.setDisableConcurrentStreams(u??!1),c&&this.connectionManager.setMaxConcurrentStreams(c),l&&this.connectionManager.setNodeHttp2ConnectOptions(l)}let{requestTimeout:s,disableConcurrentStreams:i}=this.config,a=i||o,f=n??s;return new Promise((u,c)=>{let l=!1,p,h=async E=>{await p,u(E)},d=async E=>{await p,c(E)};if(r?.aborted){l=!0;let E=pt(r);d(E);return}let{hostname:y,method:g,port:x,protocol:b,query:S}=e,D="";if(e.username!=null||e.password!=null){let E=e.username??"",N=e.password??"";D=`${E}:${N}@`}let C=`${b}//${D}${y}${x?`:${x}`:""}`,_={destination:new URL(C)},q={requestTimeout:this.config?.sessionTimeout,isEventStream:o},ee=a?this.connectionManager.createIsolatedSession(_,q):this.connectionManager.lease(_,q),gt=ee.deref(),M=E=>{a&&ee.destroy(),l=!0,d(E)},xe=S?As(S):"",J=e.path;xe&&(J+=`?${xe}`),e.fragment&&(J+=`#${e.fragment}`);let w=gt.request({...e.headers,[vs.HTTP2_HEADER_PATH]:J,[vs.HTTP2_HEADER_METHOD]:g});if(f&&w.setTimeout(f,()=>{w.close();let E=new Error(`Stream timed out because of no activity for ${f} ms`);E.name="TimeoutError",M(E)}),r){let E=()=>{w.close();let N=pt(r);M(N)};if(typeof r.addEventListener=="function"){let N=r;N.addEventListener("abort",E,{once:!0}),w.once("close",()=>N.removeEventListener("abort",E))}else r.onabort=E}w.on("frameError",(E,N,Us)=>{M(new Error(`Frame type id ${E} in stream id ${Us} has failed with code ${N}.`))}),w.on("error",M),w.on("aborted",()=>{M(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${w.rstCode}.`))}),w.on("response",E=>{let N=new Cs({statusCode:E[":status"]??-1,headers:Bs(E),body:w});l=!0,h({response:N}),a&>.close()}),w.on("close",()=>{a?ee.destroy():this.connectionManager.release(_,ee),l||M(new Error("Unexpected error: http2 request did not get a response"))}),p=Ds(w,e,f)})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>({...n,[e]:r}))}httpHandlerConfigs(){return this.config??{}}},Ar=class extends la{bufferedBytes=[];_write(e,r,n){this.bufferedBytes.push(e),n()}},Sa=t=>Ea(t)?Ta(t):new Promise((e,r)=>{let n=new Ar;t.pipe(n),t.on("error",o=>{n.end(),r(o)}),n.on("error",r),n.on("finish",function(){let o=new Uint8Array(Buffer.concat(this.bufferedBytes));e(o)})}),Ea=t=>typeof ReadableStream=="function"&&t instanceof ReadableStream;async function Ta(t){let e=[],r=t.getReader(),n=!1,o=0;for(;!n;){let{done:a,value:f}=await r.read();f&&(e.push(f),o+=f.length),n=a}let s=new Uint8Array(o),i=0;for(let a of e)s.set(a,i),i+=a.length;return s}Pe.DEFAULT_REQUEST_TIMEOUT=xa;Pe.NodeHttp2Handler=vr;Pe.NodeHttpHandler=Sr;Pe.streamCollector=Sa});var Ba={};Re(Ba,{handler:()=>Ca});module.exports=ke(Ba);var Ms=require("node:crypto"),yt=require("@aws-sdk/client-dynamodb"),Os=Ie(_s(),1),va={requestHandler:new Os.NodeHttpHandler({requestTimeout:1e4,connectionTimeout:5e3}),maxAttempts:5},Aa=new yt.DynamoDBClient(va);async function Ca(t,e){let r=e.awsRequestId,n=(0,Ms.randomUUID)().slice(0,8),o=(f,u)=>{console.info(JSON.stringify({requestId:r,batchId:n,msg:f,...u}))},s=(f,u,c)=>{console.error(JSON.stringify({requestId:r,batchId:n,msg:f,error:String(u),...c}))};o("Processing SES batch",{recordCount:t.Records.length});let i=process.env.TABLE_NAME;if(!i)throw new Error("TABLE_NAME environment variable not set");let a=Number.parseInt(process.env.RETENTION_DAYS||"90",10);for(let f of t.Records)try{let c=JSON.parse(f.body).detail,l=c.eventType||c.notificationType,p=c.mail,h=p.messageId,d=new Date(p.timestamp).getTime(),y=p.source,g=p.destination||[],x=p.commonHeaders?.subject||"";o("Processing email event",{messageId:h,eventType:l,recipientCount:g.length});let b={},S=d;if(l==="Send"&&c.send)b={tags:p.tags||{}};else if(l==="Delivery"&&c.delivery)S=new Date(c.delivery.timestamp).getTime(),b={timestamp:c.delivery.timestamp,processingTimeMillis:c.delivery.processingTimeMillis,recipients:c.delivery.recipients,smtpResponse:c.delivery.smtpResponse,remoteMtaIp:c.delivery.remoteMtaIp};else if(l==="Open"&&c.open)S=new Date(c.open.timestamp).getTime(),b={timestamp:c.open.timestamp,userAgent:c.open.userAgent,ipAddress:c.open.ipAddress};else if(l==="Click"&&c.click)S=new Date(c.click.timestamp).getTime(),b={timestamp:c.click.timestamp,link:c.click.link,linkTags:c.click.linkTags||{},userAgent:c.click.userAgent,ipAddress:c.click.ipAddress};else if(l==="Bounce"&&c.bounce){let C=c.bounce.bounceSubType;C==="Suppressed"||C==="OnAccountSuppressionList"?(l="Suppressed",S=new Date(c.bounce.timestamp).getTime(),b={reason:C,suppressedRecipients:c.bounce.bouncedRecipients,timestamp:c.bounce.timestamp,feedbackId:c.bounce.feedbackId}):(S=new Date(c.bounce.timestamp).getTime(),b={bounceType:c.bounce.bounceType,bounceSubType:c.bounce.bounceSubType,bouncedRecipients:c.bounce.bouncedRecipients,timestamp:c.bounce.timestamp,feedbackId:c.bounce.feedbackId})}else l==="Complaint"&&c.complaint?(S=new Date(c.complaint.timestamp).getTime(),b={complainedRecipients:c.complaint.complainedRecipients,timestamp:c.complaint.timestamp,feedbackId:c.complaint.feedbackId,complaintFeedbackType:c.complaint.complaintFeedbackType,userAgent:c.complaint.userAgent}):l==="Reject"&&c.reject?b={reason:c.reject.reason}:l==="Rendering Failure"&&c.failure?b={errorMessage:c.failure.errorMessage,templateName:c.failure.templateName}:l==="DeliveryDelay"&&c.deliveryDelay?(S=new Date(c.deliveryDelay.timestamp).getTime(),b={timestamp:c.deliveryDelay.timestamp,delayType:c.deliveryDelay.delayType,expirationTime:c.deliveryDelay.expirationTime,delayedRecipients:c.deliveryDelay.delayedRecipients}):l==="Subscription"&&c.subscription&&(S=new Date(c.subscription.timestamp).getTime(),b={contactList:c.subscription.contactList,timestamp:c.subscription.timestamp,source:c.subscription.source,newTopicPreferences:c.subscription.newTopicPreferences,oldTopicPreferences:c.subscription.oldTopicPreferences});let D=a>0?Date.now()+a*24*60*60*1e3:Date.now()+365*24*60*60*1e3;await Aa.send(new yt.PutItemCommand({TableName:i,Item:{messageId:{S:h},sentAt:{N:S.toString()},mailSentAt:{N:d.toString()},accountId:{S:process.env.AWS_ACCOUNT_ID||"unknown"},from:{S:y},to:{L:g.map(C=>({S:C}))},subject:{S:x},eventType:{S:l},eventData:{S:JSON.stringify(c)},additionalData:{S:JSON.stringify(b)},createdAt:{N:Date.now().toString()},expiresAt:{N:D.toString()}}})),o("Stored event",{eventType:l,messageId:h})}catch(u){s("Error processing record",u,{sqsMessageId:f.messageId})}return{statusCode:200,body:JSON.stringify({message:"Events processed successfully"})}}0&&(module.exports={handler});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Built at: 2026-
|
|
1
|
+
Built at: 2026-07-07T21:36:58.461Z
|