UNPKG

fauna

Version:

A driver to query Fauna databases in browsers, Node.js, and other Javascript runtimes

7 lines (6 loc) 38.9 kB
var or=Object.create;var Pt=Object.defineProperty;var ar=Object.getOwnPropertyDescriptor;var ir=Object.getOwnPropertyNames;var ur=Object.getPrototypeOf,cr=Object.prototype.hasOwnProperty;var at=(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 dr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var lr=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ir(e))!cr.call(t,n)&&n!==r&&Pt(t,n,{get:()=>e[n],enumerable:!(s=ar(e,n))||s.enumerable});return t};var mr=(t,e,r)=>(r=t!=null?or(ur(t)):{},lr(e||!t||!t.__esModule?Pt(r,"default",{value:t,enumerable:!0}):r,t));var it=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var a=(t,e,r)=>(it(t,e,"read from private field"),r?r.call(t):e.get(t)),u=(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)},p=(t,e,r,s)=>(it(t,e,"write to private field"),s?s.call(t,r):e.set(t,r),r),ut=(t,e,r,s)=>({set _(n){p(t,e,n,r)},get _(){return a(t,e,s)}}),m=(t,e,r)=>(it(t,e,"access private method"),r);var kt=dr(je=>{"use strict";je.byteLength=hr;je.toByteArray=br;je.fromByteArray=xr;var I=[],C=[],yr=typeof Uint8Array<"u"?Uint8Array:Array,pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ne=0,Ft=pt.length;ne<Ft;++ne)I[ne]=pt[ne],C[pt.charCodeAt(ne)]=ne;var ne,Ft;C["-".charCodeAt(0)]=62;C["_".charCodeAt(0)]=63;function Ot(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 hr(t){var e=Ot(t),r=e[0],s=e[1];return(r+s)*3/4-s}function Tr(t,e,r){return(e+r)*3/4-r}function br(t){var e,r=Ot(t),s=r[0],n=r[1],o=new yr(Tr(t,s,n)),i=0,d=n>0?s-4:s,c;for(c=0;c<d;c+=4)e=C[t.charCodeAt(c)]<<18|C[t.charCodeAt(c+1)]<<12|C[t.charCodeAt(c+2)]<<6|C[t.charCodeAt(c+3)],o[i++]=e>>16&255,o[i++]=e>>8&255,o[i++]=e&255;return n===2&&(e=C[t.charCodeAt(c)]<<2|C[t.charCodeAt(c+1)]>>4,o[i++]=e&255),n===1&&(e=C[t.charCodeAt(c)]<<10|C[t.charCodeAt(c+1)]<<4|C[t.charCodeAt(c+2)]>>2,o[i++]=e>>8&255,o[i++]=e&255),o}function Sr(t){return I[t>>18&63]+I[t>>12&63]+I[t>>6&63]+I[t&63]}function wr(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(Sr(s));return n.join("")}function xr(t){for(var e,r=t.length,s=r%3,n=[],o=16383,i=0,d=r-s;i<d;i+=o)n.push(wr(t,i,i+o>d?d:i+o));return s===1?(e=t[r-1],n.push(I[e>>2]+I[e<<4&63]+"==")):s===2&&(e=(t[r-2]<<8)+t[r-1],n.push(I[e>>10]+I[e>>4&63]+I[e<<2&63]+"=")),n.join("")}});var ct={default:new URL("https://db.fauna.com"),local:new URL("http://localhost:8443"),localhost:new URL("http://localhost:8443")};var F=class extends Error{constructor(...e){super(...e)}},b=class extends F{httpStatus;code;queryInfo;constraint_failures;constructor(e,r){super(e.error.message),Error.captureStackTrace&&Error.captureStackTrace(this,b),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}},ie=class extends b{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,ie),this.name="QueryRuntimeError"}},Y=class extends b{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,Y),this.name="QueryCheckError"}},ee=class extends b{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,ee),this.name="InvalidRequestError"}},Oe=class extends b{constraint_failures;constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,Y),this.name="ConstraintFailureError",this.constraint_failures=e.error.constraint_failures}},ke=class extends b{abort;constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,Y),this.name="AbortError",this.abort=e.error.abort}},ue=class extends b{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,ue),this.name="AuthenticationError"}},ce=class extends b{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,ce),this.name="AuthorizationError"}},He=class extends b{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,ee),this.name="ContendedTransactionError"}},j=class extends b{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,j),this.name="ThrottlingError"}},de=class extends b{stats;constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,de),this.name="QueryTimeoutError",this.stats=e.stats}},le=class extends b{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,le),this.name="ServiceInternalError"}},h=class extends F{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,h),this.name="ClientError"}},O=class extends F{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,O),this.name="ClientClosedError"}},E=class extends F{constructor(e,r){super(e,r),Error.captureStackTrace&&Error.captureStackTrace(this,E),this.name="NetworkError"}},v=class extends F{httpStatus;constructor(e){super(e.message),Error.captureStackTrace&&Error.captureStackTrace(this,v),this.name="ProtocolError",this.httpStatus=e.httpStatus}},k=(t,e)=>{switch(t.error.code){case"invalid_query":return new Y(t,e);case"invalid_request":return new ee(t,e);case"abort":if(t.error.abort!==void 0)return new ke(t,e);break;case"constraint_failure":if(t.error.constraint_failures!==void 0)return new Oe(t,e);break;case"unauthorized":return new ue(t,e);case"forbidden":return new ce(t,e);case"contended_transaction":return new He(t,e);case"limit_exceeded":return new j(t,e);case"time_out":return new de(t,e);case"internal_error":return new le(t,e)}return new ie(t,e)};var A={QUERY:"/query/1",STREAM:"/stream/1",EVENT_FEED:"/feed/1"};var we=class{#e;#t=A.QUERY;#r=A.STREAM;#n;constructor({url:e,fetch_keepalive:r}){this.#e=e,this.#n=r}#s(e){return new URL(e,this.#e).toString()}async request({data:e,headers:r,method:s,client_timeout_ms:n,path:o=this.#t}){let i=AbortSignal.timeout===void 0?(()=>{let g=new AbortController,x=g.signal;return setTimeout(()=>g.abort(),n),x})():AbortSignal.timeout(n),d=await fetch(this.#s(o),{method:s,headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),signal:i,keepalive:this.#n}).catch(g=>{throw new E("The network connection encountered a problem.",{cause:g})}),c=d.status,l={};d.headers.forEach((g,x)=>l[x]=g);let f=await d.text();return{status:c,body:f,headers:l}}stream({data:e,headers:r,method:s,path:n=this.#r}){let o=new Request(this.#s(n),{method:s,headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:this.#n}),i=new AbortController,d={signal:i.signal};async function*c(){let l=await fetch(o,d).catch(y=>{throw new E("The network connection encountered a problem.",{cause:y})}),f=l.status;if(!(f>=200&&f<400)){let y=await l.json();throw k(y,f)}let g=l.body;if(!g)throw new Error("Response body is undefined.");let x=g.getReader();try{for await(let y of fr(x))yield y}catch(y){throw new E("The network connection encountered a problem while streaming events.",{cause:y})}}return{read:c(),close:()=>{i.abort("Stream closed by the client.")}}}close(){}};async function*fr(t){let e=new TextDecoder,r="";for await(let s of pr(t)){let n=e.decode(s),o=(r+n).split(` `);for(let i=0;i<o.length-1;i++)yield o[i].trim();r=o[o.length-1]}r.trim()!==""&&(yield r)}async function*pr(t){let e=!1;do{let r=await t.read();r.value!==void 0&&(yield r.value),e=r.done}while(!e)}var H;try{H=at("node:http2")}catch{H=void 0}var me,xe,Ee,_e,J,_,Ne,qe,De,vt,fe,Ie,Ae,dt,Le,Rt,Ve,Qt,te=class{constructor({http2_session_idle_ms:e,url:r,http2_max_streams:s}){u(this,fe);u(this,Ae);u(this,Le);u(this,Ve);u(this,xe,void 0);u(this,Ee,void 0);u(this,_e,void 0);u(this,J,0);u(this,_,void 0);u(this,Ne,A.QUERY);u(this,qe,A.STREAM);if(H===void 0)throw new Error("Your platform does not support Node's http2 library");p(this,xe,e),p(this,Ee,s),p(this,_e,r),p(this,_,null)}static getClient(e){var n;let r=m(n=te,De,vt).call(n,e);a(te,me).has(r)||a(te,me).set(r,new te(e));let s=a(te,me).get(r);return ut(s,J)._++,s}async request(e){let r=0,s;do try{return await m(this,Le,Rt).call(this,e)}catch(n){if(n?.code!=="ERR_HTTP2_GOAWAY_SESSION")throw new E("The network connection encountered a problem.",{cause:n});s=n,r++}while(r<3);throw new E("The network connection encountered a problem.",{cause:s})}stream(e){return m(this,Ve,Qt).call(this,e)}close(){this.isClosed()||(ut(this,J)._--,a(this,J)===0&&a(this,_)&&!a(this,_).closed&&a(this,_).close())}isClosed(){return a(this,J)===0}},re=te;me=new WeakMap,xe=new WeakMap,Ee=new WeakMap,_e=new WeakMap,J=new WeakMap,_=new WeakMap,Ne=new WeakMap,qe=new WeakMap,De=new WeakSet,vt=function({http2_session_idle_ms:e,url:r}){return`${r}|${e}`},fe=new WeakSet,Ie=function(){p(this,J,0),a(this,_)&&!a(this,_).closed&&a(this,_).close()},Ae=new WeakSet,dt=function(){if(!a(this,_)||a(this,_).closed||a(this,_).destroyed){let e=H.connect(a(this,_e),{peerMaxConcurrentStreams:a(this,Ee)}).once("error",()=>m(this,fe,Ie).call(this)).once("goaway",()=>m(this,fe,Ie).call(this));e.setTimeout(a(this,xe),()=>{m(this,fe,Ie).call(this)}),p(this,_,e)}return a(this,_)},Le=new WeakSet,Rt=function({client_timeout_ms:e,data:r,headers:s,method:n,path:o=a(this,Ne)}){return new Promise((i,d)=>{let c,l=f=>{let g=Number(f[H.constants.HTTP2_HEADER_STATUS]),x="";c.on("data",y=>{x+=y}),c.on("end",()=>{i({status:g,body:x,headers:f})})};try{let f={...s,[H.constants.HTTP2_HEADER_PATH]:o,[H.constants.HTTP2_HEADER_METHOD]:n};c=m(this,Ae,dt).call(this).request(f).setEncoding("utf8").on("error",x=>{d(x)}).on("response",l),c.write(JSON.stringify(r),"utf8"),c.setTimeout(e,()=>{c.destroy(new Error("Client timeout"))}),c.end()}catch(f){d(f)}})},Ve=new WeakSet,Qt=function({data:e,headers:r,method:s,path:n=a(this,qe)}){let o,i,d=()=>new Promise((y,G)=>{o=y,i=G}),c=d(),l,f=y=>{let G=Number(y[H.constants.HTTP2_HEADER_STATUS]);if(G>=200&&G<400){let z="";l.on("data",Q=>{let K=(z+Q).split(` `);o(K.map(ot=>ot.trim()).slice(0,-1)),c=d(),z=K[K.length-1]}),l.on("end",()=>{o([z])})}else{let z="";l.on("data",Q=>{z+=Q}),l.on("end",()=>{try{let Q=JSON.parse(z);i(k(Q,G))}catch(Q){i(new E("Could not process query failure.",{cause:Q}))}})}},g=this;async function*x(){var Q;let y={...r,[H.constants.HTTP2_HEADER_PATH]:n,[H.constants.HTTP2_HEADER_METHOD]:s};l=m(Q=g,Ae,dt).call(Q).request(y).setEncoding("utf8").on("error",K=>{i(K)}).on("response",f);let z=JSON.stringify(e);for(l.write(z,"utf8"),l.end();;){let K=await c;for(let ot of K)yield ot}}return{read:x(),close:()=>{l&&l.close()}}},u(re,De),u(re,me,new Map);var lt=t=>gr()?re.getClient(t):new we(t),mt=t=>t instanceof Object&&"body"in t&&"headers"in t&&"status"in t,ft=t=>"stream"in t&&typeof t.stream=="function",gr=()=>{if(typeof process<"u"&&process&&process.release?.name==="node")try{return at("node:http2"),!0}catch{return!1}return!1};var ht=mr(kt());var Er=/(?:\d{4}|[\u2212-]\d{4,}|\+\d{5,})/,_r=/(?:0[1-9]|1[0-2])/,Ar=/(?:0[1-9]|[12]\d|3[01])/,Ht=/(?:[01][0-9]|2[0-3])/,Ce=/(?:[0-5][0-9])/,Cr=/(?:\.\d+)/,gt=new RegExp(`(${Er.source}-(${_r.source})-(${Ar.source}))`),Pr=new RegExp(`(${Ht.source}:${Ce.source}:${Ce.source}${Cr.source}?)`),vr=new RegExp(`([zZ]|[+\u2212-]${Ht.source}(?::?${Ce.source}|:${Ce.source}:${Ce.source}))`),It=new RegExp(`^${gt.source}$`),Nt=new RegExp(`^${gt.source}`),qt=new RegExp(`^${gt.source}T${Pr.source}${vr.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(qt.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}")`}},q=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=It.exec(e);if(r===null)throw new RangeError(`Expected a plain date string but received '${e}'`);return new q(r[0])}static fromDate(e){let r=e.toISOString(),s=Nt.exec(r);if(s===null)throw new h(`Failed to parse date '${e}'`);return new q(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 M=class{coll;id;constructor({coll:e,id:r}){this.id=r,typeof e=="string"?this.coll=new W(e):this.coll=e}},pe=class extends M{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}}},X=class{coll;name;constructor({coll:e,name:r}){this.name=r,typeof e=="string"?this.coll=new W(e):this.coll=e}},ge=class extends X{ts;data;constructor(e){let{coll:r,name:s,ts:n,data:o,...i}=e;super({coll:r,name:s}),this.ts=n,this.data=o||{},Object.assign(this,i)}toObject(){return{...this}}},W=class{name;constructor(e){this.name=e}},se=class{ref;cause;constructor(e,r){this.ref=e,this.cause=r}};var D=class{data;after;constructor({data:e,after:r}){this.data=e,this.after=r}},U=class{after;constructor(e){this.after=e}},B=class{#e;constructor(e,r,s){if(s=s??{},r instanceof Function)this.#e=Qr(e,r,s);else if(r instanceof D||r instanceof U)this.#e=Dt(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 B(e,async()=>(await e.query(r,s)).data,s)}static fromPageable(e,r,s){return new B(e,r,s)}flatten(){return new Me(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}},Me=class{#e;constructor(e){this.#e=Fr(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*Dt(t,e,r){let s=e;for(s instanceof D&&(yield s.data);s.after;){let n=yt`Set.paginate(${s.after})`;s=(await t.query(n,r)).data,yield s.data}}async function*Qr(t,e,r){let s=await e();if(s instanceof D||s instanceof U){for await(let n of Dt(t,s,r))yield n;return}yield[s]}async function*Fr(t){for await(let e of t)for(let r of e)yield r}function ve(t){return typeof t.token=="string"}var oe=class{token;constructor(e){this.token=e}},Pe=class{events;cursor;hasNext;stats;constructor({events:e,cursor:r,has_next:s,stats:n}){this.events=this.#e(e),this.cursor=r,this.hasNext=s,this.stats=n}*#e(e){for(let r of e){if(r.type==="error")throw k(r);yield r}}};var L=class{static encode(e){return ye(e)}static encodeInterpolation(e){return We(e)}static decode(e,r){return JSON.parse(e,(s,n)=>{if(n==null)return null;if(n["@mod"])return new W(n["@mod"]);if(n["@doc"]){if(typeof n["@doc"]=="string"){let[i,d]=n["@doc"].split(":");return new M({coll:i,id:d})}let o=n["@doc"];return o.id?new pe(o):new ge(o)}else if(n["@ref"]){let o=n["@ref"],i;return o.id?i=new M(o):i=new X(o),"exists"in o&&o.exists===!1?new se(i,o.cause):i}else{if(n["@set"])return typeof n["@set"]=="string"?new U(n["@set"]):new D(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 q.from(n["@date"]);if(n["@time"])return N.from(n["@time"]);if(n["@object"])return n["@object"];if(n["@stream"])return new oe(n["@stream"]);if(n["@bytes"])return Ir(n["@bytes"])}}return n})}},Mt=BigInt("-9223372036854775808"),Wt=BigInt("9223372036854775807"),Lt=-(2**31),Vt=2**31-1,w={bigint:t=>{if(t<Mt||t>Wt)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>=Lt&&t<=Vt?{"@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>=Lt&&t<=Vt?{"@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]=ye(t[s]));return e?{"@object":r}:r},array:t=>t.map(ye),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 h("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)})},ye=t=>{switch(typeof t){case"bigint":return w.bigint(t);case"string":return w.string(t);case"number":return w.number(t);case"boolean":return t;case"object":if(t==null)return null;if(Array.isArray(t))return w.array(t);if(t instanceof Date)return w.date(t);if(t instanceof q)return w.faunadate(t);if(t instanceof N)return w.faunatime(t);if(t instanceof W)return w.module(t);if(t instanceof pe)return w.document(t);if(t instanceof M)return w.documentReference(t);if(t instanceof ge)return w.namedDocument(t);if(t instanceof X)return w.namedDocumentReference(t);if(t instanceof se)return ye(t.ref);if(t instanceof D)return w.set(t);if(t instanceof U)return w.set(t);if(t instanceof oe)return w.streamToken(t);if(t instanceof Uint8Array||t instanceof ArrayBuffer)return w.bytes(t);if(ArrayBuffer.isView(t))throw new h("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");if(t instanceof R)throw new TypeError("Cannot encode instance of type 'Query'. Try using TaggedTypeFormat.encodeInterpolation instead.");return w.object(t);default:throw new TypeError(`Passing ${typeof t} as a QueryArgument is not supported`)}},We=t=>{switch(typeof t){case"bigint":case"string":case"number":case"boolean":return jt(ye(t));case"object":return t==null||t instanceof Date||t instanceof q||t instanceof N||t instanceof W||t instanceof M||t instanceof X||t instanceof D||t instanceof U||t instanceof oe||t instanceof Uint8Array||t instanceof ArrayBuffer||ArrayBuffer.isView(t)?jt(ye(t)):t instanceof se?We(t.ref):t instanceof R?Hr(t):Array.isArray(t)?kr(t):Or(t);default:throw new TypeError(`Passing ${typeof t} as a QueryArgument is not supported`)}},Or=t=>{let e={};for(let r in t)t[r]!==void 0&&(e[r]=We(t[r]));return{object:e}},kr=t=>({array:t.map(We)}),Hr=t=>t.encode(),jt=t=>({value:t});function Ir(t){return ht.default.toByteArray(t)}function Nr(t){let e=t instanceof Uint8Array?t:new Uint8Array(t);return ht.default.fromByteArray(e)}function yt(t,...e){return new R(t,...e)}var R=class{#e;#t;#r;constructor(e,...r){if(e.length===0||e.length!==r.length+1)throw new Error("invalid query constructed");this.#e=e,this.#t=r,this.#r=void 0}encode(){if(this.#e.length===1)return{fql:[this.#e[0]]};let e=this.#e.flatMap((r,s)=>{if(s===this.#e.length-1)return r===""?[]:[r];let n=this.#t[s],o=L.encodeInterpolation(n);return[r,o]});return e=e.filter(r=>r!==""),{fql:e}}};var Ut="2.5.0";var Ue;try{Ue=at("node:os")}catch{Ue=void 0}var Tt=()=>{let t={driver:["javascript",Ut].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=Dr(),t.os=[Ue.platform(),Ue.release()].join("-")):s?(t.runtime=Bt(navigator),t.env="Service Worker",t.os=$t(navigator)):r?(t.runtime=Bt(navigator),t.env="browser",t.os=$t(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("; ")},Bt=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("-")},$t=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("-")},qr=typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,Dr=()=>{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 qr?.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 bt=async(t,{maxAttempts:e,maxBackoff:r,shouldRetry:s=()=>!0,attempt:n=0,sleepFn:o=setTimeout})=>{let i=n>0?Math.min(Math.random()*2**n,r)*1e3:0;n+=1;try{return await t()}catch(d){if(n>=e||s(d)!==!0)throw d;return await new Promise(c=>o(c,i)),bt(t,{maxAttempts:e,maxBackoff:r,shouldRetry:s,attempt:n,sleepFn:o})}};var Gt=t=>t instanceof Object&&"data"in t,St=t=>t instanceof Object&&"error"in t&&t.error instanceof Object&&"code"in t.error&&"message"in t.error;var V={TRACE:"0",DEBUG:"1",INFO:"2",WARN:"3",ERROR:"4",FATAL:"5",OFF:"6"};function wt(t){switch(t){case"0":case"1":case"2":case"3":case"4":case"5":case"6":return t;default:return V.OFF}}var he=class{#e;constructor(e){this.#e=e}trace(e,...r){this.#e<=V.TRACE&&console.trace(e,...r)}debug(e,...r){this.#e<=V.DEBUG&&console.debug(e,...r)}info(e,...r){this.#e<=V.INFO&&console.info(e,...r)}warn(e,...r){this.#e<=V.WARN&&console.warn(e,...r)}error(e,...r){this.#e<=V.ERROR&&console.error(e,...r)}fatal(e,...r){this.#e<=V.FATAL&&console.error(e,...r)}};var xt={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},Ge,S,$,P,Z,Qe,Et,Fe,_t,ze,zt,Ye,Yt,Je,Jt,Xe,Xt,Ze,Zt,Ke,Kt,At=class{constructor(e,r){u(this,Qe);u(this,Fe);u(this,ze);u(this,Ye);u(this,Je);u(this,Xe);u(this,Ze);u(this,Ke);u(this,S,void 0);u(this,$,void 0);u(this,P,void 0);u(this,Z,!1);p(this,S,{...xt,...e,secret:m(this,ze,zt).call(this,e),endpoint:m(this,Ye,Yt).call(this,e),logger:m(this,Je,Jt).call(this,e)}),m(this,Ke,Kt).call(this),r?p(this,$,r):p(this,$,lt({url:a(this,S).endpoint.toString(),http2_session_idle_ms:a(this,S).http2_session_idle_ms,http2_max_streams:a(this,S).http2_max_streams,fetch_keepalive:a(this,S).fetch_keepalive}))}get lastTxnTs(){return a(this,P)}set lastTxnTs(e){e!==void 0&&p(this,P,a(this,P)?Math.max(e,a(this,P)):e)}get clientConfiguration(){let{...e}=a(this,S);return e}close(){if(a(this,Z))throw new O("Your client is closed. You cannot close it again.");a(this,$).close(),p(this,Z,!0)}paginate(e,r){return e instanceof R?B.fromQuery(this,e,r):B.fromPageable(this,e,r)}async query(e,r){if(a(this,Z))throw new O("Your client is closed. No further requests can be issued.");let s={query:e.encode()};return r?.arguments&&(s.arguments=L.encode(r.arguments)),m(this,Qe,Et).call(this,s,r)}stream(e,r){if(a(this,Z))throw new O("Your client is closed. No further requests can be issued.");let s=a(this,$);if(ft(s)){let n={...a(this,S),httpStreamClient:s,logger:a(this,S).logger,...r};if(n.cursor!==void 0&&e instanceof R)throw new h("The `cursor` configuration can only be used with a stream token.");let o=e instanceof R?()=>this.query(e).then(i=>i.data):e;return new $e(o,n)}else throw new h("Streaming is not supported by this client.")}feed(e,r){if(a(this,Z))throw new O("Your client is closed. No further requests can be issued.");let s={...a(this,S),httpClient:a(this,$),logger:a(this,S).logger,...r},n=e instanceof R?()=>this.query(e).then(o=>o.data):e;return new Re(n,s)}},Be=At;Ge=new WeakMap,S=new WeakMap,$=new WeakMap,P=new WeakMap,Z=new WeakMap,Qe=new WeakSet,Et=async function(e,r,s=0){let n=this.clientConfiguration.max_backoff??xt.max_backoff,o=this.clientConfiguration.max_attempts??xt.max_attempts,i=Math.min(Math.random()*2**s,n)*1e3;s+=1;try{return await m(this,Xe,Xt).call(this,e,r,s)}catch(d){if(d instanceof j&&s<o)return await sr(i),m(this,Qe,Et).call(this,e,r,s);throw d}},Fe=new WeakSet,_t=function(e){if(e instanceof h||e instanceof E||e instanceof v||e instanceof b)return e;if(mt(e)){if(St(e.body)){let r=e.body,s=e.status;return k(r,s)}return new v({message:`Response is in an unkown format: ${e.body}`,httpStatus:e.status})}return new h("A client level error occurred. Fauna was not called.",{cause:e})},ze=new WeakSet,zt=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},Ye=new WeakSet,Yt=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??ct.default},Je=new WeakSet,Jt=function(e){if(e&&"logger"in e&&e.logger===void 0)throw new TypeError("ClientConfiguration option logger must be defined.");if(e?.logger)return e.logger;if(typeof process<"u"&&process&&typeof process=="object"&&process.env&&typeof process.env=="object"){let r=wt(process.env.FAUNA_DEBUG);return new he(r)}return new he(V.OFF)},Xe=new WeakSet,Xt=async function(e,r,s=0){try{let n={...a(this,S),...r},o={Authorization:`Bearer ${n.secret}`};m(this,Ze,Zt).call(this,n,o);let i=n.format==="tagged",d=n.query_timeout_ms+a(this,S).client_timeout_buffer_ms,c="POST";a(this,S).logger.debug("Fauna HTTP %s request to %s (timeout: %s), headers: %s",c,A.QUERY,d.toString(),JSON.stringify(o));let l=await a(this,$).request({client_timeout_ms:d,data:e,headers:o,method:c});if(a(this,S).logger.debug("Fauna HTTP response %s from %s, headers: %s",l.status,A.QUERY,JSON.stringify(l.headers)),l.status===200&&(l.body.length===0||l.headers["content-length"]==="0"))throw new v({message:"There was an issue communicating with Fauna. Response is empty. Please try again.",httpStatus:500});let f;try{if(f={...l,body:i?L.decode(l.body,{long_type:n.long_type}):JSON.parse(l.body)},f.body.query_tags){let y=f.body.query_tags.split(",").map(G=>G.split("="));f.body.query_tags=Object.fromEntries(y)}}catch(y){throw new v({message:`Error parsing response as JSON: ${y}`,httpStatus:l.status})}if(!Gt(f.body))throw m(this,Fe,_t).call(this,f);let g=f.body.txn_ts;(a(this,P)===void 0&&g!==void 0||g!==void 0&&a(this,P)!==void 0&&a(this,P)<g)&&p(this,P,g);let x=f.body;return x.stats&&(x.stats.attempts=s),x}catch(n){throw m(this,Fe,_t).call(this,n)}},Ze=new WeakSet,Zt=function(e,r){let s=(n,o,i=d=>String(d))=>{o!==void 0&&(r[n]=i(o))};s("x-format",e.format),s("x-typecheck",e.typecheck),s("x-performance-hints",e.performance_hints),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",a(this,P),n=>n),s("x-driver-env",a(At,Ge))},Ke=new WeakSet,Kt=function(){let e=a(this,S);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.")},u(Be,Ge,Tt());var $e=class{closed=!1;#e;#t=0;#r;#n;#s;#o;#a;#i;constructor(e,r){ve(e)?this.#r=()=>Promise.resolve(e):this.#r=e,this.#e=r,this.#i=r.logger,this.#c()}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 h("The stream has been closed and cannot be reused.");for(this.#a||(this.#a=await this.#r().then(e=>{if(!ve(e))throw new h(`Error requesting a stream token. Expected a EventSource as the query result, but received ${typeof e}. Your query must return the result of '<Set>.eventSource' or '<Set>.eventsOn') 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.#u())yield r}catch(r){if(r instanceof F||this.#t>=this.#e.max_attempts)throw this.close(),r;this.#t+=1,await sr(e)}}}close(){this.#o&&(this.#o.close(),this.#o=void 0),this.closed=!0}get last_ts(){return this.#n}async*#u(){let e=this.#a,r={Authorization:`Bearer ${this.#e.secret}`},s={data:{token:e.token,cursor:this.#s||this.#e.cursor},headers:r,method:"POST"},n=this.#e.httpStreamClient.stream(s);this.#o=n,this.#e.logger.debug("Fauna HTTP %s request to '%s', headers: %s",s.method,A.STREAM,JSON.stringify(s.headers));for await(let o of n.read){let i=L.decode(o,{long_type:this.#e.long_type});if(i.type==="error")throw this.close(),k(i);this.#n=i.txn_ts,this.#s=i.cursor,i.type==="start"&&(i.type="status"),!(!this.#e.status_events&&i.type==="status")&&(yield i)}}#c(){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.")}},et,Te,T,ae,be,Se,tt,er,rt,tr,nt,rr,st,nr,Ct=class{constructor(e,r){u(this,tt);u(this,rt);u(this,nt);u(this,st);u(this,Te,void 0);u(this,T,void 0);u(this,ae,void 0);u(this,be,void 0);u(this,Se,void 0);ve(e)?p(this,Te,()=>Promise.resolve(e)):p(this,Te,e),p(this,T,r),p(this,ae,r.cursor),m(this,st,nr).call(this)}async*[Symbol.asyncIterator](){for(;!a(this,Se);)yield await this.nextPage()}async nextPage(){if(a(this,Se))throw new h("The event feed has no more pages to fetch.");let{httpClient:e}=a(this,T),r=await m(this,rt,tr).call(this);a(this,T).logger.debug("Fauna HTTP %s request to '%s' (timeout: %s), headers: %s",r.method,A.EVENT_FEED,r.client_timeout_ms,JSON.stringify(r.headers));let s=await bt(()=>e.request(r),{maxAttempts:a(this,T).max_attempts,maxBackoff:a(this,T).max_backoff,shouldRetry:i=>i instanceof j});a(this,T).logger.debug("Fauna HTTP response '%s' from %s, headers: %s",s.status,A.EVENT_FEED,JSON.stringify(s.headers));let n;try{n=L.decode(s.body,{long_type:a(this,T).long_type})}catch(i){throw new v({message:`Error parsing response as JSON: ${i}`,httpStatus:s.status})}if(St(n))throw k(n,s.status);let o=new Pe(n);return p(this,ae,o.cursor),p(this,Se,!o.hasNext),o}async*flatten(){for await(let e of this)for(let r of e.events)yield r}},Re=Ct;et=new WeakMap,Te=new WeakMap,T=new WeakMap,ae=new WeakMap,be=new WeakMap,Se=new WeakMap,tt=new WeakSet,er=function(){return{Authorization:`Bearer ${a(this,T).secret}`,"x-format":"tagged","x-driver-env":a(Ct,et),"x-query-timeout-ms":a(this,T).query_timeout_ms.toString()}},rt=new WeakSet,tr=async function(){a(this,be)||p(this,be,await m(this,nt,rr).call(this,a(this,Te)));let e=m(this,tt,er).call(this),r=a(this,T).client_timeout_buffer_ms+a(this,T).query_timeout_ms,n={headers:e,client_timeout_ms:r,method:"POST",data:{token:a(this,be).token},path:A.EVENT_FEED};return a(this,T).page_size&&(n.data.page_size=a(this,T).page_size),a(this,ae)?n.data.cursor=a(this,ae):a(this,T).start_ts&&(n.data.start_ts=a(this,T).start_ts),n},nt=new WeakSet,rr=async function(e){return await e().then(r=>{if(!ve(r))throw new h(`Error requesting a stream token. Expected a EventSource as the query result, but received ${typeof r}. Your query must return the result of '<Set>.eventSource' or '<Set>.eventsOn') Query result: ${JSON.stringify(r,null)}`);return r})},st=new WeakSet,nr=function(){let e=a(this,T);if(["long_type","httpClient","max_backoff","max_attempts","client_timeout_buffer_ms","query_timeout_ms","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.");if(e.query_timeout_ms<=0)throw new RangeError("'query_timeout_ms' must be greater than zero.");if(e.client_timeout_buffer_ms<0)throw new RangeError("'client_timeout_buffer_ms' must be greater than or equal to zero.");if(e.start_ts!==void 0&&e.cursor!==void 0)throw new TypeError("Only one of 'start_ts' or 'cursor' can be defined in the client configuration.");if(e.cursor!==void 0&&typeof e.cursor!="string")throw new TypeError("'cursor' must be a string.")},u(Re,et,Tt());function sr(t){return new Promise(e=>setTimeout(e,t))}export{ke as AbortError,ue as AuthenticationError,ce as AuthorizationError,Be as Client,O as ClientClosedError,h as ClientError,he as ConsoleLogHandler,Oe as ConstraintFailureError,He as ContendedTransactionError,q as DateStub,pe as Document,M as DocumentReference,U as EmbeddedSet,A as FaunaAPIPaths,F as FaunaError,Re as FeedClient,Pe as FeedPage,we as FetchClient,Me as FlattenedSetIterator,ee as InvalidRequestError,V as LOG_LEVELS,Wt as LONG_MAX,Mt as LONG_MIN,W as Module,ge as NamedDocument,X as NamedDocumentReference,E as NetworkError,re as NodeHTTP2Client,se as NullDocument,D as Page,v as ProtocolError,Y as QueryCheckError,ie as QueryRuntimeError,de as QueryTimeoutError,b as ServiceError,le as ServiceInternalError,B as SetIterator,$e as StreamClient,oe as StreamToken,L as TaggedTypeFormat,j as ThrottlingError,N as TimeStub,ct as endpoints,yt as fql,lt as getDefaultHTTPClient,mt as isHTTPResponse,ft as isStreamClient,wt as parseDebugLevel}; //# sourceMappingURL=index.js.map