/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import {ArrayKeyType, ArrayKeyTypeData, KeyType, KeyTypeData} from './ReactRelayTypes'; import {GraphQLTaggedNode, IEnvironment, OperationType} from 'relay-runtime'; export interface PreloadedQueryResponse { readonly data: TData; readonly errors?: ReadonlyArray<{ readonly message: string }>; } export interface PreloadedQueryRef { readonly kind: 'PreloadedQueryRef'; readonly queryId: string; readonly variables: TVariables; readonly _response: Promise>; readonly fetchedAt: number; } export interface ServerEnvironment { readonly getEnvironment: () => IEnvironment; readonly serverFetchQuery: ( query: GraphQLTaggedNode, variables: T['variables'], ) => Promise; readonly serverPreloadQuery: ( query: GraphQLTaggedNode, variables: T['variables'], ) => PreloadedQueryRef; readonly serverReadFragment: { ( fragment: GraphQLTaggedNode, fragmentRef: TKey, ): Promise>; ( fragment: GraphQLTaggedNode, fragmentRef: TKey, ): Promise>; }; } export function createServerEnvironment( create: () => IEnvironment, ): ServerEnvironment;