profile
viewpoint
Jordan Stout j @DapperToast San Diego, CA jrdn.org

j/type-events 10

A typed decorator based synchronous or asynchronous Event Dispatcher.

j/graphql-party 6

A decorator based GraphQL schema builder.

j/type-clean 4

A simple (& lightly opinionated) clean architecture framework.

j/dialogable.js 3

For people who want the bootstrap modal look and feel... but better... oh and with built-in ajax support.

j/type-mongodb 2

A simple decorator based MongoDB ODM.

j/type-mongo-mapper 1

A no frills ES6 class to MongoDB document mapper.

j/federation-demo 0

Demo of Apollo Federation

j/graphql 0

GraphQL (TypeScript) module for Nest framework (node.js) 🍷

created repositoryBrewBlox/brewblox-prototypes

created time in 2 days

starteddmtrKovalenko/odiff

started time in 2 days

fork Seldaek/form

The Form component allows you to easily create, process and reuse HTML forms.

https://symfony.com/form

fork in 3 days

issue commentMichalLytek/type-graphql

DateTime error in subscription.

For others ending up here who work with UTC DateTime strings the package graphql-scalars can be used.

zifahm

comment created time in 4 days

issue closedMichalLytek/type-graphql

An overview of all decorators

Describe the issue It would be nice to have a list of all decorators available, similar to class-validator has: https://github.com/typestack/class-validator#validation-decorators

This offers a good quick overview of everything that is possible, and could contain links to the actual docs with more info.

Are you able to make a PR that fix this? It would be nice to first know if this is something that will be added, and where (README or docs site). But if it's not too much work I could give it a go 😄

Additional context Overall this project feels like it is lacking a formal "API Reference" docs. The documentation right now is nicely formatted and a good read when you have time, but not a great way to quickly find what you are looking for. This is maybe for another time though. For now just a list of all supported decorators would probably help both newcomers and regular users refresh their knowledge and find what they are looking for.

closed time in 4 days

reilem

issue commentMichalLytek/type-graphql

An overview of all decorators

@reilem Thanks for reporting this 😉

I will close this issue in favor of #17 where I'll track the progress. In the meantime you can explore d.ts file to know about all available decorators. There are not so many like with class-validators and they all are described in the docs text.

reilem

comment created time in 4 days

fork skene/worker-typescript-template

ʕ •́؈•̀) TypeScript template for Cloudflare Workers

fork in 4 days

issue commentMichalLytek/type-graphql

Cannot use GraphQLSchema from another module or realm

In my case, realized I was using graphql v15.x.x in my application package.json while graphql-yoga was using graphql v14.x.x. Deleted the v15.x.x and replaced it with v14.x.x works. That created a single graphql v14.x.x to be used.

Hope this helps.

lal12

comment created time in 4 days

startedobezuk/cf-workers-link-shortener

started time in 4 days

issue commentMichalLytek/type-graphql

Adding any @FieldResolver crashes build

One thing to mention is that I'm able to run the code just fine with ts-node or ts-node-dev.

However, when I was trying to build the source and run it with node, I got the error.

Here's how I am building the source with tsc and babel:

tsc && babel ./src --out-dir ./build --extensions '.ts,.js'

Not sure if it's babel not respecting the emitDecoratorMetadata? here's my babel.config.js:



module.exports = function(api) {
  api.cache(true);

  const presets = [
    '@babel/env',
    '@babel/preset-typescript',
  ];
  const plugins = [
    [
      "module-resolver",
      {
        "root": [
          "."
        ],
        "alias": {
          "@common": "./src/common",
          "@services": "./src/services",
          "@entities": "./src/entities",
          "@interfaces": "./src/interfaces",
          "@repositories": "./src/repositories",
          "@db": "./src/db",
          "@graphql": "./src/graphql"
        },
        "extensions": [
          ".js",
          ".ts"
        ]
      }
    ],
    'babel-plugin-transform-typescript-metadata',
    [
      '@babel/plugin-proposal-decorators',
      {
        legacy: true
      }
    ],
    [
      '@babel/plugin-proposal-class-properties',
      {
        loose: true
      }
    ],
    '@babel/proposal-object-rest-spread',
  ];

  return {
    presets,
    plugins,
  };
}
jaminhaber

comment created time in 4 days

issue commentMichalLytek/type-graphql

