@graphitation/supermassive 3.15.0 → 3.15.2
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 +18 -2
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +83 -15
- package/lib/executeWithoutSchema.js.map +2 -2
- package/lib/executeWithoutSchema.mjs +83 -15
- package/lib/executeWithoutSchema.mjs.map +2 -2
- package/package.json +1 -1
|
@@ -356,7 +356,13 @@ function executeField(exeContext, parentTypeName, source, fieldGroup, path, incr
|
|
|
356
356
|
fieldName
|
|
357
357
|
});
|
|
358
358
|
if (!loading) {
|
|
359
|
-
|
|
359
|
+
handleMissingSchemaError(
|
|
360
|
+
exeContext,
|
|
361
|
+
void 0,
|
|
362
|
+
fieldGroup,
|
|
363
|
+
path,
|
|
364
|
+
incrementalDataRecord
|
|
365
|
+
);
|
|
360
366
|
return void 0;
|
|
361
367
|
}
|
|
362
368
|
return loading.then(() => {
|
|
@@ -376,17 +382,16 @@ function executeField(exeContext, parentTypeName, source, fieldGroup, path, incr
|
|
|
376
382
|
incrementalDataRecord
|
|
377
383
|
);
|
|
378
384
|
}
|
|
379
|
-
|
|
385
|
+
handleMissingSchemaError(
|
|
386
|
+
exeContext,
|
|
387
|
+
void 0,
|
|
388
|
+
fieldGroup,
|
|
389
|
+
path,
|
|
390
|
+
incrementalDataRecord
|
|
391
|
+
);
|
|
380
392
|
return void 0;
|
|
381
393
|
});
|
|
382
394
|
}
|
|
383
|
-
function throwIfRootField(parentTypeName, fieldName, fieldGroup, validationTarget) {
|
|
384
|
-
const isRootField = parentTypeName === "Mutation" || parentTypeName === "Query";
|
|
385
|
-
if (isRootField) {
|
|
386
|
-
const message = validationTarget === "typeDefinition" ? `Type definition for ${parentTypeName}.${fieldName} is missing` : validationTarget === "resolver" ? `Resolver for ${parentTypeName}.${fieldName} is missing` : "Unexpected validation target";
|
|
387
|
-
throw locatedError(new Error(message), fieldGroup);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
395
|
function requestSchemaFragment(exeContext, request) {
|
|
391
396
|
if (!exeContext.schemaFragmentLoader) {
|
|
392
397
|
return;
|
|
@@ -429,8 +434,7 @@ function afterFieldSubscribeHandle(resolved, isDefaultResolverUsed, exeContext,
|
|
|
429
434
|
}
|
|
430
435
|
}
|
|
431
436
|
function executeSubscriptionImpl(exeContext) {
|
|
432
|
-
|
|
433
|
-
const { operation, rootValue, schemaFragment } = exeContext;
|
|
437
|
+
const { operation, schemaFragment } = exeContext;
|
|
434
438
|
const rootTypeName = getOperationRootTypeName(operation);
|
|
435
439
|
const { groupedFieldSet } = collectFields(exeContext, rootTypeName);
|
|
436
440
|
const firstRootField = groupedFieldSet.entries().next().value;
|
|
@@ -444,12 +448,52 @@ function executeSubscriptionImpl(exeContext) {
|
|
|
444
448
|
rootTypeName,
|
|
445
449
|
fieldName
|
|
446
450
|
);
|
|
447
|
-
if (
|
|
451
|
+
if (fieldDef) {
|
|
452
|
+
return runSubscriptionResolver(
|
|
453
|
+
exeContext,
|
|
454
|
+
fieldDef,
|
|
455
|
+
fieldName,
|
|
456
|
+
fieldGroup,
|
|
457
|
+
responseName,
|
|
458
|
+
rootTypeName
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
const loading = requestSchemaFragment(exeContext, {
|
|
462
|
+
kind: "ReturnType",
|
|
463
|
+
parentTypeName: rootTypeName,
|
|
464
|
+
fieldName
|
|
465
|
+
});
|
|
466
|
+
if (!loading) {
|
|
448
467
|
throw locatedError(
|
|
449
|
-
`
|
|
468
|
+
`Type definition for ${rootTypeName}.${fieldName} is missing`,
|
|
450
469
|
fieldGroup
|
|
451
470
|
);
|
|
452
471
|
}
|
|
472
|
+
return loading.then(() => {
|
|
473
|
+
const fieldDef2 = Definitions.getField(
|
|
474
|
+
schemaFragment.definitions,
|
|
475
|
+
rootTypeName,
|
|
476
|
+
fieldName
|
|
477
|
+
);
|
|
478
|
+
if (fieldDef2 === void 0) {
|
|
479
|
+
throw locatedError(
|
|
480
|
+
`Type definition for ${rootTypeName}.${fieldName} is missing`,
|
|
481
|
+
fieldGroup
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
return runSubscriptionResolver(
|
|
485
|
+
exeContext,
|
|
486
|
+
fieldDef2,
|
|
487
|
+
fieldName,
|
|
488
|
+
fieldGroup,
|
|
489
|
+
responseName,
|
|
490
|
+
rootTypeName
|
|
491
|
+
);
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
function runSubscriptionResolver(exeContext, fieldDef, fieldName, fieldGroup, responseName, rootTypeName) {
|
|
495
|
+
var _a;
|
|
496
|
+
const { rootValue, schemaFragment } = exeContext;
|
|
453
497
|
const returnTypeRef = Definitions.getFieldTypeReference(fieldDef);
|
|
454
498
|
const resolveFn = (_a = Resolvers.getSubscriptionFieldResolver(
|
|
455
499
|
schemaFragment,
|
|
@@ -620,12 +664,30 @@ function buildResolveInfo(exeContext, fieldName, fieldGroup, parentTypeName, ret
|
|
|
620
664
|
function handleFieldError(rawError, exeContext, returnTypeRef, fieldGroup, path, incrementalDataRecord) {
|
|
621
665
|
var _a;
|
|
622
666
|
const error = locatedError(rawError, fieldGroup, pathToArray(path));
|
|
623
|
-
if (isNonNullType(returnTypeRef)) {
|
|
667
|
+
if (returnTypeRef && isNonNullType(returnTypeRef)) {
|
|
624
668
|
throw error;
|
|
625
669
|
}
|
|
626
670
|
const errors = (_a = incrementalDataRecord == null ? void 0 : incrementalDataRecord.errors) != null ? _a : exeContext.errors;
|
|
627
671
|
errors.push(error);
|
|
628
672
|
}
|
|
673
|
+
function handleMissingSchemaError(exeContext, returnTypeRef, fieldGroup, path, incrementalDataRecord) {
|
|
674
|
+
const parentTypeName = path.typename;
|
|
675
|
+
const isRootField = parentTypeName === "Mutation" || parentTypeName === "Query";
|
|
676
|
+
if (!isRootField) {
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
const fieldName = path.key;
|
|
680
|
+
const message = !returnTypeRef ? `Type definition for ${parentTypeName}.${fieldName} is missing` : `Resolver for ${parentTypeName}.${fieldName} is missing`;
|
|
681
|
+
const error = new Error(message);
|
|
682
|
+
handleFieldError(
|
|
683
|
+
error,
|
|
684
|
+
exeContext,
|
|
685
|
+
returnTypeRef,
|
|
686
|
+
fieldGroup,
|
|
687
|
+
path,
|
|
688
|
+
incrementalDataRecord
|
|
689
|
+
);
|
|
690
|
+
}
|
|
629
691
|
function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fieldGroup, path, source, incrementalDataRecord) {
|
|
630
692
|
var _a;
|
|
631
693
|
const fieldName = fieldGroup[0].name.value;
|
|
@@ -645,7 +707,13 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
645
707
|
);
|
|
646
708
|
const isDefaultResolverUsed = resolveFn === exeContext.fieldResolver || fieldName === "__typename";
|
|
647
709
|
if (resolveFn === exeContext.fieldResolver && typeof source === "undefined") {
|
|
648
|
-
|
|
710
|
+
handleMissingSchemaError(
|
|
711
|
+
exeContext,
|
|
712
|
+
returnTypeRef,
|
|
713
|
+
fieldGroup,
|
|
714
|
+
path,
|
|
715
|
+
incrementalDataRecord
|
|
716
|
+
);
|
|
649
717
|
}
|
|
650
718
|
const hooks = exeContext.fieldExecutionHooks;
|
|
651
719
|
let hookContext = void 0;
|