Skip to content

Releases: eddeee888/graphql-code-generator-plugins

@eddeee888/gcg-typescript-resolver-files@0.9.4

12 Jun 12:55
d682d2e
Compare
Choose a tag to compare

Patch Changes

  • b734d8b: Revert VariableStatement assumption that can cause runtime errors

@eddeee888/gcg-typescript-resolver-files@0.9.3

11 Jun 10:43
22a4725
Compare
Choose a tag to compare

Patch Changes

  • 386bb30: Fix issue where variable statements without type node does not get type node added
  • 6715a49: Prefer detected scalar file on filesystem over scalar modules when wiring up resolvers map
  • 86babc6: Fix issue where GraphQLScalarType is imported all the time, regardless of whether it's used

@eddeee888/gcg-typescript-resolver-files@0.9.2

29 May 14:31
7367d8d
Compare
Choose a tag to compare

Patch Changes

  • 538eb24: Fix issue where whitelisted/blacklisted module can incorrectly detect extended resolvers to wire up to resolvers.generated.ts
  • 263604f: Fix externalResolvers config not working for enums

@eddeee888/gcg-typescript-resolver-files@0.9.1

28 May 12:53
ce30dca
Compare
Choose a tag to compare

Patch Changes

  • e999093: Add hooks to defineConfig context

@eddeee888/gcg-typescript-resolver-files@0.9.0

24 May 09:17
891bcfb
Compare
Choose a tag to compare

Minor Changes

  • 454d1df: Add resolverGeneration 'minimal' mode

    minimal is the equivalent of:

    {
      "query": "*",
      "mutation": "*",
      "subscription": "*",
      "scalar": "*",
      "object": "",
      "union": "",
      "interface": ""
    }
  • 454d1df: Implement file auto-wireup if detected at the right filesystem location

Patch Changes

  • c48e8c6: Update internals to avoid parsing schema twice

@eddeee888/gcg-typescript-resolver-files@0.8.1

18 May 09:31
d50f03b
Compare
Choose a tag to compare

Patch Changes

  • 3213b73: Bump base codegen plugin to apply patches from upstream
  • d6df63c: Force generate object types with mappers to avoid runtime errors
  • Updated dependencies [3213b73]
    • @eddeee888/gcg-server-config@0.2.1

@eddeee888/gcg-server-config@0.2.1

18 May 09:31
d50f03b
Compare
Choose a tag to compare

Patch Changes

  • 3213b73: Bump base codegen plugin to apply patches from upstream

@eddeee888/gcg-typescript-resolver-files@0.8.0

18 Apr 10:55
e842560
Compare
Choose a tag to compare

Minor Changes

  • 6bf957d: Extend resolverGeneration functionality

    Allow passing in an object that to control which files to be generated. By default (i.e. resolverGeneration: 'recommended'), it's equivalent to the following settings:

    defineConfig({
      resolverGeneration: {
        query: '*',
        mutation: '*',
        subscription: '*',
        scalar: '*',
        object: '*',
        union: '',
        interface: '',
      },
    });

    Each option can take a glob pattern to tell the preset which files of a given type to be generated based on its normalized file name.


    A normalized file name has this pattern:

    <Module name>.<Top-level type name>.<Field resolver>?
    

    Consider this schema:

    # src/schema/pet/schema.graphql
    extend type Query {
      pets: [Pet!]!
    }
    
    type Cat {
      id: ID!
    }
    type Dog {
      id: ID!
    }
    union Pet = Cat | Dog
    
    # src/schema/user/schema.graphql
    extend type Mutation {
      createUser(id: ID!): CreateUserResult!
    }
    
    type User {
      id: ID!
    }
    
    type CreateUserOk {
      result: User!
    }
    type CreateUserError {
      error: String!
    }
    union CreateUserResult = CreateUserOk | CreateUserError

    Then, the generated files and normalised names are:

    • src/schema/pet/resolvers/Query/pets.ts, affected by query option, normalized name: pet.Query.pets
    • src/schema/pet/resolvers/Cat.ts, affected by object option, normalized name: pet.Cat
    • src/schema/pet/resolvers/Dog.ts, affected by object option, normalized name: pet.Dog
    • src/schema/pet/resolvers/Pet.ts, affected by union option, normalized name: pet.Pet
    • src/schema/user/resolvers/Mutation/createUser.ts, affected by mutation option, normalized name: user.Mutation.createUser
    • src/schema/user/resolvers/User.ts, affected by object option, normalized name: user.User
    • src/schema/user/resolvers/CreateUserOk.ts, affected by object option, normalized name: user.CreateUserOk
    • src/schema/user/resolvers/CreateUserError.ts, affected by object option, normalized name: user.CreateUserError
    • src/schema/user/resolvers/CreateUserResult.ts, affected by union option, normalized name: user.CreateUserResult

    Now, let's say we want to disable all union files, types ending with Ok or Error, the config would look like this:

    defineConfig({
      resolverGeneration: {
        query: '*',
        mutation: '*',
        subscription: '*',
        scalar: '*',
        object: ['!*.*Ok', '!*.*Error'], // Disables objects ending with `Ok` or `Error` in every module
        union: '', // Empty string disables all file generation of relevant type in every module
        interface: '*',
      },
    });
  • 00a80bc: Bump ts-morph to v22 which requires TypeScript 5.4

Patch Changes

  • 6bf957d: Add colours to logs

  • de5599b: Move union and interface config from server config to server preset

    This config is fairly opinionated and may not make sense being on server config. However, it is definitely the default mode of operation we want to use for server preset to avoid having extra files, simplifying the setup.

  • Updated dependencies [de5599b]

    • @eddeee888/gcg-server-config@0.2.0

@eddeee888/gcg-server-config@0.2.0

18 Apr 10:55
e842560
Compare
Choose a tag to compare

Minor Changes

  • de5599b: Move union and interface config from server config to server preset

    This config is fairly opinionated and may not make sense being on server config. However, it is definitely the default mode of operation we want to use for server preset to avoid having extra files, simplifying the setup.

@eddeee888/gcg-typescript-resolver-files@0.7.5

14 Apr 07:14
31b09fa
Compare
Choose a tag to compare

Patch Changes

  • 4ab8016: Use TypeScript typechecker to collect type properties

    Previously, we manually walked through the program to collect properties of types. This is problematic as there are lots of ways to declare mappers that we cannot manually handle. On top of this, type property properties can be handled natively correctly by TypeScript typechecker.

    Note: class declaration private properties are picked up by TypeScript typechecker, which could be problematic. We are keeping that case as-is.