Skip to main content

@graphql-mesh/utils

Type aliases#

Variables#

Functions#

Type aliases#

ArgTypeMap#

Ƭ ArgTypeMap: object

Type declaration:#

Defined in: packages/utils/src/resolver-data-factory.ts:17


ResolverDataBasedFactory#

Ƭ ResolverDataBasedFactory<T\>: (data: ResolverData) => T

Type parameters:#

Name
T

Type declaration:#

▸ (data: ResolverData): T

Parameters:#

NameType
dataResolverData

Returns: T

Defined in: packages/utils/src/resolver-data-factory.ts:15

Variables#

globalLruCache#

Const globalLruCache: Lru<any\>

Defined in: packages/utils/src/global-lru-cache.ts:3


stringInterpolator#

Const stringInterpolator: any

Defined in: packages/utils/src/string-interpolator.ts:5

Functions#

applyRequestTransforms#

applyRequestTransforms(originalRequest: Request, delegationContext: DelegationContext, transformationContext: Record<string, any\>, transforms: Transform[]): Request

Parameters:#

NameType
originalRequestRequest
delegationContextDelegationContext
transformationContextRecord<string, any\>
transformsTransform[]

Returns: Request

Defined in: packages/utils/src/apply-transforms.ts:17


applyResultTransforms#

applyResultTransforms(originalResult: ExecutionResult, delegationContext: DelegationContext, transformationContext: Record<string, any\>, transforms: Transform[]): ExecutionResult<Record<string, any\>\>

Parameters:#

NameType
originalResultExecutionResult
delegationContextDelegationContext
transformationContextRecord<string, any\>
transformsTransform[]

Returns: ExecutionResult<Record<string, any\>\>

Defined in: packages/utils/src/apply-transforms.ts:41


applySchemaTransforms#

applySchemaTransforms(originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig, transformedSchema: GraphQLSchema, transforms: Transform[]): GraphQLSchema

Parameters:#

NameType
originalWrappingSchemaGraphQLSchema
subschemaConfigSubschemaConfig
transformedSchemaGraphQLSchema
transformsTransform[]

Returns: GraphQLSchema

Defined in: packages/utils/src/apply-transforms.ts:5


ensureDocumentNode#

ensureDocumentNode<TData, TVariables\>(document: GraphQLOperation<TData, TVariables\>): TypedDocumentNode<TData, TVariables\>

Type parameters:#

NameDefault
TDataany
TVariablesany

Parameters:#

NameType
documentGraphQLOperation<TData, TVariables\>

Returns: TypedDocumentNode<TData, TVariables\>

Defined in: packages/utils/src/ensure-document-node.ts:5


extractResolvers#

extractResolvers(schema: GraphQLSchema): any

Parameters:#

NameType
schemaGraphQLSchema

Returns: any

Defined in: packages/utils/src/extract-resolvers.ts:4


flatString#

flatString(str: string): string

Parameters:#

NameType
strstring

Returns: string

Defined in: packages/utils/src/flat-string.ts:2


getCachedFetch#

getCachedFetch(cache: KeyValueCache): typeof fetch

Parameters:#

NameType
cacheKeyValueCache

Returns: typeof fetch

Defined in: packages/utils/src/read-file-or-url.ts:19


getHeadersObject#

getHeadersObject(headers: Headers): Record<string, string\>

Parameters:#

NameType
headersHeaders

Returns: Record<string, string\>

Defined in: packages/utils/src/resolver-data-factory.ts:93


getInputTypeFromTypeName#

getInputTypeFromTypeName(typeName: GraphQLInputType | ArgType): GraphQLInputType

Parameters:#

NameType
typeNameGraphQLInputType | ArgType

Returns: GraphQLInputType

Defined in: packages/utils/src/resolver-data-factory.ts:27


getInterpolatedHeadersFactory#

getInterpolatedHeadersFactory(nonInterpolatedHeaders?: Record<string, string\>): ResolverDataBasedFactory<Headers\>

Parameters:#

NameTypeDefault value
nonInterpolatedHeadersRecord<string, string\>{}

Returns: ResolverDataBasedFactory<Headers\>

Defined in: packages/utils/src/resolver-data-factory.ts:78


getInterpolatedStringFactory#

getInterpolatedStringFactory(nonInterpolatedString: string): ResolverDataBasedFactory<string\>

Parameters:#

NameType
nonInterpolatedStringstring

Returns: ResolverDataBasedFactory<string\>

Defined in: packages/utils/src/resolver-data-factory.ts:74


groupTransforms#

groupTransforms(transforms: MeshTransform[]): object

Parameters:#

NameType
transformsMeshTransform[]

Returns: object

NameType
noWrapTransformsMeshTransform[]
wrapTransformsMeshTransform[]

Defined in: packages/utils/src/group-transforms.ts:3


isUrl#

isUrl(string: string): boolean

Parameters:#

NameType
stringstring

Returns: boolean

Defined in: node_modules/@types/is-url/index.d.ts:9


