@apollo/client 3.8.0-alpha.12 → 3.8.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs +145 -119
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/invariantErrorCodes.js +29 -34
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +12 -13
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +12 -13
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +12 -13
- package/link/utils/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- package/link/utils/throwServerError.js.map +1 -1
- package/package.json +18 -17
- package/react/cache/QuerySubscription.d.ts +11 -4
- package/react/cache/QuerySubscription.d.ts.map +1 -1
- package/react/cache/QuerySubscription.js +52 -34
- package/react/cache/QuerySubscription.js.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +2 -2
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +2 -2
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +58 -63
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +58 -63
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useFragment.d.ts +2 -1
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +25 -13
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseCache.js +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +15 -3
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +34 -52
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/react.cjs +52 -33
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +52 -33
- package/react/types/types.d.ts +1 -3
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/mocking/mockLink.js +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/index.d.ts +2 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/promises/decoration.d.ts +2 -0
- package/utilities/promises/decoration.d.ts.map +1 -1
- package/utilities/promises/decoration.js +12 -0
- package/utilities/promises/decoration.js.map +1 -1
- package/utilities/types/DeepOmit.d.ts +4 -3
- package/utilities/types/DeepOmit.d.ts.map +1 -1
- package/utilities/types/DeepOmit.js.map +1 -1
- package/utilities/types/DeepPartial.d.ts +12 -0
- package/utilities/types/DeepPartial.d.ts.map +1 -0
- package/utilities/types/DeepPartial.js +2 -0
- package/utilities/types/DeepPartial.js.map +1 -0
- package/utilities/types/Primitive.d.ts +2 -0
- package/utilities/types/Primitive.d.ts.map +1 -0
- package/utilities/types/Primitive.js +2 -0
- package/utilities/types/Primitive.js.map +1 -0
- package/utilities/utilities.cjs +30 -16
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +30 -16
- package/version.js +1 -1
package/react/types/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/types/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactNode } from 'react';\nimport { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { Observable, ObservableSubscription } from '../../utilities';\nimport { FetchResult } from '../../link/core';\nimport { ApolloError } from '../../errors';\nimport {\n ApolloCache,\n ApolloClient,\n DefaultContext,\n FetchPolicy,\n MutationOptions,\n NetworkStatus,\n ObservableQuery,\n OperationVariables,\n InternalRefetchQueriesInclude,\n WatchQueryOptions,\n WatchQueryFetchPolicy,\n} from '../../core';\nimport { SuspenseCache } from '../cache';\n\n/* Common types */\n\nexport type { DefaultContext as Context } from \"../../core\";\n\nexport type CommonOptions<TOptions> = TOptions & {\n client?: ApolloClient<object>;\n};\n\n/* Query types */\n\nexport interface BaseQueryOptions<TVariables extends OperationVariables = OperationVariables>\nextends Omit<WatchQueryOptions<TVariables>, \"query\"> {\n ssr?: boolean;\n client?: ApolloClient<any>;\n context?: DefaultContext;\n}\n\nexport interface QueryFunctionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseQueryOptions<TVariables> {\n skip?: boolean;\n onCompleted?: (data: TData) => void;\n onError?: (error: ApolloError) => void;\n\n // Default WatchQueryOptions for this useQuery, providing initial values for\n // unspecified options, superseding client.defaultOptions.watchQuery (option\n // by option, not whole), but never overriding options previously passed to\n // useQuery (or options added/modified later by other means).\n // TODO What about about default values that are expensive to evaluate?\n defaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>;\n}\n\nexport type ObservableQueryFields<TData, TVariables extends OperationVariables> = Pick<\n ObservableQuery<TData, TVariables>,\n | 'startPolling'\n | 'stopPolling'\n | 'subscribeToMore'\n | 'updateQuery'\n | 'refetch'\n | 'reobserve'\n | 'variables'\n | 'fetchMore'\n>;\n\nexport interface QueryResult<TData = any, TVariables extends OperationVariables = OperationVariables>\n extends ObservableQueryFields<TData, TVariables> {\n client: ApolloClient<any>;\n observable: ObservableQuery<TData, TVariables>;\n data: TData | undefined;\n previousData?: TData;\n error?: ApolloError;\n loading: boolean;\n networkStatus: NetworkStatus;\n called: boolean;\n}\n\nexport interface QueryDataOptions<TData = any, TVariables extends OperationVariables = OperationVariables>\n extends QueryFunctionOptions<TData, TVariables> {\n children?: (result: QueryResult<TData, TVariables>) => ReactNode;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface QueryHookOptions<TData = any, TVariables extends OperationVariables = OperationVariables>\n extends QueryFunctionOptions<TData, TVariables> {\n}\n\nexport interface LazyQueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends Omit<QueryHookOptions<TData, TVariables>, 'skip'> {\n}\n\nexport interface LazyQueryHookExecOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends LazyQueryHookOptions<TData, TVariables> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\n/**\n * suspensePolicy determines how suspense behaves for a refetch. The options are:\n * - always (default): Re-suspend a component when a refetch occurs\n * - initial: Only suspend on the first fetch\n */\nexport type SuspensePolicy =\n | 'always'\n | 'initial'\n\nexport type SuspenseQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n | 'cache-first'\n | 'network-only'\n | 'no-cache'\n | 'cache-and-network'\n>;\n\nexport interface SuspenseQueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends Pick<\n QueryHookOptions<TData, TVariables>,\n | 'client'\n | 'variables'\n | 'errorPolicy'\n | 'context'\n | 'canonizeResults'\n | 'returnPartialData'\n | 'refetchWritePolicy'\n> {\n fetchPolicy?: SuspenseQueryHookFetchPolicy;\n suspensePolicy?: SuspensePolicy;\n suspenseCache?: SuspenseCache;\n queryKey?: string | number | any[];\n}\n\n/**\n * @deprecated TODO Delete this unused interface.\n */\nexport interface QueryLazyOptions<TVariables> {\n variables?: TVariables;\n context?: DefaultContext;\n}\n\n/**\n * @deprecated TODO Delete this unused type alias.\n */\nexport type LazyQueryResult<TData, TVariables extends OperationVariables> = QueryResult<TData, TVariables>;\n\n/**\n * @deprecated TODO Delete this unused type alias.\n */\nexport type QueryTuple<TData, TVariables extends OperationVariables> =\n LazyQueryResultTuple<TData, TVariables>;\n\nexport type LazyQueryExecFunction<TData, TVariables extends OperationVariables> = (\n options?: Partial<LazyQueryHookExecOptions<TData, TVariables>>,\n) => Promise<QueryResult<TData, TVariables>>;\n\nexport type LazyQueryResultTuple<TData, TVariables extends OperationVariables> = [\n LazyQueryExecFunction<TData, TVariables>,\n QueryResult<TData, TVariables>,\n];\n\n/* Mutation types */\n\nexport type RefetchQueriesFunction = (\n ...args: any[]\n) => InternalRefetchQueriesInclude;\n\nexport interface BaseMutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> extends Omit<\n MutationOptions<TData, TVariables, TContext, TCache>,\n | \"mutation\"\n> {\n client?: ApolloClient<object>;\n notifyOnNetworkStatusChange?: boolean;\n onCompleted?: (data: TData, clientOptions?: BaseMutationOptions) => void;\n onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void;\n ignoreResults?: boolean;\n}\n\nexport interface MutationFunctionOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationResult<TData = any> {\n data?: TData | null;\n error?: ApolloError;\n loading: boolean;\n called: boolean;\n client: ApolloClient<object>;\n reset(): void;\n}\n\nexport declare type MutationFunction<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n) => Promise<FetchResult<TData>>;\n\nexport interface MutationHookOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n}\n\nexport interface MutationDataOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type MutationTuple<\n TData,\n TVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = [\n (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n // TODO This FetchResult<TData> seems strange here, as opposed to an\n // ApolloQueryResult<TData>\n ) => Promise<FetchResult<TData>>,\n MutationResult<TData>,\n];\n\n/* Subscription types */\n\nexport interface OnDataOptions<TData = any> {\n client: ApolloClient<object>;\n data: SubscriptionResult<TData>;\n}\n\nexport interface OnSubscriptionDataOptions<TData = any> {\n client: ApolloClient<object>;\n subscriptionData: SubscriptionResult<TData>;\n}\n\nexport interface BaseSubscriptionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> {\n variables?: TVariables;\n fetchPolicy?: FetchPolicy;\n shouldResubscribe?:\n | boolean\n | ((options: BaseSubscriptionOptions<TData, TVariables>) => boolean);\n client?: ApolloClient<object>;\n skip?: boolean;\n context?: DefaultContext;\n onComplete?: () => void;\n onData?: (options: OnDataOptions<TData>) => any;\n /**\n * @deprecated Use onData instead\n */\n onSubscriptionData?: (options: OnSubscriptionDataOptions<TData>) => any;\n onError?: (error: ApolloError) => void;\n /**\n * @deprecated Use onComplete instead\n */\n onSubscriptionComplete?: () => void;\n}\n\nexport interface SubscriptionResult<TData = any, TVariables = any> {\n loading: boolean;\n data?: TData;\n error?: ApolloError;\n // This was added by the legacy useSubscription type, and is tested in unit\n // tests, but probably shouldn’t be added to the result.\n variables?: TVariables;\n}\n\nexport interface SubscriptionHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseSubscriptionOptions<TData, TVariables> {\n}\n\nexport interface SubscriptionDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);\n}\n\nexport interface SubscriptionCurrentObservable {\n query?: Observable<any>;\n subscription?: ObservableSubscription;\n}\n\n/**\nHelper type that allows using a type in a way that cannot be \"widened\" by inference on the value it is used on.\n\nThis type was first suggested [in this Github discussion](https://github.com/microsoft/TypeScript/issues/14829#issuecomment-504042546).\n\nExample usage:\n```ts\nexport function useQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> = Object.create(null),\n)\n```\nIn this case, `TData` and `TVariables` should be inferred from `query`, but never widened from something in `options`.\n\nSo, in this code example:\n```ts\ndeclare const typedNode: TypedDocumentNode<{ foo: string}, { bar: number }>\nconst { variables } = useQuery(typedNode, { variables: { bar: 4, nonExistingVariable: \"string\" } });\n```\nWithout the use of `NoInfer`, `variables` would now be of the type `{ bar: number, nonExistingVariable: \"string\" }`.\nWith `NoInfer`, it will instead give an error on `nonExistingVariable`.\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never]\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/types/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactNode } from 'react';\nimport { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { Observable, ObservableSubscription } from '../../utilities';\nimport { FetchResult } from '../../link/core';\nimport { ApolloError } from '../../errors';\nimport {\n ApolloCache,\n ApolloClient,\n DefaultContext,\n FetchPolicy,\n MutationOptions,\n NetworkStatus,\n ObservableQuery,\n OperationVariables,\n InternalRefetchQueriesInclude,\n WatchQueryOptions,\n WatchQueryFetchPolicy,\n} from '../../core';\nimport { SuspenseCache } from '../cache';\n\n/* Common types */\n\nexport type { DefaultContext as Context } from \"../../core\";\n\nexport type CommonOptions<TOptions> = TOptions & {\n client?: ApolloClient<object>;\n};\n\n/* Query types */\n\nexport interface BaseQueryOptions<TVariables extends OperationVariables = OperationVariables>\nextends Omit<WatchQueryOptions<TVariables>, \"query\"> {\n ssr?: boolean;\n client?: ApolloClient<any>;\n context?: DefaultContext;\n}\n\nexport interface QueryFunctionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseQueryOptions<TVariables> {\n skip?: boolean;\n onCompleted?: (data: TData) => void;\n onError?: (error: ApolloError) => void;\n\n // Default WatchQueryOptions for this useQuery, providing initial values for\n // unspecified options, superseding client.defaultOptions.watchQuery (option\n // by option, not whole), but never overriding options previously passed to\n // useQuery (or options added/modified later by other means).\n // TODO What about about default values that are expensive to evaluate?\n defaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>;\n}\n\nexport type ObservableQueryFields<TData, TVariables extends OperationVariables> = Pick<\n ObservableQuery<TData, TVariables>,\n | 'startPolling'\n | 'stopPolling'\n | 'subscribeToMore'\n | 'updateQuery'\n | 'refetch'\n | 'reobserve'\n | 'variables'\n | 'fetchMore'\n>;\n\nexport interface QueryResult<TData = any, TVariables extends OperationVariables = OperationVariables>\n extends ObservableQueryFields<TData, TVariables> {\n client: ApolloClient<any>;\n observable: ObservableQuery<TData, TVariables>;\n data: TData | undefined;\n previousData?: TData;\n error?: ApolloError;\n loading: boolean;\n networkStatus: NetworkStatus;\n called: boolean;\n}\n\nexport interface QueryDataOptions<TData = any, TVariables extends OperationVariables = OperationVariables>\n extends QueryFunctionOptions<TData, TVariables> {\n children?: (result: QueryResult<TData, TVariables>) => ReactNode;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface QueryHookOptions<TData = any, TVariables extends OperationVariables = OperationVariables>\n extends QueryFunctionOptions<TData, TVariables> {\n}\n\nexport interface LazyQueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends Omit<QueryHookOptions<TData, TVariables>, 'skip'> {\n}\n\nexport interface LazyQueryHookExecOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends LazyQueryHookOptions<TData, TVariables> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type SuspenseQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n | 'cache-first'\n | 'network-only'\n | 'no-cache'\n | 'cache-and-network'\n>;\n\nexport interface SuspenseQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n> extends Pick<\n QueryHookOptions<TData, TVariables>,\n | 'client'\n | 'variables'\n | 'errorPolicy'\n | 'context'\n | 'canonizeResults'\n | 'returnPartialData'\n | 'refetchWritePolicy'\n> {\n fetchPolicy?: SuspenseQueryHookFetchPolicy;\n suspenseCache?: SuspenseCache;\n queryKey?: string | number | any[];\n}\n\n/**\n * @deprecated TODO Delete this unused interface.\n */\nexport interface QueryLazyOptions<TVariables> {\n variables?: TVariables;\n context?: DefaultContext;\n}\n\n/**\n * @deprecated TODO Delete this unused type alias.\n */\nexport type LazyQueryResult<TData, TVariables extends OperationVariables> = QueryResult<TData, TVariables>;\n\n/**\n * @deprecated TODO Delete this unused type alias.\n */\nexport type QueryTuple<TData, TVariables extends OperationVariables> =\n LazyQueryResultTuple<TData, TVariables>;\n\nexport type LazyQueryExecFunction<TData, TVariables extends OperationVariables> = (\n options?: Partial<LazyQueryHookExecOptions<TData, TVariables>>,\n) => Promise<QueryResult<TData, TVariables>>;\n\nexport type LazyQueryResultTuple<TData, TVariables extends OperationVariables> = [\n LazyQueryExecFunction<TData, TVariables>,\n QueryResult<TData, TVariables>,\n];\n\n/* Mutation types */\n\nexport type RefetchQueriesFunction = (\n ...args: any[]\n) => InternalRefetchQueriesInclude;\n\nexport interface BaseMutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> extends Omit<\n MutationOptions<TData, TVariables, TContext, TCache>,\n | \"mutation\"\n> {\n client?: ApolloClient<object>;\n notifyOnNetworkStatusChange?: boolean;\n onCompleted?: (data: TData, clientOptions?: BaseMutationOptions) => void;\n onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void;\n ignoreResults?: boolean;\n}\n\nexport interface MutationFunctionOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationResult<TData = any> {\n data?: TData | null;\n error?: ApolloError;\n loading: boolean;\n called: boolean;\n client: ApolloClient<object>;\n reset(): void;\n}\n\nexport declare type MutationFunction<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n) => Promise<FetchResult<TData>>;\n\nexport interface MutationHookOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n}\n\nexport interface MutationDataOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type MutationTuple<\n TData,\n TVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = [\n (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n // TODO This FetchResult<TData> seems strange here, as opposed to an\n // ApolloQueryResult<TData>\n ) => Promise<FetchResult<TData>>,\n MutationResult<TData>,\n];\n\n/* Subscription types */\n\nexport interface OnDataOptions<TData = any> {\n client: ApolloClient<object>;\n data: SubscriptionResult<TData>;\n}\n\nexport interface OnSubscriptionDataOptions<TData = any> {\n client: ApolloClient<object>;\n subscriptionData: SubscriptionResult<TData>;\n}\n\nexport interface BaseSubscriptionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> {\n variables?: TVariables;\n fetchPolicy?: FetchPolicy;\n shouldResubscribe?:\n | boolean\n | ((options: BaseSubscriptionOptions<TData, TVariables>) => boolean);\n client?: ApolloClient<object>;\n skip?: boolean;\n context?: DefaultContext;\n onComplete?: () => void;\n onData?: (options: OnDataOptions<TData>) => any;\n /**\n * @deprecated Use onData instead\n */\n onSubscriptionData?: (options: OnSubscriptionDataOptions<TData>) => any;\n onError?: (error: ApolloError) => void;\n /**\n * @deprecated Use onComplete instead\n */\n onSubscriptionComplete?: () => void;\n}\n\nexport interface SubscriptionResult<TData = any, TVariables = any> {\n loading: boolean;\n data?: TData;\n error?: ApolloError;\n // This was added by the legacy useSubscription type, and is tested in unit\n // tests, but probably shouldn’t be added to the result.\n variables?: TVariables;\n}\n\nexport interface SubscriptionHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseSubscriptionOptions<TData, TVariables> {\n}\n\nexport interface SubscriptionDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);\n}\n\nexport interface SubscriptionCurrentObservable {\n query?: Observable<any>;\n subscription?: ObservableSubscription;\n}\n\n/**\nHelper type that allows using a type in a way that cannot be \"widened\" by inference on the value it is used on.\n\nThis type was first suggested [in this Github discussion](https://github.com/microsoft/TypeScript/issues/14829#issuecomment-504042546).\n\nExample usage:\n```ts\nexport function useQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> = Object.create(null),\n)\n```\nIn this case, `TData` and `TVariables` should be inferred from `query`, but never widened from something in `options`.\n\nSo, in this code example:\n```ts\ndeclare const typedNode: TypedDocumentNode<{ foo: string}, { bar: number }>\nconst { variables } = useQuery(typedNode, { variables: { bar: 4, nonExistingVariable: \"string\" } });\n```\nWithout the use of `NoInfer`, `variables` would now be of the type `{ bar: number, nonExistingVariable: \"string\" }`.\nWith `NoInfer`, it will instead give an error on `nonExistingVariable`.\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never]\n"]}
|
package/testing/core/core.cjs
CHANGED
|
@@ -119,7 +119,7 @@ var MockLink = (function (_super) {
|
|
|
119
119
|
MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {
|
|
120
120
|
var newMockedResponse = utilities.cloneDeep(mockedResponse);
|
|
121
121
|
var queryWithoutConnection = utilities.removeConnectionDirectiveFromDocument(newMockedResponse.request.query);
|
|
122
|
-
globals.__DEV__ ? globals.invariant(queryWithoutConnection, "query is required") : globals.invariant(queryWithoutConnection,
|
|
122
|
+
globals.__DEV__ ? globals.invariant(queryWithoutConnection, "query is required") : globals.invariant(queryWithoutConnection, 40);
|
|
123
123
|
newMockedResponse.request.query = queryWithoutConnection;
|
|
124
124
|
var query = utilities.removeClientSetsFromDocument(newMockedResponse.request.query);
|
|
125
125
|
if (query) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","sources":["mocking/mockLink.js","mocking/mockSubscriptionLink.js","mocking/mockClient.js","subscribeAndCount.js","itAsync.js","wait.js","withConsoleSpy.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { invariant, __DEV__ } from '../../../utilities/globals';\nimport { print } from 'graphql';\nimport { equal } from '@wry/equality';\nimport { ApolloLink, } from '../../../link/core';\nimport { Observable, addTypenameToDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, cloneDeep, stringifyForDisplay, } from '../../../utilities';\nfunction requestToKey(request, addTypename) {\n var queryString = request.query &&\n print(addTypename ? addTypenameToDocument(request.query) : request.query);\n var requestKey = { query: queryString };\n return JSON.stringify(requestKey);\n}\nvar MockLink = (function (_super) {\n __extends(MockLink, _super);\n function MockLink(mockedResponses, addTypename, options) {\n if (addTypename === void 0) { addTypename = true; }\n if (options === void 0) { options = Object.create(null); }\n var _this = this;\n var _a;\n _this = _super.call(this) || this;\n _this.addTypename = true;\n _this.showWarnings = true;\n _this.mockedResponsesByKey = {};\n _this.addTypename = addTypename;\n _this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true;\n if (mockedResponses) {\n mockedResponses.forEach(function (mockedResponse) {\n _this.addMockedResponse(mockedResponse);\n });\n }\n return _this;\n }\n MockLink.prototype.addMockedResponse = function (mockedResponse) {\n var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse);\n var key = requestToKey(normalizedMockedResponse.request, this.addTypename);\n var mockedResponses = this.mockedResponsesByKey[key];\n if (!mockedResponses) {\n mockedResponses = [];\n this.mockedResponsesByKey[key] = mockedResponses;\n }\n mockedResponses.push(normalizedMockedResponse);\n };\n MockLink.prototype.request = function (operation) {\n var _this = this;\n this.operation = operation;\n var key = requestToKey(operation, this.addTypename);\n var unmatchedVars = [];\n var requestVariables = operation.variables || {};\n var mockedResponses = this.mockedResponsesByKey[key];\n var responseIndex = mockedResponses ? mockedResponses.findIndex(function (res, index) {\n var mockedResponseVars = res.request.variables || {};\n if (equal(requestVariables, mockedResponseVars)) {\n return true;\n }\n unmatchedVars.push(mockedResponseVars);\n return false;\n }) : -1;\n var response = responseIndex >= 0\n ? mockedResponses[responseIndex]\n : void 0;\n var configError;\n if (!response) {\n configError = new Error(\"No more mocked responses for the query: \".concat(print(operation.query), \"\\nExpected variables: \").concat(stringifyForDisplay(operation.variables), \"\\n\").concat(unmatchedVars.length > 0 ? \"\\nFailed to match \".concat(unmatchedVars.length, \" mock\").concat(unmatchedVars.length === 1 ? \"\" : \"s\", \" for this query. The mocked response had the following variables:\\n\").concat(unmatchedVars.map(function (d) { return \" \".concat(stringifyForDisplay(d)); }).join('\\n'), \"\\n\") : \"\"));\n if (this.showWarnings) {\n console.warn(configError.message +\n '\\nThis typically indicates a configuration error in your mocks ' +\n 'setup, usually due to a typo or mismatched variable.');\n }\n }\n else {\n mockedResponses.splice(responseIndex, 1);\n var newData = response.newData;\n if (newData) {\n response.result = newData();\n mockedResponses.push(response);\n }\n if (!response.result && !response.error) {\n configError = new Error(\"Mocked response should contain either result or error: \".concat(key));\n }\n }\n return new Observable(function (observer) {\n var timer = setTimeout(function () {\n if (configError) {\n try {\n if (_this.onError(configError, observer) !== false) {\n throw configError;\n }\n }\n catch (error) {\n observer.error(error);\n }\n }\n else if (response) {\n if (response.error) {\n observer.error(response.error);\n }\n else {\n if (response.result) {\n observer.next(typeof response.result === 'function'\n ? response.result()\n : response.result);\n }\n observer.complete();\n }\n }\n }, response && response.delay || 0);\n return function () {\n clearTimeout(timer);\n };\n });\n };\n MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {\n var newMockedResponse = cloneDeep(mockedResponse);\n var queryWithoutConnection = removeConnectionDirectiveFromDocument(newMockedResponse.request.query);\n __DEV__ ? invariant(queryWithoutConnection, \"query is required\") : invariant(queryWithoutConnection, 41);\n newMockedResponse.request.query = queryWithoutConnection;\n var query = removeClientSetsFromDocument(newMockedResponse.request.query);\n if (query) {\n newMockedResponse.request.query = query;\n }\n return newMockedResponse;\n };\n return MockLink;\n}(ApolloLink));\nexport { MockLink };\nexport function mockSingleLink() {\n var mockedResponses = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n mockedResponses[_i] = arguments[_i];\n }\n var maybeTypename = mockedResponses[mockedResponses.length - 1];\n var mocks = mockedResponses.slice(0, mockedResponses.length - 1);\n if (typeof maybeTypename !== 'boolean') {\n mocks = mockedResponses;\n maybeTypename = true;\n }\n return new MockLink(mocks, maybeTypename);\n}\n//# sourceMappingURL=mockLink.js.map","import { __extends } from \"tslib\";\nimport { Observable } from '../../../utilities';\nimport { ApolloLink } from '../../../link/core';\nvar MockSubscriptionLink = (function (_super) {\n __extends(MockSubscriptionLink, _super);\n function MockSubscriptionLink() {\n var _this = _super.call(this) || this;\n _this.unsubscribers = [];\n _this.setups = [];\n _this.observers = [];\n return _this;\n }\n MockSubscriptionLink.prototype.request = function (operation) {\n var _this = this;\n this.operation = operation;\n return new Observable(function (observer) {\n _this.setups.forEach(function (x) { return x(); });\n _this.observers.push(observer);\n return function () {\n _this.unsubscribers.forEach(function (x) { return x(); });\n };\n });\n };\n MockSubscriptionLink.prototype.simulateResult = function (result, complete) {\n var _this = this;\n if (complete === void 0) { complete = false; }\n setTimeout(function () {\n var observers = _this.observers;\n if (!observers.length)\n throw new Error('subscription torn down');\n observers.forEach(function (observer) {\n if (result.result && observer.next)\n observer.next(result.result);\n if (result.error && observer.error)\n observer.error(result.error);\n if (complete && observer.complete)\n observer.complete();\n });\n }, result.delay || 0);\n };\n MockSubscriptionLink.prototype.simulateComplete = function () {\n var observers = this.observers;\n if (!observers.length)\n throw new Error('subscription torn down');\n observers.forEach(function (observer) {\n if (observer.complete)\n observer.complete();\n });\n };\n MockSubscriptionLink.prototype.onSetup = function (listener) {\n this.setups = this.setups.concat([listener]);\n };\n MockSubscriptionLink.prototype.onUnsubscribe = function (listener) {\n this.unsubscribers = this.unsubscribers.concat([listener]);\n };\n return MockSubscriptionLink;\n}(ApolloLink));\nexport { MockSubscriptionLink };\nexport function mockObservableLink() {\n return new MockSubscriptionLink();\n}\n//# sourceMappingURL=mockSubscriptionLink.js.map","import { ApolloClient } from '../../../core';\nimport { InMemoryCache } from '../../../cache';\nimport { mockSingleLink } from './mockLink';\nexport function createMockClient(data, query, variables) {\n if (variables === void 0) { variables = {}; }\n return new ApolloClient({\n link: mockSingleLink({\n request: { query: query, variables: variables },\n result: { data: data },\n }).setOnError(function (error) { throw error; }),\n cache: new InMemoryCache({ addTypename: false }),\n });\n}\n//# sourceMappingURL=mockClient.js.map","import { asyncMap } from '../../utilities';\nexport default function subscribeAndCount(reject, observable, cb) {\n var queue = Promise.resolve();\n var handleCount = 0;\n var subscription = asyncMap(observable, function (result) {\n return queue = queue.then(function () {\n return cb(++handleCount, result);\n }).catch(error);\n }).subscribe({ error: error });\n function error(e) {\n subscription.unsubscribe();\n reject(e);\n }\n return subscription;\n}\n//# sourceMappingURL=subscribeAndCount.js.map","function wrap(key) {\n return function (message, callback, timeout) { return (key ? it[key] : it)(message, function () {\n var _this = this;\n return new Promise(function (resolve, reject) { return callback.call(_this, resolve, reject); });\n }, timeout); };\n}\nvar wrappedIt = wrap();\nexport var itAsync = Object.assign(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return wrappedIt.apply(this, args);\n}, {\n only: wrap(\"only\"),\n skip: wrap(\"skip\"),\n todo: wrap(\"todo\"),\n});\n//# sourceMappingURL=itAsync.js.map","import { __awaiter, __generator } from \"tslib\";\nexport function wait(ms) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2, new Promise(function (resolve) { return setTimeout(resolve, ms); })];\n });\n });\n}\nexport function tick() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2, wait(0)];\n });\n });\n}\n//# sourceMappingURL=wait.js.map","function wrapTestFunction(fn, consoleMethodName) {\n return function () {\n var _this = this;\n var args = arguments;\n var spy = jest.spyOn(console, consoleMethodName);\n spy.mockImplementation(function () { });\n return new Promise(function (resolve) {\n resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args));\n }).finally(function () {\n expect(spy).toMatchSnapshot();\n spy.mockReset();\n });\n };\n}\nexport function withErrorSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"error\");\n return it.apply(void 0, args);\n}\nexport function withWarningSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"warn\");\n return it.apply(void 0, args);\n}\nexport function withLogSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"log\");\n return it.apply(void 0, args);\n}\n//# sourceMappingURL=withConsoleSpy.js.map"],"names":["print","addTypenameToDocument","__extends","equal","stringifyForDisplay","Observable","cloneDeep","removeConnectionDirectiveFromDocument","__DEV__","invariant","removeClientSetsFromDocument","ApolloLink","ApolloClient","InMemoryCache","asyncMap","__awaiter","__generator"],"mappings":";;;;;;;;;;;;;AAMA,SAAS,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE;AAC5C,IAAI,IAAI,WAAW,GAAG,OAAO,CAAC,KAAK;AACnC,QAAQA,aAAK,CAAC,WAAW,GAAGC,+BAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAClF,IAAI,IAAI,UAAU,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAC5C,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AACE,IAAC,QAAQ,IAAI,UAAU,MAAM,EAAE;AAClC,IAAIC,eAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAChC,IAAI,SAAS,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE;AAC7D,QAAQ,IAAI,WAAW,KAAK,KAAK,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC,EAAE;AAC3D,QAAQ,IA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AACL,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAChD,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AACM,SAAS,UAAU,CAAC,EAAE,EAAE;AAC/B,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;AAClB,IAAI,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE;AAClD,QAAQ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;AACrC,KAAK;AACL,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/C,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;AAClC;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"core.cjs","sources":["mocking/mockLink.js","mocking/mockSubscriptionLink.js","mocking/mockClient.js","subscribeAndCount.js","itAsync.js","wait.js","withConsoleSpy.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { invariant, __DEV__ } from '../../../utilities/globals';\nimport { print } from 'graphql';\nimport { equal } from '@wry/equality';\nimport { ApolloLink, } from '../../../link/core';\nimport { Observable, addTypenameToDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, cloneDeep, stringifyForDisplay, } from '../../../utilities';\nfunction requestToKey(request, addTypename) {\n var queryString = request.query &&\n print(addTypename ? addTypenameToDocument(request.query) : request.query);\n var requestKey = { query: queryString };\n return JSON.stringify(requestKey);\n}\nvar MockLink = (function (_super) {\n __extends(MockLink, _super);\n function MockLink(mockedResponses, addTypename, options) {\n if (addTypename === void 0) { addTypename = true; }\n if (options === void 0) { options = Object.create(null); }\n var _this = this;\n var _a;\n _this = _super.call(this) || this;\n _this.addTypename = true;\n _this.showWarnings = true;\n _this.mockedResponsesByKey = {};\n _this.addTypename = addTypename;\n _this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true;\n if (mockedResponses) {\n mockedResponses.forEach(function (mockedResponse) {\n _this.addMockedResponse(mockedResponse);\n });\n }\n return _this;\n }\n MockLink.prototype.addMockedResponse = function (mockedResponse) {\n var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse);\n var key = requestToKey(normalizedMockedResponse.request, this.addTypename);\n var mockedResponses = this.mockedResponsesByKey[key];\n if (!mockedResponses) {\n mockedResponses = [];\n this.mockedResponsesByKey[key] = mockedResponses;\n }\n mockedResponses.push(normalizedMockedResponse);\n };\n MockLink.prototype.request = function (operation) {\n var _this = this;\n this.operation = operation;\n var key = requestToKey(operation, this.addTypename);\n var unmatchedVars = [];\n var requestVariables = operation.variables || {};\n var mockedResponses = this.mockedResponsesByKey[key];\n var responseIndex = mockedResponses ? mockedResponses.findIndex(function (res, index) {\n var mockedResponseVars = res.request.variables || {};\n if (equal(requestVariables, mockedResponseVars)) {\n return true;\n }\n unmatchedVars.push(mockedResponseVars);\n return false;\n }) : -1;\n var response = responseIndex >= 0\n ? mockedResponses[responseIndex]\n : void 0;\n var configError;\n if (!response) {\n configError = new Error(\"No more mocked responses for the query: \".concat(print(operation.query), \"\\nExpected variables: \").concat(stringifyForDisplay(operation.variables), \"\\n\").concat(unmatchedVars.length > 0 ? \"\\nFailed to match \".concat(unmatchedVars.length, \" mock\").concat(unmatchedVars.length === 1 ? \"\" : \"s\", \" for this query. The mocked response had the following variables:\\n\").concat(unmatchedVars.map(function (d) { return \" \".concat(stringifyForDisplay(d)); }).join('\\n'), \"\\n\") : \"\"));\n if (this.showWarnings) {\n console.warn(configError.message +\n '\\nThis typically indicates a configuration error in your mocks ' +\n 'setup, usually due to a typo or mismatched variable.');\n }\n }\n else {\n mockedResponses.splice(responseIndex, 1);\n var newData = response.newData;\n if (newData) {\n response.result = newData();\n mockedResponses.push(response);\n }\n if (!response.result && !response.error) {\n configError = new Error(\"Mocked response should contain either result or error: \".concat(key));\n }\n }\n return new Observable(function (observer) {\n var timer = setTimeout(function () {\n if (configError) {\n try {\n if (_this.onError(configError, observer) !== false) {\n throw configError;\n }\n }\n catch (error) {\n observer.error(error);\n }\n }\n else if (response) {\n if (response.error) {\n observer.error(response.error);\n }\n else {\n if (response.result) {\n observer.next(typeof response.result === 'function'\n ? response.result()\n : response.result);\n }\n observer.complete();\n }\n }\n }, response && response.delay || 0);\n return function () {\n clearTimeout(timer);\n };\n });\n };\n MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {\n var newMockedResponse = cloneDeep(mockedResponse);\n var queryWithoutConnection = removeConnectionDirectiveFromDocument(newMockedResponse.request.query);\n __DEV__ ? invariant(queryWithoutConnection, \"query is required\") : invariant(queryWithoutConnection, 40);\n newMockedResponse.request.query = queryWithoutConnection;\n var query = removeClientSetsFromDocument(newMockedResponse.request.query);\n if (query) {\n newMockedResponse.request.query = query;\n }\n return newMockedResponse;\n };\n return MockLink;\n}(ApolloLink));\nexport { MockLink };\nexport function mockSingleLink() {\n var mockedResponses = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n mockedResponses[_i] = arguments[_i];\n }\n var maybeTypename = mockedResponses[mockedResponses.length - 1];\n var mocks = mockedResponses.slice(0, mockedResponses.length - 1);\n if (typeof maybeTypename !== 'boolean') {\n mocks = mockedResponses;\n maybeTypename = true;\n }\n return new MockLink(mocks, maybeTypename);\n}\n//# sourceMappingURL=mockLink.js.map","import { __extends } from \"tslib\";\nimport { Observable } from '../../../utilities';\nimport { ApolloLink } from '../../../link/core';\nvar MockSubscriptionLink = (function (_super) {\n __extends(MockSubscriptionLink, _super);\n function MockSubscriptionLink() {\n var _this = _super.call(this) || this;\n _this.unsubscribers = [];\n _this.setups = [];\n _this.observers = [];\n return _this;\n }\n MockSubscriptionLink.prototype.request = function (operation) {\n var _this = this;\n this.operation = operation;\n return new Observable(function (observer) {\n _this.setups.forEach(function (x) { return x(); });\n _this.observers.push(observer);\n return function () {\n _this.unsubscribers.forEach(function (x) { return x(); });\n };\n });\n };\n MockSubscriptionLink.prototype.simulateResult = function (result, complete) {\n var _this = this;\n if (complete === void 0) { complete = false; }\n setTimeout(function () {\n var observers = _this.observers;\n if (!observers.length)\n throw new Error('subscription torn down');\n observers.forEach(function (observer) {\n if (result.result && observer.next)\n observer.next(result.result);\n if (result.error && observer.error)\n observer.error(result.error);\n if (complete && observer.complete)\n observer.complete();\n });\n }, result.delay || 0);\n };\n MockSubscriptionLink.prototype.simulateComplete = function () {\n var observers = this.observers;\n if (!observers.length)\n throw new Error('subscription torn down');\n observers.forEach(function (observer) {\n if (observer.complete)\n observer.complete();\n });\n };\n MockSubscriptionLink.prototype.onSetup = function (listener) {\n this.setups = this.setups.concat([listener]);\n };\n MockSubscriptionLink.prototype.onUnsubscribe = function (listener) {\n this.unsubscribers = this.unsubscribers.concat([listener]);\n };\n return MockSubscriptionLink;\n}(ApolloLink));\nexport { MockSubscriptionLink };\nexport function mockObservableLink() {\n return new MockSubscriptionLink();\n}\n//# sourceMappingURL=mockSubscriptionLink.js.map","import { ApolloClient } from '../../../core';\nimport { InMemoryCache } from '../../../cache';\nimport { mockSingleLink } from './mockLink';\nexport function createMockClient(data, query, variables) {\n if (variables === void 0) { variables = {}; }\n return new ApolloClient({\n link: mockSingleLink({\n request: { query: query, variables: variables },\n result: { data: data },\n }).setOnError(function (error) { throw error; }),\n cache: new InMemoryCache({ addTypename: false }),\n });\n}\n//# sourceMappingURL=mockClient.js.map","import { asyncMap } from '../../utilities';\nexport default function subscribeAndCount(reject, observable, cb) {\n var queue = Promise.resolve();\n var handleCount = 0;\n var subscription = asyncMap(observable, function (result) {\n return queue = queue.then(function () {\n return cb(++handleCount, result);\n }).catch(error);\n }).subscribe({ error: error });\n function error(e) {\n subscription.unsubscribe();\n reject(e);\n }\n return subscription;\n}\n//# sourceMappingURL=subscribeAndCount.js.map","function wrap(key) {\n return function (message, callback, timeout) { return (key ? it[key] : it)(message, function () {\n var _this = this;\n return new Promise(function (resolve, reject) { return callback.call(_this, resolve, reject); });\n }, timeout); };\n}\nvar wrappedIt = wrap();\nexport var itAsync = Object.assign(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return wrappedIt.apply(this, args);\n}, {\n only: wrap(\"only\"),\n skip: wrap(\"skip\"),\n todo: wrap(\"todo\"),\n});\n//# sourceMappingURL=itAsync.js.map","import { __awaiter, __generator } from \"tslib\";\nexport function wait(ms) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2, new Promise(function (resolve) { return setTimeout(resolve, ms); })];\n });\n });\n}\nexport function tick() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2, wait(0)];\n });\n });\n}\n//# sourceMappingURL=wait.js.map","function wrapTestFunction(fn, consoleMethodName) {\n return function () {\n var _this = this;\n var args = arguments;\n var spy = jest.spyOn(console, consoleMethodName);\n spy.mockImplementation(function () { });\n return new Promise(function (resolve) {\n resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args));\n }).finally(function () {\n expect(spy).toMatchSnapshot();\n spy.mockReset();\n });\n };\n}\nexport function withErrorSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"error\");\n return it.apply(void 0, args);\n}\nexport function withWarningSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"warn\");\n return it.apply(void 0, args);\n}\nexport function withLogSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"log\");\n return it.apply(void 0, args);\n}\n//# sourceMappingURL=withConsoleSpy.js.map"],"names":["print","addTypenameToDocument","__extends","equal","stringifyForDisplay","Observable","cloneDeep","removeConnectionDirectiveFromDocument","__DEV__","invariant","removeClientSetsFromDocument","ApolloLink","ApolloClient","InMemoryCache","asyncMap","__awaiter","__generator"],"mappings":";;;;;;;;;;;;;AAMA,SAAS,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE;AAC5C,IAAI,IAAI,WAAW,GAAG,OAAO,CAAC,KAAK;AACnC,QAAQA,aAAK,CAAC,WAAW,GAAGC,+BAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAClF,IAAI,IAAI,UAAU,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAC5C,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AACE,IAAC,QAAQ,IAAI,UAAU,MAAM,EAAE;AAClC,IAAIC,eAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAChC,IAAI,SAAS,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE;AAC7D,QAAQ,IAAI,WAAW,KAAK,KAAK,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC,EAAE;AAC3D,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;AAClE,QAAQ,IAAI,KAAK,GAAG,IAAI,CAAC;AACzB,QAAQ,IAAI,EAAE,CAAC;AACf,QAAQ,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC1C,QAAQ,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;AACjC,QAAQ,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;AAClC,QAAQ,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC;AACxC,Q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CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;AACrC,KAAK;AACL,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/C,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;AAClC;;;;;;;;;;;;;;;"}
|
|
@@ -119,7 +119,7 @@ var MockLink = (function (_super) {
|
|
|
119
119
|
MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {
|
|
120
120
|
var newMockedResponse = utilities.cloneDeep(mockedResponse);
|
|
121
121
|
var queryWithoutConnection = utilities.removeConnectionDirectiveFromDocument(newMockedResponse.request.query);
|
|
122
|
-
globals.__DEV__ ? globals.invariant(queryWithoutConnection, "query is required") : globals.invariant(queryWithoutConnection,
|
|
122
|
+
globals.__DEV__ ? globals.invariant(queryWithoutConnection, "query is required") : globals.invariant(queryWithoutConnection, 40);
|
|
123
123
|
newMockedResponse.request.query = queryWithoutConnection;
|
|
124
124
|
var query = utilities.removeClientSetsFromDocument(newMockedResponse.request.query);
|
|
125
125
|
if (query) {
|
|
@@ -112,7 +112,7 @@ var MockLink = (function (_super) {
|
|
|
112
112
|
MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {
|
|
113
113
|
var newMockedResponse = cloneDeep(mockedResponse);
|
|
114
114
|
var queryWithoutConnection = removeConnectionDirectiveFromDocument(newMockedResponse.request.query);
|
|
115
|
-
__DEV__ ? invariant(queryWithoutConnection, "query is required") : invariant(queryWithoutConnection,
|
|
115
|
+
__DEV__ ? invariant(queryWithoutConnection, "query is required") : invariant(queryWithoutConnection, 40);
|
|
116
116
|
newMockedResponse.request.query = queryWithoutConnection;
|
|
117
117
|
var query = removeClientSetsFromDocument(newMockedResponse.request.query);
|
|
118
118
|
if (query) {
|
|
@@ -10,7 +10,7 @@ export function shouldInclude(_a, variables) {
|
|
|
10
10
|
var evaledValue = false;
|
|
11
11
|
if (ifArgument.value.kind === 'Variable') {
|
|
12
12
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
13
|
-
__DEV__ ? invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : invariant(evaledValue !== void 0,
|
|
13
|
+
__DEV__ ? invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : invariant(evaledValue !== void 0, 41);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
16
|
evaledValue = ifArgument.value.value;
|
|
@@ -57,13 +57,13 @@ export function getInclusionDirectives(directives) {
|
|
|
57
57
|
return;
|
|
58
58
|
var directiveArguments = directive.arguments;
|
|
59
59
|
var directiveName = directive.name.value;
|
|
60
|
-
__DEV__ ? invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : invariant(directiveArguments && directiveArguments.length === 1,
|
|
60
|
+
__DEV__ ? invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : invariant(directiveArguments && directiveArguments.length === 1, 42);
|
|
61
61
|
var ifArgument = directiveArguments[0];
|
|
62
|
-
__DEV__ ? invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
62
|
+
__DEV__ ? invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : invariant(ifArgument.name && ifArgument.name.value === 'if', 43);
|
|
63
63
|
var ifValue = ifArgument.value;
|
|
64
64
|
__DEV__ ? invariant(ifValue &&
|
|
65
65
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : invariant(ifValue &&
|
|
66
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
66
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44);
|
|
67
67
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -6,14 +6,14 @@ export function getFragmentQueryDocument(document, fragmentName) {
|
|
|
6
6
|
document.definitions.forEach(function (definition) {
|
|
7
7
|
if (definition.kind === 'OperationDefinition') {
|
|
8
8
|
throw __DEV__ ? new InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
9
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new InvariantError(
|
|
9
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new InvariantError(45);
|
|
10
10
|
}
|
|
11
11
|
if (definition.kind === 'FragmentDefinition') {
|
|
12
12
|
fragments.push(definition);
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
if (typeof actualFragmentName === 'undefined') {
|
|
16
|
-
__DEV__ ? invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : invariant(fragments.length === 1,
|
|
16
|
+
__DEV__ ? invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : invariant(fragments.length === 1, 46);
|
|
17
17
|
actualFragmentName = fragments[0].name.value;
|
|
18
18
|
}
|
|
19
19
|
var query = __assign(__assign({}, document), { definitions: __spreadArray([
|
|
@@ -54,7 +54,7 @@ export function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
54
54
|
return fragmentMap(fragmentName);
|
|
55
55
|
}
|
|
56
56
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
57
|
-
__DEV__ ? invariant(fragment, "No fragment named ".concat(fragmentName)) : invariant(fragment,
|
|
57
|
+
__DEV__ ? invariant(fragment, "No fragment named ".concat(fragmentName)) : invariant(fragment, 47);
|
|
58
58
|
return fragment || null;
|
|
59
59
|
}
|
|
60
60
|
default:
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { invariant, InvariantError, __DEV__ } from "../globals/index.js";
|
|
2
2
|
import { valueToObjectRepresentation } from "./storeUtils.js";
|
|
3
3
|
export function checkDocument(doc) {
|
|
4
|
-
__DEV__ ? invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : invariant(doc && doc.kind === 'Document',
|
|
4
|
+
__DEV__ ? invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : invariant(doc && doc.kind === 'Document', 48);
|
|
5
5
|
var operations = doc.definitions
|
|
6
6
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
7
7
|
.map(function (definition) {
|
|
8
8
|
if (definition.kind !== 'OperationDefinition') {
|
|
9
|
-
throw __DEV__ ? new InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new InvariantError(
|
|
9
|
+
throw __DEV__ ? new InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new InvariantError(49);
|
|
10
10
|
}
|
|
11
11
|
return definition;
|
|
12
12
|
});
|
|
13
|
-
__DEV__ ? invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : invariant(operations.length <= 1,
|
|
13
|
+
__DEV__ ? invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : invariant(operations.length <= 1, 50);
|
|
14
14
|
return doc;
|
|
15
15
|
}
|
|
16
16
|
export function getOperationDefinition(doc) {
|
|
@@ -33,14 +33,14 @@ export function getFragmentDefinitions(doc) {
|
|
|
33
33
|
}
|
|
34
34
|
export function getQueryDefinition(doc) {
|
|
35
35
|
var queryDef = getOperationDefinition(doc);
|
|
36
|
-
__DEV__ ? invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : invariant(queryDef && queryDef.operation === 'query',
|
|
36
|
+
__DEV__ ? invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : invariant(queryDef && queryDef.operation === 'query', 51);
|
|
37
37
|
return queryDef;
|
|
38
38
|
}
|
|
39
39
|
export function getFragmentDefinition(doc) {
|
|
40
|
-
__DEV__ ? invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : invariant(doc.kind === 'Document',
|
|
41
|
-
__DEV__ ? invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : invariant(doc.definitions.length <= 1,
|
|
40
|
+
__DEV__ ? invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : invariant(doc.kind === 'Document', 52);
|
|
41
|
+
__DEV__ ? invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : invariant(doc.definitions.length <= 1, 53);
|
|
42
42
|
var fragmentDef = doc.definitions[0];
|
|
43
|
-
__DEV__ ? invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
43
|
+
__DEV__ ? invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : invariant(fragmentDef.kind === 'FragmentDefinition', 54);
|
|
44
44
|
return fragmentDef;
|
|
45
45
|
}
|
|
46
46
|
export function getMainDefinition(queryDoc) {
|
|
@@ -63,7 +63,7 @@ export function getMainDefinition(queryDoc) {
|
|
|
63
63
|
if (fragmentDefinition) {
|
|
64
64
|
return fragmentDefinition;
|
|
65
65
|
}
|
|
66
|
-
throw __DEV__ ? new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new InvariantError(
|
|
66
|
+
throw __DEV__ ? new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new InvariantError(55);
|
|
67
67
|
}
|
|
68
68
|
export function getDefaultValues(definition) {
|
|
69
69
|
var defaultValues = Object.create(null);
|
|
@@ -73,7 +73,7 @@ export function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
73
73
|
else {
|
|
74
74
|
throw __DEV__ ? new InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
75
75
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
76
|
-
'overcome this limitation.') : new InvariantError(
|
|
76
|
+
'overcome this limitation.') : new InvariantError(56);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
export function storeKeyNameFromField(field, variables) {
|
package/utilities/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { StoreObject, Reference, StoreValue, Directives, VariableValue, makeRefe
|
|
|
6
6
|
export { RemoveNodeConfig, GetNodeConfig, RemoveDirectiveConfig, GetDirectiveConfig, RemoveArgumentsConfig, GetFragmentSpreadConfig, RemoveFragmentSpreadConfig, RemoveFragmentDefinitionConfig, RemoveVariableDefinitionConfig, addTypenameToDocument, buildQueryFromSelectionSet, removeDirectivesFromDocument, removeConnectionDirectiveFromDocument, removeArgumentsFromDocument, removeFragmentSpreadFromDocument, removeClientSetsFromDocument, } from './graphql/transform';
|
|
7
7
|
export { concatPagination, offsetLimitPagination, relayStylePagination, } from './policies/pagination';
|
|
8
8
|
export { Observable, Observer, ObservableSubscription } from './observables/Observable';
|
|
9
|
-
export { isStatefulPromise, wrapPromiseWithState, } from './promises/decoration';
|
|
9
|
+
export { isStatefulPromise, createFulfilledPromise, createRejectedPromise, wrapPromiseWithState, } from './promises/decoration';
|
|
10
10
|
export * from './common/mergeDeep';
|
|
11
11
|
export * from './common/cloneDeep';
|
|
12
12
|
export * from './common/maybeDeepFreeze';
|
|
@@ -28,4 +28,5 @@ export { omitDeep } from './common/omitDeep';
|
|
|
28
28
|
export { stripTypename } from './common/stripTypename';
|
|
29
29
|
export * from './types/IsStrictlyAny';
|
|
30
30
|
export { DeepOmit } from './types/DeepOmit';
|
|
31
|
+
export { DeepPartial } from './types/DeepPartial';
|
|
31
32
|
//# sourceMappingURL=index.d.ts.map
|
package/utilities/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,eAAe,EACf,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,qCAAqC,EACrC,2BAA2B,EAC3B,gCAAgC,EAChC,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,gBAAgB,E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B,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|
package/utilities/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { makeReference, isDocumentNode, isReference, isField, isInlineFragment,
|
|
|
6
6
|
export { addTypenameToDocument, buildQueryFromSelectionSet, removeDirectivesFromDocument, removeConnectionDirectiveFromDocument, removeArgumentsFromDocument, removeFragmentSpreadFromDocument, removeClientSetsFromDocument, } from "./graphql/transform.js";
|
|
7
7
|
export { concatPagination, offsetLimitPagination, relayStylePagination, } from "./policies/pagination.js";
|
|
8
8
|
export { Observable } from "./observables/Observable.js";
|
|
9
|
-
export { isStatefulPromise, wrapPromiseWithState, } from "./promises/decoration.js";
|
|
9
|
+
export { isStatefulPromise, createFulfilledPromise, createRejectedPromise, wrapPromiseWithState, } from "./promises/decoration.js";
|
|
10
10
|
export * from "./common/mergeDeep.js";
|
|
11
11
|
export * from "./common/cloneDeep.js";
|
|
12
12
|
export * from "./common/maybeDeepFreeze.js";
|
package/utilities/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAGL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,GACvB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C;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,cAAc,uBAAuB,CAAC","sourcesContent":["export { DEV, maybe } from './globals';\n\nexport {\n DirectiveInfo,\n InclusionDirectives,\n shouldInclude,\n hasDirectives,\n hasAnyDirectives,\n hasAllDirectives,\n hasClientExports,\n getDirectiveNames,\n getInclusionDirectives,\n} from './graphql/directives';\n\nexport {\n FragmentMap,\n FragmentMapFunction,\n createFragmentMap,\n getFragmentQueryDocument,\n getFragmentFromSelection,\n} from './graphql/fragments';\n\nexport {\n checkDocument,\n getOperationDefinition,\n getOperationName,\n getFragmentDefinitions,\n getQueryDefinition,\n getFragmentDefinition,\n getMainDefinition,\n getDefaultValues,\n} from './graphql/getFromAST';\n\nexport {\n StoreObject,\n Reference,\n StoreValue,\n Directives,\n VariableValue,\n makeReference,\n isDocumentNode,\n isReference,\n isField,\n isInlineFragment,\n valueToObjectRepresentation,\n storeKeyNameFromField,\n argumentsObjectFromField,\n resultKeyNameFromField,\n getStoreKeyName,\n getTypenameFromResult,\n} from './graphql/storeUtils';\n\nexport {\n RemoveNodeConfig,\n GetNodeConfig,\n RemoveDirectiveConfig,\n GetDirectiveConfig,\n RemoveArgumentsConfig,\n GetFragmentSpreadConfig,\n RemoveFragmentSpreadConfig,\n RemoveFragmentDefinitionConfig,\n RemoveVariableDefinitionConfig,\n addTypenameToDocument,\n buildQueryFromSelectionSet,\n removeDirectivesFromDocument,\n removeConnectionDirectiveFromDocument,\n removeArgumentsFromDocument,\n removeFragmentSpreadFromDocument,\n removeClientSetsFromDocument,\n} from './graphql/transform';\n\nexport {\n concatPagination,\n offsetLimitPagination,\n relayStylePagination,\n} from './policies/pagination';\n\nexport {\n Observable,\n Observer,\n ObservableSubscription\n} from './observables/Observable';\n\nexport { \n isStatefulPromise,\n wrapPromiseWithState,\n} from './promises/decoration';\n\nexport * from './common/mergeDeep';\nexport * from './common/cloneDeep';\nexport * from './common/maybeDeepFreeze';\nexport * from './observables/iteration';\nexport * from './observables/asyncMap';\nexport * from './observables/Concast';\nexport * from './observables/subclassing';\nexport * from './common/arrays';\nexport * from './common/objects';\nexport * from './common/errorHandling';\nexport * from './common/canUse';\nexport * from './common/compact';\nexport * from './common/makeUniqueId';\nexport * from './common/stringifyForDisplay';\nexport * from './common/mergeOptions';\nexport * from './common/responseIterator';\nexport * from './common/incrementalResult';\n\nexport { omitDeep } from './common/omitDeep';\nexport { stripTypename } from './common/stripTypename';\n\nexport * from './types/IsStrictlyAny';\nexport { DeepOmit } from './types/DeepOmit';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAGL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAGL,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAML,aAAa,EACb,cAAc,EACd,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,eAAe,EACf,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAUL,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,qCAAqC,EACrC,2BAA2B,EAC3B,gCAAgC,EAChC,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,UAAU,EAGX,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,cAAc,uBAAuB,CAAC","sourcesContent":["export { DEV, maybe } from './globals';\n\nexport {\n DirectiveInfo,\n InclusionDirectives,\n shouldInclude,\n hasDirectives,\n hasAnyDirectives,\n hasAllDirectives,\n hasClientExports,\n getDirectiveNames,\n getInclusionDirectives,\n} from './graphql/directives';\n\nexport {\n FragmentMap,\n FragmentMapFunction,\n createFragmentMap,\n getFragmentQueryDocument,\n getFragmentFromSelection,\n} from './graphql/fragments';\n\nexport {\n checkDocument,\n getOperationDefinition,\n getOperationName,\n getFragmentDefinitions,\n getQueryDefinition,\n getFragmentDefinition,\n getMainDefinition,\n getDefaultValues,\n} from './graphql/getFromAST';\n\nexport {\n StoreObject,\n Reference,\n StoreValue,\n Directives,\n VariableValue,\n makeReference,\n isDocumentNode,\n isReference,\n isField,\n isInlineFragment,\n valueToObjectRepresentation,\n storeKeyNameFromField,\n argumentsObjectFromField,\n resultKeyNameFromField,\n getStoreKeyName,\n getTypenameFromResult,\n} from './graphql/storeUtils';\n\nexport {\n RemoveNodeConfig,\n GetNodeConfig,\n RemoveDirectiveConfig,\n GetDirectiveConfig,\n RemoveArgumentsConfig,\n GetFragmentSpreadConfig,\n RemoveFragmentSpreadConfig,\n RemoveFragmentDefinitionConfig,\n RemoveVariableDefinitionConfig,\n addTypenameToDocument,\n buildQueryFromSelectionSet,\n removeDirectivesFromDocument,\n removeConnectionDirectiveFromDocument,\n removeArgumentsFromDocument,\n removeFragmentSpreadFromDocument,\n removeClientSetsFromDocument,\n} from './graphql/transform';\n\nexport {\n concatPagination,\n offsetLimitPagination,\n relayStylePagination,\n} from './policies/pagination';\n\nexport {\n Observable,\n Observer,\n ObservableSubscription\n} from './observables/Observable';\n\nexport { \n isStatefulPromise,\n createFulfilledPromise,\n createRejectedPromise,\n wrapPromiseWithState,\n} from './promises/decoration';\n\nexport * from './common/mergeDeep';\nexport * from './common/cloneDeep';\nexport * from './common/maybeDeepFreeze';\nexport * from './observables/iteration';\nexport * from './observables/asyncMap';\nexport * from './observables/Concast';\nexport * from './observables/subclassing';\nexport * from './common/arrays';\nexport * from './common/objects';\nexport * from './common/errorHandling';\nexport * from './common/canUse';\nexport * from './common/compact';\nexport * from './common/makeUniqueId';\nexport * from './common/stringifyForDisplay';\nexport * from './common/mergeOptions';\nexport * from './common/responseIterator';\nexport * from './common/incrementalResult';\n\nexport { omitDeep } from './common/omitDeep';\nexport { stripTypename } from './common/stripTypename';\n\nexport * from './types/IsStrictlyAny';\nexport { DeepOmit } from './types/DeepOmit';\nexport { DeepPartial } from './types/DeepPartial';\n"]}
|
|
@@ -10,6 +10,8 @@ export interface RejectedPromise<TValue> extends Promise<TValue> {
|
|
|
10
10
|
reason: unknown;
|
|
11
11
|
}
|
|
12
12
|
export type PromiseWithState<TValue> = PendingPromise<TValue> | FulfilledPromise<TValue> | RejectedPromise<TValue>;
|
|
13
|
+
export declare function createFulfilledPromise<TValue>(value: TValue): FulfilledPromise<TValue>;
|
|
14
|
+
export declare function createRejectedPromise<TValue = unknown>(reason: unknown): RejectedPromise<TValue>;
|
|
13
15
|
export declare function isStatefulPromise<TValue>(promise: Promise<TValue>): promise is PromiseWithState<TValue>;
|
|
14
16
|
export declare function wrapPromiseWithState<TValue>(promise: Promise<TValue>): PromiseWithState<TValue>;
|
|
15
17
|
//# sourceMappingURL=decoration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoration.d.ts","sourceRoot":"","sources":["../../../src/utilities/promises/decoration.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc,CAAC,MAAM,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC;IAC7D,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB,CAAC,MAAM,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC;IAC/D,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe,CAAC,MAAM,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC;IAC9D,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAC/B,cAAc,CAAC,MAAM,CAAC,GACtB,gBAAgB,CAAC,MAAM,CAAC,GACxB,eAAe,CAAC,MAAM,CAAC,CAAC;AAE5B,wBAAgB,iBAAiB,CAAC,MAAM,EACtC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,GACvB,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAErC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EACzC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,GACvB,gBAAgB,CAAC,MAAM,CAAC,CA8B1B"}
|
|
1
|
+
{"version":3,"file":"decoration.d.ts","sourceRoot":"","sources":["../../../src/utilities/promises/decoration.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc,CAAC,MAAM,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC;IAC7D,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB,CAAC,MAAM,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC;IAC/D,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe,CAAC,MAAM,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC;IAC9D,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAC/B,cAAc,CAAC,MAAM,CAAC,GACtB,gBAAgB,CAAC,MAAM,CAAC,GACxB,eAAe,CAAC,MAAM,CAAC,CAAC;AAE5B,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,4BAO3D;AAED,wBAAgB,qBAAqB,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,EAAE,OAAO,2BAOtE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EACtC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,GACvB,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAErC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EACzC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,GACvB,gBAAgB,CAAC,MAAM,CAAC,CA8B1B"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
export function createFulfilledPromise(value) {
|
|
2
|
+
var promise = Promise.resolve(value);
|
|
3
|
+
promise.status = 'fulfilled';
|
|
4
|
+
promise.value = value;
|
|
5
|
+
return promise;
|
|
6
|
+
}
|
|
7
|
+
export function createRejectedPromise(reason) {
|
|
8
|
+
var promise = Promise.reject(reason);
|
|
9
|
+
promise.status = 'rejected';
|
|
10
|
+
promise.reason = reason;
|
|
11
|
+
return promise;
|
|
12
|
+
}
|
|
1
13
|
export function isStatefulPromise(promise) {
|
|
2
14
|
return 'status' in promise;
|
|
3
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoration.js","sourceRoot":"","sources":["../../../src/utilities/promises/decoration.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,iBAAiB,CAC/B,OAAwB;IAExB,OAAO,QAAQ,IAAI,OAAO,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,OAAwB;IAExB,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE;QAC9B,OAAO,OAAO,CAAC;KAChB;IAED,IAAM,cAAc,GAAG,OAAiC,CAAC;IACzD,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAElC,cAAc,CAAC,IAAI,CACjB,UAAC,KAAK;QACJ,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,EAAE;YACvC,IAAM,gBAAgB,GACpB,cAAqD,CAAC;YAExD,gBAAgB,CAAC,MAAM,GAAG,WAAW,CAAC;YACtC,gBAAgB,CAAC,KAAK,GAAG,KAAK,CAAC;SAChC;IACH,CAAC,EACD,UAAC,MAAe;QACd,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,EAAE;YACvC,IAAM,eAAe,GACnB,cAAoD,CAAC;YAEvD,eAAe,CAAC,MAAM,GAAG,UAAU,CAAC;YACpC,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;SACjC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,OAAmC,CAAC;AAC7C,CAAC","sourcesContent":["export interface PendingPromise<TValue> extends Promise<TValue> {\n status: 'pending';\n}\n\nexport interface FulfilledPromise<TValue> extends Promise<TValue> {\n status: 'fulfilled';\n value: TValue;\n}\n\nexport interface RejectedPromise<TValue> extends Promise<TValue> {\n status: 'rejected';\n reason: unknown;\n}\n\nexport type PromiseWithState<TValue> =\n | PendingPromise<TValue>\n | FulfilledPromise<TValue>\n | RejectedPromise<TValue>;\n\nexport function isStatefulPromise<TValue>(\n promise: Promise<TValue>\n): promise is PromiseWithState<TValue> {\n return 'status' in promise;\n}\n\nexport function wrapPromiseWithState<TValue>(\n promise: Promise<TValue>\n): PromiseWithState<TValue> {\n if (isStatefulPromise(promise)) {\n return promise;\n }\n\n const pendingPromise = promise as PendingPromise<TValue>;\n pendingPromise.status = 'pending';\n\n pendingPromise.then(\n (value) => {\n if (pendingPromise.status === 'pending') {\n const fulfilledPromise =\n pendingPromise as unknown as FulfilledPromise<TValue>;\n\n fulfilledPromise.status = 'fulfilled';\n fulfilledPromise.value = value;\n }\n },\n (reason: unknown) => {\n if (pendingPromise.status === 'pending') {\n const rejectedPromise =\n pendingPromise as unknown as RejectedPromise<TValue>;\n\n rejectedPromise.status = 'rejected';\n rejectedPromise.reason = reason;\n }\n }\n );\n\n return promise as PromiseWithState<TValue>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"decoration.js","sourceRoot":"","sources":["../../../src/utilities/promises/decoration.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,sBAAsB,CAAS,KAAa;IAC1D,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAA6B,CAAC;IAEnE,OAAO,CAAC,MAAM,GAAG,WAAW,CAAC;IAC7B,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IAEtB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAmB,MAAe;IACrE,IAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAA4B,CAAC;IAElE,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC;IAC5B,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IAExB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,OAAwB;IAExB,OAAO,QAAQ,IAAI,OAAO,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,OAAwB;IAExB,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE;QAC9B,OAAO,OAAO,CAAC;KAChB;IAED,IAAM,cAAc,GAAG,OAAiC,CAAC;IACzD,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAElC,cAAc,CAAC,IAAI,CACjB,UAAC,KAAK;QACJ,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,EAAE;YACvC,IAAM,gBAAgB,GACpB,cAAqD,CAAC;YAExD,gBAAgB,CAAC,MAAM,GAAG,WAAW,CAAC;YACtC,gBAAgB,CAAC,KAAK,GAAG,KAAK,CAAC;SAChC;IACH,CAAC,EACD,UAAC,MAAe;QACd,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,EAAE;YACvC,IAAM,eAAe,GACnB,cAAoD,CAAC;YAEvD,eAAe,CAAC,MAAM,GAAG,UAAU,CAAC;YACpC,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;SACjC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,OAAmC,CAAC;AAC7C,CAAC","sourcesContent":["export interface PendingPromise<TValue> extends Promise<TValue> {\n status: 'pending';\n}\n\nexport interface FulfilledPromise<TValue> extends Promise<TValue> {\n status: 'fulfilled';\n value: TValue;\n}\n\nexport interface RejectedPromise<TValue> extends Promise<TValue> {\n status: 'rejected';\n reason: unknown;\n}\n\nexport type PromiseWithState<TValue> =\n | PendingPromise<TValue>\n | FulfilledPromise<TValue>\n | RejectedPromise<TValue>;\n\nexport function createFulfilledPromise<TValue>(value: TValue) {\n const promise = Promise.resolve(value) as FulfilledPromise<TValue>;\n\n promise.status = 'fulfilled';\n promise.value = value;\n\n return promise;\n}\n\nexport function createRejectedPromise<TValue = unknown>(reason: unknown) {\n const promise = Promise.reject(reason) as RejectedPromise<TValue>;\n\n promise.status = 'rejected';\n promise.reason = reason;\n\n return promise;\n}\n\nexport function isStatefulPromise<TValue>(\n promise: Promise<TValue>\n): promise is PromiseWithState<TValue> {\n return 'status' in promise;\n}\n\nexport function wrapPromiseWithState<TValue>(\n promise: Promise<TValue>\n): PromiseWithState<TValue> {\n if (isStatefulPromise(promise)) {\n return promise;\n }\n\n const pendingPromise = promise as PendingPromise<TValue>;\n pendingPromise.status = 'pending';\n\n pendingPromise.then(\n (value) => {\n if (pendingPromise.status === 'pending') {\n const fulfilledPromise =\n pendingPromise as unknown as FulfilledPromise<TValue>;\n\n fulfilledPromise.status = 'fulfilled';\n fulfilledPromise.value = value;\n }\n },\n (reason: unknown) => {\n if (pendingPromise.status === 'pending') {\n const rejectedPromise =\n pendingPromise as unknown as RejectedPromise<TValue>;\n\n rejectedPromise.status = 'rejected';\n rejectedPromise.reason = reason;\n }\n }\n );\n\n return promise as PromiseWithState<TValue>;\n}\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { Primitive } from './Primitive';
|
|
2
|
+
type DeepOmitPrimitive = Primitive | Function;
|
|
2
3
|
export type DeepOmitArray<T extends any[], K> = {
|
|
3
4
|
[P in keyof T]: DeepOmit<T[P], K>;
|
|
4
5
|
};
|
|
5
|
-
export type DeepOmit<T, K> = T extends
|
|
6
|
-
[P in Exclude<keyof T, K>]: T[P] extends infer TP ? TP extends
|
|
6
|
+
export type DeepOmit<T, K> = T extends DeepOmitPrimitive ? T : {
|
|
7
|
+
[P in Exclude<keyof T, K>]: T[P] extends infer TP ? TP extends DeepOmitPrimitive ? TP : TP extends any[] ? DeepOmitArray<TP, K> : DeepOmit<TP, K> : never;
|
|
7
8
|
};
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=DeepOmit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeepOmit.d.ts","sourceRoot":"","sources":["../../../src/utilities/types/DeepOmit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DeepOmit.d.ts","sourceRoot":"","sources":["../../../src/utilities/types/DeepOmit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,KAAK,iBAAiB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9C,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,IAAI;KAC7C,CAAC,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CAClC,CAAC;AAcF,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,iBAAiB,GACpD,CAAC,GACD;KACG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,EAAE,GAC7C,EAAE,SAAS,iBAAiB,GAC1B,EAAE,GACF,EAAE,SAAS,GAAG,EAAE,GAChB,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC,GACpB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,GACjB,KAAK;CACV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeepOmit.js","sourceRoot":"","sources":["../../../src/utilities/types/DeepOmit.ts"],"names":[],"mappings":"","sourcesContent":["// DeepOmit primitives include functions
|
|
1
|
+
{"version":3,"file":"DeepOmit.js","sourceRoot":"","sources":["../../../src/utilities/types/DeepOmit.ts"],"names":[],"mappings":"","sourcesContent":["import { Primitive } from './Primitive';\n\n// DeepOmit primitives include functions since these are unmodified.\ntype DeepOmitPrimitive = Primitive | Function;\n\nexport type DeepOmitArray<T extends any[], K> = {\n [P in keyof T]: DeepOmit<T[P], K>;\n};\n\n// Unfortunately there is one major flaw in this type: This will omit properties\n// from class instances in the return type even though our omitDeep helper\n// ignores class instances, therefore resulting in a type mismatch between\n// the return value and the runtime value.\n//\n// It is not currently possible with TypeScript to distinguish between plain\n// objects and class instances.\n// https://github.com/microsoft/TypeScript/issues/29063\n//\n// This should be fine as of the time of this writing until omitDeep gets\n// broader use since this utility is only used to strip __typename from\n// `variables`; a case in which class instances are invalid anyways.\nexport type DeepOmit<T, K> = T extends DeepOmitPrimitive\n ? T\n : {\n [P in Exclude<keyof T, K>]: T[P] extends infer TP\n ? TP extends DeepOmitPrimitive\n ? TP\n : TP extends any[]\n ? DeepOmitArray<TP, K>\n : DeepOmit<TP, K>\n : never;\n };\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Primitive } from './Primitive';
|
|
2
|
+
type DeepPartialPrimitive = Primitive | Date | RegExp;
|
|
3
|
+
export type DeepPartial<T> = T extends DeepPartialPrimitive ? T : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue> : T extends ReadonlyMap<infer TKey, infer TValue> ? DeepPartialReadonlyMap<TKey, TValue> : T extends Set<infer TItem> ? DeepPartialSet<TItem> : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends ReadonlyArray<infer TItem> ? TItem[] extends T ? readonly TItem[] extends T ? ReadonlyArray<DeepPartial<TItem | undefined>> : Array<DeepPartial<TItem | undefined>> : DeepPartialObject<T> : DeepPartialObject<T> : unknown;
|
|
4
|
+
type DeepPartialMap<TKey, TValue> = {} & Map<DeepPartial<TKey>, DeepPartial<TValue>>;
|
|
5
|
+
type DeepPartialReadonlyMap<TKey, TValue> = {} & ReadonlyMap<DeepPartial<TKey>, DeepPartial<TValue>>;
|
|
6
|
+
type DeepPartialSet<T> = {} & Set<DeepPartial<T>>;
|
|
7
|
+
type DeepPartialReadonlySet<T> = {} & ReadonlySet<DeepPartial<T>>;
|
|
8
|
+
type DeepPartialObject<T extends object> = {
|
|
9
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=DeepPartial.d.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,CAAC,MAAM,CAAC,CACpB,CAAC;AAEF,KAAK,sBAAsB,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,GAAG,WAAW,CAC1D,WAAW,CAAC,IAAI,CAAC,EACjB,WAAW,CAAC,MAAM,CAAC,CACpB,CAAC;AAEF,KAAK,cAAc,CAAC,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,KAAK,sBAAsB,CAAC,CAAC,IAAI,EAAE,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAElE,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,IAAI;KACxC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeepPartial.js","sourceRoot":"","sources":["../../../src/utilities/types/DeepPartial.ts"],"names":[],"mappings":"","sourcesContent":["// Inspired by type-fest PartialDeep: https://github.com/sindresorhus/type-fest/blob/9feb8c89be9a0f2f688bf2f497230298a8e2472e/source/partial-deep.d.ts\n//\n// We're including the license to give credit to the original implementation.\n// https://github.com/sindresorhus/type-fest/blob/main/license-mit\n\n/*\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nimport { Primitive } from './Primitive';\n\ntype DeepPartialPrimitive = Primitive | Date | RegExp;\n\nexport type DeepPartial<T> = T extends DeepPartialPrimitive\n ? T\n : T extends Map<infer TKey, infer TValue>\n ? DeepPartialMap<TKey, TValue>\n : T extends ReadonlyMap<infer TKey, infer TValue>\n ? DeepPartialReadonlyMap<TKey, TValue>\n : T extends Set<infer TItem>\n ? DeepPartialSet<TItem>\n : T extends ReadonlySet<infer TItem>\n ? DeepPartialReadonlySet<TItem>\n : T extends (...args: any[]) => unknown\n ? T | undefined\n : T extends object\n ? T extends ReadonlyArray<infer TItem> // Test for arrays/tuples\n ? TItem[] extends T // Test for non-tuples\n ? readonly TItem[] extends T\n ? ReadonlyArray<DeepPartial<TItem | undefined>>\n : Array<DeepPartial<TItem | undefined>>\n : DeepPartialObject<T>\n : DeepPartialObject<T>\n : unknown;\n\ntype DeepPartialMap<TKey, TValue> = {} & Map<\n DeepPartial<TKey>,\n DeepPartial<TValue>\n>;\n\ntype DeepPartialReadonlyMap<TKey, TValue> = {} & ReadonlyMap<\n DeepPartial<TKey>,\n DeepPartial<TValue>\n>;\n\ntype DeepPartialSet<T> = {} & Set<DeepPartial<T>>;\ntype DeepPartialReadonlySet<T> = {} & ReadonlySet<DeepPartial<T>>;\n\ntype DeepPartialObject<T extends object> = {\n [K in keyof T]?: DeepPartial<T[K]>;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Primitive.d.ts","sourceRoot":"","sources":["../../../src/utilities/types/Primitive.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Primitive.js","sourceRoot":"","sources":["../../../src/utilities/types/Primitive.ts"],"names":[],"mappings":"","sourcesContent":["// Matches any primitive value: https://developer.mozilla.org/en-US/docs/Glossary/Primitive.\nexport type Primitive =\n | null\n | undefined\n | string\n | number\n | boolean\n | symbol\n | bigint;\n"]}
|