UNPKG

@graphql-tools/executor

Version:

Fork of GraphQL.js' execute function

27 lines (26 loc) 787 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BoxedPromiseOrValue = void 0; const utils_1 = require("@graphql-tools/utils"); /** * A BoxedPromiseOrValue is a container for a value or promise where the value * will be updated when the promise resolves. * * A BoxedPromiseOrValue may only be used with promises whose possible * rejection has already been handled, otherwise this will lead to unhandled * promise rejections. * * @internal * */ class BoxedPromiseOrValue { value; constructor(value) { this.value = value; if ((0, utils_1.isPromise)(value)) { value.then(resolved => { this.value = resolved; }); } } } exports.BoxedPromiseOrValue = BoxedPromiseOrValue;