jsonFlatStringify#

jsonFlatStringify<T\>(data: T, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string

Type parameters:#

Name
T

Parameters:#

NameType
dataT
replacer?(this: any, key: string, value: any) => any
space?string | number

Returns: string

Defined in: packages/utils/src/flat-string.ts:6


loadFromModuleExportExpression#

loadFromModuleExportExpression<T\>(expression: T | string, options?: loadFromModuleExportExpressionOptions): Promise<T\>

Type parameters:#

Name
T

Parameters:#

NameType
expressionT | string
options?loadFromModuleExportExpressionOptions

Returns: Promise<T\>

Defined in: packages/utils/src/load-from-module-export-expression.ts:8


loadFromModuleExportExpressionSync#

loadFromModuleExportExpressionSync<T\>(expression: T | string, options?: loadFromModuleExportExpressionOptions): T

Type parameters:#

Name
T

Parameters:#

NameType
expressionT | string
options?loadFromModuleExportExpressionOptions

Returns: T

Defined in: packages/utils/src/load-from-module-export-expression.ts:47


mkdir#

mkdir(path: string, options?: MakeDirectoryOptions): Promise<void\>

Parameters:#

NameType
pathstring
optionsMakeDirectoryOptions

Returns: Promise<void\>

Defined in: packages/utils/src/fs-operations.ts:53


parseInterpolationStrings#

parseInterpolationStrings(interpolationStrings: string[], argTypeMap?: ArgTypeMap): object

Parameters:#

NameType
interpolationStringsstring[]
argTypeMap?ArgTypeMap

Returns: object

NameType
argsGraphQLFieldConfigArgumentMap
contextVariablesstring[]

Defined in: packages/utils/src/resolver-data-factory.ts:46


pathExists#

pathExists(path: string): Promise<boolean\>

Parameters:#

NameType
pathstring

Returns: Promise<boolean\>

Defined in: packages/utils/src/fs-operations.ts:7


readFileOrUrlWithCache#

readFileOrUrlWithCache<T\>(filePathOrUrl: string, cache: KeyValueCache, config?: ReadFileOrUrlOptions): Promise<T\>

Type parameters:#

Name
T

Parameters:#

NameType
filePathOrUrlstring
cacheKeyValueCache
config?ReadFileOrUrlOptions

Returns: Promise<T\>

Defined in: packages/utils/src/read-file-or-url.ts:28


readFileWithCache#

readFileWithCache<T\>(filePath: string, cache: KeyValueCache, config?: ReadFileOrUrlOptions): Promise<T\>

Type parameters:#

Name
T

Parameters:#

NameType
filePathstring
cacheKeyValueCache
config?ReadFileOrUrlOptions

Returns: Promise<T\>

Defined in: packages/utils/src/read-file-or-url.ts:40


readJSON#

readJSON<T\>(path: string): Promise<T\>

Type parameters:#

NameDefault
Tany

Parameters:#

NameType
pathstring

Returns: Promise<T\>

Defined in: packages/utils/src/fs-operations.ts:28


readJSONSync#

readJSONSync<T\>(path: string): T

Type parameters:#

NameDefault
Tany

Parameters:#

NameType
pathstring

Returns: T

Defined in: packages/utils/src/fs-operations.ts:23


readUrlWithCache#

readUrlWithCache<T\>(path: string, cache: KeyValueCache, config?: ReadFileOrUrlOptions): Promise<T\>

Type parameters:#

Name
T

Parameters:#

NameType
pathstring
cacheKeyValueCache
config?ReadFileOrUrlOptions

Returns: Promise<T\>

Defined in: packages/utils/src/read-file-or-url.ts:78


withCancel#

withCancel<T\>(asyncIteratorLike: { [Symbol.asyncIterator]: () => AsyncIterator<T, any, undefined\> }, onCancel: () => void): AsyncIterator<T | undefined\>

Type parameters:#

Name
T

Parameters:#

NameType
asyncIteratorLikeobject
asyncIteratorLike.[Symbol.asyncIterator]-
onCancel() => void

Returns: AsyncIterator<T | undefined\>

Defined in: packages/utils/src/with-cancel.ts:1


writeFile#

ConstwriteFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { flag?: OpenMode ; mode?: Mode } | BufferEncoding | null): Promise<void\>

Parameters:#

NameType
pathPathLike | FileHandle
datastring | Uint8Array
options?BaseEncodingOptions & { flag?: OpenMode ; mode?: Mode } | BufferEncoding | null

Returns: Promise<void\>

Defined in: packages/utils/src/fs-operations.ts:43


writeJSON#

writeJSON<T\>(path: string, data: T, replacer?: (this: any, key: string, value: any) => any, space?: string | number): Promise<void\>

Type parameters:#

Name
T

Parameters:#

NameType
pathstring
dataT
replacer?(this: any, key: string, value: any) => any
space?string | number

Returns: Promise<void\>

Defined in: packages/utils/src/fs-operations.ts:33