Skip to content

February 14, 2023

Compare
Choose a tag to compare
@github-actions github-actions released this 14 Feb 19:44
· 701 commits to main since this release
b7ac516

@graphql-codegen/[email protected]

Minor Changes

  • #70 e6e85a999 Thanks @aplr! - Make typescript-generic-sdk respect the documentMode external option by prefixing types with the value configured in importOperationTypesFrom as documented.

@graphql-codegen/[email protected]

Patch Changes

  • #269 d28569b9a Thanks @plmercereau! - Initial release

    The typescript-nhost plugin generates the schema for the Typescript Nhost SDK.

    What the plugin does:

    • Generate types with graphql-codegem/typescript, following a strict configuration. (the plugin does not require @graphql-codegen/typescript to be installed by the user but is use as a dependency).
    • Minify the introspection object with '@urql/introspection
    • Export the introspection object as well as all the types so they can be accessed through a default import schema from './generated-schema'

    Installation

    yarn add -D @graphql-codegen/cli @graphql-codegen/typescript-nhost

    Then configure the code generator by adding a codegen.yaml file:

    schema:
      - http://localhost:1337/v1/graphql:
          headers:
            x-hasura-admin-secret: nhost-admin-secret
    generates:
      ./src/schema.ts:
        plugins:
          - typescript-nhost

    Usage

    yarn add @nhost/nhost-js
    import { NhostClient } from '@nhost/nhost-js';
    import schema from './schema';
    
    const nhost = new NhostClient({ subdomain: 'localhost', schema });

    A GraphQL query named todos will then be accessible through:

    const todos = await nhost.graphql.query.todos({ select: { contents: true } });

    The todos object will be strongly typed based on the GraphQL schema, and the fields that would have been selected in the query.

@graphql-codegen/[email protected]

Patch Changes

  • #248 98d3da6b1 Thanks @DominicGBauer! - fix: update imported api to use alternate name

    Previously imported api name did not update actual implementation

    import { newApiName } from '../baseApi'
    
    ...
    const injectedApi = oldApiName...
    
    

    now it does update the implementation

    import { newApiName } from '../baseApi'
    
    ...
    const injectedApi = newApiName...
    ...