"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Redis=void 0;const faas_common_sdk_1=require("@alipay/faas-common-sdk"),ioredis_1=require("ioredis"),utils_1=require("../utils");class Redis extends ioredis_1.Redis{#s;#e;constructor(e){if(!e.innerConfig?.functionRedisEndpoint)throw new faas_common_sdk_1.FaasError(40006,"Redis \u670D\u52A1\u672A\u5F00\u901A");const r=e.host,t=e.port??6379,i=e.password,[n,o]=e.innerConfig.functionRedisEndpoint.split(":");if(e.host=n,e.port=parseInt(o),e.password="need-auth-string",super(e),this.#s=e.innerConfig,e.url)this.#e=`!cloudbase:__direct-conn__:${e.url.replace("redis://","")}`;else if(r){const u=e.username??"";this.#e=`!cloudbase:__direct-conn__:${u}:${i}@${r}:${t}`}}auth(...e){return this.#e?e[0]=this.#e:this.#s&&(e[0]=(0,utils_1.authString)(this.#s)),super.auth.apply(this,e)}}exports.Redis=Redis;function forbidden(s){return()=>{throw new Error(`'${s}' is not support, see https://opendocs.alipay.com/cloud/089gv6?pathHash=4325d091`)}}["cluster","readonly","readwrite","keys","migrate","move","wait","psubscribe","pubsub","publish","punsubscribe","subscribe","unsubscribe","bgrewriteaof","bgsave","debug","lastsave","monitor","module","psync","role","save","shutdown","slaveof","sync","discard","exec","multi","unwatch","watch"].forEach(s=>{Redis.prototype[s]=forbidden(s)});