Comparing version 2.0.0-beta.0 to 2.0.0
@@ -1,5 +0,5 @@ | ||
var Rt=Object.create;var tt=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var Ot=Object.getOwnPropertyNames;var vt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var qe=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Ht=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ft=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ot(e))!Nt.call(t,n)&&n!==r&&tt(t,n,{get:()=>e[n],enumerable:!(s=Pt(e,n))||s.enumerable});return t};var It=(t,e,r)=>(r=t!=null?Rt(vt(t)):{},Ft(e||!t||!t.__esModule?tt(r,"default",{value:t,enumerable:!0}):r,t));var Ve=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var i=(t,e,r)=>(Ve(t,e,"read from private field"),r?r.call(t):e.get(t)),d=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},S=(t,e,r,s)=>(Ve(t,e,"write to private field"),s?s.call(t,r):e.set(t,r),r),Me=(t,e,r,s)=>({set _(n){S(t,e,n,r)},get _(){return i(t,e,s)}}),p=(t,e,r)=>(Ve(t,e,"access private method"),r);var it=Ht(Ae=>{"use strict";Ae.byteLength=Wt;Ae.toByteArray=Lt;Ae.fromByteArray=$t;var P=[],C=[],Mt=typeof Uint8Array<"u"?Uint8Array:Array,$e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Z=0,ot=$e.length;Z<ot;++Z)P[Z]=$e[Z],C[$e.charCodeAt(Z)]=Z;var Z,ot;C["-".charCodeAt(0)]=62;C["_".charCodeAt(0)]=63;function at(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var s=r===e?0:4-r%4;return[r,s]}function Wt(t){var e=at(t),r=e[0],s=e[1];return(r+s)*3/4-s}function jt(t,e,r){return(e+r)*3/4-r}function Lt(t){var e,r=at(t),s=r[0],n=r[1],o=new Mt(jt(t,s,n)),a=0,c=n>0?s-4:s,u;for(u=0;u<c;u+=4)e=C[t.charCodeAt(u)]<<18|C[t.charCodeAt(u+1)]<<12|C[t.charCodeAt(u+2)]<<6|C[t.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=C[t.charCodeAt(u)]<<2|C[t.charCodeAt(u+1)]>>4,o[a++]=e&255),n===1&&(e=C[t.charCodeAt(u)]<<10|C[t.charCodeAt(u+1)]<<4|C[t.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function Ut(t){return P[t>>18&63]+P[t>>12&63]+P[t>>6&63]+P[t&63]}function Bt(t,e,r){for(var s,n=[],o=e;o<r;o+=3)s=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),n.push(Ut(s));return n.join("")}function $t(t){for(var e,r=t.length,s=r%3,n=[],o=16383,a=0,c=r-s;a<c;a+=o)n.push(Bt(t,a,a+o>c?c:a+o));return s===1?(e=t[r-1],n.push(P[e>>2]+P[e<<4&63]+"==")):s===2&&(e=(t[r-2]<<8)+t[r-1],n.push(P[e>>10]+P[e>>4&63]+P[e<<2&63]+"=")),n.join("")}});var We={default:new URL("https://db.fauna.com"),local:new URL("http://localhost:8443"),localhost:new URL("http://localhost:8443")};var Q=class extends Error{constructor(...e){super(...e)}},y=class extends Q{httpStatus;code;queryInfo;constraint_failures;constructor(e,r){super(e.error.message),Error.captureStackTrace&&Error.captureStackTrace(this,y),this.name="ServiceError",this.code=e.error.code,this.httpStatus=r;let s={txn_ts:e.txn_ts,summary:e.summary,query_tags:e.query_tags,stats:e.stats};this.queryInfo=s,this.constraint_failures=e.error.constraint_failures}},te=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,te),this.name="QueryRuntimeError"}},V=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,V),this.name="QueryCheckError"}},z=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,z),this.name="InvalidRequestError"}},be=class extends y{constraint_failures;constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,V),this.name="ConstraintFailureError",this.constraint_failures=e.error.constraint_failures}},Se=class extends y{abort;constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,V),this.name="AbortError",this.abort=e.error.abort}},re=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,re),this.name="AuthenticationError"}},ne=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,ne),this.name="AuthorizationError"}},we=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,z),this.name="ContendedTransactionError"}},M=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,M),this.name="ThrottlingError"}},se=class extends y{stats;constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,se),this.name="QueryTimeoutError",this.stats=e.stats}},oe=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,oe),this.name="ServiceInternalError"}},b=class extends Q{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,b),this.name="ClientError"}},O=class extends Q{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,O),this.name="ClientClosedError"}},g=class extends Q{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,g),this.name="NetworkError"}},v=class extends Q{httpStatus;constructor(e){super(e.message),Error.captureStackTrace&&Error.captureStackTrace(this,v),this.name="ProtocolError",this.httpStatus=e.httpStatus}},X=(t,e)=>{switch(t.error.code){case"invalid_query":return new V(t,e);case"invalid_request":return new z(t,e);case"abort":if(t.error.abort!==void 0)return new Se(t,e);break;case"constraint_failure":if(t.error.constraint_failures!==void 0)return new be(t,e);break;case"unauthorized":return new re(t,e);case"forbidden":return new ne(t,e);case"contended_transaction":return new we(t,e);case"throttle":return new M(t,e);case"time_out":return new se(t,e);case"internal_error":return new oe(t,e)}return new te(t,e)};var le=class{#e;#t;#r;constructor({url:e,fetch_keepalive:r}){this.#e=new URL("/query/1",e).toString(),this.#t=new URL("/stream/1",e).toString(),this.#r=r}async request({data:e,headers:r,method:s,client_timeout_ms:n}){let o=AbortSignal.timeout===void 0?(()=>{let f=new AbortController,l=f.signal;return setTimeout(()=>f.abort(),n),l})():AbortSignal.timeout(n),a=await fetch(this.#e,{method:s,headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),signal:o,keepalive:this.#r}).catch(f=>{throw new g("The network connection encountered a problem.",{cause:f})}),c=a.status,u={};a.headers.forEach((f,l)=>u[l]=f);let T=await a.text();return{status:c,body:T,headers:u}}stream({data:e,headers:r,method:s}){let n=new Request(this.#t,{method:s,headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:this.#r}),o=new AbortController,a={signal:o.signal};async function*c(){let u=await fetch(n,a).catch(m=>{throw new g("The network connection encountered a problem.",{cause:m})}),T=u.status;if(!(T>=200&&T<400)){let m=await u.json();throw X(m,T)}let f=u.body;if(!f)throw new Error("Response body is undefined.");let l=f.getReader();try{for await(let m of Dt(l))yield m}catch(m){throw new g("The network connection encountered a problem while streaming events.",{cause:m})}}return{read:c(),close:()=>{o.abort("Stream closed by the client.")}}}close(){}};async function*Dt(t){let e=new TextDecoder,r="";for await(let s of qt(t)){let n=e.decode(s),o=(r+n).split(` | ||
var Rt=Object.create;var tt=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var Ot=Object.getOwnPropertyNames;var vt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var qe=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Ht=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ft=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ot(e))!Nt.call(t,n)&&n!==r&&tt(t,n,{get:()=>e[n],enumerable:!(s=Pt(e,n))||s.enumerable});return t};var It=(t,e,r)=>(r=t!=null?Rt(vt(t)):{},Ft(e||!t||!t.__esModule?tt(r,"default",{value:t,enumerable:!0}):r,t));var Ve=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var i=(t,e,r)=>(Ve(t,e,"read from private field"),r?r.call(t):e.get(t)),d=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},S=(t,e,r,s)=>(Ve(t,e,"write to private field"),s?s.call(t,r):e.set(t,r),r),Me=(t,e,r,s)=>({set _(n){S(t,e,n,r)},get _(){return i(t,e,s)}}),p=(t,e,r)=>(Ve(t,e,"access private method"),r);var it=Ht(Ae=>{"use strict";Ae.byteLength=Wt;Ae.toByteArray=Lt;Ae.fromByteArray=$t;var P=[],C=[],Mt=typeof Uint8Array<"u"?Uint8Array:Array,$e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Z=0,ot=$e.length;Z<ot;++Z)P[Z]=$e[Z],C[$e.charCodeAt(Z)]=Z;var Z,ot;C["-".charCodeAt(0)]=62;C["_".charCodeAt(0)]=63;function at(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var s=r===e?0:4-r%4;return[r,s]}function Wt(t){var e=at(t),r=e[0],s=e[1];return(r+s)*3/4-s}function jt(t,e,r){return(e+r)*3/4-r}function Lt(t){var e,r=at(t),s=r[0],n=r[1],o=new Mt(jt(t,s,n)),a=0,c=n>0?s-4:s,u;for(u=0;u<c;u+=4)e=C[t.charCodeAt(u)]<<18|C[t.charCodeAt(u+1)]<<12|C[t.charCodeAt(u+2)]<<6|C[t.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=C[t.charCodeAt(u)]<<2|C[t.charCodeAt(u+1)]>>4,o[a++]=e&255),n===1&&(e=C[t.charCodeAt(u)]<<10|C[t.charCodeAt(u+1)]<<4|C[t.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function Ut(t){return P[t>>18&63]+P[t>>12&63]+P[t>>6&63]+P[t&63]}function Bt(t,e,r){for(var s,n=[],o=e;o<r;o+=3)s=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),n.push(Ut(s));return n.join("")}function $t(t){for(var e,r=t.length,s=r%3,n=[],o=16383,a=0,c=r-s;a<c;a+=o)n.push(Bt(t,a,a+o>c?c:a+o));return s===1?(e=t[r-1],n.push(P[e>>2]+P[e<<4&63]+"==")):s===2&&(e=(t[r-2]<<8)+t[r-1],n.push(P[e>>10]+P[e>>4&63]+P[e<<2&63]+"=")),n.join("")}});var We={default:new URL("https://db.fauna.com"),local:new URL("http://localhost:8443"),localhost:new URL("http://localhost:8443")};var Q=class extends Error{constructor(...e){super(...e)}},y=class extends Q{httpStatus;code;queryInfo;constraint_failures;constructor(e,r){super(e.error.message),Error.captureStackTrace&&Error.captureStackTrace(this,y),this.name="ServiceError",this.code=e.error.code,this.httpStatus=r;let s={txn_ts:e.txn_ts,summary:e.summary,query_tags:e.query_tags,stats:e.stats};this.queryInfo=s,this.constraint_failures=e.error.constraint_failures}},te=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,te),this.name="QueryRuntimeError"}},V=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,V),this.name="QueryCheckError"}},z=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,z),this.name="InvalidRequestError"}},be=class extends y{constraint_failures;constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,V),this.name="ConstraintFailureError",this.constraint_failures=e.error.constraint_failures}},Se=class extends y{abort;constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,V),this.name="AbortError",this.abort=e.error.abort}},re=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,re),this.name="AuthenticationError"}},ne=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,ne),this.name="AuthorizationError"}},we=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,z),this.name="ContendedTransactionError"}},M=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,M),this.name="ThrottlingError"}},se=class extends y{stats;constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,se),this.name="QueryTimeoutError",this.stats=e.stats}},oe=class extends y{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,oe),this.name="ServiceInternalError"}},b=class extends Q{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,b),this.name="ClientError"}},O=class extends Q{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,O),this.name="ClientClosedError"}},g=class extends Q{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,g),this.name="NetworkError"}},v=class extends Q{httpStatus;constructor(e){super(e.message),Error.captureStackTrace&&Error.captureStackTrace(this,v),this.name="ProtocolError",this.httpStatus=e.httpStatus}},X=(t,e)=>{switch(t.error.code){case"invalid_query":return new V(t,e);case"invalid_request":return new z(t,e);case"abort":if(t.error.abort!==void 0)return new Se(t,e);break;case"constraint_failure":if(t.error.constraint_failures!==void 0)return new be(t,e);break;case"unauthorized":return new re(t,e);case"forbidden":return new ne(t,e);case"contended_transaction":return new we(t,e);case"limit_exceeded":return new M(t,e);case"time_out":return new se(t,e);case"internal_error":return new oe(t,e)}return new te(t,e)};var le=class{#e;#t;#r;constructor({url:e,fetch_keepalive:r}){this.#e=new URL("/query/1",e).toString(),this.#t=new URL("/stream/1",e).toString(),this.#r=r}async request({data:e,headers:r,method:s,client_timeout_ms:n}){let o=AbortSignal.timeout===void 0?(()=>{let f=new AbortController,l=f.signal;return setTimeout(()=>f.abort(),n),l})():AbortSignal.timeout(n),a=await fetch(this.#e,{method:s,headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),signal:o,keepalive:this.#r}).catch(f=>{throw new g("The network connection encountered a problem.",{cause:f})}),c=a.status,u={};a.headers.forEach((f,l)=>u[l]=f);let T=await a.text();return{status:c,body:T,headers:u}}stream({data:e,headers:r,method:s}){let n=new Request(this.#t,{method:s,headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:this.#r}),o=new AbortController,a={signal:o.signal};async function*c(){let u=await fetch(n,a).catch(m=>{throw new g("The network connection encountered a problem.",{cause:m})}),T=u.status;if(!(T>=200&&T<400)){let m=await u.json();throw X(m,T)}let f=u.body;if(!f)throw new Error("Response body is undefined.");let l=f.getReader();try{for await(let m of Dt(l))yield m}catch(m){throw new g("The network connection encountered a problem while streaming events.",{cause:m})}}return{read:c(),close:()=>{o.abort("Stream closed by the client.")}}}close(){}};async function*Dt(t){let e=new TextDecoder,r="";for await(let s of qt(t)){let n=e.decode(s),o=(r+n).split(` | ||
`);for(let a=0;a<o.length-1;a++)yield o[a].trim();r=o[o.length-1]}r.trim()!==""&&(yield r)}async function*qt(t){let e=!1;do{let r=await t.read();r.value!==void 0&&(yield r.value),e=r.done}while(!e)}var R;try{R=qe("node:http2")}catch{R=void 0}var ae,me,fe,pe,W,w,_e,rt,ie,xe,ye,je,Ee,nt,Ce,st,Y=class{constructor({http2_session_idle_ms:e,url:r,http2_max_streams:s}){d(this,ie);d(this,ye);d(this,Ee);d(this,Ce);d(this,me,void 0);d(this,fe,void 0);d(this,pe,void 0);d(this,W,0);d(this,w,void 0);if(R===void 0)throw new Error("Your platform does not support Node's http2 library");S(this,me,e),S(this,fe,s),S(this,pe,r),S(this,w,null)}static getClient(e){var n;let r=p(n=Y,_e,rt).call(n,e);i(Y,ae).has(r)||i(Y,ae).set(r,new Y(e));let s=i(Y,ae).get(r);return Me(s,W)._++,s}async request(e){let r=0,s;do try{return await p(this,Ee,nt).call(this,e)}catch(n){if(n?.code!=="ERR_HTTP2_GOAWAY_SESSION")throw new g("The network connection encountered a problem.",{cause:n});s=n,r++}while(r<3);throw new g("The network connection encountered a problem.",{cause:s})}stream(e){return p(this,Ce,st).call(this,e)}close(){this.isClosed()||(Me(this,W)._--,i(this,W)===0&&i(this,w)&&!i(this,w).closed&&i(this,w).close())}isClosed(){return i(this,W)===0}},J=Y;ae=new WeakMap,me=new WeakMap,fe=new WeakMap,pe=new WeakMap,W=new WeakMap,w=new WeakMap,_e=new WeakSet,rt=function({http2_session_idle_ms:e,url:r}){return`${r}|${e}`},ie=new WeakSet,xe=function(){S(this,W,0),i(this,w)&&!i(this,w).closed&&i(this,w).close()},ye=new WeakSet,je=function(){if(!i(this,w)||i(this,w).closed||i(this,w).destroyed){let e=R.connect(i(this,pe),{peerMaxConcurrentStreams:i(this,fe)}).once("error",()=>p(this,ie,xe).call(this)).once("goaway",()=>p(this,ie,xe).call(this));e.setTimeout(i(this,me),()=>{p(this,ie,xe).call(this)}),S(this,w,e)}return i(this,w)},Ee=new WeakSet,nt=function({client_timeout_ms:e,data:r,headers:s,method:n}){return new Promise((o,a)=>{let c,u=T=>{let f=Number(T[R.constants.HTTP2_HEADER_STATUS]),l="";c.on("data",m=>{l+=m}),c.on("end",()=>{o({status:f,body:l,headers:T})})};try{let T={...s,[R.constants.HTTP2_HEADER_PATH]:"/query/1",[R.constants.HTTP2_HEADER_METHOD]:n};c=p(this,ye,je).call(this).request(T).setEncoding("utf8").on("error",l=>{a(new g("The network connection encountered a problem while streaming events.",{cause:l}))}).on("response",u),c.write(JSON.stringify(r),"utf8"),c.setTimeout(e,()=>{c.destroy(new Error("Client timeout"))}),c.end()}catch(T){a(new g("The network connection encountered a problem while streaming events.",{cause:T}))}})},Ce=new WeakSet,st=function({data:e,headers:r,method:s}){let n,o,a=()=>new Promise((m,k)=>{n=m,o=k}),c=a(),u,T=m=>{let k=Number(m[R.constants.HTTP2_HEADER_STATUS]);if(k>=200&&k<400){let _="";u.on("data",E=>{let G=(_+E).split(` | ||
`);n(G.map(De=>De.trim()).slice(0,-1)),c=a(),_=G[G.length-1]}),u.on("end",()=>{n([_])})}else{let _="";u.on("data",E=>{_+=E}),u.on("end",()=>{try{let E=JSON.parse(_);o(X(E,k))}catch(E){o(new g("Could not process query failure.",{cause:E}))}})}},f=this;async function*l(){var E;let m={...r,[R.constants.HTTP2_HEADER_PATH]:"/stream/1",[R.constants.HTTP2_HEADER_METHOD]:s};u=p(E=f,ye,je).call(E).request(m).setEncoding("utf8").on("error",G=>{o(G)}).on("response",T);let _=JSON.stringify(e);for(u.write(_,"utf8"),u.end();;){let G=await c;for(let De of G)yield De}}return{read:l(),close:()=>{u&&u.close()}}},d(J,_e),d(J,ae,new Map);var Le=t=>Vt()?J.getClient(t):new le(t),Ue=t=>t instanceof Object&&"body"in t&&"headers"in t&&"status"in t,Be=t=>"stream"in t&&typeof t.stream=="function",Vt=()=>{if(typeof process<"u"&&process&&process.release?.name==="node")try{return qe("node:http2"),!0}catch{return!1}return!1};var Ye=It(it());var Gt=/(?:\d{4}|[\u2212-]\d{4,}|\+\d{5,})/,zt=/(?:0[1-9]|1[0-2])/,Xt=/(?:0[1-9]|[12]\d|3[01])/,ut=/(?:[01][0-9]|2[0-3])/,ge=/(?:[0-5][0-9])/,Yt=/(?:\.\d+)/,Ge=new RegExp(`(${Gt.source}-(${zt.source})-(${Xt.source}))`),Jt=new RegExp(`(${ut.source}:${ge.source}:${ge.source}${Yt.source}?)`),Zt=new RegExp(`([zZ]|[+\u2212-]${ut.source}(?::?${ge.source}|:${ge.source}:${ge.source}))`),ct=new RegExp(`^${Ge.source}$`),dt=new RegExp(`^${Ge.source}`),lt=new RegExp(`^${Ge.source}T${Jt.source}${Zt.source}$`);var N=class{isoString;constructor(e){this.isoString=e}static from(e){if(typeof e!="string")throw new TypeError(`Expected string but received ${typeof e}: ${e}`);if(lt.exec(e)===null)throw new RangeError(`(regex) Expected an ISO date string but received '${e}'`);return new N(e)}static fromDate(e){return new N(e.toISOString())}toDate(){let e=new Date(this.isoString);if(e.toString()==="Invalid Date")throw new RangeError("Fauna Date could not be converted to Javascript Date");return e}toString(){return`TimeStub("${this.isoString}")`}},H=class{dateString;constructor(e){this.dateString=e}static from(e){if(typeof e!="string")throw new TypeError(`Expected string but received ${typeof e}: ${e}`);let r=ct.exec(e);if(r===null)throw new RangeError(`Expected a plain date string but received '${e}'`);return new H(r[0])}static fromDate(e){let r=e.toISOString(),s=dt.exec(r);if(s===null)throw new b(`Failed to parse date '${e}'`);return new H(s[0])}toDate(){let e=new Date(this.dateString+"T00:00:00Z");if(e.toString()==="Invalid Date")throw new RangeError("Fauna Date could not be converted to Javascript Date");return e}toString(){return`DateStub("${this.dateString}")`}};var j=class{coll;id;constructor({coll:e,id:r}){this.id=r,typeof e=="string"?this.coll=new L(e):this.coll=e}},ue=class extends j{ts;ttl;constructor(e){let{coll:r,id:s,ts:n,...o}=e;super({coll:r,id:s}),this.ts=n,Object.assign(this,o)}toObject(){return{...this}}},K=class{coll;name;constructor({coll:e,name:r}){this.name=r,typeof e=="string"?this.coll=new L(e):this.coll=e}},ce=class extends K{ts;data;constructor(e){let{coll:r,name:s,ts:n,data:o,...a}=e;super({coll:r,name:s}),this.ts=n,this.data=o||{},Object.assign(this,a)}toObject(){return{...this}}},L=class{name;constructor(e){this.name=e}},de=class{ref;cause;constructor(e,r){this.ref=e,this.cause=r}};var F=class{data;after;constructor({data:e,after:r}){this.data=e,this.after=r}},U=class{after;constructor(e){this.after=e}},I=class{#e;constructor(e,r,s){if(s=s??{},r instanceof Function)this.#e=er(e,r,s);else if(r instanceof F||r instanceof U)this.#e=mt(e,r,s);else throw new TypeError(`Expected 'Page<T> | EmbeddedSet | (() => Promise<T | Page<T> | EmbeddedSet>)', but received ${JSON.stringify(r)}`)}static fromQuery(e,r,s){return new I(e,async()=>(await e.query(r,s)).data,s)}static fromPageable(e,r,s){return new I(e,r,s)}flatten(){return new ze(this)}async next(){return this.#e.next()}async return(){return this.#e.return()}async throw(e){return this.#e.throw(e)}[Symbol.asyncIterator](){return this}},ze=class{#e;constructor(e){this.#e=tr(e)}async next(){return this.#e.next()}async return(){return this.#e.return()}async throw(e){return this.#e.throw(e)}[Symbol.asyncIterator](){return this}};async function*mt(t,e,r){let s=e;for(s instanceof F&&(yield s.data);s.after;){let n=Xe`Set.paginate(${s.after})`;s=(await t.query(n,r)).data,yield s.data}}async function*er(t,e,r){let s=await e();if(s instanceof F||s instanceof U){for await(let n of mt(t,s,r))yield n;return}yield[s]}async function*tr(t){for await(let e of t)for(let r of e)yield r}var D=class{token;constructor(e){this.token=e}};var q=class{static encode(e){return ke(e)}static decode(e,r){return JSON.parse(e,(s,n)=>{if(n==null)return null;if(n["@mod"])return new L(n["@mod"]);if(n["@doc"]){if(typeof n["@doc"]=="string"){let[a,c]=n["@doc"].split(":");return new j({coll:a,id:c})}let o=n["@doc"];return o.id?new ue(o):new ce(o)}else if(n["@ref"]){let o=n["@ref"],a;return o.id?a=new j(o):a=new K(o),"exists"in o&&o.exists===!1?new de(a,o.cause):a}else{if(n["@set"])return typeof n["@set"]=="string"?new U(n["@set"]):new F(n["@set"]);if(n["@int"])return Number(n["@int"]);if(n["@long"]){let o=BigInt(n["@long"]);return r.long_type==="number"?((o>Number.MAX_SAFE_INTEGER||o<Number.MIN_SAFE_INTEGER)&&console.warn("Value is too large to be represented as a number. Returning as Number with loss of precision. Use long_type 'bigint' instead."),Number(o)):o}else{if(n["@double"])return Number(n["@double"]);if(n["@date"])return H.from(n["@date"]);if(n["@time"])return N.from(n["@time"]);if(n["@object"])return n["@object"];if(n["@stream"])return new D(n["@stream"]);if(n["@bytes"])return rr(n["@bytes"])}}return n})}},yt=BigInt("-9223372036854775808"),gt=BigInt("9223372036854775807"),ft=-(2**31),pt=2**31-1,h={bigint:t=>{if(t<yt||t>gt)throw new RangeError("BigInt value exceeds max magnitude for a 64-bit Fauna long. Use a 'number' to represent doubles beyond that limit.");return t>=ft&&t<=pt?{"@int":t.toString()}:{"@long":t.toString()}},number:t=>{if(t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)throw new RangeError(`Cannot convert ${t} to a Fauna type.`);return Number.isInteger(t)?t>=ft&&t<=pt?{"@int":t.toString()}:Number.isSafeInteger(t)?{"@long":t.toString()}:{"@double":t.toString()}:{"@double":t.toString()}},string:t=>t,object:t=>{let e=!1,r={};for(let s in t)s.startsWith("@")&&(e=!0),t[s]!==void 0&&(r[s]=ke(t[s]));return e?{"@object":r}:r},array:t=>{let e=[];for(let r in t)e.push(ke(t[r]));return e},date:t=>({"@time":t.toISOString()}),faunadate:t=>({"@date":t.dateString}),faunatime:t=>({"@time":t.isoString}),module:t=>({"@mod":t.name}),documentReference:t=>({"@ref":{id:t.id,coll:{"@mod":t.coll.name}}}),document:t=>({"@ref":{id:t.id,coll:{"@mod":t.coll.name}}}),namedDocumentReference:t=>({"@ref":{name:t.name,coll:{"@mod":t.coll.name}}}),namedDocument:t=>({"@ref":{name:t.name,coll:{"@mod":t.coll.name}}}),set:t=>{throw new b("Page could not be encoded. Fauna does not accept encoded Set values, yet. Use Page.data and Page.after as arguments, instead.")},streamToken:t=>t.token,bytes:t=>({"@bytes":nr(t)})},ke=t=>{if(t===void 0)throw new TypeError("Passing undefined as a QueryValue is not supported");switch(typeof t){case"bigint":return h.bigint(t);case"string":return h.string(t);case"number":return h.number(t);case"boolean":return t;case"object":if(t==null)return null;if(Array.isArray(t))return h.array(t);if(t instanceof Date)return h.date(t);if(t instanceof H)return h.faunadate(t);if(t instanceof N)return h.faunatime(t);if(t instanceof L)return h.module(t);if(t instanceof ue)return h.document(t);if(t instanceof j)return h.documentReference(t);if(t instanceof ce)return h.namedDocument(t);if(t instanceof K)return h.namedDocumentReference(t);if(t instanceof de)return ke(t.ref);if(t instanceof F)return h.set(t);if(t instanceof U)return h.set(t);if(t instanceof D)return h.streamToken(t);if(t instanceof Uint8Array||t instanceof ArrayBuffer)return h.bytes(t);if(ArrayBuffer.isView(t))throw new b("Error encoding TypedArray to Fauna Bytes. Convert your TypedArray to Uint8Array or ArrayBuffer before passing it to Fauna. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray");return h.object(t)}};function rr(t){return Ye.default.toByteArray(t)}function nr(t){let e=t instanceof Uint8Array?t:new Uint8Array(t);return Ye.default.fromByteArray(e)}function Xe(t,...e){return new B(t,...e)}var B=class{#e;#t;constructor(e,...r){if(e.length===0||e.length!==r.length+1)throw new Error("invalid query constructed");this.#e=e,this.#t=r}toQuery(e={}){return{...this.#r(e),...e}}#r(e){if(this.#e.length===1)return{query:{fql:[this.#e[0]]},arguments:{}};let r={};return{query:{fql:this.#e.flatMap((n,o)=>{if(o===this.#e.length-1)return n===""?[]:[n];let a=this.#t[o],c;if(a instanceof B){let u=a.toQuery(e);c=u.query,r={...r,...u.arguments}}else c={value:q.encode(a)};return[n,c].filter(u=>u!=="")})},arguments:r}}};var ht="2.0.0-beta.0";var Qe;try{Qe=qe("node:os")}catch{Qe=void 0}var St=()=>{let t={driver:["javascript",ht].join("-"),env:"unknown",os:"unknown",runtime:"unknown"};try{let e=typeof window>"u"&&typeof process<"u"&&process.versions!=null&&process.versions.node!=null,r=typeof window<"u"&&typeof window.document<"u",s=typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope";e?(t.runtime=["nodejs",process.version].join("-"),t.env=or(),t.os=[Qe.platform(),Qe.release()].join("-")):s?(t.runtime=Tt(navigator),t.env="Service Worker",t.os=bt(navigator)):r?(t.runtime=Tt(navigator),t.env="browser",t.os=bt(navigator)):typeof EdgeRuntime!="string"&&(t.runtime="Vercel Edge Runtime",t.env="edge")}catch{}return Object.entries(t).filter(([e,r])=>r!=="unknown").map(e=>e.join("=")).join("; ")},Tt=t=>{let e=t.appName,r=""+parseFloat(t.appVersion),s,n,o;return(n=t.userAgent.indexOf("Opera"))!=-1?(e="Opera",r=t.userAgent.substring(n+6),(n=t.userAgent.indexOf("Version"))!=-1&&(r=t.userAgent.substring(n+8))):(n=t.userAgent.indexOf("MSIE"))!=-1?(e="Microsoft Internet Explorer",r=t.userAgent.substring(n+5)):e=="Netscape"&&t.userAgent.indexOf("Trident/")!=-1?(e="Microsoft Internet Explorer",r=t.userAgent.substring(n+5),(n=t.userAgent.indexOf("rv:"))!=-1&&(r=t.userAgent.substring(n+3))):(n=t.userAgent.indexOf("Chrome"))!=-1?(e="Chrome",r=t.userAgent.substring(n+7)):(n=t.userAgent.indexOf("Safari"))!=-1?(e="Safari",r=t.userAgent.substring(n+7),(n=t.userAgent.indexOf("Version"))!=-1&&(r=t.userAgent.substring(n+8)),t.userAgent.indexOf("CriOS")!=-1&&(e="Chrome")):(n=t.userAgent.indexOf("Firefox"))!=-1?(e="Firefox",r=t.userAgent.substring(n+8)):(s=t.userAgent.lastIndexOf(" ")+1)<(n=t.userAgent.lastIndexOf("/"))&&(e=t.userAgent.substring(s,n),r=t.userAgent.substring(n+1),e.toLowerCase()==e.toUpperCase()&&(e=t.appName)),(o=r.indexOf(";"))!=-1&&(r=r.substring(0,o)),(o=r.indexOf(" "))!=-1&&(r=r.substring(0,o)),(o=r.indexOf(")"))!=-1&&(r=r.substring(0,o)),[e,r].join("-")},bt=t=>{let e="unknown",r=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 3.11",r:/Win16/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Chrome OS",r:/CrOS/},{s:"Linux",r:/(Linux|X11(?!.*CrOS))/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(Mac OS|MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/},{s:"Search Bot",r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}];for(let n in r){let o=r[n];if(o.r.test(t.userAgent)){e=o.s;break}}let s="unknown";if(/Windows/.test(e)){let n=/Windows (.*)/.exec(e);n&&(s=n[1]),e="Windows"}switch(e){case"Mac OS":case"Mac OS X":case"Android":{let n=/(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\d]+)/.exec(t.userAgent);n&&(s=n[1]);break}case"iOS":{let n=/OS (\d+)_(\d+)_?(\d+)?/.exec(t.appVersion);n&&(s=n[1]+"."+n[2]+"."+(n[3]??0));break}}return[e,s].join("-")},sr=typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,or=()=>{if(!(typeof process<"u"&&process&&process.env&&typeof process.env=="object"))return"unknown";let e=[{name:"Netlify",check:function(){return!!process.env.NETLIFY_IMAGES_CDN_DOMAIN}},{name:"Vercel",check:function(){return!!process.env.VERCEL}},{name:"Heroku",check:function(){return!!process.env.PATH&&process.env.PATH.indexOf(".heroku")!==-1}},{name:"AWS Lambda",check:function(){return!!process.env.AWS_LAMBDA_FUNCTION_VERSION}},{name:"GCP Cloud Functions",check:function(){return!!process.env._&&process.env._.indexOf("google")!==-1}},{name:"GCP Compute Instances",check:function(){return!!process.env.GOOGLE_CLOUD_PROJECT}},{name:"Azure Cloud Functions",check:function(){return!!process.env.WEBSITE_FUNCTIONS_AZUREMONITOR_CATEGORIES}},{name:"Azure Compute",check:function(){return!!process.env.ORYX_ENV_TYPE&&!!process.env.WEBSITE_INSTANCE_ID&&process.env.ORYX_ENV_TYPE==="AppService"}},{name:"Mongo Stitch",check:function(){return typeof sr?.StitchError=="function"}},{name:"Render",check:function(){return!!process.env.RENDER_SERVICE_ID}},{name:"Begin",check:function(){return!!process.env.BEGIN_DATA_SCOPE_ID}}].find(r=>r.check());return e?e.name:"unknown"};var wt=t=>t instanceof Object&&"data"in t,xt=t=>t instanceof Object&&"error"in t&&t.error instanceof Object&&"code"in t.error&&"message"in t.error;var Je={client_timeout_buffer_ms:5e3,format:"tagged",http2_session_idle_ms:5e3,http2_max_streams:100,long_type:"number",fetch_keepalive:!1,query_timeout_ms:5e3,max_attempts:3,max_backoff:20},Oe,x,$,A,ee,he,Ze,Te,Ke,ve,_t,Ne,Et,He,Ct,Fe,At,Ie,kt,et=class{constructor(e,r){d(this,he);d(this,Te);d(this,ve);d(this,Ne);d(this,He);d(this,Fe);d(this,Ie);d(this,x,void 0);d(this,$,void 0);d(this,A,void 0);d(this,ee,!1);S(this,x,{...Je,...e,secret:p(this,ve,_t).call(this,e),endpoint:p(this,Ne,Et).call(this,e)}),p(this,Ie,kt).call(this),r?S(this,$,r):S(this,$,Le({url:i(this,x).endpoint.toString(),http2_session_idle_ms:i(this,x).http2_session_idle_ms,http2_max_streams:i(this,x).http2_max_streams,fetch_keepalive:i(this,x).fetch_keepalive}))}get lastTxnTs(){return i(this,A)}set lastTxnTs(e){e!==void 0&&S(this,A,i(this,A)?Math.max(e,i(this,A)):e)}get clientConfiguration(){let{...e}=i(this,x);return e}close(){if(i(this,ee))throw new O("Your client is closed. You cannot close it again.");i(this,$).close(),S(this,ee,!0)}paginate(e,r){return e instanceof B?I.fromQuery(this,e,r):I.fromPageable(this,e,r)}async query(e,r){if(i(this,ee))throw new O("Your client is closed. No further requests can be issued.");let s=e.toQuery(r).query;return p(this,he,Ze).call(this,s,r)}stream(e,r){if(i(this,ee))throw new O("Your client is closed. No further requests can be issued.");let s=i(this,$);if(Be(s)){let n={...i(this,x),httpStreamClient:s,...r},o=e instanceof B?()=>this.query(e).then(a=>a.data):e;return new Pe(o,n)}else throw new b("Streaming is not supported by this client.")}},Re=et;Oe=new WeakMap,x=new WeakMap,$=new WeakMap,A=new WeakMap,ee=new WeakMap,he=new WeakSet,Ze=async function(e,r,s=0){let n=this.clientConfiguration.max_backoff??Je.max_backoff,o=this.clientConfiguration.max_attempts??Je.max_attempts,a=Math.min(Math.random()*2**s,n)*1e3;s+=1;try{return await p(this,He,Ct).call(this,e,r,s)}catch(c){if(c instanceof M&&s<o)return await Qt(a),p(this,he,Ze).call(this,e,r,s);throw c}},Te=new WeakSet,Ke=function(e){if(e instanceof b||e instanceof g||e instanceof v||e instanceof y)return e;if(Ue(e)){if(xt(e.body)){let r=e.body,s=e.status;return X(r,s)}return new v({message:`Response is in an unkown format: ${e.body}`,httpStatus:e.status})}return new b("A client level error occurred. Fauna was not called.",{cause:e})},ve=new WeakSet,_t=function(e){let r;typeof process<"u"&&process&&typeof process=="object"&&process.env&&typeof process.env=="object"&&(r=process.env.FAUNA_SECRET);let s=e?.secret??r;if(s===void 0)throw new TypeError("You must provide a secret to the driver. Set it in an environmental variable named FAUNA_SECRET or pass it to the Client constructor.");return s},Ne=new WeakSet,Et=function(e){if(e&&"endpoint"in e&&e.endpoint===void 0)throw new TypeError("ClientConfiguration option endpoint must be defined.");let r;return typeof process<"u"&&process&&typeof process=="object"&&process.env&&typeof process.env=="object"&&(r=process.env.FAUNA_ENDPOINT?new URL(process.env.FAUNA_ENDPOINT):void 0),e?.endpoint??r??We.default},He=new WeakSet,Ct=async function(e,r,s=0){try{let n={...i(this,x),...r},o={Authorization:`Bearer ${n.secret}`};p(this,Fe,At).call(this,n,o);let a=n.format==="tagged",c=n.arguments?a?q.encode(n.arguments):n.arguments:void 0,u={query:e,arguments:c},T=n.query_timeout_ms+i(this,x).client_timeout_buffer_ms,f=await i(this,$).request({client_timeout_ms:T,data:u,headers:o,method:"POST"}),l;try{if(l={...f,body:a?q.decode(f.body,{long_type:n.long_type}):JSON.parse(f.body)},l.body.query_tags){let _=l.body.query_tags.split(",").map(E=>E.split("="));l.body.query_tags=Object.fromEntries(_)}}catch(_){throw new v({message:`Error parsing response as JSON: ${_}`,httpStatus:f.status})}if(!wt(l.body))throw p(this,Te,Ke).call(this,l);let m=l.body.txn_ts;(i(this,A)===void 0&&m!==void 0||m!==void 0&&i(this,A)!==void 0&&i(this,A)<m)&&S(this,A,m);let k=l.body;return k.stats&&(k.stats.attempts=s),k}catch(n){throw p(this,Te,Ke).call(this,n)}},Fe=new WeakSet,At=function(e,r){let s=(n,o,a=c=>String(c))=>{o!==void 0&&(r[n]=a(o))};s("x-format",e.format),s("x-typecheck",e.typecheck),s("x-query-timeout-ms",e.query_timeout_ms),s("x-linearized",e.linearized),s("x-max-contention-retries",e.max_contention_retries),s("traceparent",e.traceparent),s("x-query-tags",e.query_tags,n=>Object.entries(n).map(o=>o.join("=")).join(",")),s("x-last-txn-ts",i(this,A),n=>n),s("x-driver-env",i(et,Oe))},Ie=new WeakSet,kt=function(){let e=i(this,x);if(["client_timeout_buffer_ms","endpoint","format","http2_session_idle_ms","long_type","query_timeout_ms","fetch_keepalive","http2_max_streams","max_backoff","max_attempts"].forEach(s=>{if(e[s]===void 0)throw new TypeError(`ClientConfiguration option '${s}' must be defined.`)}),e.http2_max_streams<=0)throw new RangeError("'http2_max_streams' must be greater than zero.");if(e.client_timeout_buffer_ms<=0)throw new RangeError("'client_timeout_buffer_ms' must be greater than zero.");if(e.query_timeout_ms<=0)throw new RangeError("'query_timeout_ms' must be greater than zero.");if(e.max_backoff<=0)throw new RangeError("'max_backoff' must be greater than zero.");if(e.max_attempts<=0)throw new RangeError("'max_attempts' must be greater than zero.")},d(Re,Oe,St());var Pe=class{closed=!1;#e;#t=0;#r;#s;#n;#o;constructor(e,r){e instanceof D?this.#r=()=>Promise.resolve(e):this.#r=e,this.#e=r,this.#i()}start(e,r){if(typeof e!="function")throw new TypeError(`Expected a function as the 'onEvent' argument, but received ${typeof e}. Please provide a valid function.`);if(r&&typeof r!="function")throw new TypeError(`Expected a function as the 'onError' argument, but received ${typeof r}. Please provide a valid function.`);(async()=>{try{for await(let n of this)e(n)}catch(n){r&&r(n)}})()}async*[Symbol.asyncIterator](){if(this.closed)throw new b("The stream has been closed and cannot be reused.");for(this.#o||(this.#o=await this.#r().then(e=>{if(!(e instanceof D))throw new b(`Error requesting a stream token. Expected a StreamToken as the query result, but received ${typeof e}. Your query must return the result of '<Set>.toStream' or '<Set>.changesOn') | ||
`);n(G.map(De=>De.trim()).slice(0,-1)),c=a(),_=G[G.length-1]}),u.on("end",()=>{n([_])})}else{let _="";u.on("data",E=>{_+=E}),u.on("end",()=>{try{let E=JSON.parse(_);o(X(E,k))}catch(E){o(new g("Could not process query failure.",{cause:E}))}})}},f=this;async function*l(){var E;let m={...r,[R.constants.HTTP2_HEADER_PATH]:"/stream/1",[R.constants.HTTP2_HEADER_METHOD]:s};u=p(E=f,ye,je).call(E).request(m).setEncoding("utf8").on("error",G=>{o(G)}).on("response",T);let _=JSON.stringify(e);for(u.write(_,"utf8"),u.end();;){let G=await c;for(let De of G)yield De}}return{read:l(),close:()=>{u&&u.close()}}},d(J,_e),d(J,ae,new Map);var Le=t=>Vt()?J.getClient(t):new le(t),Ue=t=>t instanceof Object&&"body"in t&&"headers"in t&&"status"in t,Be=t=>"stream"in t&&typeof t.stream=="function",Vt=()=>{if(typeof process<"u"&&process&&process.release?.name==="node")try{return qe("node:http2"),!0}catch{return!1}return!1};var Ye=It(it());var Gt=/(?:\d{4}|[\u2212-]\d{4,}|\+\d{5,})/,zt=/(?:0[1-9]|1[0-2])/,Xt=/(?:0[1-9]|[12]\d|3[01])/,ut=/(?:[01][0-9]|2[0-3])/,ge=/(?:[0-5][0-9])/,Yt=/(?:\.\d+)/,Ge=new RegExp(`(${Gt.source}-(${zt.source})-(${Xt.source}))`),Jt=new RegExp(`(${ut.source}:${ge.source}:${ge.source}${Yt.source}?)`),Zt=new RegExp(`([zZ]|[+\u2212-]${ut.source}(?::?${ge.source}|:${ge.source}:${ge.source}))`),ct=new RegExp(`^${Ge.source}$`),dt=new RegExp(`^${Ge.source}`),lt=new RegExp(`^${Ge.source}T${Jt.source}${Zt.source}$`);var N=class{isoString;constructor(e){this.isoString=e}static from(e){if(typeof e!="string")throw new TypeError(`Expected string but received ${typeof e}: ${e}`);if(lt.exec(e)===null)throw new RangeError(`(regex) Expected an ISO date string but received '${e}'`);return new N(e)}static fromDate(e){return new N(e.toISOString())}toDate(){let e=new Date(this.isoString);if(e.toString()==="Invalid Date")throw new RangeError("Fauna Date could not be converted to Javascript Date");return e}toString(){return`TimeStub("${this.isoString}")`}},H=class{dateString;constructor(e){this.dateString=e}static from(e){if(typeof e!="string")throw new TypeError(`Expected string but received ${typeof e}: ${e}`);let r=ct.exec(e);if(r===null)throw new RangeError(`Expected a plain date string but received '${e}'`);return new H(r[0])}static fromDate(e){let r=e.toISOString(),s=dt.exec(r);if(s===null)throw new b(`Failed to parse date '${e}'`);return new H(s[0])}toDate(){let e=new Date(this.dateString+"T00:00:00Z");if(e.toString()==="Invalid Date")throw new RangeError("Fauna Date could not be converted to Javascript Date");return e}toString(){return`DateStub("${this.dateString}")`}};var j=class{coll;id;constructor({coll:e,id:r}){this.id=r,typeof e=="string"?this.coll=new L(e):this.coll=e}},ue=class extends j{ts;ttl;constructor(e){let{coll:r,id:s,ts:n,...o}=e;super({coll:r,id:s}),this.ts=n,Object.assign(this,o)}toObject(){return{...this}}},K=class{coll;name;constructor({coll:e,name:r}){this.name=r,typeof e=="string"?this.coll=new L(e):this.coll=e}},ce=class extends K{ts;data;constructor(e){let{coll:r,name:s,ts:n,data:o,...a}=e;super({coll:r,name:s}),this.ts=n,this.data=o||{},Object.assign(this,a)}toObject(){return{...this}}},L=class{name;constructor(e){this.name=e}},de=class{ref;cause;constructor(e,r){this.ref=e,this.cause=r}};var F=class{data;after;constructor({data:e,after:r}){this.data=e,this.after=r}},U=class{after;constructor(e){this.after=e}},I=class{#e;constructor(e,r,s){if(s=s??{},r instanceof Function)this.#e=er(e,r,s);else if(r instanceof F||r instanceof U)this.#e=mt(e,r,s);else throw new TypeError(`Expected 'Page<T> | EmbeddedSet | (() => Promise<T | Page<T> | EmbeddedSet>)', but received ${JSON.stringify(r)}`)}static fromQuery(e,r,s){return new I(e,async()=>(await e.query(r,s)).data,s)}static fromPageable(e,r,s){return new I(e,r,s)}flatten(){return new ze(this)}async next(){return this.#e.next()}async return(){return this.#e.return()}async throw(e){return this.#e.throw(e)}[Symbol.asyncIterator](){return this}},ze=class{#e;constructor(e){this.#e=tr(e)}async next(){return this.#e.next()}async return(){return this.#e.return()}async throw(e){return this.#e.throw(e)}[Symbol.asyncIterator](){return this}};async function*mt(t,e,r){let s=e;for(s instanceof F&&(yield s.data);s.after;){let n=Xe`Set.paginate(${s.after})`;s=(await t.query(n,r)).data,yield s.data}}async function*er(t,e,r){let s=await e();if(s instanceof F||s instanceof U){for await(let n of mt(t,s,r))yield n;return}yield[s]}async function*tr(t){for await(let e of t)for(let r of e)yield r}var D=class{token;constructor(e){this.token=e}};var q=class{static encode(e){return ke(e)}static decode(e,r){return JSON.parse(e,(s,n)=>{if(n==null)return null;if(n["@mod"])return new L(n["@mod"]);if(n["@doc"]){if(typeof n["@doc"]=="string"){let[a,c]=n["@doc"].split(":");return new j({coll:a,id:c})}let o=n["@doc"];return o.id?new ue(o):new ce(o)}else if(n["@ref"]){let o=n["@ref"],a;return o.id?a=new j(o):a=new K(o),"exists"in o&&o.exists===!1?new de(a,o.cause):a}else{if(n["@set"])return typeof n["@set"]=="string"?new U(n["@set"]):new F(n["@set"]);if(n["@int"])return Number(n["@int"]);if(n["@long"]){let o=BigInt(n["@long"]);return r.long_type==="number"?((o>Number.MAX_SAFE_INTEGER||o<Number.MIN_SAFE_INTEGER)&&console.warn("Value is too large to be represented as a number. Returning as Number with loss of precision. Use long_type 'bigint' instead."),Number(o)):o}else{if(n["@double"])return Number(n["@double"]);if(n["@date"])return H.from(n["@date"]);if(n["@time"])return N.from(n["@time"]);if(n["@object"])return n["@object"];if(n["@stream"])return new D(n["@stream"]);if(n["@bytes"])return rr(n["@bytes"])}}return n})}},yt=BigInt("-9223372036854775808"),gt=BigInt("9223372036854775807"),ft=-(2**31),pt=2**31-1,h={bigint:t=>{if(t<yt||t>gt)throw new RangeError("BigInt value exceeds max magnitude for a 64-bit Fauna long. Use a 'number' to represent doubles beyond that limit.");return t>=ft&&t<=pt?{"@int":t.toString()}:{"@long":t.toString()}},number:t=>{if(t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)throw new RangeError(`Cannot convert ${t} to a Fauna type.`);return Number.isInteger(t)?t>=ft&&t<=pt?{"@int":t.toString()}:Number.isSafeInteger(t)?{"@long":t.toString()}:{"@double":t.toString()}:{"@double":t.toString()}},string:t=>t,object:t=>{let e=!1,r={};for(let s in t)s.startsWith("@")&&(e=!0),t[s]!==void 0&&(r[s]=ke(t[s]));return e?{"@object":r}:r},array:t=>{let e=[];for(let r in t)e.push(ke(t[r]));return e},date:t=>({"@time":t.toISOString()}),faunadate:t=>({"@date":t.dateString}),faunatime:t=>({"@time":t.isoString}),module:t=>({"@mod":t.name}),documentReference:t=>({"@ref":{id:t.id,coll:{"@mod":t.coll.name}}}),document:t=>({"@ref":{id:t.id,coll:{"@mod":t.coll.name}}}),namedDocumentReference:t=>({"@ref":{name:t.name,coll:{"@mod":t.coll.name}}}),namedDocument:t=>({"@ref":{name:t.name,coll:{"@mod":t.coll.name}}}),set:t=>{throw new b("Page could not be encoded. Fauna does not accept encoded Set values, yet. Use Page.data and Page.after as arguments, instead.")},streamToken:t=>t.token,bytes:t=>({"@bytes":nr(t)})},ke=t=>{if(t===void 0)throw new TypeError("Passing undefined as a QueryValue is not supported");switch(typeof t){case"bigint":return h.bigint(t);case"string":return h.string(t);case"number":return h.number(t);case"boolean":return t;case"object":if(t==null)return null;if(Array.isArray(t))return h.array(t);if(t instanceof Date)return h.date(t);if(t instanceof H)return h.faunadate(t);if(t instanceof N)return h.faunatime(t);if(t instanceof L)return h.module(t);if(t instanceof ue)return h.document(t);if(t instanceof j)return h.documentReference(t);if(t instanceof ce)return h.namedDocument(t);if(t instanceof K)return h.namedDocumentReference(t);if(t instanceof de)return ke(t.ref);if(t instanceof F)return h.set(t);if(t instanceof U)return h.set(t);if(t instanceof D)return h.streamToken(t);if(t instanceof Uint8Array||t instanceof ArrayBuffer)return h.bytes(t);if(ArrayBuffer.isView(t))throw new b("Error encoding TypedArray to Fauna Bytes. Convert your TypedArray to Uint8Array or ArrayBuffer before passing it to Fauna. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray");return h.object(t)}};function rr(t){return Ye.default.toByteArray(t)}function nr(t){let e=t instanceof Uint8Array?t:new Uint8Array(t);return Ye.default.fromByteArray(e)}function Xe(t,...e){return new B(t,...e)}var B=class{#e;#t;constructor(e,...r){if(e.length===0||e.length!==r.length+1)throw new Error("invalid query constructed");this.#e=e,this.#t=r}toQuery(e={}){return{...this.#r(e),...e}}#r(e){if(this.#e.length===1)return{query:{fql:[this.#e[0]]},arguments:{}};let r={};return{query:{fql:this.#e.flatMap((n,o)=>{if(o===this.#e.length-1)return n===""?[]:[n];let a=this.#t[o],c;if(a instanceof B){let u=a.toQuery(e);c=u.query,r={...r,...u.arguments}}else c={value:q.encode(a)};return[n,c].filter(u=>u!=="")})},arguments:r}}};var ht="2.0.0";var Qe;try{Qe=qe("node:os")}catch{Qe=void 0}var St=()=>{let t={driver:["javascript",ht].join("-"),env:"unknown",os:"unknown",runtime:"unknown"};try{let e=typeof window>"u"&&typeof process<"u"&&process.versions!=null&&process.versions.node!=null,r=typeof window<"u"&&typeof window.document<"u",s=typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope";e?(t.runtime=["nodejs",process.version].join("-"),t.env=or(),t.os=[Qe.platform(),Qe.release()].join("-")):s?(t.runtime=Tt(navigator),t.env="Service Worker",t.os=bt(navigator)):r?(t.runtime=Tt(navigator),t.env="browser",t.os=bt(navigator)):typeof EdgeRuntime!="string"&&(t.runtime="Vercel Edge Runtime",t.env="edge")}catch{}return Object.entries(t).filter(([e,r])=>r!=="unknown").map(e=>e.join("=")).join("; ")},Tt=t=>{let e=t.appName,r=""+parseFloat(t.appVersion),s,n,o;return(n=t.userAgent.indexOf("Opera"))!=-1?(e="Opera",r=t.userAgent.substring(n+6),(n=t.userAgent.indexOf("Version"))!=-1&&(r=t.userAgent.substring(n+8))):(n=t.userAgent.indexOf("MSIE"))!=-1?(e="Microsoft Internet Explorer",r=t.userAgent.substring(n+5)):e=="Netscape"&&t.userAgent.indexOf("Trident/")!=-1?(e="Microsoft Internet Explorer",r=t.userAgent.substring(n+5),(n=t.userAgent.indexOf("rv:"))!=-1&&(r=t.userAgent.substring(n+3))):(n=t.userAgent.indexOf("Chrome"))!=-1?(e="Chrome",r=t.userAgent.substring(n+7)):(n=t.userAgent.indexOf("Safari"))!=-1?(e="Safari",r=t.userAgent.substring(n+7),(n=t.userAgent.indexOf("Version"))!=-1&&(r=t.userAgent.substring(n+8)),t.userAgent.indexOf("CriOS")!=-1&&(e="Chrome")):(n=t.userAgent.indexOf("Firefox"))!=-1?(e="Firefox",r=t.userAgent.substring(n+8)):(s=t.userAgent.lastIndexOf(" ")+1)<(n=t.userAgent.lastIndexOf("/"))&&(e=t.userAgent.substring(s,n),r=t.userAgent.substring(n+1),e.toLowerCase()==e.toUpperCase()&&(e=t.appName)),(o=r.indexOf(";"))!=-1&&(r=r.substring(0,o)),(o=r.indexOf(" "))!=-1&&(r=r.substring(0,o)),(o=r.indexOf(")"))!=-1&&(r=r.substring(0,o)),[e,r].join("-")},bt=t=>{let e="unknown",r=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 3.11",r:/Win16/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Chrome OS",r:/CrOS/},{s:"Linux",r:/(Linux|X11(?!.*CrOS))/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(Mac OS|MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/},{s:"Search Bot",r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}];for(let n in r){let o=r[n];if(o.r.test(t.userAgent)){e=o.s;break}}let s="unknown";if(/Windows/.test(e)){let n=/Windows (.*)/.exec(e);n&&(s=n[1]),e="Windows"}switch(e){case"Mac OS":case"Mac OS X":case"Android":{let n=/(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\d]+)/.exec(t.userAgent);n&&(s=n[1]);break}case"iOS":{let n=/OS (\d+)_(\d+)_?(\d+)?/.exec(t.appVersion);n&&(s=n[1]+"."+n[2]+"."+(n[3]??0));break}}return[e,s].join("-")},sr=typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,or=()=>{if(!(typeof process<"u"&&process&&process.env&&typeof process.env=="object"))return"unknown";let e=[{name:"Netlify",check:function(){return!!process.env.NETLIFY_IMAGES_CDN_DOMAIN}},{name:"Vercel",check:function(){return!!process.env.VERCEL}},{name:"Heroku",check:function(){return!!process.env.PATH&&process.env.PATH.indexOf(".heroku")!==-1}},{name:"AWS Lambda",check:function(){return!!process.env.AWS_LAMBDA_FUNCTION_VERSION}},{name:"GCP Cloud Functions",check:function(){return!!process.env._&&process.env._.indexOf("google")!==-1}},{name:"GCP Compute Instances",check:function(){return!!process.env.GOOGLE_CLOUD_PROJECT}},{name:"Azure Cloud Functions",check:function(){return!!process.env.WEBSITE_FUNCTIONS_AZUREMONITOR_CATEGORIES}},{name:"Azure Compute",check:function(){return!!process.env.ORYX_ENV_TYPE&&!!process.env.WEBSITE_INSTANCE_ID&&process.env.ORYX_ENV_TYPE==="AppService"}},{name:"Mongo Stitch",check:function(){return typeof sr?.StitchError=="function"}},{name:"Render",check:function(){return!!process.env.RENDER_SERVICE_ID}},{name:"Begin",check:function(){return!!process.env.BEGIN_DATA_SCOPE_ID}}].find(r=>r.check());return e?e.name:"unknown"};var wt=t=>t instanceof Object&&"data"in t,xt=t=>t instanceof Object&&"error"in t&&t.error instanceof Object&&"code"in t.error&&"message"in t.error;var Je={client_timeout_buffer_ms:5e3,format:"tagged",http2_session_idle_ms:5e3,http2_max_streams:100,long_type:"number",fetch_keepalive:!1,query_timeout_ms:5e3,max_attempts:3,max_backoff:20},Oe,x,$,A,ee,he,Ze,Te,Ke,ve,_t,Ne,Et,He,Ct,Fe,At,Ie,kt,et=class{constructor(e,r){d(this,he);d(this,Te);d(this,ve);d(this,Ne);d(this,He);d(this,Fe);d(this,Ie);d(this,x,void 0);d(this,$,void 0);d(this,A,void 0);d(this,ee,!1);S(this,x,{...Je,...e,secret:p(this,ve,_t).call(this,e),endpoint:p(this,Ne,Et).call(this,e)}),p(this,Ie,kt).call(this),r?S(this,$,r):S(this,$,Le({url:i(this,x).endpoint.toString(),http2_session_idle_ms:i(this,x).http2_session_idle_ms,http2_max_streams:i(this,x).http2_max_streams,fetch_keepalive:i(this,x).fetch_keepalive}))}get lastTxnTs(){return i(this,A)}set lastTxnTs(e){e!==void 0&&S(this,A,i(this,A)?Math.max(e,i(this,A)):e)}get clientConfiguration(){let{...e}=i(this,x);return e}close(){if(i(this,ee))throw new O("Your client is closed. You cannot close it again.");i(this,$).close(),S(this,ee,!0)}paginate(e,r){return e instanceof B?I.fromQuery(this,e,r):I.fromPageable(this,e,r)}async query(e,r){if(i(this,ee))throw new O("Your client is closed. No further requests can be issued.");let s=e.toQuery(r).query;return p(this,he,Ze).call(this,s,r)}stream(e,r){if(i(this,ee))throw new O("Your client is closed. No further requests can be issued.");let s=i(this,$);if(Be(s)){let n={...i(this,x),httpStreamClient:s,...r},o=e instanceof B?()=>this.query(e).then(a=>a.data):e;return new Pe(o,n)}else throw new b("Streaming is not supported by this client.")}},Re=et;Oe=new WeakMap,x=new WeakMap,$=new WeakMap,A=new WeakMap,ee=new WeakMap,he=new WeakSet,Ze=async function(e,r,s=0){let n=this.clientConfiguration.max_backoff??Je.max_backoff,o=this.clientConfiguration.max_attempts??Je.max_attempts,a=Math.min(Math.random()*2**s,n)*1e3;s+=1;try{return await p(this,He,Ct).call(this,e,r,s)}catch(c){if(c instanceof M&&s<o)return await Qt(a),p(this,he,Ze).call(this,e,r,s);throw c}},Te=new WeakSet,Ke=function(e){if(e instanceof b||e instanceof g||e instanceof v||e instanceof y)return e;if(Ue(e)){if(xt(e.body)){let r=e.body,s=e.status;return X(r,s)}return new v({message:`Response is in an unkown format: ${e.body}`,httpStatus:e.status})}return new b("A client level error occurred. Fauna was not called.",{cause:e})},ve=new WeakSet,_t=function(e){let r;typeof process<"u"&&process&&typeof process=="object"&&process.env&&typeof process.env=="object"&&(r=process.env.FAUNA_SECRET);let s=e?.secret??r;if(s===void 0)throw new TypeError("You must provide a secret to the driver. Set it in an environmental variable named FAUNA_SECRET or pass it to the Client constructor.");return s},Ne=new WeakSet,Et=function(e){if(e&&"endpoint"in e&&e.endpoint===void 0)throw new TypeError("ClientConfiguration option endpoint must be defined.");let r;return typeof process<"u"&&process&&typeof process=="object"&&process.env&&typeof process.env=="object"&&(r=process.env.FAUNA_ENDPOINT?new URL(process.env.FAUNA_ENDPOINT):void 0),e?.endpoint??r??We.default},He=new WeakSet,Ct=async function(e,r,s=0){try{let n={...i(this,x),...r},o={Authorization:`Bearer ${n.secret}`};p(this,Fe,At).call(this,n,o);let a=n.format==="tagged",c=n.arguments?a?q.encode(n.arguments):n.arguments:void 0,u={query:e,arguments:c},T=n.query_timeout_ms+i(this,x).client_timeout_buffer_ms,f=await i(this,$).request({client_timeout_ms:T,data:u,headers:o,method:"POST"}),l;try{if(l={...f,body:a?q.decode(f.body,{long_type:n.long_type}):JSON.parse(f.body)},l.body.query_tags){let _=l.body.query_tags.split(",").map(E=>E.split("="));l.body.query_tags=Object.fromEntries(_)}}catch(_){throw new v({message:`Error parsing response as JSON: ${_}`,httpStatus:f.status})}if(!wt(l.body))throw p(this,Te,Ke).call(this,l);let m=l.body.txn_ts;(i(this,A)===void 0&&m!==void 0||m!==void 0&&i(this,A)!==void 0&&i(this,A)<m)&&S(this,A,m);let k=l.body;return k.stats&&(k.stats.attempts=s),k}catch(n){throw p(this,Te,Ke).call(this,n)}},Fe=new WeakSet,At=function(e,r){let s=(n,o,a=c=>String(c))=>{o!==void 0&&(r[n]=a(o))};s("x-format",e.format),s("x-typecheck",e.typecheck),s("x-query-timeout-ms",e.query_timeout_ms),s("x-linearized",e.linearized),s("x-max-contention-retries",e.max_contention_retries),s("traceparent",e.traceparent),s("x-query-tags",e.query_tags,n=>Object.entries(n).map(o=>o.join("=")).join(",")),s("x-last-txn-ts",i(this,A),n=>n),s("x-driver-env",i(et,Oe))},Ie=new WeakSet,kt=function(){let e=i(this,x);if(["client_timeout_buffer_ms","endpoint","format","http2_session_idle_ms","long_type","query_timeout_ms","fetch_keepalive","http2_max_streams","max_backoff","max_attempts"].forEach(s=>{if(e[s]===void 0)throw new TypeError(`ClientConfiguration option '${s}' must be defined.`)}),e.http2_max_streams<=0)throw new RangeError("'http2_max_streams' must be greater than zero.");if(e.client_timeout_buffer_ms<=0)throw new RangeError("'client_timeout_buffer_ms' must be greater than zero.");if(e.query_timeout_ms<=0)throw new RangeError("'query_timeout_ms' must be greater than zero.");if(e.max_backoff<=0)throw new RangeError("'max_backoff' must be greater than zero.");if(e.max_attempts<=0)throw new RangeError("'max_attempts' must be greater than zero.")},d(Re,Oe,St());var Pe=class{closed=!1;#e;#t=0;#r;#s;#n;#o;constructor(e,r){e instanceof D?this.#r=()=>Promise.resolve(e):this.#r=e,this.#e=r,this.#i()}start(e,r){if(typeof e!="function")throw new TypeError(`Expected a function as the 'onEvent' argument, but received ${typeof e}. Please provide a valid function.`);if(r&&typeof r!="function")throw new TypeError(`Expected a function as the 'onError' argument, but received ${typeof r}. Please provide a valid function.`);(async()=>{try{for await(let n of this)e(n)}catch(n){r&&r(n)}})()}async*[Symbol.asyncIterator](){if(this.closed)throw new b("The stream has been closed and cannot be reused.");for(this.#o||(this.#o=await this.#r().then(e=>{if(!(e instanceof D))throw new b(`Error requesting a stream token. Expected a StreamToken as the query result, but received ${typeof e}. Your query must return the result of '<Set>.toStream' or '<Set>.changesOn') | ||
Query result: ${JSON.stringify(e,null)}`);return e})),this.#t=1;!this.closed;){let e=Math.min(Math.random()*2**this.#t,this.#e.max_backoff)*1e3;try{for await(let r of this.#a(this.#s))yield r}catch(r){if(r instanceof Q||this.#t>=this.#e.max_attempts)throw this.close(),r;this.#t+=1,await Qt(e)}}}close(){this.#n&&(this.#n.close(),this.#n=void 0),this.closed=!0}get last_ts(){return this.#s}async*#a(e){let r=this.#o,s={Authorization:`Bearer ${this.#e.secret}`},n=this.#e.httpStreamClient.stream({data:{token:r.token,start_ts:e},headers:s,method:"POST"});this.#n=n;for await(let o of n.read){let a=q.decode(o,{long_type:this.#e.long_type});if(a.type==="error")throw this.close(),X(a);this.#s=a.txn_ts,a.type==="start"&&(a.type="status"),!(!this.#e.status_events&&a.type==="status")&&(yield a)}}#i(){let e=this.#e;if(["long_type","httpStreamClient","max_backoff","max_attempts","secret"].forEach(s=>{if(e[s]===void 0)throw new TypeError(`ClientConfiguration option '${s}' must be defined.`)}),e.max_backoff<=0)throw new RangeError("'max_backoff' must be greater than zero.");if(e.max_attempts<=0)throw new RangeError("'max_attempts' must be greater than zero.")}};function Qt(t){return new Promise(e=>setTimeout(e,t))}export{Se as AbortError,re as AuthenticationError,ne as AuthorizationError,Re as Client,O as ClientClosedError,b as ClientError,be as ConstraintFailureError,we as ContendedTransactionError,H as DateStub,ue as Document,j as DocumentReference,U as EmbeddedSet,Q as FaunaError,le as FetchClient,z as InvalidRequestError,gt as LONG_MAX,yt as LONG_MIN,L as Module,ce as NamedDocument,K as NamedDocumentReference,g as NetworkError,J as NodeHTTP2Client,de as NullDocument,F as Page,v as ProtocolError,V as QueryCheckError,te as QueryRuntimeError,se as QueryTimeoutError,y as ServiceError,oe as ServiceInternalError,I as SetIterator,Pe as StreamClient,D as StreamToken,q as TaggedTypeFormat,M as ThrottlingError,N as TimeStub,We as endpoints,Xe as fql,Le as getDefaultHTTPClient,Ue as isHTTPResponse,Be as isStreamClient}; | ||
//# sourceMappingURL=index.js.map |
/** The current package version. */ | ||
export declare const packageVersion = "2.0.0-beta.0"; | ||
export declare const packageVersion = "2.0.0"; |
{ | ||
"name": "fauna", | ||
"version": "2.0.0-beta.0", | ||
"version": "2.0.0", | ||
"description": "A driver to query Fauna databases in browsers, Node.js, and other Javascript runtimes", | ||
@@ -5,0 +5,0 @@ "homepage": "https://fauna.com", |
504
README.md
@@ -1,4 +0,4 @@ | ||
# The Official Javascript Driver for [Fauna](https://fauna.com). | ||
# The Official JavaScript Driver for [Fauna](https://fauna.com). | ||
[![Npm Version](https://img.shields.io/npm/v/fauna.svg?maxAge=21600)](https://www.npmjs.com/package/fauna) | ||
[![npm Version](https://img.shields.io/npm/v/fauna.svg?maxAge=21600)](https://www.npmjs.com/package/fauna) | ||
[![License](https://img.shields.io/badge/license-MPL_2.0-blue.svg?maxAge=2592000)](https://raw.githubusercontent.com/fauna/fauna-js/main/LICENSE) | ||
@@ -13,53 +13,105 @@ | ||
- [The Official Javascript Driver for Fauna.](#the-official-javascript-driver-for-fauna) | ||
- [Quick-Start](#quick-start) | ||
- [Supported Runtimes](#supported-runtimes) | ||
- [Installation](#installation) | ||
- [Package Manager](#package-manager) | ||
- [Via CDN](#via-cdn) | ||
- [Usage](#usage) | ||
- [Creating queries with the `fql` function](#creating-queries-with-the-fql-function) | ||
- [Connecting from the browser](#connecting-from-the-browser) | ||
- [Importing into a bundled project](#importing-into-a-bundled-project) | ||
- [Typescript Support](#typescript-support) | ||
- [Query Options](#query-options) | ||
- [Client Configuration](#client-configuration) | ||
- [The Official JavaScript Driver for Fauna.](#the-official-javascript-driver-for-fauna) | ||
- [Supported runtimes](#supported-runtimes) | ||
- [Install](#install) | ||
- [Usage](#usage) | ||
- [Write FQL queries](#write-fql-queries) | ||
- [Typescript support](#typescript-support) | ||
- [Query options](#query-options) | ||
- [Query statistics](#query-statistics) | ||
- [Pagination](#pagination) | ||
- [Client configuration](#client-configuration) | ||
- [Environment variables](#environment-variables) | ||
- [Retry](#retry) | ||
- [Max Attempts](#max-attempts) | ||
- [Max Backoff](#max-backoff) | ||
- [Max attempts](#max-attempts) | ||
- [Max backoff](#max-backoff) | ||
- [Timeouts](#timeouts) | ||
- [Query Timeout](#query-timeout) | ||
- [Client Timeout](#client-timeout) | ||
- [HTTP/2 Session Idle Timeout](#http2-session-idle-timeout) | ||
- [Using environment variables](#using-environment-variables) | ||
- [Query Statistics](#query-statistics) | ||
- [Streaming](#streaming) | ||
- [Contributing](#contributing) | ||
- [Setting up this Repo](#setting-up-this-repo) | ||
- [Running tests](#running-tests) | ||
- [Linting your code](#linting-your-code) | ||
- [License](#license) | ||
- [Query timeout](#query-timeout) | ||
- [Client timeout](#client-timeout) | ||
- [HTTP/2 session idle timeout](#http2-session-idle-timeout) | ||
- [Event Streaming](#event-streaming) | ||
- [Start a stream](#start-a-stream) | ||
- [Iterate on a stream](#iterate-on-a-stream) | ||
- [Close a stream](#close-a-stream) | ||
- [Stream options](#stream-options) | ||
- [Contributing](#contributing) | ||
- [Set up the repo](#set-up-the-repo) | ||
- [Run tests](#run-tests) | ||
- [Lint your code](#lint-your-code) | ||
- [License](#license) | ||
</details> | ||
# Quick-Start | ||
## Supported runtimes | ||
**Server-side** | ||
Node.js - [Current and active LTS versions](https://nodejs.org/en/about/releases/): | ||
- Current - v20 | ||
- LTS - v18 | ||
**Cloud providers** | ||
- Cloudflare Workers | ||
- AWS Lambda | ||
- Netlify | ||
- Vercel | ||
**Browsers** | ||
Stable versions of: | ||
- Chrome 69+ | ||
- Firefox 62+ | ||
- Safari 12.1+ | ||
- Edge 79+ | ||
## Install | ||
The driver is available on [npm](https://www.npmjs.com/package/fauna). You | ||
can install it using your preferred package manager. For example: | ||
```shell | ||
npm install fauna | ||
``` | ||
Browsers can import the driver using a CDN link: | ||
```html | ||
<script type="module"> | ||
import * as fauna from "https://cdn.jsdelivr.net/npm/fauna@latest/dist/browser/index.js"; | ||
</script> | ||
``` | ||
## Usage | ||
By default, the driver's `Client` instance authenticates with Fauna using an | ||
access token in the `FAUNA_SECRET` environment variable. If needed, you can pass | ||
the token to the client using the `secret` argument instead. | ||
```javascript | ||
import { Client, fql, FaunaError } from "fauna"; | ||
// Use `require` for CommonJS: | ||
// const { Client, fql, FaunaError } = require('fauna'); | ||
// configure your client | ||
const client = new Client({ | ||
secret: YOUR_FAUNA_SECRET, | ||
}); | ||
const client = new Client(); | ||
// To configure your client: | ||
// const client = new Client({ | ||
// secret: YOUR_FAUNA_SECRET, | ||
// }); | ||
try { | ||
// build queries using the `fql` function | ||
// Build a query using the `fql` method | ||
const collectionQuery = fql`Collection.create({ name: "Dogs" })`; | ||
// execute the query | ||
// Run the query | ||
const collectionResponse = await client.query(collectionQuery); | ||
// define some data in your app | ||
// Declare a var for app data | ||
const dog = { name: "Scout" }; | ||
// query using your app's local variables | ||
// Build a query using the var | ||
const documentQuery = fql` | ||
@@ -73,10 +125,11 @@ Dogs.create(${dog}) { | ||
// execute the query | ||
// Run the query | ||
const response = await client.query(documentQuery); | ||
console.log(response); | ||
} catch (error) { | ||
if (error instanceof FaunaError) { | ||
// handle errors | ||
console.log(error); | ||
} | ||
} finally { | ||
// clean up any remaining resources | ||
// Clean up any remaining resources | ||
client.close(); | ||
@@ -86,49 +139,5 @@ } | ||
# Supported Runtimes | ||
This Driver supports and is tested on: | ||
### Write FQL queries | ||
- Browsers - Stable versions of | ||
- Chrome 69+ | ||
- Firefox 62+ | ||
- Safari 12.1+ | ||
- Edge 79+ | ||
- Node.js - [Current and Active LTS](https://nodejs.org/en/about/releases/) | ||
- Current - v20 | ||
- LTS - v18 | ||
- Cloudflare Workers | ||
- AWS Lambda | ||
- Netlify | ||
- Vercel | ||
# Installation | ||
## Package Manager | ||
The fauna-js driver is available on npm. You can install with your package manager of choice: | ||
```shell | ||
npm install fauna@beta | ||
``` | ||
or | ||
```shell | ||
yarn add fauna@beta | ||
``` | ||
## Via CDN | ||
The driver is additionally made available to browsers via CDN: | ||
```html | ||
<script type="module"> | ||
import * as fauna from "https://cdn.jsdelivr.net/npm/fauna@latest/dist/browser/index.js"; | ||
</script> | ||
``` | ||
# Usage | ||
## Creating queries with the `fql` function | ||
The `fql` function is your gateway to building safe, reuseable Fauna queries. | ||
@@ -138,5 +147,5 @@ | ||
for example: | ||
For example: | ||
```typescript | ||
```javascript | ||
import { Client, fql } from "fauna"; | ||
@@ -149,17 +158,18 @@ | ||
// a reusable sub-query to determine if a collection exists | ||
// Build a reusable sub-query to determine if a collection exists | ||
const collectionExists = (name) => fql`Collection.byName(${name}) != null`; | ||
// define a new query that uses the prior sub-query | ||
// Build query that uses the previous var and sub-query | ||
const upsertCollectionQuery = fql` | ||
if (${collectionExists(collectionName)}) { | ||
"Collection exists!" | ||
"Collection already exists" | ||
} else { | ||
Collection.create({ name: ${collectionName} }) | ||
"Collection exists now!" | ||
"Collection created" | ||
} | ||
`; | ||
// execute the query | ||
// Run the query | ||
const response = await client.query(upsertCollectionQuery); | ||
console.log(response.data); | ||
@@ -175,36 +185,9 @@ client.close(); | ||
## Connecting from the browser | ||
```html | ||
<html> | ||
<head></head> | ||
<body> | ||
<h1>Test</h1> | ||
</body> | ||
<script type="module"> | ||
import * as fauna from "https://cdn.jsdelivr.net/npm/fauna@latest/dist/browser/index.js"; | ||
### Typescript support | ||
/* ... */ | ||
</script> | ||
</html> | ||
``` | ||
## Importing into a bundled project | ||
```javascript | ||
import * as fauna from "fauna"; | ||
``` | ||
or using `require` for CommonJS files | ||
```javascript | ||
const fauna = require("fauna"); | ||
``` | ||
## Typescript Support | ||
With TypeScript, you can apply a type parameter to your result. | ||
```typescript | ||
import { Client, fql } from "fauna"; | ||
import { fql, Client, type QuerySuccess } from "fauna"; | ||
@@ -232,6 +215,8 @@ const client = new Client(); | ||
## Query Options | ||
Options are available to configure queries on each request. | ||
### Query options | ||
Options are available to configure queries on each request. These override any | ||
default query options in the [client configuration](#client-configuration). | ||
```typescript | ||
@@ -255,2 +240,3 @@ import { fql, Client, type QueryOptions } from "fauna"; | ||
const response = await client.query(fql`"Hello, #{name}!"`, options); | ||
console.log(response.data) | ||
@@ -260,15 +246,96 @@ client.close(); | ||
## Client Configuration | ||
The driver use's a default ClientConfiguration. We recommend most users stick with the defaults. | ||
### Query statistics | ||
If your environment needs different configuration however, the default ClientConfiguration can be overridden. | ||
Query statistics are returned with successful query responses and errors of | ||
the `ServiceError` type. | ||
Furthermore, on each request you can provide query specific configuration that will override the setting in your client for that request only. | ||
```typescript | ||
import { | ||
fql, | ||
Client, | ||
ServiceError, | ||
type QueryInfo, | ||
type QueryStats, | ||
type QuerySuccess, | ||
} from "fauna"; | ||
const client = new Client(); | ||
try { | ||
const response: QuerySuccess<string> = await client.query<string>( | ||
fql`"Hello world"` | ||
); | ||
const stats: QueryStats | undefined = response.stats; | ||
console.log(stats); | ||
} catch (error: any) { | ||
if (error instanceof ServiceError) { | ||
const info: QueryInfo = error.queryInfo; | ||
const stats: QueryStats | undefined = info.stats; | ||
} | ||
} | ||
``` | ||
Example output: | ||
```javascript | ||
{ | ||
compute_ops: 1, | ||
read_ops: 0, | ||
write_ops: 0, | ||
query_time_ms: 15, | ||
storage_bytes_read: 0, | ||
storage_bytes_write: 0, | ||
contention_retries: 0 | ||
} | ||
``` | ||
## Pagination | ||
Use the `Client.paginate()` method to iterate sets that contain more than one page of results. | ||
`Client.paginate()` accepts the same [query options](#query-options) as | ||
`Client.query()`. | ||
Change the default items per page using FQL's `<set>.pageSize()` method. | ||
```typescript | ||
import { fql, Client, type SetIterator, type QueryValue } from "fauna"; | ||
const client = new Client(); | ||
// Adjust `pageSize()` size as needed. | ||
const query = fql` | ||
Product | ||
.byName("limes") | ||
.pageSize(60) { description }`; | ||
const options = { | ||
query_timeout_ms: 60_000, | ||
}; | ||
const pages: SetIterator<QueryValue> = client.paginate(query, options); | ||
for await (const products of pages) { | ||
for (const product of products) { | ||
console.log(product) | ||
} | ||
} | ||
client.close(); | ||
``` | ||
## Client configuration | ||
The driver's `Client` instance comes with reasonable defaults that should be | ||
used in most cases. Yu can override these defaults if needed. | ||
In addition to configuring the client, you can also set default [query | ||
options](#query-options). | ||
```typescript | ||
import { Client, endpoints, type ClientConfiguration } from "fauna"; | ||
const config: ClientConfiguration = { | ||
// configure client | ||
// Configure the client | ||
client_timeout_buffer_ms: 5000, | ||
@@ -281,3 +348,3 @@ endpoint: endpoints.default, | ||
// set default query options | ||
// Set default query options | ||
format: "tagged", | ||
@@ -298,6 +365,26 @@ long_type: "number", | ||
### Environment variables | ||
The driver will default to configuring your client with the values of the `FAUNA_SECRET` and `FAUNA_ENDPOINT` environment variable. | ||
For example, if you set the following environment variables: | ||
```shell | ||
export FAUNA_SECRET=YOUR_FAUNA_SECRET | ||
export FAUNA_ENDPOINT=https://db.fauna.com/ | ||
``` | ||
You can initalize the client with a default configuration: | ||
```javascript | ||
const client = new Client(); | ||
``` | ||
### Retry | ||
#### Max Attempts | ||
#### Max attempts | ||
The maximum number of times a query will be attempted if a retryable exception is thrown (ThrottlingError). Default 3, inclusive of the initial call. The retry strategy implemented is a simple exponential backoff. | ||
@@ -307,6 +394,8 @@ | ||
#### Max Backoff | ||
#### Max backoff | ||
The maximum backoff in seconds to be observed between each retry. Default 20 seconds. | ||
### Timeouts | ||
@@ -316,4 +405,5 @@ | ||
#### Query Timeout | ||
#### Query timeout | ||
The query timeout is the time, in milliseconds, that Fauna will spend executing your query before aborting with a 503 Timeout error. If a query timeout occurs, the driver will throw an instance of `ServiceTimeoutError`. | ||
@@ -333,4 +423,5 @@ | ||
#### Client Timeout | ||
#### Client timeout | ||
The client timeout is the time, in milliseconds, that the client will wait for a network response before canceling the request. If a client timeout occurs, the driver will throw an instance of `NetworkError`. | ||
@@ -344,4 +435,5 @@ | ||
#### HTTP/2 Session Idle Timeout | ||
#### HTTP/2 session idle timeout | ||
The HTTP/2 session idle timeout is the time, in milliseconds, that an HTTP/2 session will remain open after there is no more pending communication. Once the session idle time has elapsed the session is considered idle and the session is closed. Subsequent requests will create a new session; the session idle timeout does not result in an error. | ||
@@ -363,73 +455,20 @@ | ||
### Using environment variables | ||
## Event Streaming | ||
The driver will default to configuring your client with the values of the `FAUNA_SECRET` and `FAUNA_ENDPOINT` environment variable. | ||
The driver supports [Event Streaming](https://docs.fauna.com/fauna/current/learn/streaming). | ||
For example, if you set the following environment variables: | ||
### Start a stream | ||
```shell | ||
export FAUNA_SECRET=YOUR_FAUNA_SECRET | ||
export FAUNA_ENDPOINT=https://db.fauna.com/ | ||
``` | ||
To get a stream token, append | ||
[`toStream()`](https://docs.fauna.com/fauna/current/reference/reference/schema_entities/set/tostream) | ||
or | ||
[`changesOn()`](https://docs.fauna.com/fauna/current/reference/reference/schema_entities/set/changeson) | ||
to a set from a [supported | ||
source](https://docs.fauna.com/fauna/current/reference/streaming_reference/#supported-sources). | ||
you can create a client without additional options | ||
To start and subscribe to the stream, pass the stream token to `Client.stream()`: | ||
```javascript | ||
const client = new Client(); | ||
``` | ||
## Query Statistics | ||
Query statistics are returned with successful query responses and `ServiceError`s. | ||
````typescript | ||
import { | ||
fql, | ||
Client, | ||
ServiceError, | ||
type QueryInfo, | ||
type QueryStats, | ||
type QuerySuccess, | ||
} from "fauna"; | ||
const client = new Client(); | ||
try { | ||
const response: QuerySuccess<string> = await client.query<string>( | ||
fql`"Hello world"` | ||
); | ||
const stats: QueryStats | undefined = response.stats; | ||
console.log(stats); | ||
} catch (error: any) { | ||
if (error instanceof ServiceError) { | ||
const info: QueryInfo = error.queryInfo; | ||
const stats: QueryStats | undefined = info.stats; | ||
} | ||
} | ||
/* example output | ||
* ``` | ||
* { | ||
* compute_ops: 1, | ||
* read_ops: 0, | ||
* write_ops: 0, | ||
* query_time_ms: 15, | ||
* storage_bytes_read: 0, | ||
* storage_bytes_write: 0, | ||
* contention_retries: 0 | ||
* } | ||
* ``` | ||
*/ | ||
```` | ||
## Streaming | ||
Obtain a stream token using a regular query with either the `toStream()` or `changesOn()` FQL methods on a Set. | ||
```javascript | ||
import { Client, fql } from "fauna" | ||
const client = new Client({ secret: FAUNA_SECRET }) | ||
const response = await client.query(fql` | ||
let set = MyCollection.all() | ||
let set = Product.all() | ||
@@ -443,19 +482,17 @@ { | ||
const stream = client.stream(streamToken) | ||
client.stream(streamToken) | ||
``` | ||
The driver will take care of the initial request to convert to a stream if you provide a Query | ||
You can also pass a query that produces a stream token directly to `Client.stream()`: | ||
```javascript | ||
import { Client, fql } from "fauna" | ||
const client = new Client({ secret: FAUNA_SECRET }) | ||
const query = fql`Product.all().changesOn(.price, .quantity)` | ||
const stream = await client.stream(fql`MyCollection.all().changesOn(.field1, .field2)`) | ||
client.stream(query) | ||
``` | ||
There are two Two ways to initiate the stream: | ||
1. Async Iterator | ||
2. Callbacks | ||
### Iterate on a stream | ||
_Async Iterator example_ | ||
You can iterate on the stream using an async loop: | ||
```javascript | ||
@@ -482,3 +519,4 @@ try { | ||
_Callbacks example_ | ||
Or you can use a callback function: | ||
```javascript | ||
@@ -506,10 +544,7 @@ stream.start( | ||
_Close a stream_ | ||
### Close a stream | ||
Use the `<stream>.close()` method to close a stream. | ||
Use `<stream>.close()` to close a stream: | ||
```javascript | ||
import { Client, fql } from "fauna" | ||
const client = new Client() | ||
const stream = await client.stream(fql`Product.all().toStream()`) | ||
@@ -519,4 +554,4 @@ | ||
for await (const event of stream) { | ||
console.log(event.type) | ||
console.log(event.data) | ||
console.log("Stream event:", event); | ||
// ... | ||
count++; | ||
@@ -526,3 +561,2 @@ | ||
if (count === 2) { | ||
console.log("Closing the stream ...") | ||
stream.close() | ||
@@ -532,8 +566,30 @@ break; | ||
} | ||
``` | ||
client.close(); | ||
### Stream options | ||
The [client configuration](#client-configuration) sets default options for the | ||
`Client.stream()` method. | ||
You can pass an `options` object to override these defaults: | ||
```javascript | ||
const options = { | ||
long_type: "number", | ||
max_attempts: 5, | ||
max_backoff: 1000, | ||
secret: "YOUR_FAUNA_SECRET", | ||
status_events: true, | ||
}; | ||
client.stream(fql`Product.all().toStream()`, options) | ||
``` | ||
# Contributing | ||
For supported properties, see [Stream | ||
options](https://docs.fauna.com/fauna/current/drivers/js-client#stream-options) | ||
in the Fauna docs. | ||
## Contributing | ||
Any contributions are from the community are greatly appreciated! | ||
@@ -545,14 +601,17 @@ | ||
## Setting up this Repo | ||
### Set up the repo | ||
1. Clone the repository; e.g. `gh repo clone fauna/fauna-js` if you use the GitHub CLI | ||
2. Install dependencies via `yarn install` | ||
## Running tests | ||
### Run tests | ||
1. Start a docker desktop or other docker platform. | ||
2. Run `yarn test`. This will start local fauna containers, verify they're up and run all tests. | ||
## Linting your code | ||
### Lint your code | ||
Linting runs automatically on each commit. | ||
@@ -562,4 +621,5 @@ | ||
# License | ||
## License | ||
Distributed under the MPL 2.0 License. See [LICENSE](./LICENSE) for more information. |
@@ -365,3 +365,3 @@ import type { | ||
case "throttle": | ||
case "limit_exceeded": | ||
return new ThrottlingError(failure, httpStatus); | ||
@@ -368,0 +368,0 @@ |
@@ -15,3 +15,3 @@ import { FetchClient } from "./fetch-client"; | ||
export const getDefaultHTTPClient = ( | ||
options: HTTPClientOptions | ||
options: HTTPClientOptions, | ||
): HTTPClient & HTTPStreamClient => | ||
@@ -26,3 +26,3 @@ nodeHttp2IsSupported() | ||
export const isStreamClient = ( | ||
client: Partial<HTTPStreamClient> | ||
client: Partial<HTTPStreamClient>, | ||
): client is HTTPStreamClient => { | ||
@@ -29,0 +29,0 @@ return "stream" in client && typeof client.stream === "function"; |
//THIS FILE IS AUTOGENERATED. DO NOT EDIT. SEE .husky/pre-commit | ||
/** The current package version. */ | ||
export const packageVersion = "2.0.0-beta.0"; | ||
export const packageVersion = "2.0.0"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
638602
0
602