Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 13:36
    dependabot[bot] edited #1454
  • 13:34
    dependabot[bot] synchronize #1454
  • 13:34
    dependabot[bot] edited #1454
  • 13:34
    dependabot[bot] edited #1454
  • 13:32
    dependabot[bot] edited #1454
  • 13:32
    Romakita labeled #1545
  • 13:32
    Romakita commented #1545
  • 13:08
    Romakita closed #1545
  • 08:49
    github-actions[bot] commented #1545
  • 08:35
    Romakita synchronize #1545
  • 08:24
    Romakita synchronize #1545
  • 07:14
    Romakita opened #1545
  • 05:43
    Romakita closed #1496
  • 05:42
    Romakita closed #1534
  • Sep 27 17:54
    dependabot[bot] edited #1454
  • Sep 27 17:52
    dependabot[bot] edited #1454
  • Sep 27 17:52
    dependabot[bot] synchronize #1454
  • Sep 27 17:52
    dependabot[bot] edited #1454
  • Sep 27 17:50
    dependabot[bot] edited #1454
  • Sep 27 17:49
    Romakita labeled #1544
Romain Lenzotti
@Romakita
in v6, it was more simple to remove consent page XD
Panva complexify his module :p
Clément de l'Hamaide
@cdelhamaide_gitlab

@Romakita it works ! I got my first JWT token :)
`
async loadExistingGrant(ctx: KoaContextWithOIDC) {
const grantId = (ctx.oidc.result
&& ctx.oidc.result.consent
&& ctx.oidc.result.consent.grantId) || ctx.oidc.session?.grantIdFor(ctx.oidc.client?.clientId || '');

  if (grantId) {
    return ctx.oidc.provider.Grant.find(grantId);
  } else {
    const grant = new ctx.oidc.provider.Grant();
    grant.accountId = ctx.oidc.session?.accountId
    grant.clientId = ctx.oidc.client?.clientId

    grant.addOIDCScope('openid email profile');
    grant.addOIDCClaims(['first_name']);
    grant.addResourceScope('urn:example:resource-indicator', 'api:read api:write');
    await grant.save();
    return grant;
  }
}

`

Romain Lenzotti
@Romakita
Perfect. I’ll update the documentation page ;)
Ashish Gupta
@ashprojects

Hi Romain,
TSED version upgrade (from 6.37.X to 6.43.X) is breaking Generics in Schema for our use case.
See sample code:

import {BodyParams, Context, Controller, Get, Logger, Post} from "@tsed/common";
import {Inject} from "@tsed/di";
import {GenericOf, Generics, getJsonSchema, Property} from "@tsed/schema";

@Generics("T")
export class UserProperty<T> {
  @Property("T")
  value: T;
}

export class Adjustment {
  @GenericOf(Number)
  adjustment: UserProperty<number>;
}

console.log(JSON.stringify(getJsonSchema(Adjustment)));
// On 6.43.4 => API fails 
// {"type":"object","properties":{"adjustment":{"type":"object","properties":{"value":{"type":"object","$ref":"T"}}}}}

//On 6.37.2 => Works
// {"type":"object","properties":{"adjustment":{"type":"object","properties":{"value":{"$ref":"#/definitions/Number"}}}},"definitions":{"Number":{"type":"number"}}}

@Controller("/hello-world")
export class HelloWorldController {
  @Inject()
  logger: Logger;
  @Post("/")
  get(@Context() ctx: Context, @BodyParams() m: Adjustment) {
    this.logger.info('this.logger used', {a: 'this logger'});
    ctx.logger.info( {b: 'req logger'});
    m.adjustment.value += 10;
    return m;
  }
}

I tried replacing @GenericOf(Number) with @GenericOf(number()) no luck. Even custom JsonSchema doesn't work here.

