@graphql-tools/utils 10.7.2 → 12.0.1
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/cjs/astFromValue.js +21 -14
- package/cjs/build-operation-for-field.js +13 -3
- package/cjs/collectFields.js +4 -3
- package/cjs/comments.js +1 -1
- package/cjs/defaultValueAstFromType.js +32 -0
- package/cjs/descriptionFromObject.js +7 -5
- package/cjs/errors.js +30 -4
- package/cjs/getArgumentValues.js +23 -15
- package/cjs/getDirectiveValues.js +15 -0
- package/cjs/heal.js +4 -1
- package/cjs/helpers.js +40 -4
- package/cjs/index.js +8 -5
- package/cjs/jsutils.js +4 -6
- package/cjs/mapSchema.js +2 -1
- package/cjs/mergeDeep.js +35 -9
- package/cjs/mergeIncrementalResult.js +25 -4
- package/cjs/observableToAsyncIterable.js +29 -17
- package/cjs/print-schema-with-directives.js +23 -17
- package/cjs/registerAbortSignalListener.js +5 -1
- package/cjs/stub.js +1 -0
- package/cjs/updateArgument.js +2 -1
- package/cjs/visitResult.js +7 -1
- package/esm/astFromValue.js +21 -14
- package/esm/build-operation-for-field.js +13 -3
- package/esm/collectFields.js +2 -1
- package/esm/comments.js +1 -1
- package/esm/defaultValueAstFromType.js +28 -0
- package/esm/descriptionFromObject.js +7 -5
- package/esm/errors.js +29 -6
- package/esm/getArgumentValues.js +24 -16
- package/esm/getDirectiveValues.js +12 -0
- package/esm/heal.js +4 -1
- package/esm/helpers.js +39 -4
- package/esm/index.js +3 -4
- package/esm/jsutils.js +3 -5
- package/esm/mapSchema.js +2 -1
- package/esm/mergeDeep.js +35 -9
- package/esm/mergeIncrementalResult.js +25 -4
- package/esm/observableToAsyncIterable.js +28 -16
- package/esm/print-schema-with-directives.js +24 -18
- package/esm/registerAbortSignalListener.js +5 -1
- package/esm/stub.js +1 -0
- package/esm/updateArgument.js +2 -1
- package/esm/visitResult.js +7 -1
- package/package.json +3 -3
- package/typings/Interfaces.d.cts +39 -0
- package/typings/Interfaces.d.ts +39 -0
- package/typings/collectFields.d.cts +5 -6
- package/typings/collectFields.d.ts +5 -6
- package/typings/defaultValueAstFromType.d.cts +9 -0
- package/typings/defaultValueAstFromType.d.ts +9 -0
- package/typings/errors.d.cts +19 -1
- package/typings/errors.d.ts +19 -1
- package/typings/executor.d.cts +4 -7
- package/typings/executor.d.ts +4 -7
- package/typings/getDirectiveExtensions.d.cts +1 -3
- package/typings/getDirectiveExtensions.d.ts +1 -3
- package/typings/getDirectiveValues.d.cts +10 -0
- package/typings/getDirectiveValues.d.ts +10 -0
- package/typings/helpers.d.cts +28 -2
- package/typings/helpers.d.ts +28 -2
- package/typings/index.d.cts +3 -4
- package/typings/index.d.ts +3 -4
- package/typings/jsutils.d.cts +2 -2
- package/typings/jsutils.d.ts +2 -2
- package/typings/mergeDeep.d.cts +1 -1
- package/typings/mergeDeep.d.ts +1 -1
- package/typings/print-schema-with-directives.d.cts +1 -0
- package/typings/print-schema-with-directives.d.ts +1 -0
- package/typings/registerAbortSignalListener.d.cts +1 -1
- package/typings/registerAbortSignalListener.d.ts +1 -1
- package/typings/types.d.cts +25 -1
- package/typings/types.d.ts +25 -1
- package/cjs/createDeferred.js +0 -15
- package/cjs/fakePromise.js +0 -63
- package/cjs/map-maybe-promise.js +0 -26
- package/cjs/mapAsyncIterator.js +0 -75
- package/esm/createDeferred.js +0 -12
- package/esm/fakePromise.js +0 -59
- package/esm/map-maybe-promise.js +0 -23
- package/esm/mapAsyncIterator.js +0 -72
- package/typings/createDeferred.d.cts +0 -6
- package/typings/createDeferred.d.ts +0 -6
- package/typings/fakePromise.d.cts +0 -4
- package/typings/fakePromise.d.ts +0 -4
- package/typings/map-maybe-promise.d.cts +0 -2
- package/typings/map-maybe-promise.d.ts +0 -2
- package/typings/mapAsyncIterator.d.cts +0 -6
- package/typings/mapAsyncIterator.d.ts +0 -6
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FieldNode, FragmentDefinitionNode, FragmentSpreadNode, GraphQLObjectType, GraphQLSchema, InlineFragmentNode, SelectionSetNode } from 'graphql';
|
|
2
|
+
import { VariableValues } from './types.cjs';
|
|
2
3
|
export interface PatchFields {
|
|
3
4
|
label: string | undefined;
|
|
4
5
|
fields: Map<string, Array<FieldNode>>;
|
|
@@ -15,12 +16,12 @@ export interface FieldsAndPatches {
|
|
|
15
16
|
* object type returned by that field.
|
|
16
17
|
*
|
|
17
18
|
*/
|
|
18
|
-
export declare function collectFields<TVariables = any>(schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: TVariables
|
|
19
|
+
export declare function collectFields<TVariables = any>(schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: VariableValues<TVariables>, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode): FieldsAndPatches;
|
|
19
20
|
/**
|
|
20
21
|
* Determines if a field should be included based on the `@include` and `@skip`
|
|
21
22
|
* directives, where `@skip` has higher precedence than `@include`.
|
|
22
23
|
*/
|
|
23
|
-
export declare function shouldIncludeNode(variableValues:
|
|
24
|
+
export declare function shouldIncludeNode<TVariables = any>(variableValues: VariableValues<TVariables>, node: FragmentSpreadNode | FieldNode | InlineFragmentNode): boolean;
|
|
24
25
|
/**
|
|
25
26
|
* Determines if a fragment is applicable to the given type.
|
|
26
27
|
*/
|
|
@@ -34,7 +35,7 @@ export declare function getFieldEntryKey(node: FieldNode): string;
|
|
|
34
35
|
* deferred based on the experimental flag, defer directive present and
|
|
35
36
|
* not disabled by the "if" argument.
|
|
36
37
|
*/
|
|
37
|
-
export declare function getDeferValues(variableValues:
|
|
38
|
+
export declare function getDeferValues<TVariables = any>(variableValues: VariableValues<TVariables>, node: FragmentSpreadNode | InlineFragmentNode): undefined | {
|
|
38
39
|
label: string | undefined;
|
|
39
40
|
};
|
|
40
41
|
/**
|
|
@@ -46,6 +47,4 @@ export declare function getDeferValues(variableValues: any, node: FragmentSpread
|
|
|
46
47
|
* object type returned by that field.
|
|
47
48
|
*
|
|
48
49
|
*/
|
|
49
|
-
export declare const collectSubFields: (schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues:
|
|
50
|
-
[variable: string]: unknown;
|
|
51
|
-
}, returnType: GraphQLObjectType, fieldNodes: Array<FieldNode>) => FieldsAndPatches;
|
|
50
|
+
export declare const collectSubFields: (schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: VariableValues, returnType: GraphQLObjectType, fieldNodes: Array<FieldNode>) => FieldsAndPatches;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FieldNode, FragmentDefinitionNode, FragmentSpreadNode, GraphQLObjectType, GraphQLSchema, InlineFragmentNode, SelectionSetNode } from 'graphql';
|
|
2
|
+
import { VariableValues } from './types.js';
|
|
2
3
|
export interface PatchFields {
|
|
3
4
|
label: string | undefined;
|
|
4
5
|
fields: Map<string, Array<FieldNode>>;
|
|
@@ -15,12 +16,12 @@ export interface FieldsAndPatches {
|
|
|
15
16
|
* object type returned by that field.
|
|
16
17
|
*
|
|
17
18
|
*/
|
|
18
|
-
export declare function collectFields<TVariables = any>(schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: TVariables
|
|
19
|
+
export declare function collectFields<TVariables = any>(schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: VariableValues<TVariables>, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode): FieldsAndPatches;
|
|
19
20
|
/**
|
|
20
21
|
* Determines if a field should be included based on the `@include` and `@skip`
|
|
21
22
|
* directives, where `@skip` has higher precedence than `@include`.
|
|
22
23
|
*/
|
|
23
|
-
export declare function shouldIncludeNode(variableValues:
|
|
24
|
+
export declare function shouldIncludeNode<TVariables = any>(variableValues: VariableValues<TVariables>, node: FragmentSpreadNode | FieldNode | InlineFragmentNode): boolean;
|
|
24
25
|
/**
|
|
25
26
|
* Determines if a fragment is applicable to the given type.
|
|
26
27
|
*/
|
|
@@ -34,7 +35,7 @@ export declare function getFieldEntryKey(node: FieldNode): string;
|
|
|
34
35
|
* deferred based on the experimental flag, defer directive present and
|
|
35
36
|
* not disabled by the "if" argument.
|
|
36
37
|
*/
|
|
37
|
-
export declare function getDeferValues(variableValues:
|
|
38
|
+
export declare function getDeferValues<TVariables = any>(variableValues: VariableValues<TVariables>, node: FragmentSpreadNode | InlineFragmentNode): undefined | {
|
|
38
39
|
label: string | undefined;
|
|
39
40
|
};
|
|
40
41
|
/**
|
|
@@ -46,6 +47,4 @@ export declare function getDeferValues(variableValues: any, node: FragmentSpread
|
|
|
46
47
|
* object type returned by that field.
|
|
47
48
|
*
|
|
48
49
|
*/
|
|
49
|
-
export declare const collectSubFields: (schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues:
|
|
50
|
-
[variable: string]: unknown;
|
|
51
|
-
}, returnType: GraphQLObjectType, fieldNodes: Array<FieldNode>) => FieldsAndPatches;
|
|
50
|
+
export declare const collectSubFields: (schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: VariableValues, returnType: GraphQLObjectType, fieldNodes: Array<FieldNode>) => FieldsAndPatches;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type GraphQLArgument, type GraphQLInputField, type ValueNode } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* `defaultValueAstFromType` extracts default value from `GraphQLArgument` or `GraphQLInputField`, if available
|
|
4
|
+
* This is compatible with all `graphql` versions
|
|
5
|
+
*
|
|
6
|
+
* The return type is `ConstValueNode` in graphql@16+,
|
|
7
|
+
* but it is not available in graphql@15 so `ValueNode` is used as return type here and `as any` is often required at callsites for backwards compatibility,
|
|
8
|
+
*/
|
|
9
|
+
export declare const defaultValueAstFromType: (arg: GraphQLArgument | GraphQLInputField) => ValueNode | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type GraphQLArgument, type GraphQLInputField, type ValueNode } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* `defaultValueAstFromType` extracts default value from `GraphQLArgument` or `GraphQLInputField`, if available
|
|
4
|
+
* This is compatible with all `graphql` versions
|
|
5
|
+
*
|
|
6
|
+
* The return type is `ConstValueNode` in graphql@16+,
|
|
7
|
+
* but it is not available in graphql@15 so `ValueNode` is used as return type here and `as any` is often required at callsites for backwards compatibility,
|
|
8
|
+
*/
|
|
9
|
+
export declare const defaultValueAstFromType: (arg: GraphQLArgument | GraphQLInputField) => ValueNode | undefined;
|
package/typings/errors.d.cts
CHANGED
|
@@ -9,7 +9,25 @@ interface GraphQLErrorOptions {
|
|
|
9
9
|
readonly extensions?: unknown;
|
|
10
10
|
}>;
|
|
11
11
|
extensions?: any;
|
|
12
|
+
coordinate?: string;
|
|
12
13
|
}
|
|
14
|
+
declare module 'graphql' {
|
|
15
|
+
interface GraphQLError {
|
|
16
|
+
/**
|
|
17
|
+
* An optional schema coordinate (e.g. "MyType.myField") associated with this error.
|
|
18
|
+
*/
|
|
19
|
+
readonly coordinate?: string;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export declare function isGraphQLErrorLike(error: any): boolean;
|
|
13
23
|
export declare function createGraphQLError(message: string, options?: GraphQLErrorOptions): GraphQLError;
|
|
14
|
-
|
|
24
|
+
type SchemaCoordinateInfo = {
|
|
25
|
+
fieldName: string;
|
|
26
|
+
parentType: {
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function getSchemaCoordinate(error: GraphQLError): string | undefined;
|
|
31
|
+
export declare function locatedError(rawError: unknown, nodes: ASTNode | ReadonlyArray<ASTNode> | undefined, path: Maybe<ReadonlyArray<string | number>>, info?: SchemaCoordinateInfo | false | null | undefined): GraphQLError;
|
|
32
|
+
export declare function relocatedError(originalError: GraphQLError, path?: ReadonlyArray<string | number>, info?: SchemaCoordinateInfo | false | null | undefined): GraphQLError;
|
|
15
33
|
export {};
|
package/typings/errors.d.ts
CHANGED
|
@@ -9,7 +9,25 @@ interface GraphQLErrorOptions {
|
|
|
9
9
|
readonly extensions?: unknown;
|
|
10
10
|
}>;
|
|
11
11
|
extensions?: any;
|
|
12
|
+
coordinate?: string;
|
|
12
13
|
}
|
|
14
|
+
declare module 'graphql' {
|
|
15
|
+
interface GraphQLError {
|
|
16
|
+
/**
|
|
17
|
+
* An optional schema coordinate (e.g. "MyType.myField") associated with this error.
|
|
18
|
+
*/
|
|
19
|
+
readonly coordinate?: string;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export declare function isGraphQLErrorLike(error: any): boolean;
|
|
13
23
|
export declare function createGraphQLError(message: string, options?: GraphQLErrorOptions): GraphQLError;
|
|
14
|
-
|
|
24
|
+
type SchemaCoordinateInfo = {
|
|
25
|
+
fieldName: string;
|
|
26
|
+
parentType: {
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function getSchemaCoordinate(error: GraphQLError): string | undefined;
|
|
31
|
+
export declare function locatedError(rawError: unknown, nodes: ASTNode | ReadonlyArray<ASTNode> | undefined, path: Maybe<ReadonlyArray<string | number>>, info?: SchemaCoordinateInfo | false | null | undefined): GraphQLError;
|
|
32
|
+
export declare function relocatedError(originalError: GraphQLError, path?: ReadonlyArray<string | number>, info?: SchemaCoordinateInfo | false | null | undefined): GraphQLError;
|
|
15
33
|
export {};
|
package/typings/executor.d.cts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import type { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
1
2
|
import { ExecutionRequest, ExecutionResult } from './Interfaces.cjs';
|
|
2
|
-
export type MaybePromise
|
|
3
|
+
export type { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
3
4
|
export type MaybeAsyncIterable<T> = AsyncIterable<T> | T;
|
|
4
5
|
export type AsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => Promise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
5
6
|
export type SyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => ExecutionResult<TReturn>;
|
|
6
7
|
export type Executor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => MaybePromise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
7
|
-
export type DisposableSyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = SyncExecutor<TBaseContext, TBaseExtensions> &
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
export type DisposableAsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = AsyncExecutor<TBaseContext, TBaseExtensions> & {
|
|
11
|
-
[Symbol.asyncDispose]: () => PromiseLike<void>;
|
|
12
|
-
};
|
|
8
|
+
export type DisposableSyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = SyncExecutor<TBaseContext, TBaseExtensions> & Disposable;
|
|
9
|
+
export type DisposableAsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = AsyncExecutor<TBaseContext, TBaseExtensions> & AsyncDisposable;
|
|
13
10
|
export type DisposableExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = DisposableSyncExecutor<TBaseContext, TBaseExtensions> | DisposableAsyncExecutor<TBaseContext, TBaseExtensions>;
|
package/typings/executor.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import type { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
1
2
|
import { ExecutionRequest, ExecutionResult } from './Interfaces.js';
|
|
2
|
-
export type MaybePromise
|
|
3
|
+
export type { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
3
4
|
export type MaybeAsyncIterable<T> = AsyncIterable<T> | T;
|
|
4
5
|
export type AsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => Promise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
5
6
|
export type SyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => ExecutionResult<TReturn>;
|
|
6
7
|
export type Executor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => MaybePromise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
7
|
-
export type DisposableSyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = SyncExecutor<TBaseContext, TBaseExtensions> &
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
export type DisposableAsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = AsyncExecutor<TBaseContext, TBaseExtensions> & {
|
|
11
|
-
[Symbol.asyncDispose]: () => PromiseLike<void>;
|
|
12
|
-
};
|
|
8
|
+
export type DisposableSyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = SyncExecutor<TBaseContext, TBaseExtensions> & Disposable;
|
|
9
|
+
export type DisposableAsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = AsyncExecutor<TBaseContext, TBaseExtensions> & AsyncDisposable;
|
|
13
10
|
export type DisposableExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = DisposableSyncExecutor<TBaseContext, TBaseExtensions> | DisposableAsyncExecutor<TBaseContext, TBaseExtensions>;
|
|
@@ -5,9 +5,7 @@ export type DirectableASTNode = ASTNode & {
|
|
|
5
5
|
export type DirectableObject = {
|
|
6
6
|
astNode?: DirectableASTNode | null | undefined;
|
|
7
7
|
extensionASTNodes?: readonly DirectableASTNode[] | null | undefined;
|
|
8
|
-
extensions?:
|
|
9
|
-
directives?: Record<string, any> | undefined;
|
|
10
|
-
} | null | undefined;
|
|
8
|
+
extensions?: any;
|
|
11
9
|
};
|
|
12
10
|
export declare function getDirectiveExtensions<TDirectiveAnnotationsMap extends {
|
|
13
11
|
[directiveName: string]: {
|
|
@@ -5,9 +5,7 @@ export type DirectableASTNode = ASTNode & {
|
|
|
5
5
|
export type DirectableObject = {
|
|
6
6
|
astNode?: DirectableASTNode | null | undefined;
|
|
7
7
|
extensionASTNodes?: readonly DirectableASTNode[] | null | undefined;
|
|
8
|
-
extensions?:
|
|
9
|
-
directives?: Record<string, any> | undefined;
|
|
10
|
-
} | null | undefined;
|
|
8
|
+
extensions?: any;
|
|
11
9
|
};
|
|
12
10
|
export declare function getDirectiveExtensions<TDirectiveAnnotationsMap extends {
|
|
13
11
|
[directiveName: string]: {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DirectiveNode, GraphQLDirective } from 'graphql';
|
|
2
|
+
import { VariableValues } from './types.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* GraphQL v17's getDirectiveValues function accepts `VariableValues`
|
|
5
|
+
* while older versions accept `Record<string, any>`. This function wraps the original
|
|
6
|
+
* getDirectiveValues function to provide compatibility across versions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDirectiveValues<TVariables = Record<string, unknown>>(directiveDef: GraphQLDirective, node: {
|
|
9
|
+
readonly directives?: ReadonlyArray<DirectiveNode> | undefined;
|
|
10
|
+
}, variableValues?: VariableValues<TVariables>): undefined | Record<string, unknown>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DirectiveNode, GraphQLDirective } from 'graphql';
|
|
2
|
+
import { VariableValues } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* GraphQL v17's getDirectiveValues function accepts `VariableValues`
|
|
5
|
+
* while older versions accept `Record<string, any>`. This function wraps the original
|
|
6
|
+
* getDirectiveValues function to provide compatibility across versions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDirectiveValues<TVariables = Record<string, unknown>>(directiveDef: GraphQLDirective, node: {
|
|
9
|
+
readonly directives?: ReadonlyArray<DirectiveNode> | undefined;
|
|
10
|
+
}, variableValues?: VariableValues<TVariables>): undefined | Record<string, unknown>;
|
package/typings/helpers.d.cts
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
import { ASTNode } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the given string is a valid URL.
|
|
4
|
+
*
|
|
5
|
+
* @param str - The string to validate as a URL
|
|
6
|
+
* @returns A boolean indicating whether the string is a valid URL
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This function first attempts to use the `URL.canParse` method if available.
|
|
10
|
+
* If not, it falls back to creating a new `URL` object to validate the string.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isUrl(str: string): boolean;
|
|
2
13
|
export declare const asArray: <T>(fns: T | T[]) => T[];
|
|
14
|
+
/**
|
|
15
|
+
* Determines if a given input is a valid GraphQL document string.
|
|
16
|
+
*
|
|
17
|
+
* @param str - The input to validate as a GraphQL document
|
|
18
|
+
* @returns A boolean indicating whether the input is a valid GraphQL document string
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This function performs several validation checks:
|
|
22
|
+
* - Ensures the input is a string
|
|
23
|
+
* - Filters out strings with invalid document extensions
|
|
24
|
+
* - Excludes URLs
|
|
25
|
+
* - Attempts to parse the string as a GraphQL document
|
|
26
|
+
*
|
|
27
|
+
* @throws {Error} If the document fails to parse and is empty except GraphQL comments
|
|
28
|
+
*/
|
|
3
29
|
export declare function isDocumentString(str: any): boolean;
|
|
4
30
|
/**
|
|
5
|
-
*
|
|
31
|
+
* Checks whether the `str` contains any path illegal characters.
|
|
6
32
|
*
|
|
7
33
|
* A string may sometimes look like a path but is not (like an SDL of a simple
|
|
8
34
|
* GraphQL schema). To make sure we don't yield false-positives in such cases,
|
|
@@ -10,7 +36,7 @@ export declare function isDocumentString(str: any): boolean;
|
|
|
10
36
|
* lines in file names).
|
|
11
37
|
*/
|
|
12
38
|
export declare function isValidPath(str: any): boolean;
|
|
13
|
-
export declare function compareStrings<A, B>(a: A, b: B):
|
|
39
|
+
export declare function compareStrings<A, B>(a: A, b: B): -1 | 0 | 1;
|
|
14
40
|
export declare function nodeToString(a: ASTNode): string;
|
|
15
41
|
export declare function compareNodes(a: ASTNode, b: ASTNode, customFn?: (a: any, b: any) => number): number;
|
|
16
42
|
export declare function isSome<T>(input: T): input is Exclude<T, null | undefined>;
|
package/typings/helpers.d.ts
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
import { ASTNode } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the given string is a valid URL.
|
|
4
|
+
*
|
|
5
|
+
* @param str - The string to validate as a URL
|
|
6
|
+
* @returns A boolean indicating whether the string is a valid URL
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This function first attempts to use the `URL.canParse` method if available.
|
|
10
|
+
* If not, it falls back to creating a new `URL` object to validate the string.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isUrl(str: string): boolean;
|
|
2
13
|
export declare const asArray: <T>(fns: T | T[]) => T[];
|
|
14
|
+
/**
|
|
15
|
+
* Determines if a given input is a valid GraphQL document string.
|
|
16
|
+
*
|
|
17
|
+
* @param str - The input to validate as a GraphQL document
|
|
18
|
+
* @returns A boolean indicating whether the input is a valid GraphQL document string
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This function performs several validation checks:
|
|
22
|
+
* - Ensures the input is a string
|
|
23
|
+
* - Filters out strings with invalid document extensions
|
|
24
|
+
* - Excludes URLs
|
|
25
|
+
* - Attempts to parse the string as a GraphQL document
|
|
26
|
+
*
|
|
27
|
+
* @throws {Error} If the document fails to parse and is empty except GraphQL comments
|
|
28
|
+
*/
|
|
3
29
|
export declare function isDocumentString(str: any): boolean;
|
|
4
30
|
/**
|
|
5
|
-
*
|
|
31
|
+
* Checks whether the `str` contains any path illegal characters.
|
|
6
32
|
*
|
|
7
33
|
* A string may sometimes look like a path but is not (like an SDL of a simple
|
|
8
34
|
* GraphQL schema). To make sure we don't yield false-positives in such cases,
|
|
@@ -10,7 +36,7 @@ export declare function isDocumentString(str: any): boolean;
|
|
|
10
36
|
* lines in file names).
|
|
11
37
|
*/
|
|
12
38
|
export declare function isValidPath(str: any): boolean;
|
|
13
|
-
export declare function compareStrings<A, B>(a: A, b: B):
|
|
39
|
+
export declare function compareStrings<A, B>(a: A, b: B): -1 | 0 | 1;
|
|
14
40
|
export declare function nodeToString(a: ASTNode): string;
|
|
15
41
|
export declare function compareNodes(a: ASTNode, b: ASTNode, customFn?: (a: any, b: any) => number): number;
|
|
16
42
|
export declare function isSome<T>(input: T): input is Exclude<T, null | undefined>;
|
package/typings/index.d.cts
CHANGED
|
@@ -28,8 +28,8 @@ export * from './getResponseKeyFromInfo.cjs';
|
|
|
28
28
|
export * from './fields.cjs';
|
|
29
29
|
export * from './renameType.cjs';
|
|
30
30
|
export * from './transformInputValue.cjs';
|
|
31
|
-
export * from './mapAsyncIterator.cjs';
|
|
32
31
|
export * from './updateArgument.cjs';
|
|
32
|
+
export * from './astFromType.cjs';
|
|
33
33
|
export * from './implementsAbstractType.cjs';
|
|
34
34
|
export * from './errors.cjs';
|
|
35
35
|
export * from './observableToAsyncIterable.cjs';
|
|
@@ -55,7 +55,6 @@ export * from './directives.cjs';
|
|
|
55
55
|
export * from './mergeIncrementalResult.cjs';
|
|
56
56
|
export * from './debugTimer.cjs';
|
|
57
57
|
export * from './getDirectiveExtensions.cjs';
|
|
58
|
-
export
|
|
59
|
-
export * from './fakePromise.cjs';
|
|
60
|
-
export * from './createDeferred.cjs';
|
|
58
|
+
export { mapAsyncIterator, mapMaybePromise, fakePromise, createDeferredPromise as createDeferred, } from '@whatwg-node/promise-helpers';
|
|
61
59
|
export * from './registerAbortSignalListener.cjs';
|
|
60
|
+
export * from './getDirectiveValues.cjs';
|
package/typings/index.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ export * from './getResponseKeyFromInfo.js';
|
|
|
28
28
|
export * from './fields.js';
|
|
29
29
|
export * from './renameType.js';
|
|
30
30
|
export * from './transformInputValue.js';
|
|
31
|
-
export * from './mapAsyncIterator.js';
|
|
32
31
|
export * from './updateArgument.js';
|
|
32
|
+
export * from './astFromType.js';
|
|
33
33
|
export * from './implementsAbstractType.js';
|
|
34
34
|
export * from './errors.js';
|
|
35
35
|
export * from './observableToAsyncIterable.js';
|
|
@@ -55,7 +55,6 @@ export * from './directives.js';
|
|
|
55
55
|
export * from './mergeIncrementalResult.js';
|
|
56
56
|
export * from './debugTimer.js';
|
|
57
57
|
export * from './getDirectiveExtensions.js';
|
|
58
|
-
export
|
|
59
|
-
export * from './fakePromise.js';
|
|
60
|
-
export * from './createDeferred.js';
|
|
58
|
+
export { mapAsyncIterator, mapMaybePromise, fakePromise, createDeferredPromise as createDeferred, } from '@whatwg-node/promise-helpers';
|
|
61
59
|
export * from './registerAbortSignalListener.js';
|
|
60
|
+
export * from './getDirectiveValues.js';
|
package/typings/jsutils.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MaybePromise } from '
|
|
1
|
+
import { isPromise, type MaybePromise } from '@whatwg-node/promise-helpers';
|
|
2
2
|
export declare function isIterableObject(value: unknown): value is Iterable<unknown>;
|
|
3
3
|
export declare function isObjectLike(value: unknown): value is {
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export { isPromise };
|
|
7
7
|
export declare function promiseReduce<T, U>(values: Iterable<T>, callbackFn: (accumulator: U, currentValue: T) => MaybePromise<U>, initialValue: MaybePromise<U>): MaybePromise<U>;
|
|
8
8
|
export declare function hasOwnProperty(obj: unknown, prop: string): boolean;
|
package/typings/jsutils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MaybePromise } from '
|
|
1
|
+
import { isPromise, type MaybePromise } from '@whatwg-node/promise-helpers';
|
|
2
2
|
export declare function isIterableObject(value: unknown): value is Iterable<unknown>;
|
|
3
3
|
export declare function isObjectLike(value: unknown): value is {
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export { isPromise };
|
|
7
7
|
export declare function promiseReduce<T, U>(values: Iterable<T>, callbackFn: (accumulator: U, currentValue: T) => MaybePromise<U>, initialValue: MaybePromise<U>): MaybePromise<U>;
|
|
8
8
|
export declare function hasOwnProperty(obj: unknown, prop: string): boolean;
|
package/typings/mergeDeep.d.cts
CHANGED
|
@@ -5,5 +5,5 @@ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
|
|
|
5
5
|
type UnboxIntersection<T> = T extends {
|
|
6
6
|
0: infer U;
|
|
7
7
|
} ? U : never;
|
|
8
|
-
export declare function mergeDeep<S extends any[]>(sources: S, respectPrototype?: boolean, respectArrays?: boolean, respectArrayLength?: boolean): UnboxIntersection<UnionToIntersection<BoxedTupleTypes<S>>> & any;
|
|
8
|
+
export declare function mergeDeep<S extends any[]>(sources: S, respectPrototype?: boolean, respectArrays?: boolean, respectArrayLength?: boolean, respectNonEnumerableSymbols?: boolean): UnboxIntersection<UnionToIntersection<BoxedTupleTypes<S>>> & any;
|
|
9
9
|
export {};
|
package/typings/mergeDeep.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
|
|
|
5
5
|
type UnboxIntersection<T> = T extends {
|
|
6
6
|
0: infer U;
|
|
7
7
|
} ? U : never;
|
|
8
|
-
export declare function mergeDeep<S extends any[]>(sources: S, respectPrototype?: boolean, respectArrays?: boolean, respectArrayLength?: boolean): UnboxIntersection<UnionToIntersection<BoxedTupleTypes<S>>> & any;
|
|
8
|
+
export declare function mergeDeep<S extends any[]>(sources: S, respectPrototype?: boolean, respectArrays?: boolean, respectArrayLength?: boolean, respectNonEnumerableSymbols?: boolean): UnboxIntersection<UnionToIntersection<BoxedTupleTypes<S>>> & any;
|
|
9
9
|
export {};
|
|
@@ -9,6 +9,7 @@ export declare function getDirectiveNodes<TDirectiveNode extends DirectiveNode>(
|
|
|
9
9
|
deprecationReason?: string | null;
|
|
10
10
|
specifiedByUrl?: string | null;
|
|
11
11
|
specifiedByURL?: string | null;
|
|
12
|
+
isOneOf?: boolean;
|
|
12
13
|
}, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): Array<TDirectiveNode>;
|
|
13
14
|
export declare function astFromArg(arg: GraphQLArgument, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): InputValueDefinitionNode;
|
|
14
15
|
export declare function astFromObjectType(type: GraphQLObjectType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): ObjectTypeDefinitionNode;
|
|
@@ -9,6 +9,7 @@ export declare function getDirectiveNodes<TDirectiveNode extends DirectiveNode>(
|
|
|
9
9
|
deprecationReason?: string | null;
|
|
10
10
|
specifiedByUrl?: string | null;
|
|
11
11
|
specifiedByURL?: string | null;
|
|
12
|
+
isOneOf?: boolean;
|
|
12
13
|
}, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): Array<TDirectiveNode>;
|
|
13
14
|
export declare function astFromArg(arg: GraphQLArgument, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): InputValueDefinitionNode;
|
|
14
15
|
export declare function astFromObjectType(type: GraphQLObjectType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): ObjectTypeDefinitionNode;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* warning occuring on Node.js
|
|
6
6
|
*/
|
|
7
7
|
export declare function registerAbortSignalListener(signal: AbortSignal, listener: () => void): void;
|
|
8
|
-
export declare const getAbortPromise: (signal: AbortSignal) => Promise<
|
|
8
|
+
export declare const getAbortPromise: (signal: AbortSignal) => Promise<unknown>;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* warning occuring on Node.js
|
|
6
6
|
*/
|
|
7
7
|
export declare function registerAbortSignalListener(signal: AbortSignal, listener: () => void): void;
|
|
8
|
-
export declare const getAbortPromise: (signal: AbortSignal) => Promise<
|
|
8
|
+
export declare const getAbortPromise: (signal: AbortSignal) => Promise<unknown>;
|
package/typings/types.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLEnumType, GraphQLInputObjectType, GraphQLNamedType, GraphQLScalarType, visit } from 'graphql';
|
|
1
|
+
import { GraphQLEnumType, GraphQLInputObjectType, GraphQLInputType, GraphQLNamedType, GraphQLScalarType, visit } from 'graphql';
|
|
2
2
|
export interface SchemaPrintOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Descriptions are defined as preceding string literals, however an older
|
|
@@ -117,3 +117,27 @@ export type DirectiveUsage = {
|
|
|
117
117
|
name: string;
|
|
118
118
|
args: DirectiveArgs;
|
|
119
119
|
};
|
|
120
|
+
export interface PromiseWithResolvers<T> {
|
|
121
|
+
promise: Promise<T>;
|
|
122
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
123
|
+
reject: (reason?: any) => void;
|
|
124
|
+
}
|
|
125
|
+
export interface VariableValues<TVariables = Record<string, unknown>> {
|
|
126
|
+
/** Coerced runtime variable values keyed by variable name. */
|
|
127
|
+
readonly coerced: TVariables;
|
|
128
|
+
/** Source metadata for each variable value keyed by variable name. */
|
|
129
|
+
readonly sources: Record<string, VariableValueSource>;
|
|
130
|
+
}
|
|
131
|
+
export interface VariableValueSource {
|
|
132
|
+
readonly signature: GraphQLVariableSignature;
|
|
133
|
+
readonly value?: unknown;
|
|
134
|
+
}
|
|
135
|
+
interface GraphQLVariableSignature {
|
|
136
|
+
name: string;
|
|
137
|
+
type: GraphQLInputType;
|
|
138
|
+
defaultValue?: never;
|
|
139
|
+
default: {
|
|
140
|
+
literal: any;
|
|
141
|
+
} | undefined;
|
|
142
|
+
}
|
|
143
|
+
export {};
|
package/typings/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLEnumType, GraphQLInputObjectType, GraphQLNamedType, GraphQLScalarType, visit } from 'graphql';
|
|
1
|
+
import { GraphQLEnumType, GraphQLInputObjectType, GraphQLInputType, GraphQLNamedType, GraphQLScalarType, visit } from 'graphql';
|
|
2
2
|
export interface SchemaPrintOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Descriptions are defined as preceding string literals, however an older
|
|
@@ -117,3 +117,27 @@ export type DirectiveUsage = {
|
|
|
117
117
|
name: string;
|
|
118
118
|
args: DirectiveArgs;
|
|
119
119
|
};
|
|
120
|
+
export interface PromiseWithResolvers<T> {
|
|
121
|
+
promise: Promise<T>;
|
|
122
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
123
|
+
reject: (reason?: any) => void;
|
|
124
|
+
}
|
|
125
|
+
export interface VariableValues<TVariables = Record<string, unknown>> {
|
|
126
|
+
/** Coerced runtime variable values keyed by variable name. */
|
|
127
|
+
readonly coerced: TVariables;
|
|
128
|
+
/** Source metadata for each variable value keyed by variable name. */
|
|
129
|
+
readonly sources: Record<string, VariableValueSource>;
|
|
130
|
+
}
|
|
131
|
+
export interface VariableValueSource {
|
|
132
|
+
readonly signature: GraphQLVariableSignature;
|
|
133
|
+
readonly value?: unknown;
|
|
134
|
+
}
|
|
135
|
+
interface GraphQLVariableSignature {
|
|
136
|
+
name: string;
|
|
137
|
+
type: GraphQLInputType;
|
|
138
|
+
defaultValue?: never;
|
|
139
|
+
default: {
|
|
140
|
+
literal: any;
|
|
141
|
+
} | undefined;
|
|
142
|
+
}
|
|
143
|
+
export {};
|
package/cjs/createDeferred.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDeferred = createDeferred;
|
|
4
|
-
function createDeferred() {
|
|
5
|
-
if (Promise.withResolvers) {
|
|
6
|
-
return Promise.withResolvers();
|
|
7
|
-
}
|
|
8
|
-
let resolve;
|
|
9
|
-
let reject;
|
|
10
|
-
const promise = new Promise((_resolve, _reject) => {
|
|
11
|
-
resolve = _resolve;
|
|
12
|
-
reject = _reject;
|
|
13
|
-
});
|
|
14
|
-
return { promise, resolve, reject };
|
|
15
|
-
}
|
package/cjs/fakePromise.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fakeRejectPromise = fakeRejectPromise;
|
|
4
|
-
exports.fakePromise = fakePromise;
|
|
5
|
-
function isPromise(val) {
|
|
6
|
-
return val?.then != null;
|
|
7
|
-
}
|
|
8
|
-
function fakeRejectPromise(error) {
|
|
9
|
-
if (isPromise(error)) {
|
|
10
|
-
return error;
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
then() {
|
|
14
|
-
return this;
|
|
15
|
-
},
|
|
16
|
-
catch(reject) {
|
|
17
|
-
if (reject) {
|
|
18
|
-
return fakePromise(reject(error));
|
|
19
|
-
}
|
|
20
|
-
return this;
|
|
21
|
-
},
|
|
22
|
-
finally(cb) {
|
|
23
|
-
if (cb) {
|
|
24
|
-
cb();
|
|
25
|
-
}
|
|
26
|
-
return this;
|
|
27
|
-
},
|
|
28
|
-
[Symbol.toStringTag]: 'Promise',
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function fakePromise(value) {
|
|
32
|
-
if (isPromise(value)) {
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
// Write a fake promise to avoid the promise constructor
|
|
36
|
-
// being called with `new Promise` in the browser.
|
|
37
|
-
return {
|
|
38
|
-
then(resolve) {
|
|
39
|
-
if (resolve) {
|
|
40
|
-
const callbackResult = resolve(value);
|
|
41
|
-
if (isPromise(callbackResult)) {
|
|
42
|
-
return callbackResult;
|
|
43
|
-
}
|
|
44
|
-
return fakePromise(callbackResult);
|
|
45
|
-
}
|
|
46
|
-
return this;
|
|
47
|
-
},
|
|
48
|
-
catch() {
|
|
49
|
-
return this;
|
|
50
|
-
},
|
|
51
|
-
finally(cb) {
|
|
52
|
-
if (cb) {
|
|
53
|
-
const callbackResult = cb();
|
|
54
|
-
if (isPromise(callbackResult)) {
|
|
55
|
-
return callbackResult.then(() => value);
|
|
56
|
-
}
|
|
57
|
-
return fakePromise(value);
|
|
58
|
-
}
|
|
59
|
-
return this;
|
|
60
|
-
},
|
|
61
|
-
[Symbol.toStringTag]: 'Promise',
|
|
62
|
-
};
|
|
63
|
-
}
|
package/cjs/map-maybe-promise.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapMaybePromise = mapMaybePromise;
|
|
4
|
-
const jsutils_js_1 = require("./jsutils.js");
|
|
5
|
-
function mapMaybePromise(value, mapper, errorMapper) {
|
|
6
|
-
if ((0, jsutils_js_1.isPromise)(value)) {
|
|
7
|
-
if (errorMapper) {
|
|
8
|
-
try {
|
|
9
|
-
return value.then(mapper, errorMapper);
|
|
10
|
-
}
|
|
11
|
-
catch (e) {
|
|
12
|
-
return errorMapper(e);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return value.then(mapper);
|
|
16
|
-
}
|
|
17
|
-
if (errorMapper) {
|
|
18
|
-
try {
|
|
19
|
-
return mapper(value);
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
return errorMapper(e);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return mapper(value);
|
|
26
|
-
}
|