@graphql-tools/utils 8.6.3 → 8.6.6
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/index.js +20 -7
- package/index.mjs +20 -7
- package/package.json +1 -1
- package/print-schema-with-directives.d.ts +1 -1
package/index.js
CHANGED
|
@@ -90,8 +90,7 @@ function isAggregateError(error) {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
// Taken from graphql-js
|
|
93
|
-
const
|
|
94
|
-
const MAX_RECURSIVE_DEPTH = 2;
|
|
93
|
+
const MAX_RECURSIVE_DEPTH = 3;
|
|
95
94
|
/**
|
|
96
95
|
* Used to print values in error messages.
|
|
97
96
|
*/
|
|
@@ -163,8 +162,8 @@ function formatArray(array, seenValues) {
|
|
|
163
162
|
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
164
163
|
return '[Array]';
|
|
165
164
|
}
|
|
166
|
-
const len =
|
|
167
|
-
const remaining = array.length
|
|
165
|
+
const len = array.length;
|
|
166
|
+
const remaining = array.length;
|
|
168
167
|
const items = [];
|
|
169
168
|
for (let i = 0; i < len; ++i) {
|
|
170
169
|
items.push(formatValue(array[i], seenValues));
|
|
@@ -1124,7 +1123,7 @@ function astFromEnumValue(value, schema, pathToDirectivesInExtensions) {
|
|
|
1124
1123
|
value: value.name,
|
|
1125
1124
|
},
|
|
1126
1125
|
// ConstXNode has been introduced in v16 but it is not compatible with XNode so we do `as any` for backwards compatibility
|
|
1127
|
-
directives:
|
|
1126
|
+
directives: getDeprecatableDirectiveNodes(value, schema, pathToDirectivesInExtensions),
|
|
1128
1127
|
};
|
|
1129
1128
|
}
|
|
1130
1129
|
function makeDeprecatedDirective(deprecationReason) {
|
|
@@ -2369,10 +2368,24 @@ function transformInputValue(type, value, inputLeafValueTransformer = null, inpu
|
|
|
2369
2368
|
// unreachable, no other possible return value
|
|
2370
2369
|
}
|
|
2371
2370
|
function serializeInputValue(type, value) {
|
|
2372
|
-
return transformInputValue(type, value, (t, v) =>
|
|
2371
|
+
return transformInputValue(type, value, (t, v) => {
|
|
2372
|
+
try {
|
|
2373
|
+
return t.serialize(v);
|
|
2374
|
+
}
|
|
2375
|
+
catch (_a) {
|
|
2376
|
+
return v;
|
|
2377
|
+
}
|
|
2378
|
+
});
|
|
2373
2379
|
}
|
|
2374
2380
|
function parseInputValue(type, value) {
|
|
2375
|
-
return transformInputValue(type, value, (t, v) =>
|
|
2381
|
+
return transformInputValue(type, value, (t, v) => {
|
|
2382
|
+
try {
|
|
2383
|
+
return t.parseValue(v);
|
|
2384
|
+
}
|
|
2385
|
+
catch (_a) {
|
|
2386
|
+
return v;
|
|
2387
|
+
}
|
|
2388
|
+
});
|
|
2376
2389
|
}
|
|
2377
2390
|
function parseInputValueLiteral(type, value) {
|
|
2378
2391
|
return transformInputValue(type, value, (t, v) => t.parseLiteral(v, {}));
|
package/index.mjs
CHANGED
|
@@ -87,8 +87,7 @@ function isAggregateError(error) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// Taken from graphql-js
|
|
90
|
-
const
|
|
91
|
-
const MAX_RECURSIVE_DEPTH = 2;
|
|
90
|
+
const MAX_RECURSIVE_DEPTH = 3;
|
|
92
91
|
/**
|
|
93
92
|
* Used to print values in error messages.
|
|
94
93
|
*/
|
|
@@ -160,8 +159,8 @@ function formatArray(array, seenValues) {
|
|
|
160
159
|
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
161
160
|
return '[Array]';
|
|
162
161
|
}
|
|
163
|
-
const len =
|
|
164
|
-
const remaining = array.length
|
|
162
|
+
const len = array.length;
|
|
163
|
+
const remaining = array.length;
|
|
165
164
|
const items = [];
|
|
166
165
|
for (let i = 0; i < len; ++i) {
|
|
167
166
|
items.push(formatValue(array[i], seenValues));
|
|
@@ -1121,7 +1120,7 @@ function astFromEnumValue(value, schema, pathToDirectivesInExtensions) {
|
|
|
1121
1120
|
value: value.name,
|
|
1122
1121
|
},
|
|
1123
1122
|
// ConstXNode has been introduced in v16 but it is not compatible with XNode so we do `as any` for backwards compatibility
|
|
1124
|
-
directives:
|
|
1123
|
+
directives: getDeprecatableDirectiveNodes(value, schema, pathToDirectivesInExtensions),
|
|
1125
1124
|
};
|
|
1126
1125
|
}
|
|
1127
1126
|
function makeDeprecatedDirective(deprecationReason) {
|
|
@@ -2367,10 +2366,24 @@ function transformInputValue(type, value, inputLeafValueTransformer = null, inpu
|
|
|
2367
2366
|
// unreachable, no other possible return value
|
|
2368
2367
|
}
|
|
2369
2368
|
function serializeInputValue(type, value) {
|
|
2370
|
-
return transformInputValue(type, value, (t, v) =>
|
|
2369
|
+
return transformInputValue(type, value, (t, v) => {
|
|
2370
|
+
try {
|
|
2371
|
+
return t.serialize(v);
|
|
2372
|
+
}
|
|
2373
|
+
catch (_a) {
|
|
2374
|
+
return v;
|
|
2375
|
+
}
|
|
2376
|
+
});
|
|
2371
2377
|
}
|
|
2372
2378
|
function parseInputValue(type, value) {
|
|
2373
|
-
return transformInputValue(type, value, (t, v) =>
|
|
2379
|
+
return transformInputValue(type, value, (t, v) => {
|
|
2380
|
+
try {
|
|
2381
|
+
return t.parseValue(v);
|
|
2382
|
+
}
|
|
2383
|
+
catch (_a) {
|
|
2384
|
+
return v;
|
|
2385
|
+
}
|
|
2386
|
+
});
|
|
2374
2387
|
}
|
|
2375
2388
|
function parseInputValueLiteral(type, value) {
|
|
2376
2389
|
return transformInputValue(type, value, (t, v) => t.parseLiteral(v, {}));
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ export declare function printSchemaWithDirectives(schema: GraphQLSchema, options
|
|
|
5
5
|
export declare function astFromSchema(schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): SchemaDefinitionNode | SchemaExtensionNode | null;
|
|
6
6
|
export declare function astFromDirective(directive: GraphQLDirective, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): DirectiveDefinitionNode;
|
|
7
7
|
export declare function getDirectiveNodes(entity: GraphQLSchema | GraphQLNamedType | GraphQLEnumValue, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): Array<DirectiveNode>;
|
|
8
|
-
export declare function getDeprecatableDirectiveNodes(entity: GraphQLArgument | GraphQLField<any, any> | GraphQLInputField, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): Array<DirectiveNode>;
|
|
8
|
+
export declare function getDeprecatableDirectiveNodes(entity: GraphQLArgument | GraphQLField<any, any> | GraphQLInputField | GraphQLEnumValue, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): Array<DirectiveNode>;
|
|
9
9
|
export declare function astFromArg(arg: GraphQLArgument, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): InputValueDefinitionNode;
|
|
10
10
|
export declare function astFromObjectType(type: GraphQLObjectType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): ObjectTypeDefinitionNode;
|
|
11
11
|
export declare function astFromInterfaceType(type: GraphQLInterfaceType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): InterfaceTypeDefinitionNode;
|