MCPcopy Create free account
hub / github.com/openai/plugins / executeField

Function executeField

plugins/shopify/skills/shopify-admin/scripts/validate.mjs:11570–11627  ·  view source on GitHub ↗
(exeContext, parentType, source, fieldNodes, path3)

Source from the content-addressed store, hash-verified

11568 return (0, _promiseForObject.promiseForObject)(results);
11569 }
11570 function executeField(exeContext, parentType, source, fieldNodes, path3) {
11571 var _fieldDef$resolve;
11572 const fieldDef = getFieldDef(exeContext.schema, parentType, fieldNodes[0]);
11573 if (!fieldDef) {
11574 return;
11575 }
11576 const returnType = fieldDef.type;
11577 const resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver;
11578 const info = buildResolveInfo(
11579 exeContext,
11580 fieldDef,
11581 fieldNodes,
11582 parentType,
11583 path3
11584 );
11585 try {
11586 const args = (0, _values.getArgumentValues)(
11587 fieldDef,
11588 fieldNodes[0],
11589 exeContext.variableValues
11590 );
11591 const contextValue = exeContext.contextValue;
11592 const result = resolveFn(source, args, contextValue, info);
11593 let completed;
11594 if ((0, _isPromise.isPromise)(result)) {
11595 completed = result.then(
11596 (resolved) => completeValue(exeContext, returnType, fieldNodes, info, path3, resolved)
11597 );
11598 } else {
11599 completed = completeValue(
11600 exeContext,
11601 returnType,
11602 fieldNodes,
11603 info,
11604 path3,
11605 result
11606 );
11607 }
11608 if ((0, _isPromise.isPromise)(completed)) {
11609 return completed.then(void 0, (rawError) => {
11610 const error = (0, _locatedError.locatedError)(
11611 rawError,
11612 fieldNodes,
11613 (0, _Path.pathToArray)(path3)
11614 );
11615 return handleFieldError(error, returnType, path3, exeContext);
11616 });
11617 }
11618 return completed;
11619 } catch (rawError) {
11620 const error = (0, _locatedError.locatedError)(
11621 rawError,
11622 fieldNodes,
11623 (0, _Path.pathToArray)(path3)
11624 );
11625 return handleFieldError(error, returnType, path3, exeContext);
11626 }
11627 }

Callers 2

executeFieldsSeriallyFunction · 0.70
executeFieldsFunction · 0.70

Calls 4

getFieldDefFunction · 0.70
buildResolveInfoFunction · 0.70
completeValueFunction · 0.70
handleFieldErrorFunction · 0.70

Tested by

no test coverage detected