├── .eslintrc ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── dependabot.yml └── workflows │ ├── release.yml │ └── test.yml ├── .gitignore ├── .npmignore ├── .prettierignore ├── .prettierrc ├── .vscode ├── launch.json └── settings.json ├── .yarn └── releases │ └── yarn-berry.cjs ├── .yarnrc.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── docs ├── .nojekyll ├── assets │ ├── css │ │ └── main.css │ ├── images │ │ ├── icons.png │ │ ├── icons@2x.png │ │ ├── widgets.png │ │ └── widgets@2x.png │ └── js │ │ ├── main.js │ │ └── search.js ├── classes │ ├── module.iomodule.html │ ├── module_core.iocoremodule.html │ └── nestjs_graphql_redis_subscriptions.redispubsub.html ├── index.html ├── interfaces │ ├── module_core.iomoduleasyncoptions.html │ └── nestjs_graphql_redis_subscriptions.redis.html ├── modules.html └── modules │ ├── constants.html │ ├── helpers.html │ ├── module.html │ ├── module_core.html │ └── nestjs_graphql_redis_subscriptions.html ├── package.json ├── src ├── constants.ts ├── helpers.ts ├── index.ts ├── module.core.ts └── module.ts ├── tsconfig.build.json ├── tsconfig.json ├── typedoc.js └── yarn.lock /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true 4 | }, 5 | "parser": "@typescript-eslint/parser", 6 | "parserOptions": { 7 | "project": "./tsconfig.json", 8 | "sourceType": "module" 9 | }, 10 | "ignorePatterns": ["typedoc.js"], 11 | "plugins": ["@typescript-eslint", "prefer-arrow", "import"], 12 | "extends": [ 13 | "eslint:recommended", 14 | "plugin:@typescript-eslint/eslint-recommended", 15 | "plugin:@typescript-eslint/recommended", 16 | "prettier" 17 | ], 18 | "root": true, 19 | "rules": { 20 | "indent": ["error", 4], 21 | "@typescript-eslint/interface-name-prefix": "off", 22 | "@typescript-eslint/explicit-function-return-type": "off", 23 | "@typescript-eslint/no-explicit-any": "off", 24 | "@typescript-eslint/no-unused-vars": "off", 25 | "@typescript-eslint/no-empty-interface": "off" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: ['https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=M754R7Y5FE6DN&source=url'] 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Bug report 4 | about: Create a report to help us improve 5 | title: '' 6 | labels: '' 7 | assignees: '' 8 | ---**Describe the bug** 9 | A clear and concise description of what the bug is. 10 | 11 | **To Reproduce** 12 | Steps to reproduce the behavior: 13 | 14 | 1. Go to '...' 15 | 2. Click on '....' 16 | 3. Scroll down to '....' 17 | 4. See error 18 | 19 | **Expected behavior** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **Screenshots** 23 | If applicable, add screenshots to help explain your problem. 24 | 25 | **OS (please complete the following information):** 26 | 27 | - OS: [e.g. OSX, Linux...] 28 | - Node Version 29 | 30 | **Additional context** 31 | Add any other context about the problem here. 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | # Sequence of patterns matched against refs/tags 4 | tags: 5 | - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 6 | 7 | name: Git Release 8 | 9 | jobs: 10 | build: 11 | name: Create Release 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@master 16 | - name: Create Release 17 | id: create_release 18 | uses: actions/create-release@v1 19 | env: 20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token 21 | with: 22 | tag_name: ${{ github.ref }} 23 | release_name: Release ${{ github.ref }} 24 | draft: false 25 | prerelease: false 26 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | strategy: 10 | matrix: 11 | node-version: [10.x, 11.x, 12.x, 13.x] 12 | 13 | steps: 14 | - uses: actions/checkout@v1 15 | - name: Use Node.js ${{ matrix.node-version }} 16 | uses: actions/setup-node@v1 17 | with: 18 | node-version: ${{ matrix.node-version }} 19 | - name: npm install, build, and test 20 | run: | 21 | yarn install 22 | yarn run lint 23 | yarn run build 24 | yarn run test:cov 25 | - name: Codecov 26 | uses: codecov/codecov-action@v1.0.5 27 | with: 28 | token: ${{ secrets.CODECOV_TOKEN }} 29 | file: ./coverage/coverage-final.json 30 | fail_ci_if_error: true 31 | CI: true 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | coverage 5 | .yarn/cache 6 | .yarn/install* -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | coverage/ 3 | docs/ 4 | src/ 5 | dist/test/ 6 | resources/ 7 | .prettierrc 8 | .prettierignore 9 | .gitignore 10 | tsconfig.json 11 | tsconfig.build.json 12 | typedoc.js 13 | yarn.lock 14 | .vscode 15 | renovate.json 16 | .eslintrc 17 | .github 18 | *.tgz 19 | .yarn* -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.d.ts 2 | **/*.js -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "tabWidth": 4, 4 | "semi": true, 5 | "trailingComma": "none", 6 | "printWidth": 120 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "node", 6 | "request": "attach", 7 | "name": "Attach", 8 | "port": 9229 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "./node_modules/typescript/lib", 3 | "eslint.validate": ["typescript", "javascript"], 4 | "editor.codeActionsOnSave": { 5 | "source.fixAll.eslint": true, 6 | "source.organizeImports": true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | 3 | yarnPath: .yarn/releases/yarn-berry.cjs 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## [0.0.2-alpha.81](https://github.com/COURIIER-TECHNOLOGIES/ops/compare/v0.0.2-alpha.80...v0.0.2-alpha.81) (2019-08-24) 7 | 8 | **Note:** Version bump only for package @couriier/ops-user 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Pop-Code 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nestjs-graphql-redis-subscriptions 2 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pop-Code/nestjs-graphql-redis-subscriptions/7e797b1fa94bc2a08e11ce4f00a0b4c118d92a73/docs/.nojekyll -------------------------------------------------------------------------------- /docs/assets/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pop-Code/nestjs-graphql-redis-subscriptions/7e797b1fa94bc2a08e11ce4f00a0b4c118d92a73/docs/assets/images/icons.png -------------------------------------------------------------------------------- /docs/assets/images/icons@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pop-Code/nestjs-graphql-redis-subscriptions/7e797b1fa94bc2a08e11ce4f00a0b4c118d92a73/docs/assets/images/icons@2x.png -------------------------------------------------------------------------------- /docs/assets/images/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pop-Code/nestjs-graphql-redis-subscriptions/7e797b1fa94bc2a08e11ce4f00a0b4c118d92a73/docs/assets/images/widgets.png -------------------------------------------------------------------------------- /docs/assets/images/widgets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pop-Code/nestjs-graphql-redis-subscriptions/7e797b1fa94bc2a08e11ce4f00a0b4c118d92a73/docs/assets/images/widgets@2x.png -------------------------------------------------------------------------------- /docs/assets/js/search.js: -------------------------------------------------------------------------------- 1 | window.searchData = {"kinds":{"1":"Module","32":"Variable","64":"Function","128":"Class","256":"Interface","512":"Constructor","1024":"Property","2048":"Method","16777216":"Reference"},"rows":[{"id":0,"kind":1,"name":"constants","url":"modules/constants.html","classes":"tsd-kind-module"},{"id":1,"kind":32,"name":"REDIS_CLIENT_TOKEN","url":"modules/constants.html#REDIS_CLIENT_TOKEN","classes":"tsd-kind-variable tsd-parent-kind-module","parent":"constants"},{"id":2,"kind":32,"name":"REDIS_PUB_SUB_TOKEN","url":"modules/constants.html#REDIS_PUB_SUB_TOKEN","classes":"tsd-kind-variable tsd-parent-kind-module","parent":"constants"},{"id":3,"kind":32,"name":"REDIS_PUB_CONFIG_TOKEN","url":"modules/constants.html#REDIS_PUB_CONFIG_TOKEN","classes":"tsd-kind-variable tsd-parent-kind-module","parent":"constants"},{"id":4,"kind":32,"name":"REDIS_SUB_CONFIG_TOKEN","url":"modules/constants.html#REDIS_SUB_CONFIG_TOKEN","classes":"tsd-kind-variable tsd-parent-kind-module","parent":"constants"},{"id":5,"kind":1,"name":"helpers","url":"modules/helpers.html","classes":"tsd-kind-module"},{"id":6,"kind":64,"name":"InjectRedisClient","url":"modules/helpers.html#InjectRedisClient","classes":"tsd-kind-function tsd-parent-kind-module","parent":"helpers"},{"id":7,"kind":64,"name":"InjectRedisPubSub","url":"modules/helpers.html#InjectRedisPubSub","classes":"tsd-kind-function tsd-parent-kind-module","parent":"helpers"},{"id":8,"kind":1,"name":"nestjs-graphql-redis-subscriptions","url":"modules/nestjs_graphql_redis_subscriptions.html","classes":"tsd-kind-module"},{"id":9,"kind":1,"name":"module.core","url":"modules/module_core.html","classes":"tsd-kind-module"},{"id":10,"kind":256,"name":"IOModuleAsyncOptions","url":"interfaces/module_core.IOModuleAsyncOptions.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"module.core"},{"id":11,"kind":2048,"name":"useFactory","url":"interfaces/module_core.IOModuleAsyncOptions.html#useFactory","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"module.core.IOModuleAsyncOptions"},{"id":12,"kind":1024,"name":"inject","url":"interfaces/module_core.IOModuleAsyncOptions.html#inject","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"module.core.IOModuleAsyncOptions"},{"id":13,"kind":128,"name":"IOCoreModule","url":"classes/module_core.IOCoreModule.html","classes":"tsd-kind-class tsd-parent-kind-module","parent":"module.core"},{"id":14,"kind":2048,"name":"registerRedis","url":"classes/module_core.IOCoreModule.html#registerRedis","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"module.core.IOCoreModule"},{"id":15,"kind":2048,"name":"registerRedisPubSub","url":"classes/module_core.IOCoreModule.html#registerRedisPubSub","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"module.core.IOCoreModule"},{"id":16,"kind":512,"name":"constructor","url":"classes/module_core.IOCoreModule.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"module.core.IOCoreModule"},{"id":17,"kind":2048,"name":"onModuleDestroy","url":"classes/module_core.IOCoreModule.html#onModuleDestroy","classes":"tsd-kind-method tsd-parent-kind-class","parent":"module.core.IOCoreModule"},{"id":18,"kind":1,"name":"module","url":"modules/module.html","classes":"tsd-kind-module"},{"id":19,"kind":128,"name":"IOModule","url":"classes/module.IOModule.html","classes":"tsd-kind-class tsd-parent-kind-module","parent":"module"},{"id":20,"kind":2048,"name":"registerRedis","url":"classes/module.IOModule.html#registerRedis","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"module.IOModule"},{"id":21,"kind":2048,"name":"registerRedisPubSub","url":"classes/module.IOModule.html#registerRedisPubSub","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"module.IOModule"},{"id":22,"kind":512,"name":"constructor","url":"classes/module.IOModule.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"module.IOModule"},{"id":23,"kind":16777216,"name":"REDIS_CLIENT_TOKEN","url":"modules/nestjs_graphql_redis_subscriptions.html#REDIS_CLIENT_TOKEN","classes":"tsd-kind-reference tsd-parent-kind-module","parent":"nestjs-graphql-redis-subscriptions"},{"id":24,"kind":16777216,"name":"REDIS_PUB_SUB_TOKEN","url":"modules/nestjs_graphql_redis_subscriptions.html#REDIS_PUB_SUB_TOKEN","classes":"tsd-kind-reference tsd-parent-kind-module","parent":"nestjs-graphql-redis-subscriptions"},{"id":25,"kind":16777216,"name":"REDIS_PUB_CONFIG_TOKEN","url":"modules/nestjs_graphql_redis_subscriptions.html#REDIS_PUB_CONFIG_TOKEN","classes":"tsd-kind-reference tsd-parent-kind-module","parent":"nestjs-graphql-redis-subscriptions"},{"id":26,"kind":16777216,"name":"REDIS_SUB_CONFIG_TOKEN","url":"modules/nestjs_graphql_redis_subscriptions.html#REDIS_SUB_CONFIG_TOKEN","classes":"tsd-kind-reference tsd-parent-kind-module","parent":"nestjs-graphql-redis-subscriptions"},{"id":27,"kind":16777216,"name":"InjectRedisClient","url":"modules/nestjs_graphql_redis_subscriptions.html#InjectRedisClient","classes":"tsd-kind-reference tsd-parent-kind-module","parent":"nestjs-graphql-redis-subscriptions"},{"id":28,"kind":16777216,"name":"InjectRedisPubSub","url":"modules/nestjs_graphql_redis_subscriptions.html#InjectRedisPubSub","classes":"tsd-kind-reference tsd-parent-kind-module","parent":"nestjs-graphql-redis-subscriptions"},{"id":29,"kind":16777216,"name":"IOModule","url":"modules/nestjs_graphql_redis_subscriptions.html#IOModule","classes":"tsd-kind-reference tsd-parent-kind-module","parent":"nestjs-graphql-redis-subscriptions"},{"id":30,"kind":16777216,"name":"IOModuleAsyncOptions","url":"modules/nestjs_graphql_redis_subscriptions.html#IOModuleAsyncOptions","classes":"tsd-kind-reference tsd-parent-kind-module","parent":"nestjs-graphql-redis-subscriptions"},{"id":31,"kind":16777216,"name":"IOCoreModule","url":"modules/nestjs_graphql_redis_subscriptions.html#IOCoreModule","classes":"tsd-kind-reference tsd-parent-kind-module","parent":"nestjs-graphql-redis-subscriptions"}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,18.569]],["parent/0",[]],["name/1",[1,26.74]],["parent/1",[0,2.15]],["name/2",[2,26.74]],["parent/2",[0,2.15]],["name/3",[3,26.74]],["parent/3",[0,2.15]],["name/4",[4,26.74]],["parent/4",[0,2.15]],["name/5",[5,23.253]],["parent/5",[]],["name/6",[6,26.74]],["parent/6",[5,2.692]],["name/7",[7,26.74]],["parent/7",[5,2.692]],["name/8",[8,5.487,9,5.487,10,5.487,11,5.487]],["parent/8",[]],["name/9",[12,23.253]],["parent/9",[]],["name/10",[13,26.74]],["parent/10",[12,2.692]],["name/11",[14,32.034]],["parent/11",[15,3.096]],["name/12",[16,32.034]],["parent/12",[15,3.096]],["name/13",[17,26.74]],["parent/13",[12,2.692]],["name/14",[18,26.74]],["parent/14",[19,2.391]],["name/15",[20,26.74]],["parent/15",[19,2.391]],["name/16",[21,26.74]],["parent/16",[19,2.391]],["name/17",[22,32.034]],["parent/17",[19,2.391]],["name/18",[23,26.74]],["parent/18",[]],["name/19",[24,26.74]],["parent/19",[23,3.096]],["name/20",[18,26.74]],["parent/20",[25,2.692]],["name/21",[20,26.74]],["parent/21",[25,2.692]],["name/22",[21,26.74]],["parent/22",[25,2.692]],["name/23",[1,26.74]],["parent/23",[8,0.734,9,0.734,10,0.734,11,0.734]],["name/24",[2,26.74]],["parent/24",[8,0.734,9,0.734,10,0.734,11,0.734]],["name/25",[3,26.74]],["parent/25",[8,0.734,9,0.734,10,0.734,11,0.734]],["name/26",[4,26.74]],["parent/26",[8,0.734,9,0.734,10,0.734,11,0.734]],["name/27",[6,26.74]],["parent/27",[8,0.734,9,0.734,10,0.734,11,0.734]],["name/28",[7,26.74]],["parent/28",[8,0.734,9,0.734,10,0.734,11,0.734]],["name/29",[24,26.74]],["parent/29",[8,0.734,9,0.734,10,0.734,11,0.734]],["name/30",[13,26.74]],["parent/30",[8,0.734,9,0.734,10,0.734,11,0.734]],["name/31",[17,26.74]],["parent/31",[8,0.734,9,0.734,10,0.734,11,0.734]]],"invertedIndex":[["constants",{"_index":0,"name":{"0":{}},"parent":{"1":{},"2":{},"3":{},"4":{}}}],["constructor",{"_index":21,"name":{"16":{},"22":{}},"parent":{}}],["graphql",{"_index":9,"name":{"8":{}},"parent":{"23":{},"24":{},"25":{},"26":{},"27":{},"28":{},"29":{},"30":{},"31":{}}}],["helpers",{"_index":5,"name":{"5":{}},"parent":{"6":{},"7":{}}}],["inject",{"_index":16,"name":{"12":{}},"parent":{}}],["injectredisclient",{"_index":6,"name":{"6":{},"27":{}},"parent":{}}],["injectredispubsub",{"_index":7,"name":{"7":{},"28":{}},"parent":{}}],["iocoremodule",{"_index":17,"name":{"13":{},"31":{}},"parent":{}}],["iomodule",{"_index":24,"name":{"19":{},"29":{}},"parent":{}}],["iomoduleasyncoptions",{"_index":13,"name":{"10":{},"30":{}},"parent":{}}],["module",{"_index":23,"name":{"18":{}},"parent":{"19":{}}}],["module.core",{"_index":12,"name":{"9":{}},"parent":{"10":{},"13":{}}}],["module.core.iocoremodule",{"_index":19,"name":{},"parent":{"14":{},"15":{},"16":{},"17":{}}}],["module.core.iomoduleasyncoptions",{"_index":15,"name":{},"parent":{"11":{},"12":{}}}],["module.iomodule",{"_index":25,"name":{},"parent":{"20":{},"21":{},"22":{}}}],["nestjs",{"_index":8,"name":{"8":{}},"parent":{"23":{},"24":{},"25":{},"26":{},"27":{},"28":{},"29":{},"30":{},"31":{}}}],["onmoduledestroy",{"_index":22,"name":{"17":{}},"parent":{}}],["redis",{"_index":10,"name":{"8":{}},"parent":{"23":{},"24":{},"25":{},"26":{},"27":{},"28":{},"29":{},"30":{},"31":{}}}],["redis_client_token",{"_index":1,"name":{"1":{},"23":{}},"parent":{}}],["redis_pub_config_token",{"_index":3,"name":{"3":{},"25":{}},"parent":{}}],["redis_pub_sub_token",{"_index":2,"name":{"2":{},"24":{}},"parent":{}}],["redis_sub_config_token",{"_index":4,"name":{"4":{},"26":{}},"parent":{}}],["registerredis",{"_index":18,"name":{"14":{},"20":{}},"parent":{}}],["registerredispubsub",{"_index":20,"name":{"15":{},"21":{}},"parent":{}}],["subscriptions",{"_index":11,"name":{"8":{}},"parent":{"23":{},"24":{},"25":{},"26":{},"27":{},"28":{},"29":{},"30":{},"31":{}}}],["usefactory",{"_index":14,"name":{"11":{}},"parent":{}}]],"pipeline":[]}} -------------------------------------------------------------------------------- /docs/classes/module.iomodule.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IOModule | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 | 64 |

Class IOModule

65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |

Hierarchy

73 |
    74 |
  • 75 | IOModule 76 |
  • 77 |
78 |
79 |
80 |

Index

81 |
82 |
83 |
84 |

Constructors

85 | 88 |
89 |
90 |

Methods

91 | 95 |
96 |
97 |
98 |
99 |
100 |

Constructors

101 |
102 | 103 |

constructor

104 | 107 |
    108 |
  • 109 | 111 |

    Returns IOModule

    112 |
  • 113 |
114 |
115 |
116 |
117 |

Methods

118 |
119 | 120 |

Static registerRedis

121 | 124 |
    125 |
  • 126 | 131 |

    Parameters

    132 | 137 |

    Returns DynamicModule

    138 |
  • 139 |
140 |
141 |
142 | 143 |

Static registerRedisPubSub

144 | 147 | 166 |
167 |
168 |
169 | 215 |
216 |
217 | 238 |
239 | 240 | 241 | -------------------------------------------------------------------------------- /docs/classes/module_core.iocoremodule.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IOCoreModule | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 | 64 |

Class IOCoreModule

65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |

Hierarchy

73 |
    74 |
  • 75 | IOCoreModule 76 |
  • 77 |
78 |
79 |
80 |

Implements

81 |
    82 |
  • OnModuleDestroy
  • 83 |
84 |
85 |
86 |

Index

87 |
88 |
89 |
90 |

Constructors

91 | 94 |
95 |
96 |

Methods

97 | 102 |
103 |
104 |
105 |
106 |
107 |

Constructors

108 |
109 | 110 |

constructor

111 | 114 | 133 |
134 |
135 |
136 |

Methods

137 |
138 | 139 |

onModuleDestroy

140 |
    141 |
  • onModuleDestroy(): Promise<void>
  • 142 |
143 |
    144 |
  • 145 | 151 |

    Returns Promise<void>

    152 |
  • 153 |
154 |
155 |
156 | 157 |

Static registerRedis

158 | 161 | 177 |
178 |
179 | 180 |

Static registerRedisPubSub

181 | 184 | 203 |
204 |
205 |
206 | 258 |
259 |
260 | 282 |
283 | 284 | 285 | -------------------------------------------------------------------------------- /docs/classes/nestjs_graphql_redis_subscriptions.redispubsub.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | RedisPubSub | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 | 64 |

Class RedisPubSub

65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |

Hierarchy

73 |
    74 |
  • 75 | RedisPubSub 76 |
  • 77 |
78 |
79 |
80 |

Implements

81 |
    82 |
  • PubSubEngine
  • 83 |
84 |
85 |
86 |

Index

87 |
88 |
89 |
90 |

Constructors

91 | 94 |
95 |
96 |

Properties

97 | 109 |
110 |
111 |

Methods

112 | 121 |
122 |
123 |
124 |
125 |
126 |

Constructors

127 |
128 | 129 |

constructor

130 |
    131 |
  • new RedisPubSub(options?: PubSubRedisOptions): RedisPubSub
  • 132 |
133 |
    134 |
  • 135 | 140 |

    Parameters

    141 |
      142 |
    • 143 |
      Optional options: PubSubRedisOptions
      144 |
    • 145 |
    146 |

    Returns RedisPubSub

    147 |
  • 148 |
149 |
150 |
151 |
152 |

Properties

153 |
154 | 155 |

Private currentSubscriptionId

156 |
currentSubscriptionId: any
157 | 162 |
163 |
164 | 165 |

Private Optional Readonly deserializer

166 |
deserializer: any
167 | 172 |
173 |
174 | 175 |

Private onMessage

176 |
onMessage: any
177 | 182 |
183 |
184 | 185 |

Private Readonly redisPublisher

186 |
redisPublisher: any
187 | 192 |
193 |
194 | 195 |

Private Readonly redisSubscriber

196 |
redisSubscriber: any
197 | 202 |
203 |
204 | 205 |

Private Readonly reviver

206 |
reviver: any
207 | 212 |
213 |
214 | 215 |

Private Optional Readonly serializer

216 |
serializer: any
217 | 222 |
223 |
224 | 225 |

Private Readonly subsRefsMap

226 |
subsRefsMap: any
227 | 232 |
233 |
234 | 235 |

Private Readonly subscriptionMap

236 |
subscriptionMap: any
237 | 242 |
243 |
244 | 245 |

Private Readonly triggerTransform

246 |
triggerTransform: any
247 | 252 |
253 |
254 |
255 |

Methods

256 |
257 | 258 |

asyncIterator

259 |
    260 |
  • asyncIterator<T>(triggers: string | string[], options?: unknown): AsyncIterator<T, any, undefined>
  • 261 |
262 |
    263 |
  • 264 | 270 |

    Type parameters

    271 |
      272 |
    • 273 |

      T

      274 |
    • 275 |
    276 |

    Parameters

    277 |
      278 |
    • 279 |
      triggers: string | string[]
      280 |
    • 281 |
    • 282 |
      Optional options: unknown
      283 |
    • 284 |
    285 |

    Returns AsyncIterator<T, any, undefined>

    286 |
  • 287 |
288 |
289 |
290 | 291 |

close

292 |
    293 |
  • close(): Promise<"OK"[]>
  • 294 |
295 |
    296 |
  • 297 | 302 |

    Returns Promise<"OK"[]>

    303 |
  • 304 |
305 |
306 |
307 | 308 |

getPublisher

309 |
    310 |
  • getPublisher(): RedisClient
  • 311 |
312 |
    313 |
  • 314 | 319 |

    Returns RedisClient

    320 |
  • 321 |
322 |
323 |
324 | 325 |

getSubscriber

326 |
    327 |
  • getSubscriber(): RedisClient
  • 328 |
329 |
    330 |
  • 331 | 336 |

    Returns RedisClient

    337 |
  • 338 |
339 |
340 |
341 | 342 |

publish

343 |
    344 |
  • publish<T>(trigger: string, payload: T): Promise<void>
  • 345 |
346 |
    347 |
  • 348 | 354 |

    Type parameters

    355 |
      356 |
    • 357 |

      T

      358 |
    • 359 |
    360 |

    Parameters

    361 |
      362 |
    • 363 |
      trigger: string
      364 |
    • 365 |
    • 366 |
      payload: T
      367 |
    • 368 |
    369 |

    Returns Promise<void>

    370 |
  • 371 |
372 |
373 |
374 | 375 |

subscribe

376 |
    377 |
  • subscribe<T>(trigger: string, onMessage: OnMessage<T>, options?: unknown): Promise<number>
  • 378 |
379 |
    380 |
  • 381 | 387 |

    Type parameters

    388 |
      389 |
    • 390 |

      T = any

      391 |
    • 392 |
    393 |

    Parameters

    394 |
      395 |
    • 396 |
      trigger: string
      397 |
    • 398 |
    • 399 |
      onMessage: OnMessage<T>
      400 |
    • 401 |
    • 402 |
      Optional options: unknown
      403 |
    • 404 |
    405 |

    Returns Promise<number>

    406 |
  • 407 |
408 |
409 |
410 | 411 |

unsubscribe

412 |
    413 |
  • unsubscribe(subId: number): void
  • 414 |
415 |
    416 |
  • 417 | 423 |

    Parameters

    424 |
      425 |
    • 426 |
      subId: number
      427 |
    • 428 |
    429 |

    Returns void

    430 |
  • 431 |
432 |
433 |
434 |
435 | 556 |
557 |
558 | 575 |
576 | 577 | 578 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 |

Nestjs-graphql-redis-subscriptions

54 |
55 |
56 |
57 |
58 |
59 | 66 | 94 |
95 |
96 | 113 |
114 | 115 | 116 | -------------------------------------------------------------------------------- /docs/interfaces/module_core.iomoduleasyncoptions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IOModuleAsyncOptions | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 | 64 |

Interface IOModuleAsyncOptions

65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |

Hierarchy

73 |
    74 |
  • 75 | Pick<ModuleMetadata, "imports"> 76 |
      77 |
    • 78 | IOModuleAsyncOptions 79 |
    • 80 |
    81 |
  • 82 |
83 |
84 |
85 |

Index

86 |
87 |
88 |
89 |

Properties

90 | 94 |
95 |
96 |

Methods

97 | 100 |
101 |
102 |
103 |
104 |
105 |

Properties

106 |
107 | 108 |

Optional imports

109 |
imports: (Type<any> | DynamicModule | Promise<DynamicModule> | ForwardReference<any>)[]
110 | 116 |
117 |
118 |

Optional list of imported modules that export the providers which are 119 | required in this module.

120 |
121 |
122 |
123 |
124 | 125 |

Optional inject

126 |
inject: any[]
127 | 132 |
133 |
134 |
135 |

Methods

136 |
137 | 138 |

useFactory

139 |
    140 |
  • useFactory(...args: any[]): RedisOptions | Promise<RedisOptions>
  • 141 |
142 |
    143 |
  • 144 | 149 |

    Parameters

    150 |
      151 |
    • 152 |
      Rest ...args: any[]
      153 |
    • 154 |
    155 |

    Returns RedisOptions | Promise<RedisOptions>

    156 |
  • 157 |
158 |
159 |
160 |
161 | 210 |
211 |
212 | 231 |
232 | 233 | 234 | -------------------------------------------------------------------------------- /docs/modules.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 |

Nestjs-graphql-redis-subscriptions

54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |

Index

62 |
63 |
64 |
65 |

Modules

66 | 73 |
74 |
75 |
76 |
77 |
78 | 106 |
107 |
108 | 125 |
126 | 127 | 128 | -------------------------------------------------------------------------------- /docs/modules/constants.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | constants | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 | 61 |

Module constants

62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |

Index

70 |
71 |
72 |
73 |

Variables

74 | 80 |
81 |
82 |
83 |
84 |
85 |

Variables

86 |
87 | 88 |

Const REDIS_CLIENT_TOKEN

89 |
REDIS_CLIENT_TOKEN: "REDIS_CLIENT" = 'REDIS_CLIENT'
90 | 95 |
96 |
97 | 98 |

Const REDIS_PUB_CONFIG_TOKEN

99 |
REDIS_PUB_CONFIG_TOKEN: "REDIS_PUB_CONFIG" = 'REDIS_PUB_CONFIG'
100 | 105 |
106 |
107 | 108 |

Const REDIS_PUB_SUB_TOKEN

109 |
REDIS_PUB_SUB_TOKEN: "REDIS_PUB_SUB" = 'REDIS_PUB_SUB'
110 | 115 |
116 |
117 | 118 |

Const REDIS_SUB_CONFIG_TOKEN

119 |
REDIS_SUB_CONFIG_TOKEN: "REDIS_SUB_CONFIG" = 'REDIS_SUB_CONFIG'
120 | 125 |
126 |
127 |
128 | 168 |
169 |
170 | 187 |
188 | 189 | 190 | -------------------------------------------------------------------------------- /docs/modules/helpers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | helpers | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 | 61 |

Module helpers

62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |

Index

70 |
71 |
72 |
73 |

Functions

74 | 78 |
79 |
80 |
81 |
82 |
83 |

Functions

84 |
85 | 86 |

InjectRedisClient

87 |
    88 |
  • InjectRedisClient(): (target: any, key: string | symbol, index?: number) => void
  • 89 |
90 |
    91 |
  • 92 | 97 |

    Returns (target: any, key: string | symbol, index?: number) => void

    98 |
      99 |
    • 100 |
        101 |
      • (target: any, key: string | symbol, index?: number): void
      • 102 |
      103 |
        104 |
      • 105 |

        Parameters

        106 |
          107 |
        • 108 |
          target: any
          109 |
        • 110 |
        • 111 |
          key: string | symbol
          112 |
        • 113 |
        • 114 |
          Optional index: number
          115 |
        • 116 |
        117 |

        Returns void

        118 |
      • 119 |
      120 |
    • 121 |
    122 |
  • 123 |
124 |
125 |
126 | 127 |

InjectRedisPubSub

128 |
    129 |
  • InjectRedisPubSub(): (target: any, key: string | symbol, index?: number) => void
  • 130 |
131 |
    132 |
  • 133 | 138 |

    Returns (target: any, key: string | symbol, index?: number) => void

    139 |
      140 |
    • 141 |
        142 |
      • (target: any, key: string | symbol, index?: number): void
      • 143 |
      144 |
        145 |
      • 146 |

        Parameters

        147 |
          148 |
        • 149 |
          target: any
          150 |
        • 151 |
        • 152 |
          key: string | symbol
          153 |
        • 154 |
        • 155 |
          Optional index: number
          156 |
        • 157 |
        158 |

        Returns void

        159 |
      • 160 |
      161 |
    • 162 |
    163 |
  • 164 |
165 |
166 |
167 |
168 | 202 |
203 |
204 | 221 |
222 | 223 | 224 | -------------------------------------------------------------------------------- /docs/modules/module.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | module | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 | 61 |

Module module

62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |

Index

70 |
71 |
72 |
73 |

Classes

74 | 77 |
78 |
79 |
80 |
81 |
82 | 113 |
114 |
115 | 132 |
133 | 134 | 135 | -------------------------------------------------------------------------------- /docs/modules/module_core.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | module.core | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 | 61 |

Module module.core

62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |

Index

70 |
71 |
72 |
73 |

Classes

74 | 77 |
78 |
79 |

Interfaces

80 | 83 |
84 |
85 |
86 |
87 |
88 | 122 |
123 |
124 | 141 |
142 | 143 | 144 | -------------------------------------------------------------------------------- /docs/modules/nestjs_graphql_redis_subscriptions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | nestjs-graphql-redis-subscriptions | Nestjs-graphql-redis-subscriptions 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 28 |
29 |
30 | Options 31 |
32 |
33 | All 34 |
    35 |
  • Public
  • 36 |
  • Public/Protected
  • 37 |
  • All
  • 38 |
39 |
40 | 41 | 42 | 43 | 44 |
45 |
46 | Menu 47 |
48 |
49 |
50 |
51 |
52 |
53 | 61 |

Module nestjs-graphql-redis-subscriptions

62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |

Index

70 |
71 |
72 |
73 |

References

74 | 85 |
86 |
87 |

Classes

88 | 91 |
92 |
93 |

Interfaces

94 | 97 |
98 |
99 |
100 |
101 |
102 |

References

103 |
104 | 105 |

IOCoreModule

106 | Re-exports IOCoreModule 107 |
108 |
109 | 110 |

IOModule

111 | Re-exports IOModule 112 |
113 |
114 | 115 |

IOModuleAsyncOptions

116 | Re-exports IOModuleAsyncOptions 117 |
118 |
119 | 120 |

InjectRedisClient

121 | Re-exports InjectRedisClient 122 |
123 |
124 | 125 |

InjectRedisPubSub

126 | Re-exports InjectRedisPubSub 127 |
128 |
129 | 130 |

REDIS_CLIENT_TOKEN

131 | Re-exports REDIS_CLIENT_TOKEN 132 |
133 |
134 | 135 |

REDIS_PUB_CONFIG_TOKEN

136 | Re-exports REDIS_PUB_CONFIG_TOKEN 137 |
138 |
139 | 140 |

REDIS_PUB_SUB_TOKEN

141 | Re-exports REDIS_PUB_SUB_TOKEN 142 |
143 |
144 | 145 |

REDIS_SUB_CONFIG_TOKEN

146 | Re-exports REDIS_SUB_CONFIG_TOKEN 147 |
148 |
149 |
150 | 211 |
212 |
213 | 230 |
231 | 232 | 233 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nestjs-graphql-redis-subscriptions", 3 | "version": "0.1.1", 4 | "description": "A nestjs module that provide an instance of graphql-redis-subscriptions", 5 | "author": "Alex Hermann ", 6 | "repository": "https://github.com/Pop-Code/nestjs-graphql-redis-subscriptions.git", 7 | "license": "MIT", 8 | "main": "./dist/index.js", 9 | "types": "./dist/index.d.ts", 10 | "scripts": { 11 | "build": "rm -Rf dist && tsc -b tsconfig.build.json", 12 | "format": "prettier \"**/*.ts\" --ignore-path ./.prettierignore --write && git status", 13 | "lint": "eslint ./src/**/*.ts", 14 | "doc": "rm -Rf ./docs && typedoc ./src && touch ./docs/.nojekyll", 15 | "test": "jest", 16 | "test:watch": "jest --watch", 17 | "test:cov": "jest --coverage", 18 | "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand" 19 | }, 20 | "peerDependencies": { 21 | "@nestjs/common": "^7 || ^8", 22 | "graphql": "^16.4.0", 23 | "graphql-redis-subscriptions-graphql16-ioredis5": "^1.0.0", 24 | "graphql-subscriptions": "^2.0.0" 25 | }, 26 | "dependencies": { 27 | "ioredis": "5.0.4" 28 | }, 29 | "devDependencies": { 30 | "@nestjs/common": "8.4.4", 31 | "@nestjs/core": "8.4.4", 32 | "@nestjs/platform-express": "8.4.4", 33 | "@nestjs/testing": "8.4.4", 34 | "@types/jest": "27.4.1", 35 | "@types/node": "^16.7.1", 36 | "@typescript-eslint/eslint-plugin": "5.21.0", 37 | "@typescript-eslint/parser": "5.21.0", 38 | "codecov": "3.8.3", 39 | "eslint": "8.14.0", 40 | "eslint-config-prettier": "8.5.0", 41 | "eslint-plugin-import": "2.26.0", 42 | "eslint-plugin-prefer-arrow": "1.2.3", 43 | "graphql": "16.4.0", 44 | "graphql-redis-subscriptions-graphql16-ioredis5": "^1.0.0", 45 | "graphql-subscriptions": "^2.0.0", 46 | "jest": "^27.5.1", 47 | "prettier": "2.6.2", 48 | "reflect-metadata": "0.1.13", 49 | "rxjs": "7.5.5", 50 | "ts-jest": "27.1.4", 51 | "ts-node": "10.7.0", 52 | "tsconfig-paths": "3.14.1", 53 | "typedoc": "0.22.15", 54 | "typescript": "4.6.3" 55 | }, 56 | "jest": { 57 | "moduleFileExtensions": [ 58 | "js", 59 | "json", 60 | "ts" 61 | ], 62 | "rootDir": "src", 63 | "testRegex": ".spec.ts$", 64 | "transform": { 65 | "^.+\\.(t|j)s$": "ts-jest" 66 | }, 67 | "collectCoverageFrom": [ 68 | "**/*.{js,jsx,ts}", 69 | "!index.ts", 70 | "!**/test/**" 71 | ], 72 | "coverageDirectory": "../coverage" 73 | }, 74 | "engines": { 75 | "node": ">=0.12" 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/constants.ts: -------------------------------------------------------------------------------- 1 | export const REDIS_CLIENT_TOKEN = 'REDIS_CLIENT'; 2 | export const REDIS_PUB_SUB_TOKEN = 'REDIS_PUB_SUB'; 3 | export const REDIS_PUB_CONFIG_TOKEN = 'REDIS_PUB_CONFIG'; 4 | export const REDIS_SUB_CONFIG_TOKEN = 'REDIS_SUB_CONFIG'; 5 | -------------------------------------------------------------------------------- /src/helpers.ts: -------------------------------------------------------------------------------- 1 | import { Inject } from '@nestjs/common'; 2 | 3 | import { REDIS_CLIENT_TOKEN, REDIS_PUB_SUB_TOKEN } from './constants'; 4 | 5 | export function InjectRedisClient(): (target: any, key: string | symbol, index?: number) => void { 6 | return Inject(REDIS_CLIENT_TOKEN); 7 | } 8 | 9 | export function InjectRedisPubSub(): (target: any, key: string | symbol, index?: number) => void { 10 | return Inject(REDIS_PUB_SUB_TOKEN); 11 | } 12 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module nestjs-graphql-redis-subscriptions 3 | */ 4 | 5 | export { RedisPubSub } from 'graphql-redis-subscriptions-graphql16-ioredis5'; 6 | export { default as Redis } from 'ioredis'; 7 | export * from './constants'; 8 | export * from './helpers'; 9 | export * from './module'; 10 | export * from './module.core'; 11 | 12 | -------------------------------------------------------------------------------- /src/module.core.ts: -------------------------------------------------------------------------------- 1 | import { DynamicModule, Global, Module, OnModuleDestroy, Optional } from '@nestjs/common'; 2 | import { ModuleMetadata } from '@nestjs/common/interfaces'; 3 | import { RedisPubSub } from 'graphql-redis-subscriptions-graphql16-ioredis5'; 4 | import Redis, { RedisOptions } from 'ioredis'; 5 | 6 | import { REDIS_CLIENT_TOKEN, REDIS_PUB_CONFIG_TOKEN, REDIS_PUB_SUB_TOKEN, REDIS_SUB_CONFIG_TOKEN } from './constants'; 7 | import { InjectRedisClient, InjectRedisPubSub } from './helpers'; 8 | 9 | 10 | 11 | export interface IOModuleAsyncOptions extends Pick { 12 | useFactory: (...args: any[]) => Promise | RedisOptions; 13 | inject?: any[]; 14 | } 15 | 16 | @Global() 17 | @Module({}) 18 | export class IOCoreModule implements OnModuleDestroy { 19 | constructor( 20 | @Optional() 21 | @InjectRedisClient() 22 | private readonly redisClient: Redis, 23 | 24 | @Optional() 25 | @InjectRedisPubSub() 26 | private readonly redisPubSub: RedisPubSub 27 | ) {} 28 | 29 | async onModuleDestroy(): Promise { 30 | if (this.redisClient) { 31 | this.redisClient.disconnect(); 32 | } 33 | if (this.redisPubSub) { 34 | this.redisPubSub.getPublisher().disconnect(); 35 | this.redisPubSub.getSubscriber().disconnect(); 36 | } 37 | } 38 | 39 | static registerRedis(options: IOModuleAsyncOptions): DynamicModule { 40 | const configToken = 'redisClientConfigToken'; 41 | const configProvider = { 42 | provide: configToken, 43 | ...options 44 | }; 45 | const redisProvider = { 46 | provide: REDIS_CLIENT_TOKEN, 47 | useFactory: (config: RedisOptions) => { 48 | return new Redis(config); 49 | }, 50 | inject: [configToken] 51 | }; 52 | const providers = [configProvider, redisProvider]; 53 | return { 54 | module: IOCoreModule, 55 | providers, 56 | exports: providers 57 | }; 58 | } 59 | 60 | static registerRedisPubSub( 61 | publisherOpts: IOModuleAsyncOptions, 62 | subscriberOpts: IOModuleAsyncOptions 63 | ): DynamicModule { 64 | const pubConfigProvider = { 65 | provide: REDIS_PUB_CONFIG_TOKEN, 66 | ...publisherOpts 67 | }; 68 | const subConfigProvider = { 69 | provide: REDIS_SUB_CONFIG_TOKEN, 70 | ...subscriberOpts 71 | }; 72 | const redisPubSubProvider = { 73 | provide: REDIS_PUB_SUB_TOKEN, 74 | useFactory: (pubOpts: RedisOptions, subOtps: RedisOptions) => { 75 | return new RedisPubSub({ 76 | publisher: new Redis(pubOpts), 77 | subscriber: new Redis(subOtps) 78 | }); 79 | }, 80 | inject: [REDIS_PUB_CONFIG_TOKEN, REDIS_SUB_CONFIG_TOKEN] 81 | }; 82 | const providers = [pubConfigProvider, subConfigProvider, redisPubSubProvider]; 83 | return { 84 | module: IOCoreModule, 85 | providers, 86 | exports: providers 87 | }; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/module.ts: -------------------------------------------------------------------------------- 1 | import { DynamicModule, Global, Module } from '@nestjs/common'; 2 | 3 | import { IOCoreModule, IOModuleAsyncOptions } from './module.core'; 4 | 5 | @Global() 6 | @Module({}) 7 | export class IOModule { 8 | static registerRedis(options: IOModuleAsyncOptions): DynamicModule { 9 | return { 10 | module: IOModule, 11 | imports: [IOCoreModule.registerRedis(options)] 12 | }; 13 | } 14 | 15 | static registerRedisPubSub(pubOpts: IOModuleAsyncOptions, subOpts: IOModuleAsyncOptions): DynamicModule { 16 | return { 17 | module: IOModule, 18 | imports: [IOCoreModule.registerRedisPubSub(pubOpts, subOpts)] 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "allowSyntheticDefaultImports": true, 5 | "declaration": true, 6 | "declarationMap": true, 7 | "noImplicitAny": false, 8 | "noUnusedLocals": false, 9 | "removeComments": true, 10 | "noLib": false, 11 | "emitDecoratorMetadata": true, 12 | "experimentalDecorators": true, 13 | "target": "es6", 14 | "sourceMap": true, 15 | "allowJs": true, 16 | "outDir": "dist", 17 | "lib": ["es7"] 18 | }, 19 | "include": ["src/**/*"] 20 | } 21 | -------------------------------------------------------------------------------- /typedoc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | out: 'docs', 3 | exclude: ['**/test/**/*'], 4 | theme: 'default', 5 | name: 'Nestjs-graphql-redis-subscriptions', 6 | excludePrivate: false, 7 | hideGenerator: true 8 | }; 9 | --------------------------------------------------------------------------------