@nightx.co/pulsar 1.0.15 → 1.0.17
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/LICENSE +207 -0
- package/README.md +83 -10
- package/dist/chunk-cpn1qh4e.js.map +2 -2
- package/dist/helpers/computeConfigDelta.d.ts.map +1 -1
- package/dist/helpers/generateShaHash.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +8 -8
- package/dist/network/abstract/BaseNetworkDriver.d.ts +1 -1
- package/dist/network/abstract/BaseNetworkDriver.d.ts.map +1 -1
- package/dist/network/drivers/HttpNetworkDriver.d.ts +1 -1
- package/dist/network/drivers/HttpNetworkDriver.d.ts.map +1 -1
- package/dist/network/drivers/WebSocketNetworkDriver.d.ts +1 -1
- package/dist/network/drivers/WebSocketNetworkDriver.d.ts.map +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/storage/index.js.map +4 -4
- package/dist/subsys/LoggerService.d.ts.map +1 -1
- package/dist/types/consumer.types.d.ts +36 -0
- package/dist/types/consumer.types.d.ts.map +1 -1
- package/package.json +4 -2
|
@@ -11,7 +11,7 @@ export declare abstract class BaseNetworkDriver {
|
|
|
11
11
|
constructor(config: NetworkConfig);
|
|
12
12
|
abstract start(): Promise<void>;
|
|
13
13
|
abstract stop(): Promise<void>;
|
|
14
|
-
abstract broadcast(queue: string, payload: any): Promise<void>;
|
|
14
|
+
abstract broadcast(queue: string, payload: any, optimizePayload: boolean): Promise<void>;
|
|
15
15
|
abstract onTrigger(handler: (queue: string, data: any) => void): void;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=BaseNetworkDriver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseNetworkDriver.d.ts","sourceRoot":"","sources":["../../../src/network/abstract/BaseNetworkDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,8BAAsB,iBAAiB;IASvB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,aAAa;IARrD,SAAS,CAAC,SAAS,EAAG,OAAO,CAAS;IACtC,SAAS,CAAC,MAAM,EAAG,OAAO,CAAC;IAE3B,SAAgB,SAAS,EAAG,WAAW,GAAG,MAAM,CAAC;IAEjD,sBAAsB;IACtB,SAAS,CAAC,EAAE,EAAG,mBAAmB,CAAC;gBAEJ,MAAM,EAAG,aAAa;aAKrC,KAAK,IAAK,OAAO,CAAC,IAAI,CAAC;aACvB,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;aACtB,SAAS,CAAC,KAAK,EAAG,MAAM,EAAE,OAAO,EAAG,GAAG,GAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseNetworkDriver.d.ts","sourceRoot":"","sources":["../../../src/network/abstract/BaseNetworkDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,8BAAsB,iBAAiB;IASvB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,aAAa;IARrD,SAAS,CAAC,SAAS,EAAG,OAAO,CAAS;IACtC,SAAS,CAAC,MAAM,EAAG,OAAO,CAAC;IAE3B,SAAgB,SAAS,EAAG,WAAW,GAAG,MAAM,CAAC;IAEjD,sBAAsB;IACtB,SAAS,CAAC,EAAE,EAAG,mBAAmB,CAAC;gBAEJ,MAAM,EAAG,aAAa;aAKrC,KAAK,IAAK,OAAO,CAAC,IAAI,CAAC;aACvB,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;aACtB,SAAS,CAAC,KAAK,EAAG,MAAM,EAAE,OAAO,EAAG,GAAG,EAAE,eAAe,EAAG,OAAO,GAAI,OAAO,CAAC,IAAI,CAAC;aACnF,SAAS,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,GAAI,IAAI;CAChF"}
|
|
@@ -15,7 +15,7 @@ export declare class HttpNetworkDriver extends BaseNetworkDriver {
|
|
|
15
15
|
private store;
|
|
16
16
|
constructor(networkConfig: NetworkConfig, networkInterface: NetworkInterface, storage: PulsarUnifiedStorage, queueService: QueueService);
|
|
17
17
|
start(): Promise<void>;
|
|
18
|
-
broadcast(queue: string, payload: any): Promise<void>;
|
|
18
|
+
broadcast(queue: string, payload: any, optimizePayload: boolean): Promise<void>;
|
|
19
19
|
onTrigger(handler: (queue: string, data: any) => void): void;
|
|
20
20
|
stop(): Promise<void>;
|
|
21
21
|
private handleFetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpNetworkDriver.d.ts","sourceRoot":"","sources":["../../../src/network/drivers/HttpNetworkDriver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAOlE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAe/D,qBAAa,iBAAkB,SAAQ,iBAAiB;IAWhD,QAAQ,CAAC,aAAa,EAAG,aAAa;IACtC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,YAAY;IAbxB,SAAyB,SAAS,UAAU;IAE5C,OAAO,CAAC,YAAY,CAAqC;IACzD,OAAO,CAAC,cAAc,CAAC,CAAuC;IAE9D,OAAO,CAAC,kBAAkB,CAAsB;IAChD,OAAO,CAAC,KAAK,CAAuB;gBAIvB,aAAa,EAAG,aAAa,EACrB,gBAAgB,EAAG,gBAAgB,EAC5C,OAAO,EAAG,oBAAoB,EAC9B,YAAY,EAAG,YAAY;IAoBjB,KAAK;IAEL,SAAS,CAAC,KAAK,EAAG,MAAM,EAAE,OAAO,EAAG,GAAG;
|
|
1
|
+
{"version":3,"file":"HttpNetworkDriver.d.ts","sourceRoot":"","sources":["../../../src/network/drivers/HttpNetworkDriver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAOlE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAe/D,qBAAa,iBAAkB,SAAQ,iBAAiB;IAWhD,QAAQ,CAAC,aAAa,EAAG,aAAa;IACtC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,YAAY;IAbxB,SAAyB,SAAS,UAAU;IAE5C,OAAO,CAAC,YAAY,CAAqC;IACzD,OAAO,CAAC,cAAc,CAAC,CAAuC;IAE9D,OAAO,CAAC,kBAAkB,CAAsB;IAChD,OAAO,CAAC,KAAK,CAAuB;gBAIvB,aAAa,EAAG,aAAa,EACrB,gBAAgB,EAAG,gBAAgB,EAC5C,OAAO,EAAG,oBAAoB,EAC9B,YAAY,EAAG,YAAY;IAoBjB,KAAK;IAEL,SAAS,CAAC,KAAK,EAAG,MAAM,EAAE,OAAO,EAAG,GAAG,EAAE,eAAe,EAAG,OAAO;IAqCjF,SAAS,CAAC,OAAO,EAAE,CAAC,KAAK,EAAG,MAAM,EAAE,IAAI,EAAG,GAAG,KAAK,IAAI;IAIxC,IAAI;YAEZ,WAAW;YAiDX,kBAAkB;IAuBhC,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,cAAc;YAaR,aAAa;YAWb,SAAS;YAMT,UAAU;YAMV,WAAW;YAMX,gBAAgB;CAUjC"}
|
|
@@ -11,7 +11,7 @@ export declare class WebSocketNetworkDriver extends BaseNetworkDriver {
|
|
|
11
11
|
private boundClose;
|
|
12
12
|
constructor(config: NetworkConfig, networkInterface: NetworkInterface);
|
|
13
13
|
start(): Promise<void>;
|
|
14
|
-
broadcast(queue: string, payload: any): Promise<void>;
|
|
14
|
+
broadcast(queue: string, payload: any, optimizePayload: boolean): Promise<void>;
|
|
15
15
|
onTrigger(handler: (queue: string, data: any) => void): void;
|
|
16
16
|
stop(): Promise<void>;
|
|
17
17
|
private onConnectionOpen;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocketNetworkDriver.d.ts","sourceRoot":"","sources":["../../../src/network/drivers/WebSocketNetworkDriver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,qBAAa,sBAAuB,SAAQ,iBAAiB;IAUrB,OAAO,CAAC,gBAAgB;IAT5D,SAAyB,SAAS,eAAe;IAEjD,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,cAAc,CAAC,CAAuC;IAE9D,OAAO,CAAC,SAAS,CAAgD;IACjE,OAAO,CAAC,YAAY,CAAqE;IACzF,OAAO,CAAC,UAAU,CAAiD;gBAEvD,MAAM,EAAG,aAAa,EAAU,gBAAgB,EAAG,gBAAgB;IAQzD,KAAK;IAEL,SAAS,CAAC,KAAK,EAAG,MAAM,EAAE,OAAO,EAAG,GAAG;
|
|
1
|
+
{"version":3,"file":"WebSocketNetworkDriver.d.ts","sourceRoot":"","sources":["../../../src/network/drivers/WebSocketNetworkDriver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,qBAAa,sBAAuB,SAAQ,iBAAiB;IAUrB,OAAO,CAAC,gBAAgB;IAT5D,SAAyB,SAAS,eAAe;IAEjD,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,cAAc,CAAC,CAAuC;IAE9D,OAAO,CAAC,SAAS,CAAgD;IACjE,OAAO,CAAC,YAAY,CAAqE;IACzF,OAAO,CAAC,UAAU,CAAiD;gBAEvD,MAAM,EAAG,aAAa,EAAU,gBAAgB,EAAG,gBAAgB;IAQzD,KAAK;IAEL,SAAS,CAAC,KAAK,EAAG,MAAM,EAAE,OAAO,EAAG,GAAG,EAAE,eAAe,EAAG,OAAO;IAmBjF,SAAS,CAAC,OAAO,EAAE,CAAC,KAAK,EAAG,MAAM,EAAE,IAAI,EAAG,GAAG,KAAK,IAAI;IAIxC,IAAI;IAc1B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,wBAAwB;IAqBhC,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,iBAAiB;CAa5B"}
|
package/dist/storage/index.js
CHANGED
|
@@ -400,4 +400,4 @@ end`;class R extends N{driver;protocol;constructor(Y){super();this.driver=Y;this
|
|
|
400
400
|
`);if(h=C.pop()||"",h.length>RW)throw Error("Buffer size exceeded (1MB)");for(let i of C)if(i.startsWith("data: ")){let LW=i.slice(6);Y.onMessage?.(LW)}}}catch(h){if(h instanceof Error&&h.name==="AbortError");else console.error("Stream reading error:",h)}finally{try{await M.cancel()}catch{}}})(),{result:1}}let Z,X=await T.text();try{Z=JSON.parse(X)}catch(M){throw new f(X,{cause:M})}if(this.readYourWrites){let M=T.headers;this.upstashSyncToken=M.get("upstash-sync-token")??""}if(this.options.responseEncoding==="base64"){if(Array.isArray(Z))return Z.map(({result:w,error:h})=>({result:k(w),error:h}));return{result:k(Z.result),error:Z.error}}return Z}};function a(Y){let W="";try{let $=atob(Y),Q=$.length,G=new Uint8Array(Q);for(let D=0;D<Q;D++)G[D]=$.charCodeAt(D);W=new TextDecoder().decode(G)}catch{W=Y}return W}function k(Y){let W=void 0;switch(typeof Y){case"undefined":return Y;case"number":{W=Y;break}case"object":{if(Array.isArray(Y))W=Y.map(($)=>typeof $==="string"?a($):Array.isArray($)?$.map((Q)=>k(Q)):$);else W=null;break}case"string":{W=Y==="OK"?"OK":a(Y);break}default:break}return W}function v(Y,W,$){if(!$)return Y;if(!Y[W])return Y[W]=$,Y;if(!Y[W].split(",").map((G)=>G.trim()).includes($.trim()))Y[W]=[Y[W],$].join(",");return Y}var OW=(Y)=>{switch(typeof Y){case"string":case"number":case"boolean":return Y;default:return JSON.stringify(Y)}},V=class{command;serialize;deserialize;headers;path;onMessage;isStreaming;signal;constructor(Y,W){if(this.serialize=OW,this.deserialize=W?.automaticDeserialization===void 0||W.automaticDeserialization?W?.deserialize??B:($)=>$,this.command=Y.map(($)=>this.serialize($)),this.headers=W?.headers,this.path=W?.path,this.onMessage=W?.streamOptions?.onMessage,this.isStreaming=W?.streamOptions?.isStreaming??!1,this.signal=W?.streamOptions?.signal,W?.latencyLogging){let $=this.exec.bind(this);this.exec=async(Q)=>{let G=performance.now(),D=await $(Q),T=(performance.now()-G).toFixed(2);return console.log(`Latency for \x1B[38;2;19;185;39m${this.command[0].toString().toUpperCase()}\x1B[0m: \x1B[38;2;0;255;255m${T} ms\x1B[0m`),D}}}async exec(Y){let{result:W,error:$}=await Y.request({body:this.command,path:this.path,upstashSyncToken:Y.upstashSyncToken,headers:this.headers,onMessage:this.onMessage,isStreaming:this.isStreaming,signal:this.signal});if($)throw new J($);if(W===void 0)throw TypeError("Request did not return a result");return this.deserialize(W)}},E=class extends V{constructor(Y,W){let $=Y.map((Q)=>typeof Q==="string"?Q:String(Q));super($,W)}},vW=["TEXT","U64","I64","F64","BOOL","DATE","KEYWORD","FACET","HYBRID"];function T1(Y){return typeof Y==="string"&&vW.includes(Y)}function H1(Y){return typeof Y==="object"&&Y!==null&&"type"in Y&&T1(Y.type)}function fW(Y){return typeof Y==="object"&&Y!==null&&!H1(Y)}function Z1(Y,W=[]){let $=[];for(let[Q,G]of Object.entries(Y)){let D=[...W,Q],z=D.join(".");if(T1(G))$.push({path:z,type:G});else if(H1(G))$.push({path:z,type:G.type,fast:"fast"in G?G.fast:void 0,noTokenize:"noTokenize"in G?G.noTokenize:void 0,noStem:"noStem"in G?G.noStem:void 0,from:"from"in G?G.from:void 0});else if(fW(G)){let T=Z1(G,D);$.push(...T)}}return $}function kW(Y){return Y.map((W)=>{let $=W,Q=$[0],G=Number($[1]),D=$[2];if(D===void 0)return{key:Q,score:G};if(!Array.isArray(D)||D.length===0)return{key:Q,score:G,data:{}};let z={};for(let T of D){let H=T[0],Z=T[1],X=H.split(".");if(X.length===1)z[H]=Z;else{let M=z;for(let w=0;w<X.length-1;w++){let h=X[w];if(!(h in M))M[h]={};M=M[h]}M[X.at(-1)]=Z}}if("$"in z)z=z.$;return{key:Q,score:G,data:z}})}function lW(Y){let W={};for(let $=0;$<Y.length;$+=2)switch(Y[$]){case"name":{W.name=Y[$+1];break}case"type":{W.dataType=Y[$+1].toLowerCase();break}case"prefixes":{W.prefixes=Y[$+1];break}case"language":{W.language=Y[$+1];break}case"schema":{let G={};for(let D of Y[$+1]){let z=D[0],T={type:D[1]};if(D.length>2)for(let H=2;H<D.length;H++)switch(D[H]){case"NOSTEM":{T.noStem=!0;break}case"NOTOKENIZE":{T.noTokenize=!0;break}case"FAST":{T.fast=!0;break}case"FROM":{T.from=D[++H];break}}G[z]=T}W.schema=G;break}}return W}function yW(Y){return typeof Y==="number"?Y:Number.parseInt(Y,10)}function uW(Y){return X1(Y)}function X1(Y){let W={};for(let $=0;$<Y.length;$+=2){let Q=Y[$],G=Y[$+1];if(Array.isArray(G))if(G.length>0&&typeof G[0]==="string")W[Q]=G[0]==="buckets"?iW(G):j(G);else W[Q]=X1(G);else W[Q]=G}return W}function CW(Y){if(typeof Y==="string"&&Y!==""&&!Number.isNaN(Number(Y)))return Number(Y);return Y}function j(Y){let W={};for(let $=0;$<Y.length;$+=2){let Q=Y[$],G=Y[$+1];if(Array.isArray(G)&&G.length>0)if(typeof G[0]==="string")W[Q]=j(G);else if(Array.isArray(G[0])&&typeof G[0][0]==="string")W[Q]=G.map((D)=>j(D));else W[Q]=G;else W[Q]=CW(G)}return W}function iW(Y){if(Y[0]==="buckets"&&Array.isArray(Y[1])){let W={buckets:Y[1].map(($)=>{let Q={};for(let G=0;G<$.length;G+=2){let D=$[G],z=$[G+1];Q[D]=Array.isArray(z)&&z.length>0&&typeof z[0]==="string"?j(z):z}return Q})};for(let $=2;$<Y.length;$+=2)W[Y[$]]=Y[$+1];return W}return Y}function m(Y,W,$){let Q=JSON.stringify($?.filter??{}),G=[Y,W,Q];if($?.limit!==void 0)G.push("LIMIT",$.limit.toString());if($?.offset!==void 0)G.push("OFFSET",$.offset.toString());if($?.select&&Object.keys($.select).length===0)G.push("NOCONTENT");if($){if("orderBy"in $&&$.orderBy){G.push("ORDERBY");for(let[D,z]of Object.entries($.orderBy))G.push(D,z)}else if("scoreFunc"in $&&$.scoreFunc)G.push("SCOREFUNC",...gW($.scoreFunc))}if($?.highlight){if(G.push("HIGHLIGHT","FIELDS",$.highlight.fields.length.toString(),...$.highlight.fields),$.highlight.preTag&&$.highlight.postTag)G.push("TAGS",$.highlight.preTag,$.highlight.postTag)}if($?.select&&Object.keys($.select).length>0)G.push("SELECT",Object.keys($.select).length.toString(),...Object.keys($.select));return G}function gW(Y){let W=[];if(typeof Y==="string")W.push("FIELDVALUE",Y);else if("fields"in Y){if(Y.combineMode)W.push("COMBINEMODE",Y.combineMode.toUpperCase());if(Y.scoreMode)W.push("SCOREMODE",Y.scoreMode.toUpperCase());for(let $ of Y.fields)W.push(...s($))}else W.push(...s(Y));return W}function s(Y){let W=[];if(typeof Y==="string")W.push("FIELDVALUE",Y);else{if(Y.scoreMode)W.push("SCOREMODE",Y.scoreMode.toUpperCase());if(W.push("FIELDVALUE",Y.field),Y.modifier)W.push("MODIFIER",Y.modifier.toUpperCase());if(Y.factor!==void 0)W.push("FACTOR",Y.factor.toString());if(Y.missing!==void 0)W.push("MISSING",Y.missing.toString())}return W}function cW(Y){let{name:W,schema:$,dataType:Q,language:G,skipInitialScan:D,existsOk:z}=Y,T;if(Y.dataType==="stream")T=["ON","STREAM",Y.stream];else{let X=Array.isArray(Y.prefix)?Y.prefix:[Y.prefix];T=["ON",Q.toUpperCase(),"PREFIX",X.length.toString(),...X]}let H=[W,...D?["SKIPINITIALSCAN"]:[],...z?["EXISTSOK"]:[],...T,...G?["LANGUAGE",G]:[],"SCHEMA"],Z=Z1($);for(let X of Z){if(H.push(X.path,X.type),X.fast)H.push("FAST");if(X.noTokenize)H.push("NOTOKENIZE");if(X.noStem)H.push("NOSTEM");if(X.from)H.push("FROM",X.from)}return["SEARCH.CREATE",...H]}function pW(Y,W){let $=JSON.stringify(W?.filter??{}),Q=JSON.stringify(W.aggregations);return["SEARCH.AGGREGATE",Y,$,Q]}var M1=class{name;schema;client;constructor({name:Y,schema:W,client:$}){this.name=Y,this.schema=W,this.client=$}async waitIndexing(){let Y=["SEARCH.WAITINDEXING",this.name];return await new E(Y).exec(this.client)}async describe(){let Y=["SEARCH.DESCRIBE",this.name],W=await new E(Y).exec(this.client);if(!W)return null;return lW(W)}async query(Y){let W=m("SEARCH.QUERY",this.name,Y),$=await new E(W).exec(this.client);if(!$)return $;return kW($)}async aggregate(Y){let W=pW(this.name,Y),$=await new E(W).exec(this.client);return uW($)}async count({filter:Y}){let W=m("SEARCH.COUNT",this.name,{filter:Y}),$=await new E(W).exec(this.client);return{count:yW($)}}async drop(){let Y=["SEARCH.DROP",this.name];return await new E(Y).exec(this.client)}async addAlias({alias:Y}){let W=["SEARCH.ALIASADD",Y,this.name];return await new E(W).exec(this.client)}};async function nW(Y,W){let{name:$,schema:Q}=W,G=cW(W);return await new E(G).exec(Y),h1(Y,{name:$,schema:Q})}function h1(Y,W){let{name:$,schema:Q}=W;return new M1({name:$,schema:Q,client:Y})}async function tW(Y){let $=await new E(["SEARCH.LISTALIASES"]).exec(Y);if($===0||Array.isArray($)&&$.length===0)return{};if(!Array.isArray($))return{};let Q={};for(let G of $)if(Array.isArray(G)&&G.length===2){let[D,z]=G;Q[D]=z}return Q}async function dW(Y,{indexName:W,alias:$}){return await new E(["SEARCH.ALIASADD",$,W]).exec(Y)}async function rW(Y,{alias:W}){return await new E(["SEARCH.ALIASDEL",W]).exec(Y)}function eW(Y){let W=new Uint8Array(Y.length*4),$=new DataView(W.buffer);for(let[D,z]of Y.entries())$.setFloat32(D*4,z,!0);let Q="",G=32768;for(let D=0;D<W.length;D+=G)Q+=String.fromCodePoint(...W.subarray(D,D+G));return btoa(Q)}function w1(Y){if(Array.isArray(Y))return["VALUES",Y.length,...Y];if(Y instanceof Float32Array)return["BASE64-FP32",eW(Y)];return["BASE64-FP32",Y.base64]}function oW(Y){if(Y===null)return null;return Y.map(Number)}function aW(Y){return Y.map(([W,$])=>({id:String(W),score:Number($)}))}function mW(Y){if(Y===null)return null;let W=Array.isArray(Y)?Object.fromEntries(Array.from({length:Math.floor(Y.length/2)},($,Q)=>[String(Y[Q*2]),Y[Q*2+1]])):Y;return{dimension:Number(W.dimension),metric:String(W.metric).toUpperCase()}}var sW=class extends V{constructor([Y,W,$],Q){super(["VECTOR.ADD",Y,W,...w1($)],Q)}},Y$=class extends V{constructor([Y],W){super(["VECTOR.COUNT",Y],W)}},W$=class extends V{constructor([Y,W],$){let Q=["VECTOR.CREATE",Y,"DIM",W.dimension,"METRIC",W.metric];if(W.existsOk)Q.push("EXISTSOK");super(Q,$)}},$$=class extends V{constructor([Y,W],$){super(["VECTOR.DEL",Y,W],$)}},Q$=class extends V{constructor([Y],W){super(["VECTOR.DROP",Y],W)}},G$=class extends V{constructor([Y,W],$){super(["VECTOR.GET",Y,W],{deserialize:oW,...$})}},V$=class extends V{constructor([Y],W){super(["VECTOR.INFO",Y],{deserialize:mW,...W})}},D$=class extends V{constructor([Y,W],$){let Q=["VECTOR.QUERY",Y,"TOPK",W.topK];if(W.profile)Q.push("PROFILE",W.profile);Q.push(...w1(W.vector));super(Q,{deserialize:aW,...$})}},y=class{name;client;commandOptions;constructor({name:Y,client:W,commandOptions:$}){this.name=Y,this.client=W,this.commandOptions=$}add(Y,W){return new sW([this.name,Y,W],this.commandOptions).exec(this.client)}get(Y){return new G$([this.name,Y],this.commandOptions).exec(this.client)}query(Y){return new D$([this.name,Y],this.commandOptions).exec(this.client)}delete(Y){return new $$([this.name,Y],this.commandOptions).exec(this.client)}count(){return new Y$([this.name],this.commandOptions).exec(this.client)}info(){return new V$([this.name],this.commandOptions).exec(this.client)}drop(){return new Q$([this.name],this.commandOptions).exec(this.client)}};async function z$(Y,{name:W,...$},Q){return await new W$([W,$],Q).exec(Y),new y({name:W,client:Y,commandOptions:Q})}function T$(Y,W,$){return new y({name:W,client:Y,commandOptions:$})}function H$(Y){if(Y.length===0)return null;let W={};for(let $=0;$<Y.length;$+=2){let Q=Y[$],G=Y[$+1];try{W[Q]=K(G)}catch{W[Q]=G}}return W}var E1=class extends V{constructor(Y,W){let $=["hrandfield",Y[0]];if(typeof Y[1]==="number")$.push(Y[1]);if(Y[2])$.push("WITHVALUES");super($,{deserialize:Y[2]?(Q)=>H$(Q):W?.deserialize,...W})}},L1=class extends V{constructor(Y,W){super(["append",...Y],W)}},U1=class extends V{constructor(Y,W){super(["ARCOUNT",...Y],W)}},K1=class extends V{constructor(Y,W){super(["ARDEL",...Y],W)}},J1=class extends V{constructor([Y,...W],$){super(["ARDELRANGE",Y,...W.flat()],$)}},N1=class extends V{constructor(Y,W){super(["ARGET",...Y],W)}},P1=class extends V{constructor(Y,W){super(["ARGETRANGE",...Y],W)}},F1=class extends V{constructor([Y,W,$,Q],G){let D=["ARGREP",Y,W,$];for(let z of Q.predicates)if("exact"in z)D.push("EXACT",z.exact);else if("match"in z)D.push("MATCH",z.match);else if("glob"in z)D.push("GLOB",z.glob);else D.push("RE",z.re);if(Q.combine)D.push(Q.combine.toUpperCase());if(Q.noCase)D.push("NOCASE");if(Q.withValues)D.push("WITHVALUES");if(Q.limit!==void 0)D.push("LIMIT",Q.limit);super(D,{deserialize:(z)=>B(z).map((T)=>Array.isArray(T)?[String(T[0]),T[1]]:String(T)),...G})}};function Z$(Y){return Y.replaceAll(/-([a-z])/g,(W,$)=>$.toUpperCase())}function X$(Y){let W=Array.isArray(Y)?Array.from({length:Math.floor(Y.length/2)},(G,D)=>[Y[D*2],Y[D*2+1]]):Object.entries(Y),$=new Set(["len","nextInsertIndex"]),Q={};for(let[G,D]of W){let z=Z$(String(G));if($.has(z)){Q[z]=String(D);continue}let T=typeof D==="number"?D:Number(D);Q[z]=Number.isNaN(T)?D:T}return Q}var _1=class extends V{constructor([Y,W],$){let Q=["ARINFO",Y];if(W?.full)Q.push("FULL");super(Q,{deserialize:X$,...$})}},j1=class extends V{constructor(Y,W){super(["ARINSERT",...Y],{deserialize:String,...W})}},A1=class extends V{constructor([Y,W,$],Q){let G=["ARLASTITEMS",Y,W];if($?.rev)G.push("REV");super(G,Q)}},B1=class extends V{constructor(Y,W){super(["ARLEN",...Y],{deserialize:String,...W})}},I1=class extends V{constructor(Y,W){super(["ARMGET",...Y],W)}},S1=class extends V{constructor([Y,W],$){let Q=Array.isArray(W)?W:Object.entries(W);super(["ARMSET",Y,...Q.flatMap(([G,D])=>[G,D])],$)}},q1=class extends V{constructor(Y,W){super(["ARNEXT",...Y],{deserialize:($)=>$===null?null:String($),...W})}},b1=class extends V{constructor([Y,W,$,Q],G){let D=["AROP",Y,W,$];if(typeof Q==="string")D.push(Q.toUpperCase());else D.push("MATCH",Q.match);super(D,{deserialize:(z)=>z===null?null:Number(z),...G})}},x1=class extends V{constructor(Y,W){super(["ARRING",...Y],{deserialize:String,...W})}},R1=class extends V{constructor([Y,W,$,Q],G){let D=["ARSCAN",Y,W,$];if(Q?.limit!==void 0)D.push("LIMIT",Q.limit);super(D,{deserialize:(z)=>B(z).map(([T,H])=>[String(T),H]),...G})}},O1=class extends V{constructor(Y,W){super(["ARSEEK",...Y],W)}},v1=class extends V{constructor(Y,W){super(["ARSET",...Y],W)}},f1=class extends V{constructor([Y,W,$],Q){let G=["bitcount",Y];if(typeof W==="number")G.push(W);if(typeof $==="number")G.push($);super(G,Q)}},k1=class{constructor(Y,W,$,Q=(G)=>G.exec(this.client)){this.client=W,this.opts=$,this.execOperation=Q,this.command=["bitfield",...Y]}command;chain(...Y){return this.command.push(...Y),this}get(...Y){return this.chain("get",...Y)}set(...Y){return this.chain("set",...Y)}incrby(...Y){return this.chain("incrby",...Y)}overflow(Y){return this.chain("overflow",Y)}exec(){let Y=new V(this.command,this.opts);return this.execOperation(Y)}},l1=class extends V{constructor(Y,W){super(["bitop",...Y],W)}},y1=class extends V{constructor(Y,W){super(["bitpos",...Y],W)}},u1=class extends V{constructor([Y,W],$){super(["CLIENT","SETINFO",Y.toUpperCase(),W],$)}},C1=class extends V{constructor([Y,W,$],Q){super(["COPY",Y,W,...$?.replace?["REPLACE"]:[]],{...Q,deserialize(G){if(G>0)return"COPIED";return"NOT_COPIED"}})}},i1=class extends V{constructor(Y){super(["dbsize"],Y)}},g1=class extends V{constructor(Y,W){super(["decr",...Y],W)}},c1=class extends V{constructor(Y,W){super(["decrby",...Y],W)}},p1=class extends V{constructor(Y,W){super(["del",...Y],W)}},n1=class extends V{constructor(Y,W){super(["echo",...Y],W)}},t1=class extends V{constructor([Y,W,$],Q){super(["eval_ro",Y,W.length,...W,...$??[]],Q)}},d1=class extends V{constructor([Y,W,$],Q){super(["eval",Y,W.length,...W,...$??[]],Q)}},r1=class extends V{constructor([Y,W,$],Q){super(["evalsha_ro",Y,W.length,...W,...$??[]],Q)}},e1=class extends V{constructor([Y,W,$],Q){super(["evalsha",Y,W.length,...W,...$??[]],Q)}},o1=class extends V{constructor(Y,W){super(["exists",...Y],W)}},a1=class extends V{constructor(Y,W){super(["expire",...Y.filter(Boolean)],W)}},m1=class extends V{constructor(Y,W){super(["expireat",...Y],W)}},s1=class extends V{constructor([Y,W,$],Q){super(["fcall",Y,...W?[W.length,...W]:[0],...$??[]],Q)}},Y0=class extends V{constructor([Y,W,$],Q){super(["fcall_ro",Y,...W?[W.length,...W]:[0],...$??[]],Q)}},W0=class extends V{constructor(Y,W){let $=["flushall"];if(Y&&Y.length>0&&Y[0].async)$.push("async");super($,W)}},$0=class extends V{constructor([Y],W){let $=["flushdb"];if(Y?.async)$.push("async");super($,W)}},Q0=class extends V{constructor([Y],W){super(["function","delete",Y],W)}},G0=class extends V{constructor(Y){super(["function","flush"],Y)}},V0=class extends V{constructor([Y],W){let $=["function","list"];if(Y?.libraryName)$.push("libraryname",Y.libraryName);if(Y?.withCode)$.push("withcode");super($,{deserialize:M$,...W})}};function M$(Y){if(!Array.isArray(Y))return[];return Y.map((W)=>{let $=P(W),Q=$.functions.map((G)=>P(G));return{libraryName:$.library_name,engine:$.engine,functions:Q.map((G)=>({name:G.name,description:G.description??void 0,flags:G.flags})),libraryCode:$.library_code}})}var D0=class extends V{constructor([Y],W){super(["function","load",...Y.replace?["replace"]:[],Y.code],W)}},z0=class extends V{constructor(Y){super(["function","stats"],{deserialize:h$,...Y})}};function h$(Y){let W=P(P(Y).engines),$=Object.fromEntries(Object.entries(W).map(([G,D])=>[G,P(D)]));return{engines:Object.fromEntries(Object.entries($).map(([G,D])=>[G,{librariesCount:D.libraries_count,functionsCount:D.functions_count}]))}}var T0=class extends V{constructor([Y,W,...$],Q){let G=["geoadd",Y];if("nx"in W&&W.nx)G.push("nx");else if("xx"in W&&W.xx)G.push("xx");if("ch"in W&&W.ch)G.push("ch");if("latitude"in W&&W.latitude)G.push(W.longitude,W.latitude,W.member);G.push(...$.flatMap(({latitude:D,longitude:z,member:T})=>[z,D,T]));super(G,Q)}},H0=class extends V{constructor([Y,W,$,Q="M"],G){super(["GEODIST",Y,W,$,Q],G)}},Z0=class extends V{constructor(Y,W){let[$]=Y,Q=Array.isArray(Y[1])?Y[1]:Y.slice(1);super(["GEOHASH",$,...Q],W)}},X0=class extends V{constructor(Y,W){let[$]=Y,Q=Array.isArray(Y[1])?Y[1]:Y.slice(1);super(["GEOPOS",$,...Q],{deserialize:(G)=>w$(G),...W})}};function w$(Y){let W=[];for(let $ of Y){if(!$?.[0]||!$?.[1])continue;W.push({lng:Number.parseFloat($[0]),lat:Number.parseFloat($[1])})}return W}var M0=class extends V{constructor([Y,W,$,Q,G],D){let z=["GEOSEARCH",Y];if(W.type==="FROMMEMBER"||W.type==="frommember")z.push(W.type,W.member);if(W.type==="FROMLONLAT"||W.type==="fromlonlat")z.push(W.type,W.coordinate.lon,W.coordinate.lat);if($.type==="BYRADIUS"||$.type==="byradius")z.push($.type,$.radius,$.radiusType);if($.type==="BYBOX"||$.type==="bybox")z.push($.type,$.rect.width,$.rect.height,$.rectType);if(z.push(Q),G?.count)z.push("COUNT",G.count.limit,...G.count.any?["ANY"]:[]);let T=(H)=>{if(!G?.withCoord&&!G?.withDist&&!G?.withHash)return H.map((Z)=>{try{return{member:K(Z)}}catch{return{member:Z}}});return H.map((Z)=>{let X=1,M={};try{M.member=K(Z[0])}catch{M.member=Z[0]}if(G.withDist)M.dist=Number.parseFloat(Z[X++]);if(G.withHash)M.hash=Z[X++].toString();if(G.withCoord)M.coord={long:Number.parseFloat(Z[X][0]),lat:Number.parseFloat(Z[X][1])};return M})};super([...z,...G?.withCoord?["WITHCOORD"]:[],...G?.withDist?["WITHDIST"]:[],...G?.withHash?["WITHHASH"]:[]],{deserialize:T,...D})}},h0=class extends V{constructor([Y,W,$,Q,G,D],z){let T=["GEOSEARCHSTORE",Y,W];if($.type==="FROMMEMBER"||$.type==="frommember")T.push($.type,$.member);if($.type==="FROMLONLAT"||$.type==="fromlonlat")T.push($.type,$.coordinate.lon,$.coordinate.lat);if(Q.type==="BYRADIUS"||Q.type==="byradius")T.push(Q.type,Q.radius,Q.radiusType);if(Q.type==="BYBOX"||Q.type==="bybox")T.push(Q.type,Q.rect.width,Q.rect.height,Q.rectType);if(T.push(G),D?.count)T.push("COUNT",D.count.limit,...D.count.any?["ANY"]:[]);super([...T,...D?.storeDist?["STOREDIST"]:[]],z)}},w0=class extends V{constructor(Y,W){super(["get",...Y],W)}},E0=class extends V{constructor(Y,W){super(["getbit",...Y],W)}},L0=class extends V{constructor(Y,W){super(["getdel",...Y],W)}},U0=class extends V{constructor([Y,W],$){let Q=["getex",Y];if(W){if("ex"in W&&typeof W.ex==="number")Q.push("ex",W.ex);else if("px"in W&&typeof W.px==="number")Q.push("px",W.px);else if("exat"in W&&typeof W.exat==="number")Q.push("exat",W.exat);else if("pxat"in W&&typeof W.pxat==="number")Q.push("pxat",W.pxat);else if("persist"in W&&W.persist)Q.push("persist")}super(Q,$)}},K0=class extends V{constructor(Y,W){super(["getrange",...Y],W)}},J0=class extends V{constructor(Y,W){super(["getset",...Y],W)}},N0=class extends V{constructor(Y,W){super(["hdel",...Y],W)}},P0=class extends V{constructor(Y,W){super(["hexists",...Y],W)}},F0=class extends V{constructor(Y,W){let[$,Q,G,D]=Y,z=Array.isArray(Q)?Q:[Q];super(["hexpire",$,G,...D?[D]:[],"FIELDS",z.length,...z],W)}},_0=class extends V{constructor(Y,W){let[$,Q,G,D]=Y,z=Array.isArray(Q)?Q:[Q];super(["hexpireat",$,G,...D?[D]:[],"FIELDS",z.length,...z],W)}},j0=class extends V{constructor(Y,W){let[$,Q]=Y,G=Array.isArray(Q)?Q:[Q];super(["hexpiretime",$,"FIELDS",G.length,...G],W)}},A0=class extends V{constructor(Y,W){let[$,Q]=Y,G=Array.isArray(Q)?Q:[Q];super(["hpersist",$,"FIELDS",G.length,...G],W)}},B0=class extends V{constructor(Y,W){let[$,Q,G,D]=Y,z=Array.isArray(Q)?Q:[Q];super(["hpexpire",$,G,...D?[D]:[],"FIELDS",z.length,...z],W)}},I0=class extends V{constructor(Y,W){let[$,Q,G,D]=Y,z=Array.isArray(Q)?Q:[Q];super(["hpexpireat",$,G,...D?[D]:[],"FIELDS",z.length,...z],W)}},S0=class extends V{constructor(Y,W){let[$,Q]=Y,G=Array.isArray(Q)?Q:[Q];super(["hpexpiretime",$,"FIELDS",G.length,...G],W)}},q0=class extends V{constructor(Y,W){let[$,Q]=Y,G=Array.isArray(Q)?Q:[Q];super(["hpttl",$,"FIELDS",G.length,...G],W)}},b0=class extends V{constructor(Y,W){super(["hget",...Y],W)}};function E$(Y){if(Y.length===0)return null;let W={};for(let $=0;$<Y.length;$+=2){let Q=Y[$],G=Y[$+1];try{let D=!Number.isNaN(Number(G))&&!Number.isSafeInteger(Number(G));W[Q]=D?G:K(G)}catch{W[Q]=G}}return W}var x0=class extends V{constructor(Y,W){super(["hgetall",...Y],{deserialize:($)=>E$($),...W})}};function u(Y,W){if(W.every((Q)=>Q===null))return null;let $={};for(let[Q,G]of Y.entries())try{$[G]=K(W[Q])}catch{$[G]=W[Q]}return $}var R0=class extends V{constructor([Y,...W],$){super(["hmget",Y,...W],{deserialize:(Q)=>u(W,Q),...$})}},O0=class extends V{constructor([Y,...W],$){super(["hgetdel",Y,"FIELDS",W.length,...W],{deserialize:(Q)=>u(W.map(String),Q),...$})}},v0=class extends V{constructor([Y,W,...$],Q){let G=["hgetex",Y];if("ex"in W&&typeof W.ex==="number")G.push("EX",W.ex);else if("px"in W&&typeof W.px==="number")G.push("PX",W.px);else if("exat"in W&&typeof W.exat==="number")G.push("EXAT",W.exat);else if("pxat"in W&&typeof W.pxat==="number")G.push("PXAT",W.pxat);else if("persist"in W&&W.persist)G.push("PERSIST");G.push("FIELDS",$.length,...$);super(G,{deserialize:(D)=>u($.map(String),D),...Q})}},f0=class extends V{constructor(Y,W){super(["hincrby",...Y],W)}},k0=class extends V{constructor(Y,W){super(["hincrbyfloat",...Y],W)}},l0=class extends V{constructor([Y],W){super(["hkeys",Y],W)}},y0=class extends V{constructor(Y,W){super(["hlen",...Y],W)}},u0=class extends V{constructor([Y,W],$){super(["hmset",Y,...Object.entries(W).flatMap(([Q,G])=>[Q,G])],$)}},C0=class extends V{constructor([Y,W,$],Q){let G=["hscan",Y,W];if($?.match)G.push("match",$.match);if(typeof $?.count==="number")G.push("count",$.count);super(G,{deserialize:I,...Q})}},i0=class extends V{constructor([Y,W],$){super(["hset",Y,...Object.entries(W).flatMap(([Q,G])=>[Q,G])],$)}},g0=class extends V{constructor([Y,W,$],Q){let G=["hsetex",Y];if(W.conditional)G.push(W.conditional.toUpperCase());if(W.expiration){if("ex"in W.expiration&&typeof W.expiration.ex==="number")G.push("EX",W.expiration.ex);else if("px"in W.expiration&&typeof W.expiration.px==="number")G.push("PX",W.expiration.px);else if("exat"in W.expiration&&typeof W.expiration.exat==="number")G.push("EXAT",W.expiration.exat);else if("pxat"in W.expiration&&typeof W.expiration.pxat==="number")G.push("PXAT",W.expiration.pxat);else if("keepttl"in W.expiration&&W.expiration.keepttl)G.push("KEEPTTL")}let D=Object.entries($);G.push("FIELDS",D.length);for(let[z,T]of D)G.push(z,T);super(G,Q)}},c0=class extends V{constructor(Y,W){super(["hsetnx",...Y],W)}},p0=class extends V{constructor(Y,W){super(["hstrlen",...Y],W)}},n0=class extends V{constructor(Y,W){let[$,Q]=Y,G=Array.isArray(Q)?Q:[Q];super(["httl",$,"FIELDS",G.length,...G],W)}},t0=class extends V{constructor(Y,W){super(["hvals",...Y],W)}},d0=class extends V{constructor(Y,W){super(["incr",...Y],W)}},r0=class extends V{constructor(Y,W){super(["incrby",...Y],W)}},e0=class extends V{constructor(Y,W){super(["incrbyfloat",...Y],W)}},o0=class extends V{constructor(Y,W){super(["JSON.ARRAPPEND",...Y],W)}},a0=class extends V{constructor(Y,W){super(["JSON.ARRINDEX",...Y],W)}},m0=class extends V{constructor(Y,W){super(["JSON.ARRINSERT",...Y],W)}},s0=class extends V{constructor(Y,W){super(["JSON.ARRLEN",Y[0],Y[1]??"$"],W)}},YY=class extends V{constructor(Y,W){super(["JSON.ARRPOP",...Y],W)}},WY=class extends V{constructor(Y,W){let $=Y[1]??"$",Q=Y[2]??0,G=Y[3]??0;super(["JSON.ARRTRIM",Y[0],$,Q,G],W)}},$Y=class extends V{constructor(Y,W){super(["JSON.CLEAR",...Y],W)}},QY=class extends V{constructor(Y,W){super(["JSON.DEL",...Y],W)}},GY=class extends V{constructor(Y,W){super(["JSON.FORGET",...Y],W)}},VY=class extends V{constructor(Y,W){let $=["JSON.GET"];if(typeof Y[1]==="string")$.push(...Y);else{if($.push(Y[0]),Y[1]){if(Y[1].indent)$.push("INDENT",Y[1].indent);if(Y[1].newline)$.push("NEWLINE",Y[1].newline);if(Y[1].space)$.push("SPACE",Y[1].space)}$.push(...Y.slice(2))}super($,W)}},DY=class extends V{constructor(Y,W){let $=["JSON.MERGE",...Y];super($,W)}},zY=class extends V{constructor(Y,W){super(["JSON.MGET",...Y[0],Y[1]],W)}},TY=class extends V{constructor(Y,W){let $=["JSON.MSET"];for(let Q of Y)$.push(Q.key,Q.path,Q.value);super($,W)}},HY=class extends V{constructor(Y,W){super(["JSON.NUMINCRBY",...Y],W)}},ZY=class extends V{constructor(Y,W){super(["JSON.NUMMULTBY",...Y],W)}},XY=class extends V{constructor(Y,W){super(["JSON.OBJKEYS",...Y],W)}},MY=class extends V{constructor(Y,W){super(["JSON.OBJLEN",...Y],W)}},hY=class extends V{constructor(Y,W){super(["JSON.RESP",...Y],W)}},wY=class extends V{constructor(Y,W){let $=["JSON.SET",Y[0],Y[1],Y[2]];if(Y[3]){if(Y[3].nx)$.push("NX");else if(Y[3].xx)$.push("XX")}super($,W)}},EY=class extends V{constructor(Y,W){super(["JSON.STRAPPEND",...Y],W)}},LY=class extends V{constructor(Y,W){super(["JSON.STRLEN",...Y],W)}},UY=class extends V{constructor(Y,W){super(["JSON.TOGGLE",...Y],W)}},KY=class extends V{constructor(Y,W){super(["JSON.TYPE",...Y],W)}},JY=class extends V{constructor(Y,W){super(["keys",...Y],W)}},NY=class extends V{constructor(Y,W){super(["lindex",...Y],W)}},PY=class extends V{constructor(Y,W){super(["linsert",...Y],W)}},FY=class extends V{constructor(Y,W){super(["llen",...Y],W)}},_Y=class extends V{constructor(Y,W){super(["lmove",...Y],W)}},jY=class extends V{constructor(Y,W){let[$,Q,G,D]=Y;super(["LMPOP",$,...Q,G,...D?["COUNT",D]:[]],W)}},AY=class extends V{constructor(Y,W){super(["lpop",...Y],W)}},BY=class extends V{constructor(Y,W){let $=["lpos",Y[0],Y[1]];if(typeof Y[2]?.rank==="number")$.push("rank",Y[2].rank);if(typeof Y[2]?.count==="number")$.push("count",Y[2].count);if(typeof Y[2]?.maxLen==="number")$.push("maxLen",Y[2].maxLen);super($,W)}},IY=class extends V{constructor(Y,W){super(["lpush",...Y],W)}},SY=class extends V{constructor(Y,W){super(["lpushx",...Y],W)}},qY=class extends V{constructor(Y,W){super(["lrange",...Y],W)}},bY=class extends V{constructor(Y,W){super(["lrem",...Y],W)}},xY=class extends V{constructor(Y,W){super(["lset",...Y],W)}},RY=class extends V{constructor(Y,W){super(["ltrim",...Y],W)}},OY=class extends V{constructor(Y,W){let $=Array.isArray(Y[0])?Y[0]:Y;super(["mget",...$],W)}},vY=class extends V{constructor([Y],W){super(["mset",...Object.entries(Y).flatMap(([$,Q])=>[$,Q])],W)}},fY=class extends V{constructor([Y],W){super(["msetnx",...Object.entries(Y).flat()],W)}},kY=class extends V{constructor(Y,W){super(["persist",...Y],W)}},lY=class extends V{constructor(Y,W){super(["pexpire",...Y],W)}},yY=class extends V{constructor(Y,W){super(["pexpireat",...Y],W)}},uY=class extends V{constructor(Y,W){super(["pfadd",...Y],W)}},CY=class extends V{constructor(Y,W){super(["pfcount",...Y],W)}},iY=class extends V{constructor(Y,W){super(["pfmerge",...Y],W)}},gY=class extends V{constructor(Y,W){let $=["ping"];if(Y?.[0]!==void 0)$.push(Y[0]);super($,W)}},cY=class extends V{constructor(Y,W){super(["psetex",...Y],W)}},pY=class extends V{constructor(Y,W){super(["pttl",...Y],W)}},nY=class extends V{constructor(Y,W){super(["publish",...Y],W)}},tY=class extends V{constructor(Y){super(["randomkey"],Y)}},dY=class extends V{constructor(Y,W){super(["rename",...Y],W)}},rY=class extends V{constructor(Y,W){super(["renamenx",...Y],W)}},eY=class extends V{constructor(Y,W){super(["rpop",...Y],W)}},oY=class extends V{constructor(Y,W){super(["rpush",...Y],W)}},aY=class extends V{constructor(Y,W){super(["rpushx",...Y],W)}},mY=class extends V{constructor(Y,W){super(["sadd",...Y],W)}},sY=class extends V{constructor([Y,W],$){let Q=["scan",Y];if(W?.match)Q.push("match",W.match);if(typeof W?.count==="number")Q.push("count",W.count);if(W&&"withType"in W&&W.withType===!0)Q.push("withtype");else if(W&&"type"in W&&W.type&&W.type.length>0)Q.push("type",W.type);super(Q,{deserialize:W?.withType?bW:I,...$})}},Y4=class extends V{constructor(Y,W){super(["scard",...Y],W)}},W4=class extends V{constructor(Y,W){super(["script","exists",...Y],{deserialize:($)=>$,...W})}},$4=class extends V{constructor([Y],W){let $=["script","flush"];if(Y?.sync)$.push("sync");else if(Y?.async)$.push("async");super($,W)}},Q4=class extends V{constructor(Y,W){super(["script","load",...Y],W)}},G4=class extends V{constructor(Y,W){super(["sdiff",...Y],W)}},V4=class extends V{constructor(Y,W){super(["sdiffstore",...Y],W)}},D4=class extends V{constructor([Y,W,$],Q){let G=["set",Y,W];if($){if("nx"in $&&$.nx)G.push("nx");else if("xx"in $&&$.xx)G.push("xx");if("get"in $&&$.get)G.push("get");if("ex"in $&&typeof $.ex==="number")G.push("ex",$.ex);else if("px"in $&&typeof $.px==="number")G.push("px",$.px);else if("exat"in $&&typeof $.exat==="number")G.push("exat",$.exat);else if("pxat"in $&&typeof $.pxat==="number")G.push("pxat",$.pxat);else if("keepTtl"in $&&$.keepTtl)G.push("keepTtl")}super(G,Q)}},z4=class extends V{constructor(Y,W){super(["setbit",...Y],W)}},T4=class extends V{constructor(Y,W){super(["setex",...Y],W)}},H4=class extends V{constructor(Y,W){super(["setnx",...Y],W)}},Z4=class extends V{constructor(Y,W){super(["setrange",...Y],W)}},X4=class extends V{constructor(Y,W){super(["sinter",...Y],W)}},M4=class extends V{constructor(Y,W){let[$,Q]=Y,G=["sintercard",$.length,...$];if(Q?.limit!==void 0)G.push("LIMIT",Q.limit);super(G,W)}},h4=class extends V{constructor(Y,W){super(["sinterstore",...Y],W)}},w4=class extends V{constructor(Y,W){super(["sismember",...Y],W)}},E4=class extends V{constructor(Y,W){super(["smembers",...Y],W)}},L4=class extends V{constructor(Y,W){super(["smismember",Y[0],...Y[1]],W)}},U4=class extends V{constructor(Y,W){super(["smove",...Y],W)}},K4=class extends V{constructor([Y,W],$){let Q=["spop",Y];if(typeof W==="number")Q.push(W);super(Q,$)}},J4=class extends V{constructor([Y,W],$){let Q=["srandmember",Y];if(typeof W==="number")Q.push(W);super(Q,$)}},N4=class extends V{constructor(Y,W){super(["srem",...Y],W)}},P4=class extends V{constructor([Y,W,$],Q){let G=["sscan",Y,W];if($?.match)G.push("match",$.match);if(typeof $?.count==="number")G.push("count",$.count);super(G,{deserialize:I,...Q})}},F4=class extends V{constructor(Y,W){super(["strlen",...Y],W)}},_4=class extends V{constructor(Y,W){super(["sunion",...Y],W)}},j4=class extends V{constructor(Y,W){super(["sunionstore",...Y],W)}},A4=class extends V{constructor(Y){super(["time"],Y)}},B4=class extends V{constructor(Y,W){super(["touch",...Y],W)}},I4=class extends V{constructor(Y,W){super(["ttl",...Y],W)}},S4=class extends V{constructor(Y,W){super(["type",...Y],W)}},q4=class extends V{constructor(Y,W){super(["unlink",...Y],W)}},b4=class extends V{constructor([Y,W,$],Q){let G=Array.isArray($)?[...$]:[$];super(["XACK",Y,W,...G],Q)}},x4=class extends V{constructor([Y,W,$,...Q],G){let D=["XACKDEL",Y,W];D.push($.toUpperCase(),"IDS",Q.length,...Q);super(D,G)}},R4=class extends V{constructor([Y,W,$,Q],G){let D=["XADD",Y];if(Q){if(Q.nomkStream)D.push("NOMKSTREAM");if(Q.trim){if(D.push(Q.trim.type,Q.trim.comparison,Q.trim.threshold),Q.trim.limit!==void 0)D.push("LIMIT",Q.trim.limit)}}D.push(W);for(let[z,T]of Object.entries($))D.push(z,T);super(D,G)}},O4=class extends V{constructor([Y,W,$,Q,G,D],z){let T=[];if(D?.count)T.push("COUNT",D.count);if(D?.justId)T.push("JUSTID");super(["XAUTOCLAIM",Y,W,$,Q,G,...T],z)}},v4=class extends V{constructor([Y,W,$,Q,G,D],z){let T=Array.isArray(G)?[...G]:[G],H=[];if(D?.idleMS)H.push("IDLE",D.idleMS);if(D?.idleMS)H.push("TIME",D.timeMS);if(D?.retryCount)H.push("RETRYCOUNT",D.retryCount);if(D?.force)H.push("FORCE");if(D?.justId)H.push("JUSTID");if(D?.lastId)H.push("LASTID",D.lastId);super(["XCLAIM",Y,W,$,Q,...T,...H],z)}},f4=class extends V{constructor([Y,W],$){let Q=Array.isArray(W)?[...W]:[W];super(["XDEL",Y,...Q],$)}},k4=class extends V{constructor([Y,W,...$],Q){let G=["XDELEX",Y];if(W)G.push(W.toUpperCase());G.push("IDS",$.length,...$);super(G,Q)}},l4=class extends V{constructor([Y,W],$){let Q=["XGROUP"];switch(W.type){case"CREATE":{if(Q.push("CREATE",Y,W.group,W.id),W.options){if(W.options.MKSTREAM)Q.push("MKSTREAM");if(W.options.ENTRIESREAD!==void 0)Q.push("ENTRIESREAD",W.options.ENTRIESREAD.toString())}break}case"CREATECONSUMER":{Q.push("CREATECONSUMER",Y,W.group,W.consumer);break}case"DELCONSUMER":{Q.push("DELCONSUMER",Y,W.group,W.consumer);break}case"DESTROY":{Q.push("DESTROY",Y,W.group);break}case"SETID":{if(Q.push("SETID",Y,W.group,W.id),W.options?.ENTRIESREAD!==void 0)Q.push("ENTRIESREAD",W.options.ENTRIESREAD.toString());break}default:throw Error("Invalid XGROUP")}super(Q,$)}},y4=class extends V{constructor([Y,W],$){let Q=[];if(W.type==="CONSUMERS")Q.push("CONSUMERS",Y,W.group);else Q.push("GROUPS",Y);super(["XINFO",...Q],$)}},u4=class extends V{constructor(Y,W){super(["XLEN",...Y],W)}},C4=class extends V{constructor([Y,W,$,Q,G,D],z){let T=D?.consumer===void 0?[]:Array.isArray(D.consumer)?[...D.consumer]:[D.consumer];super(["XPENDING",Y,W,...D?.idleTime?["IDLE",D.idleTime]:[],$,Q,G,...T],z)}};function L$(Y){let W={};for(let $ of Y)for(let Q=0;Q<$.length;Q+=2){let G=$[Q],D=$[Q+1];if(!(G in W))W[G]={};for(let z=0;z<D.length;z+=2){let T=D[z],H=D[z+1];try{W[G][T]=K(H)}catch{W[G][T]=H}}}return W}var i4=class extends V{constructor([Y,W,$,Q],G){let D=["XRANGE",Y,W,$];if(typeof Q==="number")D.push("COUNT",Q);super(D,{deserialize:(z)=>L$(z),...G})}},U$="ERR Unbalanced XREAD list of streams: for each stream key an ID or '$' must be specified",g4=class extends V{constructor([Y,W,$],Q){if(Array.isArray(Y)&&Array.isArray(W)&&Y.length!==W.length)throw Error(U$);let G=[];if(typeof $?.count==="number")G.push("COUNT",$.count);if(typeof $?.blockMS==="number")G.push("BLOCK",$.blockMS);G.push("STREAMS",...Array.isArray(Y)?[...Y]:[Y],...Array.isArray(W)?[...W]:[W]);super(["XREAD",...G],Q)}},K$="ERR Unbalanced XREADGROUP list of streams: for each stream key an ID or '$' must be specified",c4=class extends V{constructor([Y,W,$,Q,G],D){if(Array.isArray($)&&Array.isArray(Q)&&$.length!==Q.length)throw Error(K$);let z=[];if(typeof G?.count==="number")z.push("COUNT",G.count);if(typeof G?.blockMS==="number")z.push("BLOCK",G.blockMS);if(typeof G?.NOACK==="boolean"&&G.NOACK)z.push("NOACK");z.push("STREAMS",...Array.isArray($)?[...$]:[$],...Array.isArray(Q)?[...Q]:[Q]);super(["XREADGROUP","GROUP",Y,W,...z],D)}},p4=class extends V{constructor([Y,W,$,Q],G){let D=["XREVRANGE",Y,W,$];if(typeof Q==="number")D.push("COUNT",Q);super(D,{deserialize:(z)=>J$(z),...G})}};function J$(Y){let W={};for(let $ of Y)for(let Q=0;Q<$.length;Q+=2){let G=$[Q],D=$[Q+1];if(!(G in W))W[G]={};for(let z=0;z<D.length;z+=2){let T=D[z],H=D[z+1];try{W[G][T]=K(H)}catch{W[G][T]=H}}}return W}var n4=class extends V{constructor([Y,W],$){let{limit:Q,strategy:G,threshold:D,exactness:z="~"}=W;super(["XTRIM",Y,G,z,D,...Q?["LIMIT",Q]:[]],$)}},A=class extends V{constructor([Y,W,...$],Q){let G=["zadd",Y];if("nx"in W&&W.nx)G.push("nx");else if("xx"in W&&W.xx)G.push("xx");if("ch"in W&&W.ch)G.push("ch");if("incr"in W&&W.incr)G.push("incr");if("lt"in W&&W.lt)G.push("lt");else if("gt"in W&&W.gt)G.push("gt");if("score"in W&&"member"in W)G.push(W.score,W.member);G.push(...$.flatMap(({score:D,member:z})=>[D,z]));super(G,Q)}},t4=class extends V{constructor(Y,W){super(["zcard",...Y],W)}},d4=class extends V{constructor(Y,W){super(["zcount",...Y],W)}},r4=class extends V{constructor(Y,W){super(["zincrby",...Y],W)}},e4=class extends V{constructor([Y,W,$,Q],G){let D=["zinterstore",Y,W];if(Array.isArray($))D.push(...$);else D.push($);if(Q){if("weights"in Q&&Q.weights)D.push("weights",...Q.weights);else if("weight"in Q&&typeof Q.weight==="number")D.push("weights",Q.weight);if("aggregate"in Q)D.push("aggregate",Q.aggregate)}super(D,G)}},o4=class extends V{constructor(Y,W){super(["zlexcount",...Y],W)}},a4=class extends V{constructor([Y,W],$){let Q=["zpopmax",Y];if(typeof W==="number")Q.push(W);super(Q,$)}},m4=class extends V{constructor([Y,W],$){let Q=["zpopmin",Y];if(typeof W==="number")Q.push(W);super(Q,$)}},s4=class extends V{constructor([Y,W,$,Q],G){let D=["zrange",Y,W,$];if(Q?.byScore)D.push("byscore");if(Q?.byLex)D.push("bylex");if(Q?.rev)D.push("rev");if(Q?.count!==void 0&&Q.offset!==void 0)D.push("limit",Q.offset,Q.count);if(Q?.withScores)D.push("withscores");super(D,G)}},YW=class extends V{constructor(Y,W){super(["zrank",...Y],W)}},WW=class extends V{constructor(Y,W){super(["zrem",...Y],W)}},$W=class extends V{constructor(Y,W){super(["zremrangebylex",...Y],W)}},QW=class extends V{constructor(Y,W){super(["zremrangebyrank",...Y],W)}},GW=class extends V{constructor(Y,W){super(["zremrangebyscore",...Y],W)}},VW=class extends V{constructor(Y,W){super(["zrevrank",...Y],W)}},DW=class extends V{constructor([Y,W,$],Q){let G=["zscan",Y,W];if($?.match)G.push("match",$.match);if(typeof $?.count==="number")G.push("count",$.count);super(G,{deserialize:I,...Q})}},zW=class extends V{constructor(Y,W){super(["zscore",...Y],W)}},TW=class extends V{constructor([Y,W,$],Q){let G=["zunion",Y];if(Array.isArray(W))G.push(...W);else G.push(W);if($){if("weights"in $&&$.weights)G.push("weights",...$.weights);else if("weight"in $&&typeof $.weight==="number")G.push("weights",$.weight);if("aggregate"in $)G.push("aggregate",$.aggregate);if($.withScores)G.push("withscores")}super(G,Q)}},HW=class extends V{constructor([Y,W,$,Q],G){let D=["zunionstore",Y,W];if(Array.isArray($))D.push(...$);else D.push($);if(Q){if("weights"in Q&&Q.weights)D.push("weights",...Q.weights);else if("weight"in Q&&typeof Q.weight==="number")D.push("weights",Q.weight);if("aggregate"in Q)D.push("aggregate",Q.aggregate)}super(D,G)}},ZW=class extends V{constructor(Y,W){super(["zdiffstore",...Y],W)}},XW=class extends V{constructor(Y,W){let[$,Q]=Y;super(["zmscore",$,...Q],W)}},Y1=class{client;commands;commandOptions;multiExec;constructor(Y){if(this.client=Y.client,this.commands=[],this.commandOptions=Y.commandOptions,this.multiExec=Y.multiExec??!1,this.commandOptions?.latencyLogging){let W=this.exec.bind(this);this.exec=async($)=>{let Q=performance.now(),G=await($?W($):W()),z=(performance.now()-Q).toFixed(2);return console.log(`Latency for \x1B[38;2;19;185;39m${this.multiExec?["MULTI-EXEC"]:["PIPELINE"].toString().toUpperCase()}\x1B[0m: \x1B[38;2;0;255;255m${z} ms\x1B[0m`),G}}}exec=async(Y)=>{if(this.commands.length===0)throw Error("Pipeline is empty");let W=this.multiExec?["multi-exec"]:["pipeline"],$=await this.client.request({path:W,body:Object.values(this.commands).map((Q)=>Q.command)});return Y?.keepErrors?$.map(({error:Q,result:G},D)=>{return{error:Q,result:this.commands[D].deserialize(G)}}):$.map(({error:Q,result:G},D)=>{if(Q)throw new J(`Command ${D+1} [ ${this.commands[D].command[0]} ] failed: ${Q}`);return this.commands[D].deserialize(G)})};length(){return this.commands.length}chain(Y){return this.commands.push(Y),this}append=(...Y)=>this.chain(new L1(Y,this.commandOptions));arcount=(...Y)=>this.chain(new U1(Y,this.commandOptions));ardel=(...Y)=>this.chain(new K1(Y,this.commandOptions));ardelrange=(...Y)=>this.chain(new J1(Y,this.commandOptions));arget=(...Y)=>this.chain(new N1(Y,this.commandOptions));argetrange=(...Y)=>this.chain(new P1(Y,this.commandOptions));argrep=(Y,W,$,Q)=>this.chain(new F1([Y,W,$,Q],this.commandOptions));arinfo=(...Y)=>this.chain(new _1(Y,this.commandOptions));arinsert=(Y,...W)=>this.chain(new j1([Y,...W],this.commandOptions));arlastitems=(...Y)=>this.chain(new A1(Y,this.commandOptions));arlen=(...Y)=>this.chain(new B1(Y,this.commandOptions));armget=(...Y)=>this.chain(new I1(Y,this.commandOptions));armset=(Y,W)=>this.chain(new S1([Y,W],this.commandOptions));arnext=(...Y)=>this.chain(new q1(Y,this.commandOptions));arop=(Y,W,$,Q)=>this.chain(new b1([Y,W,$,Q],this.commandOptions));arring=(Y,W,...$)=>this.chain(new x1([Y,W,...$],this.commandOptions));arscan=(...Y)=>this.chain(new R1(Y,this.commandOptions));arseek=(...Y)=>this.chain(new O1(Y,this.commandOptions));arset=(Y,W,...$)=>this.chain(new v1([Y,W,...$],this.commandOptions));bitcount=(...Y)=>this.chain(new f1(Y,this.commandOptions));bitfield=(...Y)=>new k1(Y,this.client,this.commandOptions,this.chain.bind(this));bitop=(Y,W,$,...Q)=>this.chain(new l1([Y,W,$,...Q],this.commandOptions));bitpos=(...Y)=>this.chain(new y1(Y,this.commandOptions));clientSetinfo=(...Y)=>this.chain(new u1(Y,this.commandOptions));copy=(...Y)=>this.chain(new C1(Y,this.commandOptions));zdiffstore=(...Y)=>this.chain(new ZW(Y,this.commandOptions));dbsize=()=>this.chain(new i1(this.commandOptions));decr=(...Y)=>this.chain(new g1(Y,this.commandOptions));decrby=(...Y)=>this.chain(new c1(Y,this.commandOptions));del=(...Y)=>this.chain(new p1(Y,this.commandOptions));echo=(...Y)=>this.chain(new n1(Y,this.commandOptions));evalRo=(...Y)=>this.chain(new t1(Y,this.commandOptions));eval=(...Y)=>this.chain(new d1(Y,this.commandOptions));evalshaRo=(...Y)=>this.chain(new r1(Y,this.commandOptions));evalsha=(...Y)=>this.chain(new e1(Y,this.commandOptions));exists=(...Y)=>this.chain(new o1(Y,this.commandOptions));expire=(...Y)=>this.chain(new a1(Y,this.commandOptions));expireat=(...Y)=>this.chain(new m1(Y,this.commandOptions));flushall=(Y)=>this.chain(new W0(Y,this.commandOptions));flushdb=(...Y)=>this.chain(new $0(Y,this.commandOptions));geoadd=(...Y)=>this.chain(new T0(Y,this.commandOptions));geodist=(...Y)=>this.chain(new H0(Y,this.commandOptions));geopos=(...Y)=>this.chain(new X0(Y,this.commandOptions));geohash=(...Y)=>this.chain(new Z0(Y,this.commandOptions));geosearch=(...Y)=>this.chain(new M0(Y,this.commandOptions));geosearchstore=(...Y)=>this.chain(new h0(Y,this.commandOptions));get=(...Y)=>this.chain(new w0(Y,this.commandOptions));getbit=(...Y)=>this.chain(new E0(Y,this.commandOptions));getdel=(...Y)=>this.chain(new L0(Y,this.commandOptions));getex=(...Y)=>this.chain(new U0(Y,this.commandOptions));getrange=(...Y)=>this.chain(new K0(Y,this.commandOptions));getset=(Y,W)=>this.chain(new J0([Y,W],this.commandOptions));hdel=(...Y)=>this.chain(new N0(Y,this.commandOptions));hexists=(...Y)=>this.chain(new P0(Y,this.commandOptions));hexpire=(...Y)=>this.chain(new F0(Y,this.commandOptions));hexpireat=(...Y)=>this.chain(new _0(Y,this.commandOptions));hexpiretime=(...Y)=>this.chain(new j0(Y,this.commandOptions));httl=(...Y)=>this.chain(new n0(Y,this.commandOptions));hpexpire=(...Y)=>this.chain(new B0(Y,this.commandOptions));hpexpireat=(...Y)=>this.chain(new I0(Y,this.commandOptions));hpexpiretime=(...Y)=>this.chain(new S0(Y,this.commandOptions));hpttl=(...Y)=>this.chain(new q0(Y,this.commandOptions));hpersist=(...Y)=>this.chain(new A0(Y,this.commandOptions));hget=(...Y)=>this.chain(new b0(Y,this.commandOptions));hgetall=(...Y)=>this.chain(new x0(Y,this.commandOptions));hgetdel=(...Y)=>this.chain(new O0(Y,this.commandOptions));hgetex=(...Y)=>this.chain(new v0(Y,this.commandOptions));hincrby=(...Y)=>this.chain(new f0(Y,this.commandOptions));hincrbyfloat=(...Y)=>this.chain(new k0(Y,this.commandOptions));hkeys=(...Y)=>this.chain(new l0(Y,this.commandOptions));hlen=(...Y)=>this.chain(new y0(Y,this.commandOptions));hmget=(...Y)=>this.chain(new R0(Y,this.commandOptions));hmset=(Y,W)=>this.chain(new u0([Y,W],this.commandOptions));hrandfield=(Y,W,$)=>this.chain(new E1([Y,W,$],this.commandOptions));hscan=(...Y)=>this.chain(new C0(Y,this.commandOptions));hset=(Y,W)=>this.chain(new i0([Y,W],this.commandOptions));hsetex=(...Y)=>this.chain(new g0(Y,this.commandOptions));hsetnx=(Y,W,$)=>this.chain(new c0([Y,W,$],this.commandOptions));hstrlen=(...Y)=>this.chain(new p0(Y,this.commandOptions));hvals=(...Y)=>this.chain(new t0(Y,this.commandOptions));incr=(...Y)=>this.chain(new d0(Y,this.commandOptions));incrby=(...Y)=>this.chain(new r0(Y,this.commandOptions));incrbyfloat=(...Y)=>this.chain(new e0(Y,this.commandOptions));keys=(...Y)=>this.chain(new JY(Y,this.commandOptions));lindex=(...Y)=>this.chain(new NY(Y,this.commandOptions));linsert=(Y,W,$,Q)=>this.chain(new PY([Y,W,$,Q],this.commandOptions));llen=(...Y)=>this.chain(new FY(Y,this.commandOptions));lmove=(...Y)=>this.chain(new _Y(Y,this.commandOptions));lpop=(...Y)=>this.chain(new AY(Y,this.commandOptions));lmpop=(...Y)=>this.chain(new jY(Y,this.commandOptions));lpos=(...Y)=>this.chain(new BY(Y,this.commandOptions));lpush=(Y,...W)=>this.chain(new IY([Y,...W],this.commandOptions));lpushx=(Y,...W)=>this.chain(new SY([Y,...W],this.commandOptions));lrange=(...Y)=>this.chain(new qY(Y,this.commandOptions));lrem=(Y,W,$)=>this.chain(new bY([Y,W,$],this.commandOptions));lset=(Y,W,$)=>this.chain(new xY([Y,W,$],this.commandOptions));ltrim=(...Y)=>this.chain(new RY(Y,this.commandOptions));mget=(...Y)=>this.chain(new OY(Y,this.commandOptions));mset=(Y)=>this.chain(new vY([Y],this.commandOptions));msetnx=(Y)=>this.chain(new fY([Y],this.commandOptions));persist=(...Y)=>this.chain(new kY(Y,this.commandOptions));pexpire=(...Y)=>this.chain(new lY(Y,this.commandOptions));pexpireat=(...Y)=>this.chain(new yY(Y,this.commandOptions));pfadd=(...Y)=>this.chain(new uY(Y,this.commandOptions));pfcount=(...Y)=>this.chain(new CY(Y,this.commandOptions));pfmerge=(...Y)=>this.chain(new iY(Y,this.commandOptions));ping=(Y)=>this.chain(new gY(Y,this.commandOptions));psetex=(Y,W,$)=>this.chain(new cY([Y,W,$],this.commandOptions));pttl=(...Y)=>this.chain(new pY(Y,this.commandOptions));publish=(...Y)=>this.chain(new nY(Y,this.commandOptions));randomkey=()=>this.chain(new tY(this.commandOptions));rename=(...Y)=>this.chain(new dY(Y,this.commandOptions));renamenx=(...Y)=>this.chain(new rY(Y,this.commandOptions));rpop=(...Y)=>this.chain(new eY(Y,this.commandOptions));rpush=(Y,...W)=>this.chain(new oY([Y,...W],this.commandOptions));rpushx=(Y,...W)=>this.chain(new aY([Y,...W],this.commandOptions));sadd=(Y,W,...$)=>this.chain(new mY([Y,W,...$],this.commandOptions));scan=(...Y)=>this.chain(new sY(Y,this.commandOptions));scard=(...Y)=>this.chain(new Y4(Y,this.commandOptions));scriptExists=(...Y)=>this.chain(new W4(Y,this.commandOptions));scriptFlush=(...Y)=>this.chain(new $4(Y,this.commandOptions));scriptLoad=(...Y)=>this.chain(new Q4(Y,this.commandOptions));sdiff=(...Y)=>this.chain(new G4(Y,this.commandOptions));sdiffstore=(...Y)=>this.chain(new V4(Y,this.commandOptions));set=(Y,W,$)=>this.chain(new D4([Y,W,$],this.commandOptions));setbit=(...Y)=>this.chain(new z4(Y,this.commandOptions));setex=(Y,W,$)=>this.chain(new T4([Y,W,$],this.commandOptions));setnx=(Y,W)=>this.chain(new H4([Y,W],this.commandOptions));setrange=(...Y)=>this.chain(new Z4(Y,this.commandOptions));sinter=(...Y)=>this.chain(new X4(Y,this.commandOptions));sintercard=(...Y)=>this.chain(new M4(Y,this.commandOptions));sinterstore=(...Y)=>this.chain(new h4(Y,this.commandOptions));sismember=(Y,W)=>this.chain(new w4([Y,W],this.commandOptions));smembers=(...Y)=>this.chain(new E4(Y,this.commandOptions));smismember=(Y,W)=>this.chain(new L4([Y,W],this.commandOptions));smove=(Y,W,$)=>this.chain(new U4([Y,W,$],this.commandOptions));spop=(...Y)=>this.chain(new K4(Y,this.commandOptions));srandmember=(...Y)=>this.chain(new J4(Y,this.commandOptions));srem=(Y,...W)=>this.chain(new N4([Y,...W],this.commandOptions));sscan=(...Y)=>this.chain(new P4(Y,this.commandOptions));strlen=(...Y)=>this.chain(new F4(Y,this.commandOptions));sunion=(...Y)=>this.chain(new _4(Y,this.commandOptions));sunionstore=(...Y)=>this.chain(new j4(Y,this.commandOptions));time=()=>this.chain(new A4(this.commandOptions));touch=(...Y)=>this.chain(new B4(Y,this.commandOptions));ttl=(...Y)=>this.chain(new I4(Y,this.commandOptions));type=(...Y)=>this.chain(new S4(Y,this.commandOptions));unlink=(...Y)=>this.chain(new q4(Y,this.commandOptions));zadd=(...Y)=>{if("score"in Y[1])return this.chain(new A([Y[0],Y[1],...Y.slice(2)],this.commandOptions));return this.chain(new A([Y[0],Y[1],...Y.slice(2)],this.commandOptions))};xadd=(...Y)=>this.chain(new R4(Y,this.commandOptions));xack=(...Y)=>this.chain(new b4(Y,this.commandOptions));xackdel=(...Y)=>this.chain(new x4(Y,this.commandOptions));xdel=(...Y)=>this.chain(new f4(Y,this.commandOptions));xdelex=(...Y)=>this.chain(new k4(Y,this.commandOptions));xgroup=(...Y)=>this.chain(new l4(Y,this.commandOptions));xread=(...Y)=>this.chain(new g4(Y,this.commandOptions));xreadgroup=(...Y)=>this.chain(new c4(Y,this.commandOptions));xinfo=(...Y)=>this.chain(new y4(Y,this.commandOptions));xlen=(...Y)=>this.chain(new u4(Y,this.commandOptions));xpending=(...Y)=>this.chain(new C4(Y,this.commandOptions));xclaim=(...Y)=>this.chain(new v4(Y,this.commandOptions));xautoclaim=(...Y)=>this.chain(new O4(Y,this.commandOptions));xtrim=(...Y)=>this.chain(new n4(Y,this.commandOptions));xrange=(...Y)=>this.chain(new i4(Y,this.commandOptions));xrevrange=(...Y)=>this.chain(new p4(Y,this.commandOptions));zcard=(...Y)=>this.chain(new t4(Y,this.commandOptions));zcount=(...Y)=>this.chain(new d4(Y,this.commandOptions));zincrby=(Y,W,$)=>this.chain(new r4([Y,W,$],this.commandOptions));zinterstore=(...Y)=>this.chain(new e4(Y,this.commandOptions));zlexcount=(...Y)=>this.chain(new o4(Y,this.commandOptions));zmscore=(...Y)=>this.chain(new XW(Y,this.commandOptions));zpopmax=(...Y)=>this.chain(new a4(Y,this.commandOptions));zpopmin=(...Y)=>this.chain(new m4(Y,this.commandOptions));zrange=(...Y)=>this.chain(new s4(Y,this.commandOptions));zrank=(Y,W)=>this.chain(new YW([Y,W],this.commandOptions));zrem=(Y,...W)=>this.chain(new WW([Y,...W],this.commandOptions));zremrangebylex=(...Y)=>this.chain(new $W(Y,this.commandOptions));zremrangebyrank=(...Y)=>this.chain(new QW(Y,this.commandOptions));zremrangebyscore=(...Y)=>this.chain(new GW(Y,this.commandOptions));zrevrank=(Y,W)=>this.chain(new VW([Y,W],this.commandOptions));zscan=(...Y)=>this.chain(new DW(Y,this.commandOptions));zscore=(Y,W)=>this.chain(new zW([Y,W],this.commandOptions));zunionstore=(...Y)=>this.chain(new HW(Y,this.commandOptions));zunion=(...Y)=>this.chain(new TW(Y,this.commandOptions));get json(){return{arrappend:(...Y)=>this.chain(new o0(Y,this.commandOptions)),arrindex:(...Y)=>this.chain(new a0(Y,this.commandOptions)),arrinsert:(...Y)=>this.chain(new m0(Y,this.commandOptions)),arrlen:(...Y)=>this.chain(new s0(Y,this.commandOptions)),arrpop:(...Y)=>this.chain(new YY(Y,this.commandOptions)),arrtrim:(...Y)=>this.chain(new WY(Y,this.commandOptions)),clear:(...Y)=>this.chain(new $Y(Y,this.commandOptions)),del:(...Y)=>this.chain(new QY(Y,this.commandOptions)),forget:(...Y)=>this.chain(new GY(Y,this.commandOptions)),get:(...Y)=>this.chain(new VY(Y,this.commandOptions)),merge:(...Y)=>this.chain(new DY(Y,this.commandOptions)),mget:(...Y)=>this.chain(new zY(Y,this.commandOptions)),mset:(...Y)=>this.chain(new TY(Y,this.commandOptions)),numincrby:(...Y)=>this.chain(new HY(Y,this.commandOptions)),nummultby:(...Y)=>this.chain(new ZY(Y,this.commandOptions)),objkeys:(...Y)=>this.chain(new XY(Y,this.commandOptions)),objlen:(...Y)=>this.chain(new MY(Y,this.commandOptions)),resp:(...Y)=>this.chain(new hY(Y,this.commandOptions)),set:(...Y)=>this.chain(new wY(Y,this.commandOptions)),strappend:(...Y)=>this.chain(new EY(Y,this.commandOptions)),strlen:(...Y)=>this.chain(new LY(Y,this.commandOptions)),toggle:(...Y)=>this.chain(new UY(Y,this.commandOptions)),type:(...Y)=>this.chain(new KY(Y,this.commandOptions))}}get functions(){return{load:(...Y)=>this.chain(new D0(Y,this.commandOptions)),list:(...Y)=>this.chain(new V0(Y,this.commandOptions)),delete:(...Y)=>this.chain(new Q0(Y,this.commandOptions)),flush:()=>this.chain(new G0(this.commandOptions)),stats:()=>this.chain(new z0(this.commandOptions)),call:(...Y)=>this.chain(new s1(Y,this.commandOptions)),callRo:(...Y)=>this.chain(new Y0(Y,this.commandOptions))}}},W1=1000,N$=new Set(["arcount","arget","argetrange","argrep","arinfo","arlastitems","arlen","armget","arnext","arop","arscan","get","getrange","mget","strlen","bitcount","bitpos","getbit","hexists","hget","hgetall","hkeys","hlen","hmget","hrandfield","hscan","hstrlen","httl","hvals","hexpiretime","hpexpiretime","hpttl","lindex","llen","lpos","lrange","scard","sdiff","sinter","sintercard","sismember","smembers","smismember","srandmember","sscan","sunion","zcard","zcount","zlexcount","zmscore","zrange","zrank","zrevrank","zscan","zscore","zunion","exists","type","ttl","pttl","randomkey","touch","pfcount","xinfo","xlen","xpending","xrange","xread","xrevrange","geodist","geohash","geopos","geosearch","scriptExists","evalRo","evalshaRo","dbsize","echo","ping","time","scan","keys","arrindex","arrlen","objkeys","objlen","resp","list","stats","callRo"]),P$=new Set(["scan","keys","flushdb","flushall","dbsize","hscan","hgetall","hkeys","lrange","sscan","smembers","xrange","xrevrange","zscan","zrange","exec"]);function l(Y,W="root"){let $=Y;if(!$.autoPipelineExecutor)$.autoPipelineExecutor=new F$($);return new Proxy($,{get:(Q,G)=>{if(G==="pipelineCounter")return Q.autoPipelineExecutor.pipelineCounter;if(W==="root"&&G==="json")return l(Q,"json");if(W==="root"&&G==="functions")return l(Q,"functions");if(W==="root"){let H=G in Q&&!(G in Q.autoPipelineExecutor.pipeline),Z=P$.has(G);if(H||Z)return Q[G]}let D=Q.autoPipelineExecutor.pipeline,z=W==="json"?D.json[G]:W==="functions"?D.functions[G]:D[G];if(typeof z==="function")return(...H)=>{let Z=N$.has(G)?"read":"write";return Q.autoPipelineExecutor.withAutoPipeline(Z,(X)=>{(W==="json"?X.json[G]:W==="functions"?X.functions[G]:X[G])(...H)})};return z}})}var F$=class{pipelinePromises=new WeakMap;activeReadPipeline=null;activeWritePipeline=null;readIndex=0;writeIndex=0;redis;pipeline;pipelineCounter=0;constructor(Y){this.redis=Y,this.pipeline=Y.pipeline()}async withAutoPipeline(Y,W){let $=Y==="read",Q=$?this.activeReadPipeline:this.activeWritePipeline,G=Q??this.redis.pipeline();if(!Q)if($)this.activeReadPipeline=G,this.readIndex=0;else this.activeWritePipeline=G,this.writeIndex=0;let D=$?this.readIndex++:this.writeIndex++;if(W(G),$&&this.readIndex>=W1)this.activeReadPipeline=null;else if(!$&&this.writeIndex>=W1)this.activeWritePipeline=null;let H=(await this.deferExecution().then(()=>{if(!this.pipelinePromises.has(G)){let Z=G.exec({keepErrors:!0});if(this.pipelineCounter+=1,this.pipelinePromises.set(G,Z),this.activeReadPipeline===G)this.activeReadPipeline=null;if(this.activeWritePipeline===G)this.activeWritePipeline=null}return this.pipelinePromises.get(G)}))[D];if(H.error)throw new J(`Command failed: ${H.error}`);return H.result}async deferExecution(){await Promise.resolve(),await Promise.resolve()}},_$=class extends V{constructor(Y,W){let $={Accept:"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};super([],{...W,headers:$,path:["psubscribe",...Y],streamOptions:{isStreaming:!0,onMessage:W?.streamOptions?.onMessage,signal:W?.streamOptions?.signal}})}},$1=class extends EventTarget{subscriptions;client;listeners;opts;constructor(Y,W,$=!1,Q){super();this.client=Y,this.subscriptions=new Map,this.listeners=new Map,this.opts=Q;for(let G of W)if($)this.subscribeToPattern(G);else this.subscribeToChannel(G)}subscribeToChannel(Y){let W=new AbortController,$=new j$([Y],{streamOptions:{signal:W.signal,onMessage:(Q)=>this.handleMessage(Q,!1)}});$.exec(this.client).catch((Q)=>{if(Q.name!=="AbortError")this.dispatchToListeners("error",Q)}),this.subscriptions.set(Y,{command:$,controller:W,isPattern:!1})}subscribeToPattern(Y){let W=new AbortController,$=new _$([Y],{streamOptions:{signal:W.signal,onMessage:(Q)=>this.handleMessage(Q,!0)}});$.exec(this.client).catch((Q)=>{if(Q.name!=="AbortError")this.dispatchToListeners("error",Q)}),this.subscriptions.set(Y,{command:$,controller:W,isPattern:!0})}handleMessage(Y,W){let $=Y.replace(/^data:\s*/,""),Q=$.indexOf(","),G=$.indexOf(",",Q+1),D=W?$.indexOf(",",G+1):-1;if(Q!==-1&&G!==-1){let z=$.slice(0,Q);if(W&&z==="pmessage"&&D!==-1){let T=$.slice(Q+1,G),H=$.slice(G+1,D),Z=$.slice(D+1);try{let X=this.opts?.automaticDeserialization===!1?Z:JSON.parse(Z);this.dispatchToListeners("pmessage",{pattern:T,channel:H,message:X}),this.dispatchToListeners(`pmessage:${T}`,{pattern:T,channel:H,message:X})}catch(X){this.dispatchToListeners("error",Error(`Failed to parse message: ${X}`))}}else{let T=$.slice(Q+1,G),H=$.slice(G+1);try{if(z==="subscribe"||z==="psubscribe"||z==="unsubscribe"||z==="punsubscribe"){let Z=Number.parseInt(H);this.dispatchToListeners(z,Z)}else{let Z=this.opts?.automaticDeserialization===!1?H:A$(H);this.dispatchToListeners(z,{channel:T,message:Z}),this.dispatchToListeners(`${z}:${T}`,{channel:T,message:Z})}}catch(Z){this.dispatchToListeners("error",Error(`Failed to parse message: ${Z}`))}}}}dispatchToListeners(Y,W){let $=this.listeners.get(Y);if($)for(let Q of $)Q(W)}on(Y,W){if(!this.listeners.has(Y))this.listeners.set(Y,new Set);this.listeners.get(Y)?.add(W)}removeAllListeners(){this.listeners.clear()}async unsubscribe(Y){if(Y)for(let W of Y){let $=this.subscriptions.get(W);if($){try{$.controller.abort()}catch{}this.subscriptions.delete(W)}}else{for(let W of this.subscriptions.values())try{W.controller.abort()}catch{}this.subscriptions.clear(),this.removeAllListeners()}}getSubscribedChannels(){return[...this.subscriptions.keys()]}},j$=class extends V{constructor(Y,W){let $={Accept:"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};super([],{...W,headers:$,path:["subscribe",...Y],streamOptions:{isStreaming:!0,onMessage:W?.streamOptions?.onMessage,signal:W?.streamOptions?.signal}})}},A$=(Y)=>{try{return JSON.parse(Y)}catch{return Y}},B$=class{script;sha1;initPromise;redis;constructor(Y,W){this.redis=Y,this.script=W,this.sha1="",this.init(W)}init(Y){if(!this.initPromise)this.initPromise=this.digest(Y).then((W)=>{this.sha1=W});return this.initPromise}async eval(Y,W){return await this.init(this.script),await this.redis.eval(this.script,Y,W)}async evalsha(Y,W){return await this.init(this.script),await this.redis.evalsha(this.sha1,Y,W)}async exec(Y,W){return await this.init(this.script),await this.redis.evalsha(this.sha1,Y,W).catch(async(Q)=>{if(Q instanceof Error&&Q.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,Y,W);throw Q})}async digest(Y){let W=new TextEncoder().encode(Y),$=await _.digest("SHA-1",W);return[...new Uint8Array($)].map((G)=>G.toString(16).padStart(2,"0")).join("")}},I$=class{script;sha1;initPromise;redis;constructor(Y,W){this.redis=Y,this.sha1="",this.script=W,this.init(W)}init(Y){if(!this.initPromise)this.initPromise=this.digest(Y).then((W)=>{this.sha1=W});return this.initPromise}async evalRo(Y,W){return await this.init(this.script),await this.redis.evalRo(this.script,Y,W)}async evalshaRo(Y,W){return await this.init(this.script),await this.redis.evalshaRo(this.sha1,Y,W)}async exec(Y,W){return await this.init(this.script),await this.redis.evalshaRo(this.sha1,Y,W).catch(async(Q)=>{if(Q instanceof Error&&Q.message.toLowerCase().includes("noscript"))return await this.redis.evalRo(this.script,Y,W);throw Q})}async digest(Y){let W=new TextEncoder().encode(Y),$=await _.digest("SHA-1",W);return[...new Uint8Array($)].map((G)=>G.toString(16).padStart(2,"0")).join("")}},MW=class{client;opts;enableTelemetry;enableAutoPipelining;constructor(Y,W){if(this.client=Y,this.opts=W,this.enableTelemetry=W?.enableTelemetry??!0,W?.readYourWrites===!1)this.client.readYourWrites=!1;this.enableAutoPipelining=W?.enableAutoPipelining??!0}get readYourWritesSyncToken(){return this.client.upstashSyncToken}set readYourWritesSyncToken(Y){this.client.upstashSyncToken=Y}get json(){return{arrappend:(...Y)=>new o0(Y,this.opts).exec(this.client),arrindex:(...Y)=>new a0(Y,this.opts).exec(this.client),arrinsert:(...Y)=>new m0(Y,this.opts).exec(this.client),arrlen:(...Y)=>new s0(Y,this.opts).exec(this.client),arrpop:(...Y)=>new YY(Y,this.opts).exec(this.client),arrtrim:(...Y)=>new WY(Y,this.opts).exec(this.client),clear:(...Y)=>new $Y(Y,this.opts).exec(this.client),del:(...Y)=>new QY(Y,this.opts).exec(this.client),forget:(...Y)=>new GY(Y,this.opts).exec(this.client),get:(...Y)=>new VY(Y,this.opts).exec(this.client),merge:(...Y)=>new DY(Y,this.opts).exec(this.client),mget:(...Y)=>new zY(Y,this.opts).exec(this.client),mset:(...Y)=>new TY(Y,this.opts).exec(this.client),numincrby:(...Y)=>new HY(Y,this.opts).exec(this.client),nummultby:(...Y)=>new ZY(Y,this.opts).exec(this.client),objkeys:(...Y)=>new XY(Y,this.opts).exec(this.client),objlen:(...Y)=>new MY(Y,this.opts).exec(this.client),resp:(...Y)=>new hY(Y,this.opts).exec(this.client),set:(...Y)=>new wY(Y,this.opts).exec(this.client),strappend:(...Y)=>new EY(Y,this.opts).exec(this.client),strlen:(...Y)=>new LY(Y,this.opts).exec(this.client),toggle:(...Y)=>new UY(Y,this.opts).exec(this.client),type:(...Y)=>new KY(Y,this.opts).exec(this.client)}}get functions(){return{load:(...Y)=>new D0(Y,this.opts).exec(this.client),list:(...Y)=>new V0(Y,this.opts).exec(this.client),delete:(...Y)=>new Q0(Y,this.opts).exec(this.client),flush:()=>new G0(this.opts).exec(this.client),stats:()=>new z0(this.opts).exec(this.client),call:(...Y)=>new s1(Y,this.opts).exec(this.client),callRo:(...Y)=>new Y0(Y,this.opts).exec(this.client)}}use=(Y)=>{let W=this.client.request.bind(this.client);this.client.request=($)=>Y($,W)};addTelemetry=(Y)=>{if(!this.enableTelemetry)return;try{this.client.mergeTelemetry(Y)}catch{}};createScript(Y,W){return W?.readonly?new I$(this,Y):new B$(this,Y)}get search(){return{createIndex:(Y)=>{return nW(this.client,Y)},index:(Y)=>{return h1(this.client,Y)},alias:{list:()=>{return tW(this.client)},add:({indexName:Y,alias:W})=>{return dW(this.client,{indexName:Y,alias:W})},delete:({alias:Y})=>{return rW(this.client,{alias:Y})}}}}get vector(){return{createIndex:(Y)=>{return z$(this.client,Y,this.opts)},index:(Y)=>{return T$(this.client,Y,this.opts)}}}pipeline=()=>new Y1({client:this.client,commandOptions:this.opts,multiExec:!1});autoPipeline=()=>{return l(this)};multi=()=>new Y1({client:this.client,commandOptions:this.opts,multiExec:!0});bitfield=(...Y)=>new k1(Y,this.client,this.opts);append=(...Y)=>new L1(Y,this.opts).exec(this.client);arcount=(...Y)=>new U1(Y,this.opts).exec(this.client);ardel=(...Y)=>new K1(Y,this.opts).exec(this.client);ardelrange=(...Y)=>new J1(Y,this.opts).exec(this.client);arget=(...Y)=>new N1(Y,this.opts).exec(this.client);argetrange=(...Y)=>new P1(Y,this.opts).exec(this.client);argrep=(Y,W,$,Q)=>new F1([Y,W,$,Q],this.opts).exec(this.client);arinfo=(...Y)=>new _1(Y,this.opts).exec(this.client);arinsert=(Y,...W)=>new j1([Y,...W],this.opts).exec(this.client);arlastitems=(...Y)=>new A1(Y,this.opts).exec(this.client);arlen=(...Y)=>new B1(Y,this.opts).exec(this.client);armget=(...Y)=>new I1(Y,this.opts).exec(this.client);armset=(Y,W)=>new S1([Y,W],this.opts).exec(this.client);arnext=(...Y)=>new q1(Y,this.opts).exec(this.client);arop=(Y,W,$,Q)=>new b1([Y,W,$,Q],this.opts).exec(this.client);arring=(Y,W,...$)=>new x1([Y,W,...$],this.opts).exec(this.client);arscan=(...Y)=>new R1(Y,this.opts).exec(this.client);arseek=(...Y)=>new O1(Y,this.opts).exec(this.client);arset=(Y,W,...$)=>new v1([Y,W,...$],this.opts).exec(this.client);bitcount=(...Y)=>new f1(Y,this.opts).exec(this.client);bitop=(Y,W,$,...Q)=>new l1([Y,W,$,...Q],this.opts).exec(this.client);bitpos=(...Y)=>new y1(Y,this.opts).exec(this.client);clientSetinfo=(...Y)=>new u1(Y,this.opts).exec(this.client);copy=(...Y)=>new C1(Y,this.opts).exec(this.client);dbsize=()=>new i1(this.opts).exec(this.client);decr=(...Y)=>new g1(Y,this.opts).exec(this.client);decrby=(...Y)=>new c1(Y,this.opts).exec(this.client);del=(...Y)=>new p1(Y,this.opts).exec(this.client);echo=(...Y)=>new n1(Y,this.opts).exec(this.client);evalRo=(...Y)=>new t1(Y,this.opts).exec(this.client);eval=(...Y)=>new d1(Y,this.opts).exec(this.client);evalshaRo=(...Y)=>new r1(Y,this.opts).exec(this.client);evalsha=(...Y)=>new e1(Y,this.opts).exec(this.client);exec=(Y)=>new E(Y,this.opts).exec(this.client);exists=(...Y)=>new o1(Y,this.opts).exec(this.client);expire=(...Y)=>new a1(Y,this.opts).exec(this.client);expireat=(...Y)=>new m1(Y,this.opts).exec(this.client);flushall=(Y)=>new W0(Y,this.opts).exec(this.client);flushdb=(...Y)=>new $0(Y,this.opts).exec(this.client);geoadd=(...Y)=>new T0(Y,this.opts).exec(this.client);geopos=(...Y)=>new X0(Y,this.opts).exec(this.client);geodist=(...Y)=>new H0(Y,this.opts).exec(this.client);geohash=(...Y)=>new Z0(Y,this.opts).exec(this.client);geosearch=(...Y)=>new M0(Y,this.opts).exec(this.client);geosearchstore=(...Y)=>new h0(Y,this.opts).exec(this.client);get=(...Y)=>new w0(Y,this.opts).exec(this.client);getbit=(...Y)=>new E0(Y,this.opts).exec(this.client);getdel=(...Y)=>new L0(Y,this.opts).exec(this.client);getex=(...Y)=>new U0(Y,this.opts).exec(this.client);getrange=(...Y)=>new K0(Y,this.opts).exec(this.client);getset=(Y,W)=>new J0([Y,W],this.opts).exec(this.client);hdel=(...Y)=>new N0(Y,this.opts).exec(this.client);hexists=(...Y)=>new P0(Y,this.opts).exec(this.client);hexpire=(...Y)=>new F0(Y,this.opts).exec(this.client);hexpireat=(...Y)=>new _0(Y,this.opts).exec(this.client);hexpiretime=(...Y)=>new j0(Y,this.opts).exec(this.client);httl=(...Y)=>new n0(Y,this.opts).exec(this.client);hpexpire=(...Y)=>new B0(Y,this.opts).exec(this.client);hpexpireat=(...Y)=>new I0(Y,this.opts).exec(this.client);hpexpiretime=(...Y)=>new S0(Y,this.opts).exec(this.client);hpttl=(...Y)=>new q0(Y,this.opts).exec(this.client);hpersist=(...Y)=>new A0(Y,this.opts).exec(this.client);hget=(...Y)=>new b0(Y,this.opts).exec(this.client);hgetall=(...Y)=>new x0(Y,this.opts).exec(this.client);hgetdel=(...Y)=>new O0(Y,this.opts).exec(this.client);hgetex=(...Y)=>new v0(Y,this.opts).exec(this.client);hincrby=(...Y)=>new f0(Y,this.opts).exec(this.client);hincrbyfloat=(...Y)=>new k0(Y,this.opts).exec(this.client);hkeys=(...Y)=>new l0(Y,this.opts).exec(this.client);hlen=(...Y)=>new y0(Y,this.opts).exec(this.client);hmget=(...Y)=>new R0(Y,this.opts).exec(this.client);hmset=(Y,W)=>new u0([Y,W],this.opts).exec(this.client);hrandfield=(Y,W,$)=>new E1([Y,W,$],this.opts).exec(this.client);hscan=(...Y)=>new C0(Y,this.opts).exec(this.client);hset=(Y,W)=>new i0([Y,W],this.opts).exec(this.client);hsetex=(...Y)=>new g0(Y,this.opts).exec(this.client);hsetnx=(Y,W,$)=>new c0([Y,W,$],this.opts).exec(this.client);hstrlen=(...Y)=>new p0(Y,this.opts).exec(this.client);hvals=(...Y)=>new t0(Y,this.opts).exec(this.client);incr=(...Y)=>new d0(Y,this.opts).exec(this.client);incrby=(...Y)=>new r0(Y,this.opts).exec(this.client);incrbyfloat=(...Y)=>new e0(Y,this.opts).exec(this.client);keys=(...Y)=>new JY(Y,this.opts).exec(this.client);lindex=(...Y)=>new NY(Y,this.opts).exec(this.client);linsert=(Y,W,$,Q)=>new PY([Y,W,$,Q],this.opts).exec(this.client);llen=(...Y)=>new FY(Y,this.opts).exec(this.client);lmove=(...Y)=>new _Y(Y,this.opts).exec(this.client);lpop=(...Y)=>new AY(Y,this.opts).exec(this.client);lmpop=(...Y)=>new jY(Y,this.opts).exec(this.client);lpos=(...Y)=>new BY(Y,this.opts).exec(this.client);lpush=(Y,...W)=>new IY([Y,...W],this.opts).exec(this.client);lpushx=(Y,...W)=>new SY([Y,...W],this.opts).exec(this.client);lrange=(...Y)=>new qY(Y,this.opts).exec(this.client);lrem=(Y,W,$)=>new bY([Y,W,$],this.opts).exec(this.client);lset=(Y,W,$)=>new xY([Y,W,$],this.opts).exec(this.client);ltrim=(...Y)=>new RY(Y,this.opts).exec(this.client);mget=(...Y)=>new OY(Y,this.opts).exec(this.client);mset=(Y)=>new vY([Y],this.opts).exec(this.client);msetnx=(Y)=>new fY([Y],this.opts).exec(this.client);persist=(...Y)=>new kY(Y,this.opts).exec(this.client);pexpire=(...Y)=>new lY(Y,this.opts).exec(this.client);pexpireat=(...Y)=>new yY(Y,this.opts).exec(this.client);pfadd=(...Y)=>new uY(Y,this.opts).exec(this.client);pfcount=(...Y)=>new CY(Y,this.opts).exec(this.client);pfmerge=(...Y)=>new iY(Y,this.opts).exec(this.client);ping=(Y)=>new gY(Y,this.opts).exec(this.client);psetex=(Y,W,$)=>new cY([Y,W,$],this.opts).exec(this.client);psubscribe=(Y)=>{let W=Array.isArray(Y)?Y:[Y];return new $1(this.client,W,!0,this.opts)};pttl=(...Y)=>new pY(Y,this.opts).exec(this.client);publish=(...Y)=>new nY(Y,this.opts).exec(this.client);randomkey=()=>new tY().exec(this.client);rename=(...Y)=>new dY(Y,this.opts).exec(this.client);renamenx=(...Y)=>new rY(Y,this.opts).exec(this.client);rpop=(...Y)=>new eY(Y,this.opts).exec(this.client);rpush=(Y,...W)=>new oY([Y,...W],this.opts).exec(this.client);rpushx=(Y,...W)=>new aY([Y,...W],this.opts).exec(this.client);sadd=(Y,W,...$)=>new mY([Y,W,...$],this.opts).exec(this.client);scan(Y,W){return new sY([Y,W],this.opts).exec(this.client)}scard=(...Y)=>new Y4(Y,this.opts).exec(this.client);scriptExists=(...Y)=>new W4(Y,this.opts).exec(this.client);scriptFlush=(...Y)=>new $4(Y,this.opts).exec(this.client);scriptLoad=(...Y)=>new Q4(Y,this.opts).exec(this.client);sdiff=(...Y)=>new G4(Y,this.opts).exec(this.client);sdiffstore=(...Y)=>new V4(Y,this.opts).exec(this.client);set=(Y,W,$)=>new D4([Y,W,$],this.opts).exec(this.client);setbit=(...Y)=>new z4(Y,this.opts).exec(this.client);setex=(Y,W,$)=>new T4([Y,W,$],this.opts).exec(this.client);setnx=(Y,W)=>new H4([Y,W],this.opts).exec(this.client);setrange=(...Y)=>new Z4(Y,this.opts).exec(this.client);sinter=(...Y)=>new X4(Y,this.opts).exec(this.client);sintercard=(...Y)=>new M4(Y,this.opts).exec(this.client);sinterstore=(...Y)=>new h4(Y,this.opts).exec(this.client);sismember=(Y,W)=>new w4([Y,W],this.opts).exec(this.client);smismember=(Y,W)=>new L4([Y,W],this.opts).exec(this.client);smembers=(...Y)=>new E4(Y,this.opts).exec(this.client);smove=(Y,W,$)=>new U4([Y,W,$],this.opts).exec(this.client);spop=(...Y)=>new K4(Y,this.opts).exec(this.client);srandmember=(...Y)=>new J4(Y,this.opts).exec(this.client);srem=(Y,...W)=>new N4([Y,...W],this.opts).exec(this.client);sscan=(...Y)=>new P4(Y,this.opts).exec(this.client);strlen=(...Y)=>new F4(Y,this.opts).exec(this.client);subscribe=(Y)=>{let W=Array.isArray(Y)?Y:[Y];return new $1(this.client,W,!1,this.opts)};sunion=(...Y)=>new _4(Y,this.opts).exec(this.client);sunionstore=(...Y)=>new j4(Y,this.opts).exec(this.client);time=()=>new A4().exec(this.client);touch=(...Y)=>new B4(Y,this.opts).exec(this.client);ttl=(...Y)=>new I4(Y,this.opts).exec(this.client);type=(...Y)=>new S4(Y,this.opts).exec(this.client);unlink=(...Y)=>new q4(Y,this.opts).exec(this.client);xadd=(...Y)=>new R4(Y,this.opts).exec(this.client);xack=(...Y)=>new b4(Y,this.opts).exec(this.client);xackdel=(...Y)=>new x4(Y,this.opts).exec(this.client);xdel=(...Y)=>new f4(Y,this.opts).exec(this.client);xdelex=(...Y)=>new k4(Y,this.opts).exec(this.client);xgroup=(...Y)=>new l4(Y,this.opts).exec(this.client);xread=(...Y)=>new g4(Y,this.opts).exec(this.client);xreadgroup=(...Y)=>new c4(Y,this.opts).exec(this.client);xinfo=(...Y)=>new y4(Y,this.opts).exec(this.client);xlen=(...Y)=>new u4(Y,this.opts).exec(this.client);xpending=(...Y)=>new C4(Y,this.opts).exec(this.client);xclaim=(...Y)=>new v4(Y,this.opts).exec(this.client);xautoclaim=(...Y)=>new O4(Y,this.opts).exec(this.client);xtrim=(...Y)=>new n4(Y,this.opts).exec(this.client);xrange=(...Y)=>new i4(Y,this.opts).exec(this.client);xrevrange=(...Y)=>new p4(Y,this.opts).exec(this.client);zadd=(...Y)=>{if("score"in Y[1])return new A([Y[0],Y[1],...Y.slice(2)],this.opts).exec(this.client);return new A([Y[0],Y[1],...Y.slice(2)],this.opts).exec(this.client)};zcard=(...Y)=>new t4(Y,this.opts).exec(this.client);zcount=(...Y)=>new d4(Y,this.opts).exec(this.client);zdiffstore=(...Y)=>new ZW(Y,this.opts).exec(this.client);zincrby=(Y,W,$)=>new r4([Y,W,$],this.opts).exec(this.client);zinterstore=(...Y)=>new e4(Y,this.opts).exec(this.client);zlexcount=(...Y)=>new o4(Y,this.opts).exec(this.client);zmscore=(...Y)=>new XW(Y,this.opts).exec(this.client);zpopmax=(...Y)=>new a4(Y,this.opts).exec(this.client);zpopmin=(...Y)=>new m4(Y,this.opts).exec(this.client);zrange=(...Y)=>new s4(Y,this.opts).exec(this.client);zrank=(Y,W)=>new YW([Y,W],this.opts).exec(this.client);zrem=(Y,...W)=>new WW([Y,...W],this.opts).exec(this.client);zremrangebylex=(...Y)=>new $W(Y,this.opts).exec(this.client);zremrangebyrank=(...Y)=>new QW(Y,this.opts).exec(this.client);zremrangebyscore=(...Y)=>new GW(Y,this.opts).exec(this.client);zrevrank=(Y,W)=>new VW([Y,W],this.opts).exec(this.client);zscan=(...Y)=>new DW(Y,this.opts).exec(this.client);zscore=(Y,W)=>new zW([Y,W],this.opts).exec(this.client);zunion=(...Y)=>new TW(Y,this.opts).exec(this.client);zunionstore=(...Y)=>new HW(Y,this.opts).exec(this.client)},hW="v1.41.0";if(typeof atob>"u")global.atob=(Y)=>Buffer.from(Y,"base64").toString("utf8");var wW=class Y extends MW{constructor(W){if("request"in W){super(W);return}if(!W.url)console.warn("[Upstash Redis] The 'url' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis");else if(W.url.startsWith(" ")||W.url.endsWith(" ")||/\r|\n/.test(W.url))console.warn("[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!");if(!W.token)console.warn("[Upstash Redis] The 'token' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis");else if(W.token.startsWith(" ")||W.token.endsWith(" ")||/\r|\n/.test(W.token))console.warn("[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!");let $=new z1({baseUrl:W.url,retry:W.retry,headers:{authorization:`Bearer ${W.token}`},agent:W.agent,responseEncoding:W.responseEncoding,cache:W.cache??"no-store",signal:W.signal,keepAlive:W.keepAlive,readYourWrites:W.readYourWrites}),Q=typeof process==="object"&&process&&typeof process.env==="object"&&process.env?process.env:{};super($,{automaticDeserialization:W.automaticDeserialization,enableTelemetry:W.enableTelemetry??!Q.UPSTASH_DISABLE_TELEMETRY,latencyLogging:W.latencyLogging,enableAutoPipelining:W.enableAutoPipelining});let G=typeof process==="object"&&process?process.version:void 0;if(this.addTelemetry({runtime:typeof EdgeRuntime==="string"?"edge-light":G?`node@${G}`:"unknown",platform:Q.UPSTASH_CONSOLE?"console":Q.VERCEL?"vercel":Q.AWS_REGION?"aws":"unknown",sdk:`@upstash/redis@${hW}`}),this.enableAutoPipelining)return this.autoPipeline()}static fromEnv(W){if(typeof process!=="object"||!process||typeof process.env!=="object"||!process.env)throw TypeError('[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead');let $=process.env.UPSTASH_REDIS_REST_URL||process.env.KV_REST_API_URL;if(!$)console.warn("[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis");let Q=process.env.UPSTASH_REDIS_REST_TOKEN||process.env.KV_REST_API_TOKEN;if(!Q)console.warn("[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis");return new Y({...W,url:$,token:Q})}};class EW{options;type="cache";name="RedisDriver";tcpClient;httpClient;prefix;logger;constructor(Y){this.options=Y;this.logger=new U}initClients(){if(this.options.protocol==="http")this.httpClient=new wW({url:this.options.url,token:this.options.token});else this.tcpClient=new S$(this.options.connectionString,{lazyConnect:!0,maxRetriesPerRequest:3})}setKeyPrefix(Y){this.prefix=Y}async connect(){if(this.options.protocol=="tcp"){if(!this.tcpClient)this.initClients();if(!this.tcpClient)throw Error("TCP Client could not found");let Y=this.tcpClient.status;if(Y==="end"||Y==="close")this.initClients();if(this.tcpClient.status==="wait")await this.tcpClient.connect(),this.logger.log(`[RedisDriver] : TCP Connected to ${this.options.connectionString}`)}else if(this.options.protocol=="http"){if(!this.httpClient)this.initClients();let Y=await this.httpClient.ping();if(Y.toLowerCase()==="pong")this.logger.log("[RedisDriver] : HTTP REST client initialized.");else this.logger.warn("[RedisDriver] : HTTP REST client initialized, but ping failed with unexpected response:",Y)}}async disconnect(){if(this.options.protocol=="tcp"&&this.tcpClient){let Y=this.tcpClient.status;if(Y!=="end"&&Y!=="close")try{await this.tcpClient.quit(),this.logger.log("[RedisDriver] : TCP Disconnected.")}catch(W){this.tcpClient.disconnect()}}}async healthCheck(){let Y=Date.now();try{if(this.options.protocol==="tcp")await this.tcpClient.ping();else await this.httpClient.ping();return{status:"up",latencyMs:Date.now()-Y}}catch(W){return{status:"down",latencyMs:Date.now()-Y,details:{error:W.message}}}}getNativeClient(Y){if((Y??this.options.protocol)==="tcp"){if(!this.tcpClient)throw Error("[RedisDriver] : TCP client is not initialized.");return this.tcpClient}if(!this.httpClient)throw Error("[RedisDriver] : REST client is not initialized.");return this.httpClient}}export{EW as RedisDriver,e as PulsarUnifiedStorage,o as PostgresDriver};
|
|
401
401
|
/* Powered by NightX - Pulsar Engine */
|
|
402
402
|
|
|
403
|
-
//# debugId=
|
|
403
|
+
//# debugId=2EBC7DC1D9C804F564756E2164756E21
|