MCPcopy
hub / github.com/redis/node-redis / _executeScript

Method _executeScript

packages/client/lib/client/index.ts:1250–1272  ·  view source on GitHub ↗

* @internal

(
    script: RedisScript,
    parser: CommandParser,
    options: CommandOptions | undefined,
    transformReply: TransformReply | undefined,
  )

Source from the content-addressed store, hash-verified

1248 * @internal
1249 */
1250 async _executeScript(
1251 script: RedisScript,
1252 parser: CommandParser,
1253 options: CommandOptions | undefined,
1254 transformReply: TransformReply | undefined,
1255 ) {
1256 const args = parser.redisArgs as Array<RedisArgument>;
1257
1258 let reply: ReplyUnion;
1259 try {
1260 reply = await this.sendCommand(args, options);
1261 } catch (err) {
1262 if (!(err as Error)?.message?.startsWith?.('NOSCRIPT')) throw err;
1263
1264 args[0] = 'EVAL';
1265 args[1] = script.SCRIPT;
1266 reply = await this.sendCommand(args, options);
1267 }
1268
1269 return transformReply ?
1270 transformReply(reply, parser.preserve, options?.typeMapping) :
1271 reply;
1272 }
1273
1274 sendCommand<T = ReplyUnion>(
1275 args: ReadonlyArray<RedisArgument>,

Callers 4

#createScriptCommandMethod · 0.95
#createScriptCommandMethod · 0.80
createScriptCommandFunction · 0.80
#createScriptCommandMethod · 0.80

Calls 2

sendCommandMethod · 0.95
transformReplyFunction · 0.50

Tested by

no test coverage detected