New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-tools/executor

Package Overview
Dependencies
Maintainers
3
Versions
431
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/executor - npm Package Compare versions

Comparing version 2.0.0-alpha-20240808024706-13ce91e5925ef720175c2a5f55583f7b34209017 to 2.0.0-alpha-20240809205104-4b5ae769b3963cc742e682b4049d634fc014d5b4

cjs/execution/DeferredFragments.js

46

cjs/execution/collectFields.js

@@ -19,3 +19,2 @@ "use strict";

const groupedFieldSet = new AccumulatorMap_js_1.AccumulatorMap();
const newDeferUsages = [];
const context = {

@@ -28,5 +27,9 @@ schema,

visitedFragmentNames: new Set(),
encounteredDefer: false,
};
collectFieldsImpl(context, selectionSet, groupedFieldSet, newDeferUsages);
return { groupedFieldSet, newDeferUsages };
collectFieldsImpl(context, selectionSet, groupedFieldSet);
if (context.encounteredDefer) {
groupedFieldSet.encounteredDefer = true;
}
return groupedFieldSet;
}

@@ -44,3 +47,3 @@ exports.collectFields = collectFields;

*/
function collectSubfields(schema, fragments, variableValues, errorOnSubscriptionWithIncrementalDelivery, returnType, fieldGroup) {
function collectSubfields(schema, fragments, variableValues, errorOnSubscriptionWithIncrementalDelivery, returnType, fieldGroup, path) {
const context = {

@@ -53,18 +56,18 @@ schema,

visitedFragmentNames: new Set(),
encounteredDefer: false,
};
const subGroupedFieldSet = new AccumulatorMap_js_1.AccumulatorMap();
const newDeferUsages = [];
for (const fieldDetail of fieldGroup) {
const node = fieldDetail.node;
const { node, deferUsage } = fieldDetail;
if (node.selectionSet) {
collectFieldsImpl(context, node.selectionSet, subGroupedFieldSet, newDeferUsages, fieldDetail.deferUsage);
collectFieldsImpl(context, node.selectionSet, subGroupedFieldSet, path, deferUsage);
}
}
return {
groupedFieldSet: subGroupedFieldSet,
newDeferUsages,
};
if (context.encounteredDefer) {
subGroupedFieldSet.encounteredDefer = true;
}
return subGroupedFieldSet;
}
exports.collectSubfields = collectSubfields;
function collectFieldsImpl(context, selectionSet, groupedFieldSet, newDeferUsages, deferUsage) {
function collectFieldsImpl(context, selectionSet, groupedFieldSet, path, deferUsage) {
const { schema, fragments, variableValues, runtimeType, errorOnSubscriptionWithIncrementalDelivery, visitedFragmentNames, } = context;

@@ -88,9 +91,9 @@ for (const selection of selectionSet.selections) {

}
const newDeferUsage = getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, selection, deferUsage);
const newDeferUsage = getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, selection, path, deferUsage);
if (!newDeferUsage) {
collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, newDeferUsages, deferUsage);
collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, path, deferUsage);
}
else {
newDeferUsages.push(newDeferUsage);
collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, newDeferUsages, newDeferUsage);
context.encounteredDefer = true;
collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, path, newDeferUsage);
}

@@ -101,3 +104,3 @@ break;

const fragName = selection.name.value;
const newDeferUsage = getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, selection, deferUsage);
const newDeferUsage = getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, selection, path, deferUsage);
if (!newDeferUsage &&

@@ -113,7 +116,7 @@ (visitedFragmentNames.has(fragName) || !shouldIncludeNode(variableValues, selection))) {

visitedFragmentNames.add(fragName);
collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, newDeferUsages, deferUsage);
collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, path, deferUsage);
}
else {
newDeferUsages.push(newDeferUsage);
collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, newDeferUsages, newDeferUsage);
context.encounteredDefer = true;
collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, path, newDeferUsage);
}

@@ -130,3 +133,3 @@ break;

*/
function getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, node, parentDeferUsage) {
function getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, node, path, parentDeferUsage) {
const defer = (0, graphql_1.getDirectiveValues)(utils_1.GraphQLDeferDirective, node, variableValues);

@@ -143,2 +146,3 @@ if (!defer) {

parentDeferUsage,
depth: (0, utils_1.pathToArray)(path).length,
};

@@ -145,0 +149,0 @@ }

@@ -6,2 +6,3 @@ "use strict";

const BoxedPromiseOrValue_js_1 = require("./BoxedPromiseOrValue.js");
const DeferredFragments_js_1 = require("./DeferredFragments.js");
const invariant_js_1 = require("./invariant.js");

@@ -14,10 +15,12 @@ const types_js_1 = require("./types.js");

