mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Merge pull request #27918 from SimonSchick/feat/catbox-redis
feat(catbox-redis): add typings
This commit is contained in:
12
types/catbox-redis/catbox-redis-tests.ts
Normal file
12
types/catbox-redis/catbox-redis-tests.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as CatbotRedis from 'catbox-redis';
|
||||
|
||||
const cache = new CatbotRedis({
|
||||
host: 'localhost',
|
||||
partition: 'test',
|
||||
port: 2018,
|
||||
});
|
||||
|
||||
cache.get({
|
||||
segment: 'test',
|
||||
id: 'test',
|
||||
});
|
||||
60
types/catbox-redis/index.d.ts
vendored
Normal file
60
types/catbox-redis/index.d.ts
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
// Type definitions for catbox-redis 4.1
|
||||
// Project: https://github.com/hapijs/catbox-redis#readme
|
||||
// Definitions by: Simon Schick <https://github.com/SimonSchick>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
// tslint:disable-next-line
|
||||
declare module 'catbox-redis' {
|
||||
import { Redis } from 'ioredis';
|
||||
import { EnginePrototype, ClientOptions, Client } from 'catbox';
|
||||
namespace CatboxRedis {
|
||||
interface CatboxRedisOptions extends ClientOptions {
|
||||
/**
|
||||
* Raw client.
|
||||
*/
|
||||
client?: Redis;
|
||||
/**
|
||||
* the Redis server URL (if url is provided, host, port, and socket are ignored)
|
||||
*/
|
||||
url?: string;
|
||||
/**
|
||||
* the Redis server hostname.
|
||||
* Defaults to '127.0.0.1'.
|
||||
*/
|
||||
host?: string;
|
||||
/**
|
||||
* the Redis server port or unix domain socket path.
|
||||
* Defaults to 6379.
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* the unix socket string to connect to (if socket is provided, host and port are ignored)
|
||||
*/
|
||||
socket?: string;
|
||||
/**
|
||||
* the Redis authentication password when required.
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* the Redis database.
|
||||
*/
|
||||
database?: string;
|
||||
/**
|
||||
* an array of redis sentinel addresses to connect to.
|
||||
*/
|
||||
sentinels?: Array<{
|
||||
host: string;
|
||||
}>;
|
||||
/**
|
||||
* the name of the sentinel master.
|
||||
* (Only needed when sentinels is specified)
|
||||
*/
|
||||
sentinelName?: string;
|
||||
}
|
||||
}
|
||||
class CatboxRedis extends Client {
|
||||
constructor(options: CatboxRedis.CatboxRedisOptions);
|
||||
}
|
||||
export = CatboxRedis;
|
||||
}
|
||||
23
types/catbox-redis/tsconfig.json
Normal file
23
types/catbox-redis/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"catbox-redis-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/catbox-redis/tslint.json
Normal file
1
types/catbox-redis/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
3
types/catbox/index.d.ts
vendored
3
types/catbox/index.d.ts
vendored
@@ -112,6 +112,9 @@ export interface CachedObject {
|
||||
export type CacheItem = any;
|
||||
|
||||
export interface ClientOptions {
|
||||
/**
|
||||
* this will store items under keys that start with this value.
|
||||
*/
|
||||
partition: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user