@subnoto/api-client 2.3.8 → 2.3.10

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/index.cjs ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";var et=Object.create;var U=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty;var ct=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ie=(e,t)=>{for(var i in t)U(e,i,{get:t[i],enumerable:!0})},pe=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of it(t))!st.call(e,s)&&s!==i&&U(e,s,{get:()=>t[s],enumerable:!(r=tt(t,s))||r.enumerable});return e};var q=(e,t,i)=>(i=e!=null?et(rt(e)):{},pe(t||!e||!e.__esModule?U(i,"default",{value:e,enumerable:!0}):i,e)),nt=e=>pe(U({},"__esModule",{value:!0}),e);var Ue=ct((xi,We)=>{"use strict";var Xt=require("path");We.exports=Xt.join(__dirname,"oak_session_wasm_nodejs_bg.wasm")});var y1={};ie(y1,{SubnotoClient:()=>te,SubnotoError:()=>m});module.exports=nt(y1);var Ze=q(require("openapi-fetch"));var X={};ie(X,{generateDigestHeaders:()=>ke,generateSignatureHeader:()=>Fe});var he=typeof Uint8Array=="function",b,V=class e{static decode(t){let i=typeof t=="string",r;if(b===void 0){let a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=`= \f
2
+ \r \xA0\u2028\u2029`;for(b=[],r=0;r<64;++r)b[a.charCodeAt(r)]=r;for(r=0;r<u.length;++r)b[u.charCodeAt(r)]=-1;b[45]=b[43],b[95]=b[47]}let s=he?new Uint8Array(t.length*3>>2):[],o=0,d=0,c=0;for(r=0;r<t.length;++r){let a=i?t.charCodeAt(r):t[r];if(a==61)break;if(a=b[a],a!=-1){if(a===void 0)throw"Illegal character at offset "+r;o|=a,++d>=4?(s[c++]=o>>16,s[c++]=o>>8&255,s[c++]=o&255,o=0,d=0):o<<=6}}switch(d){case 1:throw"Base64 encoding incomplete: at least 2 bits missing";case 2:s[c++]=o>>10;break;case 3:s[c++]=o>>16,s[c++]=o>>8&255;break}return he&&s.length>c&&(s=s.subarray(0,c)),s}static pretty(t){let i=4-t.length%4;return i<4&&(t+="===".slice(0,i)),t=t.replace(/-/g,"+").replace(/_/g,"/"),t.replace(/.{80}/g,`$&
3
+ `)}static unarmor(t){let i=e.re.exec(t);if(i)if(i[1])t=i[1];else if(i[2])t=i[2];else if(i[3])t=i[3];else throw"RegExp out of sync";return e.decode(t)}};V.re=/-----BEGIN [^-]+-----([A-Za-z0-9+/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+/=\s]+)====|^([A-Za-z0-9+/=\s]+)$/;var Se={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bits:6};var T={parse:function(t,i){return ot(t,Se,i)},stringify:function(t,i){return at(t,Se,i)}};function ot(e,t,i){var r;if(i===void 0&&(i={}),!t.codes){t.codes={};for(var s=0;s<t.chars.length;++s)t.codes[t.chars[s]]=s}if(!i.loose&&e.length*t.bits&7)throw new SyntaxError("Invalid padding");for(var o=e.length;e[o-1]==="=";)if(--o,!i.loose&&!((e.length-o)*t.bits&7))throw new SyntaxError("Invalid padding");for(var d=new((r=i.out)!=null?r:Uint8Array)(o*t.bits/8|0),c=0,a=0,u=0,S=0;S<o;++S){var n=t.codes[e[S]];if(n===void 0)throw new SyntaxError("Invalid character "+e[S]);a=a<<t.bits|n,c+=t.bits,c>=8&&(c-=8,d[u++]=255&a>>c)}if(c>=t.bits||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return d}function at(e,t,i){i===void 0&&(i={});for(var r=i,s=r.pad,o=s===void 0?!0:s,d=(1<<t.bits)-1,c="",a=0,u=0,S=0;S<e.length;++S)for(u=u<<8|255&e[S],a+=8;a>t.bits;)a-=t.bits,c+=t.chars[d&u>>a];if(a&&(c+=t.chars[d&u<<t.bits-a]),o)for(;c.length*t.bits&7;)c+="=";return c}var dt=Object.create,Ie=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,Ae=Object.getOwnPropertyNames,ut=Object.getPrototypeOf,pt=Object.prototype.hasOwnProperty,K=(e,t)=>function(){return t||(0,e[Ae(e)[0]])((t={exports:{}}).exports,t),t.exports},ht=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ae(t))!pt.call(e,s)&&s!==i&&Ie(e,s,{get:()=>t[s],enumerable:!(r=lt(t,s))||r.enumerable});return e},z=(e,t,i)=>(i=e!=null?dt(ut(e)):{},ht(t||!e||!e.__esModule?Ie(i,"default",{value:e,enumerable:!0}):i,e)),se=K({"node_modules/.pnpm/structured-headers@1.0.1/node_modules/structured-headers/dist/types.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ByteSequence=void 0;var t=class{constructor(i){this.base64Value=i}toBase64(){return this.base64Value}};e.ByteSequence=t}}),j=K({"node_modules/.pnpm/structured-headers@1.0.1/node_modules/structured-headers/dist/util.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isByteSequence=e.isInnerList=e.isValidKeyStr=e.isValidTokenStr=e.isAscii=void 0;var t=/^[\x20-\x7E]*$/,i=/^[a-zA-Z*][:/!#$%&'*+\-.^_`|~A-Za-z0-9]*$/,r=/^[a-z*][*\-_.a-z0-9]*$/;function s(u){return t.test(u)}e.isAscii=s;function o(u){return i.test(u)}e.isValidTokenStr=o;function d(u){return r.test(u)}e.isValidKeyStr=d;function c(u){return Array.isArray(u[0])}e.isInnerList=c;function a(u){return typeof u=="object"&&"base64Value"in u}e.isByteSequence=a}}),ce=K({"node_modules/.pnpm/structured-headers@1.0.1/node_modules/structured-headers/dist/token.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Token=void 0;var t=j(),i=class{constructor(r){if(!(0,t.isValidTokenStr)(r))throw new TypeError("Invalid character in Token string. Tokens must start with *, A-Z and the rest of the string may only contain a-z, A-Z, 0-9, :/!#$%&'*+-.^_`|~");this.value=r}toString(){return this.value}};e.Token=i}}),St=K({"node_modules/.pnpm/structured-headers@1.0.1/node_modules/structured-headers/dist/serializer.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.serializeKey=e.serializeParameters=e.serializeToken=e.serializeByteSequence=e.serializeBoolean=e.serializeString=e.serializeDecimal=e.serializeInteger=e.serializeBareItem=e.serializeInnerList=e.serializeItem=e.serializeDictionary=e.serializeList=e.SerializeError=void 0;var t=se(),i=ce(),r=j(),s=class extends Error{};e.SerializeError=s;function o(l){return l.map(C=>(0,r.isInnerList)(C)?a(C):c(C)).join(", ")}e.serializeList=o;function d(l){return Array.from(l.entries()).map(([C,A])=>{let E=N(C);return A[0]===!0?E+=I(A[1]):(E+="=",(0,r.isInnerList)(A)?E+=a(A):E+=c(A)),E}).join(", ")}e.serializeDictionary=d;function c(l){return u(l[0])+I(l[1])}e.serializeItem=c;function a(l){return`(${l[0].map(C=>c(C)).join(" ")})${I(l[1])}`}e.serializeInnerList=a;function u(l){if(typeof l=="number")return Number.isInteger(l)?S(l):n(l);if(typeof l=="string")return p(l);if(l instanceof i.Token)return W(l);if(l instanceof t.ByteSequence)return y(l);if(typeof l=="boolean")return f(l);throw new s(`Cannot serialize values of type ${typeof l}`)}e.serializeBareItem=u;function S(l){if(l<-999999999999999||l>999999999999999)throw new s("Structured headers can only encode integers in the range range of -999,999,999,999,999 to 999,999,999,999,999 inclusive");return l.toString()}e.serializeInteger=S;function n(l){let C=l.toFixed(3).replace(/0+$/,"");if(C.split(".")[0].replace("-","").length>12)throw new s("Fractional numbers are not allowed to have more than 12 significant digits before the decimal point");return C}e.serializeDecimal=n;function p(l){if(!(0,r.isAscii)(l))throw new s("Only ASCII strings may be serialized");return`"${l.replace(/("|\\)/g,C=>"\\"+C)}"`}e.serializeString=p;function f(l){return l?"?1":"?0"}e.serializeBoolean=f;function y(l){return`:${l.toBase64()}:`}e.serializeByteSequence=y;function W(l){return l.toString()}e.serializeToken=W;function I(l){return Array.from(l).map(([C,A])=>{let E=";"+N(C);return A!==!0&&(E+="="+u(A)),E}).join("")}e.serializeParameters=I;function N(l){if(!(0,r.isValidKeyStr)(l))throw new s("Keys in dictionaries must only contain lowercase letter, numbers, _-*. and must start with a letter or *");return l}e.serializeKey=N}}),ft=K({"node_modules/.pnpm/structured-headers@1.0.1/node_modules/structured-headers/dist/parser.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ParseError=e.parseItem=e.parseList=e.parseDictionary=void 0;var t=se(),i=ce(),r=j();function s(n){return new a(n).parseDictionary()}e.parseDictionary=s;function o(n){return new a(n).parseList()}e.parseList=o;function d(n){return new a(n).parseItem()}e.parseItem=d;var c=class extends Error{constructor(n,p){super(`Parse error: ${p} at offset ${n}`)}};e.ParseError=c;var a=class{constructor(n){this.input=n,this.pos=0}parseDictionary(){this.skipWS();let n=new Map;for(;!this.eof();){let p=this.parseKey(),f;if(this.lookChar()==="="?(this.pos++,f=this.parseItemOrInnerList()):f=[!0,this.parseParameters()],n.set(p,f),this.skipOWS(),this.eof())return n;if(this.expectChar(","),this.pos++,this.skipOWS(),this.eof())throw new c(this.pos,"Dictionary contained a trailing comma")}return n}parseList(){this.skipWS();let n=[];for(;!this.eof();){if(n.push(this.parseItemOrInnerList()),this.skipOWS(),this.eof())return n;if(this.expectChar(","),this.pos++,this.skipOWS(),this.eof())throw new c(this.pos,"A list may not end with a trailing comma")}return n}parseItem(n=!0){n&&this.skipWS();let p=[this.parseBareItem(),this.parseParameters()];return n&&this.checkTrail(),p}parseItemOrInnerList(){return this.lookChar()==="("?this.parseInnerList():this.parseItem(!1)}parseInnerList(){this.expectChar("("),this.pos++;let n=[];for(;!this.eof();){if(this.skipWS(),this.lookChar()===")")return this.pos++,[n,this.parseParameters()];n.push(this.parseItem(!1));let p=this.lookChar();if(p!==" "&&p!==")")throw new c(this.pos,"Expected a whitespace or ) after every item in an inner list")}throw new c(this.pos,"Could not find end of inner list")}parseBareItem(){let n=this.lookChar();if(n===void 0)throw new c(this.pos,"Unexpected end of string");if(n.match(/^[-0-9]/))return this.parseIntegerOrDecimal();if(n==='"')return this.parseString();if(n.match(/^[A-Za-z*]/))return this.parseToken();if(n===":")return this.parseByteSequence();if(n==="?")return this.parseBoolean();throw new c(this.pos,"Unexpected input")}parseParameters(){let n=new Map;for(;!this.eof()&&this.lookChar()===";";){this.pos++,this.skipWS();let f=this.parseKey(),y=!0;this.lookChar()==="="&&(this.pos++,y=this.parseBareItem()),n.set(f,y)}return n}parseIntegerOrDecimal(){let n="integer",p=1,f="";if(this.lookChar()==="-"&&(p=-1,this.pos++),!S(this.lookChar()))throw new c(this.pos,"Expected a digit (0-9)");for(;!this.eof();){let y=this.getChar();if(S(y))f+=y;else if(n==="integer"&&y==="."){if(f.length>12)throw new c(this.pos,"Exceeded maximum decimal length");f+=".",n="decimal"}else{this.pos--;break}if(n==="integer"&&f.length>15)throw new c(this.pos,"Exceeded maximum integer length");if(n==="decimal"&&f.length>16)throw new c(this.pos,"Exceeded maximum decimal length")}if(n==="integer")return parseInt(f,10)*p;if(f.endsWith("."))throw new c(this.pos,"Decimal cannot end on a period");if(f.split(".")[1].length>3)throw new c(this.pos,"Number of digits after the decimal point cannot exceed 3");return parseFloat(f)*p}parseString(){let n="";for(this.expectChar('"'),this.pos++;!this.eof();){let p=this.getChar();if(p==="\\"){if(this.eof())throw new c(this.pos,"Unexpected end of input");let f=this.getChar();if(f!=="\\"&&f!=='"')throw new c(this.pos,"A backslash must be followed by another backslash or double quote");n+=f}else{if(p==='"')return n;if((0,r.isAscii)(p))n+=p;else throw new c(this.pos,"Strings must be in the ASCII range")}}throw new c(this.pos,"Unexpected end of input")}parseToken(){let n="";for(;!this.eof();){let p=this.lookChar();if(p===void 0||!/^[:/!#$%&'*+\-.^_`|~A-Za-z0-9]$/.test(p))return new i.Token(n);n+=this.getChar()}return new i.Token(n)}parseByteSequence(){this.expectChar(":"),this.pos++;let n=this.input.indexOf(":",this.pos);if(n===-1)throw new c(this.pos,'Could not find a closing ":" character to mark end of Byte Sequence');let p=this.input.substring(this.pos,n);if(this.pos+=p.length+1,!/^[A-Za-z0-9+/=]*$/.test(p))throw new c(this.pos,"ByteSequence does not contain a valid base64 string");return new t.ByteSequence(p)}parseBoolean(){this.expectChar("?"),this.pos++;let n=this.getChar();if(n==="1")return!0;if(n==="0")return!1;throw new c(this.pos,'Unexpected character. Expected a "1" or a "0"')}parseKey(){var n;if(!(!((n=this.lookChar())===null||n===void 0)&&n.match(/^[a-z*]/)))throw new c(this.pos,"A key must begin with an asterisk or letter (a-z)");let p="";for(;!this.eof();){let f=this.lookChar();if(f===void 0||!/^[a-z0-9_\-.*]$/.test(f))return p;p+=this.getChar()}return p}lookChar(){return this.input[this.pos]}expectChar(n){if(this.lookChar()!==n)throw new c(this.pos,`Expected ${n}`)}getChar(){return this.input[this.pos++]}eof(){return this.pos>=this.input.length}skipOWS(){for(;;){let n=this.input.substr(this.pos,1);if(n===" "||n===" ")this.pos++;else break}}skipWS(){for(;this.lookChar()===" ";)this.pos++}checkTrail(){if(this.skipWS(),!this.eof())throw new c(this.pos,"Unexpected characters at end of input")}};e.default=a;var u=/^[0-9]$/;function S(n){return n===void 0?!1:u.test(n)}}}),$=K({"node_modules/.pnpm/structured-headers@1.0.1/node_modules/structured-headers/dist/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(s,o,d,c){c===void 0&&(c=d);var a=Object.getOwnPropertyDescriptor(o,d);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[d]}}),Object.defineProperty(s,c,a)}:function(s,o,d,c){c===void 0&&(c=d),s[c]=o[d]}),i=e&&e.__exportStar||function(s,o){for(var d in s)d!=="default"&&!Object.prototype.hasOwnProperty.call(o,d)&&t(o,s,d)};Object.defineProperty(e,"__esModule",{value:!0}),e.Token=void 0,i(St(),e),i(ft(),e),i(se(),e),i(j(),e);var r=ce();Object.defineProperty(e,"Token",{enumerable:!0,get:function(){return r.Token}})}});var B1=Uint8Array.from([48,13,6,9,42,134,72,134,247,13,1,1,1,5,0]);var be=new TextEncoder;async function mt(){return globalThis.crypto??(await import("node:crypto")).webcrypto}var gt=/[^\S\r\n]*\r?\n[^\S\r\n]+/g;function fe(e){return e.replaceAll(gt," ")}function k(e){if(typeof e=="number")return e.toString();if(!e)return"";if(typeof e=="string")return fe(e).trim();if(Array.isArray(e))return e.map(t=>{if(t==null)return"";if(typeof t=="number")return t.toString();if(typeof t=="string")return fe(t).trim();throw new Error(`Invalid header value type ${t}`)}).join(", ");throw new Error(`Invalid header value type ${e}`)}function L(e){return Object.entries(e).reduce((t,[i,r])=>(i==="__proto__"||(t[i.toLowerCase()]=r),t),{})}function me(e,t){t=t.toLowerCase();for(let[i,r]of Object.entries(e))if(i.toLowerCase()===t)return r}function Ct(e){return typeof e=="number"?e.toString():typeof e=="string"?e.toLowerCase():""}function re(e){return e.reduce((t,i,r)=>{if(r%2===0){if(typeof i!="string")throw new Error(`Invalid header key type '${typeof i}' of ${i}`);if(i.toLowerCase()in t)return t;t[i.toLowerCase()]=[]}else t[Ct(e[r-1])].push(i==null?"":i.toString());return t},{})}function _(e){if("rawHeaders"in e&&e.rawHeaders)return re(e.rawHeaders.flat(1));if("getHeaders"in e&&typeof e.getHeaders=="function")return L(e.getHeaders());if("headers"in e&&e.headers){if(typeof e.headers!="object")throw new Error("headers must be an object");return Te(e.headers)?re(Array.from(e.headers.entries()).flat(1)):Array.isArray(e.headers)?re(e.headers.flat(1)):L(e.headers)}throw new Error("Cannot get headers from request object")}function Ee(e,t,i){if("setHeader"in e&&typeof e.setHeader=="function")e.setHeader(t,i.toString());else if("headers"in e&&typeof e.headers=="object")Te(e.headers)?e.headers.set(t,i.toString()):e.headers[t]=i.toString();else throw new Error("Cannot set headers to request object")}function ge(e){return"Response"in globalThis&&typeof e=="object"&&e instanceof Response}function yt(e){return"Request"in globalThis&&typeof e=="object"&&e instanceof Request}function Te(e){return"Headers"in globalThis&&typeof e=="object"&&e instanceof Headers}function Pe(e){let t=new Uint8Array(e);return T.stringify(t)}var It={hash:"SHA-256",ec:"DSA"};function At(e,t){return{hash:t,...e}}function ne(e){return e instanceof Map?new Map(e):Array.isArray(e)?new Map(e):new Map(Object.entries(e))}function Ce(e){let t=ne(e);for(let[i,r]of t.entries())r===void 0&&t.delete(i);return t}var g=z($(),1),bt={signature:"dict","signature-input":"dict","accept-signature":"dict","content-digest":"dict","repr-digest":"dict","want-content-digest":"dict","want-repr-digest":"dict","accept-ch":"list","proxy-status":"list","cache-status":"list",priority:"dict","client-cert":"bs","client-cert-chain":"list"},Et=["@method","@authority","@scheme","@target-uri","@request-target","@path","@query"],Tt=["@status"],we=class{isRequest(){return this.response===null}isResponse(){return this.response!==null}constructor(e,t="https",i={},r,s=null){if(s&&!Array.isArray(s))throw new Error("requiredComponents must be an array");if(s&&s.length>0?this.requiredComponents=s.map(c=>{let a;return c.startsWith('"')?a=g.parseItem(c):a=[c,new Map],g.serializeItem(a)}):this.requiredComponents=null,this.sfvTypeDictionary=L({...bt,...i}),"req"in e)this.response=e,this.responseHeaders=_(e),this.request=e.req,this.requestHeaders=_(this.request);else if(ge(e)){if(!r)throw new Error("Request is not provided");this.response=e,this.responseHeaders=_(e),this.request=r,this.requestHeaders=_(this.request)}else this.response=null,this.responseHeaders=null,this.request=e,this.requestHeaders=_(e);if(!this.request.url)throw new Error("Request URL is empty");if(!this.request.method)throw new Error("Request method is empty");if(!("signature-input"in this.requestHeaders))throw new Error("Signature-Input header is not found in request");if(this.requestSignatureInput=g.parseDictionary(k(this.requestHeaders["signature-input"])),this.isResponse()){if(!this.responseHeaders)throw new Error("responseHeaders is empty");if(!("signature-input"in this.responseHeaders))throw new Error("Signature-Input header is not found in response");this.responseSignatureInput=g.parseDictionary(k(this.responseHeaders["signature-input"]))}this.sfvTypeDictionary=L(i),this.scheme=this.request.url.startsWith("/")?t:new URL(this.request.url).protocol.replace(":","");let o="httpVersionMajor"in this.request&&this.request.httpVersionMajor===2?this.requestHeaders[":authority"]:this.requestHeaders.host;if(!yt(this.request)&&!o)throw new Error("Host header is empty");let d=k(o);this.targetUri=this.request.url.startsWith("/")?new URL(this.request.url,`${t}://${d}`).href:this.request.url,this.url=new URL(this.targetUri)}get(e,t=new Map){let i=ne(t),r=g.serializeItem([e,i]);if(!e)throw new Error(`Type is empty: ${r}`);if(e.startsWith('"'))if(e.endsWith('"'))e=e.slice(1,-1);else throw new Error(`Invalid component type string: ${r}`);if(this.isResponse()&&i.get("req")!==!0&&Et.includes(e))throw new Error(`component is not available in response (must use with ;req, or provided object is unintentionally treated as response (existing req prop.)): ${e}`);if(this.isRequest()&&Tt.includes(e))throw new Error(`component is not available in request (provided object is unintentionally treated as request (including req prop.)): ${e}`);if(this.isRequest()&&i.get("req")===!0)throw new Error("req param is not available in request (provided object is treated as request, please set req param with Request)");let s=this.isRequest()||i.get("req")===!0;if(e==="@signature-params")throw new Error(`@signature-params is not available in get method: ${r}`);if(e==="@method"){if(!this.request.method)throw new Error("Request method is empty");return this.request.method.toUpperCase()}else{if(e==="@authority")return this.url.host;if(e==="@scheme")return this.scheme.toLocaleLowerCase();if(e==="@target-uri")return this.targetUri;if(e==="@request-target"){if(!this.request.method)throw new Error("Request method is empty");return`${this.request.method.toLowerCase()} ${this.url.pathname}`}else{if(e==="@path")return this.url.pathname;if(e==="@query")return this.url.search;if(e==="@query-param"){let o=i.get("name");if(o===void 0)throw new Error("Query parameter name not found or invalid");let d=this.url.searchParams.get(o.toString());if(d===null)throw new Error(`Query parameter not found: ${o} (${r})`);return d}else if(e==="@status"){if(!this.response)throw new Error("response is empty (@status)");return ge(this.response)?this.response.status.toString():this.response.statusCode.toString()}else{if(e.startsWith("@"))throw new Error(`Unknown derived component: ${e}`);{let o=i.get("key"),d=i.get("sf")===!0,c=i.get("bs")===!0,a=i.get("tr")===!0;if([o,d,c].filter(S=>S).length>1)throw new Error(`Invalid component: ${r} (multiple params are specified)`);let u=(()=>{if(s)if(a){if("trailers"in this.request&&this.request.trailers)return me(this.request.trailers,e);throw new Error(`Trailers not found in request object (${r})`)}else return this.requestHeaders[e];else{if(!this.response||!this.responseHeaders)throw new Error("response is not provided");if(a){if("trailers"in this.response&&this.response.trailers)return me(this.response.trailers,e);throw new Error(`Trailers not found in response object (${r})`)}else return this.responseHeaders[e]}})();if(u===void 0)throw new Error(`Header not found: ${r}`);if(d){if(!(e in this.sfvTypeDictionary))throw new Error(`Type not found in SFV type dictionary: ${e}`);let S=k(u);if(this.sfvTypeDictionary[e]==="dict")return g.serializeDictionary(g.parseDictionary(S));if(this.sfvTypeDictionary[e]==="list")return g.serializeList(g.parseList(S));if(["item","bs","int","dec","str","bool","token"].includes(this.sfvTypeDictionary[e]))return g.serializeItem(g.parseItem(S))}if(o){if(!(e in this.sfvTypeDictionary))throw new Error(`key specified but type unknown (Type not found in SFV type dictionary): ${r}`);if(typeof u!="string")throw new Error(`Key specified but value is not a string: ${r}`);if(this.sfvTypeDictionary[e]==="dict"){let n=g.parseDictionary(u).get(o);if(n===void 0)throw new Error(`Key not found in dictionary: ${o} (${r})`);return Array.isArray(n[0])?g.serializeList([n]):g.serializeItem(n)}else throw new Error(`"${e}" is not dict: ${this.sfvTypeDictionary[e]} (${r})`)}if(c){let S=(Array.isArray(u)?u:[u]).map(n=>{if(typeof n!="string")throw new Error(`Invalid header value type: ${typeof n}`);return[new g.ByteSequence(Pe(be.encode(k(n)).buffer)),new Map]});return g.serializeList(S)}return k(u)}}}}}generate(e){let t=this.isRequest()?this.requestSignatureInput?.get(e):this.responseSignatureInput?.get(e);if(!t)throw new Error(`label not found: ${e}`);if(!Array.isArray(t[0]))throw new Error(`item is not InnerList: ${g.serializeDictionary(new Map([[e,t]]))}`);let i=new Map;for(let r of t[0]){let s=r[0];if(s.startsWith('"'))if(s.endsWith('"'))s=s.slice(1,-1);else throw new Error(`Invalid component identifier name: ${s}`);r[0]=s;let o=g.serializeItem(r);if(i.has(o))throw new Error(`Duplicate key: ${s}`);i.set(o,this.get(s,r[1]))}if(this.requiredComponents){for(let r of this.requiredComponents)if(!i.has(r))throw new Error(`Required component not found: ${r}`)}return i.set('"@signature-params"',g.serializeInnerList(t)),Array.from(i.entries(),([r,s])=>`${r}: ${s}`).join(`
4
+ `)}};function De(e){let t=ne(e),i=new Map;for(let[r,s]of t){if(!Array.isArray(s))throw new Error("item is not array");let[o,d]=s;i.set(r,[o.map(c=>typeof c=="string"?[c,new Map]:[c[0],Ce(c[1])]),Ce(d)])}return g.serializeDictionary(i)}var H1=z($(),1);async function Me(e,t,i=It){let r=await(await mt()).subtle.sign(At(e.algorithm,i.hash),e,be.encode(t));return Pe(r)}var W1=z($(),1);function ve(e){let t=e.toUpperCase();if(t==="SHA-256")return"sha-256";if(t==="SHA-512")return"sha-512";throw new Error(`Unsupported hash algorithm: ${e}`)}var V1=z($(),1);async function Q(){return globalThis.crypto??(await import("node:crypto")).webcrypto}var Ne=e=>{let t=new Uint8Array(e);return T.stringify(t)};var Pt=async(e,t="SHA-256")=>(t==="SHA"&&(t="SHA-1"),typeof e=="string"&&(e=new TextEncoder().encode(e)),(await Q()).subtle.digest(t,e)),ke=async e=>{let t="SHA-256",i=await Pt(e.body,t).then(Ne),r=`${t}=${i}`,s=`${ve(t)}=:${i}:`;return{digest:r,contentDigest:s}};var wt=/^[\x20-\x7E]*$/,Dt=/^[a-zA-Z*][:/!#$%&'*+\-.^_`|~A-Za-z0-9]*$/,Mt=/^[a-z*][*\-_.a-z0-9]*$/;function oe(e){return wt.test(e)}function Ke(e){return Dt.test(e)}function Re(e){return Mt.test(e)}function Oe(e){return Array.isArray(e[0])}function xe(e){let t=new Uint8Array(e),i="";for(let r of t)i+=String.fromCharCode(r);return btoa(i)}function ae(e){let t=atob(e),i=t.length,r=new Uint8Array(i);for(let s=0;s<i;s++)r[s]=t.charCodeAt(s);return r.buffer}var R=class{constructor(t){if(!Ke(t))throw new TypeError("Invalid character in Token string. Tokens must start with *, A-Z and the rest of the string may only contain a-z, A-Z, 0-9, :/!#$%&'*+-.^_`|~");this.value=t}toString(){return this.value}};var O=class{constructor(t){this.value=t}toString(){return this.value}};var w=class extends Error{};function Be(e){let t=e instanceof Map?e.entries():Object.entries(e);return Array.from(t).map(([i,r])=>{let s=Xe(i);return Array.isArray(r)?r[0]===!0?s+J(r[1]):Oe(r)?s+"="+vt(r):s+"="+_e(r):r===!0?s:s+"="+Z(r)}).join(", ")}function _e(e,t){return Array.isArray(e)?Z(e[0])+J(e[1]):Z(e)+(t?J(t):"")}function vt(e){return`(${e[0].map(t=>_e(t)).join(" ")})${J(e[1])}`}function Z(e){if(typeof e=="number")return Number.isInteger(e)?Nt(e):kt(e);if(typeof e=="string")return Kt(e);if(e instanceof R)return Bt(e);if(e instanceof ArrayBuffer)return xt(e);if(e instanceof O)return Rt(e);if(e instanceof Date)return _t(e);if(typeof e=="boolean")return Ot(e);throw new w(`Cannot serialize values of type ${typeof e}`)}function Nt(e){if(e<-999999999999999||e>999999999999999)throw new w("Structured headers can only encode integers in the range range of -999,999,999,999,999 to 999,999,999,999,999 inclusive");return e.toString()}function kt(e){let t=e.toFixed(3).replace(/0+$/,"");if(t.split(".")[0].replace("-","").length>12)throw new w("Fractional numbers are not allowed to have more than 12 significant digits before the decimal point");return t}function Kt(e){if(!oe(e))throw new w("Only ASCII strings may be serialized");return`"${e.replace(/("|\\)/g,t=>"\\"+t)}"`}function Rt(e){let t='%"',i=new TextEncoder;for(let r of i.encode(e.toString()))r===37||r===34||r<=31||r>=127?t+="%"+r.toString(16):t+=String.fromCharCode(r);return t+'"'}function Ot(e){return e?"?1":"?0"}function xt(e){return`:${xe(e)}:`}function Bt(e){return e.toString()}function _t(e){return"@"+Math.floor(e.getTime()/1e3)}function J(e){return Array.from(e).map(([t,i])=>{let r=";"+Xe(t);return i!==!0&&(r+="="+Z(i)),r}).join("")}function Xe(e){if(!Re(e))throw new w("Keys in dictionaries must only contain lowercase letter, numbers, _-*. and must start with a letter or *");return e}var Fe=async e=>{let{request:t,authenticationType:i,accessKey:r,secretKey:s,creationDate:o}=e,d={key_ops:["sign","verify"],ext:!0,kty:"oct",k:s,alg:"HS256"},c=await(await Q()).subtle.importKey("jwk",d,{name:"HMAC",hash:"SHA-256"},!0,["sign","verify"]),a=new Map,u=new Map;a.set(i,c),u.set(i,[["x-timestamp","@authority","content-type","content-digest","content-length"],{keyid:r,created:o,alg:"hmac-sha256"}]);let S=De(u);Ee(t,"Signature-Input",S);let n=new we(t),p=(n.isRequest()?n.requestSignatureInput:n.responseSignatureInput)?.keys();if(!p)throw new Error("signaturesEntries is undefined");let f=new Map,y=new Map;for(let I of p){let N=n.generate(I),l=a.get(I);if(!l)throw new Error(`key not found: ${I}`);y.set(I,N),f.set(I,[ae(await Me(l,N,{hash:"SHA-256",ec:"DSA"})),new Map])}let W=Be(f);return{signatureInputHeader:S,signatureHeader:W}};function He(e){return{async onRequest({request:t}){let i=t.clone(),r=i.url,s=await i.arrayBuffer()??JSON.stringify({}),o=i.method??"POST",d=await X.generateDigestHeaders({body:s}),c={headers:{"X-Timestamp":Date.now().toString(),Host:new URL(r).host,"Content-Type":i.headers.get("Content-Type")??"application/json","Content-Length":i.headers.get("Content-Length")??s.byteLength.toString(),Digest:d.digest,"Content-Digest":d.contentDigest},body:s.toString(),method:o,url:r},{signatureHeader:a,signatureInputHeader:u}=await X.generateSignatureHeader({request:c,authenticationType:"team",accessKey:e.accessKey,secretKey:Buffer.from(e.secretKey,"hex").toString("base64"),creationDate:Math.floor(Date.now()/1e3)});return t.headers.set("Signature",a),t.headers.set("Signature-Input",u),t.headers.set("X-Timestamp",c.headers["X-Timestamp"]),t.headers.set("Content-Type",c.headers["Content-Type"]),t.headers.set("Digest",c.headers.Digest),t.headers.set("Content-Digest",c.headers["Content-Digest"]),t}}}var m=class extends Error{statusCode;code;constructor(t,i,r){super(t),this.statusCode=i,this.code=r,this.name="SubnotoError"}};function Ge(e){return{async onRequest({request:t}){if(!t.url.includes("/tunnel/")&&!t.url.includes("/public/")||t.url.includes("/tunnel/session"))return t;try{await e.ensureSession();let i=t.clone(),r=Buffer.from(await i.arrayBuffer());if(!r||r.byteLength===0)throw new m("EMPTY_REQUEST_BODY");let s=e.encryptRequest(r);if(!s||s.byteLength===0)throw new m("Empty encrypted message");let o=e.getSessionId();if(!o)throw new m("Session ID not available");let d=new Headers(i.headers);d.set("X-Session-Id",o);let c=i.headers.get("Content-Type");c&&c.includes("multipart/form-data")&&d.set("X-Original-Content-Type",c),d.set("Content-Type","application/octet-stream"),d.set("Content-Length",s.byteLength.toString());let a=await e.getCookies(i.url);return a&&d.set("Cookie",a),new Request(i.url,{method:i.method,headers:d,body:s,mode:i.mode,credentials:i.credentials,cache:i.cache,redirect:i.redirect,referrer:i.referrer,referrerPolicy:i.referrerPolicy,integrity:i.integrity,keepalive:i.keepalive})}catch(i){throw console.error(`Error in tunnel middleware for ${t.url}:`,i),i}},async onResponse({response:t,request:i}){if(!i.url.includes("/tunnel/")&&!i.url.includes("/public/")||i.url.includes("/tunnel/session"))return t;try{if(!(t.headers.get("x-subnoto-encrypted-response")?.includes("true")&&t.headers.get("content-type")?.includes("application/octet-stream")))return t;let s=t.clone(),o=Buffer.from(await s.arrayBuffer());if(o.byteLength===0)throw new m("Empty encrypted response");let d=e.decryptResponse(o),c=new Headers(t.headers);return c.get("x-subnoto-content-type-response")?.includes("application/octet-stream")?(c.set("Content-Type","application/octet-stream"),c.delete("x-subnoto-encrypted-response"),new Response(d,{status:t.status,statusText:t.statusText,headers:c})):(c.set("Content-Type","application/json"),c.delete("x-subnoto-encrypted-response"),c.delete("x-subnoto-content-type-response"),new Response(d,{status:t.status,statusText:t.statusText,headers:c}))}catch(r){throw console.error(`Error decrypting response for ${i.url}:`,r),r}}}}var Le=q(Ue());var le={};ie(le,{PutIncomingMessageResult:()=>Wt,WasmClientSession:()=>v,__wbg___wbindgen_is_function_ee8a6c5833c90377:()=>Ut,__wbg___wbindgen_is_object_c818261d21f283a4:()=>qt,__wbg___wbindgen_is_string_fbb76cb2940daafd:()=>Vt,__wbg___wbindgen_is_undefined_2d472862bd29a478:()=>Lt,__wbg___wbindgen_throw_b855445ff6a94295:()=>zt,__wbg_call_525440f72fbfc0ea:()=>jt,__wbg_call_e762c39fa8ea36bf:()=>$t,__wbg_crypto_574e78ad8b13b65f:()=>Qt,__wbg_getRandomValues_b8f5dbd5f3995a9e:()=>Zt,__wbg_length_69bca3cb64fc8748:()=>Jt,__wbg_msCrypto_a61aeb35a24c1329:()=>Yt,__wbg_new_no_args_ee98eee5275000a4:()=>e1,__wbg_new_with_length_01aa0dc35aa13543:()=>t1,__wbg_node_905d3e251edff8a2:()=>i1,__wbg_now_793306c526e2e3b6:()=>r1,__wbg_process_dc0fbacc7c1c06f7:()=>s1,__wbg_prototypesetcall_2a6620b6922694b2:()=>c1,__wbg_randomFillSync_ac0988aba3254290:()=>n1,__wbg_require_60cc747a6bc5215a:()=>o1,__wbg_set_wasm:()=>Ht,__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e:()=>a1,__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac:()=>d1,__wbg_static_accessor_SELF_6fdf4b64710cc91b:()=>l1,__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2:()=>u1,__wbg_subarray_480600f3d6a9f26c:()=>p1,__wbg_versions_c01dfd4722a88165:()=>h1,__wbindgen_cast_2241b6af4c4b2941:()=>S1,__wbindgen_cast_cb9088102bce6b30:()=>f1,__wbindgen_init_externref_table:()=>m1});var h,Ft;function Ht(e,t){h=e,Ft=t}var Y=null;function de(){return(Y===null||Y.byteLength===0)&&(Y=new Uint8Array(h.memory.buffer)),Y}var Ve=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Ve.decode();function Gt(e,t){return Ve.decode(de().subarray(e,e+t))}function F(e,t){return e=e>>>0,Gt(e,t)}function H(e){let t=h.__externref_table_alloc();return h.__wbindgen_externrefs.set(t,e),t}function G(e,t){try{return e.apply(this,t)}catch(i){let r=H(i);h.__wbindgen_exn_store(r)}}function M(e,t){return e=e>>>0,de().subarray(e/1,e/1+t)}function B(e){return e==null}var D=0;function x(e,t){let i=t(e.length*1,1)>>>0;return de().set(e,i/1),D=e.length,i}function P(e){let t=h.__wbindgen_externrefs.get(e);return h.__externref_table_dealloc(e),t}var Wt=Object.freeze({NoIncomingMessageExpected:0,0:"NoIncomingMessageExpected",Success:1,1:"Success"}),qe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>h.__wbg_wasmclientsession_free(e>>>0,1)),v=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,qe.unregister(this),t}free(){let t=this.__destroy_into_raw();h.__wbg_wasmclientsession_free(t,0)}constructor(t,i){var r=B(i)?0:x(i,h.__wbindgen_malloc),s=D;let o=h.wasmclientsession_new(B(t)?16777215:t?1:0,r,s);if(o[2])throw P(o[1]);return this.__wbg_ptr=o[0]>>>0,qe.register(this,this.__wbg_ptr,this),this}is_open(){return h.wasmclientsession_is_open(this.__wbg_ptr)!==0}write(t){let i=x(t,h.__wbindgen_malloc),r=D,s=h.wasmclientsession_write(this.__wbg_ptr,i,r);if(s[3])throw P(s[2]);var o=M(s[0],s[1]).slice();return h.__wbindgen_free(s[0],s[1]*1,1),o}read(t){let i=x(t,h.__wbindgen_malloc),r=D,s=h.wasmclientsession_read(this.__wbg_ptr,i,r);if(s[3])throw P(s[2]);var o=M(s[0],s[1]).slice();return h.__wbindgen_free(s[0],s[1]*1,1),o}write_buffer(t){let i=x(t,h.__wbindgen_malloc),r=D,s=h.wasmclientsession_write_buffer(this.__wbg_ptr,i,r);if(s[3])throw P(s[2]);var o=M(s[0],s[1]).slice();return h.__wbindgen_free(s[0],s[1]*1,1),o}read_buffer(t){let i=x(t,h.__wbindgen_malloc),r=D,s=h.wasmclientsession_read_buffer(this.__wbg_ptr,i,r);if(s[3])throw P(s[2]);var o=M(s[0],s[1]).slice();return h.__wbindgen_free(s[0],s[1]*1,1),o}put_incoming_message(t){let i=x(t,h.__wbindgen_malloc),r=D,s=h.wasmclientsession_put_incoming_message(this.__wbg_ptr,i,r);if(s[2])throw P(s[1]);return s[0]}get_outgoing_message(){let t=h.wasmclientsession_get_outgoing_message(this.__wbg_ptr);if(t[3])throw P(t[2]);let i;return t[0]!==0&&(i=M(t[0],t[1]).slice(),h.__wbindgen_free(t[0],t[1]*1,1)),i}get_attestation_results_json(){let t=h.wasmclientsession_get_attestation_results_json(this.__wbg_ptr);if(t[3])throw P(t[2]);let i;return t[0]!==0&&(i=F(t[0],t[1]).slice(),h.__wbindgen_free(t[0],t[1]*1,1)),i}get_attestation_status(){let t,i;try{let r=h.wasmclientsession_get_attestation_status(this.__wbg_ptr);return t=r[0],i=r[1],F(r[0],r[1])}finally{h.__wbindgen_free(t,i,1)}}};Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);function Ut(e){return typeof e=="function"}function qt(e){let t=e;return typeof t=="object"&&t!==null}function Vt(e){return typeof e=="string"}function Lt(e){return e===void 0}function zt(e,t){throw new Error(F(e,t))}function jt(){return G(function(e,t,i){return e.call(t,i)},arguments)}function $t(){return G(function(e,t){return e.call(t)},arguments)}function Qt(e){return e.crypto}function Zt(){return G(function(e,t){e.getRandomValues(t)},arguments)}function Jt(e){return e.length}function Yt(e){return e.msCrypto}function e1(e,t){return new Function(F(e,t))}function t1(e){return new Uint8Array(e>>>0)}function i1(e){return e.node}function r1(){return Date.now()}function s1(e){return e.process}function c1(e,t,i){Uint8Array.prototype.set.call(M(e,t),i)}function n1(){return G(function(e,t){e.randomFillSync(t)},arguments)}function o1(){return G(function(){return module.require},arguments)}function a1(){let e=typeof global>"u"?null:global;return B(e)?0:H(e)}function d1(){let e=typeof globalThis>"u"?null:globalThis;return B(e)?0:H(e)}function l1(){let e=typeof self>"u"?null:self;return B(e)?0:H(e)}function u1(){let e=typeof window>"u"?null:window;return B(e)?0:H(e)}function p1(e,t,i){return e.subarray(t>>>0,i>>>0)}function h1(e){return e.versions}function S1(e,t){return F(e,t)}function f1(e,t){return M(e,t)}function m1(){let e=h.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}var ze=require("node:fs"),ue={};ue["./oak_session_wasm_nodejs_bg.js"]=le;var g1=require("url").pathToFileURL(Le.default),C1=(0,ze.readFileSync)(g1),je=new WebAssembly.Module(C1),$e=new WebAssembly.Instance(je,ue).exports;ue["./oak_session_wasm_nodejs_bg.js"].__wbg_set_wasm($e,je);$e.__wbindgen_start();var Qe=require("tough-cookie");var ee=class{session=null;sessionId=null;config;handshakeInProgress=!1;cookieJar;constructor(t){this.config=t,this.cookieJar=new Qe.CookieJar}async ensureSession(){if(!(this.session&&this.session.is_open())){if(this.handshakeInProgress){for(;this.handshakeInProgress;)await new Promise(t=>setTimeout(t,50));return}await this.handshake()}}async handshake(){this.handshakeInProgress=!0;try{let t=this.config.unattested??!1;this.session=new v(t,t?void 0:this.config.attesterKey);let i=4,r=0;if(!this.session)throw new m("Failed to create session");for(;!this.session.is_open()&&r<i;){r++;let s=this.session.get_outgoing_message();if(!s||this.session.is_open())break;let o=`${this.config.apiBaseUrl}/tunnel/session`,d={"Content-Type":"application/octet-stream"};this.sessionId&&(d["X-Session-Id"]=this.sessionId);let c=await this.cookieJar.getCookieString(o);c&&(d.Cookie=c);let a=await fetch(o,{method:"POST",body:s,headers:d});if(!this.sessionId){let n=a.headers.get("X-Session-Id");if(!n)throw new m("No session ID received from server");this.sessionId=n}if(!a.ok){let n=await a.text().catch(()=>"Unable to read error");throw new m(`Handshake failed with status ${a.status}: ${n}`,a.status)}let u=a.headers.getSetCookie?.()||[];for(let n of u)await this.cookieJar.setCookie(n,o);let S=await a.arrayBuffer();if(S.byteLength>0)this.session.put_incoming_message(Buffer.from(S));else throw new m("Empty response from server during handshake")}if(!this.session.is_open()||!this.sessionId)throw new m("Failed to establish session after handshake")}finally{this.handshakeInProgress=!1}}encryptRequest(t){if(!this.session||!this.session.is_open())throw new m("Session not open");try{let i=typeof t=="string"?Buffer.from(t,"utf-8"):t,r=this.session.write(i);return Buffer.from(r)}catch(i){throw new m(`Encryption failed: ${i instanceof Error?i.message:"Unknown error"}`)}}decryptResponse(t){if(!this.session||!this.session.is_open())throw new m("Session not open");try{let i=Buffer.isBuffer(t)?t:Buffer.from(t),r=this.session.read(i);return Buffer.from(r)}catch(i){throw new m(`Decryption failed: ${i instanceof Error?i.message:"Unknown error"}`)}}getSessionId(){return this.sessionId}getCookies(t){return this.cookieJar.getCookieString(t)}destroy(){this.session=null,this.sessionId=null}getAttestationResults(){return this.session?this.session.get_attestation_results_json()??null:null}getAttestationStatus(){return this.session?this.session.get_attestation_status()??null:null}};function Je(e){let t=(0,Ze.default)({baseUrl:e.apiBaseUrl}),i=new ee(e);return t.use(Ge(i)),t.use(He({accessKey:e.accessKey,secretKey:e.secretKey})),{client:t,sessionManager:i}}async function Ye(e,t){let{workspaceUuid:i,fileBuffer:r,envelopeTitle:s}=t,o=new Blob([new Uint8Array(r)],{type:"application/pdf"}),d=await e.POST("/public/envelope/create-from-file",{body:{workspaceUuid:i,envelopeTitle:s,file:o},bodySerializer:c=>{let a=new FormData;return a.append("workspaceUuid",c.workspaceUuid),a.append("envelopeTitle",c.envelopeTitle),a.append("file",c.file,"document.pdf"),a}});if(d.error)throw new m(`Failed to upload document: ${JSON.stringify(d.error)}`,d.response?.status,typeof d.error=="object"&&"code"in d.error?String(d.error.code):void 0);return{envelopeUuid:d.data.envelopeUuid,documentUuid:d.data.documentUuid}}var te=class{client;sessionManager;constructor(t){let{client:i,sessionManager:r}=Je(t);this.client=i,this.sessionManager=r}get GET(){return this.client.GET}get POST(){return this.client.POST}get PUT(){return this.client.PUT}get DELETE(){return this.client.DELETE}get PATCH(){return this.client.PATCH}uploadDocument(t){return Ye(this,t)}getAttestationStatus(){let t=this.sessionManager.getAttestationStatus();return t?JSON.parse(t):null}getAttestationResults(){let t=this.sessionManager.getAttestationResults();return t?JSON.parse(t):null}};0&&(module.exports={SubnotoClient,SubnotoError});
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@subnoto/api-client",
3
3
  "private": false,
4
- "version": "2.3.8",
4
+ "version": "2.3.10",
5
5
  "description": "TypeScript SDK for Subnoto Public API",
6
6
  "author": "Subnoto",
7
7
  "homepage": "https://subnoto.com",
@@ -12,11 +12,13 @@
12
12
  "typescript"
13
13
  ],
14
14
  "type": "module",
15
+ "main": "./index.cjs",
15
16
  "module": "./index.js",
16
17
  "types": "./index.d.ts",
17
18
  "exports": {
18
19
  ".": {
19
20
  "import": "./index.js",
21
+ "require": "./index.cjs",
20
22
  "types": "./index.d.ts"
21
23
  }
22
24
  },
@@ -1061,7 +1061,7 @@ export interface paths {
1061
1061
  put?: never;
1062
1062
  /**
1063
1063
  * add-attachment
1064
- * @description Add a document attachment to an existing envelope. Accepts multipart/form-data with a PDF or Word document file.
1064
+ * @description Add a document attachment to an existing envelope. Accepts multipart/form-data with a PDF, Word (DOCX/DOC), ODT, or RTF document file.
1065
1065
  */
1066
1066
  post: {
1067
1067
  parameters: {
@@ -1079,7 +1079,7 @@ export interface paths {
1079
1079
  envelopeUuid: string;
1080
1080
  /** @description The title of the document attachment. */
1081
1081
  documentTitle: string;
1082
- /** @description The file to attach (PDF or Word document, max 50MB). */
1082
+ /** @description The file to attach (PDF, Word, ODT, or RTF document, max 11MB). */
1083
1083
  file: unknown;
1084
1084
  };
1085
1085
  };
@@ -1753,7 +1753,7 @@ export interface paths {
1753
1753
  put?: never;
1754
1754
  /**
1755
1755
  * create-from-file
1756
- * @description Create an envelope and the first document placeholder with a file upload. Accepts multipart/form-data with a PDF or Word document file (max 50 MB). DOCX files are converted to PDF. The file is processed and uploaded directly.
1756
+ * @description Create an envelope and the first document placeholder with a file upload. Accepts multipart/form-data with a PDF, Word (DOCX/DOC), ODT, or RTF document file (max 50 MB). DOCX, ODT, and RTF files are converted to PDF. The file is processed and uploaded directly.
1757
1757
  */
1758
1758
  post: {
1759
1759
  parameters: {
@@ -1769,7 +1769,7 @@ export interface paths {
1769
1769
  workspaceUuid: string;
1770
1770
  /** @description The title of the envelope being created. */
1771
1771
  envelopeTitle: string;
1772
- /** @description The file to upload (PDF or Word document, max 50MB). */
1772
+ /** @description The file to upload (PDF, Word, ODT, or RTF document, max 50MB). */
1773
1773
  file: unknown;
1774
1774
  /** @description Enable Smart Anchor detection. Set to 'true' to detect and process Smart Anchors in the PDF. Defaults to false. */
1775
1775
  detectSmartAnchors?: string;
@@ -1805,7 +1805,7 @@ export interface paths {
1805
1805
  * @description The error code
1806
1806
  * @enum {string}
1807
1807
  */
1808
- code: "WORKSPACE_NOT_FOUND" | "INVALID_FILE_DATA" | "FILE_SIZE_EXCEEDED" | "INVALID_PDF" | "INVALID_REQUEST" | "DOCUMENT_INVALID" | "DOCX_CONVERSION_UNAVAILABLE" | "DOCUMENT_CONVERSION_FAILED" | "INVALID_REQUEST_FORMAT";
1808
+ code: "WORKSPACE_NOT_FOUND" | "INVALID_FILE_DATA" | "FILE_SIZE_EXCEEDED" | "INVALID_PDF" | "INVALID_REQUEST" | "DOCUMENT_INVALID" | "DOCUMENT_CONVERSION_UNAVAILABLE" | "DOCUMENT_CONVERSION_FAILED" | "INVALID_REQUEST_FORMAT";
1809
1809
  /** @description The error message */
1810
1810
  message: string;
1811
1811
  /** @description A suggestion to resolve the error */