Ashish Gupta
@ashprojects
Looks like tsed/schema/getJsonSchema and tsed/json-mapper/deserialize are inconsistent in newer version for Generics of Number.
Romain Lenzotti
@Romakita
Hum maybe a fix is required
Ashish Gupta
@ashprojects
Oh. Okay. Thanks for quick acknowledgement. Took a while for us figure out as well
Romain Lenzotti
@Romakita
I work on it. The problem isn’t related to Groups but on the feature introduced to support Enum on generics
Ashish Gupta
@ashprojects
Wrote a test case in local (GenericOf)
it("should generate Generic with an native types", () => {
    @Generics("T")
    class Submission<T> {
      @Property()
      _id: string;

      @Property("T")
      data: T;
    }

    class NumberContent {
      @GenericOf(Number)
      submission: Submission<Number>;
    }

    class StringContent {
      @GenericOf(String)
      submission: Submission<String>;
    }

    expect(getJsonSchema(NumberContent)).to.deep.eq({
      properties: {
        submission: {
          properties: {
            _id: {
              type: "string"
            },
            data: {
              type: "number"
            }
          },
          type: "object"
        }
      },
      type: "object"
    });

    expect(getJsonSchema(StringContent)).to.deep.eq({
      properties: {
        submission: {
          properties: {
            _id: {
              type: "string"
            },
            data: {
              type: "string"
            }
          },
          type: "object"
        }
      },
      type: "object"
    });
  });
If that helps in figuring out the issue. :)
Romain Lenzotti
@Romakita
Yes totally. I used your previous example to reproduce the issue. i found the fix
Romain Lenzotti
@Romakita
Ok the PR is ready
Ashish Gupta
@ashprojects
Great! :)
Romain Lenzotti
@Romakita
I’ll merge it in 5minutes. The build / release takes 10min-15min

@ashprojects have you seen my message about your question

proud to use TSED. But i had a query regarding microservices usage of tsed
is there a plan or way to make internal services call via tcp? Proxy calling other microservices ? At this point i have to expose http endpoints for each service.

Ashish Gupta
@ashprojects

Oh yeah, sorry missed it.
I will check the link that you sent, will review it.
My basic need was internal communication among microservices built on TsED.
Example
There is a UserService with following methods: getUserById() and createUser()
And there is a UIService which calls UserService internally in the same VPC.