Adding any @FieldResolver crashes build

I hit the same issue even with target: es2018. I have a similar set up as @jaminhaber, I logged out the def object:

{
  kind: 'external',
  methodName: 'user',
  schemaName: 'user',
  target: [Function: AdminManagerResolver],
  getType: [Function: getType],
  typeOptions: {},
  complexity: undefined,
  description: undefined,
  deprecationReason: undefined,
  resolverClassMetadata: {
    target: [Function: AdminManagerResolver],
    getObjectType: [Function (anonymous)],
    isAbstract: false
  },
  params: [
    {
      kind: 'root',
      target: [Function: AdminManagerResolver],
      methodName: 'user',
      index: 0,
      propertyName: undefined,
      getType: [Function: getType]
    }
  ],
  roles: undefined,
  middlewares: [],
  directives: [],
  extensions: {},
  getObjectType: [Function (anonymous)]
}

This is what my FieldResolver looks like:

@FieldResolver(() => User)
  public async user(@Root() manager: Manager): Promise<User> {
    return this.managerLoaders.user.load(manager.id);
  }

I made sure the tsconfig.json is correct based on the link provided above, any thoughts?

jaminhaber

comment created time in 4 days

startedwelldone-software/why-did-you-render

started time in 4 days

issue openedMichalLytek/type-graphql

An overview of all decorators

Describe the issue It would be nice to have a list of all decorators available, similar to class-validator has: https://github.com/typestack/class-validator#validation-decorators

This offers a good quick overview of everything that is possible, and could contain links to the actual docs with more info.

Are you able to make a PR that fix this? It would be nice to first know if this is something that will be added, and where (README or docs site). But if it's not too much work I could give it a go 😄

Additional context Overall this project feels like it is lacking a formal "API Reference" docs. The documentation right now is nicely formatted and a good read when you have time, but not a great way to quickly find what you are looking for. This is maybe for another time though. For now just a list of all supported decorators would probably help both newcomers and regular users refresh their knowledge and find what they are looking for.

created time in 4 days

push eventMichalLytek/type-graphql

Michał Lytek

commit sha 77c93ecc197ef7e51c46a2f874d238b2eb6e643c

docs(examples): upgrade apollo cache example from apollo engine

view details

push time in 5 days

startedbendyzx/imagesaver

started time in 6 days

created repositorysteersbob/nats-demo

created time in 6 days

startedalyssaxuu/screenity

started time in 8 days

startedseek-oss/braid-design-system

started time in 9 days

startedcode-hike/codehike

started time in 9 days

issue commentMichalLytek/type-graphql

Inconsistent behavior for defaultValue and nullable on input types

A runtime error while building the schema?

this happens. thrown by type-graphql itself at https://github.com/MichalLytek/type-graphql/blob/b45961a5929d4534a09081bb12c7b5219edd13f4/src/helpers/types.ts#L57

It doesn't make sense. What is the purpose of default value if the field is required and you can't provide null value or omit the arg/field?

required is the wrong semantic here. nullable config does not make a direct statement about whether or not a client is required to provide a value. nullable config is about what the resolver is expected to get. whether or not the client has to provide a value (semantic: required value) depends on the configuration of nullable and default value. see also the discussion linked in https://github.com/graphql/graphql-spec/issues/570

example: what is the semantic of nullable: false, defaultValue: 'foo' for a string field/arg?

  • the resolver always gets a string, since not nullable
  • the query issuer may not provide a value, since default value is available
  • if the query issuer does provide a value, it must be a string, since not nullable

example: what is the semantic of nullable: true, defaultValue: 'foo' for a string field/arg?

  • the resolver gets a string or null, since nullable
  • the query issuer may not provide a value, since default value is available
  • if the query issuer does provide a value, it must be a string or null, since nullable

example: what is the semantic of nullable: false for a string field/arg?

  • the resolver gets a string, since not nullable
  • the query issuer must provide a value and it must be a string, since not nullable and no default value is available

conclusion:

  • what the resolver is about to expect depends only on nullable
  • what the query issuer is expected to provide depends on nullable and defaultValue
backbone87

comment created time in 11 days

issue commentMichalLytek/type-graphql

graphql-subscription dependency causing memory leak

Problem is, this pull request is over a year old and it seems it won't be merged in.

So it's time for community to fork and maintain the updated version 😉

This does not solve our problem anymore with npm 7 - something to do with SemVer for packages installed directly from Git.

So go ask npm team about overriding dependencies like a yarn can do 😛

Not sure what the solution would be.

I have no idea too 🙄 Maybe in v2.0.0 I'll integrate custom subscriptions engine with compatible API for other pubsub addons (redis, etc.).

urossmolnik

comment created time in 11 days

issue commentMichalLytek/type-graphql

Inconsistent behavior for defaultValue and nullable on input types

results in a definition error.

What do you mean? A runtime error while building the schema? An explicitly named error is thrown? Every query results in error? Or the definition is not matching your expectation?

backbone87

comment created time in 11 days

issue commentMichalLytek/type-graphql

Integration with typegoose

Thank you @MichalLytek

danpaugo

comment created time in 11 days

issue closedMichalLytek/type-graphql

Using typegraphql with aws appsync

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen. You can also propose how the new API should looks like.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

closed time in 11 days

himanshu199728

issue commentMichalLytek/type-graphql

Using typegraphql with aws appsync

Closing for housekeeping purposes as I have no idea what the feature request is about 🔒

If you have questions how to achieve something, like how to use TypeGraphQL with AWS AppSync, please ask on stackoverlow or gitter chat.

himanshu199728

comment created time in 11 days

issue openedMichalLytek/type-graphql

Inconsistent behavior for defaultValue and nullable on input types

Describe the Bug A field in an input type or argument list is set to nullable: true, if a default is provided, even when the global nullable is false. Explicitly specifying nullable: false results in a definition error.

On the behavior regarding argument lists and input types with default values and nullable: https://github.com/graphql/graphql-spec/issues/570

I mentioned this in https://github.com/MichalLytek/type-graphql/issues/498#issuecomment-723673596, but created this as a separate issue since the linked issue also argues about object types (while this one is only about input types) and to increase visibility.

To Reproduce

@InputType()
class MyInput {
  // definition error, but should be `foo: Int! = 0`
  @Field(() => Int, { nullable: false; defaultValue: 0 })
  public foo!: number;

  // with global nullable: false results in `foo: Int = 0`, but should be `foo: Int! = 0`
  @Field(() => Int, { defaultValue: 0 })
  public foo!: number;
}

Expected Behavior

Lets a asume a string argument or input field:

  • nullable: true (type-graphql behaves correctly)
    • omitted: resolver gets undefined (this is a "legacy" behavior of graphql-js)
    • passed null: resolver gets null
    • passed a string: resolver gets the string
  • nullable: false (type-graphql behaves correctly) (this is the only case where a value must be passed when querying)
    • omitted: error
    • passed null: error
    • passed a string: resolver gets the string
  • nullable: true, defaultValue: null (type-graphql behaves correctly)
    • omitted: resolver gets null
    • passed null: resolver gets null
    • passed a string: resolver gets the string
  • nullable: true, defaultValue: 'foo' (type-graphql behaves correctly)
    • omitted: resolver gets string "foo"
    • passed null: resolver gets null
    • passed a string: resolver gets the string
  • nullable: false, defaultValue: null: invalid definition (type-graphql behaves correctly)
  • nullable: false, defaultValue: 'foo' (type-graphql behaves incorrectly: if nullable: false is set explicitly, then type-graphql incorrectly rejects the definition as invalid. if nullable: false is set implicitly through global setting, then type-graphql silently converts the field to a nullable: true field. both cases are incorrect behavior.)
    • omitted: resolver gets string "foo"
    • passed null: error
    • passed a string: resolver gets the string

created time in 11 days

issue commentMichalLytek/type-graphql

Default values in default value of input types

@croossin i solved it by reusing the default value of the "parent" input object:

const DEFAULT_FOO = { bar: 0 };

@InputObject()
class FooInput {
  @Field({ defaultValue: DEFAULT_FOO.bar })
  public bar!: number;
}

@InputObject()
class MyInput {
  @Field({ defaultValue: DEFAULT_FOO })
  public foo!: FooInput;
}
backbone87

comment created time in 11 days

startedpmndrs/valtio

started time in 11 days

issue commentMichalLytek/type-graphql

Using typegraphql with aws appsync

Please fill the template, otherwise I'll close this issue.

himanshu199728

comment created time in 12 days

more