@upstash/redis 1.24.2 → 1.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunk-JIU2S2DZ.js +1 -0
- package/chunk-KBK5EDMP.mjs +1 -0
- package/cloudflare.js +1 -1
- package/cloudflare.mjs +1 -1
- package/fastly.js +1 -1
- package/fastly.mjs +1 -1
- package/nodejs.js +1 -1
- package/nodejs.mjs +1 -1
- package/package.json +1 -54
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;var c=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var ie=class{constructor(n){this.options={backend:_optionalChain([n, 'access', _2 => _2.options, 'optionalAccess', _3 => _3.backend]),agent:n.agent,responseEncoding:_nullishCoalesce(n.responseEncoding, () => ("base64")),cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof _optionalChain([n, 'optionalAccess', _4 => _4.retry])=="boolean"&&_optionalChain([n, 'optionalAccess', _5 => _5.retry])===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _6 => _6.retry, 'optionalAccess', _7 => _7.retries]), () => (5)),backoff:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _8 => _8.retry, 'optionalAccess', _9 => _9.backoff]), () => ((t=>Math.exp(t)*50)))}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:_optionalChain([this, 'access', _10 => _10.options, 'optionalAccess', _11 => _11.agent]),backend:_optionalChain([this, 'access', _12 => _12.options, 'optionalAccess', _13 => _13.backend])},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,..._nullishCoalesce(n.path, () => ([]))].join("/"),t);break}catch(i){m=i,await new Promise(p=>setTimeout(p,this.retry.backoff(a)))}if(!o)throw _nullishCoalesce(m, () => (new Error("Exhausted all retries")));let r=await o.json();if(!o.ok)throw new c(`${r.error}, command was: ${JSON.stringify(n.body)}`);return _optionalChain([this, 'access', _14 => _14.options, 'optionalAccess', _15 => _15.responseEncoding])==="base64"?Array.isArray(r)?r.map(({result:i,error:p})=>({result:re(i),error:p})):{result:re(r.result),error:r.error}:r}};function pe(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch (e2){n=s}return n}function re(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?pe(t):Array.isArray(t)?t.map(re):t):n=null;break}case"string":{n=s==="OK"?"OK":pe(s);break}default:break}return n}function de(s){let n=Array.isArray(s)?s.map(t=>{try{return de(t)}catch (e3){return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ce(s){try{return de(s)}catch (e4){return s}}var he=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{constructor(n,t){this.serialize=he,this.deserialize=typeof _optionalChain([t, 'optionalAccess', _16 => _16.automaticDeserialization])>"u"||t.automaticDeserialization?_nullishCoalesce(_optionalChain([t, 'optionalAccess', _17 => _17.deserialize]), () => (ce)):o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new c(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var C=class extends e{constructor(n,t){super(["append",...n],t)}};var l=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var g=class extends e{constructor(n,t){super(["bitop",...n],t)}};var x=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var f=class extends e{constructor([n,t,o],m){super(["COPY",n,t,..._optionalChain([o, 'optionalAccess', _18 => _18.replace])?["REPLACE"]:[]],{...m,deserialize(r){return r>0?"COPIED":"NOT_COPIED"}})}};var y=class extends e{constructor(n){super(["dbsize"],n)}};var b=class extends e{constructor(n,t){super(["decr",...n],t)}};var O=class extends e{constructor(n,t){super(["decrby",...n],t)}};var T=class extends e{constructor(n,t){super(["del",...n],t)}};var w=class extends e{constructor(n,t){super(["echo",...n],t)}};var D=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,..._nullishCoalesce(o, () => ([]))],m)}};var k=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,..._nullishCoalesce(o, () => ([]))],m)}};var A=class extends e{constructor(n,t){super(["exists",...n],t)}};var S=class extends e{constructor(n,t){super(["expire",...n],t)}};var R=class extends e{constructor(n,t){super(["expireat",...n],t)}};var M=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var v=class extends e{constructor([n],t){let o=["flushdb"];_optionalChain([n, 'optionalAccess', _19 => _19.async])&&o.push("async"),super(o,t)}};var E=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:p})=>[i,a,p])),super(r,m)}};var z=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var J=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOPOS",o,...m],{deserialize:r=>Ce(r),...t})}};function Ce(s){let n=[];for(let t of s)!_optionalChain([t, 'optionalAccess', _20 => _20[0]])||!_optionalChain([t, 'optionalAccess', _21 => _21[1]])||n.push({lng:parseFloat(t[0]),lat:parseFloat(t[1])});return n}var P=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOHASH",o,...m],t)}};var I=class extends e{constructor([n,t,o,m,r],a){let i=["GEOSEARCH",n];(t.type==="FROMMEMBER"||t.type==="frommember")&&i.push(t.type,t.member),(t.type==="FROMLONLAT"||t.type==="fromlonlat")&&i.push(t.type,t.coordinate.lon,t.coordinate.lat),(o.type==="BYRADIUS"||o.type==="byradius")&&i.push(o.type,o.radius,o.radiusType),(o.type==="BYBOX"||o.type==="bybox")&&i.push(o.type,o.rect.width,o.rect.height,o.rectType),i.push(m),_optionalChain([r, 'optionalAccess', _22 => _22.count])&&i.push(r.count.limit,...r.count.any?["ANY"]:[]);let p=ae=>!_optionalChain([r, 'optionalAccess', _23 => _23.withCoord])&&!_optionalChain([r, 'optionalAccess', _24 => _24.withDist])&&!_optionalChain([r, 'optionalAccess', _25 => _25.withHash])?ae.map(d=>{try{return{member:JSON.parse(d)}}catch (e5){return{member:d}}}):ae.map(d=>{let ee=1,h={};try{h.member=JSON.parse(d[0])}catch (e6){h.member=d[0]}return r.withDist&&(h.dist=parseFloat(d[ee++])),r.withHash&&(h.hash=d[ee++].toString()),r.withCoord&&(h.coord={long:parseFloat(d[ee][0]),lat:parseFloat(d[ee][1])}),h});super([...i,..._optionalChain([r, 'optionalAccess', _26 => _26.withCoord])?["WITHCOORD"]:[],..._optionalChain([r, 'optionalAccess', _27 => _27.withDist])?["WITHDIST"]:[],..._optionalChain([r, 'optionalAccess', _28 => _28.withHash])?["WITHHASH"]:[]],{...a,deserialize:p})}};var K=class extends e{constructor([n,t,o,m,r,a],i){let p=["GEOSEARCHSTORE",n,t];(o.type==="FROMMEMBER"||o.type==="frommember")&&p.push(o.type,o.member),(o.type==="FROMLONLAT"||o.type==="fromlonlat")&&p.push(o.type,o.coordinate.lon,o.coordinate.lat),(m.type==="BYRADIUS"||m.type==="byradius")&&p.push(m.type,m.radius,m.radiusType),(m.type==="BYBOX"||m.type==="bybox")&&p.push(m.type,m.rect.width,m.rect.height,m.rectType),p.push(r),_optionalChain([a, 'optionalAccess', _29 => _29.count])&&p.push(a.count.limit,...a.count.any?["ANY"]:[]),super([...p,..._optionalChain([a, 'optionalAccess', _30 => _30.storeDist])?["STOREDIST"]:[]],i)}};var L=class extends e{constructor(n,t){super(["get",...n],t)}};var Z=class extends e{constructor(n,t){super(["getbit",...n],t)}};var N=class extends e{constructor(n,t){super(["getdel",...n],t)}};var G=class extends e{constructor(n,t){super(["getrange",...n],t)}};var B=class extends e{constructor(n,t){super(["getset",...n],t)}};var U=class extends e{constructor(n,t){super(["hdel",...n],t)}};var H=class extends e{constructor(n,t){super(["hexists",...n],t)}};var F=class extends e{constructor(n,t){super(["hget",...n],t)}};function le(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch (e7){n[t]=o}}return n}var q=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>le(o),...t})}};var $=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var X=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var j=class extends e{constructor([n],t){super(["hkeys",n],t)}};var Y=class extends e{constructor(n,t){super(["hlen",...n],t)}};function ge(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch (e8){t[s[o]]=n[o]}return t}var W=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>ge(t,m),...o})}};var V=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function xe(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch (e9){n[t]=o}}return n}var _=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>xe(m):_optionalChain([t, 'optionalAccess', _31 => _31.deserialize]),...t})}};var Q=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];_optionalChain([o, 'optionalAccess', _32 => _32.match])&&r.push("match",o.match),typeof _optionalChain([o, 'optionalAccess', _33 => _33.count])=="number"&&r.push("count",o.count),super(r,m)}};var nn=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var tn=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var en=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var on=class extends e{constructor(n,t){super(["hvals",...n],t)}};var sn=class extends e{constructor(n,t){super(["incr",...n],t)}};var mn=class extends e{constructor(n,t){super(["incrby",...n],t)}};var rn=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var dn=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var cn=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],_nullishCoalesce(n[1], () => ("$"))],t)}};var un=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var hn=class extends e{constructor(n,t){let o=_nullishCoalesce(n[1], () => ("$")),m=_nullishCoalesce(n[2], () => (0)),r=_nullishCoalesce(n[3], () => (0));super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var ln=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var yn=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var wn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var Dn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var kn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var An=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var Sn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Rn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var Mn=class extends e{constructor(n,t){super(["keys",...n],t)}};var vn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var En=class extends e{constructor(n,t){super(["linsert",...n],t)}};var zn=class extends e{constructor(n,t){super(["llen",...n],t)}};var Jn=class extends e{constructor(n,t){super(["lmove",...n],t)}};var Pn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var In=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof _optionalChain([n, 'access', _34 => _34[2], 'optionalAccess', _35 => _35.rank])=="number"&&o.push("rank",n[2].rank),typeof _optionalChain([n, 'access', _36 => _36[2], 'optionalAccess', _37 => _37.count])=="number"&&o.push("count",n[2].count),typeof _optionalChain([n, 'access', _38 => _38[2], 'optionalAccess', _39 => _39.maxLen])=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var Kn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Ln=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Zn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Nn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Gn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Bn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Un=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Hn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Fn=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var qn=class extends e{constructor(n,t){super(["persist",...n],t)}};var $n=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var Xn=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var jn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Yn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Wn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var Vn=class extends e{constructor(n,t){super(["publish",...n],t)}};var _n=class extends e{constructor(n){super(["randomkey"],n)}};var Qn=class extends e{constructor(n,t){super(["rename",...n],t)}};var nt=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var tt=class extends e{constructor(n,t){super(["rpop",...n],t)}};var et=class extends e{constructor(n,t){super(["rpush",...n],t)}};var ot=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var st=class extends e{constructor(n,t){super(["sadd",...n],t)}};var mt=class extends e{constructor([n,t],o){let m=["scan",n];_optionalChain([t, 'optionalAccess', _40 => _40.match])&&m.push("match",t.match),typeof _optionalChain([t, 'optionalAccess', _41 => _41.count])=="number"&&m.push("count",t.count),_optionalChain([t, 'optionalAccess', _42 => _42.type])&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var rt=class extends e{constructor(n,t){super(["scard",...n],t)}};var at=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var it=class extends e{constructor([n],t){let o=["script","flush"];_optionalChain([n, 'optionalAccess', _43 => _43.sync])?o.push("sync"):_optionalChain([n, 'optionalAccess', _44 => _44.async])&&o.push("async"),super(o,t)}};var pt=class extends e{constructor(n,t){super(["script","load",...n],t)}};var dt=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var ct=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var ut=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var ht=class extends e{constructor(n,t){super(["setbit",...n],t)}};var Ct=class extends e{constructor(n,t){super(["setex",...n],t)}};var lt=class extends e{constructor(n,t){super(["setnx",...n],t)}};var gt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var xt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ft=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var yt=class extends e{constructor(n,t){super(["sismember",...n],t)}};var bt=class extends e{constructor(n,t){super(["smembers",...n],t)}};var Ot=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Tt=class extends e{constructor(n,t){super(["smove",...n],t)}};var wt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var Dt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var kt=class extends e{constructor(n,t){super(["srem",...n],t)}};var At=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];_optionalChain([o, 'optionalAccess', _45 => _45.match])&&r.push("match",o.match),typeof _optionalChain([o, 'optionalAccess', _46 => _46.count])=="number"&&r.push("count",o.count),super(r,m)}};var St=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Rt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Mt=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var vt=class extends e{constructor(n){super(["time"],n)}};var Et=class extends e{constructor(n,t){super(["touch",...n],t)}};var zt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var Jt=class extends e{constructor(n,t){super(["type",...n],t)}};var Pt=class extends e{constructor(n,t){super(["unlink",...n],t)}};var oe=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,p]of Object.entries(o))a.push(i,p);super(a,r)}};function fe(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch (e10){n[o][r]=a}}}return n}var se=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>fe(i),...r})}};var u=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var It=class extends e{constructor(n,t){super(["zcard",...n],t)}};var Kt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Lt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Zt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Nt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Gt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Bt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Ut=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];_optionalChain([m, 'optionalAccess', _47 => _47.byScore])&&a.push("byscore"),_optionalChain([m, 'optionalAccess', _48 => _48.byLex])&&a.push("bylex"),_optionalChain([m, 'optionalAccess', _49 => _49.rev])&&a.push("rev"),typeof _optionalChain([m, 'optionalAccess', _50 => _50.count])<"u"&&typeof _optionalChain([m, 'optionalAccess', _51 => _51.offset])<"u"&&a.push("limit",m.offset,m.count),_optionalChain([m, 'optionalAccess', _52 => _52.withScores])&&a.push("withscores"),super(a,r)}};var Ht=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Ft=class extends e{constructor(n,t){super(["zrem",...n],t)}};var qt=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var $t=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var Xt=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var jt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Yt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];_optionalChain([o, 'optionalAccess', _53 => _53.match])&&r.push("match",o.match),typeof _optionalChain([o, 'optionalAccess', _54 => _54.count])=="number"&&r.push("count",o.count),super(r,m)}};var Wt=class extends e{constructor(n,t){super(["zscore",...n],t)}};var Vt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),_optionalChain([o, 'optionalAccess', _55 => _55.withScores])&&r.push("withscores")),super(r,m)}};var _t=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Qt=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var ne=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var te= (_class =class{constructor(n){;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);_class.prototype.__init11.call(this);_class.prototype.__init12.call(this);_class.prototype.__init13.call(this);_class.prototype.__init14.call(this);_class.prototype.__init15.call(this);_class.prototype.__init16.call(this);_class.prototype.__init17.call(this);_class.prototype.__init18.call(this);_class.prototype.__init19.call(this);_class.prototype.__init20.call(this);_class.prototype.__init21.call(this);_class.prototype.__init22.call(this);_class.prototype.__init23.call(this);_class.prototype.__init24.call(this);_class.prototype.__init25.call(this);_class.prototype.__init26.call(this);_class.prototype.__init27.call(this);_class.prototype.__init28.call(this);_class.prototype.__init29.call(this);_class.prototype.__init30.call(this);_class.prototype.__init31.call(this);_class.prototype.__init32.call(this);_class.prototype.__init33.call(this);_class.prototype.__init34.call(this);_class.prototype.__init35.call(this);_class.prototype.__init36.call(this);_class.prototype.__init37.call(this);_class.prototype.__init38.call(this);_class.prototype.__init39.call(this);_class.prototype.__init40.call(this);_class.prototype.__init41.call(this);_class.prototype.__init42.call(this);_class.prototype.__init43.call(this);_class.prototype.__init44.call(this);_class.prototype.__init45.call(this);_class.prototype.__init46.call(this);_class.prototype.__init47.call(this);_class.prototype.__init48.call(this);_class.prototype.__init49.call(this);_class.prototype.__init50.call(this);_class.prototype.__init51.call(this);_class.prototype.__init52.call(this);_class.prototype.__init53.call(this);_class.prototype.__init54.call(this);_class.prototype.__init55.call(this);_class.prototype.__init56.call(this);_class.prototype.__init57.call(this);_class.prototype.__init58.call(this);_class.prototype.__init59.call(this);_class.prototype.__init60.call(this);_class.prototype.__init61.call(this);_class.prototype.__init62.call(this);_class.prototype.__init63.call(this);_class.prototype.__init64.call(this);_class.prototype.__init65.call(this);_class.prototype.__init66.call(this);_class.prototype.__init67.call(this);_class.prototype.__init68.call(this);_class.prototype.__init69.call(this);_class.prototype.__init70.call(this);_class.prototype.__init71.call(this);_class.prototype.__init72.call(this);_class.prototype.__init73.call(this);_class.prototype.__init74.call(this);_class.prototype.__init75.call(this);_class.prototype.__init76.call(this);_class.prototype.__init77.call(this);_class.prototype.__init78.call(this);_class.prototype.__init79.call(this);_class.prototype.__init80.call(this);_class.prototype.__init81.call(this);_class.prototype.__init82.call(this);_class.prototype.__init83.call(this);_class.prototype.__init84.call(this);_class.prototype.__init85.call(this);_class.prototype.__init86.call(this);_class.prototype.__init87.call(this);_class.prototype.__init88.call(this);_class.prototype.__init89.call(this);_class.prototype.__init90.call(this);_class.prototype.__init91.call(this);_class.prototype.__init92.call(this);_class.prototype.__init93.call(this);_class.prototype.__init94.call(this);_class.prototype.__init95.call(this);_class.prototype.__init96.call(this);_class.prototype.__init97.call(this);_class.prototype.__init98.call(this);_class.prototype.__init99.call(this);_class.prototype.__init100.call(this);_class.prototype.__init101.call(this);_class.prototype.__init102.call(this);_class.prototype.__init103.call(this);_class.prototype.__init104.call(this);_class.prototype.__init105.call(this);_class.prototype.__init106.call(this);_class.prototype.__init107.call(this);_class.prototype.__init108.call(this);_class.prototype.__init109.call(this);_class.prototype.__init110.call(this);_class.prototype.__init111.call(this);_class.prototype.__init112.call(this);_class.prototype.__init113.call(this);_class.prototype.__init114.call(this);_class.prototype.__init115.call(this);_class.prototype.__init116.call(this);_class.prototype.__init117.call(this);_class.prototype.__init118.call(this);_class.prototype.__init119.call(this);_class.prototype.__init120.call(this);_class.prototype.__init121.call(this);_class.prototype.__init122.call(this);_class.prototype.__init123.call(this);this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=_nullishCoalesce(n.multiExec, () => (!1))}__init() {this.exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new c(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})}}length(){return this.commands.length}chain(n){return this.commands.push(n),this}__init2() {this.append=(...n)=>this.chain(new C(n,this.commandOptions))}__init3() {this.bitcount=(...n)=>this.chain(new l(n,this.commandOptions))}__init4() {this.bitop=(n,t,o,...m)=>this.chain(new g([n,t,o,...m],this.commandOptions))}__init5() {this.bitpos=(...n)=>this.chain(new x(n,this.commandOptions))}__init6() {this.copy=(...n)=>this.chain(new f(n,this.commandOptions))}__init7() {this.zdiffstore=(...n)=>this.chain(new Qt(n,this.commandOptions))}__init8() {this.dbsize=()=>this.chain(new y(this.commandOptions))}__init9() {this.decr=(...n)=>this.chain(new b(n,this.commandOptions))}__init10() {this.decrby=(...n)=>this.chain(new O(n,this.commandOptions))}__init11() {this.del=(...n)=>this.chain(new T(n,this.commandOptions))}__init12() {this.echo=(...n)=>this.chain(new w(n,this.commandOptions))}__init13() {this.eval=(...n)=>this.chain(new D(n,this.commandOptions))}__init14() {this.evalsha=(...n)=>this.chain(new k(n,this.commandOptions))}__init15() {this.exists=(...n)=>this.chain(new A(n,this.commandOptions))}__init16() {this.expire=(...n)=>this.chain(new S(n,this.commandOptions))}__init17() {this.expireat=(...n)=>this.chain(new R(n,this.commandOptions))}__init18() {this.flushall=n=>this.chain(new M(n,this.commandOptions))}__init19() {this.flushdb=(...n)=>this.chain(new v(n,this.commandOptions))}__init20() {this.get=(...n)=>this.chain(new L(n,this.commandOptions))}__init21() {this.getbit=(...n)=>this.chain(new Z(n,this.commandOptions))}__init22() {this.getdel=(...n)=>this.chain(new N(n,this.commandOptions))}__init23() {this.getrange=(...n)=>this.chain(new G(n,this.commandOptions))}__init24() {this.getset=(n,t)=>this.chain(new B([n,t],this.commandOptions))}__init25() {this.hdel=(...n)=>this.chain(new U(n,this.commandOptions))}__init26() {this.hexists=(...n)=>this.chain(new H(n,this.commandOptions))}__init27() {this.hget=(...n)=>this.chain(new F(n,this.commandOptions))}__init28() {this.hgetall=(...n)=>this.chain(new q(n,this.commandOptions))}__init29() {this.hincrby=(...n)=>this.chain(new $(n,this.commandOptions))}__init30() {this.hincrbyfloat=(...n)=>this.chain(new X(n,this.commandOptions))}__init31() {this.hkeys=(...n)=>this.chain(new j(n,this.commandOptions))}__init32() {this.hlen=(...n)=>this.chain(new Y(n,this.commandOptions))}__init33() {this.hmget=(...n)=>this.chain(new W(n,this.commandOptions))}__init34() {this.hmset=(n,t)=>this.chain(new V([n,t],this.commandOptions))}__init35() {this.hrandfield=(n,t,o)=>this.chain(new _([n,t,o],this.commandOptions))}__init36() {this.hscan=(...n)=>this.chain(new Q(n,this.commandOptions))}__init37() {this.hset=(n,t)=>this.chain(new nn([n,t],this.commandOptions))}__init38() {this.hsetnx=(n,t,o)=>this.chain(new tn([n,t,o],this.commandOptions))}__init39() {this.hstrlen=(...n)=>this.chain(new en(n,this.commandOptions))}__init40() {this.hvals=(...n)=>this.chain(new on(n,this.commandOptions))}__init41() {this.incr=(...n)=>this.chain(new sn(n,this.commandOptions))}__init42() {this.incrby=(...n)=>this.chain(new mn(n,this.commandOptions))}__init43() {this.incrbyfloat=(...n)=>this.chain(new rn(n,this.commandOptions))}__init44() {this.keys=(...n)=>this.chain(new Mn(n,this.commandOptions))}__init45() {this.lindex=(...n)=>this.chain(new vn(n,this.commandOptions))}__init46() {this.linsert=(n,t,o,m)=>this.chain(new En([n,t,o,m],this.commandOptions))}__init47() {this.llen=(...n)=>this.chain(new zn(n,this.commandOptions))}__init48() {this.lmove=(...n)=>this.chain(new Jn(n,this.commandOptions))}__init49() {this.lpop=(...n)=>this.chain(new Pn(n,this.commandOptions))}__init50() {this.lpos=(...n)=>this.chain(new In(n,this.commandOptions))}__init51() {this.lpush=(n,...t)=>this.chain(new Kn([n,...t],this.commandOptions))}__init52() {this.lpushx=(n,...t)=>this.chain(new Ln([n,...t],this.commandOptions))}__init53() {this.lrange=(...n)=>this.chain(new Zn(n,this.commandOptions))}__init54() {this.lrem=(n,t,o)=>this.chain(new Nn([n,t,o],this.commandOptions))}__init55() {this.lset=(n,t,o)=>this.chain(new Gn([n,t,o],this.commandOptions))}__init56() {this.ltrim=(...n)=>this.chain(new Bn(n,this.commandOptions))}__init57() {this.mget=(...n)=>this.chain(new Un(n,this.commandOptions))}__init58() {this.mset=n=>this.chain(new Hn([n],this.commandOptions))}__init59() {this.msetnx=n=>this.chain(new Fn([n],this.commandOptions))}__init60() {this.persist=(...n)=>this.chain(new qn(n,this.commandOptions))}__init61() {this.pexpire=(...n)=>this.chain(new $n(n,this.commandOptions))}__init62() {this.pexpireat=(...n)=>this.chain(new Xn(n,this.commandOptions))}__init63() {this.ping=n=>this.chain(new jn(n,this.commandOptions))}__init64() {this.psetex=(n,t,o)=>this.chain(new Yn([n,t,o],this.commandOptions))}__init65() {this.pttl=(...n)=>this.chain(new Wn(n,this.commandOptions))}__init66() {this.publish=(...n)=>this.chain(new Vn(n,this.commandOptions))}__init67() {this.randomkey=()=>this.chain(new _n(this.commandOptions))}__init68() {this.rename=(...n)=>this.chain(new Qn(n,this.commandOptions))}__init69() {this.renamenx=(...n)=>this.chain(new nt(n,this.commandOptions))}__init70() {this.rpop=(...n)=>this.chain(new tt(n,this.commandOptions))}__init71() {this.rpush=(n,...t)=>this.chain(new et([n,...t],this.commandOptions))}__init72() {this.rpushx=(n,...t)=>this.chain(new ot([n,...t],this.commandOptions))}__init73() {this.sadd=(n,...t)=>this.chain(new st([n,...t],this.commandOptions))}__init74() {this.scan=(...n)=>this.chain(new mt(n,this.commandOptions))}__init75() {this.scard=(...n)=>this.chain(new rt(n,this.commandOptions))}__init76() {this.scriptExists=(...n)=>this.chain(new at(n,this.commandOptions))}__init77() {this.scriptFlush=(...n)=>this.chain(new it(n,this.commandOptions))}__init78() {this.scriptLoad=(...n)=>this.chain(new pt(n,this.commandOptions))}__init79() {this.sdiff=(...n)=>this.chain(new dt(n,this.commandOptions))}__init80() {this.sdiffstore=(...n)=>this.chain(new ct(n,this.commandOptions))}__init81() {this.set=(n,t,o)=>this.chain(new ut([n,t,o],this.commandOptions))}__init82() {this.setbit=(...n)=>this.chain(new ht(n,this.commandOptions))}__init83() {this.setex=(n,t,o)=>this.chain(new Ct([n,t,o],this.commandOptions))}__init84() {this.setnx=(n,t)=>this.chain(new lt([n,t],this.commandOptions))}__init85() {this.setrange=(...n)=>this.chain(new gt(n,this.commandOptions))}__init86() {this.sinter=(...n)=>this.chain(new xt(n,this.commandOptions))}__init87() {this.sinterstore=(...n)=>this.chain(new ft(n,this.commandOptions))}__init88() {this.sismember=(n,t)=>this.chain(new yt([n,t],this.commandOptions))}__init89() {this.smembers=(...n)=>this.chain(new bt(n,this.commandOptions))}__init90() {this.smismember=(n,t)=>this.chain(new Ot([n,t],this.commandOptions))}__init91() {this.smove=(n,t,o)=>this.chain(new Tt([n,t,o],this.commandOptions))}__init92() {this.spop=(...n)=>this.chain(new wt(n,this.commandOptions))}__init93() {this.srandmember=(...n)=>this.chain(new Dt(n,this.commandOptions))}__init94() {this.srem=(n,...t)=>this.chain(new kt([n,...t],this.commandOptions))}__init95() {this.sscan=(...n)=>this.chain(new At(n,this.commandOptions))}__init96() {this.strlen=(...n)=>this.chain(new St(n,this.commandOptions))}__init97() {this.sunion=(...n)=>this.chain(new Rt(n,this.commandOptions))}__init98() {this.sunionstore=(...n)=>this.chain(new Mt(n,this.commandOptions))}__init99() {this.time=()=>this.chain(new vt(this.commandOptions))}__init100() {this.touch=(...n)=>this.chain(new Et(n,this.commandOptions))}__init101() {this.ttl=(...n)=>this.chain(new zt(n,this.commandOptions))}__init102() {this.type=(...n)=>this.chain(new Jt(n,this.commandOptions))}__init103() {this.unlink=(...n)=>this.chain(new Pt(n,this.commandOptions))}__init104() {this.zadd=(...n)=>"score"in n[1]?this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions))}__init105() {this.zcard=(...n)=>this.chain(new It(n,this.commandOptions))}__init106() {this.zcount=(...n)=>this.chain(new Kt(n,this.commandOptions))}__init107() {this.zincrby=(n,t,o)=>this.chain(new Lt([n,t,o],this.commandOptions))}__init108() {this.zinterstore=(...n)=>this.chain(new Zt(n,this.commandOptions))}__init109() {this.zlexcount=(...n)=>this.chain(new Nt(n,this.commandOptions))}__init110() {this.zmscore=(...n)=>this.chain(new ne(n,this.commandOptions))}__init111() {this.zpopmax=(...n)=>this.chain(new Gt(n,this.commandOptions))}__init112() {this.zpopmin=(...n)=>this.chain(new Bt(n,this.commandOptions))}__init113() {this.zrange=(...n)=>this.chain(new Ut(n,this.commandOptions))}__init114() {this.zrank=(n,t)=>this.chain(new Ht([n,t],this.commandOptions))}__init115() {this.zrem=(n,...t)=>this.chain(new Ft([n,...t],this.commandOptions))}__init116() {this.zremrangebylex=(...n)=>this.chain(new qt(n,this.commandOptions))}__init117() {this.zremrangebyrank=(...n)=>this.chain(new $t(n,this.commandOptions))}__init118() {this.zremrangebyscore=(...n)=>this.chain(new Xt(n,this.commandOptions))}__init119() {this.zrevrank=(n,t)=>this.chain(new jt([n,t],this.commandOptions))}__init120() {this.zscan=(...n)=>this.chain(new Yt(n,this.commandOptions))}__init121() {this.zscore=(n,t)=>this.chain(new Wt([n,t],this.commandOptions))}__init122() {this.zunionstore=(...n)=>this.chain(new _t(n,this.commandOptions))}__init123() {this.zunion=(...n)=>this.chain(new Vt(n,this.commandOptions))}get json(){return{arrappend:(...n)=>this.chain(new an(n,this.commandOptions)),arrindex:(...n)=>this.chain(new pn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new dn(n,this.commandOptions)),arrlen:(...n)=>this.chain(new cn(n,this.commandOptions)),arrpop:(...n)=>this.chain(new un(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new hn(n,this.commandOptions)),clear:(...n)=>this.chain(new Cn(n,this.commandOptions)),del:(...n)=>this.chain(new ln(n,this.commandOptions)),forget:(...n)=>this.chain(new gn(n,this.commandOptions)),geoadd:(...n)=>this.chain(new E(n,this.commandOptions)),geodist:(...n)=>this.chain(new z(n,this.commandOptions)),geopos:(...n)=>this.chain(new J(n,this.commandOptions)),geohash:(...n)=>this.chain(new P(n,this.commandOptions)),geosearch:(...n)=>this.chain(new I(n,this.commandOptions)),geosearchstore:(...n)=>this.chain(new K(n,this.commandOptions)),get:(...n)=>this.chain(new xn(n,this.commandOptions)),mget:(...n)=>this.chain(new fn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new yn(n,this.commandOptions)),nummultby:(...n)=>this.chain(new bn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new On(n,this.commandOptions)),objlen:(...n)=>this.chain(new Tn(n,this.commandOptions)),resp:(...n)=>this.chain(new wn(n,this.commandOptions)),set:(...n)=>this.chain(new Dn(n,this.commandOptions)),strappend:(...n)=>this.chain(new kn(n,this.commandOptions)),strlen:(...n)=>this.chain(new An(n,this.commandOptions)),toggle:(...n)=>this.chain(new Sn(n,this.commandOptions)),type:(...n)=>this.chain(new Rn(n,this.commandOptions))}}}, _class);var _enchex = require('crypto-js/enc-hex'); var _enchex2 = _interopRequireDefault(_enchex);var _sha1 = require('crypto-js/sha1'); var _sha12 = _interopRequireDefault(_sha1);var me=class{constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return _enchex2.default.stringify(_sha12.default.call(void 0, n))}};var ue= (_class2 =class{constructor(n,t){;_class2.prototype.__init124.call(this);_class2.prototype.__init125.call(this);_class2.prototype.__init126.call(this);_class2.prototype.__init127.call(this);_class2.prototype.__init128.call(this);_class2.prototype.__init129.call(this);_class2.prototype.__init130.call(this);_class2.prototype.__init131.call(this);_class2.prototype.__init132.call(this);_class2.prototype.__init133.call(this);_class2.prototype.__init134.call(this);_class2.prototype.__init135.call(this);_class2.prototype.__init136.call(this);_class2.prototype.__init137.call(this);_class2.prototype.__init138.call(this);_class2.prototype.__init139.call(this);_class2.prototype.__init140.call(this);_class2.prototype.__init141.call(this);_class2.prototype.__init142.call(this);_class2.prototype.__init143.call(this);_class2.prototype.__init144.call(this);_class2.prototype.__init145.call(this);_class2.prototype.__init146.call(this);_class2.prototype.__init147.call(this);_class2.prototype.__init148.call(this);_class2.prototype.__init149.call(this);_class2.prototype.__init150.call(this);_class2.prototype.__init151.call(this);_class2.prototype.__init152.call(this);_class2.prototype.__init153.call(this);_class2.prototype.__init154.call(this);_class2.prototype.__init155.call(this);_class2.prototype.__init156.call(this);_class2.prototype.__init157.call(this);_class2.prototype.__init158.call(this);_class2.prototype.__init159.call(this);_class2.prototype.__init160.call(this);_class2.prototype.__init161.call(this);_class2.prototype.__init162.call(this);_class2.prototype.__init163.call(this);_class2.prototype.__init164.call(this);_class2.prototype.__init165.call(this);_class2.prototype.__init166.call(this);_class2.prototype.__init167.call(this);_class2.prototype.__init168.call(this);_class2.prototype.__init169.call(this);_class2.prototype.__init170.call(this);_class2.prototype.__init171.call(this);_class2.prototype.__init172.call(this);_class2.prototype.__init173.call(this);_class2.prototype.__init174.call(this);_class2.prototype.__init175.call(this);_class2.prototype.__init176.call(this);_class2.prototype.__init177.call(this);_class2.prototype.__init178.call(this);_class2.prototype.__init179.call(this);_class2.prototype.__init180.call(this);_class2.prototype.__init181.call(this);_class2.prototype.__init182.call(this);_class2.prototype.__init183.call(this);_class2.prototype.__init184.call(this);_class2.prototype.__init185.call(this);_class2.prototype.__init186.call(this);_class2.prototype.__init187.call(this);_class2.prototype.__init188.call(this);_class2.prototype.__init189.call(this);_class2.prototype.__init190.call(this);_class2.prototype.__init191.call(this);_class2.prototype.__init192.call(this);_class2.prototype.__init193.call(this);_class2.prototype.__init194.call(this);_class2.prototype.__init195.call(this);_class2.prototype.__init196.call(this);_class2.prototype.__init197.call(this);_class2.prototype.__init198.call(this);_class2.prototype.__init199.call(this);_class2.prototype.__init200.call(this);_class2.prototype.__init201.call(this);_class2.prototype.__init202.call(this);_class2.prototype.__init203.call(this);_class2.prototype.__init204.call(this);_class2.prototype.__init205.call(this);_class2.prototype.__init206.call(this);_class2.prototype.__init207.call(this);_class2.prototype.__init208.call(this);_class2.prototype.__init209.call(this);_class2.prototype.__init210.call(this);_class2.prototype.__init211.call(this);_class2.prototype.__init212.call(this);_class2.prototype.__init213.call(this);_class2.prototype.__init214.call(this);_class2.prototype.__init215.call(this);_class2.prototype.__init216.call(this);_class2.prototype.__init217.call(this);_class2.prototype.__init218.call(this);_class2.prototype.__init219.call(this);_class2.prototype.__init220.call(this);_class2.prototype.__init221.call(this);_class2.prototype.__init222.call(this);_class2.prototype.__init223.call(this);_class2.prototype.__init224.call(this);_class2.prototype.__init225.call(this);_class2.prototype.__init226.call(this);_class2.prototype.__init227.call(this);_class2.prototype.__init228.call(this);_class2.prototype.__init229.call(this);_class2.prototype.__init230.call(this);_class2.prototype.__init231.call(this);_class2.prototype.__init232.call(this);_class2.prototype.__init233.call(this);_class2.prototype.__init234.call(this);_class2.prototype.__init235.call(this);_class2.prototype.__init236.call(this);_class2.prototype.__init237.call(this);_class2.prototype.__init238.call(this);_class2.prototype.__init239.call(this);_class2.prototype.__init240.call(this);_class2.prototype.__init241.call(this);_class2.prototype.__init242.call(this);_class2.prototype.__init243.call(this);_class2.prototype.__init244.call(this);_class2.prototype.__init245.call(this);_class2.prototype.__init246.call(this);_class2.prototype.__init247.call(this);_class2.prototype.__init248.call(this);_class2.prototype.__init249.call(this);_class2.prototype.__init250.call(this);_class2.prototype.__init251.call(this);this.client=n,this.opts=t,this.enableTelemetry=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _56 => _56.enableTelemetry]), () => (!0))}get json(){return{arrappend:(...n)=>new an(n,this.opts).exec(this.client),arrindex:(...n)=>new pn(n,this.opts).exec(this.client),arrinsert:(...n)=>new dn(n,this.opts).exec(this.client),arrlen:(...n)=>new cn(n,this.opts).exec(this.client),arrpop:(...n)=>new un(n,this.opts).exec(this.client),arrtrim:(...n)=>new hn(n,this.opts).exec(this.client),clear:(...n)=>new Cn(n,this.opts).exec(this.client),del:(...n)=>new ln(n,this.opts).exec(this.client),forget:(...n)=>new gn(n,this.opts).exec(this.client),geoadd:(...n)=>new E(n,this.opts).exec(this.client),geopos:(...n)=>new J(n,this.opts).exec(this.client),geodist:(...n)=>new z(n,this.opts).exec(this.client),geohash:(...n)=>new P(n,this.opts).exec(this.client),geosearch:(...n)=>new I(n,this.opts).exec(this.client),geosearchstore:(...n)=>new K(n,this.opts).exec(this.client),get:(...n)=>new xn(n,this.opts).exec(this.client),mget:(...n)=>new fn(n,this.opts).exec(this.client),numincrby:(...n)=>new yn(n,this.opts).exec(this.client),nummultby:(...n)=>new bn(n,this.opts).exec(this.client),objkeys:(...n)=>new On(n,this.opts).exec(this.client),objlen:(...n)=>new Tn(n,this.opts).exec(this.client),resp:(...n)=>new wn(n,this.opts).exec(this.client),set:(...n)=>new Dn(n,this.opts).exec(this.client),strappend:(...n)=>new kn(n,this.opts).exec(this.client),strlen:(...n)=>new An(n,this.opts).exec(this.client),toggle:(...n)=>new Sn(n,this.opts).exec(this.client),type:(...n)=>new Rn(n,this.opts).exec(this.client)}}__init124() {this.use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)}}__init125() {this.addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch (e12){}}}createScript(n){return new me(this,n)}__init126() {this.pipeline=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!1})}__init127() {this.multi=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!0})}__init128() {this.append=(...n)=>new C(n,this.opts).exec(this.client)}__init129() {this.bitcount=(...n)=>new l(n,this.opts).exec(this.client)}__init130() {this.bitop=(n,t,o,...m)=>new g([n,t,o,...m],this.opts).exec(this.client)}__init131() {this.bitpos=(...n)=>new x(n,this.opts).exec(this.client)}__init132() {this.copy=(...n)=>new f(n,this.opts).exec(this.client)}__init133() {this.dbsize=()=>new y(this.opts).exec(this.client)}__init134() {this.decr=(...n)=>new b(n,this.opts).exec(this.client)}__init135() {this.decrby=(...n)=>new O(n,this.opts).exec(this.client)}__init136() {this.del=(...n)=>new T(n,this.opts).exec(this.client)}__init137() {this.echo=(...n)=>new w(n,this.opts).exec(this.client)}__init138() {this.eval=(...n)=>new D(n,this.opts).exec(this.client)}__init139() {this.evalsha=(...n)=>new k(n,this.opts).exec(this.client)}__init140() {this.exists=(...n)=>new A(n,this.opts).exec(this.client)}__init141() {this.expire=(...n)=>new S(n,this.opts).exec(this.client)}__init142() {this.expireat=(...n)=>new R(n,this.opts).exec(this.client)}__init143() {this.flushall=n=>new M(n,this.opts).exec(this.client)}__init144() {this.flushdb=(...n)=>new v(n,this.opts).exec(this.client)}__init145() {this.get=(...n)=>new L(n,this.opts).exec(this.client)}__init146() {this.getbit=(...n)=>new Z(n,this.opts).exec(this.client)}__init147() {this.getdel=(...n)=>new N(n,this.opts).exec(this.client)}__init148() {this.getrange=(...n)=>new G(n,this.opts).exec(this.client)}__init149() {this.getset=(n,t)=>new B([n,t],this.opts).exec(this.client)}__init150() {this.hdel=(...n)=>new U(n,this.opts).exec(this.client)}__init151() {this.hexists=(...n)=>new H(n,this.opts).exec(this.client)}__init152() {this.hget=(...n)=>new F(n,this.opts).exec(this.client)}__init153() {this.hgetall=(...n)=>new q(n,this.opts).exec(this.client)}__init154() {this.hincrby=(...n)=>new $(n,this.opts).exec(this.client)}__init155() {this.hincrbyfloat=(...n)=>new X(n,this.opts).exec(this.client)}__init156() {this.hkeys=(...n)=>new j(n,this.opts).exec(this.client)}__init157() {this.hlen=(...n)=>new Y(n,this.opts).exec(this.client)}__init158() {this.hmget=(...n)=>new W(n,this.opts).exec(this.client)}__init159() {this.hmset=(n,t)=>new V([n,t],this.opts).exec(this.client)}__init160() {this.hrandfield=(n,t,o)=>new _([n,t,o],this.opts).exec(this.client)}__init161() {this.hscan=(...n)=>new Q(n,this.opts).exec(this.client)}__init162() {this.hset=(n,t)=>new nn([n,t],this.opts).exec(this.client)}__init163() {this.hsetnx=(n,t,o)=>new tn([n,t,o],this.opts).exec(this.client)}__init164() {this.hstrlen=(...n)=>new en(n,this.opts).exec(this.client)}__init165() {this.hvals=(...n)=>new on(n,this.opts).exec(this.client)}__init166() {this.incr=(...n)=>new sn(n,this.opts).exec(this.client)}__init167() {this.incrby=(...n)=>new mn(n,this.opts).exec(this.client)}__init168() {this.incrbyfloat=(...n)=>new rn(n,this.opts).exec(this.client)}__init169() {this.keys=(...n)=>new Mn(n,this.opts).exec(this.client)}__init170() {this.lindex=(...n)=>new vn(n,this.opts).exec(this.client)}__init171() {this.linsert=(n,t,o,m)=>new En([n,t,o,m],this.opts).exec(this.client)}__init172() {this.llen=(...n)=>new zn(n,this.opts).exec(this.client)}__init173() {this.lmove=(...n)=>new Jn(n,this.opts).exec(this.client)}__init174() {this.lpop=(...n)=>new Pn(n,this.opts).exec(this.client)}__init175() {this.lpos=(...n)=>new In(n,this.opts).exec(this.client)}__init176() {this.lpush=(n,...t)=>new Kn([n,...t],this.opts).exec(this.client)}__init177() {this.lpushx=(n,...t)=>new Ln([n,...t],this.opts).exec(this.client)}__init178() {this.lrange=(...n)=>new Zn(n,this.opts).exec(this.client)}__init179() {this.lrem=(n,t,o)=>new Nn([n,t,o],this.opts).exec(this.client)}__init180() {this.lset=(n,t,o)=>new Gn([n,t,o],this.opts).exec(this.client)}__init181() {this.ltrim=(...n)=>new Bn(n,this.opts).exec(this.client)}__init182() {this.mget=(...n)=>new Un(n,this.opts).exec(this.client)}__init183() {this.mset=n=>new Hn([n],this.opts).exec(this.client)}__init184() {this.msetnx=n=>new Fn([n],this.opts).exec(this.client)}__init185() {this.persist=(...n)=>new qn(n,this.opts).exec(this.client)}__init186() {this.pexpire=(...n)=>new $n(n,this.opts).exec(this.client)}__init187() {this.pexpireat=(...n)=>new Xn(n,this.opts).exec(this.client)}__init188() {this.ping=n=>new jn(n,this.opts).exec(this.client)}__init189() {this.psetex=(n,t,o)=>new Yn([n,t,o],this.opts).exec(this.client)}__init190() {this.pttl=(...n)=>new Wn(n,this.opts).exec(this.client)}__init191() {this.publish=(...n)=>new Vn(n,this.opts).exec(this.client)}__init192() {this.randomkey=()=>new _n().exec(this.client)}__init193() {this.rename=(...n)=>new Qn(n,this.opts).exec(this.client)}__init194() {this.renamenx=(...n)=>new nt(n,this.opts).exec(this.client)}__init195() {this.rpop=(...n)=>new tt(n,this.opts).exec(this.client)}__init196() {this.rpush=(n,...t)=>new et([n,...t],this.opts).exec(this.client)}__init197() {this.rpushx=(n,...t)=>new ot([n,...t],this.opts).exec(this.client)}__init198() {this.sadd=(n,...t)=>new st([n,...t],this.opts).exec(this.client)}__init199() {this.scan=(...n)=>new mt(n,this.opts).exec(this.client)}__init200() {this.scard=(...n)=>new rt(n,this.opts).exec(this.client)}__init201() {this.scriptExists=(...n)=>new at(n,this.opts).exec(this.client)}__init202() {this.scriptFlush=(...n)=>new it(n,this.opts).exec(this.client)}__init203() {this.scriptLoad=(...n)=>new pt(n,this.opts).exec(this.client)}__init204() {this.sdiff=(...n)=>new dt(n,this.opts).exec(this.client)}__init205() {this.sdiffstore=(...n)=>new ct(n,this.opts).exec(this.client)}__init206() {this.set=(n,t,o)=>new ut([n,t,o],this.opts).exec(this.client)}__init207() {this.setbit=(...n)=>new ht(n,this.opts).exec(this.client)}__init208() {this.setex=(n,t,o)=>new Ct([n,t,o],this.opts).exec(this.client)}__init209() {this.setnx=(n,t)=>new lt([n,t],this.opts).exec(this.client)}__init210() {this.setrange=(...n)=>new gt(n,this.opts).exec(this.client)}__init211() {this.sinter=(...n)=>new xt(n,this.opts).exec(this.client)}__init212() {this.sinterstore=(...n)=>new ft(n,this.opts).exec(this.client)}__init213() {this.sismember=(n,t)=>new yt([n,t],this.opts).exec(this.client)}__init214() {this.smismember=(n,t)=>new Ot([n,t],this.opts).exec(this.client)}__init215() {this.smembers=(...n)=>new bt(n,this.opts).exec(this.client)}__init216() {this.smove=(n,t,o)=>new Tt([n,t,o],this.opts).exec(this.client)}__init217() {this.spop=(...n)=>new wt(n,this.opts).exec(this.client)}__init218() {this.srandmember=(...n)=>new Dt(n,this.opts).exec(this.client)}__init219() {this.srem=(n,...t)=>new kt([n,...t],this.opts).exec(this.client)}__init220() {this.sscan=(...n)=>new At(n,this.opts).exec(this.client)}__init221() {this.strlen=(...n)=>new St(n,this.opts).exec(this.client)}__init222() {this.sunion=(...n)=>new Rt(n,this.opts).exec(this.client)}__init223() {this.sunionstore=(...n)=>new Mt(n,this.opts).exec(this.client)}__init224() {this.time=()=>new vt().exec(this.client)}__init225() {this.touch=(...n)=>new Et(n,this.opts).exec(this.client)}__init226() {this.ttl=(...n)=>new zt(n,this.opts).exec(this.client)}__init227() {this.type=(...n)=>new Jt(n,this.opts).exec(this.client)}__init228() {this.unlink=(...n)=>new Pt(n,this.opts).exec(this.client)}__init229() {this.xadd=(...n)=>new oe(n,this.opts).exec(this.client)}__init230() {this.xrange=(...n)=>new se(n,this.opts).exec(this.client)}__init231() {this.zadd=(...n)=>"score"in n[1]?new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client)}__init232() {this.zcard=(...n)=>new It(n,this.opts).exec(this.client)}__init233() {this.zcount=(...n)=>new Kt(n,this.opts).exec(this.client)}__init234() {this.zdiffstore=(...n)=>new Qt(n,this.opts).exec(this.client)}__init235() {this.zincrby=(n,t,o)=>new Lt([n,t,o],this.opts).exec(this.client)}__init236() {this.zinterstore=(...n)=>new Zt(n,this.opts).exec(this.client)}__init237() {this.zlexcount=(...n)=>new Nt(n,this.opts).exec(this.client)}__init238() {this.zmscore=(...n)=>new ne(n,this.opts).exec(this.client)}__init239() {this.zpopmax=(...n)=>new Gt(n,this.opts).exec(this.client)}__init240() {this.zpopmin=(...n)=>new Bt(n,this.opts).exec(this.client)}__init241() {this.zrange=(...n)=>new Ut(n,this.opts).exec(this.client)}__init242() {this.zrank=(n,t)=>new Ht([n,t],this.opts).exec(this.client)}__init243() {this.zrem=(n,...t)=>new Ft([n,...t],this.opts).exec(this.client)}__init244() {this.zremrangebylex=(...n)=>new qt(n,this.opts).exec(this.client)}__init245() {this.zremrangebyrank=(...n)=>new $t(n,this.opts).exec(this.client)}__init246() {this.zremrangebyscore=(...n)=>new Xt(n,this.opts).exec(this.client)}__init247() {this.zrevrank=(n,t)=>new jt([n,t],this.opts).exec(this.client)}__init248() {this.zscan=(...n)=>new Yt(n,this.opts).exec(this.client)}__init249() {this.zscore=(n,t)=>new Wt([n,t],this.opts).exec(this.client)}__init250() {this.zunion=(...n)=>new Vt(n,this.opts).exec(this.client)}__init251() {this.zunionstore=(...n)=>new _t(n,this.opts).exec(this.client)}}, _class2);var cC="v1.24.3";exports.a = ie; exports.b = ue; exports.c = cC;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var ie=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(p=>setTimeout(p,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new c(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:p})=>({result:re(i),error:p})):{result:re(r.result),error:r.error}:r}};function pe(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function re(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?pe(t):Array.isArray(t)?t.map(re):t):n=null;break}case"string":{n=s==="OK"?"OK":pe(s);break}default:break}return n}function de(s){let n=Array.isArray(s)?s.map(t=>{try{return de(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ce(s){try{return de(s)}catch{return s}}var he=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=he,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??ce:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new c(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var C=class extends e{constructor(n,t){super(["append",...n],t)}};var l=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var g=class extends e{constructor(n,t){super(["bitop",...n],t)}};var x=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var f=class extends e{constructor([n,t,o],m){super(["COPY",n,t,...o?.replace?["REPLACE"]:[]],{...m,deserialize(r){return r>0?"COPIED":"NOT_COPIED"}})}};var y=class extends e{constructor(n){super(["dbsize"],n)}};var b=class extends e{constructor(n,t){super(["decr",...n],t)}};var O=class extends e{constructor(n,t){super(["decrby",...n],t)}};var T=class extends e{constructor(n,t){super(["del",...n],t)}};var w=class extends e{constructor(n,t){super(["echo",...n],t)}};var D=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var k=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var A=class extends e{constructor(n,t){super(["exists",...n],t)}};var S=class extends e{constructor(n,t){super(["expire",...n],t)}};var R=class extends e{constructor(n,t){super(["expireat",...n],t)}};var M=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var v=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var E=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:p})=>[i,a,p])),super(r,m)}};var z=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var J=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOPOS",o,...m],{deserialize:r=>Ce(r),...t})}};function Ce(s){let n=[];for(let t of s)!t?.[0]||!t?.[1]||n.push({lng:parseFloat(t[0]),lat:parseFloat(t[1])});return n}var P=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOHASH",o,...m],t)}};var I=class extends e{constructor([n,t,o,m,r],a){let i=["GEOSEARCH",n];(t.type==="FROMMEMBER"||t.type==="frommember")&&i.push(t.type,t.member),(t.type==="FROMLONLAT"||t.type==="fromlonlat")&&i.push(t.type,t.coordinate.lon,t.coordinate.lat),(o.type==="BYRADIUS"||o.type==="byradius")&&i.push(o.type,o.radius,o.radiusType),(o.type==="BYBOX"||o.type==="bybox")&&i.push(o.type,o.rect.width,o.rect.height,o.rectType),i.push(m),r?.count&&i.push(r.count.limit,...r.count.any?["ANY"]:[]);let p=ae=>!r?.withCoord&&!r?.withDist&&!r?.withHash?ae.map(d=>{try{return{member:JSON.parse(d)}}catch{return{member:d}}}):ae.map(d=>{let ee=1,h={};try{h.member=JSON.parse(d[0])}catch{h.member=d[0]}return r.withDist&&(h.dist=parseFloat(d[ee++])),r.withHash&&(h.hash=d[ee++].toString()),r.withCoord&&(h.coord={long:parseFloat(d[ee][0]),lat:parseFloat(d[ee][1])}),h});super([...i,...r?.withCoord?["WITHCOORD"]:[],...r?.withDist?["WITHDIST"]:[],...r?.withHash?["WITHHASH"]:[]],{...a,deserialize:p})}};var K=class extends e{constructor([n,t,o,m,r,a],i){let p=["GEOSEARCHSTORE",n,t];(o.type==="FROMMEMBER"||o.type==="frommember")&&p.push(o.type,o.member),(o.type==="FROMLONLAT"||o.type==="fromlonlat")&&p.push(o.type,o.coordinate.lon,o.coordinate.lat),(m.type==="BYRADIUS"||m.type==="byradius")&&p.push(m.type,m.radius,m.radiusType),(m.type==="BYBOX"||m.type==="bybox")&&p.push(m.type,m.rect.width,m.rect.height,m.rectType),p.push(r),a?.count&&p.push(a.count.limit,...a.count.any?["ANY"]:[]),super([...p,...a?.storeDist?["STOREDIST"]:[]],i)}};var L=class extends e{constructor(n,t){super(["get",...n],t)}};var Z=class extends e{constructor(n,t){super(["getbit",...n],t)}};var N=class extends e{constructor(n,t){super(["getdel",...n],t)}};var G=class extends e{constructor(n,t){super(["getrange",...n],t)}};var B=class extends e{constructor(n,t){super(["getset",...n],t)}};var U=class extends e{constructor(n,t){super(["hdel",...n],t)}};var H=class extends e{constructor(n,t){super(["hexists",...n],t)}};var F=class extends e{constructor(n,t){super(["hget",...n],t)}};function le(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var q=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>le(o),...t})}};var $=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var X=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var j=class extends e{constructor([n],t){super(["hkeys",n],t)}};var Y=class extends e{constructor(n,t){super(["hlen",...n],t)}};function ge(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var W=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>ge(t,m),...o})}};var V=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function xe(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var _=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>xe(m):t?.deserialize,...t})}};var Q=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var nn=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var tn=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var en=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var on=class extends e{constructor(n,t){super(["hvals",...n],t)}};var sn=class extends e{constructor(n,t){super(["incr",...n],t)}};var mn=class extends e{constructor(n,t){super(["incrby",...n],t)}};var rn=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var dn=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var cn=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var un=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var hn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var ln=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var yn=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var wn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var Dn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var kn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var An=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var Sn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Rn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var Mn=class extends e{constructor(n,t){super(["keys",...n],t)}};var vn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var En=class extends e{constructor(n,t){super(["linsert",...n],t)}};var zn=class extends e{constructor(n,t){super(["llen",...n],t)}};var Jn=class extends e{constructor(n,t){super(["lmove",...n],t)}};var Pn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var In=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var Kn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Ln=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Zn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Nn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Gn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Bn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Un=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Hn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Fn=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var qn=class extends e{constructor(n,t){super(["persist",...n],t)}};var $n=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var Xn=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var jn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Yn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Wn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var Vn=class extends e{constructor(n,t){super(["publish",...n],t)}};var _n=class extends e{constructor(n){super(["randomkey"],n)}};var Qn=class extends e{constructor(n,t){super(["rename",...n],t)}};var nt=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var tt=class extends e{constructor(n,t){super(["rpop",...n],t)}};var et=class extends e{constructor(n,t){super(["rpush",...n],t)}};var ot=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var st=class extends e{constructor(n,t){super(["sadd",...n],t)}};var mt=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var rt=class extends e{constructor(n,t){super(["scard",...n],t)}};var at=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var it=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var pt=class extends e{constructor(n,t){super(["script","load",...n],t)}};var dt=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var ct=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var ut=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var ht=class extends e{constructor(n,t){super(["setbit",...n],t)}};var Ct=class extends e{constructor(n,t){super(["setex",...n],t)}};var lt=class extends e{constructor(n,t){super(["setnx",...n],t)}};var gt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var xt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ft=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var yt=class extends e{constructor(n,t){super(["sismember",...n],t)}};var bt=class extends e{constructor(n,t){super(["smembers",...n],t)}};var Ot=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Tt=class extends e{constructor(n,t){super(["smove",...n],t)}};var wt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var Dt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var kt=class extends e{constructor(n,t){super(["srem",...n],t)}};var At=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var St=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Rt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Mt=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var vt=class extends e{constructor(n){super(["time"],n)}};var Et=class extends e{constructor(n,t){super(["touch",...n],t)}};var zt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var Jt=class extends e{constructor(n,t){super(["type",...n],t)}};var Pt=class extends e{constructor(n,t){super(["unlink",...n],t)}};var oe=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,p]of Object.entries(o))a.push(i,p);super(a,r)}};function fe(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var se=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>fe(i),...r})}};var u=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var It=class extends e{constructor(n,t){super(["zcard",...n],t)}};var Kt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Lt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Zt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Nt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Gt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Bt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Ut=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Ht=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Ft=class extends e{constructor(n,t){super(["zrem",...n],t)}};var qt=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var $t=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var Xt=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var jt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Yt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var Wt=class extends e{constructor(n,t){super(["zscore",...n],t)}};var Vt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var _t=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Qt=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var ne=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var te=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new c(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new C(n,this.commandOptions));bitcount=(...n)=>this.chain(new l(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new g([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new x(n,this.commandOptions));copy=(...n)=>this.chain(new f(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new Qt(n,this.commandOptions));dbsize=()=>this.chain(new y(this.commandOptions));decr=(...n)=>this.chain(new b(n,this.commandOptions));decrby=(...n)=>this.chain(new O(n,this.commandOptions));del=(...n)=>this.chain(new T(n,this.commandOptions));echo=(...n)=>this.chain(new w(n,this.commandOptions));eval=(...n)=>this.chain(new D(n,this.commandOptions));evalsha=(...n)=>this.chain(new k(n,this.commandOptions));exists=(...n)=>this.chain(new A(n,this.commandOptions));expire=(...n)=>this.chain(new S(n,this.commandOptions));expireat=(...n)=>this.chain(new R(n,this.commandOptions));flushall=n=>this.chain(new M(n,this.commandOptions));flushdb=(...n)=>this.chain(new v(n,this.commandOptions));get=(...n)=>this.chain(new L(n,this.commandOptions));getbit=(...n)=>this.chain(new Z(n,this.commandOptions));getdel=(...n)=>this.chain(new N(n,this.commandOptions));getrange=(...n)=>this.chain(new G(n,this.commandOptions));getset=(n,t)=>this.chain(new B([n,t],this.commandOptions));hdel=(...n)=>this.chain(new U(n,this.commandOptions));hexists=(...n)=>this.chain(new H(n,this.commandOptions));hget=(...n)=>this.chain(new F(n,this.commandOptions));hgetall=(...n)=>this.chain(new q(n,this.commandOptions));hincrby=(...n)=>this.chain(new $(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new X(n,this.commandOptions));hkeys=(...n)=>this.chain(new j(n,this.commandOptions));hlen=(...n)=>this.chain(new Y(n,this.commandOptions));hmget=(...n)=>this.chain(new W(n,this.commandOptions));hmset=(n,t)=>this.chain(new V([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new _([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new Q(n,this.commandOptions));hset=(n,t)=>this.chain(new nn([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new tn([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new en(n,this.commandOptions));hvals=(...n)=>this.chain(new on(n,this.commandOptions));incr=(...n)=>this.chain(new sn(n,this.commandOptions));incrby=(...n)=>this.chain(new mn(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new rn(n,this.commandOptions));keys=(...n)=>this.chain(new Mn(n,this.commandOptions));lindex=(...n)=>this.chain(new vn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new En([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new zn(n,this.commandOptions));lmove=(...n)=>this.chain(new Jn(n,this.commandOptions));lpop=(...n)=>this.chain(new Pn(n,this.commandOptions));lpos=(...n)=>this.chain(new In(n,this.commandOptions));lpush=(n,...t)=>this.chain(new Kn([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new Ln([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new Zn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Nn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new Gn([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Bn(n,this.commandOptions));mget=(...n)=>this.chain(new Un(n,this.commandOptions));mset=n=>this.chain(new Hn([n],this.commandOptions));msetnx=n=>this.chain(new Fn([n],this.commandOptions));persist=(...n)=>this.chain(new qn(n,this.commandOptions));pexpire=(...n)=>this.chain(new $n(n,this.commandOptions));pexpireat=(...n)=>this.chain(new Xn(n,this.commandOptions));ping=n=>this.chain(new jn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new Yn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new Wn(n,this.commandOptions));publish=(...n)=>this.chain(new Vn(n,this.commandOptions));randomkey=()=>this.chain(new _n(this.commandOptions));rename=(...n)=>this.chain(new Qn(n,this.commandOptions));renamenx=(...n)=>this.chain(new nt(n,this.commandOptions));rpop=(...n)=>this.chain(new tt(n,this.commandOptions));rpush=(n,...t)=>this.chain(new et([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new ot([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new st([n,...t],this.commandOptions));scan=(...n)=>this.chain(new mt(n,this.commandOptions));scard=(...n)=>this.chain(new rt(n,this.commandOptions));scriptExists=(...n)=>this.chain(new at(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new it(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new pt(n,this.commandOptions));sdiff=(...n)=>this.chain(new dt(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new ct(n,this.commandOptions));set=(n,t,o)=>this.chain(new ut([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new ht(n,this.commandOptions));setex=(n,t,o)=>this.chain(new Ct([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new lt([n,t],this.commandOptions));setrange=(...n)=>this.chain(new gt(n,this.commandOptions));sinter=(...n)=>this.chain(new xt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ft(n,this.commandOptions));sismember=(n,t)=>this.chain(new yt([n,t],this.commandOptions));smembers=(...n)=>this.chain(new bt(n,this.commandOptions));smismember=(n,t)=>this.chain(new Ot([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Tt([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new wt(n,this.commandOptions));srandmember=(...n)=>this.chain(new Dt(n,this.commandOptions));srem=(n,...t)=>this.chain(new kt([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new At(n,this.commandOptions));strlen=(...n)=>this.chain(new St(n,this.commandOptions));sunion=(...n)=>this.chain(new Rt(n,this.commandOptions));sunionstore=(...n)=>this.chain(new Mt(n,this.commandOptions));time=()=>this.chain(new vt(this.commandOptions));touch=(...n)=>this.chain(new Et(n,this.commandOptions));ttl=(...n)=>this.chain(new zt(n,this.commandOptions));type=(...n)=>this.chain(new Jt(n,this.commandOptions));unlink=(...n)=>this.chain(new Pt(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new It(n,this.commandOptions));zcount=(...n)=>this.chain(new Kt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Lt([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new Zt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Nt(n,this.commandOptions));zmscore=(...n)=>this.chain(new ne(n,this.commandOptions));zpopmax=(...n)=>this.chain(new Gt(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Bt(n,this.commandOptions));zrange=(...n)=>this.chain(new Ut(n,this.commandOptions));zrank=(n,t)=>this.chain(new Ht([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new Ft([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new qt(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new $t(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new Xt(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new jt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new Yt(n,this.commandOptions));zscore=(n,t)=>this.chain(new Wt([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new _t(n,this.commandOptions));zunion=(...n)=>this.chain(new Vt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new an(n,this.commandOptions)),arrindex:(...n)=>this.chain(new pn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new dn(n,this.commandOptions)),arrlen:(...n)=>this.chain(new cn(n,this.commandOptions)),arrpop:(...n)=>this.chain(new un(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new hn(n,this.commandOptions)),clear:(...n)=>this.chain(new Cn(n,this.commandOptions)),del:(...n)=>this.chain(new ln(n,this.commandOptions)),forget:(...n)=>this.chain(new gn(n,this.commandOptions)),geoadd:(...n)=>this.chain(new E(n,this.commandOptions)),geodist:(...n)=>this.chain(new z(n,this.commandOptions)),geopos:(...n)=>this.chain(new J(n,this.commandOptions)),geohash:(...n)=>this.chain(new P(n,this.commandOptions)),geosearch:(...n)=>this.chain(new I(n,this.commandOptions)),geosearchstore:(...n)=>this.chain(new K(n,this.commandOptions)),get:(...n)=>this.chain(new xn(n,this.commandOptions)),mget:(...n)=>this.chain(new fn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new yn(n,this.commandOptions)),nummultby:(...n)=>this.chain(new bn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new On(n,this.commandOptions)),objlen:(...n)=>this.chain(new Tn(n,this.commandOptions)),resp:(...n)=>this.chain(new wn(n,this.commandOptions)),set:(...n)=>this.chain(new Dn(n,this.commandOptions)),strappend:(...n)=>this.chain(new kn(n,this.commandOptions)),strlen:(...n)=>this.chain(new An(n,this.commandOptions)),toggle:(...n)=>this.chain(new Sn(n,this.commandOptions)),type:(...n)=>this.chain(new Rn(n,this.commandOptions))}}};import ye from"crypto-js/enc-hex";import be from"crypto-js/sha1";var me=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return ye.stringify(be(n))}};var ue=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new an(n,this.opts).exec(this.client),arrindex:(...n)=>new pn(n,this.opts).exec(this.client),arrinsert:(...n)=>new dn(n,this.opts).exec(this.client),arrlen:(...n)=>new cn(n,this.opts).exec(this.client),arrpop:(...n)=>new un(n,this.opts).exec(this.client),arrtrim:(...n)=>new hn(n,this.opts).exec(this.client),clear:(...n)=>new Cn(n,this.opts).exec(this.client),del:(...n)=>new ln(n,this.opts).exec(this.client),forget:(...n)=>new gn(n,this.opts).exec(this.client),geoadd:(...n)=>new E(n,this.opts).exec(this.client),geopos:(...n)=>new J(n,this.opts).exec(this.client),geodist:(...n)=>new z(n,this.opts).exec(this.client),geohash:(...n)=>new P(n,this.opts).exec(this.client),geosearch:(...n)=>new I(n,this.opts).exec(this.client),geosearchstore:(...n)=>new K(n,this.opts).exec(this.client),get:(...n)=>new xn(n,this.opts).exec(this.client),mget:(...n)=>new fn(n,this.opts).exec(this.client),numincrby:(...n)=>new yn(n,this.opts).exec(this.client),nummultby:(...n)=>new bn(n,this.opts).exec(this.client),objkeys:(...n)=>new On(n,this.opts).exec(this.client),objlen:(...n)=>new Tn(n,this.opts).exec(this.client),resp:(...n)=>new wn(n,this.opts).exec(this.client),set:(...n)=>new Dn(n,this.opts).exec(this.client),strappend:(...n)=>new kn(n,this.opts).exec(this.client),strlen:(...n)=>new An(n,this.opts).exec(this.client),toggle:(...n)=>new Sn(n,this.opts).exec(this.client),type:(...n)=>new Rn(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new me(this,n)}pipeline=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new C(n,this.opts).exec(this.client);bitcount=(...n)=>new l(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new g([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new x(n,this.opts).exec(this.client);copy=(...n)=>new f(n,this.opts).exec(this.client);dbsize=()=>new y(this.opts).exec(this.client);decr=(...n)=>new b(n,this.opts).exec(this.client);decrby=(...n)=>new O(n,this.opts).exec(this.client);del=(...n)=>new T(n,this.opts).exec(this.client);echo=(...n)=>new w(n,this.opts).exec(this.client);eval=(...n)=>new D(n,this.opts).exec(this.client);evalsha=(...n)=>new k(n,this.opts).exec(this.client);exists=(...n)=>new A(n,this.opts).exec(this.client);expire=(...n)=>new S(n,this.opts).exec(this.client);expireat=(...n)=>new R(n,this.opts).exec(this.client);flushall=n=>new M(n,this.opts).exec(this.client);flushdb=(...n)=>new v(n,this.opts).exec(this.client);get=(...n)=>new L(n,this.opts).exec(this.client);getbit=(...n)=>new Z(n,this.opts).exec(this.client);getdel=(...n)=>new N(n,this.opts).exec(this.client);getrange=(...n)=>new G(n,this.opts).exec(this.client);getset=(n,t)=>new B([n,t],this.opts).exec(this.client);hdel=(...n)=>new U(n,this.opts).exec(this.client);hexists=(...n)=>new H(n,this.opts).exec(this.client);hget=(...n)=>new F(n,this.opts).exec(this.client);hgetall=(...n)=>new q(n,this.opts).exec(this.client);hincrby=(...n)=>new $(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new X(n,this.opts).exec(this.client);hkeys=(...n)=>new j(n,this.opts).exec(this.client);hlen=(...n)=>new Y(n,this.opts).exec(this.client);hmget=(...n)=>new W(n,this.opts).exec(this.client);hmset=(n,t)=>new V([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new _([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new Q(n,this.opts).exec(this.client);hset=(n,t)=>new nn([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new tn([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new en(n,this.opts).exec(this.client);hvals=(...n)=>new on(n,this.opts).exec(this.client);incr=(...n)=>new sn(n,this.opts).exec(this.client);incrby=(...n)=>new mn(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new rn(n,this.opts).exec(this.client);keys=(...n)=>new Mn(n,this.opts).exec(this.client);lindex=(...n)=>new vn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new En([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new zn(n,this.opts).exec(this.client);lmove=(...n)=>new Jn(n,this.opts).exec(this.client);lpop=(...n)=>new Pn(n,this.opts).exec(this.client);lpos=(...n)=>new In(n,this.opts).exec(this.client);lpush=(n,...t)=>new Kn([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new Ln([n,...t],this.opts).exec(this.client);lrange=(...n)=>new Zn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Nn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new Gn([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Bn(n,this.opts).exec(this.client);mget=(...n)=>new Un(n,this.opts).exec(this.client);mset=n=>new Hn([n],this.opts).exec(this.client);msetnx=n=>new Fn([n],this.opts).exec(this.client);persist=(...n)=>new qn(n,this.opts).exec(this.client);pexpire=(...n)=>new $n(n,this.opts).exec(this.client);pexpireat=(...n)=>new Xn(n,this.opts).exec(this.client);ping=n=>new jn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new Yn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new Wn(n,this.opts).exec(this.client);publish=(...n)=>new Vn(n,this.opts).exec(this.client);randomkey=()=>new _n().exec(this.client);rename=(...n)=>new Qn(n,this.opts).exec(this.client);renamenx=(...n)=>new nt(n,this.opts).exec(this.client);rpop=(...n)=>new tt(n,this.opts).exec(this.client);rpush=(n,...t)=>new et([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new ot([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new st([n,...t],this.opts).exec(this.client);scan=(...n)=>new mt(n,this.opts).exec(this.client);scard=(...n)=>new rt(n,this.opts).exec(this.client);scriptExists=(...n)=>new at(n,this.opts).exec(this.client);scriptFlush=(...n)=>new it(n,this.opts).exec(this.client);scriptLoad=(...n)=>new pt(n,this.opts).exec(this.client);sdiff=(...n)=>new dt(n,this.opts).exec(this.client);sdiffstore=(...n)=>new ct(n,this.opts).exec(this.client);set=(n,t,o)=>new ut([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new ht(n,this.opts).exec(this.client);setex=(n,t,o)=>new Ct([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new lt([n,t],this.opts).exec(this.client);setrange=(...n)=>new gt(n,this.opts).exec(this.client);sinter=(...n)=>new xt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ft(n,this.opts).exec(this.client);sismember=(n,t)=>new yt([n,t],this.opts).exec(this.client);smismember=(n,t)=>new Ot([n,t],this.opts).exec(this.client);smembers=(...n)=>new bt(n,this.opts).exec(this.client);smove=(n,t,o)=>new Tt([n,t,o],this.opts).exec(this.client);spop=(...n)=>new wt(n,this.opts).exec(this.client);srandmember=(...n)=>new Dt(n,this.opts).exec(this.client);srem=(n,...t)=>new kt([n,...t],this.opts).exec(this.client);sscan=(...n)=>new At(n,this.opts).exec(this.client);strlen=(...n)=>new St(n,this.opts).exec(this.client);sunion=(...n)=>new Rt(n,this.opts).exec(this.client);sunionstore=(...n)=>new Mt(n,this.opts).exec(this.client);time=()=>new vt().exec(this.client);touch=(...n)=>new Et(n,this.opts).exec(this.client);ttl=(...n)=>new zt(n,this.opts).exec(this.client);type=(...n)=>new Jt(n,this.opts).exec(this.client);unlink=(...n)=>new Pt(n,this.opts).exec(this.client);xadd=(...n)=>new oe(n,this.opts).exec(this.client);xrange=(...n)=>new se(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new It(n,this.opts).exec(this.client);zcount=(...n)=>new Kt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new Qt(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Lt([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new Zt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Nt(n,this.opts).exec(this.client);zmscore=(...n)=>new ne(n,this.opts).exec(this.client);zpopmax=(...n)=>new Gt(n,this.opts).exec(this.client);zpopmin=(...n)=>new Bt(n,this.opts).exec(this.client);zrange=(...n)=>new Ut(n,this.opts).exec(this.client);zrank=(n,t)=>new Ht([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new Ft([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new qt(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new $t(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new Xt(n,this.opts).exec(this.client);zrevrank=(n,t)=>new jt([n,t],this.opts).exec(this.client);zscan=(...n)=>new Yt(n,this.opts).exec(this.client);zscore=(n,t)=>new Wt([n,t],this.opts).exec(this.client);zunion=(...n)=>new Vt(n,this.opts).exec(this.client);zunionstore=(...n)=>new _t(n,this.opts).exec(this.client)};var cC="v1.24.3";export{ie as a,ue as b,cC as c};
|
package/cloudflare.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var be=Object.create;var oe=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var Ae=(s,n)=>{for(var t in n)oe(s,t,{get:n[t],enumerable:!0})},ue=(s,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let m of Oe(n))!De.call(s,m)&&m!==t&&oe(s,m,{get:()=>n[m],enumerable:!(o=Te(n,m))||o.enumerable});return s};var he=(s,n,t)=>(t=s!=null?be(we(s)):{},ue(n||!s||!s.__esModule?oe(t,"default",{value:s,enumerable:!0}):t,s)),ke=s=>ue(oe({},"__esModule",{value:!0}),s);var ze={};Ae(ze,{Redis:()=>de});module.exports=ke(ze);var c=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var se=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(p=>setTimeout(p,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new c(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:p})=>({result:pe(i),error:p})):{result:pe(r.result),error:r.error}:r}};function le(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function pe(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?le(t):Array.isArray(t)?t.map(pe):t):n=null;break}case"string":{n=s==="OK"?"OK":le(s);break}default:break}return n}function Ce(s){let n=Array.isArray(s)?s.map(t=>{try{return Ce(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ge(s){try{return Ce(s)}catch{return s}}var Se=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=Se,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??ge:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new c(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var l=class extends e{constructor(n,t){super(["append",...n],t)}};var C=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var g=class extends e{constructor(n,t){super(["bitop",...n],t)}};var x=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var f=class extends e{constructor([n,t,o],m){super(["COPY",n,t,...o?.replace?["REPLACE"]:[]],{...m,deserialize(r){return r>0?"COPIED":"NOT_COPIED"}})}};var y=class extends e{constructor(n){super(["dbsize"],n)}};var b=class extends e{constructor(n,t){super(["decr",...n],t)}};var T=class extends e{constructor(n,t){super(["decrby",...n],t)}};var O=class extends e{constructor(n,t){super(["del",...n],t)}};var w=class extends e{constructor(n,t){super(["echo",...n],t)}};var D=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var A=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var k=class extends e{constructor(n,t){super(["exists",...n],t)}};var S=class extends e{constructor(n,t){super(["expire",...n],t)}};var R=class extends e{constructor(n,t){super(["expireat",...n],t)}};var E=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var M=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var v=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:p})=>[i,a,p])),super(r,m)}};var P=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var I=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOPOS",o,...m],{deserialize:r=>Re(r),...t})}};function Re(s){let n=[];for(let t of s)!t?.[0]||!t?.[1]||n.push({lng:parseFloat(t[0]),lat:parseFloat(t[1])});return n}var z=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOHASH",o,...m],t)}};var L=class extends e{constructor([n,t,o,m,r],a){let i=["GEOSEARCH",n];(t.type==="FROMMEMBER"||t.type==="frommember")&&i.push(t.type,t.member),(t.type==="FROMLONLAT"||t.type==="fromlonlat")&&i.push(t.type,t.coordinate.lon,t.coordinate.lat),(o.type==="BYRADIUS"||o.type==="byradius")&&i.push(o.type,o.radius,o.radiusType),(o.type==="BYBOX"||o.type==="bybox")&&i.push(o.type,o.rect.width,o.rect.height,o.rectType),i.push(m),r?.count&&i.push(r.count.limit,...r.count.any?["ANY"]:[]);let p=ce=>!r?.withCoord&&!r?.withDist&&!r?.withHash?ce.map(d=>{try{return{member:JSON.parse(d)}}catch{return{member:d}}}):ce.map(d=>{let ee=1,h={};try{h.member=JSON.parse(d[0])}catch{h.member=d[0]}return r.withDist&&(h.dist=parseFloat(d[ee++])),r.withHash&&(h.hash=d[ee++].toString()),r.withCoord&&(h.coord={long:parseFloat(d[ee][0]),lat:parseFloat(d[ee][1])}),h});super([...i,...r?.withCoord?["WITHCOORD"]:[],...r?.withDist?["WITHDIST"]:[],...r?.withHash?["WITHHASH"]:[]],{...a,deserialize:p})}};var J=class extends e{constructor([n,t,o,m,r,a],i){let p=["GEOSEARCHSTORE",n,t];(o.type==="FROMMEMBER"||o.type==="frommember")&&p.push(o.type,o.member),(o.type==="FROMLONLAT"||o.type==="fromlonlat")&&p.push(o.type,o.coordinate.lon,o.coordinate.lat),(m.type==="BYRADIUS"||m.type==="byradius")&&p.push(m.type,m.radius,m.radiusType),(m.type==="BYBOX"||m.type==="bybox")&&p.push(m.type,m.rect.width,m.rect.height,m.rectType),p.push(r),a?.count&&p.push(a.count.limit,...a.count.any?["ANY"]:[]),super([...p,...a?.storeDist?["STOREDIST"]:[]],i)}};var K=class extends e{constructor(n,t){super(["get",...n],t)}};var N=class extends e{constructor(n,t){super(["getbit",...n],t)}};var Z=class extends e{constructor(n,t){super(["getdel",...n],t)}};var U=class extends e{constructor(n,t){super(["getrange",...n],t)}};var G=class extends e{constructor(n,t){super(["getset",...n],t)}};var H=class extends e{constructor(n,t){super(["hdel",...n],t)}};var B=class extends e{constructor(n,t){super(["hexists",...n],t)}};var F=class extends e{constructor(n,t){super(["hget",...n],t)}};function Ee(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var _=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>Ee(o),...t})}};var q=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var $=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var X=class extends e{constructor([n],t){super(["hkeys",n],t)}};var j=class extends e{constructor(n,t){super(["hlen",...n],t)}};function Me(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var Y=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>Me(t,m),...o})}};var W=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function ve(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var V=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>ve(m):t?.deserialize,...t})}};var Q=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var nn=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var tn=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var en=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var on=class extends e{constructor(n,t){super(["hvals",...n],t)}};var sn=class extends e{constructor(n,t){super(["incr",...n],t)}};var mn=class extends e{constructor(n,t){super(["incrby",...n],t)}};var rn=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var dn=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var cn=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var un=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var hn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var ln=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var yn=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var wn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var Dn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var An=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var kn=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var Sn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Rn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var En=class extends e{constructor(n,t){super(["keys",...n],t)}};var Mn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var vn=class extends e{constructor(n,t){super(["linsert",...n],t)}};var Pn=class extends e{constructor(n,t){super(["llen",...n],t)}};var In=class extends e{constructor(n,t){super(["lmove",...n],t)}};var zn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Ln=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var Jn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Kn=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Nn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Zn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Un=class extends e{constructor(n,t){super(["lset",...n],t)}};var Gn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Hn=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Bn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Fn=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var _n=class extends e{constructor(n,t){super(["persist",...n],t)}};var qn=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var $n=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var Xn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var jn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Yn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var Wn=class extends e{constructor(n,t){super(["publish",...n],t)}};var Vn=class extends e{constructor(n){super(["randomkey"],n)}};var Qn=class extends e{constructor(n,t){super(["rename",...n],t)}};var nt=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var tt=class extends e{constructor(n,t){super(["rpop",...n],t)}};var et=class extends e{constructor(n,t){super(["rpush",...n],t)}};var ot=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var st=class extends e{constructor(n,t){super(["sadd",...n],t)}};var mt=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var rt=class extends e{constructor(n,t){super(["scard",...n],t)}};var at=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var it=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var pt=class extends e{constructor(n,t){super(["script","load",...n],t)}};var dt=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var ct=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var ut=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var ht=class extends e{constructor(n,t){super(["setbit",...n],t)}};var lt=class extends e{constructor(n,t){super(["setex",...n],t)}};var Ct=class extends e{constructor(n,t){super(["setnx",...n],t)}};var gt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var xt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ft=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var yt=class extends e{constructor(n,t){super(["sismember",...n],t)}};var bt=class extends e{constructor(n,t){super(["smembers",...n],t)}};var Tt=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Ot=class extends e{constructor(n,t){super(["smove",...n],t)}};var wt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var Dt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var At=class extends e{constructor(n,t){super(["srem",...n],t)}};var kt=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var St=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Rt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Et=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var Mt=class extends e{constructor(n){super(["time"],n)}};var vt=class extends e{constructor(n,t){super(["touch",...n],t)}};var Pt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var It=class extends e{constructor(n,t){super(["type",...n],t)}};var zt=class extends e{constructor(n,t){super(["unlink",...n],t)}};var me=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,p]of Object.entries(o))a.push(i,p);super(a,r)}};function Pe(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var re=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>Pe(i),...r})}};var u=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Lt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var Jt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Kt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Nt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Zt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Ut=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Gt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Ht=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Bt=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Ft=class extends e{constructor(n,t){super(["zrem",...n],t)}};var _t=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var qt=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var $t=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var Xt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var jt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var Yt=class extends e{constructor(n,t){super(["zscore",...n],t)}};var Wt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var Vt=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Qt=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var ne=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var te=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new c(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new l(n,this.commandOptions));bitcount=(...n)=>this.chain(new C(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new g([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new x(n,this.commandOptions));copy=(...n)=>this.chain(new f(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new Qt(n,this.commandOptions));dbsize=()=>this.chain(new y(this.commandOptions));decr=(...n)=>this.chain(new b(n,this.commandOptions));decrby=(...n)=>this.chain(new T(n,this.commandOptions));del=(...n)=>this.chain(new O(n,this.commandOptions));echo=(...n)=>this.chain(new w(n,this.commandOptions));eval=(...n)=>this.chain(new D(n,this.commandOptions));evalsha=(...n)=>this.chain(new A(n,this.commandOptions));exists=(...n)=>this.chain(new k(n,this.commandOptions));expire=(...n)=>this.chain(new S(n,this.commandOptions));expireat=(...n)=>this.chain(new R(n,this.commandOptions));flushall=n=>this.chain(new E(n,this.commandOptions));flushdb=(...n)=>this.chain(new M(n,this.commandOptions));get=(...n)=>this.chain(new K(n,this.commandOptions));getbit=(...n)=>this.chain(new N(n,this.commandOptions));getdel=(...n)=>this.chain(new Z(n,this.commandOptions));getrange=(...n)=>this.chain(new U(n,this.commandOptions));getset=(n,t)=>this.chain(new G([n,t],this.commandOptions));hdel=(...n)=>this.chain(new H(n,this.commandOptions));hexists=(...n)=>this.chain(new B(n,this.commandOptions));hget=(...n)=>this.chain(new F(n,this.commandOptions));hgetall=(...n)=>this.chain(new _(n,this.commandOptions));hincrby=(...n)=>this.chain(new q(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new $(n,this.commandOptions));hkeys=(...n)=>this.chain(new X(n,this.commandOptions));hlen=(...n)=>this.chain(new j(n,this.commandOptions));hmget=(...n)=>this.chain(new Y(n,this.commandOptions));hmset=(n,t)=>this.chain(new W([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new V([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new Q(n,this.commandOptions));hset=(n,t)=>this.chain(new nn([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new tn([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new en(n,this.commandOptions));hvals=(...n)=>this.chain(new on(n,this.commandOptions));incr=(...n)=>this.chain(new sn(n,this.commandOptions));incrby=(...n)=>this.chain(new mn(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new rn(n,this.commandOptions));keys=(...n)=>this.chain(new En(n,this.commandOptions));lindex=(...n)=>this.chain(new Mn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new vn([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new Pn(n,this.commandOptions));lmove=(...n)=>this.chain(new In(n,this.commandOptions));lpop=(...n)=>this.chain(new zn(n,this.commandOptions));lpos=(...n)=>this.chain(new Ln(n,this.commandOptions));lpush=(n,...t)=>this.chain(new Jn([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new Kn([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new Nn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Zn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new Un([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Gn(n,this.commandOptions));mget=(...n)=>this.chain(new Hn(n,this.commandOptions));mset=n=>this.chain(new Bn([n],this.commandOptions));msetnx=n=>this.chain(new Fn([n],this.commandOptions));persist=(...n)=>this.chain(new _n(n,this.commandOptions));pexpire=(...n)=>this.chain(new qn(n,this.commandOptions));pexpireat=(...n)=>this.chain(new $n(n,this.commandOptions));ping=n=>this.chain(new Xn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new jn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new Yn(n,this.commandOptions));publish=(...n)=>this.chain(new Wn(n,this.commandOptions));randomkey=()=>this.chain(new Vn(this.commandOptions));rename=(...n)=>this.chain(new Qn(n,this.commandOptions));renamenx=(...n)=>this.chain(new nt(n,this.commandOptions));rpop=(...n)=>this.chain(new tt(n,this.commandOptions));rpush=(n,...t)=>this.chain(new et([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new ot([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new st([n,...t],this.commandOptions));scan=(...n)=>this.chain(new mt(n,this.commandOptions));scard=(...n)=>this.chain(new rt(n,this.commandOptions));scriptExists=(...n)=>this.chain(new at(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new it(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new pt(n,this.commandOptions));sdiff=(...n)=>this.chain(new dt(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new ct(n,this.commandOptions));set=(n,t,o)=>this.chain(new ut([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new ht(n,this.commandOptions));setex=(n,t,o)=>this.chain(new lt([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new Ct([n,t],this.commandOptions));setrange=(...n)=>this.chain(new gt(n,this.commandOptions));sinter=(...n)=>this.chain(new xt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ft(n,this.commandOptions));sismember=(n,t)=>this.chain(new yt([n,t],this.commandOptions));smembers=(...n)=>this.chain(new bt(n,this.commandOptions));smismember=(n,t)=>this.chain(new Tt([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Ot([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new wt(n,this.commandOptions));srandmember=(...n)=>this.chain(new Dt(n,this.commandOptions));srem=(n,...t)=>this.chain(new At([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new kt(n,this.commandOptions));strlen=(...n)=>this.chain(new St(n,this.commandOptions));sunion=(...n)=>this.chain(new Rt(n,this.commandOptions));sunionstore=(...n)=>this.chain(new Et(n,this.commandOptions));time=()=>this.chain(new Mt(this.commandOptions));touch=(...n)=>this.chain(new vt(n,this.commandOptions));ttl=(...n)=>this.chain(new Pt(n,this.commandOptions));type=(...n)=>this.chain(new It(n,this.commandOptions));unlink=(...n)=>this.chain(new zt(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Lt(n,this.commandOptions));zcount=(...n)=>this.chain(new Jt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Kt([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new Nt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Zt(n,this.commandOptions));zmscore=(...n)=>this.chain(new ne(n,this.commandOptions));zpopmax=(...n)=>this.chain(new Ut(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Gt(n,this.commandOptions));zrange=(...n)=>this.chain(new Ht(n,this.commandOptions));zrank=(n,t)=>this.chain(new Bt([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new Ft([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new _t(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new qt(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new $t(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new Xt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new jt(n,this.commandOptions));zscore=(n,t)=>this.chain(new Yt([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new Vt(n,this.commandOptions));zunion=(...n)=>this.chain(new Wt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new an(n,this.commandOptions)),arrindex:(...n)=>this.chain(new pn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new dn(n,this.commandOptions)),arrlen:(...n)=>this.chain(new cn(n,this.commandOptions)),arrpop:(...n)=>this.chain(new un(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new hn(n,this.commandOptions)),clear:(...n)=>this.chain(new ln(n,this.commandOptions)),del:(...n)=>this.chain(new Cn(n,this.commandOptions)),forget:(...n)=>this.chain(new gn(n,this.commandOptions)),geoadd:(...n)=>this.chain(new v(n,this.commandOptions)),geodist:(...n)=>this.chain(new P(n,this.commandOptions)),geopos:(...n)=>this.chain(new I(n,this.commandOptions)),geohash:(...n)=>this.chain(new z(n,this.commandOptions)),geosearch:(...n)=>this.chain(new L(n,this.commandOptions)),geosearchstore:(...n)=>this.chain(new J(n,this.commandOptions)),get:(...n)=>this.chain(new xn(n,this.commandOptions)),mget:(...n)=>this.chain(new fn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new yn(n,this.commandOptions)),nummultby:(...n)=>this.chain(new bn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new Tn(n,this.commandOptions)),objlen:(...n)=>this.chain(new On(n,this.commandOptions)),resp:(...n)=>this.chain(new wn(n,this.commandOptions)),set:(...n)=>this.chain(new Dn(n,this.commandOptions)),strappend:(...n)=>this.chain(new An(n,this.commandOptions)),strlen:(...n)=>this.chain(new kn(n,this.commandOptions)),toggle:(...n)=>this.chain(new Sn(n,this.commandOptions)),type:(...n)=>this.chain(new Rn(n,this.commandOptions))}}};var xe=he(require("crypto-js/enc-hex")),fe=he(require("crypto-js/sha1")),ae=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return xe.default.stringify((0,fe.default)(n))}};var ie=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new an(n,this.opts).exec(this.client),arrindex:(...n)=>new pn(n,this.opts).exec(this.client),arrinsert:(...n)=>new dn(n,this.opts).exec(this.client),arrlen:(...n)=>new cn(n,this.opts).exec(this.client),arrpop:(...n)=>new un(n,this.opts).exec(this.client),arrtrim:(...n)=>new hn(n,this.opts).exec(this.client),clear:(...n)=>new ln(n,this.opts).exec(this.client),del:(...n)=>new Cn(n,this.opts).exec(this.client),forget:(...n)=>new gn(n,this.opts).exec(this.client),geoadd:(...n)=>new v(n,this.opts).exec(this.client),geopos:(...n)=>new I(n,this.opts).exec(this.client),geodist:(...n)=>new P(n,this.opts).exec(this.client),geohash:(...n)=>new z(n,this.opts).exec(this.client),geosearch:(...n)=>new L(n,this.opts).exec(this.client),geosearchstore:(...n)=>new J(n,this.opts).exec(this.client),get:(...n)=>new xn(n,this.opts).exec(this.client),mget:(...n)=>new fn(n,this.opts).exec(this.client),numincrby:(...n)=>new yn(n,this.opts).exec(this.client),nummultby:(...n)=>new bn(n,this.opts).exec(this.client),objkeys:(...n)=>new Tn(n,this.opts).exec(this.client),objlen:(...n)=>new On(n,this.opts).exec(this.client),resp:(...n)=>new wn(n,this.opts).exec(this.client),set:(...n)=>new Dn(n,this.opts).exec(this.client),strappend:(...n)=>new An(n,this.opts).exec(this.client),strlen:(...n)=>new kn(n,this.opts).exec(this.client),toggle:(...n)=>new Sn(n,this.opts).exec(this.client),type:(...n)=>new Rn(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new ae(this,n)}pipeline=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new l(n,this.opts).exec(this.client);bitcount=(...n)=>new C(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new g([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new x(n,this.opts).exec(this.client);copy=(...n)=>new f(n,this.opts).exec(this.client);dbsize=()=>new y(this.opts).exec(this.client);decr=(...n)=>new b(n,this.opts).exec(this.client);decrby=(...n)=>new T(n,this.opts).exec(this.client);del=(...n)=>new O(n,this.opts).exec(this.client);echo=(...n)=>new w(n,this.opts).exec(this.client);eval=(...n)=>new D(n,this.opts).exec(this.client);evalsha=(...n)=>new A(n,this.opts).exec(this.client);exists=(...n)=>new k(n,this.opts).exec(this.client);expire=(...n)=>new S(n,this.opts).exec(this.client);expireat=(...n)=>new R(n,this.opts).exec(this.client);flushall=n=>new E(n,this.opts).exec(this.client);flushdb=(...n)=>new M(n,this.opts).exec(this.client);get=(...n)=>new K(n,this.opts).exec(this.client);getbit=(...n)=>new N(n,this.opts).exec(this.client);getdel=(...n)=>new Z(n,this.opts).exec(this.client);getrange=(...n)=>new U(n,this.opts).exec(this.client);getset=(n,t)=>new G([n,t],this.opts).exec(this.client);hdel=(...n)=>new H(n,this.opts).exec(this.client);hexists=(...n)=>new B(n,this.opts).exec(this.client);hget=(...n)=>new F(n,this.opts).exec(this.client);hgetall=(...n)=>new _(n,this.opts).exec(this.client);hincrby=(...n)=>new q(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new $(n,this.opts).exec(this.client);hkeys=(...n)=>new X(n,this.opts).exec(this.client);hlen=(...n)=>new j(n,this.opts).exec(this.client);hmget=(...n)=>new Y(n,this.opts).exec(this.client);hmset=(n,t)=>new W([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new V([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new Q(n,this.opts).exec(this.client);hset=(n,t)=>new nn([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new tn([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new en(n,this.opts).exec(this.client);hvals=(...n)=>new on(n,this.opts).exec(this.client);incr=(...n)=>new sn(n,this.opts).exec(this.client);incrby=(...n)=>new mn(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new rn(n,this.opts).exec(this.client);keys=(...n)=>new En(n,this.opts).exec(this.client);lindex=(...n)=>new Mn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new vn([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new Pn(n,this.opts).exec(this.client);lmove=(...n)=>new In(n,this.opts).exec(this.client);lpop=(...n)=>new zn(n,this.opts).exec(this.client);lpos=(...n)=>new Ln(n,this.opts).exec(this.client);lpush=(n,...t)=>new Jn([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new Kn([n,...t],this.opts).exec(this.client);lrange=(...n)=>new Nn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Zn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new Un([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Gn(n,this.opts).exec(this.client);mget=(...n)=>new Hn(n,this.opts).exec(this.client);mset=n=>new Bn([n],this.opts).exec(this.client);msetnx=n=>new Fn([n],this.opts).exec(this.client);persist=(...n)=>new _n(n,this.opts).exec(this.client);pexpire=(...n)=>new qn(n,this.opts).exec(this.client);pexpireat=(...n)=>new $n(n,this.opts).exec(this.client);ping=n=>new Xn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new jn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new Yn(n,this.opts).exec(this.client);publish=(...n)=>new Wn(n,this.opts).exec(this.client);randomkey=()=>new Vn().exec(this.client);rename=(...n)=>new Qn(n,this.opts).exec(this.client);renamenx=(...n)=>new nt(n,this.opts).exec(this.client);rpop=(...n)=>new tt(n,this.opts).exec(this.client);rpush=(n,...t)=>new et([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new ot([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new st([n,...t],this.opts).exec(this.client);scan=(...n)=>new mt(n,this.opts).exec(this.client);scard=(...n)=>new rt(n,this.opts).exec(this.client);scriptExists=(...n)=>new at(n,this.opts).exec(this.client);scriptFlush=(...n)=>new it(n,this.opts).exec(this.client);scriptLoad=(...n)=>new pt(n,this.opts).exec(this.client);sdiff=(...n)=>new dt(n,this.opts).exec(this.client);sdiffstore=(...n)=>new ct(n,this.opts).exec(this.client);set=(n,t,o)=>new ut([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new ht(n,this.opts).exec(this.client);setex=(n,t,o)=>new lt([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new Ct([n,t],this.opts).exec(this.client);setrange=(...n)=>new gt(n,this.opts).exec(this.client);sinter=(...n)=>new xt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ft(n,this.opts).exec(this.client);sismember=(n,t)=>new yt([n,t],this.opts).exec(this.client);smismember=(n,t)=>new Tt([n,t],this.opts).exec(this.client);smembers=(...n)=>new bt(n,this.opts).exec(this.client);smove=(n,t,o)=>new Ot([n,t,o],this.opts).exec(this.client);spop=(...n)=>new wt(n,this.opts).exec(this.client);srandmember=(...n)=>new Dt(n,this.opts).exec(this.client);srem=(n,...t)=>new At([n,...t],this.opts).exec(this.client);sscan=(...n)=>new kt(n,this.opts).exec(this.client);strlen=(...n)=>new St(n,this.opts).exec(this.client);sunion=(...n)=>new Rt(n,this.opts).exec(this.client);sunionstore=(...n)=>new Et(n,this.opts).exec(this.client);time=()=>new Mt().exec(this.client);touch=(...n)=>new vt(n,this.opts).exec(this.client);ttl=(...n)=>new Pt(n,this.opts).exec(this.client);type=(...n)=>new It(n,this.opts).exec(this.client);unlink=(...n)=>new zt(n,this.opts).exec(this.client);xadd=(...n)=>new me(n,this.opts).exec(this.client);xrange=(...n)=>new re(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Lt(n,this.opts).exec(this.client);zcount=(...n)=>new Jt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new Qt(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Kt([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new Nt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Zt(n,this.opts).exec(this.client);zmscore=(...n)=>new ne(n,this.opts).exec(this.client);zpopmax=(...n)=>new Ut(n,this.opts).exec(this.client);zpopmin=(...n)=>new Gt(n,this.opts).exec(this.client);zrange=(...n)=>new Ht(n,this.opts).exec(this.client);zrank=(n,t)=>new Bt([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new Ft([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new _t(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new qt(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new $t(n,this.opts).exec(this.client);zrevrank=(n,t)=>new Xt([n,t],this.opts).exec(this.client);zscan=(...n)=>new jt(n,this.opts).exec(this.client);zscore=(n,t)=>new Yt([n,t],this.opts).exec(this.client);zunion=(...n)=>new Wt(n,this.opts).exec(this.client);zunionstore=(...n)=>new Vt(n,this.opts).exec(this.client)};var ye="v1.24.2";var de=class s extends ie{constructor(n,t){(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let o=new se({retry:n.retry,baseUrl:n.url,headers:{authorization:`Bearer ${n.token}`},responseEncoding:n.responseEncoding});super(o,{enableTelemetry:!t?.UPSTASH_DISABLE_TELEMETRY,automaticDeserialization:n.automaticDeserialization}),this.addTelemetry({platform:"cloudflare",sdk:`@upstash/redis@${ye}`})}static fromEnv(n,t){let o=n?.UPSTASH_REDIS_REST_URL??UPSTASH_REDIS_REST_URL,m=n?.UPSTASH_REDIS_REST_TOKEN??UPSTASH_REDIS_REST_TOKEN;if(!o)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`");if(!m)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`");return new s({...t,url:o,token:m},n)}};0&&(module.exports={Redis});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkJIU2S2DZjs = require('./chunk-JIU2S2DZ.js');var a=class S extends _chunkJIU2S2DZjs.b{constructor(e,r){(e.url.startsWith(" ")||e.url.endsWith(" ")||/\r|\n/.test(e.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(e.token.startsWith(" ")||e.token.endsWith(" ")||/\r|\n/.test(e.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new (0, _chunkJIU2S2DZjs.a)({retry:e.retry,baseUrl:e.url,headers:{authorization:`Bearer ${e.token}`},responseEncoding:e.responseEncoding});super(t,{enableTelemetry:!_optionalChain([r, 'optionalAccess', _ => _.UPSTASH_DISABLE_TELEMETRY]),automaticDeserialization:e.automaticDeserialization}),this.addTelemetry({platform:"cloudflare",sdk:`@upstash/redis@${_chunkJIU2S2DZjs.c}`})}static fromEnv(e,r){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _2 => _2.UPSTASH_REDIS_REST_URL]), () => (UPSTASH_REDIS_REST_URL)),s=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _3 => _3.UPSTASH_REDIS_REST_TOKEN]), () => (UPSTASH_REDIS_REST_TOKEN));if(!t)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`");if(!s)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`");return new S({...r,url:t,token:s},e)}};exports.Redis = a;
|
package/cloudflare.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var oe=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(p=>setTimeout(p,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new c(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:p})=>({result:ie(i),error:p})):{result:ie(r.result),error:r.error}:r}};function de(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function ie(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?de(t):Array.isArray(t)?t.map(ie):t):n=null;break}case"string":{n=s==="OK"?"OK":de(s);break}default:break}return n}function ce(s){let n=Array.isArray(s)?s.map(t=>{try{return ce(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ue(s){try{return ce(s)}catch{return s}}var Ce=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=Ce,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??ue:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new c(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var l=class extends e{constructor(n,t){super(["append",...n],t)}};var C=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var g=class extends e{constructor(n,t){super(["bitop",...n],t)}};var x=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var f=class extends e{constructor([n,t,o],m){super(["COPY",n,t,...o?.replace?["REPLACE"]:[]],{...m,deserialize(r){return r>0?"COPIED":"NOT_COPIED"}})}};var y=class extends e{constructor(n){super(["dbsize"],n)}};var b=class extends e{constructor(n,t){super(["decr",...n],t)}};var T=class extends e{constructor(n,t){super(["decrby",...n],t)}};var O=class extends e{constructor(n,t){super(["del",...n],t)}};var w=class extends e{constructor(n,t){super(["echo",...n],t)}};var D=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var A=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var k=class extends e{constructor(n,t){super(["exists",...n],t)}};var S=class extends e{constructor(n,t){super(["expire",...n],t)}};var R=class extends e{constructor(n,t){super(["expireat",...n],t)}};var E=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var M=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var v=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:p})=>[i,a,p])),super(r,m)}};var P=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var I=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOPOS",o,...m],{deserialize:r=>ge(r),...t})}};function ge(s){let n=[];for(let t of s)!t?.[0]||!t?.[1]||n.push({lng:parseFloat(t[0]),lat:parseFloat(t[1])});return n}var z=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOHASH",o,...m],t)}};var L=class extends e{constructor([n,t,o,m,r],a){let i=["GEOSEARCH",n];(t.type==="FROMMEMBER"||t.type==="frommember")&&i.push(t.type,t.member),(t.type==="FROMLONLAT"||t.type==="fromlonlat")&&i.push(t.type,t.coordinate.lon,t.coordinate.lat),(o.type==="BYRADIUS"||o.type==="byradius")&&i.push(o.type,o.radius,o.radiusType),(o.type==="BYBOX"||o.type==="bybox")&&i.push(o.type,o.rect.width,o.rect.height,o.rectType),i.push(m),r?.count&&i.push(r.count.limit,...r.count.any?["ANY"]:[]);let p=pe=>!r?.withCoord&&!r?.withDist&&!r?.withHash?pe.map(d=>{try{return{member:JSON.parse(d)}}catch{return{member:d}}}):pe.map(d=>{let ee=1,h={};try{h.member=JSON.parse(d[0])}catch{h.member=d[0]}return r.withDist&&(h.dist=parseFloat(d[ee++])),r.withHash&&(h.hash=d[ee++].toString()),r.withCoord&&(h.coord={long:parseFloat(d[ee][0]),lat:parseFloat(d[ee][1])}),h});super([...i,...r?.withCoord?["WITHCOORD"]:[],...r?.withDist?["WITHDIST"]:[],...r?.withHash?["WITHHASH"]:[]],{...a,deserialize:p})}};var J=class extends e{constructor([n,t,o,m,r,a],i){let p=["GEOSEARCHSTORE",n,t];(o.type==="FROMMEMBER"||o.type==="frommember")&&p.push(o.type,o.member),(o.type==="FROMLONLAT"||o.type==="fromlonlat")&&p.push(o.type,o.coordinate.lon,o.coordinate.lat),(m.type==="BYRADIUS"||m.type==="byradius")&&p.push(m.type,m.radius,m.radiusType),(m.type==="BYBOX"||m.type==="bybox")&&p.push(m.type,m.rect.width,m.rect.height,m.rectType),p.push(r),a?.count&&p.push(a.count.limit,...a.count.any?["ANY"]:[]),super([...p,...a?.storeDist?["STOREDIST"]:[]],i)}};var K=class extends e{constructor(n,t){super(["get",...n],t)}};var N=class extends e{constructor(n,t){super(["getbit",...n],t)}};var Z=class extends e{constructor(n,t){super(["getdel",...n],t)}};var U=class extends e{constructor(n,t){super(["getrange",...n],t)}};var G=class extends e{constructor(n,t){super(["getset",...n],t)}};var H=class extends e{constructor(n,t){super(["hdel",...n],t)}};var B=class extends e{constructor(n,t){super(["hexists",...n],t)}};var F=class extends e{constructor(n,t){super(["hget",...n],t)}};function xe(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var _=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>xe(o),...t})}};var q=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var $=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var X=class extends e{constructor([n],t){super(["hkeys",n],t)}};var j=class extends e{constructor(n,t){super(["hlen",...n],t)}};function fe(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var Y=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>fe(t,m),...o})}};var W=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function ye(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var V=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>ye(m):t?.deserialize,...t})}};var Q=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var nn=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var tn=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var en=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var on=class extends e{constructor(n,t){super(["hvals",...n],t)}};var sn=class extends e{constructor(n,t){super(["incr",...n],t)}};var mn=class extends e{constructor(n,t){super(["incrby",...n],t)}};var rn=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var dn=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var cn=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var un=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var hn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var ln=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var yn=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var wn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var Dn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var An=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var kn=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var Sn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Rn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var En=class extends e{constructor(n,t){super(["keys",...n],t)}};var Mn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var vn=class extends e{constructor(n,t){super(["linsert",...n],t)}};var Pn=class extends e{constructor(n,t){super(["llen",...n],t)}};var In=class extends e{constructor(n,t){super(["lmove",...n],t)}};var zn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Ln=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var Jn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Kn=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Nn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Zn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Un=class extends e{constructor(n,t){super(["lset",...n],t)}};var Gn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Hn=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Bn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Fn=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var _n=class extends e{constructor(n,t){super(["persist",...n],t)}};var qn=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var $n=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var Xn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var jn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Yn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var Wn=class extends e{constructor(n,t){super(["publish",...n],t)}};var Vn=class extends e{constructor(n){super(["randomkey"],n)}};var Qn=class extends e{constructor(n,t){super(["rename",...n],t)}};var nt=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var tt=class extends e{constructor(n,t){super(["rpop",...n],t)}};var et=class extends e{constructor(n,t){super(["rpush",...n],t)}};var ot=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var st=class extends e{constructor(n,t){super(["sadd",...n],t)}};var mt=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var rt=class extends e{constructor(n,t){super(["scard",...n],t)}};var at=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var it=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var pt=class extends e{constructor(n,t){super(["script","load",...n],t)}};var dt=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var ct=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var ut=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var ht=class extends e{constructor(n,t){super(["setbit",...n],t)}};var lt=class extends e{constructor(n,t){super(["setex",...n],t)}};var Ct=class extends e{constructor(n,t){super(["setnx",...n],t)}};var gt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var xt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ft=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var yt=class extends e{constructor(n,t){super(["sismember",...n],t)}};var bt=class extends e{constructor(n,t){super(["smembers",...n],t)}};var Tt=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Ot=class extends e{constructor(n,t){super(["smove",...n],t)}};var wt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var Dt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var At=class extends e{constructor(n,t){super(["srem",...n],t)}};var kt=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var St=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Rt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Et=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var Mt=class extends e{constructor(n){super(["time"],n)}};var vt=class extends e{constructor(n,t){super(["touch",...n],t)}};var Pt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var It=class extends e{constructor(n,t){super(["type",...n],t)}};var zt=class extends e{constructor(n,t){super(["unlink",...n],t)}};var se=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,p]of Object.entries(o))a.push(i,p);super(a,r)}};function be(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var me=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>be(i),...r})}};var u=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Lt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var Jt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Kt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Nt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Zt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Ut=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Gt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Ht=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Bt=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Ft=class extends e{constructor(n,t){super(["zrem",...n],t)}};var _t=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var qt=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var $t=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var Xt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var jt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var Yt=class extends e{constructor(n,t){super(["zscore",...n],t)}};var Wt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var Vt=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Qt=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var ne=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var te=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new c(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new l(n,this.commandOptions));bitcount=(...n)=>this.chain(new C(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new g([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new x(n,this.commandOptions));copy=(...n)=>this.chain(new f(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new Qt(n,this.commandOptions));dbsize=()=>this.chain(new y(this.commandOptions));decr=(...n)=>this.chain(new b(n,this.commandOptions));decrby=(...n)=>this.chain(new T(n,this.commandOptions));del=(...n)=>this.chain(new O(n,this.commandOptions));echo=(...n)=>this.chain(new w(n,this.commandOptions));eval=(...n)=>this.chain(new D(n,this.commandOptions));evalsha=(...n)=>this.chain(new A(n,this.commandOptions));exists=(...n)=>this.chain(new k(n,this.commandOptions));expire=(...n)=>this.chain(new S(n,this.commandOptions));expireat=(...n)=>this.chain(new R(n,this.commandOptions));flushall=n=>this.chain(new E(n,this.commandOptions));flushdb=(...n)=>this.chain(new M(n,this.commandOptions));get=(...n)=>this.chain(new K(n,this.commandOptions));getbit=(...n)=>this.chain(new N(n,this.commandOptions));getdel=(...n)=>this.chain(new Z(n,this.commandOptions));getrange=(...n)=>this.chain(new U(n,this.commandOptions));getset=(n,t)=>this.chain(new G([n,t],this.commandOptions));hdel=(...n)=>this.chain(new H(n,this.commandOptions));hexists=(...n)=>this.chain(new B(n,this.commandOptions));hget=(...n)=>this.chain(new F(n,this.commandOptions));hgetall=(...n)=>this.chain(new _(n,this.commandOptions));hincrby=(...n)=>this.chain(new q(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new $(n,this.commandOptions));hkeys=(...n)=>this.chain(new X(n,this.commandOptions));hlen=(...n)=>this.chain(new j(n,this.commandOptions));hmget=(...n)=>this.chain(new Y(n,this.commandOptions));hmset=(n,t)=>this.chain(new W([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new V([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new Q(n,this.commandOptions));hset=(n,t)=>this.chain(new nn([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new tn([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new en(n,this.commandOptions));hvals=(...n)=>this.chain(new on(n,this.commandOptions));incr=(...n)=>this.chain(new sn(n,this.commandOptions));incrby=(...n)=>this.chain(new mn(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new rn(n,this.commandOptions));keys=(...n)=>this.chain(new En(n,this.commandOptions));lindex=(...n)=>this.chain(new Mn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new vn([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new Pn(n,this.commandOptions));lmove=(...n)=>this.chain(new In(n,this.commandOptions));lpop=(...n)=>this.chain(new zn(n,this.commandOptions));lpos=(...n)=>this.chain(new Ln(n,this.commandOptions));lpush=(n,...t)=>this.chain(new Jn([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new Kn([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new Nn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Zn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new Un([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Gn(n,this.commandOptions));mget=(...n)=>this.chain(new Hn(n,this.commandOptions));mset=n=>this.chain(new Bn([n],this.commandOptions));msetnx=n=>this.chain(new Fn([n],this.commandOptions));persist=(...n)=>this.chain(new _n(n,this.commandOptions));pexpire=(...n)=>this.chain(new qn(n,this.commandOptions));pexpireat=(...n)=>this.chain(new $n(n,this.commandOptions));ping=n=>this.chain(new Xn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new jn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new Yn(n,this.commandOptions));publish=(...n)=>this.chain(new Wn(n,this.commandOptions));randomkey=()=>this.chain(new Vn(this.commandOptions));rename=(...n)=>this.chain(new Qn(n,this.commandOptions));renamenx=(...n)=>this.chain(new nt(n,this.commandOptions));rpop=(...n)=>this.chain(new tt(n,this.commandOptions));rpush=(n,...t)=>this.chain(new et([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new ot([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new st([n,...t],this.commandOptions));scan=(...n)=>this.chain(new mt(n,this.commandOptions));scard=(...n)=>this.chain(new rt(n,this.commandOptions));scriptExists=(...n)=>this.chain(new at(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new it(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new pt(n,this.commandOptions));sdiff=(...n)=>this.chain(new dt(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new ct(n,this.commandOptions));set=(n,t,o)=>this.chain(new ut([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new ht(n,this.commandOptions));setex=(n,t,o)=>this.chain(new lt([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new Ct([n,t],this.commandOptions));setrange=(...n)=>this.chain(new gt(n,this.commandOptions));sinter=(...n)=>this.chain(new xt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ft(n,this.commandOptions));sismember=(n,t)=>this.chain(new yt([n,t],this.commandOptions));smembers=(...n)=>this.chain(new bt(n,this.commandOptions));smismember=(n,t)=>this.chain(new Tt([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Ot([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new wt(n,this.commandOptions));srandmember=(...n)=>this.chain(new Dt(n,this.commandOptions));srem=(n,...t)=>this.chain(new At([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new kt(n,this.commandOptions));strlen=(...n)=>this.chain(new St(n,this.commandOptions));sunion=(...n)=>this.chain(new Rt(n,this.commandOptions));sunionstore=(...n)=>this.chain(new Et(n,this.commandOptions));time=()=>this.chain(new Mt(this.commandOptions));touch=(...n)=>this.chain(new vt(n,this.commandOptions));ttl=(...n)=>this.chain(new Pt(n,this.commandOptions));type=(...n)=>this.chain(new It(n,this.commandOptions));unlink=(...n)=>this.chain(new zt(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Lt(n,this.commandOptions));zcount=(...n)=>this.chain(new Jt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Kt([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new Nt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Zt(n,this.commandOptions));zmscore=(...n)=>this.chain(new ne(n,this.commandOptions));zpopmax=(...n)=>this.chain(new Ut(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Gt(n,this.commandOptions));zrange=(...n)=>this.chain(new Ht(n,this.commandOptions));zrank=(n,t)=>this.chain(new Bt([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new Ft([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new _t(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new qt(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new $t(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new Xt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new jt(n,this.commandOptions));zscore=(n,t)=>this.chain(new Yt([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new Vt(n,this.commandOptions));zunion=(...n)=>this.chain(new Wt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new an(n,this.commandOptions)),arrindex:(...n)=>this.chain(new pn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new dn(n,this.commandOptions)),arrlen:(...n)=>this.chain(new cn(n,this.commandOptions)),arrpop:(...n)=>this.chain(new un(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new hn(n,this.commandOptions)),clear:(...n)=>this.chain(new ln(n,this.commandOptions)),del:(...n)=>this.chain(new Cn(n,this.commandOptions)),forget:(...n)=>this.chain(new gn(n,this.commandOptions)),geoadd:(...n)=>this.chain(new v(n,this.commandOptions)),geodist:(...n)=>this.chain(new P(n,this.commandOptions)),geopos:(...n)=>this.chain(new I(n,this.commandOptions)),geohash:(...n)=>this.chain(new z(n,this.commandOptions)),geosearch:(...n)=>this.chain(new L(n,this.commandOptions)),geosearchstore:(...n)=>this.chain(new J(n,this.commandOptions)),get:(...n)=>this.chain(new xn(n,this.commandOptions)),mget:(...n)=>this.chain(new fn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new yn(n,this.commandOptions)),nummultby:(...n)=>this.chain(new bn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new Tn(n,this.commandOptions)),objlen:(...n)=>this.chain(new On(n,this.commandOptions)),resp:(...n)=>this.chain(new wn(n,this.commandOptions)),set:(...n)=>this.chain(new Dn(n,this.commandOptions)),strappend:(...n)=>this.chain(new An(n,this.commandOptions)),strlen:(...n)=>this.chain(new kn(n,this.commandOptions)),toggle:(...n)=>this.chain(new Sn(n,this.commandOptions)),type:(...n)=>this.chain(new Rn(n,this.commandOptions))}}};import Te from"crypto-js/enc-hex";import Oe from"crypto-js/sha1";var re=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return Te.stringify(Oe(n))}};var ae=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new an(n,this.opts).exec(this.client),arrindex:(...n)=>new pn(n,this.opts).exec(this.client),arrinsert:(...n)=>new dn(n,this.opts).exec(this.client),arrlen:(...n)=>new cn(n,this.opts).exec(this.client),arrpop:(...n)=>new un(n,this.opts).exec(this.client),arrtrim:(...n)=>new hn(n,this.opts).exec(this.client),clear:(...n)=>new ln(n,this.opts).exec(this.client),del:(...n)=>new Cn(n,this.opts).exec(this.client),forget:(...n)=>new gn(n,this.opts).exec(this.client),geoadd:(...n)=>new v(n,this.opts).exec(this.client),geopos:(...n)=>new I(n,this.opts).exec(this.client),geodist:(...n)=>new P(n,this.opts).exec(this.client),geohash:(...n)=>new z(n,this.opts).exec(this.client),geosearch:(...n)=>new L(n,this.opts).exec(this.client),geosearchstore:(...n)=>new J(n,this.opts).exec(this.client),get:(...n)=>new xn(n,this.opts).exec(this.client),mget:(...n)=>new fn(n,this.opts).exec(this.client),numincrby:(...n)=>new yn(n,this.opts).exec(this.client),nummultby:(...n)=>new bn(n,this.opts).exec(this.client),objkeys:(...n)=>new Tn(n,this.opts).exec(this.client),objlen:(...n)=>new On(n,this.opts).exec(this.client),resp:(...n)=>new wn(n,this.opts).exec(this.client),set:(...n)=>new Dn(n,this.opts).exec(this.client),strappend:(...n)=>new An(n,this.opts).exec(this.client),strlen:(...n)=>new kn(n,this.opts).exec(this.client),toggle:(...n)=>new Sn(n,this.opts).exec(this.client),type:(...n)=>new Rn(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new re(this,n)}pipeline=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new l(n,this.opts).exec(this.client);bitcount=(...n)=>new C(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new g([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new x(n,this.opts).exec(this.client);copy=(...n)=>new f(n,this.opts).exec(this.client);dbsize=()=>new y(this.opts).exec(this.client);decr=(...n)=>new b(n,this.opts).exec(this.client);decrby=(...n)=>new T(n,this.opts).exec(this.client);del=(...n)=>new O(n,this.opts).exec(this.client);echo=(...n)=>new w(n,this.opts).exec(this.client);eval=(...n)=>new D(n,this.opts).exec(this.client);evalsha=(...n)=>new A(n,this.opts).exec(this.client);exists=(...n)=>new k(n,this.opts).exec(this.client);expire=(...n)=>new S(n,this.opts).exec(this.client);expireat=(...n)=>new R(n,this.opts).exec(this.client);flushall=n=>new E(n,this.opts).exec(this.client);flushdb=(...n)=>new M(n,this.opts).exec(this.client);get=(...n)=>new K(n,this.opts).exec(this.client);getbit=(...n)=>new N(n,this.opts).exec(this.client);getdel=(...n)=>new Z(n,this.opts).exec(this.client);getrange=(...n)=>new U(n,this.opts).exec(this.client);getset=(n,t)=>new G([n,t],this.opts).exec(this.client);hdel=(...n)=>new H(n,this.opts).exec(this.client);hexists=(...n)=>new B(n,this.opts).exec(this.client);hget=(...n)=>new F(n,this.opts).exec(this.client);hgetall=(...n)=>new _(n,this.opts).exec(this.client);hincrby=(...n)=>new q(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new $(n,this.opts).exec(this.client);hkeys=(...n)=>new X(n,this.opts).exec(this.client);hlen=(...n)=>new j(n,this.opts).exec(this.client);hmget=(...n)=>new Y(n,this.opts).exec(this.client);hmset=(n,t)=>new W([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new V([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new Q(n,this.opts).exec(this.client);hset=(n,t)=>new nn([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new tn([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new en(n,this.opts).exec(this.client);hvals=(...n)=>new on(n,this.opts).exec(this.client);incr=(...n)=>new sn(n,this.opts).exec(this.client);incrby=(...n)=>new mn(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new rn(n,this.opts).exec(this.client);keys=(...n)=>new En(n,this.opts).exec(this.client);lindex=(...n)=>new Mn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new vn([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new Pn(n,this.opts).exec(this.client);lmove=(...n)=>new In(n,this.opts).exec(this.client);lpop=(...n)=>new zn(n,this.opts).exec(this.client);lpos=(...n)=>new Ln(n,this.opts).exec(this.client);lpush=(n,...t)=>new Jn([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new Kn([n,...t],this.opts).exec(this.client);lrange=(...n)=>new Nn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Zn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new Un([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Gn(n,this.opts).exec(this.client);mget=(...n)=>new Hn(n,this.opts).exec(this.client);mset=n=>new Bn([n],this.opts).exec(this.client);msetnx=n=>new Fn([n],this.opts).exec(this.client);persist=(...n)=>new _n(n,this.opts).exec(this.client);pexpire=(...n)=>new qn(n,this.opts).exec(this.client);pexpireat=(...n)=>new $n(n,this.opts).exec(this.client);ping=n=>new Xn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new jn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new Yn(n,this.opts).exec(this.client);publish=(...n)=>new Wn(n,this.opts).exec(this.client);randomkey=()=>new Vn().exec(this.client);rename=(...n)=>new Qn(n,this.opts).exec(this.client);renamenx=(...n)=>new nt(n,this.opts).exec(this.client);rpop=(...n)=>new tt(n,this.opts).exec(this.client);rpush=(n,...t)=>new et([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new ot([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new st([n,...t],this.opts).exec(this.client);scan=(...n)=>new mt(n,this.opts).exec(this.client);scard=(...n)=>new rt(n,this.opts).exec(this.client);scriptExists=(...n)=>new at(n,this.opts).exec(this.client);scriptFlush=(...n)=>new it(n,this.opts).exec(this.client);scriptLoad=(...n)=>new pt(n,this.opts).exec(this.client);sdiff=(...n)=>new dt(n,this.opts).exec(this.client);sdiffstore=(...n)=>new ct(n,this.opts).exec(this.client);set=(n,t,o)=>new ut([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new ht(n,this.opts).exec(this.client);setex=(n,t,o)=>new lt([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new Ct([n,t],this.opts).exec(this.client);setrange=(...n)=>new gt(n,this.opts).exec(this.client);sinter=(...n)=>new xt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ft(n,this.opts).exec(this.client);sismember=(n,t)=>new yt([n,t],this.opts).exec(this.client);smismember=(n,t)=>new Tt([n,t],this.opts).exec(this.client);smembers=(...n)=>new bt(n,this.opts).exec(this.client);smove=(n,t,o)=>new Ot([n,t,o],this.opts).exec(this.client);spop=(...n)=>new wt(n,this.opts).exec(this.client);srandmember=(...n)=>new Dt(n,this.opts).exec(this.client);srem=(n,...t)=>new At([n,...t],this.opts).exec(this.client);sscan=(...n)=>new kt(n,this.opts).exec(this.client);strlen=(...n)=>new St(n,this.opts).exec(this.client);sunion=(...n)=>new Rt(n,this.opts).exec(this.client);sunionstore=(...n)=>new Et(n,this.opts).exec(this.client);time=()=>new Mt().exec(this.client);touch=(...n)=>new vt(n,this.opts).exec(this.client);ttl=(...n)=>new Pt(n,this.opts).exec(this.client);type=(...n)=>new It(n,this.opts).exec(this.client);unlink=(...n)=>new zt(n,this.opts).exec(this.client);xadd=(...n)=>new se(n,this.opts).exec(this.client);xrange=(...n)=>new me(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Lt(n,this.opts).exec(this.client);zcount=(...n)=>new Jt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new Qt(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Kt([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new Nt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Zt(n,this.opts).exec(this.client);zmscore=(...n)=>new ne(n,this.opts).exec(this.client);zpopmax=(...n)=>new Ut(n,this.opts).exec(this.client);zpopmin=(...n)=>new Gt(n,this.opts).exec(this.client);zrange=(...n)=>new Ht(n,this.opts).exec(this.client);zrank=(n,t)=>new Bt([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new Ft([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new _t(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new qt(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new $t(n,this.opts).exec(this.client);zrevrank=(n,t)=>new Xt([n,t],this.opts).exec(this.client);zscan=(...n)=>new jt(n,this.opts).exec(this.client);zscore=(n,t)=>new Yt([n,t],this.opts).exec(this.client);zunion=(...n)=>new Wt(n,this.opts).exec(this.client);zunionstore=(...n)=>new Vt(n,this.opts).exec(this.client)};var he="v1.24.2";var le=class s extends ae{constructor(n,t){(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let o=new oe({retry:n.retry,baseUrl:n.url,headers:{authorization:`Bearer ${n.token}`},responseEncoding:n.responseEncoding});super(o,{enableTelemetry:!t?.UPSTASH_DISABLE_TELEMETRY,automaticDeserialization:n.automaticDeserialization}),this.addTelemetry({platform:"cloudflare",sdk:`@upstash/redis@${he}`})}static fromEnv(n,t){let o=n?.UPSTASH_REDIS_REST_URL??UPSTASH_REDIS_REST_URL,m=n?.UPSTASH_REDIS_REST_TOKEN??UPSTASH_REDIS_REST_TOKEN;if(!o)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`");if(!m)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`");return new s({...t,url:o,token:m},n)}};export{le as Redis};
|
|
1
|
+
import{a as n,b as o,c as i}from"./chunk-KBK5EDMP.mjs";var a=class S extends o{constructor(e,r){(e.url.startsWith(" ")||e.url.endsWith(" ")||/\r|\n/.test(e.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(e.token.startsWith(" ")||e.token.endsWith(" ")||/\r|\n/.test(e.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new n({retry:e.retry,baseUrl:e.url,headers:{authorization:`Bearer ${e.token}`},responseEncoding:e.responseEncoding});super(t,{enableTelemetry:!r?.UPSTASH_DISABLE_TELEMETRY,automaticDeserialization:e.automaticDeserialization}),this.addTelemetry({platform:"cloudflare",sdk:`@upstash/redis@${i}`})}static fromEnv(e,r){let t=e?.UPSTASH_REDIS_REST_URL??UPSTASH_REDIS_REST_URL,s=e?.UPSTASH_REDIS_REST_TOKEN??UPSTASH_REDIS_REST_TOKEN;if(!t)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`");if(!s)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`");return new S({...r,url:t,token:s},e)}};export{a as Redis};
|
package/fastly.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var be=Object.create;var oe=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var ke=(s,n)=>{for(var t in n)oe(s,t,{get:n[t],enumerable:!0})},ue=(s,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let m of Te(n))!De.call(s,m)&&m!==t&&oe(s,m,{get:()=>n[m],enumerable:!(o=Oe(n,m))||o.enumerable});return s};var he=(s,n,t)=>(t=s!=null?be(we(s)):{},ue(n||!s||!s.__esModule?oe(t,"default",{value:s,enumerable:!0}):t,s)),Ae=s=>ue(oe({},"__esModule",{value:!0}),s);var Ie={};ke(Ie,{Redis:()=>de});module.exports=Ae(Ie);var c=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var se=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(p=>setTimeout(p,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new c(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:p})=>({result:pe(i),error:p})):{result:pe(r.result),error:r.error}:r}};function le(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function pe(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?le(t):Array.isArray(t)?t.map(pe):t):n=null;break}case"string":{n=s==="OK"?"OK":le(s);break}default:break}return n}function Ce(s){let n=Array.isArray(s)?s.map(t=>{try{return Ce(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ge(s){try{return Ce(s)}catch{return s}}var Se=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=Se,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??ge:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new c(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var l=class extends e{constructor(n,t){super(["append",...n],t)}};var C=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var g=class extends e{constructor(n,t){super(["bitop",...n],t)}};var x=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var f=class extends e{constructor([n,t,o],m){super(["COPY",n,t,...o?.replace?["REPLACE"]:[]],{...m,deserialize(r){return r>0?"COPIED":"NOT_COPIED"}})}};var y=class extends e{constructor(n){super(["dbsize"],n)}};var b=class extends e{constructor(n,t){super(["decr",...n],t)}};var O=class extends e{constructor(n,t){super(["decrby",...n],t)}};var T=class extends e{constructor(n,t){super(["del",...n],t)}};var w=class extends e{constructor(n,t){super(["echo",...n],t)}};var D=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var k=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var A=class extends e{constructor(n,t){super(["exists",...n],t)}};var S=class extends e{constructor(n,t){super(["expire",...n],t)}};var R=class extends e{constructor(n,t){super(["expireat",...n],t)}};var M=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var v=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var E=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:p})=>[i,a,p])),super(r,m)}};var z=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var J=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOPOS",o,...m],{deserialize:r=>Re(r),...t})}};function Re(s){let n=[];for(let t of s)!t?.[0]||!t?.[1]||n.push({lng:parseFloat(t[0]),lat:parseFloat(t[1])});return n}var I=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOHASH",o,...m],t)}};var P=class extends e{constructor([n,t,o,m,r],a){let i=["GEOSEARCH",n];(t.type==="FROMMEMBER"||t.type==="frommember")&&i.push(t.type,t.member),(t.type==="FROMLONLAT"||t.type==="fromlonlat")&&i.push(t.type,t.coordinate.lon,t.coordinate.lat),(o.type==="BYRADIUS"||o.type==="byradius")&&i.push(o.type,o.radius,o.radiusType),(o.type==="BYBOX"||o.type==="bybox")&&i.push(o.type,o.rect.width,o.rect.height,o.rectType),i.push(m),r?.count&&i.push(r.count.limit,...r.count.any?["ANY"]:[]);let p=ce=>!r?.withCoord&&!r?.withDist&&!r?.withHash?ce.map(d=>{try{return{member:JSON.parse(d)}}catch{return{member:d}}}):ce.map(d=>{let ee=1,h={};try{h.member=JSON.parse(d[0])}catch{h.member=d[0]}return r.withDist&&(h.dist=parseFloat(d[ee++])),r.withHash&&(h.hash=d[ee++].toString()),r.withCoord&&(h.coord={long:parseFloat(d[ee][0]),lat:parseFloat(d[ee][1])}),h});super([...i,...r?.withCoord?["WITHCOORD"]:[],...r?.withDist?["WITHDIST"]:[],...r?.withHash?["WITHHASH"]:[]],{...a,deserialize:p})}};var K=class extends e{constructor([n,t,o,m,r,a],i){let p=["GEOSEARCHSTORE",n,t];(o.type==="FROMMEMBER"||o.type==="frommember")&&p.push(o.type,o.member),(o.type==="FROMLONLAT"||o.type==="fromlonlat")&&p.push(o.type,o.coordinate.lon,o.coordinate.lat),(m.type==="BYRADIUS"||m.type==="byradius")&&p.push(m.type,m.radius,m.radiusType),(m.type==="BYBOX"||m.type==="bybox")&&p.push(m.type,m.rect.width,m.rect.height,m.rectType),p.push(r),a?.count&&p.push(a.count.limit,...a.count.any?["ANY"]:[]),super([...p,...a?.storeDist?["STOREDIST"]:[]],i)}};var L=class extends e{constructor(n,t){super(["get",...n],t)}};var Z=class extends e{constructor(n,t){super(["getbit",...n],t)}};var N=class extends e{constructor(n,t){super(["getdel",...n],t)}};var G=class extends e{constructor(n,t){super(["getrange",...n],t)}};var B=class extends e{constructor(n,t){super(["getset",...n],t)}};var U=class extends e{constructor(n,t){super(["hdel",...n],t)}};var H=class extends e{constructor(n,t){super(["hexists",...n],t)}};var F=class extends e{constructor(n,t){super(["hget",...n],t)}};function Me(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var q=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>Me(o),...t})}};var $=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var X=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var j=class extends e{constructor([n],t){super(["hkeys",n],t)}};var W=class extends e{constructor(n,t){super(["hlen",...n],t)}};function ve(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var Y=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>ve(t,m),...o})}};var V=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function Ee(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var _=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>Ee(m):t?.deserialize,...t})}};var Q=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var nn=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var tn=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var en=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var on=class extends e{constructor(n,t){super(["hvals",...n],t)}};var sn=class extends e{constructor(n,t){super(["incr",...n],t)}};var mn=class extends e{constructor(n,t){super(["incrby",...n],t)}};var rn=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var dn=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var cn=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var un=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var hn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var ln=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var yn=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var wn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var Dn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var kn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var An=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var Sn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Rn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var Mn=class extends e{constructor(n,t){super(["keys",...n],t)}};var vn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var En=class extends e{constructor(n,t){super(["linsert",...n],t)}};var zn=class extends e{constructor(n,t){super(["llen",...n],t)}};var Jn=class extends e{constructor(n,t){super(["lmove",...n],t)}};var In=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Pn=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var Kn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Ln=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Zn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Nn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Gn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Bn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Un=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Hn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Fn=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var qn=class extends e{constructor(n,t){super(["persist",...n],t)}};var $n=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var Xn=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var jn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Wn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Yn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var Vn=class extends e{constructor(n,t){super(["publish",...n],t)}};var _n=class extends e{constructor(n){super(["randomkey"],n)}};var Qn=class extends e{constructor(n,t){super(["rename",...n],t)}};var nt=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var tt=class extends e{constructor(n,t){super(["rpop",...n],t)}};var et=class extends e{constructor(n,t){super(["rpush",...n],t)}};var ot=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var st=class extends e{constructor(n,t){super(["sadd",...n],t)}};var mt=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var rt=class extends e{constructor(n,t){super(["scard",...n],t)}};var at=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var it=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var pt=class extends e{constructor(n,t){super(["script","load",...n],t)}};var dt=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var ct=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var ut=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var ht=class extends e{constructor(n,t){super(["setbit",...n],t)}};var lt=class extends e{constructor(n,t){super(["setex",...n],t)}};var Ct=class extends e{constructor(n,t){super(["setnx",...n],t)}};var gt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var xt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ft=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var yt=class extends e{constructor(n,t){super(["sismember",...n],t)}};var bt=class extends e{constructor(n,t){super(["smembers",...n],t)}};var Ot=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Tt=class extends e{constructor(n,t){super(["smove",...n],t)}};var wt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var Dt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var kt=class extends e{constructor(n,t){super(["srem",...n],t)}};var At=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var St=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Rt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Mt=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var vt=class extends e{constructor(n){super(["time"],n)}};var Et=class extends e{constructor(n,t){super(["touch",...n],t)}};var zt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var Jt=class extends e{constructor(n,t){super(["type",...n],t)}};var It=class extends e{constructor(n,t){super(["unlink",...n],t)}};var me=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,p]of Object.entries(o))a.push(i,p);super(a,r)}};function ze(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var re=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>ze(i),...r})}};var u=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Pt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var Kt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Lt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Zt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Nt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Gt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Bt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Ut=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Ht=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Ft=class extends e{constructor(n,t){super(["zrem",...n],t)}};var qt=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var $t=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var Xt=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var jt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Wt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var Yt=class extends e{constructor(n,t){super(["zscore",...n],t)}};var Vt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var _t=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Qt=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var ne=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var te=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new c(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new l(n,this.commandOptions));bitcount=(...n)=>this.chain(new C(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new g([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new x(n,this.commandOptions));copy=(...n)=>this.chain(new f(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new Qt(n,this.commandOptions));dbsize=()=>this.chain(new y(this.commandOptions));decr=(...n)=>this.chain(new b(n,this.commandOptions));decrby=(...n)=>this.chain(new O(n,this.commandOptions));del=(...n)=>this.chain(new T(n,this.commandOptions));echo=(...n)=>this.chain(new w(n,this.commandOptions));eval=(...n)=>this.chain(new D(n,this.commandOptions));evalsha=(...n)=>this.chain(new k(n,this.commandOptions));exists=(...n)=>this.chain(new A(n,this.commandOptions));expire=(...n)=>this.chain(new S(n,this.commandOptions));expireat=(...n)=>this.chain(new R(n,this.commandOptions));flushall=n=>this.chain(new M(n,this.commandOptions));flushdb=(...n)=>this.chain(new v(n,this.commandOptions));get=(...n)=>this.chain(new L(n,this.commandOptions));getbit=(...n)=>this.chain(new Z(n,this.commandOptions));getdel=(...n)=>this.chain(new N(n,this.commandOptions));getrange=(...n)=>this.chain(new G(n,this.commandOptions));getset=(n,t)=>this.chain(new B([n,t],this.commandOptions));hdel=(...n)=>this.chain(new U(n,this.commandOptions));hexists=(...n)=>this.chain(new H(n,this.commandOptions));hget=(...n)=>this.chain(new F(n,this.commandOptions));hgetall=(...n)=>this.chain(new q(n,this.commandOptions));hincrby=(...n)=>this.chain(new $(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new X(n,this.commandOptions));hkeys=(...n)=>this.chain(new j(n,this.commandOptions));hlen=(...n)=>this.chain(new W(n,this.commandOptions));hmget=(...n)=>this.chain(new Y(n,this.commandOptions));hmset=(n,t)=>this.chain(new V([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new _([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new Q(n,this.commandOptions));hset=(n,t)=>this.chain(new nn([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new tn([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new en(n,this.commandOptions));hvals=(...n)=>this.chain(new on(n,this.commandOptions));incr=(...n)=>this.chain(new sn(n,this.commandOptions));incrby=(...n)=>this.chain(new mn(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new rn(n,this.commandOptions));keys=(...n)=>this.chain(new Mn(n,this.commandOptions));lindex=(...n)=>this.chain(new vn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new En([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new zn(n,this.commandOptions));lmove=(...n)=>this.chain(new Jn(n,this.commandOptions));lpop=(...n)=>this.chain(new In(n,this.commandOptions));lpos=(...n)=>this.chain(new Pn(n,this.commandOptions));lpush=(n,...t)=>this.chain(new Kn([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new Ln([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new Zn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Nn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new Gn([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Bn(n,this.commandOptions));mget=(...n)=>this.chain(new Un(n,this.commandOptions));mset=n=>this.chain(new Hn([n],this.commandOptions));msetnx=n=>this.chain(new Fn([n],this.commandOptions));persist=(...n)=>this.chain(new qn(n,this.commandOptions));pexpire=(...n)=>this.chain(new $n(n,this.commandOptions));pexpireat=(...n)=>this.chain(new Xn(n,this.commandOptions));ping=n=>this.chain(new jn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new Wn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new Yn(n,this.commandOptions));publish=(...n)=>this.chain(new Vn(n,this.commandOptions));randomkey=()=>this.chain(new _n(this.commandOptions));rename=(...n)=>this.chain(new Qn(n,this.commandOptions));renamenx=(...n)=>this.chain(new nt(n,this.commandOptions));rpop=(...n)=>this.chain(new tt(n,this.commandOptions));rpush=(n,...t)=>this.chain(new et([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new ot([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new st([n,...t],this.commandOptions));scan=(...n)=>this.chain(new mt(n,this.commandOptions));scard=(...n)=>this.chain(new rt(n,this.commandOptions));scriptExists=(...n)=>this.chain(new at(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new it(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new pt(n,this.commandOptions));sdiff=(...n)=>this.chain(new dt(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new ct(n,this.commandOptions));set=(n,t,o)=>this.chain(new ut([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new ht(n,this.commandOptions));setex=(n,t,o)=>this.chain(new lt([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new Ct([n,t],this.commandOptions));setrange=(...n)=>this.chain(new gt(n,this.commandOptions));sinter=(...n)=>this.chain(new xt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ft(n,this.commandOptions));sismember=(n,t)=>this.chain(new yt([n,t],this.commandOptions));smembers=(...n)=>this.chain(new bt(n,this.commandOptions));smismember=(n,t)=>this.chain(new Ot([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Tt([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new wt(n,this.commandOptions));srandmember=(...n)=>this.chain(new Dt(n,this.commandOptions));srem=(n,...t)=>this.chain(new kt([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new At(n,this.commandOptions));strlen=(...n)=>this.chain(new St(n,this.commandOptions));sunion=(...n)=>this.chain(new Rt(n,this.commandOptions));sunionstore=(...n)=>this.chain(new Mt(n,this.commandOptions));time=()=>this.chain(new vt(this.commandOptions));touch=(...n)=>this.chain(new Et(n,this.commandOptions));ttl=(...n)=>this.chain(new zt(n,this.commandOptions));type=(...n)=>this.chain(new Jt(n,this.commandOptions));unlink=(...n)=>this.chain(new It(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Pt(n,this.commandOptions));zcount=(...n)=>this.chain(new Kt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Lt([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new Zt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Nt(n,this.commandOptions));zmscore=(...n)=>this.chain(new ne(n,this.commandOptions));zpopmax=(...n)=>this.chain(new Gt(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Bt(n,this.commandOptions));zrange=(...n)=>this.chain(new Ut(n,this.commandOptions));zrank=(n,t)=>this.chain(new Ht([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new Ft([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new qt(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new $t(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new Xt(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new jt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new Wt(n,this.commandOptions));zscore=(n,t)=>this.chain(new Yt([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new _t(n,this.commandOptions));zunion=(...n)=>this.chain(new Vt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new an(n,this.commandOptions)),arrindex:(...n)=>this.chain(new pn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new dn(n,this.commandOptions)),arrlen:(...n)=>this.chain(new cn(n,this.commandOptions)),arrpop:(...n)=>this.chain(new un(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new hn(n,this.commandOptions)),clear:(...n)=>this.chain(new ln(n,this.commandOptions)),del:(...n)=>this.chain(new Cn(n,this.commandOptions)),forget:(...n)=>this.chain(new gn(n,this.commandOptions)),geoadd:(...n)=>this.chain(new E(n,this.commandOptions)),geodist:(...n)=>this.chain(new z(n,this.commandOptions)),geopos:(...n)=>this.chain(new J(n,this.commandOptions)),geohash:(...n)=>this.chain(new I(n,this.commandOptions)),geosearch:(...n)=>this.chain(new P(n,this.commandOptions)),geosearchstore:(...n)=>this.chain(new K(n,this.commandOptions)),get:(...n)=>this.chain(new xn(n,this.commandOptions)),mget:(...n)=>this.chain(new fn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new yn(n,this.commandOptions)),nummultby:(...n)=>this.chain(new bn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new On(n,this.commandOptions)),objlen:(...n)=>this.chain(new Tn(n,this.commandOptions)),resp:(...n)=>this.chain(new wn(n,this.commandOptions)),set:(...n)=>this.chain(new Dn(n,this.commandOptions)),strappend:(...n)=>this.chain(new kn(n,this.commandOptions)),strlen:(...n)=>this.chain(new An(n,this.commandOptions)),toggle:(...n)=>this.chain(new Sn(n,this.commandOptions)),type:(...n)=>this.chain(new Rn(n,this.commandOptions))}}};var xe=he(require("crypto-js/enc-hex")),fe=he(require("crypto-js/sha1")),ae=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return xe.default.stringify((0,fe.default)(n))}};var ie=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new an(n,this.opts).exec(this.client),arrindex:(...n)=>new pn(n,this.opts).exec(this.client),arrinsert:(...n)=>new dn(n,this.opts).exec(this.client),arrlen:(...n)=>new cn(n,this.opts).exec(this.client),arrpop:(...n)=>new un(n,this.opts).exec(this.client),arrtrim:(...n)=>new hn(n,this.opts).exec(this.client),clear:(...n)=>new ln(n,this.opts).exec(this.client),del:(...n)=>new Cn(n,this.opts).exec(this.client),forget:(...n)=>new gn(n,this.opts).exec(this.client),geoadd:(...n)=>new E(n,this.opts).exec(this.client),geopos:(...n)=>new J(n,this.opts).exec(this.client),geodist:(...n)=>new z(n,this.opts).exec(this.client),geohash:(...n)=>new I(n,this.opts).exec(this.client),geosearch:(...n)=>new P(n,this.opts).exec(this.client),geosearchstore:(...n)=>new K(n,this.opts).exec(this.client),get:(...n)=>new xn(n,this.opts).exec(this.client),mget:(...n)=>new fn(n,this.opts).exec(this.client),numincrby:(...n)=>new yn(n,this.opts).exec(this.client),nummultby:(...n)=>new bn(n,this.opts).exec(this.client),objkeys:(...n)=>new On(n,this.opts).exec(this.client),objlen:(...n)=>new Tn(n,this.opts).exec(this.client),resp:(...n)=>new wn(n,this.opts).exec(this.client),set:(...n)=>new Dn(n,this.opts).exec(this.client),strappend:(...n)=>new kn(n,this.opts).exec(this.client),strlen:(...n)=>new An(n,this.opts).exec(this.client),toggle:(...n)=>new Sn(n,this.opts).exec(this.client),type:(...n)=>new Rn(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new ae(this,n)}pipeline=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new l(n,this.opts).exec(this.client);bitcount=(...n)=>new C(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new g([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new x(n,this.opts).exec(this.client);copy=(...n)=>new f(n,this.opts).exec(this.client);dbsize=()=>new y(this.opts).exec(this.client);decr=(...n)=>new b(n,this.opts).exec(this.client);decrby=(...n)=>new O(n,this.opts).exec(this.client);del=(...n)=>new T(n,this.opts).exec(this.client);echo=(...n)=>new w(n,this.opts).exec(this.client);eval=(...n)=>new D(n,this.opts).exec(this.client);evalsha=(...n)=>new k(n,this.opts).exec(this.client);exists=(...n)=>new A(n,this.opts).exec(this.client);expire=(...n)=>new S(n,this.opts).exec(this.client);expireat=(...n)=>new R(n,this.opts).exec(this.client);flushall=n=>new M(n,this.opts).exec(this.client);flushdb=(...n)=>new v(n,this.opts).exec(this.client);get=(...n)=>new L(n,this.opts).exec(this.client);getbit=(...n)=>new Z(n,this.opts).exec(this.client);getdel=(...n)=>new N(n,this.opts).exec(this.client);getrange=(...n)=>new G(n,this.opts).exec(this.client);getset=(n,t)=>new B([n,t],this.opts).exec(this.client);hdel=(...n)=>new U(n,this.opts).exec(this.client);hexists=(...n)=>new H(n,this.opts).exec(this.client);hget=(...n)=>new F(n,this.opts).exec(this.client);hgetall=(...n)=>new q(n,this.opts).exec(this.client);hincrby=(...n)=>new $(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new X(n,this.opts).exec(this.client);hkeys=(...n)=>new j(n,this.opts).exec(this.client);hlen=(...n)=>new W(n,this.opts).exec(this.client);hmget=(...n)=>new Y(n,this.opts).exec(this.client);hmset=(n,t)=>new V([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new _([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new Q(n,this.opts).exec(this.client);hset=(n,t)=>new nn([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new tn([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new en(n,this.opts).exec(this.client);hvals=(...n)=>new on(n,this.opts).exec(this.client);incr=(...n)=>new sn(n,this.opts).exec(this.client);incrby=(...n)=>new mn(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new rn(n,this.opts).exec(this.client);keys=(...n)=>new Mn(n,this.opts).exec(this.client);lindex=(...n)=>new vn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new En([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new zn(n,this.opts).exec(this.client);lmove=(...n)=>new Jn(n,this.opts).exec(this.client);lpop=(...n)=>new In(n,this.opts).exec(this.client);lpos=(...n)=>new Pn(n,this.opts).exec(this.client);lpush=(n,...t)=>new Kn([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new Ln([n,...t],this.opts).exec(this.client);lrange=(...n)=>new Zn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Nn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new Gn([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Bn(n,this.opts).exec(this.client);mget=(...n)=>new Un(n,this.opts).exec(this.client);mset=n=>new Hn([n],this.opts).exec(this.client);msetnx=n=>new Fn([n],this.opts).exec(this.client);persist=(...n)=>new qn(n,this.opts).exec(this.client);pexpire=(...n)=>new $n(n,this.opts).exec(this.client);pexpireat=(...n)=>new Xn(n,this.opts).exec(this.client);ping=n=>new jn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new Wn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new Yn(n,this.opts).exec(this.client);publish=(...n)=>new Vn(n,this.opts).exec(this.client);randomkey=()=>new _n().exec(this.client);rename=(...n)=>new Qn(n,this.opts).exec(this.client);renamenx=(...n)=>new nt(n,this.opts).exec(this.client);rpop=(...n)=>new tt(n,this.opts).exec(this.client);rpush=(n,...t)=>new et([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new ot([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new st([n,...t],this.opts).exec(this.client);scan=(...n)=>new mt(n,this.opts).exec(this.client);scard=(...n)=>new rt(n,this.opts).exec(this.client);scriptExists=(...n)=>new at(n,this.opts).exec(this.client);scriptFlush=(...n)=>new it(n,this.opts).exec(this.client);scriptLoad=(...n)=>new pt(n,this.opts).exec(this.client);sdiff=(...n)=>new dt(n,this.opts).exec(this.client);sdiffstore=(...n)=>new ct(n,this.opts).exec(this.client);set=(n,t,o)=>new ut([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new ht(n,this.opts).exec(this.client);setex=(n,t,o)=>new lt([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new Ct([n,t],this.opts).exec(this.client);setrange=(...n)=>new gt(n,this.opts).exec(this.client);sinter=(...n)=>new xt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ft(n,this.opts).exec(this.client);sismember=(n,t)=>new yt([n,t],this.opts).exec(this.client);smismember=(n,t)=>new Ot([n,t],this.opts).exec(this.client);smembers=(...n)=>new bt(n,this.opts).exec(this.client);smove=(n,t,o)=>new Tt([n,t,o],this.opts).exec(this.client);spop=(...n)=>new wt(n,this.opts).exec(this.client);srandmember=(...n)=>new Dt(n,this.opts).exec(this.client);srem=(n,...t)=>new kt([n,...t],this.opts).exec(this.client);sscan=(...n)=>new At(n,this.opts).exec(this.client);strlen=(...n)=>new St(n,this.opts).exec(this.client);sunion=(...n)=>new Rt(n,this.opts).exec(this.client);sunionstore=(...n)=>new Mt(n,this.opts).exec(this.client);time=()=>new vt().exec(this.client);touch=(...n)=>new Et(n,this.opts).exec(this.client);ttl=(...n)=>new zt(n,this.opts).exec(this.client);type=(...n)=>new Jt(n,this.opts).exec(this.client);unlink=(...n)=>new It(n,this.opts).exec(this.client);xadd=(...n)=>new me(n,this.opts).exec(this.client);xrange=(...n)=>new re(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Pt(n,this.opts).exec(this.client);zcount=(...n)=>new Kt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new Qt(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Lt([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new Zt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Nt(n,this.opts).exec(this.client);zmscore=(...n)=>new ne(n,this.opts).exec(this.client);zpopmax=(...n)=>new Gt(n,this.opts).exec(this.client);zpopmin=(...n)=>new Bt(n,this.opts).exec(this.client);zrange=(...n)=>new Ut(n,this.opts).exec(this.client);zrank=(n,t)=>new Ht([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new Ft([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new qt(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new $t(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new Xt(n,this.opts).exec(this.client);zrevrank=(n,t)=>new jt([n,t],this.opts).exec(this.client);zscan=(...n)=>new Wt(n,this.opts).exec(this.client);zscore=(n,t)=>new Yt([n,t],this.opts).exec(this.client);zunion=(...n)=>new Vt(n,this.opts).exec(this.client);zunionstore=(...n)=>new _t(n,this.opts).exec(this.client)};var ye="v1.24.2";var de=class extends ie{constructor(n){(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new se({baseUrl:n.url,retry:n.retry,headers:{authorization:`Bearer ${n.token}`},options:{backend:n.backend},responseEncoding:n.responseEncoding});super(t,{automaticDeserialization:n.automaticDeserialization}),this.addTelemetry({sdk:`@upstash/redis@${ye}`,platform:"fastly"})}};0&&(module.exports={Redis});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJIU2S2DZjs = require('./chunk-JIU2S2DZ.js');var o=class extends _chunkJIU2S2DZjs.b{constructor(e){(e.url.startsWith(" ")||e.url.endsWith(" ")||/\r|\n/.test(e.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(e.token.startsWith(" ")||e.token.endsWith(" ")||/\r|\n/.test(e.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let n=new (0, _chunkJIU2S2DZjs.a)({baseUrl:e.url,retry:e.retry,headers:{authorization:`Bearer ${e.token}`},options:{backend:e.backend},responseEncoding:e.responseEncoding});super(n,{automaticDeserialization:e.automaticDeserialization}),this.addTelemetry({sdk:`@upstash/redis@${_chunkJIU2S2DZjs.c}`,platform:"fastly"})}};exports.Redis = o;
|
package/fastly.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var oe=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(p=>setTimeout(p,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new c(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:p})=>({result:ie(i),error:p})):{result:ie(r.result),error:r.error}:r}};function de(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function ie(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?de(t):Array.isArray(t)?t.map(ie):t):n=null;break}case"string":{n=s==="OK"?"OK":de(s);break}default:break}return n}function ce(s){let n=Array.isArray(s)?s.map(t=>{try{return ce(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ue(s){try{return ce(s)}catch{return s}}var Ce=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=Ce,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??ue:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new c(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var l=class extends e{constructor(n,t){super(["append",...n],t)}};var C=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var g=class extends e{constructor(n,t){super(["bitop",...n],t)}};var x=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var f=class extends e{constructor([n,t,o],m){super(["COPY",n,t,...o?.replace?["REPLACE"]:[]],{...m,deserialize(r){return r>0?"COPIED":"NOT_COPIED"}})}};var y=class extends e{constructor(n){super(["dbsize"],n)}};var b=class extends e{constructor(n,t){super(["decr",...n],t)}};var O=class extends e{constructor(n,t){super(["decrby",...n],t)}};var T=class extends e{constructor(n,t){super(["del",...n],t)}};var w=class extends e{constructor(n,t){super(["echo",...n],t)}};var D=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var k=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var A=class extends e{constructor(n,t){super(["exists",...n],t)}};var S=class extends e{constructor(n,t){super(["expire",...n],t)}};var R=class extends e{constructor(n,t){super(["expireat",...n],t)}};var M=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var v=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var E=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:p})=>[i,a,p])),super(r,m)}};var z=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var J=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOPOS",o,...m],{deserialize:r=>ge(r),...t})}};function ge(s){let n=[];for(let t of s)!t?.[0]||!t?.[1]||n.push({lng:parseFloat(t[0]),lat:parseFloat(t[1])});return n}var I=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOHASH",o,...m],t)}};var P=class extends e{constructor([n,t,o,m,r],a){let i=["GEOSEARCH",n];(t.type==="FROMMEMBER"||t.type==="frommember")&&i.push(t.type,t.member),(t.type==="FROMLONLAT"||t.type==="fromlonlat")&&i.push(t.type,t.coordinate.lon,t.coordinate.lat),(o.type==="BYRADIUS"||o.type==="byradius")&&i.push(o.type,o.radius,o.radiusType),(o.type==="BYBOX"||o.type==="bybox")&&i.push(o.type,o.rect.width,o.rect.height,o.rectType),i.push(m),r?.count&&i.push(r.count.limit,...r.count.any?["ANY"]:[]);let p=pe=>!r?.withCoord&&!r?.withDist&&!r?.withHash?pe.map(d=>{try{return{member:JSON.parse(d)}}catch{return{member:d}}}):pe.map(d=>{let ee=1,h={};try{h.member=JSON.parse(d[0])}catch{h.member=d[0]}return r.withDist&&(h.dist=parseFloat(d[ee++])),r.withHash&&(h.hash=d[ee++].toString()),r.withCoord&&(h.coord={long:parseFloat(d[ee][0]),lat:parseFloat(d[ee][1])}),h});super([...i,...r?.withCoord?["WITHCOORD"]:[],...r?.withDist?["WITHDIST"]:[],...r?.withHash?["WITHHASH"]:[]],{...a,deserialize:p})}};var K=class extends e{constructor([n,t,o,m,r,a],i){let p=["GEOSEARCHSTORE",n,t];(o.type==="FROMMEMBER"||o.type==="frommember")&&p.push(o.type,o.member),(o.type==="FROMLONLAT"||o.type==="fromlonlat")&&p.push(o.type,o.coordinate.lon,o.coordinate.lat),(m.type==="BYRADIUS"||m.type==="byradius")&&p.push(m.type,m.radius,m.radiusType),(m.type==="BYBOX"||m.type==="bybox")&&p.push(m.type,m.rect.width,m.rect.height,m.rectType),p.push(r),a?.count&&p.push(a.count.limit,...a.count.any?["ANY"]:[]),super([...p,...a?.storeDist?["STOREDIST"]:[]],i)}};var L=class extends e{constructor(n,t){super(["get",...n],t)}};var Z=class extends e{constructor(n,t){super(["getbit",...n],t)}};var N=class extends e{constructor(n,t){super(["getdel",...n],t)}};var G=class extends e{constructor(n,t){super(["getrange",...n],t)}};var B=class extends e{constructor(n,t){super(["getset",...n],t)}};var U=class extends e{constructor(n,t){super(["hdel",...n],t)}};var H=class extends e{constructor(n,t){super(["hexists",...n],t)}};var F=class extends e{constructor(n,t){super(["hget",...n],t)}};function xe(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var q=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>xe(o),...t})}};var $=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var X=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var j=class extends e{constructor([n],t){super(["hkeys",n],t)}};var W=class extends e{constructor(n,t){super(["hlen",...n],t)}};function fe(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var Y=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>fe(t,m),...o})}};var V=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function ye(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var _=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>ye(m):t?.deserialize,...t})}};var Q=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var nn=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var tn=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var en=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var on=class extends e{constructor(n,t){super(["hvals",...n],t)}};var sn=class extends e{constructor(n,t){super(["incr",...n],t)}};var mn=class extends e{constructor(n,t){super(["incrby",...n],t)}};var rn=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var dn=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var cn=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var un=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var hn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var ln=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var yn=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var wn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var Dn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var kn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var An=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var Sn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Rn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var Mn=class extends e{constructor(n,t){super(["keys",...n],t)}};var vn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var En=class extends e{constructor(n,t){super(["linsert",...n],t)}};var zn=class extends e{constructor(n,t){super(["llen",...n],t)}};var Jn=class extends e{constructor(n,t){super(["lmove",...n],t)}};var In=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Pn=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var Kn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Ln=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Zn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Nn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Gn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Bn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Un=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Hn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Fn=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var qn=class extends e{constructor(n,t){super(["persist",...n],t)}};var $n=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var Xn=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var jn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Wn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Yn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var Vn=class extends e{constructor(n,t){super(["publish",...n],t)}};var _n=class extends e{constructor(n){super(["randomkey"],n)}};var Qn=class extends e{constructor(n,t){super(["rename",...n],t)}};var nt=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var tt=class extends e{constructor(n,t){super(["rpop",...n],t)}};var et=class extends e{constructor(n,t){super(["rpush",...n],t)}};var ot=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var st=class extends e{constructor(n,t){super(["sadd",...n],t)}};var mt=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var rt=class extends e{constructor(n,t){super(["scard",...n],t)}};var at=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var it=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var pt=class extends e{constructor(n,t){super(["script","load",...n],t)}};var dt=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var ct=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var ut=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var ht=class extends e{constructor(n,t){super(["setbit",...n],t)}};var lt=class extends e{constructor(n,t){super(["setex",...n],t)}};var Ct=class extends e{constructor(n,t){super(["setnx",...n],t)}};var gt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var xt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ft=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var yt=class extends e{constructor(n,t){super(["sismember",...n],t)}};var bt=class extends e{constructor(n,t){super(["smembers",...n],t)}};var Ot=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Tt=class extends e{constructor(n,t){super(["smove",...n],t)}};var wt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var Dt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var kt=class extends e{constructor(n,t){super(["srem",...n],t)}};var At=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var St=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Rt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Mt=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var vt=class extends e{constructor(n){super(["time"],n)}};var Et=class extends e{constructor(n,t){super(["touch",...n],t)}};var zt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var Jt=class extends e{constructor(n,t){super(["type",...n],t)}};var It=class extends e{constructor(n,t){super(["unlink",...n],t)}};var se=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,p]of Object.entries(o))a.push(i,p);super(a,r)}};function be(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var me=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>be(i),...r})}};var u=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Pt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var Kt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Lt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Zt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Nt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Gt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Bt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Ut=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Ht=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Ft=class extends e{constructor(n,t){super(["zrem",...n],t)}};var qt=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var $t=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var Xt=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var jt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Wt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var Yt=class extends e{constructor(n,t){super(["zscore",...n],t)}};var Vt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var _t=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Qt=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var ne=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var te=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new c(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new l(n,this.commandOptions));bitcount=(...n)=>this.chain(new C(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new g([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new x(n,this.commandOptions));copy=(...n)=>this.chain(new f(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new Qt(n,this.commandOptions));dbsize=()=>this.chain(new y(this.commandOptions));decr=(...n)=>this.chain(new b(n,this.commandOptions));decrby=(...n)=>this.chain(new O(n,this.commandOptions));del=(...n)=>this.chain(new T(n,this.commandOptions));echo=(...n)=>this.chain(new w(n,this.commandOptions));eval=(...n)=>this.chain(new D(n,this.commandOptions));evalsha=(...n)=>this.chain(new k(n,this.commandOptions));exists=(...n)=>this.chain(new A(n,this.commandOptions));expire=(...n)=>this.chain(new S(n,this.commandOptions));expireat=(...n)=>this.chain(new R(n,this.commandOptions));flushall=n=>this.chain(new M(n,this.commandOptions));flushdb=(...n)=>this.chain(new v(n,this.commandOptions));get=(...n)=>this.chain(new L(n,this.commandOptions));getbit=(...n)=>this.chain(new Z(n,this.commandOptions));getdel=(...n)=>this.chain(new N(n,this.commandOptions));getrange=(...n)=>this.chain(new G(n,this.commandOptions));getset=(n,t)=>this.chain(new B([n,t],this.commandOptions));hdel=(...n)=>this.chain(new U(n,this.commandOptions));hexists=(...n)=>this.chain(new H(n,this.commandOptions));hget=(...n)=>this.chain(new F(n,this.commandOptions));hgetall=(...n)=>this.chain(new q(n,this.commandOptions));hincrby=(...n)=>this.chain(new $(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new X(n,this.commandOptions));hkeys=(...n)=>this.chain(new j(n,this.commandOptions));hlen=(...n)=>this.chain(new W(n,this.commandOptions));hmget=(...n)=>this.chain(new Y(n,this.commandOptions));hmset=(n,t)=>this.chain(new V([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new _([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new Q(n,this.commandOptions));hset=(n,t)=>this.chain(new nn([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new tn([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new en(n,this.commandOptions));hvals=(...n)=>this.chain(new on(n,this.commandOptions));incr=(...n)=>this.chain(new sn(n,this.commandOptions));incrby=(...n)=>this.chain(new mn(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new rn(n,this.commandOptions));keys=(...n)=>this.chain(new Mn(n,this.commandOptions));lindex=(...n)=>this.chain(new vn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new En([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new zn(n,this.commandOptions));lmove=(...n)=>this.chain(new Jn(n,this.commandOptions));lpop=(...n)=>this.chain(new In(n,this.commandOptions));lpos=(...n)=>this.chain(new Pn(n,this.commandOptions));lpush=(n,...t)=>this.chain(new Kn([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new Ln([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new Zn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Nn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new Gn([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Bn(n,this.commandOptions));mget=(...n)=>this.chain(new Un(n,this.commandOptions));mset=n=>this.chain(new Hn([n],this.commandOptions));msetnx=n=>this.chain(new Fn([n],this.commandOptions));persist=(...n)=>this.chain(new qn(n,this.commandOptions));pexpire=(...n)=>this.chain(new $n(n,this.commandOptions));pexpireat=(...n)=>this.chain(new Xn(n,this.commandOptions));ping=n=>this.chain(new jn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new Wn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new Yn(n,this.commandOptions));publish=(...n)=>this.chain(new Vn(n,this.commandOptions));randomkey=()=>this.chain(new _n(this.commandOptions));rename=(...n)=>this.chain(new Qn(n,this.commandOptions));renamenx=(...n)=>this.chain(new nt(n,this.commandOptions));rpop=(...n)=>this.chain(new tt(n,this.commandOptions));rpush=(n,...t)=>this.chain(new et([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new ot([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new st([n,...t],this.commandOptions));scan=(...n)=>this.chain(new mt(n,this.commandOptions));scard=(...n)=>this.chain(new rt(n,this.commandOptions));scriptExists=(...n)=>this.chain(new at(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new it(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new pt(n,this.commandOptions));sdiff=(...n)=>this.chain(new dt(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new ct(n,this.commandOptions));set=(n,t,o)=>this.chain(new ut([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new ht(n,this.commandOptions));setex=(n,t,o)=>this.chain(new lt([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new Ct([n,t],this.commandOptions));setrange=(...n)=>this.chain(new gt(n,this.commandOptions));sinter=(...n)=>this.chain(new xt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ft(n,this.commandOptions));sismember=(n,t)=>this.chain(new yt([n,t],this.commandOptions));smembers=(...n)=>this.chain(new bt(n,this.commandOptions));smismember=(n,t)=>this.chain(new Ot([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Tt([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new wt(n,this.commandOptions));srandmember=(...n)=>this.chain(new Dt(n,this.commandOptions));srem=(n,...t)=>this.chain(new kt([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new At(n,this.commandOptions));strlen=(...n)=>this.chain(new St(n,this.commandOptions));sunion=(...n)=>this.chain(new Rt(n,this.commandOptions));sunionstore=(...n)=>this.chain(new Mt(n,this.commandOptions));time=()=>this.chain(new vt(this.commandOptions));touch=(...n)=>this.chain(new Et(n,this.commandOptions));ttl=(...n)=>this.chain(new zt(n,this.commandOptions));type=(...n)=>this.chain(new Jt(n,this.commandOptions));unlink=(...n)=>this.chain(new It(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Pt(n,this.commandOptions));zcount=(...n)=>this.chain(new Kt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Lt([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new Zt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Nt(n,this.commandOptions));zmscore=(...n)=>this.chain(new ne(n,this.commandOptions));zpopmax=(...n)=>this.chain(new Gt(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Bt(n,this.commandOptions));zrange=(...n)=>this.chain(new Ut(n,this.commandOptions));zrank=(n,t)=>this.chain(new Ht([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new Ft([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new qt(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new $t(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new Xt(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new jt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new Wt(n,this.commandOptions));zscore=(n,t)=>this.chain(new Yt([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new _t(n,this.commandOptions));zunion=(...n)=>this.chain(new Vt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new an(n,this.commandOptions)),arrindex:(...n)=>this.chain(new pn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new dn(n,this.commandOptions)),arrlen:(...n)=>this.chain(new cn(n,this.commandOptions)),arrpop:(...n)=>this.chain(new un(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new hn(n,this.commandOptions)),clear:(...n)=>this.chain(new ln(n,this.commandOptions)),del:(...n)=>this.chain(new Cn(n,this.commandOptions)),forget:(...n)=>this.chain(new gn(n,this.commandOptions)),geoadd:(...n)=>this.chain(new E(n,this.commandOptions)),geodist:(...n)=>this.chain(new z(n,this.commandOptions)),geopos:(...n)=>this.chain(new J(n,this.commandOptions)),geohash:(...n)=>this.chain(new I(n,this.commandOptions)),geosearch:(...n)=>this.chain(new P(n,this.commandOptions)),geosearchstore:(...n)=>this.chain(new K(n,this.commandOptions)),get:(...n)=>this.chain(new xn(n,this.commandOptions)),mget:(...n)=>this.chain(new fn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new yn(n,this.commandOptions)),nummultby:(...n)=>this.chain(new bn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new On(n,this.commandOptions)),objlen:(...n)=>this.chain(new Tn(n,this.commandOptions)),resp:(...n)=>this.chain(new wn(n,this.commandOptions)),set:(...n)=>this.chain(new Dn(n,this.commandOptions)),strappend:(...n)=>this.chain(new kn(n,this.commandOptions)),strlen:(...n)=>this.chain(new An(n,this.commandOptions)),toggle:(...n)=>this.chain(new Sn(n,this.commandOptions)),type:(...n)=>this.chain(new Rn(n,this.commandOptions))}}};import Oe from"crypto-js/enc-hex";import Te from"crypto-js/sha1";var re=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return Oe.stringify(Te(n))}};var ae=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new an(n,this.opts).exec(this.client),arrindex:(...n)=>new pn(n,this.opts).exec(this.client),arrinsert:(...n)=>new dn(n,this.opts).exec(this.client),arrlen:(...n)=>new cn(n,this.opts).exec(this.client),arrpop:(...n)=>new un(n,this.opts).exec(this.client),arrtrim:(...n)=>new hn(n,this.opts).exec(this.client),clear:(...n)=>new ln(n,this.opts).exec(this.client),del:(...n)=>new Cn(n,this.opts).exec(this.client),forget:(...n)=>new gn(n,this.opts).exec(this.client),geoadd:(...n)=>new E(n,this.opts).exec(this.client),geopos:(...n)=>new J(n,this.opts).exec(this.client),geodist:(...n)=>new z(n,this.opts).exec(this.client),geohash:(...n)=>new I(n,this.opts).exec(this.client),geosearch:(...n)=>new P(n,this.opts).exec(this.client),geosearchstore:(...n)=>new K(n,this.opts).exec(this.client),get:(...n)=>new xn(n,this.opts).exec(this.client),mget:(...n)=>new fn(n,this.opts).exec(this.client),numincrby:(...n)=>new yn(n,this.opts).exec(this.client),nummultby:(...n)=>new bn(n,this.opts).exec(this.client),objkeys:(...n)=>new On(n,this.opts).exec(this.client),objlen:(...n)=>new Tn(n,this.opts).exec(this.client),resp:(...n)=>new wn(n,this.opts).exec(this.client),set:(...n)=>new Dn(n,this.opts).exec(this.client),strappend:(...n)=>new kn(n,this.opts).exec(this.client),strlen:(...n)=>new An(n,this.opts).exec(this.client),toggle:(...n)=>new Sn(n,this.opts).exec(this.client),type:(...n)=>new Rn(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new re(this,n)}pipeline=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new l(n,this.opts).exec(this.client);bitcount=(...n)=>new C(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new g([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new x(n,this.opts).exec(this.client);copy=(...n)=>new f(n,this.opts).exec(this.client);dbsize=()=>new y(this.opts).exec(this.client);decr=(...n)=>new b(n,this.opts).exec(this.client);decrby=(...n)=>new O(n,this.opts).exec(this.client);del=(...n)=>new T(n,this.opts).exec(this.client);echo=(...n)=>new w(n,this.opts).exec(this.client);eval=(...n)=>new D(n,this.opts).exec(this.client);evalsha=(...n)=>new k(n,this.opts).exec(this.client);exists=(...n)=>new A(n,this.opts).exec(this.client);expire=(...n)=>new S(n,this.opts).exec(this.client);expireat=(...n)=>new R(n,this.opts).exec(this.client);flushall=n=>new M(n,this.opts).exec(this.client);flushdb=(...n)=>new v(n,this.opts).exec(this.client);get=(...n)=>new L(n,this.opts).exec(this.client);getbit=(...n)=>new Z(n,this.opts).exec(this.client);getdel=(...n)=>new N(n,this.opts).exec(this.client);getrange=(...n)=>new G(n,this.opts).exec(this.client);getset=(n,t)=>new B([n,t],this.opts).exec(this.client);hdel=(...n)=>new U(n,this.opts).exec(this.client);hexists=(...n)=>new H(n,this.opts).exec(this.client);hget=(...n)=>new F(n,this.opts).exec(this.client);hgetall=(...n)=>new q(n,this.opts).exec(this.client);hincrby=(...n)=>new $(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new X(n,this.opts).exec(this.client);hkeys=(...n)=>new j(n,this.opts).exec(this.client);hlen=(...n)=>new W(n,this.opts).exec(this.client);hmget=(...n)=>new Y(n,this.opts).exec(this.client);hmset=(n,t)=>new V([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new _([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new Q(n,this.opts).exec(this.client);hset=(n,t)=>new nn([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new tn([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new en(n,this.opts).exec(this.client);hvals=(...n)=>new on(n,this.opts).exec(this.client);incr=(...n)=>new sn(n,this.opts).exec(this.client);incrby=(...n)=>new mn(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new rn(n,this.opts).exec(this.client);keys=(...n)=>new Mn(n,this.opts).exec(this.client);lindex=(...n)=>new vn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new En([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new zn(n,this.opts).exec(this.client);lmove=(...n)=>new Jn(n,this.opts).exec(this.client);lpop=(...n)=>new In(n,this.opts).exec(this.client);lpos=(...n)=>new Pn(n,this.opts).exec(this.client);lpush=(n,...t)=>new Kn([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new Ln([n,...t],this.opts).exec(this.client);lrange=(...n)=>new Zn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Nn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new Gn([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Bn(n,this.opts).exec(this.client);mget=(...n)=>new Un(n,this.opts).exec(this.client);mset=n=>new Hn([n],this.opts).exec(this.client);msetnx=n=>new Fn([n],this.opts).exec(this.client);persist=(...n)=>new qn(n,this.opts).exec(this.client);pexpire=(...n)=>new $n(n,this.opts).exec(this.client);pexpireat=(...n)=>new Xn(n,this.opts).exec(this.client);ping=n=>new jn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new Wn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new Yn(n,this.opts).exec(this.client);publish=(...n)=>new Vn(n,this.opts).exec(this.client);randomkey=()=>new _n().exec(this.client);rename=(...n)=>new Qn(n,this.opts).exec(this.client);renamenx=(...n)=>new nt(n,this.opts).exec(this.client);rpop=(...n)=>new tt(n,this.opts).exec(this.client);rpush=(n,...t)=>new et([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new ot([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new st([n,...t],this.opts).exec(this.client);scan=(...n)=>new mt(n,this.opts).exec(this.client);scard=(...n)=>new rt(n,this.opts).exec(this.client);scriptExists=(...n)=>new at(n,this.opts).exec(this.client);scriptFlush=(...n)=>new it(n,this.opts).exec(this.client);scriptLoad=(...n)=>new pt(n,this.opts).exec(this.client);sdiff=(...n)=>new dt(n,this.opts).exec(this.client);sdiffstore=(...n)=>new ct(n,this.opts).exec(this.client);set=(n,t,o)=>new ut([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new ht(n,this.opts).exec(this.client);setex=(n,t,o)=>new lt([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new Ct([n,t],this.opts).exec(this.client);setrange=(...n)=>new gt(n,this.opts).exec(this.client);sinter=(...n)=>new xt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ft(n,this.opts).exec(this.client);sismember=(n,t)=>new yt([n,t],this.opts).exec(this.client);smismember=(n,t)=>new Ot([n,t],this.opts).exec(this.client);smembers=(...n)=>new bt(n,this.opts).exec(this.client);smove=(n,t,o)=>new Tt([n,t,o],this.opts).exec(this.client);spop=(...n)=>new wt(n,this.opts).exec(this.client);srandmember=(...n)=>new Dt(n,this.opts).exec(this.client);srem=(n,...t)=>new kt([n,...t],this.opts).exec(this.client);sscan=(...n)=>new At(n,this.opts).exec(this.client);strlen=(...n)=>new St(n,this.opts).exec(this.client);sunion=(...n)=>new Rt(n,this.opts).exec(this.client);sunionstore=(...n)=>new Mt(n,this.opts).exec(this.client);time=()=>new vt().exec(this.client);touch=(...n)=>new Et(n,this.opts).exec(this.client);ttl=(...n)=>new zt(n,this.opts).exec(this.client);type=(...n)=>new Jt(n,this.opts).exec(this.client);unlink=(...n)=>new It(n,this.opts).exec(this.client);xadd=(...n)=>new se(n,this.opts).exec(this.client);xrange=(...n)=>new me(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Pt(n,this.opts).exec(this.client);zcount=(...n)=>new Kt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new Qt(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Lt([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new Zt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Nt(n,this.opts).exec(this.client);zmscore=(...n)=>new ne(n,this.opts).exec(this.client);zpopmax=(...n)=>new Gt(n,this.opts).exec(this.client);zpopmin=(...n)=>new Bt(n,this.opts).exec(this.client);zrange=(...n)=>new Ut(n,this.opts).exec(this.client);zrank=(n,t)=>new Ht([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new Ft([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new qt(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new $t(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new Xt(n,this.opts).exec(this.client);zrevrank=(n,t)=>new jt([n,t],this.opts).exec(this.client);zscan=(...n)=>new Wt(n,this.opts).exec(this.client);zscore=(n,t)=>new Yt([n,t],this.opts).exec(this.client);zunion=(...n)=>new Vt(n,this.opts).exec(this.client);zunionstore=(...n)=>new _t(n,this.opts).exec(this.client)};var he="v1.24.2";var le=class extends ae{constructor(n){(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new oe({baseUrl:n.url,retry:n.retry,headers:{authorization:`Bearer ${n.token}`},options:{backend:n.backend},responseEncoding:n.responseEncoding});super(t,{automaticDeserialization:n.automaticDeserialization}),this.addTelemetry({sdk:`@upstash/redis@${he}`,platform:"fastly"})}};export{le as Redis};
|
|
1
|
+
import{a as t,b as s,c as r}from"./chunk-KBK5EDMP.mjs";var o=class extends s{constructor(e){(e.url.startsWith(" ")||e.url.endsWith(" ")||/\r|\n/.test(e.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(e.token.startsWith(" ")||e.token.endsWith(" ")||/\r|\n/.test(e.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let n=new t({baseUrl:e.url,retry:e.retry,headers:{authorization:`Bearer ${e.token}`},options:{backend:e.backend},responseEncoding:e.responseEncoding});super(n,{automaticDeserialization:e.automaticDeserialization}),this.addTelemetry({sdk:`@upstash/redis@${r}`,platform:"fastly"})}};export{o as Redis};
|
package/nodejs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var be=Object.create;var oe=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var ke=(s,n)=>{for(var t in n)oe(s,t,{get:n[t],enumerable:!0})},ue=(s,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let m of Te(n))!De.call(s,m)&&m!==t&&oe(s,m,{get:()=>n[m],enumerable:!(o=Oe(n,m))||o.enumerable});return s};var he=(s,n,t)=>(t=s!=null?be(we(s)):{},ue(n||!s||!s.__esModule?oe(t,"default",{value:s,enumerable:!0}):t,s)),Ae=s=>ue(oe({},"__esModule",{value:!0}),s);var Pe={};ke(Pe,{Redis:()=>de});module.exports=Ae(Pe);var c=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var se=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(p=>setTimeout(p,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new c(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:p})=>({result:pe(i),error:p})):{result:pe(r.result),error:r.error}:r}};function le(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function pe(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?le(t):Array.isArray(t)?t.map(pe):t):n=null;break}case"string":{n=s==="OK"?"OK":le(s);break}default:break}return n}function Ce(s){let n=Array.isArray(s)?s.map(t=>{try{return Ce(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ge(s){try{return Ce(s)}catch{return s}}var Se=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=Se,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??ge:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new c(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var l=class extends e{constructor(n,t){super(["append",...n],t)}};var C=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var g=class extends e{constructor(n,t){super(["bitop",...n],t)}};var x=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var f=class extends e{constructor([n,t,o],m){super(["COPY",n,t,...o?.replace?["REPLACE"]:[]],{...m,deserialize(r){return r>0?"COPIED":"NOT_COPIED"}})}};var y=class extends e{constructor(n){super(["dbsize"],n)}};var b=class extends e{constructor(n,t){super(["decr",...n],t)}};var O=class extends e{constructor(n,t){super(["decrby",...n],t)}};var T=class extends e{constructor(n,t){super(["del",...n],t)}};var w=class extends e{constructor(n,t){super(["echo",...n],t)}};var D=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var k=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var A=class extends e{constructor(n,t){super(["exists",...n],t)}};var S=class extends e{constructor(n,t){super(["expire",...n],t)}};var R=class extends e{constructor(n,t){super(["expireat",...n],t)}};var v=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var M=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var E=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:p})=>[i,a,p])),super(r,m)}};var z=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var I=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOPOS",o,...m],{deserialize:r=>Re(r),...t})}};function Re(s){let n=[];for(let t of s)!t?.[0]||!t?.[1]||n.push({lng:parseFloat(t[0]),lat:parseFloat(t[1])});return n}var P=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOHASH",o,...m],t)}};var J=class extends e{constructor([n,t,o,m,r],a){let i=["GEOSEARCH",n];(t.type==="FROMMEMBER"||t.type==="frommember")&&i.push(t.type,t.member),(t.type==="FROMLONLAT"||t.type==="fromlonlat")&&i.push(t.type,t.coordinate.lon,t.coordinate.lat),(o.type==="BYRADIUS"||o.type==="byradius")&&i.push(o.type,o.radius,o.radiusType),(o.type==="BYBOX"||o.type==="bybox")&&i.push(o.type,o.rect.width,o.rect.height,o.rectType),i.push(m),r?.count&&i.push(r.count.limit,...r.count.any?["ANY"]:[]);let p=ce=>!r?.withCoord&&!r?.withDist&&!r?.withHash?ce.map(d=>{try{return{member:JSON.parse(d)}}catch{return{member:d}}}):ce.map(d=>{let ee=1,h={};try{h.member=JSON.parse(d[0])}catch{h.member=d[0]}return r.withDist&&(h.dist=parseFloat(d[ee++])),r.withHash&&(h.hash=d[ee++].toString()),r.withCoord&&(h.coord={long:parseFloat(d[ee][0]),lat:parseFloat(d[ee][1])}),h});super([...i,...r?.withCoord?["WITHCOORD"]:[],...r?.withDist?["WITHDIST"]:[],...r?.withHash?["WITHHASH"]:[]],{...a,deserialize:p})}};var L=class extends e{constructor([n,t,o,m,r,a],i){let p=["GEOSEARCHSTORE",n,t];(o.type==="FROMMEMBER"||o.type==="frommember")&&p.push(o.type,o.member),(o.type==="FROMLONLAT"||o.type==="fromlonlat")&&p.push(o.type,o.coordinate.lon,o.coordinate.lat),(m.type==="BYRADIUS"||m.type==="byradius")&&p.push(m.type,m.radius,m.radiusType),(m.type==="BYBOX"||m.type==="bybox")&&p.push(m.type,m.rect.width,m.rect.height,m.rectType),p.push(r),a?.count&&p.push(a.count.limit,...a.count.any?["ANY"]:[]),super([...p,...a?.storeDist?["STOREDIST"]:[]],i)}};var N=class extends e{constructor(n,t){super(["get",...n],t)}};var K=class extends e{constructor(n,t){super(["getbit",...n],t)}};var Z=class extends e{constructor(n,t){super(["getdel",...n],t)}};var G=class extends e{constructor(n,t){super(["getrange",...n],t)}};var U=class extends e{constructor(n,t){super(["getset",...n],t)}};var B=class extends e{constructor(n,t){super(["hdel",...n],t)}};var H=class extends e{constructor(n,t){super(["hexists",...n],t)}};var F=class extends e{constructor(n,t){super(["hget",...n],t)}};function ve(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var $=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>ve(o),...t})}};var q=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var j=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var X=class extends e{constructor([n],t){super(["hkeys",n],t)}};var W=class extends e{constructor(n,t){super(["hlen",...n],t)}};function Me(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var _=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>Me(t,m),...o})}};var Y=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function Ee(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var V=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>Ee(m):t?.deserialize,...t})}};var Q=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var nn=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var tn=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var en=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var on=class extends e{constructor(n,t){super(["hvals",...n],t)}};var sn=class extends e{constructor(n,t){super(["incr",...n],t)}};var mn=class extends e{constructor(n,t){super(["incrby",...n],t)}};var rn=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var dn=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var cn=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var un=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var hn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var ln=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var yn=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var wn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var Dn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var kn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var An=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var Sn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Rn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var vn=class extends e{constructor(n,t){super(["keys",...n],t)}};var Mn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var En=class extends e{constructor(n,t){super(["linsert",...n],t)}};var zn=class extends e{constructor(n,t){super(["llen",...n],t)}};var In=class extends e{constructor(n,t){super(["lmove",...n],t)}};var Pn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Jn=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var Ln=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Nn=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Kn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Zn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Gn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Un=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Bn=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Hn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Fn=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var $n=class extends e{constructor(n,t){super(["persist",...n],t)}};var qn=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var jn=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var Xn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Wn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var _n=class extends e{constructor(n,t){super(["pttl",...n],t)}};var Yn=class extends e{constructor(n,t){super(["publish",...n],t)}};var Vn=class extends e{constructor(n){super(["randomkey"],n)}};var Qn=class extends e{constructor(n,t){super(["rename",...n],t)}};var nt=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var tt=class extends e{constructor(n,t){super(["rpop",...n],t)}};var et=class extends e{constructor(n,t){super(["rpush",...n],t)}};var ot=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var st=class extends e{constructor(n,t){super(["sadd",...n],t)}};var mt=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var rt=class extends e{constructor(n,t){super(["scard",...n],t)}};var at=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var it=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var pt=class extends e{constructor(n,t){super(["script","load",...n],t)}};var dt=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var ct=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var ut=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var ht=class extends e{constructor(n,t){super(["setbit",...n],t)}};var lt=class extends e{constructor(n,t){super(["setex",...n],t)}};var Ct=class extends e{constructor(n,t){super(["setnx",...n],t)}};var gt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var xt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ft=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var yt=class extends e{constructor(n,t){super(["sismember",...n],t)}};var bt=class extends e{constructor(n,t){super(["smembers",...n],t)}};var Ot=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Tt=class extends e{constructor(n,t){super(["smove",...n],t)}};var wt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var Dt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var kt=class extends e{constructor(n,t){super(["srem",...n],t)}};var At=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var St=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Rt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var vt=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var Mt=class extends e{constructor(n){super(["time"],n)}};var Et=class extends e{constructor(n,t){super(["touch",...n],t)}};var zt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var It=class extends e{constructor(n,t){super(["type",...n],t)}};var Pt=class extends e{constructor(n,t){super(["unlink",...n],t)}};var me=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,p]of Object.entries(o))a.push(i,p);super(a,r)}};function ze(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var re=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>ze(i),...r})}};var u=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Jt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var Lt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Nt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Kt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Zt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Gt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Ut=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Bt=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Ht=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Ft=class extends e{constructor(n,t){super(["zrem",...n],t)}};var $t=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var qt=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var jt=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var Xt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Wt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var _t=class extends e{constructor(n,t){super(["zscore",...n],t)}};var Yt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var Vt=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Qt=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var ne=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var te=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new c(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new l(n,this.commandOptions));bitcount=(...n)=>this.chain(new C(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new g([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new x(n,this.commandOptions));copy=(...n)=>this.chain(new f(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new Qt(n,this.commandOptions));dbsize=()=>this.chain(new y(this.commandOptions));decr=(...n)=>this.chain(new b(n,this.commandOptions));decrby=(...n)=>this.chain(new O(n,this.commandOptions));del=(...n)=>this.chain(new T(n,this.commandOptions));echo=(...n)=>this.chain(new w(n,this.commandOptions));eval=(...n)=>this.chain(new D(n,this.commandOptions));evalsha=(...n)=>this.chain(new k(n,this.commandOptions));exists=(...n)=>this.chain(new A(n,this.commandOptions));expire=(...n)=>this.chain(new S(n,this.commandOptions));expireat=(...n)=>this.chain(new R(n,this.commandOptions));flushall=n=>this.chain(new v(n,this.commandOptions));flushdb=(...n)=>this.chain(new M(n,this.commandOptions));get=(...n)=>this.chain(new N(n,this.commandOptions));getbit=(...n)=>this.chain(new K(n,this.commandOptions));getdel=(...n)=>this.chain(new Z(n,this.commandOptions));getrange=(...n)=>this.chain(new G(n,this.commandOptions));getset=(n,t)=>this.chain(new U([n,t],this.commandOptions));hdel=(...n)=>this.chain(new B(n,this.commandOptions));hexists=(...n)=>this.chain(new H(n,this.commandOptions));hget=(...n)=>this.chain(new F(n,this.commandOptions));hgetall=(...n)=>this.chain(new $(n,this.commandOptions));hincrby=(...n)=>this.chain(new q(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new j(n,this.commandOptions));hkeys=(...n)=>this.chain(new X(n,this.commandOptions));hlen=(...n)=>this.chain(new W(n,this.commandOptions));hmget=(...n)=>this.chain(new _(n,this.commandOptions));hmset=(n,t)=>this.chain(new Y([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new V([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new Q(n,this.commandOptions));hset=(n,t)=>this.chain(new nn([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new tn([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new en(n,this.commandOptions));hvals=(...n)=>this.chain(new on(n,this.commandOptions));incr=(...n)=>this.chain(new sn(n,this.commandOptions));incrby=(...n)=>this.chain(new mn(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new rn(n,this.commandOptions));keys=(...n)=>this.chain(new vn(n,this.commandOptions));lindex=(...n)=>this.chain(new Mn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new En([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new zn(n,this.commandOptions));lmove=(...n)=>this.chain(new In(n,this.commandOptions));lpop=(...n)=>this.chain(new Pn(n,this.commandOptions));lpos=(...n)=>this.chain(new Jn(n,this.commandOptions));lpush=(n,...t)=>this.chain(new Ln([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new Nn([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new Kn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Zn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new Gn([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Un(n,this.commandOptions));mget=(...n)=>this.chain(new Bn(n,this.commandOptions));mset=n=>this.chain(new Hn([n],this.commandOptions));msetnx=n=>this.chain(new Fn([n],this.commandOptions));persist=(...n)=>this.chain(new $n(n,this.commandOptions));pexpire=(...n)=>this.chain(new qn(n,this.commandOptions));pexpireat=(...n)=>this.chain(new jn(n,this.commandOptions));ping=n=>this.chain(new Xn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new Wn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new _n(n,this.commandOptions));publish=(...n)=>this.chain(new Yn(n,this.commandOptions));randomkey=()=>this.chain(new Vn(this.commandOptions));rename=(...n)=>this.chain(new Qn(n,this.commandOptions));renamenx=(...n)=>this.chain(new nt(n,this.commandOptions));rpop=(...n)=>this.chain(new tt(n,this.commandOptions));rpush=(n,...t)=>this.chain(new et([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new ot([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new st([n,...t],this.commandOptions));scan=(...n)=>this.chain(new mt(n,this.commandOptions));scard=(...n)=>this.chain(new rt(n,this.commandOptions));scriptExists=(...n)=>this.chain(new at(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new it(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new pt(n,this.commandOptions));sdiff=(...n)=>this.chain(new dt(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new ct(n,this.commandOptions));set=(n,t,o)=>this.chain(new ut([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new ht(n,this.commandOptions));setex=(n,t,o)=>this.chain(new lt([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new Ct([n,t],this.commandOptions));setrange=(...n)=>this.chain(new gt(n,this.commandOptions));sinter=(...n)=>this.chain(new xt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ft(n,this.commandOptions));sismember=(n,t)=>this.chain(new yt([n,t],this.commandOptions));smembers=(...n)=>this.chain(new bt(n,this.commandOptions));smismember=(n,t)=>this.chain(new Ot([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Tt([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new wt(n,this.commandOptions));srandmember=(...n)=>this.chain(new Dt(n,this.commandOptions));srem=(n,...t)=>this.chain(new kt([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new At(n,this.commandOptions));strlen=(...n)=>this.chain(new St(n,this.commandOptions));sunion=(...n)=>this.chain(new Rt(n,this.commandOptions));sunionstore=(...n)=>this.chain(new vt(n,this.commandOptions));time=()=>this.chain(new Mt(this.commandOptions));touch=(...n)=>this.chain(new Et(n,this.commandOptions));ttl=(...n)=>this.chain(new zt(n,this.commandOptions));type=(...n)=>this.chain(new It(n,this.commandOptions));unlink=(...n)=>this.chain(new Pt(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Jt(n,this.commandOptions));zcount=(...n)=>this.chain(new Lt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Nt([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new Kt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Zt(n,this.commandOptions));zmscore=(...n)=>this.chain(new ne(n,this.commandOptions));zpopmax=(...n)=>this.chain(new Gt(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Ut(n,this.commandOptions));zrange=(...n)=>this.chain(new Bt(n,this.commandOptions));zrank=(n,t)=>this.chain(new Ht([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new Ft([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new $t(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new qt(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new jt(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new Xt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new Wt(n,this.commandOptions));zscore=(n,t)=>this.chain(new _t([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new Vt(n,this.commandOptions));zunion=(...n)=>this.chain(new Yt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new an(n,this.commandOptions)),arrindex:(...n)=>this.chain(new pn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new dn(n,this.commandOptions)),arrlen:(...n)=>this.chain(new cn(n,this.commandOptions)),arrpop:(...n)=>this.chain(new un(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new hn(n,this.commandOptions)),clear:(...n)=>this.chain(new ln(n,this.commandOptions)),del:(...n)=>this.chain(new Cn(n,this.commandOptions)),forget:(...n)=>this.chain(new gn(n,this.commandOptions)),geoadd:(...n)=>this.chain(new E(n,this.commandOptions)),geodist:(...n)=>this.chain(new z(n,this.commandOptions)),geopos:(...n)=>this.chain(new I(n,this.commandOptions)),geohash:(...n)=>this.chain(new P(n,this.commandOptions)),geosearch:(...n)=>this.chain(new J(n,this.commandOptions)),geosearchstore:(...n)=>this.chain(new L(n,this.commandOptions)),get:(...n)=>this.chain(new xn(n,this.commandOptions)),mget:(...n)=>this.chain(new fn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new yn(n,this.commandOptions)),nummultby:(...n)=>this.chain(new bn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new On(n,this.commandOptions)),objlen:(...n)=>this.chain(new Tn(n,this.commandOptions)),resp:(...n)=>this.chain(new wn(n,this.commandOptions)),set:(...n)=>this.chain(new Dn(n,this.commandOptions)),strappend:(...n)=>this.chain(new kn(n,this.commandOptions)),strlen:(...n)=>this.chain(new An(n,this.commandOptions)),toggle:(...n)=>this.chain(new Sn(n,this.commandOptions)),type:(...n)=>this.chain(new Rn(n,this.commandOptions))}}};var xe=he(require("crypto-js/enc-hex")),fe=he(require("crypto-js/sha1")),ae=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return xe.default.stringify((0,fe.default)(n))}};var ie=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new an(n,this.opts).exec(this.client),arrindex:(...n)=>new pn(n,this.opts).exec(this.client),arrinsert:(...n)=>new dn(n,this.opts).exec(this.client),arrlen:(...n)=>new cn(n,this.opts).exec(this.client),arrpop:(...n)=>new un(n,this.opts).exec(this.client),arrtrim:(...n)=>new hn(n,this.opts).exec(this.client),clear:(...n)=>new ln(n,this.opts).exec(this.client),del:(...n)=>new Cn(n,this.opts).exec(this.client),forget:(...n)=>new gn(n,this.opts).exec(this.client),geoadd:(...n)=>new E(n,this.opts).exec(this.client),geopos:(...n)=>new I(n,this.opts).exec(this.client),geodist:(...n)=>new z(n,this.opts).exec(this.client),geohash:(...n)=>new P(n,this.opts).exec(this.client),geosearch:(...n)=>new J(n,this.opts).exec(this.client),geosearchstore:(...n)=>new L(n,this.opts).exec(this.client),get:(...n)=>new xn(n,this.opts).exec(this.client),mget:(...n)=>new fn(n,this.opts).exec(this.client),numincrby:(...n)=>new yn(n,this.opts).exec(this.client),nummultby:(...n)=>new bn(n,this.opts).exec(this.client),objkeys:(...n)=>new On(n,this.opts).exec(this.client),objlen:(...n)=>new Tn(n,this.opts).exec(this.client),resp:(...n)=>new wn(n,this.opts).exec(this.client),set:(...n)=>new Dn(n,this.opts).exec(this.client),strappend:(...n)=>new kn(n,this.opts).exec(this.client),strlen:(...n)=>new An(n,this.opts).exec(this.client),toggle:(...n)=>new Sn(n,this.opts).exec(this.client),type:(...n)=>new Rn(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new ae(this,n)}pipeline=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new l(n,this.opts).exec(this.client);bitcount=(...n)=>new C(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new g([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new x(n,this.opts).exec(this.client);copy=(...n)=>new f(n,this.opts).exec(this.client);dbsize=()=>new y(this.opts).exec(this.client);decr=(...n)=>new b(n,this.opts).exec(this.client);decrby=(...n)=>new O(n,this.opts).exec(this.client);del=(...n)=>new T(n,this.opts).exec(this.client);echo=(...n)=>new w(n,this.opts).exec(this.client);eval=(...n)=>new D(n,this.opts).exec(this.client);evalsha=(...n)=>new k(n,this.opts).exec(this.client);exists=(...n)=>new A(n,this.opts).exec(this.client);expire=(...n)=>new S(n,this.opts).exec(this.client);expireat=(...n)=>new R(n,this.opts).exec(this.client);flushall=n=>new v(n,this.opts).exec(this.client);flushdb=(...n)=>new M(n,this.opts).exec(this.client);get=(...n)=>new N(n,this.opts).exec(this.client);getbit=(...n)=>new K(n,this.opts).exec(this.client);getdel=(...n)=>new Z(n,this.opts).exec(this.client);getrange=(...n)=>new G(n,this.opts).exec(this.client);getset=(n,t)=>new U([n,t],this.opts).exec(this.client);hdel=(...n)=>new B(n,this.opts).exec(this.client);hexists=(...n)=>new H(n,this.opts).exec(this.client);hget=(...n)=>new F(n,this.opts).exec(this.client);hgetall=(...n)=>new $(n,this.opts).exec(this.client);hincrby=(...n)=>new q(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new j(n,this.opts).exec(this.client);hkeys=(...n)=>new X(n,this.opts).exec(this.client);hlen=(...n)=>new W(n,this.opts).exec(this.client);hmget=(...n)=>new _(n,this.opts).exec(this.client);hmset=(n,t)=>new Y([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new V([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new Q(n,this.opts).exec(this.client);hset=(n,t)=>new nn([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new tn([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new en(n,this.opts).exec(this.client);hvals=(...n)=>new on(n,this.opts).exec(this.client);incr=(...n)=>new sn(n,this.opts).exec(this.client);incrby=(...n)=>new mn(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new rn(n,this.opts).exec(this.client);keys=(...n)=>new vn(n,this.opts).exec(this.client);lindex=(...n)=>new Mn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new En([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new zn(n,this.opts).exec(this.client);lmove=(...n)=>new In(n,this.opts).exec(this.client);lpop=(...n)=>new Pn(n,this.opts).exec(this.client);lpos=(...n)=>new Jn(n,this.opts).exec(this.client);lpush=(n,...t)=>new Ln([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new Nn([n,...t],this.opts).exec(this.client);lrange=(...n)=>new Kn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Zn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new Gn([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Un(n,this.opts).exec(this.client);mget=(...n)=>new Bn(n,this.opts).exec(this.client);mset=n=>new Hn([n],this.opts).exec(this.client);msetnx=n=>new Fn([n],this.opts).exec(this.client);persist=(...n)=>new $n(n,this.opts).exec(this.client);pexpire=(...n)=>new qn(n,this.opts).exec(this.client);pexpireat=(...n)=>new jn(n,this.opts).exec(this.client);ping=n=>new Xn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new Wn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new _n(n,this.opts).exec(this.client);publish=(...n)=>new Yn(n,this.opts).exec(this.client);randomkey=()=>new Vn().exec(this.client);rename=(...n)=>new Qn(n,this.opts).exec(this.client);renamenx=(...n)=>new nt(n,this.opts).exec(this.client);rpop=(...n)=>new tt(n,this.opts).exec(this.client);rpush=(n,...t)=>new et([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new ot([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new st([n,...t],this.opts).exec(this.client);scan=(...n)=>new mt(n,this.opts).exec(this.client);scard=(...n)=>new rt(n,this.opts).exec(this.client);scriptExists=(...n)=>new at(n,this.opts).exec(this.client);scriptFlush=(...n)=>new it(n,this.opts).exec(this.client);scriptLoad=(...n)=>new pt(n,this.opts).exec(this.client);sdiff=(...n)=>new dt(n,this.opts).exec(this.client);sdiffstore=(...n)=>new ct(n,this.opts).exec(this.client);set=(n,t,o)=>new ut([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new ht(n,this.opts).exec(this.client);setex=(n,t,o)=>new lt([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new Ct([n,t],this.opts).exec(this.client);setrange=(...n)=>new gt(n,this.opts).exec(this.client);sinter=(...n)=>new xt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ft(n,this.opts).exec(this.client);sismember=(n,t)=>new yt([n,t],this.opts).exec(this.client);smismember=(n,t)=>new Ot([n,t],this.opts).exec(this.client);smembers=(...n)=>new bt(n,this.opts).exec(this.client);smove=(n,t,o)=>new Tt([n,t,o],this.opts).exec(this.client);spop=(...n)=>new wt(n,this.opts).exec(this.client);srandmember=(...n)=>new Dt(n,this.opts).exec(this.client);srem=(n,...t)=>new kt([n,...t],this.opts).exec(this.client);sscan=(...n)=>new At(n,this.opts).exec(this.client);strlen=(...n)=>new St(n,this.opts).exec(this.client);sunion=(...n)=>new Rt(n,this.opts).exec(this.client);sunionstore=(...n)=>new vt(n,this.opts).exec(this.client);time=()=>new Mt().exec(this.client);touch=(...n)=>new Et(n,this.opts).exec(this.client);ttl=(...n)=>new zt(n,this.opts).exec(this.client);type=(...n)=>new It(n,this.opts).exec(this.client);unlink=(...n)=>new Pt(n,this.opts).exec(this.client);xadd=(...n)=>new me(n,this.opts).exec(this.client);xrange=(...n)=>new re(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Jt(n,this.opts).exec(this.client);zcount=(...n)=>new Lt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new Qt(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Nt([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new Kt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Zt(n,this.opts).exec(this.client);zmscore=(...n)=>new ne(n,this.opts).exec(this.client);zpopmax=(...n)=>new Gt(n,this.opts).exec(this.client);zpopmin=(...n)=>new Ut(n,this.opts).exec(this.client);zrange=(...n)=>new Bt(n,this.opts).exec(this.client);zrank=(n,t)=>new Ht([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new Ft([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new $t(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new qt(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new jt(n,this.opts).exec(this.client);zrevrank=(n,t)=>new Xt([n,t],this.opts).exec(this.client);zscan=(...n)=>new Wt(n,this.opts).exec(this.client);zscore=(n,t)=>new _t([n,t],this.opts).exec(this.client);zunion=(...n)=>new Yt(n,this.opts).exec(this.client);zunionstore=(...n)=>new Vt(n,this.opts).exec(this.client)};var ye="v1.24.2";typeof atob>"u"&&(global.atob=function(s){return Buffer.from(s,"base64").toString("utf-8")});var de=class s extends ie{constructor(n){if("request"in n){super(n);return}(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new se({baseUrl:n.url,retry:n.retry,headers:{authorization:`Bearer ${n.token}`},agent:n.agent,responseEncoding:n.responseEncoding,cache:n.cache||"no-store"});super(t,{automaticDeserialization:n.automaticDeserialization,enableTelemetry:!process.env.UPSTASH_DISABLE_TELEMETRY}),this.addTelemetry({runtime:typeof EdgeRuntime=="string"?"edge-light":`node@${process.version}`,platform:process.env.VERCEL?"vercel":process.env.AWS_REGION?"aws":"unknown",sdk:`@upstash/redis@${ye}`})}static fromEnv(n){if(typeof process?.env>"u")throw new Error('Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead');let t=process?.env.UPSTASH_REDIS_REST_URL;if(!t)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");let o=process?.env.UPSTASH_REDIS_REST_TOKEN;if(!o)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`");return new s({...n,url:t,token:o})}};0&&(module.exports={Redis});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkJIU2S2DZjs = require('./chunk-JIU2S2DZ.js');typeof atob>"u"&&(global.atob=function(n){return Buffer.from(n,"base64").toString("utf-8")});var a=class n extends _chunkJIU2S2DZjs.b{constructor(e){if("request"in e){super(e);return}(e.url.startsWith(" ")||e.url.endsWith(" ")||/\r|\n/.test(e.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(e.token.startsWith(" ")||e.token.endsWith(" ")||/\r|\n/.test(e.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new (0, _chunkJIU2S2DZjs.a)({baseUrl:e.url,retry:e.retry,headers:{authorization:`Bearer ${e.token}`},agent:e.agent,responseEncoding:e.responseEncoding,cache:e.cache||"no-store"});super(t,{automaticDeserialization:e.automaticDeserialization,enableTelemetry:!process.env.UPSTASH_DISABLE_TELEMETRY}),this.addTelemetry({runtime:typeof EdgeRuntime=="string"?"edge-light":`node@${process.version}`,platform:process.env.VERCEL?"vercel":process.env.AWS_REGION?"aws":"unknown",sdk:`@upstash/redis@${_chunkJIU2S2DZjs.c}`})}static fromEnv(e){if(typeof _optionalChain([process, 'optionalAccess', _ => _.env])>"u")throw new Error('Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead');let t=_optionalChain([process, 'optionalAccess', _2 => _2.env, 'access', _3 => _3.UPSTASH_REDIS_REST_URL]);if(!t)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");let s=_optionalChain([process, 'optionalAccess', _4 => _4.env, 'access', _5 => _5.UPSTASH_REDIS_REST_TOKEN]);if(!s)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`");return new n({...e,url:t,token:s})}};exports.Redis = a;
|
package/nodejs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var oe=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(p=>setTimeout(p,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new c(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:p})=>({result:ie(i),error:p})):{result:ie(r.result),error:r.error}:r}};function de(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function ie(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?de(t):Array.isArray(t)?t.map(ie):t):n=null;break}case"string":{n=s==="OK"?"OK":de(s);break}default:break}return n}function ce(s){let n=Array.isArray(s)?s.map(t=>{try{return ce(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ue(s){try{return ce(s)}catch{return s}}var Ce=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=Ce,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??ue:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new c(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var l=class extends e{constructor(n,t){super(["append",...n],t)}};var C=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var g=class extends e{constructor(n,t){super(["bitop",...n],t)}};var x=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var f=class extends e{constructor([n,t,o],m){super(["COPY",n,t,...o?.replace?["REPLACE"]:[]],{...m,deserialize(r){return r>0?"COPIED":"NOT_COPIED"}})}};var y=class extends e{constructor(n){super(["dbsize"],n)}};var b=class extends e{constructor(n,t){super(["decr",...n],t)}};var O=class extends e{constructor(n,t){super(["decrby",...n],t)}};var T=class extends e{constructor(n,t){super(["del",...n],t)}};var w=class extends e{constructor(n,t){super(["echo",...n],t)}};var D=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var k=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var A=class extends e{constructor(n,t){super(["exists",...n],t)}};var S=class extends e{constructor(n,t){super(["expire",...n],t)}};var R=class extends e{constructor(n,t){super(["expireat",...n],t)}};var v=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var M=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var E=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:p})=>[i,a,p])),super(r,m)}};var z=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var I=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOPOS",o,...m],{deserialize:r=>ge(r),...t})}};function ge(s){let n=[];for(let t of s)!t?.[0]||!t?.[1]||n.push({lng:parseFloat(t[0]),lat:parseFloat(t[1])});return n}var P=class extends e{constructor(n,t){let[o]=n,m=Array.isArray(n[1])?n[1]:n.slice(1);super(["GEOHASH",o,...m],t)}};var J=class extends e{constructor([n,t,o,m,r],a){let i=["GEOSEARCH",n];(t.type==="FROMMEMBER"||t.type==="frommember")&&i.push(t.type,t.member),(t.type==="FROMLONLAT"||t.type==="fromlonlat")&&i.push(t.type,t.coordinate.lon,t.coordinate.lat),(o.type==="BYRADIUS"||o.type==="byradius")&&i.push(o.type,o.radius,o.radiusType),(o.type==="BYBOX"||o.type==="bybox")&&i.push(o.type,o.rect.width,o.rect.height,o.rectType),i.push(m),r?.count&&i.push(r.count.limit,...r.count.any?["ANY"]:[]);let p=pe=>!r?.withCoord&&!r?.withDist&&!r?.withHash?pe.map(d=>{try{return{member:JSON.parse(d)}}catch{return{member:d}}}):pe.map(d=>{let ee=1,h={};try{h.member=JSON.parse(d[0])}catch{h.member=d[0]}return r.withDist&&(h.dist=parseFloat(d[ee++])),r.withHash&&(h.hash=d[ee++].toString()),r.withCoord&&(h.coord={long:parseFloat(d[ee][0]),lat:parseFloat(d[ee][1])}),h});super([...i,...r?.withCoord?["WITHCOORD"]:[],...r?.withDist?["WITHDIST"]:[],...r?.withHash?["WITHHASH"]:[]],{...a,deserialize:p})}};var L=class extends e{constructor([n,t,o,m,r,a],i){let p=["GEOSEARCHSTORE",n,t];(o.type==="FROMMEMBER"||o.type==="frommember")&&p.push(o.type,o.member),(o.type==="FROMLONLAT"||o.type==="fromlonlat")&&p.push(o.type,o.coordinate.lon,o.coordinate.lat),(m.type==="BYRADIUS"||m.type==="byradius")&&p.push(m.type,m.radius,m.radiusType),(m.type==="BYBOX"||m.type==="bybox")&&p.push(m.type,m.rect.width,m.rect.height,m.rectType),p.push(r),a?.count&&p.push(a.count.limit,...a.count.any?["ANY"]:[]),super([...p,...a?.storeDist?["STOREDIST"]:[]],i)}};var N=class extends e{constructor(n,t){super(["get",...n],t)}};var K=class extends e{constructor(n,t){super(["getbit",...n],t)}};var Z=class extends e{constructor(n,t){super(["getdel",...n],t)}};var G=class extends e{constructor(n,t){super(["getrange",...n],t)}};var U=class extends e{constructor(n,t){super(["getset",...n],t)}};var B=class extends e{constructor(n,t){super(["hdel",...n],t)}};var H=class extends e{constructor(n,t){super(["hexists",...n],t)}};var F=class extends e{constructor(n,t){super(["hget",...n],t)}};function xe(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var $=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>xe(o),...t})}};var q=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var j=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var X=class extends e{constructor([n],t){super(["hkeys",n],t)}};var W=class extends e{constructor(n,t){super(["hlen",...n],t)}};function fe(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var _=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>fe(t,m),...o})}};var Y=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function ye(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var V=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>ye(m):t?.deserialize,...t})}};var Q=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var nn=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var tn=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var en=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var on=class extends e{constructor(n,t){super(["hvals",...n],t)}};var sn=class extends e{constructor(n,t){super(["incr",...n],t)}};var mn=class extends e{constructor(n,t){super(["incrby",...n],t)}};var rn=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var dn=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var cn=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var un=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var hn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var ln=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var yn=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var wn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var Dn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var kn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var An=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var Sn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Rn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var vn=class extends e{constructor(n,t){super(["keys",...n],t)}};var Mn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var En=class extends e{constructor(n,t){super(["linsert",...n],t)}};var zn=class extends e{constructor(n,t){super(["llen",...n],t)}};var In=class extends e{constructor(n,t){super(["lmove",...n],t)}};var Pn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Jn=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var Ln=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Nn=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Kn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Zn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Gn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Un=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Bn=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Hn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Fn=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var $n=class extends e{constructor(n,t){super(["persist",...n],t)}};var qn=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var jn=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var Xn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Wn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var _n=class extends e{constructor(n,t){super(["pttl",...n],t)}};var Yn=class extends e{constructor(n,t){super(["publish",...n],t)}};var Vn=class extends e{constructor(n){super(["randomkey"],n)}};var Qn=class extends e{constructor(n,t){super(["rename",...n],t)}};var nt=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var tt=class extends e{constructor(n,t){super(["rpop",...n],t)}};var et=class extends e{constructor(n,t){super(["rpush",...n],t)}};var ot=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var st=class extends e{constructor(n,t){super(["sadd",...n],t)}};var mt=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var rt=class extends e{constructor(n,t){super(["scard",...n],t)}};var at=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var it=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var pt=class extends e{constructor(n,t){super(["script","load",...n],t)}};var dt=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var ct=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var ut=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var ht=class extends e{constructor(n,t){super(["setbit",...n],t)}};var lt=class extends e{constructor(n,t){super(["setex",...n],t)}};var Ct=class extends e{constructor(n,t){super(["setnx",...n],t)}};var gt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var xt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ft=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var yt=class extends e{constructor(n,t){super(["sismember",...n],t)}};var bt=class extends e{constructor(n,t){super(["smembers",...n],t)}};var Ot=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Tt=class extends e{constructor(n,t){super(["smove",...n],t)}};var wt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var Dt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var kt=class extends e{constructor(n,t){super(["srem",...n],t)}};var At=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var St=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Rt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var vt=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var Mt=class extends e{constructor(n){super(["time"],n)}};var Et=class extends e{constructor(n,t){super(["touch",...n],t)}};var zt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var It=class extends e{constructor(n,t){super(["type",...n],t)}};var Pt=class extends e{constructor(n,t){super(["unlink",...n],t)}};var se=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,p]of Object.entries(o))a.push(i,p);super(a,r)}};function be(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var me=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>be(i),...r})}};var u=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Jt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var Lt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Nt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Kt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Zt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Gt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Ut=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Bt=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Ht=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Ft=class extends e{constructor(n,t){super(["zrem",...n],t)}};var $t=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var qt=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var jt=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var Xt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Wt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var _t=class extends e{constructor(n,t){super(["zscore",...n],t)}};var Yt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var Vt=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Qt=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var ne=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var te=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new c(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new l(n,this.commandOptions));bitcount=(...n)=>this.chain(new C(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new g([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new x(n,this.commandOptions));copy=(...n)=>this.chain(new f(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new Qt(n,this.commandOptions));dbsize=()=>this.chain(new y(this.commandOptions));decr=(...n)=>this.chain(new b(n,this.commandOptions));decrby=(...n)=>this.chain(new O(n,this.commandOptions));del=(...n)=>this.chain(new T(n,this.commandOptions));echo=(...n)=>this.chain(new w(n,this.commandOptions));eval=(...n)=>this.chain(new D(n,this.commandOptions));evalsha=(...n)=>this.chain(new k(n,this.commandOptions));exists=(...n)=>this.chain(new A(n,this.commandOptions));expire=(...n)=>this.chain(new S(n,this.commandOptions));expireat=(...n)=>this.chain(new R(n,this.commandOptions));flushall=n=>this.chain(new v(n,this.commandOptions));flushdb=(...n)=>this.chain(new M(n,this.commandOptions));get=(...n)=>this.chain(new N(n,this.commandOptions));getbit=(...n)=>this.chain(new K(n,this.commandOptions));getdel=(...n)=>this.chain(new Z(n,this.commandOptions));getrange=(...n)=>this.chain(new G(n,this.commandOptions));getset=(n,t)=>this.chain(new U([n,t],this.commandOptions));hdel=(...n)=>this.chain(new B(n,this.commandOptions));hexists=(...n)=>this.chain(new H(n,this.commandOptions));hget=(...n)=>this.chain(new F(n,this.commandOptions));hgetall=(...n)=>this.chain(new $(n,this.commandOptions));hincrby=(...n)=>this.chain(new q(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new j(n,this.commandOptions));hkeys=(...n)=>this.chain(new X(n,this.commandOptions));hlen=(...n)=>this.chain(new W(n,this.commandOptions));hmget=(...n)=>this.chain(new _(n,this.commandOptions));hmset=(n,t)=>this.chain(new Y([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new V([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new Q(n,this.commandOptions));hset=(n,t)=>this.chain(new nn([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new tn([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new en(n,this.commandOptions));hvals=(...n)=>this.chain(new on(n,this.commandOptions));incr=(...n)=>this.chain(new sn(n,this.commandOptions));incrby=(...n)=>this.chain(new mn(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new rn(n,this.commandOptions));keys=(...n)=>this.chain(new vn(n,this.commandOptions));lindex=(...n)=>this.chain(new Mn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new En([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new zn(n,this.commandOptions));lmove=(...n)=>this.chain(new In(n,this.commandOptions));lpop=(...n)=>this.chain(new Pn(n,this.commandOptions));lpos=(...n)=>this.chain(new Jn(n,this.commandOptions));lpush=(n,...t)=>this.chain(new Ln([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new Nn([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new Kn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Zn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new Gn([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Un(n,this.commandOptions));mget=(...n)=>this.chain(new Bn(n,this.commandOptions));mset=n=>this.chain(new Hn([n],this.commandOptions));msetnx=n=>this.chain(new Fn([n],this.commandOptions));persist=(...n)=>this.chain(new $n(n,this.commandOptions));pexpire=(...n)=>this.chain(new qn(n,this.commandOptions));pexpireat=(...n)=>this.chain(new jn(n,this.commandOptions));ping=n=>this.chain(new Xn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new Wn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new _n(n,this.commandOptions));publish=(...n)=>this.chain(new Yn(n,this.commandOptions));randomkey=()=>this.chain(new Vn(this.commandOptions));rename=(...n)=>this.chain(new Qn(n,this.commandOptions));renamenx=(...n)=>this.chain(new nt(n,this.commandOptions));rpop=(...n)=>this.chain(new tt(n,this.commandOptions));rpush=(n,...t)=>this.chain(new et([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new ot([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new st([n,...t],this.commandOptions));scan=(...n)=>this.chain(new mt(n,this.commandOptions));scard=(...n)=>this.chain(new rt(n,this.commandOptions));scriptExists=(...n)=>this.chain(new at(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new it(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new pt(n,this.commandOptions));sdiff=(...n)=>this.chain(new dt(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new ct(n,this.commandOptions));set=(n,t,o)=>this.chain(new ut([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new ht(n,this.commandOptions));setex=(n,t,o)=>this.chain(new lt([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new Ct([n,t],this.commandOptions));setrange=(...n)=>this.chain(new gt(n,this.commandOptions));sinter=(...n)=>this.chain(new xt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ft(n,this.commandOptions));sismember=(n,t)=>this.chain(new yt([n,t],this.commandOptions));smembers=(...n)=>this.chain(new bt(n,this.commandOptions));smismember=(n,t)=>this.chain(new Ot([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Tt([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new wt(n,this.commandOptions));srandmember=(...n)=>this.chain(new Dt(n,this.commandOptions));srem=(n,...t)=>this.chain(new kt([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new At(n,this.commandOptions));strlen=(...n)=>this.chain(new St(n,this.commandOptions));sunion=(...n)=>this.chain(new Rt(n,this.commandOptions));sunionstore=(...n)=>this.chain(new vt(n,this.commandOptions));time=()=>this.chain(new Mt(this.commandOptions));touch=(...n)=>this.chain(new Et(n,this.commandOptions));ttl=(...n)=>this.chain(new zt(n,this.commandOptions));type=(...n)=>this.chain(new It(n,this.commandOptions));unlink=(...n)=>this.chain(new Pt(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new u([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Jt(n,this.commandOptions));zcount=(...n)=>this.chain(new Lt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Nt([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new Kt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Zt(n,this.commandOptions));zmscore=(...n)=>this.chain(new ne(n,this.commandOptions));zpopmax=(...n)=>this.chain(new Gt(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Ut(n,this.commandOptions));zrange=(...n)=>this.chain(new Bt(n,this.commandOptions));zrank=(n,t)=>this.chain(new Ht([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new Ft([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new $t(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new qt(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new jt(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new Xt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new Wt(n,this.commandOptions));zscore=(n,t)=>this.chain(new _t([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new Vt(n,this.commandOptions));zunion=(...n)=>this.chain(new Yt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new an(n,this.commandOptions)),arrindex:(...n)=>this.chain(new pn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new dn(n,this.commandOptions)),arrlen:(...n)=>this.chain(new cn(n,this.commandOptions)),arrpop:(...n)=>this.chain(new un(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new hn(n,this.commandOptions)),clear:(...n)=>this.chain(new ln(n,this.commandOptions)),del:(...n)=>this.chain(new Cn(n,this.commandOptions)),forget:(...n)=>this.chain(new gn(n,this.commandOptions)),geoadd:(...n)=>this.chain(new E(n,this.commandOptions)),geodist:(...n)=>this.chain(new z(n,this.commandOptions)),geopos:(...n)=>this.chain(new I(n,this.commandOptions)),geohash:(...n)=>this.chain(new P(n,this.commandOptions)),geosearch:(...n)=>this.chain(new J(n,this.commandOptions)),geosearchstore:(...n)=>this.chain(new L(n,this.commandOptions)),get:(...n)=>this.chain(new xn(n,this.commandOptions)),mget:(...n)=>this.chain(new fn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new yn(n,this.commandOptions)),nummultby:(...n)=>this.chain(new bn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new On(n,this.commandOptions)),objlen:(...n)=>this.chain(new Tn(n,this.commandOptions)),resp:(...n)=>this.chain(new wn(n,this.commandOptions)),set:(...n)=>this.chain(new Dn(n,this.commandOptions)),strappend:(...n)=>this.chain(new kn(n,this.commandOptions)),strlen:(...n)=>this.chain(new An(n,this.commandOptions)),toggle:(...n)=>this.chain(new Sn(n,this.commandOptions)),type:(...n)=>this.chain(new Rn(n,this.commandOptions))}}};import Oe from"crypto-js/enc-hex";import Te from"crypto-js/sha1";var re=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return Oe.stringify(Te(n))}};var ae=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new an(n,this.opts).exec(this.client),arrindex:(...n)=>new pn(n,this.opts).exec(this.client),arrinsert:(...n)=>new dn(n,this.opts).exec(this.client),arrlen:(...n)=>new cn(n,this.opts).exec(this.client),arrpop:(...n)=>new un(n,this.opts).exec(this.client),arrtrim:(...n)=>new hn(n,this.opts).exec(this.client),clear:(...n)=>new ln(n,this.opts).exec(this.client),del:(...n)=>new Cn(n,this.opts).exec(this.client),forget:(...n)=>new gn(n,this.opts).exec(this.client),geoadd:(...n)=>new E(n,this.opts).exec(this.client),geopos:(...n)=>new I(n,this.opts).exec(this.client),geodist:(...n)=>new z(n,this.opts).exec(this.client),geohash:(...n)=>new P(n,this.opts).exec(this.client),geosearch:(...n)=>new J(n,this.opts).exec(this.client),geosearchstore:(...n)=>new L(n,this.opts).exec(this.client),get:(...n)=>new xn(n,this.opts).exec(this.client),mget:(...n)=>new fn(n,this.opts).exec(this.client),numincrby:(...n)=>new yn(n,this.opts).exec(this.client),nummultby:(...n)=>new bn(n,this.opts).exec(this.client),objkeys:(...n)=>new On(n,this.opts).exec(this.client),objlen:(...n)=>new Tn(n,this.opts).exec(this.client),resp:(...n)=>new wn(n,this.opts).exec(this.client),set:(...n)=>new Dn(n,this.opts).exec(this.client),strappend:(...n)=>new kn(n,this.opts).exec(this.client),strlen:(...n)=>new An(n,this.opts).exec(this.client),toggle:(...n)=>new Sn(n,this.opts).exec(this.client),type:(...n)=>new Rn(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new re(this,n)}pipeline=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new te({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new l(n,this.opts).exec(this.client);bitcount=(...n)=>new C(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new g([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new x(n,this.opts).exec(this.client);copy=(...n)=>new f(n,this.opts).exec(this.client);dbsize=()=>new y(this.opts).exec(this.client);decr=(...n)=>new b(n,this.opts).exec(this.client);decrby=(...n)=>new O(n,this.opts).exec(this.client);del=(...n)=>new T(n,this.opts).exec(this.client);echo=(...n)=>new w(n,this.opts).exec(this.client);eval=(...n)=>new D(n,this.opts).exec(this.client);evalsha=(...n)=>new k(n,this.opts).exec(this.client);exists=(...n)=>new A(n,this.opts).exec(this.client);expire=(...n)=>new S(n,this.opts).exec(this.client);expireat=(...n)=>new R(n,this.opts).exec(this.client);flushall=n=>new v(n,this.opts).exec(this.client);flushdb=(...n)=>new M(n,this.opts).exec(this.client);get=(...n)=>new N(n,this.opts).exec(this.client);getbit=(...n)=>new K(n,this.opts).exec(this.client);getdel=(...n)=>new Z(n,this.opts).exec(this.client);getrange=(...n)=>new G(n,this.opts).exec(this.client);getset=(n,t)=>new U([n,t],this.opts).exec(this.client);hdel=(...n)=>new B(n,this.opts).exec(this.client);hexists=(...n)=>new H(n,this.opts).exec(this.client);hget=(...n)=>new F(n,this.opts).exec(this.client);hgetall=(...n)=>new $(n,this.opts).exec(this.client);hincrby=(...n)=>new q(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new j(n,this.opts).exec(this.client);hkeys=(...n)=>new X(n,this.opts).exec(this.client);hlen=(...n)=>new W(n,this.opts).exec(this.client);hmget=(...n)=>new _(n,this.opts).exec(this.client);hmset=(n,t)=>new Y([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new V([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new Q(n,this.opts).exec(this.client);hset=(n,t)=>new nn([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new tn([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new en(n,this.opts).exec(this.client);hvals=(...n)=>new on(n,this.opts).exec(this.client);incr=(...n)=>new sn(n,this.opts).exec(this.client);incrby=(...n)=>new mn(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new rn(n,this.opts).exec(this.client);keys=(...n)=>new vn(n,this.opts).exec(this.client);lindex=(...n)=>new Mn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new En([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new zn(n,this.opts).exec(this.client);lmove=(...n)=>new In(n,this.opts).exec(this.client);lpop=(...n)=>new Pn(n,this.opts).exec(this.client);lpos=(...n)=>new Jn(n,this.opts).exec(this.client);lpush=(n,...t)=>new Ln([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new Nn([n,...t],this.opts).exec(this.client);lrange=(...n)=>new Kn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Zn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new Gn([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Un(n,this.opts).exec(this.client);mget=(...n)=>new Bn(n,this.opts).exec(this.client);mset=n=>new Hn([n],this.opts).exec(this.client);msetnx=n=>new Fn([n],this.opts).exec(this.client);persist=(...n)=>new $n(n,this.opts).exec(this.client);pexpire=(...n)=>new qn(n,this.opts).exec(this.client);pexpireat=(...n)=>new jn(n,this.opts).exec(this.client);ping=n=>new Xn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new Wn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new _n(n,this.opts).exec(this.client);publish=(...n)=>new Yn(n,this.opts).exec(this.client);randomkey=()=>new Vn().exec(this.client);rename=(...n)=>new Qn(n,this.opts).exec(this.client);renamenx=(...n)=>new nt(n,this.opts).exec(this.client);rpop=(...n)=>new tt(n,this.opts).exec(this.client);rpush=(n,...t)=>new et([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new ot([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new st([n,...t],this.opts).exec(this.client);scan=(...n)=>new mt(n,this.opts).exec(this.client);scard=(...n)=>new rt(n,this.opts).exec(this.client);scriptExists=(...n)=>new at(n,this.opts).exec(this.client);scriptFlush=(...n)=>new it(n,this.opts).exec(this.client);scriptLoad=(...n)=>new pt(n,this.opts).exec(this.client);sdiff=(...n)=>new dt(n,this.opts).exec(this.client);sdiffstore=(...n)=>new ct(n,this.opts).exec(this.client);set=(n,t,o)=>new ut([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new ht(n,this.opts).exec(this.client);setex=(n,t,o)=>new lt([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new Ct([n,t],this.opts).exec(this.client);setrange=(...n)=>new gt(n,this.opts).exec(this.client);sinter=(...n)=>new xt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ft(n,this.opts).exec(this.client);sismember=(n,t)=>new yt([n,t],this.opts).exec(this.client);smismember=(n,t)=>new Ot([n,t],this.opts).exec(this.client);smembers=(...n)=>new bt(n,this.opts).exec(this.client);smove=(n,t,o)=>new Tt([n,t,o],this.opts).exec(this.client);spop=(...n)=>new wt(n,this.opts).exec(this.client);srandmember=(...n)=>new Dt(n,this.opts).exec(this.client);srem=(n,...t)=>new kt([n,...t],this.opts).exec(this.client);sscan=(...n)=>new At(n,this.opts).exec(this.client);strlen=(...n)=>new St(n,this.opts).exec(this.client);sunion=(...n)=>new Rt(n,this.opts).exec(this.client);sunionstore=(...n)=>new vt(n,this.opts).exec(this.client);time=()=>new Mt().exec(this.client);touch=(...n)=>new Et(n,this.opts).exec(this.client);ttl=(...n)=>new zt(n,this.opts).exec(this.client);type=(...n)=>new It(n,this.opts).exec(this.client);unlink=(...n)=>new Pt(n,this.opts).exec(this.client);xadd=(...n)=>new se(n,this.opts).exec(this.client);xrange=(...n)=>new me(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new u([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Jt(n,this.opts).exec(this.client);zcount=(...n)=>new Lt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new Qt(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Nt([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new Kt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Zt(n,this.opts).exec(this.client);zmscore=(...n)=>new ne(n,this.opts).exec(this.client);zpopmax=(...n)=>new Gt(n,this.opts).exec(this.client);zpopmin=(...n)=>new Ut(n,this.opts).exec(this.client);zrange=(...n)=>new Bt(n,this.opts).exec(this.client);zrank=(n,t)=>new Ht([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new Ft([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new $t(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new qt(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new jt(n,this.opts).exec(this.client);zrevrank=(n,t)=>new Xt([n,t],this.opts).exec(this.client);zscan=(...n)=>new Wt(n,this.opts).exec(this.client);zscore=(n,t)=>new _t([n,t],this.opts).exec(this.client);zunion=(...n)=>new Yt(n,this.opts).exec(this.client);zunionstore=(...n)=>new Vt(n,this.opts).exec(this.client)};var he="v1.24.2";typeof atob>"u"&&(global.atob=function(s){return Buffer.from(s,"base64").toString("utf-8")});var le=class s extends ae{constructor(n){if("request"in n){super(n);return}(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new oe({baseUrl:n.url,retry:n.retry,headers:{authorization:`Bearer ${n.token}`},agent:n.agent,responseEncoding:n.responseEncoding,cache:n.cache||"no-store"});super(t,{automaticDeserialization:n.automaticDeserialization,enableTelemetry:!process.env.UPSTASH_DISABLE_TELEMETRY}),this.addTelemetry({runtime:typeof EdgeRuntime=="string"?"edge-light":`node@${process.version}`,platform:process.env.VERCEL?"vercel":process.env.AWS_REGION?"aws":"unknown",sdk:`@upstash/redis@${he}`})}static fromEnv(n){if(typeof process?.env>"u")throw new Error('Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead');let t=process?.env.UPSTASH_REDIS_REST_URL;if(!t)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");let o=process?.env.UPSTASH_REDIS_REST_TOKEN;if(!o)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`");return new s({...n,url:t,token:o})}};export{le as Redis};
|
|
1
|
+
import{a as o,b as r,c as i}from"./chunk-KBK5EDMP.mjs";typeof atob>"u"&&(global.atob=function(n){return Buffer.from(n,"base64").toString("utf-8")});var a=class n extends r{constructor(e){if("request"in e){super(e);return}(e.url.startsWith(" ")||e.url.endsWith(" ")||/\r|\n/.test(e.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(e.token.startsWith(" ")||e.token.endsWith(" ")||/\r|\n/.test(e.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new o({baseUrl:e.url,retry:e.retry,headers:{authorization:`Bearer ${e.token}`},agent:e.agent,responseEncoding:e.responseEncoding,cache:e.cache||"no-store"});super(t,{automaticDeserialization:e.automaticDeserialization,enableTelemetry:!process.env.UPSTASH_DISABLE_TELEMETRY}),this.addTelemetry({runtime:typeof EdgeRuntime=="string"?"edge-light":`node@${process.version}`,platform:process.env.VERCEL?"vercel":process.env.AWS_REGION?"aws":"unknown",sdk:`@upstash/redis@${i}`})}static fromEnv(e){if(typeof process?.env>"u")throw new Error('Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead');let t=process?.env.UPSTASH_REDIS_REST_URL;if(!t)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");let s=process?.env.UPSTASH_REDIS_REST_TOKEN;if(!s)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`");return new n({...e,url:t,token:s})}};export{a as Redis};
|
package/package.json
CHANGED
|
@@ -1,54 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@upstash/redis",
|
|
3
|
-
"version": "1.24.2",
|
|
4
|
-
"main": "./nodejs.js",
|
|
5
|
-
"types": "./nodejs.d.ts",
|
|
6
|
-
"description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/upstash/upstash-redis.git"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"redis",
|
|
13
|
-
"database",
|
|
14
|
-
"serverless",
|
|
15
|
-
"edge",
|
|
16
|
-
"upstash"
|
|
17
|
-
],
|
|
18
|
-
"files": [
|
|
19
|
-
"./**"
|
|
20
|
-
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/",
|
|
23
|
-
"test": "bun test pkg --coverage",
|
|
24
|
-
"fmt": "bunx @biomejs/biome check --apply ./pkg"
|
|
25
|
-
},
|
|
26
|
-
"author": "Andreas Thomas <dev@chronark.com>",
|
|
27
|
-
"license": "MIT",
|
|
28
|
-
"bugs": {
|
|
29
|
-
"url": "https://github.com/upstash/upstash-redis/issues"
|
|
30
|
-
},
|
|
31
|
-
"homepage": "https://github.com/upstash/upstash-redis#readme",
|
|
32
|
-
"typesVersions": {
|
|
33
|
-
"*": {
|
|
34
|
-
"nodejs": [
|
|
35
|
-
"./nodejs.d.ts"
|
|
36
|
-
],
|
|
37
|
-
"cloudflare": [
|
|
38
|
-
"./cloudflare.d.ts"
|
|
39
|
-
],
|
|
40
|
-
"fastly": [
|
|
41
|
-
"./fastly.d.ts"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@types/crypto-js": "^4.1.3",
|
|
47
|
-
"bun-types": "^1.0.6",
|
|
48
|
-
"tsup": "^7.2.0"
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"@biomejs/biome": "^1.3.0",
|
|
52
|
-
"crypto-js": "^4.1.1"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
{ "name": "@upstash/redis", "version": "v1.24.3", "main": "./nodejs.js", "types": "./nodejs.d.ts", "description": "An HTTP/REST based Redis client built on top of Upstash REST API.", "repository": { "type": "git", "url": "git+https://github.com/upstash/upstash-redis.git" }, "keywords": [ "redis", "database", "serverless", "edge", "upstash" ], "files": [ "./**" ], "scripts": { "build": "tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/", "test": "bun test pkg --coverage", "fmt": "bunx @biomejs/biome check --apply ./pkg" }, "author": "Andreas Thomas <dev@chronark.com>", "license": "MIT", "bugs": { "url": "https://github.com/upstash/upstash-redis/issues" }, "homepage": "https://github.com/upstash/upstash-redis#readme", "typesVersions": { "*": { "nodejs": [ "./nodejs.d.ts" ], "cloudflare": [ "./cloudflare.d.ts" ], "fastly": [ "./fastly.d.ts" ] } }, "devDependencies": { "@types/crypto-js": "^4.1.3", "bun-types": "^1.0.6", "tsup": "^7.2.0", "@biomejs/biome": "^1.3.0" }, "dependencies": { "crypto-js": "^4.2.0" } }
|