I come from Java background, so was looking for a convenient way (like Service Proxies https://vertx.io/docs/vertx-service-proxy/java/) which makes UIService and UserService easy to communicate with neat API Contracts.
Today, we created shared UserService Interface, which is kept in commons, and has two implementations:

  1. Actual Implementation in UserService (HTTP Endpoint exposed)
  2. Proxy Implementation, which calls 1 via HTTP call.

UIService now has (2), calls like a method call (getUserById) and returns an object

I can create a repo demonstrating this, in case that helps.
It's just way that I am using it like now, I will review Command pattern that you mentioned as well.
Romain Lenzotti
@Romakita
Command patners won’t feet with your needs. A repo example could help me. But I never used Tcp command. I use always http protocol to communicate between two applications
Ashish Gupta
@ashprojects
Oh. Got it thanks.
Romain Lenzotti
@Romakita
Release in progress
Romain Lenzotti
@Romakita
released
Romain Lenzotti
@Romakita

:rotating_light: Hello community, :rotating_light:

Ts.ED team have decided to migrate the discussions on two tools:

image.pngimage.pngimage.png
Why github discussions? Because, the topics can be followed by any developpers who encountered the same problems
Romain Lenzotti
@Romakita
@canal The issue on Slack button is fixed!
raitislebedevs
@raitislebedevs

Is there a way to specify a Response 417 code to be shown in Swagger documentation for Post Request, by default it has only 400, if I decorate the function with @Authenticated() then it shows as well 401. How can I add 417, and still have the option to use a type e.g., want to have the below. Though Swagger does not reflect this code.

@Returns(417, { description: "Unauthorized", type: Model})

Romain Lenzotti
@Romakita
@Returns(417, Model).Description(‘Unauthorized')

@Romakita
:rotating_light: Hello community, :rotating_light:

Ts.ED team have decided to migrate the discussions on two tools:

Romain Lenzotti
@Romakita
Slack access fixed (again)
Avesh Memon
@aveshalchemy:matrix.org
[m]

Hey Community,
I am facing one issue.

TypeError: Cannot destructure property request of 'undefined' or 'null'.
at PlatformExpressHandler.getParam (/home/alchemy/bored_backend/node_modules/@tsed/common/src/platform/services/PlatformHandler.ts:89:9)
at PlatformExpressHandler.mapParam (/home/alchemy/bored_backend/node_modules/@tsed/common/src/platform/services/PlatformHandler.ts:228:24)
at context.args.Promise.all.parameters.map (/home/alchemy/bored_backend/node_modules/@tsed/common/src/platform/services/PlatformHandler.ts:201:71)
at Array.map (<anonymous>)
at PlatformExpressHandler.onRequest (/home/alchemy/bored_backend/node_modules/@tsed/common/src/platform/services/PlatformHandler.ts:201:51)
at /home/alchemy/bored_backend/node_modules/@tsed/common/src/platform/services/PlatformHandler.ts:178:14
at Layer.handle_error (/home/alchemy/bored_backend/node_modules/express/lib/router/layer.js:71:5)
at trim_prefix (/home/alchemy/bored_backend/node_modules/express/lib/router/index.js:315:13)
at /home/alchemy/bored_backend/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/home/alchemy/bored_backend/node_modules/express/lib/router/index.js:335:12)

When my request size is bigger in graphql at that time i:m getting this error

Romain Lenzotti
@Romakita
Can you open an issue. Also this chanel is closed. For any bug/question use github or slack
Avesh Memon
@aveshalchemy:matrix.org
[m]
Okay
Eric Polerecky
@detroitpro
image.png

I am using TypeORM and would like to use the async factory to resolve the default database connection; however, I am unable to find an example of how to mock out the database connection that is injected.

Is there an example of testing a service with a constructor like this?

I am looking for an example of unit testing, one that is only testing this service and not starting an entire server.
Romain Lenzotti
@Romakita
image.png
:rotating_light: Hello community, :rotating_light:
Ts.ED team have decided to migrate the discussions on two tools:
Discussions will be now on Github discussions
https://github.com/TypedProject/tsed/discussions
Direct message will be now on Slack (https://join.slack.com/t/tsed-framework/shared_invite/zt-pd8d3ope-s_W4VM89E~NsIh8kxkXNoQ)
image.pngimage.pngimage.png
Lux
@lux:ontheblueplanet.com
[m]
That's horrible
Moving away from an open source and decentralized tool as matrix to a highly problematic slack channel? That's truly sad!
Romain Lenzotti
@Romakita

This is why you have two links. One to github discussions and a second for slack.

  • Github is open and SEO frendly
  • Slack offer better options for me and I assumed that

I work on my personal time to develop the framework and provide answers. I think I have the right to choose the right tools to save time :)

There is no debate on this. I also took the time to tell you about the preferred communication channels so that you can get a response from the community.

I hope you understand my personal motivations to be able to choose the elements that prevent me from wasting time. Gitter no longer made it possible to follow conversations correctly and answer questions quickly.

For your question. I think the response is here: https://tsed.io/docs/testing.html#unit-test

Or on the official TypeORM documentation

devops-sevaa
@devops-sevaa
Hi there , I have used Ts.ed for development of NodeJS server. Everything is working fine in local , but after hosting it on AWS ec2 instance ubuntu AMI, with pm2 tool I am facing some errors
src/Server.ts(61,3): error TS2564: Property 'settings' has no initializer and is not definitely assigned in the constructor.
2|be_sagis |
2|be_sagis | src/Server.ts(56,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
2|be_sagis | src/Server.ts(58,3): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
2|be_sagis | src/Server.ts(58,3): error TS2564: Property 'app' has no initializer and is not definitely assigned in the constructor.
2|be_sagis | src/Server.ts(61,3): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
2|be_sagis | src/Server.ts(61,3): error TS2564: Property 'settings' has no initializer and is not definitely assigned in the constructor.
2|be_sagis |
2|be_sagis | src/Server.ts(56,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
2|be_sagis | src/Server.ts(58,3): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
2|be_sagis | src/Server.ts(58,3): error TS2564: Property 'app' has no initializer and is not definitely assigned in the constructor.
2|be_sagis | src/Server.ts(61,3): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
2|be_sagis | src/Server.ts(61,3): error TS2564: Property 'settings' has no initializer and is not definitely assigned in the constructor.
this is error description
Some one please help me solving this
I am system.config.js file to run pm2
Romain Lenzotti
@Romakita
This question must be asked on PM2 team.
Again this channel will be definitively close on end of this month !!
please use the appropriate channels: Github discussion or Slack