gqty

The No-GraphQL Client for TypeScript

MIT License

Downloads
51.5K
Stars
880
Committers
14

Bot releases are visible (Hide)

gqty - @gqty/[email protected]

Published by github-actions[bot] about 2 years ago

2.1.1

Patch Changes

  • 929f2b15: fix(react): stale state in useTransactionQuery
gqty - @gqty/[email protected]

Published by github-actions[bot] about 2 years ago

2.0.1

Patch Changes

  • f6277a4: Don't force unsubscribe in cleanup functions
gqty - [email protected]

Published by github-actions[bot] over 2 years ago

2.3.0

Minor Changes

  • 6ecd2b0: Use lodash mergeWith from "@gqty/utils" package
  • 59d38ad: Change variable aliasing to be deterministic with cached and sliced sha1 hashing

Patch Changes

gqty - @gqty/[email protected]

Published by github-actions[bot] over 2 years ago

3.3.0

Minor Changes

  • 323ecbe: A new option enumsAsConsts is added to the GQtyConfig

    Here's a sample of how it differs from enum

    enum Enum {
      A_B_C = 'A_B_C',
      X_Y_Z = 'X_Y_Z',
      _TEST = '_TEST',
      My_Value = 'My_Value',
    }
    
    export const EnumAsConst = {
      ABC: 'A_B_C',
      XYZ: 'X_Y_Z',
      Test: '_TEST',
      MyValue: 'My_Value',
    } as const;
    export type EnumAsConst = typeof EnumAsConst[keyof typeof EnumAsConst];
    
    function useEnum(value: Enum) {}
    function useEnumAsConst(value: EnumAsConst) {}
    
    useEnum(Enum.A_B_C); // Ok
    useEnum('A_B_C'); // Error: Argument of type '"A_B_C"' is not assignable to parameter of type 'Enum'.
    
    useEnumAsConst(Enum.A_B_C); // Ok
    useEnumAsConst(EnumAsConst.ABC); // Ok
    useEnumAsConst('A_B_C'); // Ok
    

    See also:

gqty - @gqty/[email protected]

Published by github-actions[bot] over 2 years ago

3.2.0

Minor Changes

  • dd47986: New option "fetchOptions", added to the resolved client function, that allows for giving extra configurations to the expected fetch call.

    This enables, for example, the customization of the headers sent for a specific query or to pass an AbortSignal.

    import { resolved, query } from '../gqty';
    
    // ...
    
    const controller = new AbortController();
    
    await resolved(() => query.currentUser?.email, {
      fetchOptions: {
        headers: {
          'Content-Type': 'application/json',
          authorization: 'secret_token',
        },
        signal: controller.signal,
      },
    });
    

    For already generated clients to be able to use this new option, it is required manually modify the existing query fetcher, to do for example:

    const queryFetcher: QueryFetcher = async function (
      query,
      variables,
      fetchOptions
    ) {
      const response = await fetch(endpoint, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          query,
          variables,
        }),
        ...fetchOptions,
      });
    
      const json = await response.json();
    
      return json;
    };
    
  • b7c8710: Fix generator: Argument is required only if it is non-null and does not have default value. Previously only checking if it is non-null.

Patch Changes

gqty - [email protected]

Published by github-actions[bot] over 2 years ago

2.2.0

Minor Changes

  • dd47986: New option "fetchOptions", added to the resolved client function, that allows for giving extra configurations to the expected fetch call.

    This enables, for example, the customization of the headers sent for a specific query or to pass an AbortSignal.

    import { resolved, query } from '../gqty';
    
    // ...
    
    const controller = new AbortController();
    
    await resolved(() => query.currentUser?.email, {
      fetchOptions: {
        headers: {
          'Content-Type': 'application/json',
          authorization: 'secret_token',
        },
        signal: controller.signal,
      },
    });
    

    For already generated clients to be able to use this new option, it is required manually modify the existing query fetcher, to do for example:

    const queryFetcher: QueryFetcher = async function (
      query,
      variables,
      fetchOptions
    ) {
      const response = await fetch(endpoint, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          query,
          variables,
        }),
        ...fetchOptions,
      });
    
      const json = await response.json();
    
      return json;
    };
    
gqty - @gqty/[email protected]

Published by github-actions[bot] almost 3 years ago

3.1.0

Minor Changes

  • 4c43e7a: New "transformSchema" configuration

Patch Changes

  • 46efcd2: Use undici for network schema introspection
  • 18e719b: Fix interop graphql import
gqty - @gqty/[email protected]

Published by github-actions[bot] almost 3 years ago

3.0.1

Patch Changes

  • 3ac7bee: Use "import * as" to prevent esm-cjs interop issues
gqty - @gqty/[email protected]

Published by github-actions[bot] almost 3 years ago

2.0.2

Patch Changes

  • 5ed4951: Remove "serialize-error" dependency
gqty - @gqty/[email protected]

Published by github-actions[bot] almost 3 years ago

3.0.0

Major Changes

  • c7b80c8: Minimize npm dependencies

Minor Changes

  • f9fd0b9: Added the ability to use fast-glob patterns in the schema generate endpoint to be able to use and combine multiple gql/graphql schema files
gqty - @gqty/[email protected]

Published by github-actions[bot] almost 3 years ago

2.3.1

Patch Changes

  • 96ab370: Change export syntax to fix bundling issues, show a warning on existent generated clients with export const { syntax.

    Closes #292

gqty - @gqty/[email protected]

Published by github-actions[bot] almost 3 years ago

2.1.0

Minor Changes

  • 6ced359: New "$state.error" property in "useQuery" which gives the last scheduler Error, for more in-depth error management it's still recommended to use useMetaState hook

    Closes #111

Patch Changes

  • 353b9cb: Fix require interop
gqty - @gqty/[email protected]

Published by github-actions[bot] almost 3 years ago

2.3.0

Minor Changes

  • 0b1860a: lexicographic sort GraphQL Schema before generating
  • 82fd259: Use ESM for CLI

Patch Changes

gqty - [email protected]

Published by github-actions[bot] almost 3 years ago

2.1.0

Minor Changes

  • 6df0318: Add new Core configuration "depthLimit" (by default is 15), needed to prevent possible infinite recursion, after the specified depth is reached, the proxy creation is stopped returning null.
gqty - @gqty/[email protected]

Published by github-actions[bot] almost 3 years ago

2.0.1

Patch Changes

  • 826bc98: Change React import to "* as React"
  • Updated dependencies [d6d0a22]
gqty - [email protected]

Published by github-actions[bot] almost 3 years ago

2.0.4

Patch Changes

  • d6d0a22: Fix check Error.captureStackTrace before calling it
gqty - @gqty/[email protected]

Published by github-actions[bot] almost 3 years ago

2.2.0

Minor Changes

  • cba5c43: Don't skip config read on NODE_ENV === "test"

  • a4fc294: New Envelop / graphql-ez plugin that automatically generates gqty code based on schema and gqty.config.cjs

    // graphql-ez
    
    // ...
    import { useGenerateGQty } from '@gqty/cli/envelop';
    
    const ezApp = CreateApp({
      // ...
      envelop: {
        plugins: [
          // ...
          useGenerateGQty({
            // ...
          }),
        ],
      },
    });
    
    // Envelop
    
    import { envelop } from '@envelop/core';
    import { useGenerateGQty } from '@gqty/cli/envelop';
    
    //...
    
    const getEnveloped = envelop({
      plugins: [
        // ...
        useGenerateGQty({
          // ...
        }),
      ],
    });
    

Patch Changes

  • aab8e48: Fix: don't put invalid default generate endpoint

  • f72aa23: GraphQL v16 compatibility

    closes #268

gqty - @gqty/[email protected]

Published by github-actions[bot] about 3 years ago

2.1.2

Patch Changes

  • 2b33e6a: Add missing useSubscription in generated react code
Package Rankings
Top 2.15% on Npmjs.org
Badges
Extracted from project README
Documentation Discord
Related Projects