···11import { stringifyVariables } from '@urql/core';
22-import { Resolver, Variables, NullArray } from '../types';
22+import type { Resolver, Variables, NullArray } from '../types';
3344export type MergeMode = 'before' | 'after';
55
+2-2
exchanges/graphcache/src/helpers/help.ts
···33// Every warning and error comes with a number that uniquely identifies them.
44// You can read more about the messages themselves in `docs/graphcache/errors.md`
5566-import {
77- Kind,
66+import type {
87 ExecutableDefinitionNode,
98 InlineFragmentNode,
109} from '@0no-co/graphql.web';
1010+import { Kind } from '@0no-co/graphql.web';
11111212export type ErrorCode =
1313 | 1
+2-6
exchanges/graphcache/src/helpers/operation.ts
···11-import {
22- Operation,
33- RequestPolicy,
44- OperationDebugMeta,
55- makeOperation,
66-} from '@urql/core';
11+import type { Operation, RequestPolicy, OperationDebugMeta } from '@urql/core';
22+import { makeOperation } from '@urql/core';
7384// Returns the given operation result with added cacheOutcome meta field
95export const addMetadata = (
+7-5
exchanges/graphcache/src/offlineExchange.ts
···11import { pipe, share, merge, makeSubject, filter, onPush } from 'wonka';
2233-import {
33+import type {
44 Operation,
55 OperationResult,
66 Exchange,
77 ExchangeIO,
88 CombinedError,
99 RequestPolicy,
1010- stringifyDocument,
1111- createRequest,
1212- makeOperation,
1310} from '@urql/core';
1111+import { stringifyDocument, createRequest, makeOperation } from '@urql/core';
14121515-import { SerializedRequest, CacheExchangeOpts, StorageAdapter } from './types';
1313+import type {
1414+ SerializedRequest,
1515+ CacheExchangeOpts,
1616+ StorageAdapter,
1717+} from './types';
1618import { cacheExchange } from './cacheExchange';
1719import { toRequestPolicy } from './helpers/operation';
1820
+1-1
exchanges/graphcache/src/operations/invalidate.ts
···11import * as InMemoryData from '../store/data';
22import { keyOfField } from '../store/keys';
33-import { FieldArgs } from '../types';
33+import type { FieldArgs } from '../types';
4455interface PartialFieldInfo {
66 fieldKey: string;
+7-6
exchanges/graphcache/src/operations/query.ts
···11-import { formatDocument, FormattedNode, CombinedError } from '@urql/core';
11+import type { FormattedNode, CombinedError } from '@urql/core';
22+import { formatDocument } from '@urql/core';
2333-import {
44+import type {
45 FieldNode,
56 DocumentNode,
67 FragmentDefinitionNode,
78} from '@0no-co/graphql.web';
891010+import type { SelectionSet } from '../ast';
911import {
1012 getSelectionSet,
1113 getName,
1212- SelectionSet,
1314 getFragmentTypeName,
1415 getFieldAlias,
1516 getFragments,
···1920 getDirectives,
2021} from '../ast';
21222222-import {
2323+import type {
2324 Variables,
2425 Data,
2526 DataField,
···3031} from '../types';
31323233import { joinKeys, keyOfField } from '../store/keys';
3333-import { Store } from '../store/store';
3434+import type { Store } from '../store/store';
3435import * as InMemoryData from '../store/data';
3536import { warn, pushDebugNode, popDebugNode } from '../helpers/help';
36373838+import type { Context } from './shared';
3739import {
3838- Context,
3940 makeSelectionIterator,
4041 ensureData,
4142 makeContext,
···23232424describe('makeSelectionIterator', () => {
2525 it('emits all fields', () => {
2626- const selection = selectionOfDocument(
2727- gql`
2828- {
2929- a
3030- b
3131- c
3232- }
3333- `
3434- );
2626+ const selection = selectionOfDocument(gql`
2727+ {
2828+ a
2929+ b
3030+ c
3131+ }
3232+ `);
3533 const iterate = makeSelectionIterator(
3634 'Query',
3735 'Query',
+7-12
exchanges/graphcache/src/operations/shared.ts
···11-import { CombinedError, ErrorLike, FormattedNode } from '@urql/core';
11+import type { CombinedError, ErrorLike, FormattedNode } from '@urql/core';
2233-import {
44- Kind,
33+import type {
54 FieldNode,
65 InlineFragmentNode,
76 FragmentDefinitionNode,
87} from '@0no-co/graphql.web';
88+import { Kind } from '@0no-co/graphql.web';
991010-import {
1111- isDeferred,
1212- getTypeCondition,
1313- getSelectionSet,
1414- getName,
1515- SelectionSet,
1616-} from '../ast';
1010+import type { SelectionSet } from '../ast';
1111+import { isDeferred, getTypeCondition, getSelectionSet, getName } from '../ast';
17121813import { warn, pushDebugNode, popDebugNode } from '../helpers/help';
1914import { hasField, currentOperation, currentOptimistic } from '../store/data';
2015import { keyOfField } from '../store/keys';
2121-import { Store } from '../store/store';
1616+import type { Store } from '../store/store';
22172318import { getFieldArguments, shouldInclude, isInterfaceOfType } from '../ast';
24192525-import {
2020+import type {
2621 Fragments,
2722 Variables,
2823 DataField,
+8-7
exchanges/graphcache/src/operations/write.ts
···11-import { formatDocument, FormattedNode, CombinedError } from '@urql/core';
11+import type { FormattedNode, CombinedError } from '@urql/core';
22+import { formatDocument } from '@urql/core';
2333-import {
44+import type {
45 FieldNode,
56 DocumentNode,
67 FragmentDefinitionNode,
78} from '@0no-co/graphql.web';
891010+import type { SelectionSet } from '../ast';
911import {
1012 getFragments,
1113 getMainOperation,
···1416 isFieldAvailableOnType,
1517 getSelectionSet,
1618 getName,
1717- SelectionSet,
1819 getFragmentTypeName,
1920 getFieldAlias,
2021} from '../ast';
21222223import { invariant, warn, pushDebugNode, popDebugNode } from '../helpers/help';
23242424-import {
2525+import type {
2526 NullArray,
2627 Variables,
2728 Data,
···3334} from '../types';
34353536import { joinKeys, keyOfField } from '../store/keys';
3636-import { Store } from '../store/store';
3737+import type { Store } from '../store/store';
3738import * as InMemoryData from '../store/data';
38394040+import type { Context } from './shared';
3941import {
4040- Context,
4142 makeSelectionIterator,
4243 ensureData,
4344 makeContext,
···268269269270 // Execute optimistic mutation functions on root fields, or execute recursive functions
270271 // that have been returned on optimistic objects
271271- let resolver: OptimisticMutationResolver | void;
272272+ let resolver: OptimisticMutationResolver | undefined;
272273 if (ctx.optimistic && rootField === 'mutation') {
273274 resolver = ctx.store.optimisticMutations[fieldName];
274275 if (!resolver) continue;
+1-1
exchanges/graphcache/src/store/data.ts
···11import { stringifyVariables } from '@urql/core';
2233-import {
33+import type {
44 Link,
55 EntityField,
66 FieldInfo,
+1-1
exchanges/graphcache/src/store/keys.ts
···11import { stringifyVariables } from '@urql/core';
22-import { FieldArgs, FieldInfo, KeyInfo } from '../types';
22+import type { FieldArgs, FieldInfo, KeyInfo } from '../types';
3344export const keyOfField = (fieldName: string, args?: FieldArgs) =>
55 args ? `${fieldName}(${stringifyVariables(args)})` : fieldName;
+5-4
exchanges/graphcache/src/store/store.ts
···11-import { TypedDocumentNode, formatDocument, createRequest } from '@urql/core';
11+import type { TypedDocumentNode } from '@urql/core';
22+import { formatDocument, createRequest } from '@urql/core';
2333-import {
44+import type {
45 Cache,
56 FieldInfo,
67 ResolverConfig,
···2627import { keyOfField } from './keys';
2728import * as InMemoryData from './data';
28293030+import type { SchemaIntrospector } from '../ast';
2931import {
3030- SchemaIntrospector,
3132 buildClientSchema,
3233 expectValidKeyingConfig,
3334 expectValidUpdatesConfig,
···4243 * @internal
4344 */
4445export class Store<
4545- C extends Partial<CacheExchangeOpts> = Partial<CacheExchangeOpts>
4646+ C extends Partial<CacheExchangeOpts> = Partial<CacheExchangeOpts>,
4647> implements Cache
4748{
4849 data: InMemoryData.InMemoryData;
+5-5
exchanges/graphcache/src/types.ts
···11-import {
11+import type {
22 AnyVariables,
33 DocumentInput,
44 RequestExtensions,
···77 ErrorLike,
88} from '@urql/core';
991010-import { DocumentNode, FragmentDefinitionNode } from '@0no-co/graphql.web';
1111-import { IntrospectionData } from './ast';
1010+import type { DocumentNode, FragmentDefinitionNode } from '@0no-co/graphql.web';
1111+import type { IntrospectionData } from './ast';
12121313/** Nullable GraphQL list types of `T`.
1414 *
···685685export type Resolver<
686686 ParentData = DataFields,
687687 Args = Variables,
688688- Result = ResolverResult
688688+ Result = ResolverResult,
689689> = {
690690 bivarianceHack(
691691 parent: ParentData,
···862862 */
863863export type OptimisticMutationResolver<
864864 Args = Variables,
865865- Result = Link<Data> | Scalar
865865+ Result = Link<Data> | Scalar,
866866> = {
867867 bivarianceHack(
868868 args: Args,
+2-3
exchanges/persisted/src/persistedExchange.ts
···99 pipe,
1010} from 'wonka';
11111212-import {
1313- makeOperation,
1414- stringifyDocument,
1212+import type {
1513 PersistedRequestExtensions,
1614 TypedDocumentNode,
1715 OperationResult,
···2018 Operation,
2119 OperationContext,
2220} from '@urql/core';
2121+import { makeOperation, stringifyDocument } from '@urql/core';
23222423import { hash } from './sha256';
2524
+2-7
exchanges/persisted/src/test-utils.ts
···11-import {
22- gql,
33- GraphQLRequest,
44- OperationContext,
55- Operation,
66- makeOperation,
77-} from '@urql/core';
11+import type { GraphQLRequest, OperationContext, Operation } from '@urql/core';
22+import { gql, makeOperation } from '@urql/core';
8394const context: OperationContext = {
105 fetchOptions: {
+2-7
exchanges/populate/src/helpers/node.ts
···11-import {
22- NameNode,
33- GraphQLOutputType,
44- isWrappingType,
55- GraphQLWrappingType,
66- Kind,
77-} from 'graphql';
11+import type { NameNode, GraphQLOutputType, GraphQLWrappingType } from 'graphql';
22+import { isWrappingType, Kind } from 'graphql';
8394export type GraphQLFlatType = Exclude<GraphQLOutputType, GraphQLWrappingType>;
105
+2-3
exchanges/populate/src/helpers/traverse.ts
···11-import {
11+import type {
22 SelectionNode,
33- Kind,
43 ASTNode,
54 DefinitionNode,
65 GraphQLSchema,
76 GraphQLFieldMap,
88- isAbstractType,
97 FragmentDefinitionNode,
108 FragmentSpreadNode,
119} from 'graphql';
1010+import { Kind, isAbstractType } from 'graphql';
1211import { unwrapType, getName } from './node';
13121413export function traverse(
+13-9
exchanges/populate/src/populateExchange.ts
···11-import {
22- buildClientSchema,
11+import type {
32 FragmentDefinitionNode,
43 IntrospectionQuery,
55- isAbstractType,
66- Kind,
77- GraphQLObjectType,
84 SelectionNode,
95 GraphQLInterfaceType,
1010- valueFromASTUntyped,
1111- GraphQLScalarType,
126 FieldNode,
137 InlineFragmentNode,
148 FragmentSpreadNode,
159 ArgumentNode,
1610} from 'graphql';
1111+import {
1212+ buildClientSchema,
1313+ isAbstractType,
1414+ Kind,
1515+ GraphQLObjectType,
1616+ valueFromASTUntyped,
1717+ GraphQLScalarType,
1818+} from 'graphql';
1719import { pipe, tap, map } from 'wonka';
1818-import { Exchange, Operation, stringifyVariables } from '@urql/core';
2020+import type { Exchange, Operation } from '@urql/core';
2121+import { stringifyVariables } from '@urql/core';
19222020-import { getName, GraphQLFlatType, unwrapType } from './helpers/node';
2323+import type { GraphQLFlatType } from './helpers/node';
2424+import { getName, unwrapType } from './helpers/node';
2125import { traverse } from './helpers/traverse';
22262327/** Configuration options for the {@link populateExchange}'s behaviour */
+1-1
exchanges/refocus/src/refocusExchange.ts
···11import { pipe, tap } from 'wonka';
22-import { Exchange, Operation } from '@urql/core';
22+import type { Exchange, Operation } from '@urql/core';
3344/** Exchange factory that reexecutes operations after a user returns to the tab.
55 *
···11/* eslint-disable @typescript-eslint/no-use-before-define */
22import { filter, map, merge, pipe, tap } from 'wonka';
3344-import { Client } from '../client';
55-import { Exchange, Operation, OperationResult } from '../types';
44+import type { Client } from '../client';
55+import type { Exchange, Operation, OperationResult } from '../types';
6677import {
88 makeOperation,
+1-1
packages/core/src/exchanges/debug.ts
···11import { pipe, tap } from 'wonka';
22-import { Exchange } from '../types';
22+import type { Exchange } from '../types';
3344/** Simple log debugger exchange.
55 *
+1-1
packages/core/src/exchanges/dedup.ts
···11-import { Exchange } from '../types';
11+import type { Exchange } from '../types';
2233/** Default deduplication exchange.
44 * @deprecated
+1-1
packages/core/src/exchanges/fallback.ts
···11import { filter, pipe, tap } from 'wonka';
22-import { ExchangeIO, ExchangeInput } from '../types';
22+import type { ExchangeIO, ExchangeInput } from '../types';
3344/** Used by the `Client` as the last exchange to warn about unhandled operations.
55 *
+1-1
packages/core/src/exchanges/fetch.ts
···11/* eslint-disable @typescript-eslint/no-use-before-define */
22import { filter, merge, mergeMap, pipe, takeUntil, onPush } from 'wonka';
3344-import { Exchange } from '../types';
44+import type { Exchange } from '../types';
55import {
66 makeFetchBody,
77 makeFetchURL,
+2-2
packages/core/src/exchanges/map.ts
···11import { mergeMap, fromValue, fromPromise, pipe } from 'wonka';
22-import { Operation, OperationResult, Exchange } from '../types';
33-import { CombinedError } from '../utils';
22+import type { Operation, OperationResult, Exchange } from '../types';
33+import type { CombinedError } from '../utils';
4455/** Options for the `mapExchange` allowing it to react to incoming operations, results, or errors. */
66export interface MapExchangeOpts {
+1-1
packages/core/src/exchanges/ssr.ts
···11import type { GraphQLError } from '../utils/graphql';
22import { pipe, filter, merge, map, tap } from 'wonka';
33-import { Exchange, OperationResult, Operation } from '../types';
33+import type { Exchange, OperationResult, Operation } from '../types';
44import { addMetadata, CombinedError } from '../utils';
55import { reexecuteOperation, mapTypeNames } from './cache';
66
+5-12
packages/core/src/exchanges/subscription.ts
···11-import {
22- filter,
33- make,
44- merge,
55- mergeMap,
66- pipe,
77- Subscription,
88- Source,
99- takeUntil,
1010-} from 'wonka';
11+import type { Subscription, Source } from 'wonka';
22+import { filter, make, merge, mergeMap, pipe, takeUntil } from 'wonka';
113124import {
135 makeResult,
···168 makeOperation,
179} from '../utils';
18101919-import {
1111+import type {
2012 Exchange,
2113 ExecutionResult,
2214 Operation,
2315 OperationResult,
2416} from '../types';
25172626-import { FetchBody, makeFetchBody } from '../internal';
1818+import type { FetchBody } from '../internal';
1919+import { makeFetchBody } from '../internal';
27202821/** An abstract observer-like interface.
2922 *
···11/* eslint-disable prefer-rest-params */
22import { Kind } from '@0no-co/graphql.web';
33import type { DocumentNode, DefinitionNode } from './utils/graphql';
44-import { AnyVariables, TypedDocumentNode } from './types';
44+import type { AnyVariables, TypedDocumentNode } from './types';
55import { keyDocument, stringifyDocument } from './utils';
6677/** A GraphQL parse function, which may be called as a tagged template literal, returning a parsed {@link DocumentNode}.
+2-2
packages/core/src/internal/fetchOptions.ts
···55 extractFiles,
66} from '../utils';
7788-import { AnyVariables, GraphQLRequest, Operation } from '../types';
88+import type { AnyVariables, GraphQLRequest, Operation } from '../types';
991010/** Abstract definition of the JSON data sent during GraphQL HTTP POST requests. */
1111export interface FetchBody {
···2222 */
2323export function makeFetchBody<
2424 Data = any,
2525- Variables extends AnyVariables = AnyVariables
2525+ Variables extends AnyVariables = AnyVariables,
2626>(request: Omit<GraphQLRequest<Data, Variables>, 'key'>): FetchBody {
2727 const isAPQ =
2828 request.extensions &&
+4-3
packages/core/src/internal/fetchSource.ts
···4242 * and `split` are the common, cross-compatible base implementations.
4343 */
44444545-import { Source, fromAsyncIterable, onEnd, filter, pipe } from 'wonka';
4646-import { Operation, OperationResult, ExecutionResult } from '../types';
4545+import type { Source } from 'wonka';
4646+import { fromAsyncIterable, onEnd, filter, pipe } from 'wonka';
4747+import type { Operation, OperationResult, ExecutionResult } from '../types';
4748import { makeResult, makeErrorResult, mergeResultPatch } from '../utils';
48494950const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : null;
···153154) {
154155 let networkMode = true;
155156 let result: OperationResult | null = null;
156156- let response: Response | void;
157157+ let response: Response | undefined;
157158158159 try {
159160 // Delay for a tick to give the Client a chance to cancel the request
+1-1
packages/core/src/test-utils/samples.ts
···11import { gql } from '../gql';
2233-import {
33+import type {
44 ExecutionResult,
55 GraphQLRequest,
66 Operation,
+9-9
packages/core/src/types.ts
···55 ValueNode,
66 TypeNode,
77} from '@0no-co/graphql.web';
88-import { Subscription, Source } from 'wonka';
99-import { Client } from './client';
1010-import { CombinedError } from './utils/error';
88+import type { Subscription, Source } from 'wonka';
99+import type { Client } from './client';
1010+import type { CombinedError } from './utils/error';
11111212/** A GraphQL `DocumentNode` with attached generics for its result data and variables.
1313 *
···3030 */
3131export type TypedDocumentNode<
3232 Result = { [key: string]: any },
3333- Variables = { [key: string]: any }
3333+ Variables = { [key: string]: any },
3434> = DocumentNode & {
3535 /** Type to support `@graphql-typed-document-node/core`
3636 * @internal
···8080 */
8181export type DocumentInput<
8282 Result = { [key: string]: any },
8383- Variables = { [key: string]: any }
8383+ Variables = { [key: string]: any },
8484> = string | DocumentNode | TypedDocumentNode<Result, Variables>;
85858686/** A list of errors on {@link ExecutionResult | ExecutionResults}.
···291291 */
292292export interface GraphQLRequest<
293293 Data = any,
294294- Variables extends AnyVariables = AnyVariables
294294+ Variables extends AnyVariables = AnyVariables,
295295> {
296296 /** Unique identifier for the `GraphQLRequest`.
297297 *
···344344 */
345345export type GraphQLRequestParams<
346346 Data = any,
347347- Variables extends AnyVariables = AnyVariables
347347+ Variables extends AnyVariables = AnyVariables,
348348> =
349349 | ({
350350 query: DocumentInput<Data, Variables>;
···589589 */
590590export interface Operation<
591591 Data = any,
592592- Variables extends AnyVariables = AnyVariables
592592+ Variables extends AnyVariables = AnyVariables,
593593> extends GraphQLRequest<Data, Variables> {
594594 /** The `OperationType` describing the kind of `Operation`.
595595 *
···621621 */
622622export interface OperationResult<
623623 Data = any,
624624- Variables extends AnyVariables = AnyVariables
624624+ Variables extends AnyVariables = AnyVariables,
625625> {
626626 /** The [operation]{@link Operation} which has been executed. */
627627 /** The `Operation` which this `OperationResult` is for.
+1-1
packages/core/src/utils/error.ts
···11import { GraphQLError } from '@0no-co/graphql.web';
22-import { ErrorLike } from '../types';
22+import type { ErrorLike } from '../types';
3344const generateErrorMessage = (
55 networkErr?: Error,
+6-5
packages/core/src/utils/formatDocument.ts
···11-import {
22- Kind,
11+import type {
32 FieldNode,
43 SelectionNode,
54 DefinitionNode,
65 DirectiveNode,
76} from '@0no-co/graphql.web';
88-import { KeyedDocumentNode, keyDocument } from './request';
99-import { FormattedNode, TypedDocumentNode } from '../types';
77+import { Kind } from '@0no-co/graphql.web';
88+import type { KeyedDocumentNode } from './request';
99+import { keyDocument } from './request';
1010+import type { FormattedNode, TypedDocumentNode } from '../types';
10111112const formatNode = <
1212- T extends SelectionNode | DefinitionNode | TypedDocumentNode<any, any>
1313+ T extends SelectionNode | DefinitionNode | TypedDocumentNode<any, any>,
1314>(
1415 node: T
1516): FormattedNode<T> => {
···11-import {
11+import type {
22 IntrospectionQuery,
33 IntrospectionType,
44 IntrospectionTypeRef,
···6666 value =>
6767 ({
6868 name: value.name,
6969- } as any)
6969+ }) as any
7070 ),
7171 };
7272···8080 name: field.name,
8181 type: mapType(field.type),
8282 defaultValue: field.defaultValue || undefined,
8383- } as IntrospectionInputValue)
8383+ }) as IntrospectionInputValue
8484 ),
8585 };
8686 }
···100100 name: arg.name,
101101 type: mapType(arg.type),
102102 })),
103103- } as any)
103103+ }) as any
104104 ),
105105 interfaces:
106106 type.interfaces &&
···125125 name: arg.name,
126126 type: mapType(arg.type),
127127 })),
128128- } as any)
128128+ }) as any
129129 ),
130130 interfaces:
131131 type.interfaces &&
···254254 name: arg.name,
255255 type: mapType(arg.type),
256256 defaultValue: arg.defaultValue || undefined,
257257- } as IntrospectionInputValue)
257257+ }) as IntrospectionInputValue
258258 ),
259259 }));
260260
+1-1
packages/next-urql/src/DataHydrationContext.ts
···11import React from 'react';
22import { ServerInsertedHTMLContext } from 'next/navigation';
33-import { UrqlResult } from './useUrqlValue';
33+import type { UrqlResult } from './useUrqlValue';
4455interface DataHydrationValue {
66 isInjecting: boolean;
+2-1
packages/next-urql/src/Provider.ts
···11'use client';
2233import React from 'react';
44-import { Provider, SSRExchange, Client } from 'urql';
44+import type { SSRExchange, Client } from 'urql';
55+import { Provider } from 'urql';
56import { DataHydrationContextProvider } from './DataHydrationContext';
6778export const SSRContext = React.createContext<SSRExchange | undefined>(
+1-1
packages/next-urql/src/rsc.ts
···11import * as React from 'react';
22-import { Client } from '@urql/core';
22+import type { Client } from '@urql/core';
3344/** Function to cache an urql-client across React Server Components.
55 *
+6-7
packages/next-urql/src/useQuery.ts
···11'use client';
2233-import {
33+import type {
44 AnyVariables,
55 CombinedError,
66 GraphQLRequestParams,
77 Operation,
88 OperationContext,
99 RequestPolicy,
1010- createRequest,
1111- useQuery as orig_useQuery,
1210} from 'urql';
1111+import { createRequest, useQuery as orig_useQuery } from 'urql';
1312import { useUrqlValue } from './useUrqlValue';
14131514/** Input arguments for the {@link useQuery} hook.
···1918 */
2019export type UseQueryArgs<
2120 Variables extends AnyVariables = AnyVariables,
2222- Data = any
2121+ Data = any,
2322> = {
2423 /** Updates the {@link RequestPolicy} for the executed GraphQL query operation.
2524 *
···8382 */
8483export interface UseQueryState<
8584 Data = any,
8686- Variables extends AnyVariables = AnyVariables
8585+ Variables extends AnyVariables = AnyVariables,
8786> {
8887 /** Indicates whether `useQuery` is waiting for a new result.
8988 *
···157156 */
158157export type UseQueryResponse<
159158 Data = any,
160160- Variables extends AnyVariables = AnyVariables
159159+ Variables extends AnyVariables = AnyVariables,
161160> = [UseQueryState<Data, Variables>, UseQueryExecute];
162161163162/** Hook to run a GraphQL query and get updated GraphQL results.
···198197 */
199198export function useQuery<
200199 Data = any,
201201- Variables extends AnyVariables = AnyVariables
200200+ Variables extends AnyVariables = AnyVariables,
202201>(args: UseQueryArgs<Variables, Data>): UseQueryResponse<Data, Variables> {
203202 const request = createRequest(
204203 args.query,
+7-6
packages/preact-urql/src/components/Mutation.ts
···11-import { VNode } from 'preact';
22-import { AnyVariables, DocumentInput } from '@urql/core';
11+import type { VNode } from 'preact';
22+import type { AnyVariables, DocumentInput } from '@urql/core';
3344-import { useMutation, UseMutationState, UseMutationExecute } from '../hooks';
44+import type { UseMutationState, UseMutationExecute } from '../hooks';
55+import { useMutation } from '../hooks';
5667/** Props accepted by {@link Mutation}.
78 *
···1415 */
1516export interface MutationProps<
1617 Data = any,
1717- Variables extends AnyVariables = AnyVariables
1818+ Variables extends AnyVariables = AnyVariables,
1819> {
1920 /* The GraphQL mutation document that {@link useMutation} will execute. */
2021 query: DocumentInput<Data, Variables>;
···3031 */
3132export interface MutationState<
3233 Data = any,
3333- Variables extends AnyVariables = AnyVariables
3434+ Variables extends AnyVariables = AnyVariables,
3435> extends UseMutationState<Data, Variables> {
3536 /** Alias to {@link useMutation}’s `executeMutation` function. */
3637 executeMutation: UseMutationExecute<Data, Variables>;
···4546 */
4647export function Mutation<
4748 Data = any,
4848- Variables extends AnyVariables = AnyVariables
4949+ Variables extends AnyVariables = AnyVariables,
4950>(props: MutationProps<Data, Variables>): VNode<any> {
5051 const mutation = useMutation<Data, Variables>(props.query);
5152 return props.children({ ...mutation[0], executeMutation: mutation[1] });
+7-11
packages/preact-urql/src/components/Query.ts
···11-import { VNode } from 'preact';
22-import { AnyVariables } from '@urql/core';
11+import type { VNode } from 'preact';
22+import type { AnyVariables } from '@urql/core';
3344-import {
55- useQuery,
66- UseQueryArgs,
77- UseQueryState,
88- UseQueryExecute,
99-} from '../hooks';
44+import type { UseQueryArgs, UseQueryState, UseQueryExecute } from '../hooks';
55+import { useQuery } from '../hooks';
106117/** Props accepted by {@link Query}.
128 *
···2016 */
2117export type QueryProps<
2218 Data = any,
2323- Variables extends AnyVariables = AnyVariables
1919+ Variables extends AnyVariables = AnyVariables,
2420> = UseQueryArgs<Variables, Data> & {
2521 children(arg: QueryState<Data, Variables>): VNode<any>;
2622};
···3430 */
3531export interface QueryState<
3632 Data = any,
3737- Variables extends AnyVariables = AnyVariables
3333+ Variables extends AnyVariables = AnyVariables,
3834> extends UseQueryState<Data, Variables> {
3935 /** Alias to {@link useQuery}’s `executeQuery` function. */
4036 executeQuery: UseQueryExecute;
···4945 */
5046export function Query<
5147 Data = any,
5252- Variables extends AnyVariables = AnyVariables
4848+ Variables extends AnyVariables = AnyVariables,
5349>(props: QueryProps<Data, Variables>): VNode<any> {
5450 const query = useQuery<Data, Variables>(props);
5551 return props.children({ ...query[0], executeQuery: query[1] });
···11-import { StorageAdapter } from '@urql/exchange-graphcache';
11+import type { StorageAdapter } from '@urql/exchange-graphcache';
22import AsyncStorage from '@react-native-async-storage/async-storage';
33import NetInfo from '@react-native-community/netinfo';
44
+4-3
packages/svelte-urql/src/common.ts
···11import type { Readable, Writable } from 'svelte/store';
22import type { AnyVariables, OperationResult } from '@urql/core';
33-import { Source, make } from 'wonka';
33+import type { Source } from 'wonka';
44+import { make } from 'wonka';
4556/** An {@link OperationResult} with an added {@link OperationResultState.fetching} flag.
67 *
···1011 */
1112export interface OperationResultState<
1213 Data = any,
1313- Variables extends AnyVariables = AnyVariables
1414+ Variables extends AnyVariables = AnyVariables,
1415> extends OperationResult<Data, Variables> {
1516 /** Indicates whether the store is waiting for a new {@link OperationResult}.
1617 *
···2829/** A Readable store of {@link OperationResultState}. */
2930export type OperationResultStore<
3031 Data = any,
3131- Variables extends AnyVariables = AnyVariables
3232+ Variables extends AnyVariables = AnyVariables,
3233> = Readable<OperationResultState<Data, Variables>>;
33343435/** Consumes a {@link Readable} as a {@link Source}.
+2-1
packages/svelte-urql/src/context.ts
···11import { setContext, getContext } from 'svelte';
22-import { Client, ClientOptions } from '@urql/core';
22+import type { ClientOptions } from '@urql/core';
33+import { Client } from '@urql/core';
3445const _contextKey = '$$_urql';
56
+6-9
packages/svelte-urql/src/mutationStore.ts
···11import { pipe, map, scan, subscribe } from 'wonka';
22import { derived, writable } from 'svelte/store';
3344-import {
44+import type {
55 AnyVariables,
66 GraphQLRequestParams,
77 Client,
88 OperationContext,
99- createRequest,
109} from '@urql/core';
1010+import { createRequest } from '@urql/core';
11111212-import {
1313- OperationResultState,
1414- OperationResultStore,
1515- initialResult,
1616-} from './common';
1212+import type { OperationResultState, OperationResultStore } from './common';
1313+import { initialResult } from './common';
17141815/** Input arguments for the {@link mutationStore} function.
1916 *
···2219 */
2320export type MutationArgs<
2421 Data = any,
2525- Variables extends AnyVariables = AnyVariables
2222+ Variables extends AnyVariables = AnyVariables,
2623> = {
2724 /** The {@link Client} using which the subscription will be started.
2825 *
···9289 */
9390export function mutationStore<
9491 Data = any,
9595- Variables extends AnyVariables = AnyVariables
9292+ Variables extends AnyVariables = AnyVariables,
9693>(args: MutationArgs<Data, Variables>): OperationResultStore<Data, Variables> {
9794 const request = createRequest(args.query, args.variables as Variables);
9895 const operation = args.client.createRequestOperation(
+7-9
packages/svelte-urql/src/queryStore.ts
···11-import {
11+import type {
22 Client,
33 GraphQLRequestParams,
44 AnyVariables,
55 OperationContext,
66 RequestPolicy,
77- createRequest,
87} from '@urql/core';
88+import { createRequest } from '@urql/core';
991010+import type { Source } from 'wonka';
1011import {
1111- Source,
1212 pipe,
1313 map,
1414 fromValue,
···21212222import { derived, writable } from 'svelte/store';
23232424-import {
2424+import type {
2525 OperationResultState,
2626 OperationResultStore,
2727 Pausable,
2828- initialResult,
2929- createPausable,
3030- fromStore,
3128} from './common';
2929+import { initialResult, createPausable, fromStore } from './common';
32303331/** Input arguments for the {@link queryStore} function.
3432 *
···3735 */
3836export type QueryArgs<
3937 Data = any,
4040- Variables extends AnyVariables = AnyVariables
3838+ Variables extends AnyVariables = AnyVariables,
4139> = {
4240 /** The {@link Client} using which the query will be executed.
4341 *
···118116 */
119117export function queryStore<
120118 Data = any,
121121- Variables extends AnyVariables = AnyVariables
119119+ Variables extends AnyVariables = AnyVariables,
122120>(
123121 args: QueryArgs<Data, Variables>
124122): OperationResultStore<Data, Variables> & Pausable {
+7-9
packages/svelte-urql/src/subscriptionStore.ts
···11-import {
11+import type {
22 AnyVariables,
33 GraphQLRequestParams,
44 Client,
55 OperationContext,
66- createRequest,
76} from '@urql/core';
77+import { createRequest } from '@urql/core';
8899+import type { Source } from 'wonka';
910import {
1010- Source,
1111 pipe,
1212 map,
1313 fromValue,
···20202121import { derived, writable } from 'svelte/store';
22222323-import {
2323+import type {
2424 OperationResultState,
2525 OperationResultStore,
2626 Pausable,
2727- initialResult,
2828- createPausable,
2929- fromStore,
3027} from './common';
2828+import { initialResult, createPausable, fromStore } from './common';
31293230/** Combines previous data with an incoming subscription result’s data.
3331 *
···6260 */
6361export type SubscriptionArgs<
6462 Data = any,
6565- Variables extends AnyVariables = AnyVariables
6363+ Variables extends AnyVariables = AnyVariables,
6664> = {
6765 /** The {@link Client} using which the subscription will be started.
6866 *
···137135export function subscriptionStore<
138136 Data,
139137 Result = Data,
140140- Variables extends AnyVariables = AnyVariables
138138+ Variables extends AnyVariables = AnyVariables,
141139>(
142140 args: SubscriptionArgs<Data, Variables>,
143141 handler?: SubscriptionHandler<Data, Result>
+4-2
packages/vue-urql/src/useClient.ts
···11-import { App, getCurrentInstance, inject, provide, Ref, isRef, ref } from 'vue';
22-import { Client, ClientOptions } from '@urql/core';
11+import type { App, Ref } from 'vue';
22+import { getCurrentInstance, inject, provide, isRef, ref } from 'vue';
33+import type { ClientOptions } from '@urql/core';
44+import { Client } from '@urql/core';
3546const clientsPerInstance = new WeakMap<{}, Ref<Client>>();
57
+10-12
packages/vue-urql/src/useClientHandle.ts
···11-import { DocumentNode } from 'graphql';
22-import { AnyVariables, Client, TypedDocumentNode } from '@urql/core';
33-import {
44- WatchStopHandle,
55- getCurrentInstance,
66- onMounted,
77- onBeforeUnmount,
88-} from 'vue';
11+import type { DocumentNode } from 'graphql';
22+import type { AnyVariables, Client, TypedDocumentNode } from '@urql/core';
33+import type { WatchStopHandle } from 'vue';
44+import { getCurrentInstance, onMounted, onBeforeUnmount } from 'vue';
95106import { useClient } from './useClient';
1171212-import { callUseQuery, UseQueryArgs, UseQueryResponse } from './useQuery';
88+import type { UseQueryArgs, UseQueryResponse } from './useQuery';
99+import { callUseQuery } from './useQuery';
13101414-import { callUseMutation, UseMutationResponse } from './useMutation';
1111+import type { UseMutationResponse } from './useMutation';
1212+import { callUseMutation } from './useMutation';
15131616-import {
1717- callUseSubscription,
1414+import type {
1815 UseSubscriptionArgs,
1916 SubscriptionHandlerArg,
2017 UseSubscriptionResponse,
2118} from './useSubscription';
1919+import { callUseSubscription } from './useSubscription';
22202321/** Handle to create GraphQL operations outside of Vue’s `setup` functions.
2422 *
···1212 'dependencies',
1313 'optionalDependencies',
1414 'peerDependencies',
1515-].some((dep) => pkg[dep] && pkg[dep].react);
1515+].some(dep => pkg[dep] && pkg[dep].react);
16161717const hasNext = [
1818 'dependencies',
1919 'optionalDependencies',
2020 'peerDependencies',
2121-].some((dep) => pkg[dep] && pkg[dep].next);
2121+].some(dep => pkg[dep] && pkg[dep].next);
22222323-const normalize = name => name
2424- .replace(/[@\s\/\.]+/g, ' ')
2525- .trim()
2626- .replace(/\s+/, '-')
2727- .toLowerCase();
2323+const normalize = name =>
2424+ name
2525+ .replace(/[@\s/.]+/g, ' ')
2626+ .trim()
2727+ .replace(/\s+/, '-')
2828+ .toLowerCase();
28292930const name = normalize(pkg.name);
30313131-const posixPath = x =>
3232- path.normalize(x).split(path.sep).join('/');
3232+const posixPath = x => path.normalize(x).split(path.sep).join('/');
33333434const is = (a, b) => posixPath(a) === posixPath(b);
3535···4545 );
4646}
47474848-invariant(
4949- !is(cwd, workspaceRoot),
5050- 'prepare-pkg must be run in a package.'
5151-);
4848+invariant(!is(cwd, workspaceRoot), 'prepare-pkg must be run in a package.');
52495350invariant(
5451 fs.existsSync(pkg.source || 'src/index.ts'),
···8380);
84818582invariant(
8686- is(
8787- pkg.repository.directory,
8888- path.relative(workspaceRoot, cwd)
8989- ),
8383+ is(pkg.repository.directory, path.relative(workspaceRoot, cwd)),
9084 'package.json:repository.directory path is invalid'
9185);
92869393-invariant(
9494- pkg.sideEffects === false,
9595- 'package.json:sideEffects must be false'
9696-);
8787+invariant(pkg.sideEffects === false, 'package.json:sideEffects must be false');
97889898-invariant(
9999- !!pkg.author,
100100- 'package.json:author must be defined'
101101-);
8989+invariant(!!pkg.author, 'package.json:author must be defined');
10290103103-invariant(
104104- pkg.license === 'MIT',
105105- 'package.json:license must be "MIT"'
106106-);
9191+invariant(pkg.license === 'MIT', 'package.json:license must be "MIT"');
1079210893invariant(
10994 Array.isArray(pkg.files) &&
···11398);
11499115100if (hasReact && !hasNext) {
116116- invariant(!pkg.exports, 'package.json:exports must not be added for packages depending on React.');
101101+ invariant(
102102+ !pkg.exports,
103103+ 'package.json:exports must not be added for packages depending on React.'
104104+ );
117105} else {
118118- invariant(!!pkg.exports, 'package.json:exports must be added and have a "." entry');
106106+ invariant(
107107+ !!pkg.exports,
108108+ 'package.json:exports must be added and have a "." entry'
109109+ );
119110 invariant(!!pkg.exports['.'], 'package.json:exports must have a "." entry');
120120- invariant(!!pkg.exports['./package.json'], 'package.json:exports must have a "./package.json" entry')
111111+ invariant(
112112+ !!pkg.exports['./package.json'],
113113+ 'package.json:exports must have a "./package.json" entry'
114114+ );
121115122116 for (const key in pkg.exports) {
123117 const entry = pkg.exports[key];