_rootNodes;
_deferredFragmentFactory;
_completedQueue;
_nextQueue;
constructor() {
constructor(deferredFragmentFactory) {
this._rootNodes = new Set();
this._deferredFragmentFactory = deferredFragmentFactory;
this._completedQueue = [];
this._nextQueue = [];
}
getNewPending(incrementalDataRecords) {
getNewRootNodes(incrementalDataRecords) {
const initialResultChildren = new Set();

@@ -29,4 +32,7 @@ this._addIncrementalDataRecords(incrementalDataRecords, undefined, initialResultChildren);

const { pendingExecutionGroup, incrementalDataRecords } = successfulExecutionGroup;
const deferredFragmentRecords = pendingExecutionGroup.deferredFragmentRecords;
for (const deferredFragmentRecord of deferredFragmentRecords) {
const { deferUsages, path } = pendingExecutionGroup;
const deferredFragmentRecords = [];
for (const deferUsage of deferUsages) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
deferredFragmentRecords.push(deferredFragmentRecord);
const { pendingExecutionGroups, successfulExecutionGroups } = deferredFragmentRecord;

@@ -40,2 +46,17 @@ pendingExecutionGroups.delete(successfulExecutionGroup.pendingExecutionGroup);

}
getDeepestDeferredFragmentAtRoot(initialDeferUsage, deferUsages, path) {
let bestDeferUsage = initialDeferUsage;
let maxDepth = initialDeferUsage.depth;
for (const deferUsage of deferUsages) {
if (deferUsage === initialDeferUsage) {
continue;
}
const depth = deferUsage.depth;
if (depth > maxDepth) {
maxDepth = depth;
bestDeferUsage = deferUsage;
}
}
return this._deferredFragmentFactory.get(bestDeferUsage, path);
}
*currentCompletedBatch() {

@@ -65,3 +86,4 @@ let completed;

}
completeDeferredFragment(deferredFragmentRecord) {
completeDeferredFragment(deferUsage, path) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
if (!this._rootNodes.has(deferredFragmentRecord) ||

@@ -74,16 +96,18 @@ deferredFragmentRecord.pendingExecutionGroups.size > 0) {

for (const successfulExecutionGroup of successfulExecutionGroups) {
for (const otherDeferredFragmentRecord of successfulExecutionGroup.pendingExecutionGroup
.deferredFragmentRecords) {
const { deferUsages, path: resultPath } = successfulExecutionGroup.pendingExecutionGroup;
for (const otherDeferUsage of deferUsages) {
const otherDeferredFragmentRecord = this._deferredFragmentFactory.get(otherDeferUsage, resultPath);
otherDeferredFragmentRecord.successfulExecutionGroups.delete(successfulExecutionGroup);
}
}
const newPending = this._promoteNonEmptyToRoot(deferredFragmentRecord.children);
return { newPending, successfulExecutionGroups };
const newRootNodes = this._promoteNonEmptyToRoot(deferredFragmentRecord.children);
return { deferredFragmentRecord, newRootNodes, successfulExecutionGroups };
}
removeDeferredFragment(deferredFragmentRecord) {
removeDeferredFragment(deferUsage, path) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
if (!this._rootNodes.has(deferredFragmentRecord)) {
return false;
return;
}
this._rootNodes.delete(deferredFragmentRecord);
return true;
return deferredFragmentRecord;
}

@@ -96,7 +120,9 @@ removeStream(streamRecord) {

if ((0, types_js_1.isPendingExecutionGroup)(incrementalDataRecord)) {
for (const deferredFragmentRecord of incrementalDataRecord.deferredFragmentRecords) {
const { deferUsages, path } = incrementalDataRecord;
for (const deferUsage of deferUsages) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
this._addDeferredFragment(deferredFragmentRecord, initialResultChildren);
deferredFragmentRecord.pendingExecutionGroups.add(incrementalDataRecord);
}
if (this._hasPendingFragment(incrementalDataRecord)) {
if (this._completesRootNode(incrementalDataRecord)) {
this._onExecutionGroup(incrementalDataRecord);

@@ -117,53 +143,61 @@ }

}
_promoteNonEmptyToRoot(maybeEmptyNewPending) {
const newPending = [];
for (const deliveryGroup of maybeEmptyNewPending) {
if ((0, types_js_1.isDeferredFragmentRecord)(deliveryGroup)) {
if (deliveryGroup.pendingExecutionGroups.size > 0) {
deliveryGroup.setAsPending();
for (const pendingExecutionGroup of deliveryGroup.pendingExecutionGroups) {
if (!this._hasPendingFragment(pendingExecutionGroup)) {
_promoteNonEmptyToRoot(maybeEmptyNewRootNodes) {
const newRootNodes = [];
for (const node of maybeEmptyNewRootNodes) {
if ((0, DeferredFragments_js_1.isDeferredFragmentRecord)(node)) {
if (node.pendingExecutionGroups.size > 0) {
node.setAsPending();
for (const pendingExecutionGroup of node.pendingExecutionGroups) {
if (!this._completesRootNode(pendingExecutionGroup)) {
this._onExecutionGroup(pendingExecutionGroup);
}
}
this._rootNodes.add(deliveryGroup);
newPending.push(deliveryGroup);
this._rootNodes.add(node);
newRootNodes.push(node);
continue;
}
for (const child of deliveryGroup.children) {
maybeEmptyNewPending.add(child);
for (const child of node.children) {
maybeEmptyNewRootNodes.add(child);
}
}
else {
this._rootNodes.add(deliveryGroup);
newPending.push(deliveryGroup);
this._onStreamItems(deliveryGroup);
this._rootNodes.add(node);
newRootNodes.push(node);
this._onStreamItems(node);
}
}
return newPending;
return newRootNodes;
}
_hasPendingFragment(pendingExecutionGroup) {
return pendingExecutionGroup.deferredFragmentRecords.some(deferredFragmentRecord => this._rootNodes.has(deferredFragmentRecord));
_completesRootNode(pendingExecutionGroup) {
const { deferUsages, path } = pendingExecutionGroup;
for (const deferUsage of deferUsages) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
if (this._rootNodes.has(deferredFragmentRecord)) {
return true;
}
}
return false;
}
_addDeferredFragment(deferredFragmentRecord, deliveryGroups) {
_addDeferredFragment(deferredFragmentRecord, initialResultChildren) {
if (this._rootNodes.has(deferredFragmentRecord)) {
return;
}
const parent = deferredFragmentRecord.parent;
if (parent === undefined) {
(0, invariant_js_1.invariant)(deliveryGroups !== undefined);
deliveryGroups.add(deferredFragmentRecord);
const parentDeferUsage = deferredFragmentRecord.parentDeferUsage;
if (parentDeferUsage === undefined) {
(0, invariant_js_1.invariant)(initialResultChildren !== undefined);
initialResultChildren.add(deferredFragmentRecord);
return;
}
const parent = this._deferredFragmentFactory.get(parentDeferUsage, deferredFragmentRecord.path);
parent.children.add(deferredFragmentRecord);
this._addDeferredFragment(parent, deliveryGroups);
this._addDeferredFragment(parent, initialResultChildren);
}
_onExecutionGroup(pendingExecutionGroup) {
const result = pendingExecutionGroup.result
const value = pendingExecutionGroup.result
.value;
if ((0, utils_1.isPromise)(result)) {
result.then(resolved => this._enqueue(resolved));
if ((0, utils_1.isPromise)(value)) {
value.then(resolved => this._enqueue(resolved));
}
else {
this._enqueue(result);
this._enqueue(value);
}

@@ -228,11 +262,3 @@ }

yield first;
let completed;
while ((completed = this._completedQueue.shift()) !== undefined) {
yield completed;
}
if (this._rootNodes.size === 0) {
for (const resolve of this._nextQueue) {
resolve(undefined);
}
}
yield* this.currentCompletedBatch();
}

@@ -239,0 +265,0 @@ _enqueue(completed) {

@@ -5,2 +5,3 @@ "use strict";

const utils_1 = require("@graphql-tools/utils");
const DeferredFragments_js_1 = require("./DeferredFragments.js");
const IncrementalGraph_js_1 = require("./IncrementalGraph.js");

@@ -40,11 +41,15 @@ const invariant_js_1 = require("./invariant.js");

this._nextId = 0;
this._incrementalGraph = new IncrementalGraph_js_1.IncrementalGraph();
let deferredFragmentFactory = context.deferredFragmentFactory;
if (deferredFragmentFactory === undefined) {
context.deferredFragmentFactory = deferredFragmentFactory = new DeferredFragments_js_1.DeferredFragmentFactory();
}
this._incrementalGraph = new IncrementalGraph_js_1.IncrementalGraph(deferredFragmentFactory);
}
buildResponse(data, errors, incrementalDataRecords) {
const newPending = this._incrementalGraph.getNewPending(incrementalDataRecords);
const newRootNodes = this._incrementalGraph.getNewRootNodes(incrementalDataRecords);
const initialResult = this._context
.useIncrementalNotifications
? errors === undefined
? { data, pending: this._pendingSourcesToResults(newPending), hasNext: true }
: { errors, data, pending: this._pendingSourcesToResults(newPending), hasNext: true }
? { data, pending: this._toPendingResults(newRootNodes), hasNext: true }
: { errors, data, pending: this._toPendingResults(newRootNodes), hasNext: true }
: errors === undefined

@@ -58,13 +63,13 @@ ? { data, hasNext: true }

}
_pendingSourcesToResults(newPending) {
_toPendingResults(newRootNodes) {
const pendingResults = [];
for (const pendingSource of newPending) {
for (const node of newRootNodes) {
const id = String(this._getNextId());
pendingSource.id = id;
node.id = id;
const pendingResult = {
id,
path: (0, utils_1.pathToArray)(pendingSource.path),
path: (0, utils_1.pathToArray)(node.path),
};
if (pendingSource.label !== undefined) {
pendingResult.label = pendingSource.label;
if (node.label !== undefined) {
pendingResult.label = node.label;
}

@@ -165,6 +170,7 @@ pendingResults.push(pendingResult);

_handleCompletedExecutionGroup(completedExecutionGroup, context) {
const { deferUsages, path } = completedExecutionGroup.pendingExecutionGroup;
if ((0, types_js_1.isFailedExecutionGroup)(completedExecutionGroup)) {
for (const deferredFragmentRecord of completedExecutionGroup.pendingExecutionGroup
.deferredFragmentRecords) {
if (!this._incrementalGraph.removeDeferredFragment(deferredFragmentRecord)) {
for (const deferUsage of deferUsages) {
const deferredFragmentRecord = this._incrementalGraph.removeDeferredFragment(deferUsage, path);
if (deferredFragmentRecord === undefined) {
// This can occur if multiple deferred grouped field sets error for a fragment.

@@ -197,5 +203,4 @@ continue;

this._incrementalGraph.addCompletedSuccessfulExecutionGroup(completedExecutionGroup);
for (const deferredFragmentRecord of completedExecutionGroup.pendingExecutionGroup
.deferredFragmentRecords) {
const completion = this._incrementalGraph.completeDeferredFragment(deferredFragmentRecord);
for (const deferUsage of deferUsages) {
const completion = this._incrementalGraph.completeDeferredFragment(deferUsage, path);
if (completion === undefined) {

@@ -205,9 +210,10 @@ continue;

const incremental = context.incremental;
const successfulExecutionGroups = completion.successfulExecutionGroups;
const { deferredFragmentRecord, newRootNodes, successfulExecutionGroups } = completion;
if (this._context.useIncrementalNotifications) {
const id = deferredFragmentRecord.id;
(0, invariant_js_1.invariant)(id !== undefined);
context.pending.push(...this._pendingSourcesToResults(completion.newPending));
context.pending.push(...this._toPendingResults(newRootNodes));
for (const successfulExecutionGroup of successfulExecutionGroups) {
const { bestId, subPath } = this._getBestIdAndSubPath(id, deferredFragmentRecord, successfulExecutionGroup);
const { deferUsages: resultDeferUsages, path: resultPath } = successfulExecutionGroup.pendingExecutionGroup;
const bestDeferredFragmentRecord = this._incrementalGraph.getDeepestDeferredFragmentAtRoot(deferUsage, resultDeferUsages, resultPath);
const bestId = bestDeferredFragmentRecord.id;
(0, invariant_js_1.invariant)(bestId !== undefined);
const incrementalEntry = {

@@ -217,3 +223,4 @@ ...successfulExecutionGroup.result,

};
if (subPath !== undefined) {
const subPath = (0, utils_1.pathToArray)(resultPath).slice((0, utils_1.pathToArray)(bestDeferredFragmentRecord.path).length);
if (subPath.length > 0) {
incrementalEntry.subPath = subPath;

@@ -223,2 +230,4 @@ }

}
const id = deferredFragmentRecord.id;
(0, invariant_js_1.invariant)(id !== undefined);
context.completed.push({ id });

@@ -307,5 +316,5 @@ }

if (incrementalDataRecords !== undefined) {
const newPending = this._incrementalGraph.getNewPending(incrementalDataRecords);
const newPending = this._incrementalGraph.getNewRootNodes(incrementalDataRecords);
if (this._context.useIncrementalNotifications) {
context.pending.push(...this._pendingSourcesToResults(newPending));
context.pending.push(...this._toPendingResults(newPending));
}

@@ -315,29 +324,2 @@ }

}
_getBestIdAndSubPath(initialId, initialDeferredFragmentRecord, completedExecutionGroup) {
let maxLength = (0, utils_1.pathToArray)(initialDeferredFragmentRecord.path).length;
let bestId = initialId;
for (const deferredFragmentRecord of completedExecutionGroup.pendingExecutionGroup
.deferredFragmentRecords) {
if (deferredFragmentRecord === initialDeferredFragmentRecord) {
continue;
}
const id = deferredFragmentRecord.id;
// TODO: add test case for when an fragment has not been released, but might be processed for the shortest path.
/* c8 ignore next 3 */
if (id === undefined) {
continue;
}
const fragmentPath = (0, utils_1.pathToArray)(deferredFragmentRecord.path);
const length = fragmentPath.length;
if (length > maxLength) {
maxLength = length;
bestId = id;
}
}
const subPath = completedExecutionGroup.path.slice(maxLength);
return {
bestId,
subPath: subPath.length > 0 ? subPath : undefined,
};
}
async _returnAsyncIterators() {

@@ -344,0 +326,0 @@ await this._incrementalGraph.abort();

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCancellableStreamRecord = exports.isDeferredFragmentRecord = exports.DeferredFragmentRecord = exports.isFailedExecutionGroup = exports.isCompletedExecutionGroup = exports.isPendingExecutionGroup = void 0;
exports.isCancellableStreamRecord = exports.isFailedExecutionGroup = exports.isCompletedExecutionGroup = exports.isPendingExecutionGroup = void 0;
function isPendingExecutionGroup(incrementalDataRecord) {
return 'deferredFragmentRecords' in incrementalDataRecord;
return 'deferUsages' in incrementalDataRecord;
}

@@ -16,41 +16,5 @@ exports.isPendingExecutionGroup = isPendingExecutionGroup;

exports.isFailedExecutionGroup = isFailedExecutionGroup;
/** @internal */
class DeferredFragmentRecord {
path;
label;
id;
parent;
pendingExecutionGroups;
successfulExecutionGroups;
children;
pending;
fns;
constructor(path, label, parent) {
this.path = path;
this.label = label;
this.parent = parent;
this.pendingExecutionGroups = new Set();
this.successfulExecutionGroups = new Set();
this.children = new Set();
this.pending = false;
this.fns = [];
}
onPending(fn) {
this.fns.push(fn);
}
setAsPending() {
this.pending = true;
for (const fn of this.fns) {
fn();
}
}
function isCancellableStreamRecord(streamRecord) {
return 'earlyReturn' in streamRecord;
}
exports.DeferredFragmentRecord = DeferredFragmentRecord;
function isDeferredFragmentRecord(deliveryGroup) {
return deliveryGroup instanceof DeferredFragmentRecord;
}
exports.isDeferredFragmentRecord = isDeferredFragmentRecord;
function isCancellableStreamRecord(deliveryGroup) {
return 'earlyReturn' in deliveryGroup;
}
exports.isCancellableStreamRecord = isCancellableStreamRecord;
import { getDirectiveValues, GraphQLIncludeDirective, GraphQLSkipDirective, isAbstractType, Kind, typeFromAST, } from 'graphql';
import { GraphQLDeferDirective } from '@graphql-tools/utils';
import { GraphQLDeferDirective, pathToArray } from '@graphql-tools/utils';
import { AccumulatorMap } from './AccumulatorMap.js';

@@ -16,3 +16,2 @@ import { invariant } from './invariant.js';

const groupedFieldSet = new AccumulatorMap();
const newDeferUsages = [];
const context = {

@@ -25,5 +24,9 @@ schema,

visitedFragmentNames: new Set(),
encounteredDefer: false,
};
collectFieldsImpl(context, selectionSet, groupedFieldSet, newDeferUsages);
return { groupedFieldSet, newDeferUsages };
collectFieldsImpl(context, selectionSet, groupedFieldSet);
if (context.encounteredDefer) {
groupedFieldSet.encounteredDefer = true;
}
return groupedFieldSet;
}

@@ -40,3 +43,3 @@ /**

*/
export function collectSubfields(schema, fragments, variableValues, errorOnSubscriptionWithIncrementalDelivery, returnType, fieldGroup) {
export function collectSubfields(schema, fragments, variableValues, errorOnSubscriptionWithIncrementalDelivery, returnType, fieldGroup, path) {
const context = {

@@ -49,17 +52,17 @@ schema,

visitedFragmentNames: new Set(),
encounteredDefer: false,
};
const subGroupedFieldSet = new AccumulatorMap();
const newDeferUsages = [];
for (const fieldDetail of fieldGroup) {
const node = fieldDetail.node;
const { node, deferUsage } = fieldDetail;
if (node.selectionSet) {
collectFieldsImpl(context, node.selectionSet, subGroupedFieldSet, newDeferUsages, fieldDetail.deferUsage);
collectFieldsImpl(context, node.selectionSet, subGroupedFieldSet, path, deferUsage);
}
}
return {
groupedFieldSet: subGroupedFieldSet,
newDeferUsages,
};
if (context.encounteredDefer) {
subGroupedFieldSet.encounteredDefer = true;
}
return subGroupedFieldSet;
}
function collectFieldsImpl(context, selectionSet, groupedFieldSet, newDeferUsages, deferUsage) {
function collectFieldsImpl(context, selectionSet, groupedFieldSet, path, deferUsage) {
const { schema, fragments, variableValues, runtimeType, errorOnSubscriptionWithIncrementalDelivery, visitedFragmentNames, } = context;

@@ -83,9 +86,9 @@ for (const selection of selectionSet.selections) {

}
const newDeferUsage = getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, selection, deferUsage);
const newDeferUsage = getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, selection, path, deferUsage);
if (!newDeferUsage) {
collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, newDeferUsages, deferUsage);
collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, path, deferUsage);
}
else {
newDeferUsages.push(newDeferUsage);
collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, newDeferUsages, newDeferUsage);
context.encounteredDefer = true;
collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, path, newDeferUsage);
}

@@ -96,3 +99,3 @@ break;

const fragName = selection.name.value;
const newDeferUsage = getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, selection, deferUsage);
const newDeferUsage = getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, selection, path, deferUsage);
if (!newDeferUsage &&

@@ -108,7 +111,7 @@ (visitedFragmentNames.has(fragName) || !shouldIncludeNode(variableValues, selection))) {

visitedFragmentNames.add(fragName);
collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, newDeferUsages, deferUsage);
collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, path, deferUsage);
}
else {
newDeferUsages.push(newDeferUsage);
collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, newDeferUsages, newDeferUsage);
context.encounteredDefer = true;
collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, path, newDeferUsage);
}

@@ -125,3 +128,3 @@ break;

*/
function getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, node, parentDeferUsage) {
function getDeferUsage(errorOnSubscriptionWithIncrementalDelivery, variableValues, node, path, parentDeferUsage) {
const defer = getDirectiveValues(GraphQLDeferDirective, node, variableValues);

@@ -138,2 +141,3 @@ if (!defer) {

parentDeferUsage,
depth: pathToArray(path).length,
};

@@ -140,0 +144,0 @@ }

import { assertValidSchema, getDirectiveValues, GraphQLError, isAbstractType, isLeafType, isListType, isNonNullType, isObjectType, Kind, locatedError, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, versionInfo, } from 'graphql';
import { addPath, createGraphQLError, getArgumentValues, getDefinedRootType, GraphQLStreamDirective, inspect, isAsyncIterable, isIterableObject, isObjectLike, isPromise, mapAsyncIterator, memoize1, memoize3, pathToArray, promiseReduce, } from '@graphql-tools/utils';
import { addPath, createGraphQLError, getArgumentValues, getDefinedRootType, GraphQLStreamDirective, inspect, isAsyncIterable, isIterableObject, isObjectLike, isPromise, mapAsyncIterator, memoize1, memoize3of4, pathToArray, promiseReduce, } from '@graphql-tools/utils';
import { AccumulatorMap } from './AccumulatorMap.js';

@@ -8,2 +8,3 @@ import { BoxedPromiseOrValue } from './BoxedPromiseOrValue.js';

import { collectSubfields as _collectSubfields, collectFields } from './collectFields.js';
import { DeferredFragmentFactory } from './DeferredFragments.js';
import { flattenAsyncIterable } from './flattenAsyncIterable.js';

@@ -13,3 +14,2 @@ import { buildIncrementalResponse } from './IncrementalPublisher.js';

import { promiseForObject } from './promiseForObject.js';
import { DeferredFragmentRecord } from './types.js';
import { getVariableValues } from './values.js';

@@ -21,3 +21,3 @@ /**

*/
const collectSubfields = memoize3((exeContext, returnType, fieldGroup) => _collectSubfields(exeContext.schema, exeContext.fragments, exeContext.variableValues, exeContext.errorOnSubscriptionWithIncrementalDelivery, returnType, fieldGroup));
const collectSubfields = memoize3of4((exeContext, returnType, fieldGroup, path) => _collectSubfields(exeContext.schema, exeContext.fragments, exeContext.variableValues, exeContext.errorOnSubscriptionWithIncrementalDelivery, returnType, fieldGroup, path));
/**

@@ -214,2 +214,4 @@ * Implements the "Executing requests" section of the GraphQL specification,

errors: undefined,
encounteredDefer: false,
deferredFragmentFactory: undefined,
cancellableStreams: undefined,

@@ -224,2 +226,4 @@ incrementalDataRecords: undefined,

errors: undefined,
encounteredDefer: false,
deferredFragmentFactory: undefined,
cancellableStreams: undefined,

@@ -244,19 +248,15 @@ incrementalDataRecords: undefined,

}
const collectedFields = collectFields(schema, fragments, variableValues, rootType, operation.selectionSet, errorOnSubscriptionWithIncrementalDelivery);
let groupedFieldSet = collectedFields.groupedFieldSet;
const newDeferUsages = collectedFields.newDeferUsages;
const originalGroupedFieldSet = collectFields(schema, fragments, variableValues, rootType, operation.selectionSet, errorOnSubscriptionWithIncrementalDelivery);
let data;
if (newDeferUsages.length === 0) {
data = executeRootGroupedFieldSet(exeContext, operation.operation, rootType, rootValue, groupedFieldSet, undefined);
if (!originalGroupedFieldSet.encounteredDefer) {
data = executeRootGroupedFieldSet(exeContext, operation.operation, rootType, rootValue, originalGroupedFieldSet);
}
else {
const executionPlan = deferWithoutDuplication
? buildExecutionPlan(groupedFieldSet)
: buildBranchingExecutionPlan(groupedFieldSet);
groupedFieldSet = executionPlan.groupedFieldSet;
const newGroupedFieldSets = executionPlan.newGroupedFieldSets;
const newDeferMap = addNewDeferredFragments(newDeferUsages, new Map());
data = executeRootGroupedFieldSet(exeContext, operation.operation, rootType, rootValue, groupedFieldSet, newDeferMap);
exeContext.encounteredDefer = true;
const { groupedFieldSet, newGroupedFieldSets } = deferWithoutDuplication
? buildExecutionPlan(originalGroupedFieldSet)
: buildBranchingExecutionPlan(originalGroupedFieldSet);
data = executeRootGroupedFieldSet(exeContext, operation.operation, rootType, rootValue, groupedFieldSet);
if (newGroupedFieldSets.size > 0) {
const newPendingExecutionGroups = collectExecutionGroups(exeContext, rootType, rootValue, undefined, undefined, newGroupedFieldSets, newDeferMap);
const newPendingExecutionGroups = collectExecutionGroups(exeContext, rootType, rootValue, undefined, undefined, newGroupedFieldSets);
addIncrementalDataRecords(exeContext, newPendingExecutionGroups);

@@ -285,9 +285,9 @@ }

}
function executeRootGroupedFieldSet(exeContext, operation, rootType, rootValue, groupedFieldSet, deferMap) {
function executeRootGroupedFieldSet(exeContext, operation, rootType, rootValue, groupedFieldSet) {
let result;
if (operation === 'mutation') {
result = executeFieldsSerially(exeContext, rootType, rootValue, undefined, groupedFieldSet, undefined, deferMap);
result = executeFieldsSerially(exeContext, rootType, rootValue, undefined, groupedFieldSet, undefined);
}
else {
result = executeFields(exeContext, rootType, rootValue, undefined, groupedFieldSet, undefined, deferMap);
result = executeFields(exeContext, rootType, rootValue, undefined, groupedFieldSet, undefined);
}

@@ -312,3 +312,3 @@ return result;

*/
function executeFieldsSerially(exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext, deferMap) {
function executeFieldsSerially(exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext) {
return promiseReduce(groupedFieldSet, (results, [responseName, fieldGroup]) => {

@@ -319,3 +319,3 @@ const fieldPath = addPath(path, responseName, parentType.name);

}
const result = executeField(exeContext, parentType, sourceValue, fieldGroup, fieldPath, incrementalContext, deferMap);
const result = executeField(exeContext, parentType, sourceValue, fieldGroup, fieldPath, incrementalContext);
if (result === undefined) {

@@ -338,3 +338,3 @@ return results;

*/
function executeFields(exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext, deferMap) {
function executeFields(exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext) {
const results = Object.create(null);

@@ -348,3 +348,3 @@ let containsPromise = false;

const fieldPath = addPath(path, responseName, parentType.name);
const result = executeField(exeContext, parentType, sourceValue, fieldGroup, fieldPath, incrementalContext, deferMap);
const result = executeField(exeContext, parentType, sourceValue, fieldGroup, fieldPath, incrementalContext);
if (result !== undefined) {

@@ -385,3 +385,3 @@ results[responseName] = result;

*/
function executeField(exeContext, parentType, source, fieldGroup, path, incrementalContext, deferMap) {
function executeField(exeContext, parentType, source, fieldGroup, path, incrementalContext) {
const fieldDef = getFieldDef(exeContext.schema, parentType, fieldGroup[0].node);

@@ -406,5 +406,5 @@ if (!fieldDef) {

if (isPromise(result)) {
return completePromisedValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap);
return completePromisedValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext);
}
const completed = completeValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap);
const completed = completeValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext);
if (isPromise(completed)) {

@@ -493,3 +493,3 @@ // Note: we don't rely on a `catch` method, but we do expect "thenable"

*/
function completeValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) {
function completeValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext) {
// If result is an Error, throw a located error.

@@ -502,3 +502,3 @@ if (result instanceof Error) {

if (isNonNullType(returnType)) {
const completed = completeValue(exeContext, returnType.ofType, fieldGroup, info, path, result, incrementalContext, deferMap);
const completed = completeValue(exeContext, returnType.ofType, fieldGroup, info, path, result, incrementalContext);
if (completed == null) {

@@ -515,3 +515,3 @@ throw new Error(`Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.`);

if (isListType(returnType)) {
return completeListValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap);
return completeListValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext);
}

@@ -526,7 +526,7 @@ // If field type is a leaf type, Scalar or Enum, serialize to a valid value,

if (isAbstractType(returnType)) {
return completeAbstractValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap);
return completeAbstractValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext);
}
// If field type is Object, execute and complete all sub-selections.
if (isObjectType(returnType)) {
return completeObjectValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap);
return completeObjectValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext);
}

@@ -537,6 +537,6 @@ /* c8 ignore next 6 */

}
async function completePromisedValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) {
async function completePromisedValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext) {
try {
const resolved = await result;
let completed = completeValue(exeContext, returnType, fieldGroup, info, path, resolved, incrementalContext, deferMap);
let completed = completeValue(exeContext, returnType, fieldGroup, info, path, resolved, incrementalContext);
if (isPromise(completed)) {

@@ -595,3 +595,3 @@ completed = await completed;

*/
async function completeAsyncIteratorValue(exeContext, itemType, fieldGroup, info, path, asyncIterator, incrementalContext, deferMap) {
async function completeAsyncIteratorValue(exeContext, itemType, fieldGroup, info, path, asyncIterator, incrementalContext) {
exeContext.signal?.addEventListener('abort', () => {

@@ -652,3 +652,3 @@ asyncIterator.return?.();

if (isPromise(item)) {
completedResults.push(completePromisedListItemValue(item, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap));
completedResults.push(completePromisedListItemValue(item, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext));
containsPromise = true;

@@ -658,3 +658,3 @@ }

/* c8 ignore stop */
completeListItemValue(item, completedResults, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap)
completeListItemValue(item, completedResults, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext)
// TODO: add tests for stream backed by asyncIterator that completes to a promise

@@ -686,7 +686,7 @@ /* c8 ignore start */

*/
function completeListValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) {
function completeListValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext) {
const itemType = returnType.ofType;
if (isAsyncIterable(result)) {
const asyncIterator = result[Symbol.asyncIterator]();
return completeAsyncIteratorValue(exeContext, itemType, fieldGroup, info, path, asyncIterator, incrementalContext, deferMap);
return completeAsyncIteratorValue(exeContext, itemType, fieldGroup, info, path, asyncIterator, incrementalContext);
}

@@ -696,5 +696,5 @@ if (!isIterableObject(result)) {

}
return completeIterableValue(exeContext, itemType, fieldGroup, info, path, result, incrementalContext, deferMap);
return completeIterableValue(exeContext, itemType, fieldGroup, info, path, result, incrementalContext);
}
function completeIterableValue(exeContext, itemType, fieldGroup, info, path, items, incrementalContext, deferMap) {
function completeIterableValue(exeContext, itemType, fieldGroup, info, path, items, incrementalContext) {
// This is specified as a simple map, however we're optimizing the path

@@ -725,6 +725,6 @@ // where the list contains no Promises by avoiding creating another Promise.

if (isPromise(item)) {
completedResults.push(completePromisedListItemValue(item, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap));
completedResults.push(completePromisedListItemValue(item, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext));
containsPromise = true;
}
else if (completeListItemValue(item, completedResults, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap)) {
else if (completeListItemValue(item, completedResults, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext)) {
containsPromise = true;

@@ -742,5 +742,5 @@ }

*/
function completeListItemValue(item, completedResults, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap) {
function completeListItemValue(item, completedResults, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext) {
try {
const completedItem = completeValue(exeContext, itemType, fieldGroup, info, itemPath, item, incrementalContext, deferMap);
const completedItem = completeValue(exeContext, itemType, fieldGroup, info, itemPath, item, incrementalContext);
if (isPromise(completedItem)) {

@@ -763,6 +763,6 @@ // Note: we don't rely on a `catch` method, but we do expect "thenable"

}
async function completePromisedListItemValue(item, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap) {
async function completePromisedListItemValue(item, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext) {
try {
const resolved = await item;
let completed = completeValue(exeContext, itemType, fieldGroup, info, itemPath, resolved, incrementalContext, deferMap);
let completed = completeValue(exeContext, itemType, fieldGroup, info, itemPath, resolved, incrementalContext);
if (isPromise(completed)) {

@@ -807,3 +807,3 @@ completed = await completed;

*/
function completeAbstractValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) {
function completeAbstractValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext) {
const resolveTypeFn = returnType.resolveType ?? exeContext.typeResolver;

@@ -813,5 +813,5 @@ const contextValue = exeContext.contextValue;

if (isPromise(runtimeType)) {
return runtimeType.then(resolvedRuntimeType => completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldGroup, info, result), fieldGroup, info, path, result, incrementalContext, deferMap));
return runtimeType.then(resolvedRuntimeType => completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldGroup, info, result), fieldGroup, info, path, result, incrementalContext));
}
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldGroup, info, result), fieldGroup, info, path, result, incrementalContext, deferMap);
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldGroup, info, result), fieldGroup, info, path, result, incrementalContext);
}

@@ -849,3 +849,3 @@ function ensureValidRuntimeType(runtimeTypeName, exeContext, returnType, fieldGroup, info, result) {

*/
function completeObjectValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) {
function completeObjectValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext) {
// If there is an isTypeOf predicate function, call it with the

@@ -861,3 +861,3 @@ // current result. If isTypeOf returns false, then raise an error rather

}
return collectAndExecuteSubfields(exeContext, returnType, fieldGroup, path, result, incrementalContext, deferMap);
return collectAndExecuteSubfields(exeContext, returnType, fieldGroup, path, result, incrementalContext);
});

@@ -869,3 +869,3 @@ }

}
return collectAndExecuteSubfields(exeContext, returnType, fieldGroup, path, result, incrementalContext, deferMap);
return collectAndExecuteSubfields(exeContext, returnType, fieldGroup, path, result, incrementalContext);
}

@@ -875,34 +875,13 @@ function invalidReturnTypeError(returnType, result, fieldGroup) {

}
function addNewDeferredFragments(newDeferUsages, newDeferMap, path) {
// For each new deferUsage object:
for (const newDeferUsage of newDeferUsages) {
const parentDeferUsage = newDeferUsage.parentDeferUsage;
const parent = parentDeferUsage === undefined
? undefined
: deferredFragmentRecordFromDeferUsage(parentDeferUsage, newDeferMap);
// Instantiate the new record.
const deferredFragmentRecord = new DeferredFragmentRecord(path, newDeferUsage.label, parent);
// Update the map.
newDeferMap.set(newDeferUsage, deferredFragmentRecord);
}
return newDeferMap;
}
function deferredFragmentRecordFromDeferUsage(deferUsage, deferMap) {
return deferMap.get(deferUsage);
}
function collectAndExecuteSubfields(exeContext, returnType, fieldGroup, path, result, incrementalContext, deferMap) {
function collectAndExecuteSubfields(exeContext, returnType, fieldGroup, path, result, incrementalContext) {
// Collect sub-fields to execute to complete this value.
const collectedSubfields = collectSubfields(exeContext, returnType, fieldGroup);
let groupedFieldSet = collectedSubfields.groupedFieldSet;
const newDeferUsages = collectedSubfields.newDeferUsages;
if (deferMap === undefined && newDeferUsages.length === 0) {
return executeFields(exeContext, returnType, result, path, groupedFieldSet, incrementalContext, undefined);
const originalGroupedFieldSet = collectSubfields(exeContext, returnType, fieldGroup, path);
if (!exeContext.encounteredDefer && originalGroupedFieldSet.encounteredDefer !== true) {
return executeFields(exeContext, returnType, result, path, originalGroupedFieldSet, incrementalContext);
}
const subExecutionPlan = buildSubExecutionPlan(groupedFieldSet, incrementalContext?.deferUsageSet, exeContext.deferWithoutDuplication);
groupedFieldSet = subExecutionPlan.groupedFieldSet;
const newGroupedFieldSets = subExecutionPlan.newGroupedFieldSets;
const newDeferMap = addNewDeferredFragments(newDeferUsages, new Map(deferMap), path);
const subFields = executeFields(exeContext, returnType, result, path, groupedFieldSet, incrementalContext, newDeferMap);
exeContext.encounteredDefer = true;
const { groupedFieldSet, newGroupedFieldSets } = buildSubExecutionPlan(originalGroupedFieldSet, incrementalContext?.deferUsageSet, exeContext.deferWithoutDuplication);
const subFields = executeFields(exeContext, returnType, result, path, groupedFieldSet, incrementalContext);
if (newGroupedFieldSets.size > 0) {
const newPendingExecutionGroups = collectExecutionGroups(exeContext, returnType, result, path, incrementalContext?.deferUsageSet, newGroupedFieldSets, newDeferMap);
const newPendingExecutionGroups = collectExecutionGroups(exeContext, returnType, result, path, incrementalContext?.deferUsageSet, newGroupedFieldSets);
const context = incrementalContext ?? exeContext;

@@ -1094,3 +1073,3 @@ addIncrementalDataRecords(context, newPendingExecutionGroups);

}
const { groupedFieldSet } = collectFields(schema, fragments, variableValues, rootType, operation.selectionSet, errorOnSubscriptionWithIncrementalDelivery);
const groupedFieldSet = collectFields(schema, fragments, variableValues, rootType, operation.selectionSet, errorOnSubscriptionWithIncrementalDelivery);
const firstRootField = [...groupedFieldSet.entries()][0];

@@ -1150,9 +1129,8 @@ const [responseName, fieldGroup] = firstRootField;

}
function collectExecutionGroups(exeContext, parentType, sourceValue, path, parentDeferUsages, newGroupedFieldSets, deferMap) {
function collectExecutionGroups(exeContext, parentType, sourceValue, path, parentDeferUsages, newGroupedFieldSets) {
const newPendingExecutionGroups = [];
for (const [deferUsageSet, groupedFieldSet] of newGroupedFieldSets) {
const deferredFragmentRecords = getDeferredFragmentRecords(deferUsageSet, deferMap);
const pendingExecutionGroup = {
deferUsages: deferUsageSet,
path,
deferredFragmentRecords,
result: undefined,

@@ -1164,3 +1142,3 @@ };

incrementalDataRecords: undefined,
}, deferMap);
});
if (exeContext.enableEarlyExecution) {

@@ -1179,3 +1157,9 @@ pendingExecutionGroup.result = new BoxedPromiseOrValue(shouldDefer(parentDeferUsages, deferUsageSet)

};
for (const deferredFragmentRecord of deferredFragmentRecords) {
let deferredFragmentFactory = exeContext.deferredFragmentFactory;
if (deferredFragmentFactory === undefined) {
exeContext.deferredFragmentFactory = deferredFragmentFactory =
new DeferredFragmentFactory();
}
for (const deferUsage of deferUsageSet) {
const deferredFragmentRecord = deferredFragmentFactory.get(deferUsage, path);
deferredFragmentRecord.onPending(resolveThunk);

@@ -1196,6 +1180,6 @@ }

}
function executeExecutionGroup(pendingExecutionGroup, exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext, deferMap) {
function executeExecutionGroup(pendingExecutionGroup, exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext) {
let result;
try {
result = executeFields(exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext, deferMap);
result = executeFields(exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext);
}

@@ -1243,5 +1227,2 @@ catch (error) {

}
function getDeferredFragmentRecords(deferUsages, deferMap) {
return Array.from(deferUsages).map(deferUsage => deferredFragmentRecordFromDeferUsage(deferUsage, deferMap));
}
function buildSyncStreamItemQueue(initialItem, initialIndex, streamPath, iterator, exeContext, fieldGroup, info, itemType) {

@@ -1315,3 +1296,3 @@ const streamItemQueue = [];

if (isPromise(item)) {
return completePromisedValue(exeContext, itemType, fieldGroup, info, itemPath, item, incrementalContext, new Map()).then(resolvedItem => buildStreamItemResult(incrementalContext, streamPath, resolvedItem), error => ({
return completePromisedValue(exeContext, itemType, fieldGroup, info, itemPath, item, incrementalContext).then(resolvedItem => buildStreamItemResult(incrementalContext, streamPath, resolvedItem), error => ({
path: streamPath,

@@ -1324,3 +1305,3 @@ errors: withError(incrementalContext.errors, error),

try {
result = completeValue(exeContext, itemType, fieldGroup, info, itemPath, item, incrementalContext, new Map());
result = completeValue(exeContext, itemType, fieldGroup, info, itemPath, item, incrementalContext);
}

@@ -1327,0 +1308,0 @@ catch (rawError) {

import { createDeferred, isPromise } from '@graphql-tools/utils';
import { BoxedPromiseOrValue } from './BoxedPromiseOrValue.js';
import { isDeferredFragmentRecord } from './DeferredFragments.js';
import { invariant } from './invariant.js';
import { isDeferredFragmentRecord, isPendingExecutionGroup } from './types.js';
import { isPendingExecutionGroup } from './types.js';
/**

@@ -10,10 +11,12 @@ * @internal

_rootNodes;
_deferredFragmentFactory;
_completedQueue;
_nextQueue;
constructor() {
constructor(deferredFragmentFactory) {
this._rootNodes = new Set();
this._deferredFragmentFactory = deferredFragmentFactory;
this._completedQueue = [];
this._nextQueue = [];
}
getNewPending(incrementalDataRecords) {
getNewRootNodes(incrementalDataRecords) {
const initialResultChildren = new Set();

@@ -25,4 +28,7 @@ this._addIncrementalDataRecords(incrementalDataRecords, undefined, initialResultChildren);

const { pendingExecutionGroup, incrementalDataRecords } = successfulExecutionGroup;
const deferredFragmentRecords = pendingExecutionGroup.deferredFragmentRecords;
for (const deferredFragmentRecord of deferredFragmentRecords) {
const { deferUsages, path } = pendingExecutionGroup;
const deferredFragmentRecords = [];
for (const deferUsage of deferUsages) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
deferredFragmentRecords.push(deferredFragmentRecord);
const { pendingExecutionGroups, successfulExecutionGroups } = deferredFragmentRecord;

@@ -36,2 +42,17 @@ pendingExecutionGroups.delete(successfulExecutionGroup.pendingExecutionGroup);

}
getDeepestDeferredFragmentAtRoot(initialDeferUsage, deferUsages, path) {
let bestDeferUsage = initialDeferUsage;
let maxDepth = initialDeferUsage.depth;
for (const deferUsage of deferUsages) {
if (deferUsage === initialDeferUsage) {
continue;
}
const depth = deferUsage.depth;
if (depth > maxDepth) {
maxDepth = depth;
bestDeferUsage = deferUsage;
}
}
return this._deferredFragmentFactory.get(bestDeferUsage, path);
}
*currentCompletedBatch() {

@@ -61,3 +82,4 @@ let completed;

}
completeDeferredFragment(deferredFragmentRecord) {
completeDeferredFragment(deferUsage, path) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
if (!this._rootNodes.has(deferredFragmentRecord) ||

@@ -70,16 +92,18 @@ deferredFragmentRecord.pendingExecutionGroups.size > 0) {

for (const successfulExecutionGroup of successfulExecutionGroups) {
for (const otherDeferredFragmentRecord of successfulExecutionGroup.pendingExecutionGroup
.deferredFragmentRecords) {
const { deferUsages, path: resultPath } = successfulExecutionGroup.pendingExecutionGroup;
for (const otherDeferUsage of deferUsages) {
const otherDeferredFragmentRecord = this._deferredFragmentFactory.get(otherDeferUsage, resultPath);
otherDeferredFragmentRecord.successfulExecutionGroups.delete(successfulExecutionGroup);
}
}
const newPending = this._promoteNonEmptyToRoot(deferredFragmentRecord.children);
return { newPending, successfulExecutionGroups };
const newRootNodes = this._promoteNonEmptyToRoot(deferredFragmentRecord.children);
return { deferredFragmentRecord, newRootNodes, successfulExecutionGroups };
}
removeDeferredFragment(deferredFragmentRecord) {
removeDeferredFragment(deferUsage, path) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
if (!this._rootNodes.has(deferredFragmentRecord)) {
return false;
return;
}
this._rootNodes.delete(deferredFragmentRecord);
return true;
return deferredFragmentRecord;
}

@@ -92,7 +116,9 @@ removeStream(streamRecord) {

if (isPendingExecutionGroup(incrementalDataRecord)) {
for (const deferredFragmentRecord of incrementalDataRecord.deferredFragmentRecords) {
const { deferUsages, path } = incrementalDataRecord;
for (const deferUsage of deferUsages) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
this._addDeferredFragment(deferredFragmentRecord, initialResultChildren);
deferredFragmentRecord.pendingExecutionGroups.add(incrementalDataRecord);
}
if (this._hasPendingFragment(incrementalDataRecord)) {
if (this._completesRootNode(incrementalDataRecord)) {
this._onExecutionGroup(incrementalDataRecord);

@@ -113,53 +139,61 @@ }

}
_promoteNonEmptyToRoot(maybeEmptyNewPending) {
const newPending = [];
for (const deliveryGroup of maybeEmptyNewPending) {
if (isDeferredFragmentRecord(deliveryGroup)) {
if (deliveryGroup.pendingExecutionGroups.size > 0) {
deliveryGroup.setAsPending();
for (const pendingExecutionGroup of deliveryGroup.pendingExecutionGroups) {
if (!this._hasPendingFragment(pendingExecutionGroup)) {
_promoteNonEmptyToRoot(maybeEmptyNewRootNodes) {
const newRootNodes = [];
for (const node of maybeEmptyNewRootNodes) {
if (isDeferredFragmentRecord(node)) {
if (node.pendingExecutionGroups.size > 0) {
node.setAsPending();
for (const pendingExecutionGroup of node.pendingExecutionGroups) {
if (!this._completesRootNode(pendingExecutionGroup)) {
this._onExecutionGroup(pendingExecutionGroup);
}
}
this._rootNodes.add(deliveryGroup);
newPending.push(deliveryGroup);
this._rootNodes.add(node);
newRootNodes.push(node);
continue;
}
for (const child of deliveryGroup.children) {
maybeEmptyNewPending.add(child);
for (const child of node.children) {
maybeEmptyNewRootNodes.add(child);
}
}
else {
this._rootNodes.add(deliveryGroup);
newPending.push(deliveryGroup);
this._onStreamItems(deliveryGroup);
this._rootNodes.add(node);
newRootNodes.push(node);
this._onStreamItems(node);
}
}
return newPending;
return newRootNodes;
}
_hasPendingFragment(pendingExecutionGroup) {
return pendingExecutionGroup.deferredFragmentRecords.some(deferredFragmentRecord => this._rootNodes.has(deferredFragmentRecord));
_completesRootNode(pendingExecutionGroup) {
const { deferUsages, path } = pendingExecutionGroup;
for (const deferUsage of deferUsages) {
const deferredFragmentRecord = this._deferredFragmentFactory.get(deferUsage, path);
if (this._rootNodes.has(deferredFragmentRecord)) {
return true;
}
}
return false;
}
_addDeferredFragment(deferredFragmentRecord, deliveryGroups) {
_addDeferredFragment(deferredFragmentRecord, initialResultChildren) {
if (this._rootNodes.has(deferredFragmentRecord)) {
return;
}
const parent = deferredFragmentRecord.parent;
if (parent === undefined) {
invariant(deliveryGroups !== undefined);
deliveryGroups.add(deferredFragmentRecord);
const parentDeferUsage = deferredFragmentRecord.parentDeferUsage;
if (parentDeferUsage === undefined) {
invariant(initialResultChildren !== undefined);
initialResultChildren.add(deferredFragmentRecord);
return;
}
const parent = this._deferredFragmentFactory.get(parentDeferUsage, deferredFragmentRecord.path);
parent.children.add(deferredFragmentRecord);
this._addDeferredFragment(parent, deliveryGroups);
this._addDeferredFragment(parent, initialResultChildren);
}
_onExecutionGroup(pendingExecutionGroup) {
const result = pendingExecutionGroup.result
const value = pendingExecutionGroup.result
.value;
if (isPromise(result)) {
result.then(resolved => this._enqueue(resolved));
if (isPromise(value)) {
value.then(resolved => this._enqueue(resolved));
}
else {
this._enqueue(result);
this._enqueue(value);
}

@@ -224,11 +258,3 @@ }

yield first;
let completed;
while ((completed = this._completedQueue.shift()) !== undefined) {
yield completed;
}
if (this._rootNodes.size === 0) {
for (const resolve of this._nextQueue) {
resolve(undefined);
}
}
yield* this.currentCompletedBatch();
}

@@ -235,0 +261,0 @@ _enqueue(completed) {

import { addPath, pathToArray } from '@graphql-tools/utils';
import { DeferredFragmentFactory } from './DeferredFragments.js';
import { IncrementalGraph } from './IncrementalGraph.js';

@@ -35,11 +36,15 @@ import { invariant } from './invariant.js';

this._nextId = 0;
this._incrementalGraph = new IncrementalGraph();
let deferredFragmentFactory = context.deferredFragmentFactory;
if (deferredFragmentFactory === undefined) {
context.deferredFragmentFactory = deferredFragmentFactory = new DeferredFragmentFactory();
}
this._incrementalGraph = new IncrementalGraph(deferredFragmentFactory);
}
buildResponse(data, errors, incrementalDataRecords) {
const newPending = this._incrementalGraph.getNewPending(incrementalDataRecords);
const newRootNodes = this._incrementalGraph.getNewRootNodes(incrementalDataRecords);
const initialResult = this._context
.useIncrementalNotifications
? errors === undefined
? { data, pending: this._pendingSourcesToResults(newPending), hasNext: true }
: { errors, data, pending: this._pendingSourcesToResults(newPending), hasNext: true }
? { data, pending: this._toPendingResults(newRootNodes), hasNext: true }
: { errors, data, pending: this._toPendingResults(newRootNodes), hasNext: true }
: errors === undefined

@@ -53,13 +58,13 @@ ? { data, hasNext: true }

}
_pendingSourcesToResults(newPending) {
_toPendingResults(newRootNodes) {
const pendingResults = [];
for (const pendingSource of newPending) {
for (const node of newRootNodes) {
const id = String(this._getNextId());
pendingSource.id = id;
node.id = id;
const pendingResult = {
id,
path: pathToArray(pendingSource.path),
path: pathToArray(node.path),
};
if (pendingSource.label !== undefined) {
pendingResult.label = pendingSource.label;
if (node.label !== undefined) {
pendingResult.label = node.label;
}

@@ -160,6 +165,7 @@ pendingResults.push(pendingResult);

_handleCompletedExecutionGroup(completedExecutionGroup, context) {
const { deferUsages, path } = completedExecutionGroup.pendingExecutionGroup;
if (isFailedExecutionGroup(completedExecutionGroup)) {
for (const deferredFragmentRecord of completedExecutionGroup.pendingExecutionGroup
.deferredFragmentRecords) {
if (!this._incrementalGraph.removeDeferredFragment(deferredFragmentRecord)) {
for (const deferUsage of deferUsages) {
const deferredFragmentRecord = this._incrementalGraph.removeDeferredFragment(deferUsage, path);
if (deferredFragmentRecord === undefined) {
// This can occur if multiple deferred grouped field sets error for a fragment.

@@ -192,5 +198,4 @@ continue;

this._incrementalGraph.addCompletedSuccessfulExecutionGroup(completedExecutionGroup);
for (const deferredFragmentRecord of completedExecutionGroup.pendingExecutionGroup
.deferredFragmentRecords) {
const completion = this._incrementalGraph.completeDeferredFragment(deferredFragmentRecord);
for (const deferUsage of deferUsages) {
const completion = this._incrementalGraph.completeDeferredFragment(deferUsage, path);
if (completion === undefined) {

@@ -200,9 +205,10 @@ continue;

const incremental = context.incremental;
const successfulExecutionGroups = completion.successfulExecutionGroups;
const { deferredFragmentRecord, newRootNodes, successfulExecutionGroups } = completion;
if (this._context.useIncrementalNotifications) {
const id = deferredFragmentRecord.id;
invariant(id !== undefined);
context.pending.push(...this._pendingSourcesToResults(completion.newPending));
context.pending.push(...this._toPendingResults(newRootNodes));
for (const successfulExecutionGroup of successfulExecutionGroups) {
const { bestId, subPath } = this._getBestIdAndSubPath(id, deferredFragmentRecord, successfulExecutionGroup);
const { deferUsages: resultDeferUsages, path: resultPath } = successfulExecutionGroup.pendingExecutionGroup;
const bestDeferredFragmentRecord = this._incrementalGraph.getDeepestDeferredFragmentAtRoot(deferUsage, resultDeferUsages, resultPath);
const bestId = bestDeferredFragmentRecord.id;
invariant(bestId !== undefined);
const incrementalEntry = {

@@ -212,3 +218,4 @@ ...successfulExecutionGroup.result,

};
if (subPath !== undefined) {
const subPath = pathToArray(resultPath).slice(pathToArray(bestDeferredFragmentRecord.path).length);
if (subPath.length > 0) {
incrementalEntry.subPath = subPath;

@@ -218,2 +225,4 @@ }

}
const id = deferredFragmentRecord.id;
invariant(id !== undefined);
context.completed.push({ id });

@@ -302,5 +311,5 @@ }

if (incrementalDataRecords !== undefined) {
const newPending = this._incrementalGraph.getNewPending(incrementalDataRecords);
const newPending = this._incrementalGraph.getNewRootNodes(incrementalDataRecords);
if (this._context.useIncrementalNotifications) {
context.pending.push(...this._pendingSourcesToResults(newPending));
context.pending.push(...this._toPendingResults(newPending));
}

@@ -310,29 +319,2 @@ }

}
_getBestIdAndSubPath(initialId, initialDeferredFragmentRecord, completedExecutionGroup) {
let maxLength = pathToArray(initialDeferredFragmentRecord.path).length;
let bestId = initialId;
for (const deferredFragmentRecord of completedExecutionGroup.pendingExecutionGroup
.deferredFragmentRecords) {
if (deferredFragmentRecord === initialDeferredFragmentRecord) {
continue;
}
const id = deferredFragmentRecord.id;
// TODO: add test case for when an fragment has not been released, but might be processed for the shortest path.
/* c8 ignore next 3 */
if (id === undefined) {
continue;
}
const fragmentPath = pathToArray(deferredFragmentRecord.path);
const length = fragmentPath.length;
if (length > maxLength) {
maxLength = length;
bestId = id;
}
}
const subPath = completedExecutionGroup.path.slice(maxLength);
return {
bestId,
subPath: subPath.length > 0 ? subPath : undefined,
};
}
async _returnAsyncIterators() {

@@ -339,0 +321,0 @@ await this._incrementalGraph.abort();

export function isPendingExecutionGroup(incrementalDataRecord) {
return 'deferredFragmentRecords' in incrementalDataRecord;
return 'deferUsages' in incrementalDataRecord;
}

@@ -10,38 +10,4 @@ export function isCompletedExecutionGroup(incrementalDataRecordResult) {

}
/** @internal */
export class DeferredFragmentRecord {
path;
label;
id;
parent;
pendingExecutionGroups;
successfulExecutionGroups;
children;
pending;
fns;
constructor(path, label, parent) {
this.path = path;
this.label = label;
this.parent = parent;
this.pendingExecutionGroups = new Set();
this.successfulExecutionGroups = new Set();
this.children = new Set();
this.pending = false;
this.fns = [];
}
onPending(fn) {
this.fns.push(fn);
}
setAsPending() {
this.pending = true;
for (const fn of this.fns) {
fn();
}
}
export function isCancellableStreamRecord(streamRecord) {
return 'earlyReturn' in streamRecord;
}
export function isDeferredFragmentRecord(deliveryGroup) {
return deliveryGroup instanceof DeferredFragmentRecord;
}
export function isCancellableStreamRecord(deliveryGroup) {
return 'earlyReturn' in deliveryGroup;
}
{
"name": "@graphql-tools/executor",
"version": "2.0.0-alpha-20240808024706-13ce91e5925ef720175c2a5f55583f7b34209017",
"version": "2.0.0-alpha-20240809205104-4b5ae769b3963cc742e682b4049d634fc014d5b4",
"sideEffects": false,

@@ -9,3 +9,3 @@ "peerDependencies": {

"dependencies": {
"@graphql-tools/utils": "10.4.0-alpha-20240808024706-13ce91e5925ef720175c2a5f55583f7b34209017",
"@graphql-tools/utils": "10.4.0-alpha-20240809205104-4b5ae769b3963cc742e682b4049d634fc014d5b4",
"@graphql-typed-document-node/core": "3.2.0",

@@ -12,0 +12,0 @@ "@repeaterjs/repeater": "^3.0.4",

import type { FieldNode, FragmentDefinitionNode, GraphQLObjectType, GraphQLSchema, SelectionSetNode } from 'graphql';
import { Path } from '@graphql-tools/utils';
export interface DeferUsage {
label: string | undefined;
parentDeferUsage: DeferUsage | undefined;
depth: number;
}

@@ -11,3 +13,5 @@ export interface FieldDetails {

export type FieldGroup = ReadonlyArray<FieldDetails>;
export type GroupedFieldSet = ReadonlyMap<string, FieldGroup>;
export type GroupedFieldSet = ReadonlyMap<string, FieldGroup> & {
encounteredDefer?: boolean;
};
/**

@@ -22,6 +26,3 @@ * Given a selectionSet, collects all of the fields and returns them.

*/
export declare function collectFields<TVariables = any>(schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: TVariables, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode, errorOnSubscriptionWithIncrementalDelivery: boolean): {
groupedFieldSet: GroupedFieldSet;
newDeferUsages: ReadonlyArray<DeferUsage>;
};
export declare function collectFields<TVariables = any>(schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: TVariables, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode, errorOnSubscriptionWithIncrementalDelivery: boolean): GroupedFieldSet;
/**

@@ -39,5 +40,2 @@ * Given an array of field nodes, collects all of the subfields of the passed

[variable: string]: unknown;
}, errorOnSubscriptionWithIncrementalDelivery: boolean, returnType: GraphQLObjectType, fieldGroup: FieldGroup): {
groupedFieldSet: GroupedFieldSet;
newDeferUsages: ReadonlyArray<DeferUsage>;
};
}, errorOnSubscriptionWithIncrementalDelivery: boolean, returnType: GraphQLObjectType, fieldGroup: FieldGroup, path: Path): GroupedFieldSet;

@@ -5,2 +5,3 @@ import { DocumentNode, FieldNode, FragmentDefinitionNode, GraphQLError, GraphQLField, GraphQLFieldResolver, GraphQLObjectType, GraphQLResolveInfo, GraphQLSchema, GraphQLTypeResolver, OperationDefinitionNode } from 'graphql';

import { AccumulatorMap } from './AccumulatorMap.js';
import { DeferredFragmentFactory } from './DeferredFragments.js';
import type { CancellableStreamRecord, IncrementalDataRecord, IncrementalExecutionResults, InitialIncrementalExecutionResult, SingularExecutionResult, SubsequentIncrementalExecutionResult } from './types.js';

@@ -48,2 +49,4 @@ /**

errors: AccumulatorMap<Path | undefined, GraphQLError> | undefined;
encounteredDefer: boolean;
deferredFragmentFactory: DeferredFragmentFactory | undefined;
cancellableStreams: Set<CancellableStreamRecord> | undefined;

@@ -50,0 +53,0 @@ incrementalDataRecords: Array<IncrementalDataRecord> | undefined;

@@ -1,2 +0,6 @@

import type { DeferredFragmentRecord, DeliveryGroup, IncrementalDataRecord, IncrementalDataRecordResult, StreamRecord, SuccessfulExecutionGroup } from './types.js';
import { Path } from '@graphql-tools/utils';
import { DeferUsage } from './collectFields.js';
import type { DeferredFragmentRecord, DeliveryGroup } from './DeferredFragments.js';
import { DeferredFragmentFactory } from './DeferredFragments.js';
import type { IncrementalDataRecord, IncrementalDataRecordResult, StreamRecord, SuccessfulExecutionGroup } from './types.js';
/**

@@ -7,7 +11,9 @@ * @internal

private _rootNodes;
private _deferredFragmentFactory;
private _completedQueue;
private _nextQueue;
constructor();
getNewPending(incrementalDataRecords: ReadonlyArray<IncrementalDataRecord>): ReadonlyArray<DeliveryGroup>;
constructor(deferredFragmentFactory: DeferredFragmentFactory);
getNewRootNodes(incrementalDataRecords: ReadonlyArray<IncrementalDataRecord>): ReadonlyArray<DeliveryGroup>;
addCompletedSuccessfulExecutionGroup(successfulExecutionGroup: SuccessfulExecutionGroup): void;
getDeepestDeferredFragmentAtRoot(initialDeferUsage: DeferUsage, deferUsages: ReadonlySet<DeferUsage>, path: Path | undefined): DeferredFragmentRecord;
currentCompletedBatch(): Generator<IncrementalDataRecordResult>;

@@ -17,11 +23,12 @@ nextCompletedBatch(): Promise<Iterable<IncrementalDataRecordResult> | undefined>;

hasNext(): boolean;
completeDeferredFragment(deferredFragmentRecord: DeferredFragmentRecord): {
newPending: ReadonlyArray<DeliveryGroup>;
completeDeferredFragment(deferUsage: DeferUsage, path: Path | undefined): {
deferredFragmentRecord: DeferredFragmentRecord;
newRootNodes: ReadonlyArray<DeliveryGroup>;
successfulExecutionGroups: ReadonlyArray<SuccessfulExecutionGroup>;
} | undefined;
removeDeferredFragment(deferredFragmentRecord: DeferredFragmentRecord): boolean;
removeDeferredFragment(deferUsage: DeferUsage, path: Path | undefined): DeferredFragmentRecord | undefined;
removeStream(streamRecord: StreamRecord): void;
private _addIncrementalDataRecords;
private _promoteNonEmptyToRoot;
private _hasPendingFragment;
private _completesRootNode;
private _addDeferredFragment;

@@ -28,0 +35,0 @@ private _onExecutionGroup;

import type { GraphQLError } from 'graphql';
import { DeferredFragmentFactory } from './DeferredFragments.js';
import type { CancellableStreamRecord, IncrementalDataRecord, IncrementalExecutionResults } from './types.js';

@@ -7,4 +8,5 @@ export declare function buildIncrementalResponse<TData = any>(context: IncrementalPublisherContext, result: TData, errors: ReadonlyArray<GraphQLError> | undefined, incrementalDataRecords: ReadonlyArray<IncrementalDataRecord>): IncrementalExecutionResults<TData>;

signal: AbortSignal | undefined;
deferredFragmentFactory: DeferredFragmentFactory | undefined;
cancellableStreams: Set<CancellableStreamRecord> | undefined;
}
export {};
import type { GraphQLError, GraphQLFormattedError } from 'graphql';
import type { Path } from '@graphql-tools/utils';
import type { BoxedPromiseOrValue } from './BoxedPromiseOrValue.js';
import { DeferUsage } from './collectFields.js';
/**

@@ -129,23 +130,6 @@ * The result of GraphQL execution.

export interface PendingExecutionGroup {
deferUsages: ReadonlySet<DeferUsage>;
path: Path | undefined;
deferredFragmentRecords: ReadonlyArray<DeferredFragmentRecord>;
result: BoxedPromiseOrValue<CompletedExecutionGroup> | (() => BoxedPromiseOrValue<CompletedExecutionGroup>);
}
export type DeliveryGroup = DeferredFragmentRecord | StreamRecord;
/** @internal */
export declare class DeferredFragmentRecord {
path: Path | undefined;
label: string | undefined;
id?: string | undefined;
parent: DeferredFragmentRecord | undefined;
pendingExecutionGroups: Set<PendingExecutionGroup>;
successfulExecutionGroups: Set<SuccessfulExecutionGroup>;
children: Set<DeliveryGroup>;
pending: boolean;
fns: Array<() => void>;
constructor(path: Path | undefined, label: string | undefined, parent: DeferredFragmentRecord | undefined);
onPending(fn: () => void): void;
setAsPending(): void;
}
export declare function isDeferredFragmentRecord(deliveryGroup: DeliveryGroup): deliveryGroup is DeferredFragmentRecord;
export interface StreamItemResult {

@@ -174,5 +158,5 @@ path: Path;

}
export declare function isCancellableStreamRecord(deliveryGroup: DeliveryGroup): deliveryGroup is CancellableStreamRecord;
export declare function isCancellableStreamRecord(streamRecord: StreamRecord): streamRecord is CancellableStreamRecord;
export type IncrementalDataRecord = PendingExecutionGroup | StreamRecord;
export type IncrementalDataRecordResult = CompletedExecutionGroup | StreamItemsResult;
export {};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc