New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@types/redlock

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/redlock

TypeScript definitions for redlock

3.0.9
Source
npm
Version published
Maintainers
1
Created
Source

Installation

npm install --save @types/redlock

Summary

This package contains type definitions for redlock (https://github.com/mike-marcacci/node-redlock).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redlock/v3.

index.d.ts

import * as Promise from "bluebird";
import { EventEmitter } from "events";

export = Redlock;

declare namespace Redlock {
    type Callback<T> = (err: any, value?: T) => void;

    class Lock {
        redlock: Redlock;
        resource: string;
        value: string | null;
        expiration: number;
        constructor(redlock: Redlock, resource: string, value: string | null, expiration: number);
        unlock(callback?: Callback<void>): Promise<void>;
        extend(ttl: number, callback?: Callback<Lock>): Promise<Lock>;
    }

    interface Options {
        driftFactor?: number | undefined;
        retryCount?: number | undefined;
        retryDelay?: number | undefined;
        retryJitter?: number | undefined;
        lockScript?(origLockScript: string): string;
        unlockScript?(origUnlockScript: string): string;
        extendScript?(origExtendScript: string): string;
    }

    class LockError extends Error {
        readonly name: "LockError";
        constructor(message?: string);
    }

    type EvalArg = string | number;

    interface CompatibleRedisClient {
        eval(args: EvalArg[], callback?: (err: Error | null, res: any) => void): any;
    }
}

declare class Redlock extends EventEmitter {
    LockError: typeof Redlock.LockError;
    Lock: typeof Redlock.Lock;
    driftFactor: number;
    retryCount: number;
    retryDelay: number;
    retryJitter: number;
    servers: Redlock.CompatibleRedisClient[];

    constructor(clients: Redlock.CompatibleRedisClient[], options?: Redlock.Options);

    acquire(resource: string | string[], ttl: number, callback?: Redlock.Callback<Redlock.Lock>): Promise<Redlock.Lock>;
    lock(resource: string | string[], ttl: number, callback?: Redlock.Callback<Redlock.Lock>): Promise<Redlock.Lock>;

    disposer(resource: string, ttl: number, errorHandler?: Redlock.Callback<void>): Promise.Disposer<Redlock.Lock>;

    release(lock: Redlock.Lock, callback?: Redlock.Callback<void>): Promise<void>;
    unlock(lock: Redlock.Lock, callback?: Redlock.Callback<void>): Promise<void>;

    extend(lock: Redlock.Lock, ttl: number, callback?: Redlock.Callback<Redlock.Lock>): Promise<Redlock.Lock>;

    addListener(event: "clientError", listener: (err: any) => void): this;
    on(event: "clientError", listener: (err: any) => void): this;
    once(event: "clientError", listener: (err: any) => void): this;
    removeListener(event: "clientError", listener: (err: any) => void): this;
}

Additional Details

  • Last updated: Wed, 18 Oct 2023 11:45:06 GMT
  • Dependencies: @types/bluebird

Credits

These definitions were written by Ilya Mochalov, and BendingBender.

FAQs

Package last updated on 18 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts