From dd7da2ba3a6b363a7ac3017f8db0953131991a7a Mon Sep 17 00:00:00 2001 From: zzy Date: Wed, 5 Dec 2018 15:05:17 +0800 Subject: [PATCH] dist --- .gitignore | 1 - dist/index.d.ts | 3 +++ dist/index.js | 7 +++++++ dist/redis-client.provider.d.ts | 7 +++++++ dist/redis-client.provider.js | 11 +++++++++++ dist/redis.constants.d.ts | 2 ++ dist/redis.constants.js | 4 ++++ dist/redis.interface.d.ts | 3 +++ dist/redis.interface.js | 2 ++ dist/redis.module.d.ts | 5 +++++ dist/redis.module.js | 29 +++++++++++++++++++++++++++++ dist/redis.service.d.ts | 6 ++++++ dist/redis.service.js | 31 +++++++++++++++++++++++++++++++ 13 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 dist/index.d.ts create mode 100644 dist/index.js create mode 100644 dist/redis-client.provider.d.ts create mode 100644 dist/redis-client.provider.js create mode 100644 dist/redis.constants.d.ts create mode 100644 dist/redis.constants.js create mode 100644 dist/redis.interface.d.ts create mode 100644 dist/redis.interface.js create mode 100644 dist/redis.module.d.ts create mode 100644 dist/redis.module.js create mode 100644 dist/redis.service.d.ts create mode 100644 dist/redis.service.js diff --git a/.gitignore b/.gitignore index 9f27727..398d036 100644 --- a/.gitignore +++ b/.gitignore @@ -63,7 +63,6 @@ uploads/ .gulp-cache src/test .vscode -dist/ logs/ *.thrift *.sql \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..3aae4f1 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,3 @@ +export * from './redis.service'; +export * from './redis.module'; +export * from './redis.interface'; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..7759545 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,7 @@ +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(require("./redis.service")); +__export(require("./redis.module")); diff --git a/dist/redis-client.provider.d.ts b/dist/redis-client.provider.d.ts new file mode 100644 index 0000000..24182ac --- /dev/null +++ b/dist/redis-client.provider.d.ts @@ -0,0 +1,7 @@ +import * as Redis from "ioredis"; +import { RedisModuleOptions } from "./redis.interface"; +export declare const createClient: () => { + provide: symbol; + useFactory: (options: RedisModuleOptions) => Redis.Redis; + inject: symbol[]; +}; diff --git a/dist/redis-client.provider.js b/dist/redis-client.provider.js new file mode 100644 index 0000000..2b3f4ae --- /dev/null +++ b/dist/redis-client.provider.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Redis = require("ioredis"); +const redis_constants_1 = require("./redis.constants"); +exports.createClient = () => ({ + provide: redis_constants_1.REDIS_CLIENT, + useFactory: (options) => { + return new Redis(options); + }, + inject: [redis_constants_1.REDIS_MODULE_OPTIONS] +}); diff --git a/dist/redis.constants.d.ts b/dist/redis.constants.d.ts new file mode 100644 index 0000000..37d8aed --- /dev/null +++ b/dist/redis.constants.d.ts @@ -0,0 +1,2 @@ +export declare const REDIS_MODULE_OPTIONS: unique symbol; +export declare const REDIS_CLIENT: unique symbol; diff --git a/dist/redis.constants.js b/dist/redis.constants.js new file mode 100644 index 0000000..bc59a1e --- /dev/null +++ b/dist/redis.constants.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.REDIS_MODULE_OPTIONS = Symbol('REDIS_MODULE_OPTIONS'); +exports.REDIS_CLIENT = Symbol('REDIS_CLIENT'); diff --git a/dist/redis.interface.d.ts b/dist/redis.interface.d.ts new file mode 100644 index 0000000..a5ef634 --- /dev/null +++ b/dist/redis.interface.d.ts @@ -0,0 +1,3 @@ +import { RedisOptions } from 'ioredis'; +export interface RedisModuleOptions extends RedisOptions { +} diff --git a/dist/redis.interface.js b/dist/redis.interface.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/dist/redis.interface.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/redis.module.d.ts b/dist/redis.module.d.ts new file mode 100644 index 0000000..404bb9e --- /dev/null +++ b/dist/redis.module.d.ts @@ -0,0 +1,5 @@ +import { DynamicModule } from '@nestjs/common'; +import { RedisModuleOptions } from './redis.interface'; +export declare class RedisModule { + static register(options: RedisModuleOptions): DynamicModule; +} diff --git a/dist/redis.module.js b/dist/redis.module.js new file mode 100644 index 0000000..b2878d8 --- /dev/null +++ b/dist/redis.module.js @@ -0,0 +1,29 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var RedisModule_1; +const common_1 = require("@nestjs/common"); +const redis_constants_1 = require("./redis.constants"); +const redis_service_1 = require("./redis.service"); +let RedisModule = RedisModule_1 = class RedisModule { + static register(options) { + return { + module: RedisModule_1, + providers: [ + { provide: redis_constants_1.REDIS_MODULE_OPTIONS, useValue: options } + ] + }; + } +}; +RedisModule = RedisModule_1 = __decorate([ + common_1.Module({ + providers: [redis_service_1.RedisService], + exports: [redis_service_1.RedisService] + }) +], RedisModule); +exports.RedisModule = RedisModule; diff --git a/dist/redis.service.d.ts b/dist/redis.service.d.ts new file mode 100644 index 0000000..2b0d82e --- /dev/null +++ b/dist/redis.service.d.ts @@ -0,0 +1,6 @@ +import * as Redis from "ioredis"; +export declare class RedisService { + private readonly client; + constructor(client: Redis.Redis); + getClient(): Redis.Redis; +} diff --git a/dist/redis.service.js b/dist/redis.service.js new file mode 100644 index 0000000..2feff17 --- /dev/null +++ b/dist/redis.service.js @@ -0,0 +1,31 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const common_1 = require("@nestjs/common"); +const redis_constants_1 = require("./redis.constants"); +const Redis = require("ioredis"); +let RedisService = class RedisService { + constructor(client) { + this.client = client; + } + getClient() { + return this.client; + } +}; +RedisService = __decorate([ + common_1.Injectable(), + __param(0, common_1.Inject(redis_constants_1.REDIS_CLIENT)), + __metadata("design:paramtypes", [Object]) +], RedisService); +exports.RedisService = RedisService;