Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

name property of ClientProviderOptions should accept symbol values #5093

Closed
wayou opened this issue Jul 15, 2020 · 1 comment
Closed

name property of ClientProviderOptions should accept symbol values #5093

wayou opened this issue Jul 15, 2020 · 1 comment
Labels
needs triage This issue has not been looked into

Comments

@wayou
Copy link
Contributor

wayou commented Jul 15, 2020

Bug Report

Current behavior

According to the doc:

The name property serves as an injection token that can be used to inject an instance of a ClientProxy where needed. The value of the name property, as an injection token, can be an arbitrary string or JavaScript symbol, as described here.

we can use Symbol as injection token for the microservice.

Input Code

@Module({
  imports: [
    ClientsModule.register([
      {
        // 🚨 Type 'symbol' is not assignable to type 'string'.ts(2322)
        name: Symbol('my_microservice'),
      },
    ]),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

Expected behavior

the name should accept Symbol values.

Possible Solution

packages/microservices/module/interfaces/clients-module.interface.ts

export type ClientProviderOptions = ClientOptions & {
-  name: string;
+  name: string | symbol;
};

Environment


Nest version: 7.4.1

 
For Tooling issues:
- Node version: v14.0.0  
- Platform: Mac 



@wayou wayou added the needs triage This issue has not been looked into label Jul 15, 2020
@jmcdo29
Copy link
Member

jmcdo29 commented Jul 15, 2020

Would you like to create a PR for this?

@wayou wayou mentioned this issue Jul 16, 2020
3 tasks
kamilmysliwiec added a commit that referenced this issue Jul 17, 2020
yeeezsh added a commit to yeeezsh/nest that referenced this issue Aug 16, 2020
* fix(deps): update dependency @nestjs/mongoose to v7.0.2

* chore(deps): update dependency @types/jest to v26.0.4

* fix(common): fix nan values for default value pipe

* fix(testing): allow passing abstract http server

* fix(core): instance links host should return the last instance

* chore(@nestjs) publish v7.3.2 release

* chore(): update README files

* fix(deps): update nest monorepo to v7.3.2

* fix(deps): update dependency fast-json-stringify to v2.2.2

* chore(deps): update dependency ts-loader to v8

* fix(deps): update dependency @nestjs/bull to v0.1.2

* fix(deps): update dependency @nestjs/jwt to v7.1.0

* fix(deps): update dependency @nestjs/graphql to v7.5.3

* fix(deps): update dependency @nestjs/graphql to v7.5.5

* chore(deps): update dependency @types/redis to v2.8.25

* refactor(platform-fastify): supports fastify 3.0

* fix(platform-fastify): updated dependencies in root package.json

* fix(platform-fastify): cleaned up fastify-related dependencies in root

* fix(platform-fastify): updated version of fastify-multipart

* fix(fastify-adapter): added default constructor to the adapter

* fix(platform-fastify): fixed import of fastify plugins

* fix(platform-fastify): added fastify-express package

* fix(platform-fastify): sync package-lock.json

* chore(deps): update dependency @types/mocha to v8

* chore(deps): update commitlint monorepo to v9.1.1

* sample(webpack): update webpack-node-externals option property name

* chore(deps): update typescript-eslint monorepo to v3.6.1

* chore(deps): update mysql docker tag to v5.7.31

* fix(deps): update dependency graphql-tools to v6.0.13

* fix(deps): update dependency fastify to v2.15.2

* chore(deps): update babel monorepo to v7.10.5

* chore(deps): update dependency ts-loader to v8.0.1

* feat(common) add expected type option to validation pipe

It's possible to have multiple pipes for a single parameter, so the argument type won't necessary will be same as the original type and we need to explicitly set the type for the validation pipe
see discussion:
https://discord.com/channels/520622812742811698/520649487924985885/732209853854122055

* fix nestjs#5093

* correct the type

* chore(deps): bump lodash in /sample/13-mongo-typeorm

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump lodash from 4.17.15 to 4.17.19 in /sample/01-cats-app

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): update dependency subscriptions-transport-ws to v0.9.17

* chore(deps): update dependency ts-jest to v26.1.2

* chore(deps): update dependency amqplib to v0.6.0

* correct the type for `name` in another location

* fix(deps): update dependency @grpc/proto-loader to v0.5.5

* chore(deps): update dependency typescript to v3.9.7

* fix(deps): update dependency bull to v3.16.0

* chore(deps): update dependency ts-jest to v26.1.3

* fix(deps): update dependency graphql-tools to v6.0.14

* fix(deps): update dependency mongoose to v5.9.25

* feat(common): add precondition failed exception

closes nestjs#5113

* chore(deps): update dependency @types/jest to v26.0.5

* chore(deps): update dependency eslint to v7.5.0

* chore(deps): update dependency ts-morph to v7.1.3

* chore(deps): update typescript-eslint monorepo to v3.7.0

* chore(deps): update dependency @types/socket.io to v2.1.10

* fix(deps): update dependency graphql-tools to v6.0.15

* fix(microservice): handle promise return by 'registerModules' properly

* chore(deps): update dependency @types/chai to v4.2.12

* chore(deps): update dependency @types/jest to v26.0.7

* chore(deps): update dependency webpack to v4.44.0

* chore(deps): update typescript-eslint monorepo to v3.7.1

* fix(deps): update dependency uuid to v8.3.0

* fix(deps): update apollo graphql packages to v2.16.1

* fix(microservices): add microservice dispose to close server on shutdown

* chore(deps): update dependency ts-jest to v26.1.4

* fix(deps): update dependency mongoose to v5.9.26

* Create codeql-analysis.yml

* fix(microservices): close socket module on dispose

* Update packages/microservices/nest-microservice.ts

* feat(platform-fastify): support middleware with fastify adapter

* style(): fix linter issues

* chore(deps): update dependency fastify-static to v3.2.0

* fix(deps): update dependency fast-json-stringify to v2.2.3

* fix(deps): update dependency fastify-cors to v4.1.0

* fix(deps): update dependency point-of-view to v4

* fix(deps): update dependency fastify to v3.1.1

* chore(@nestjs) publish v7.4.0 release

* chore(): update package.json

* fix(deps): update dependency @nestjs/graphql to v7.6.0

* fix(microservices): Changed visibility of Kafka variables for extension

* fix(platform-fastify): use external interfaces

* chore(@nestjs) publish v7.4.1 release

* feat(core): case insensitive headers

@headers(param) is now lowercased in order to match raw headers that are lower-cased by node https://nodejs.org/api/http.html#http_http

* fix(deps): update dependency class-transformer to v0.3.1

* fix(deps): update nest monorepo to v7.4.1

* chore(deps): update dependency webpack to v4.44.1

* fix(sample): Add missing package fastify-static

* chore(deps): update dependency jest to v26.2.1

* fix(platform-fastify): fix constructor signature, fallback to any

* chore(@nestjs) publish v7.4.2 release

* fix(deps): update dependency mongodb to v3.6.0

* chore(deps): update dependency rxjs-compat to v6.6.2

* fix(deps): update dependency rxjs to v6.6.2

* chore(deps): update dependency @types/jest to v26.0.8

* chore(deps): update dependency jest to v26.2.2

* fix(deps): update dependency mongoose to v5.9.27

* chore(deps): update dependency @types/cors to v2.8.7

* chore(deps): update dependency eslint to v7.6.0

* chore(deps): update dependency ts-loader to v8.0.2

* chore(deps): update babel monorepo to v7.11.0

* chore(deps): update dependency mocha to v8.1.0

* fix(deps): update nest monorepo to v7.4.2

* chore(deps): update typescript-eslint monorepo to v3.8.0

* chore(deps): update dependency mocha to v8.1.1

* chore(deps): update babel monorepo to v7.11.1

* fix(deps): update dependency graphql-tools to v6.0.16

* fix(deps): update dependency point-of-view to v4.3.0

* chore(deps): update dependency @types/jest to v26.0.9

* chore(deps): update dependency @babel/runtime to v7.11.2

* chore(deps): update dependency @types/mongoose to v5.7.35

* fix(deps): update dependency fastify to v3.2.0

* fix(deps): update dependency tslib to v2.0.1

* chore(deps): update dependency concurrently to v5.3.0

* Update invalid-kafka-client-topic-partition.exception.ts

typo

* chore(deps): update dependency nats to v1.4.12

* fix(deps): update dependency mongoose to v5.9.28

* chore(deps): update dependency ts-morph to v7.2.0

* chore(deps): update dependency jest to v26.3.0

* chore(deps): update typescript-eslint monorepo to v3.9.0

* fix(deps): update dependency graphql-tools to v6.0.17

* chore(deps): update dependency @types/socket.io to v2.1.11

* chore(deps): update dependency ts-jest to v26.2.0

* fix(deps): update dependency graphql-tools to v6.0.18

* chore(deps): update dependency ts-morph to v7.3.0

* chore(deps): update dependency @types/mocha to v8.0.2

* fix(deps): update dependency bull to v3.17.0

* chore(deps): update dependency sinon to v9.0.3

* fix(deps): update dependency light-my-request to v4.0.2

* chore(deps): update dependency conventional-changelog to v3.1.23

* chore(deps): update dependency mqtt to v4.2.0

* chore(deps): update dependency jest to v26.4.0

* fix(deps): update dependency graphql-query-complexity to v0.7.0

* chore(deps): bump minimist from 1.2.0 to 1.2.5 in /sample/01-cats-app

Bumps [minimist](https://github.com/substack/minimist) from 1.2.0 to 1.2.5.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.0...1.2.5)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Kamil Mysliwiec <[email protected]>
Co-authored-by: hongyiweiwu <[email protected]>
Co-authored-by: hwanseok <[email protected]>
Co-authored-by: Michael Solomon <[email protected]>
Co-authored-by: Wayou Liu <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Seb <[email protected]>
Co-authored-by: danielscw <[email protected]>
Co-authored-by: Alexey Rehov <[email protected]>
Co-authored-by: Michael Kaufman <[email protected]>
Co-authored-by: D. Kanter <[email protected]>
Co-authored-by: Adam <[email protected]>
Co-authored-by: AdamHavlicek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

2 participants