@graphitation/supermassive 3.14.2 → 3.15.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/.eslintcache +1 -1
- package/CHANGELOG.md +17 -1
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +45 -1
- package/lib/executeWithoutSchema.js.map +2 -2
- package/lib/executeWithoutSchema.mjs +45 -1
- package/lib/executeWithoutSchema.mjs.map +2 -2
- package/package.json +1 -1
|
@@ -284,6 +284,9 @@ function executeFieldsSerially(exeContext, parentTypeName, sourceValue, path, gr
|
|
|
284
284
|
}
|
|
285
285
|
if (isPromise(result)) {
|
|
286
286
|
return result.then((resolvedResult) => {
|
|
287
|
+
if (resolvedResult === void 0) {
|
|
288
|
+
return results;
|
|
289
|
+
}
|
|
287
290
|
results[responseName] = resolvedResult;
|
|
288
291
|
return results;
|
|
289
292
|
});
|
|
@@ -353,6 +356,13 @@ function executeField(exeContext, parentTypeName, source, fieldGroup, path, incr
|
|
|
353
356
|
fieldName
|
|
354
357
|
});
|
|
355
358
|
if (!loading) {
|
|
359
|
+
handleMissingSchemaError(
|
|
360
|
+
exeContext,
|
|
361
|
+
void 0,
|
|
362
|
+
fieldGroup,
|
|
363
|
+
path,
|
|
364
|
+
incrementalDataRecord
|
|
365
|
+
);
|
|
356
366
|
return void 0;
|
|
357
367
|
}
|
|
358
368
|
return loading.then(() => {
|
|
@@ -372,6 +382,13 @@ function executeField(exeContext, parentTypeName, source, fieldGroup, path, incr
|
|
|
372
382
|
incrementalDataRecord
|
|
373
383
|
);
|
|
374
384
|
}
|
|
385
|
+
handleMissingSchemaError(
|
|
386
|
+
exeContext,
|
|
387
|
+
void 0,
|
|
388
|
+
fieldGroup,
|
|
389
|
+
path,
|
|
390
|
+
incrementalDataRecord
|
|
391
|
+
);
|
|
375
392
|
return void 0;
|
|
376
393
|
});
|
|
377
394
|
}
|
|
@@ -608,12 +625,30 @@ function buildResolveInfo(exeContext, fieldName, fieldGroup, parentTypeName, ret
|
|
|
608
625
|
function handleFieldError(rawError, exeContext, returnTypeRef, fieldGroup, path, incrementalDataRecord) {
|
|
609
626
|
var _a;
|
|
610
627
|
const error = locatedError(rawError, fieldGroup, pathToArray(path));
|
|
611
|
-
if (isNonNullType(returnTypeRef)) {
|
|
628
|
+
if (returnTypeRef && isNonNullType(returnTypeRef)) {
|
|
612
629
|
throw error;
|
|
613
630
|
}
|
|
614
631
|
const errors = (_a = incrementalDataRecord == null ? void 0 : incrementalDataRecord.errors) != null ? _a : exeContext.errors;
|
|
615
632
|
errors.push(error);
|
|
616
633
|
}
|
|
634
|
+
function handleMissingSchemaError(exeContext, returnTypeRef, fieldGroup, path, incrementalDataRecord) {
|
|
635
|
+
const parentTypeName = path.typename;
|
|
636
|
+
const isRootField = parentTypeName === "Mutation" || parentTypeName === "Query";
|
|
637
|
+
if (!isRootField) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
const fieldName = path.key;
|
|
641
|
+
const message = !returnTypeRef ? `Type definition for ${parentTypeName}.${fieldName} is missing` : `Resolver for ${parentTypeName}.${fieldName} is missing`;
|
|
642
|
+
const error = new Error(message);
|
|
643
|
+
handleFieldError(
|
|
644
|
+
error,
|
|
645
|
+
exeContext,
|
|
646
|
+
returnTypeRef,
|
|
647
|
+
fieldGroup,
|
|
648
|
+
path,
|
|
649
|
+
incrementalDataRecord
|
|
650
|
+
);
|
|
651
|
+
}
|
|
617
652
|
function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fieldGroup, path, source, incrementalDataRecord) {
|
|
618
653
|
var _a;
|
|
619
654
|
const fieldName = fieldGroup[0].name.value;
|
|
@@ -632,6 +667,15 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
632
667
|
path
|
|
633
668
|
);
|
|
634
669
|
const isDefaultResolverUsed = resolveFn === exeContext.fieldResolver || fieldName === "__typename";
|
|
670
|
+
if (resolveFn === exeContext.fieldResolver && typeof source === "undefined") {
|
|
671
|
+
handleMissingSchemaError(
|
|
672
|
+
exeContext,
|
|
673
|
+
returnTypeRef,
|
|
674
|
+
fieldGroup,
|
|
675
|
+
path,
|
|
676
|
+
incrementalDataRecord
|
|
677
|
+
);
|
|
678
|
+
}
|
|
635
679
|
const hooks = exeContext.fieldExecutionHooks;
|
|
636
680
|
let hookContext = void 0;
|
|
637
681
|
try {
|