Socket
Socket
Sign inDemoInstall

graphql

Package Overview
Dependencies
Maintainers
9
Versions
258
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql - npm Package Compare versions

Comparing version 17.0.0-alpha.6 to 17.0.0-alpha.7

execution/buildExecutionPlan.d.ts

49

execution/IncrementalGraph.d.ts
import type {
DeferredFragmentRecord,
DeliveryGroup,
IncrementalDataRecord,
IncrementalDataRecordResult,
ReconcilableDeferredGroupedFieldSetResult,
StreamRecord,
SubsequentResultRecord,
SuccessfulExecutionGroup,
} from './types.js';

@@ -13,27 +13,24 @@ /**

export declare class IncrementalGraph {
private _pending;
private _deferredFragmentNodes;
private _newPending;
private _newIncrementalDataRecords;
private _rootNodes;
private _completedQueue;
private _nextQueue;
constructor();
addIncrementalDataRecords(
getNewRootNodes(
incrementalDataRecords: ReadonlyArray<IncrementalDataRecord>,
): ReadonlyArray<DeliveryGroup>;
addCompletedSuccessfulExecutionGroup(
successfulExecutionGroup: SuccessfulExecutionGroup,
): void;
addCompletedReconcilableDeferredGroupedFieldSet(
reconcilableResult: ReconcilableDeferredGroupedFieldSetResult,
): void;
getNewPending(): ReadonlyArray<SubsequentResultRecord>;
completedIncrementalData(): {
[Symbol.asyncIterator](): any;
next: () => Promise<IteratorResult<Iterable<IncrementalDataRecordResult>>>;
return: () => Promise<
IteratorResult<Iterable<IncrementalDataRecordResult>>
>;
};
currentCompletedBatch(): Generator<IncrementalDataRecordResult>;
nextCompletedBatch(): Promise<
Iterable<IncrementalDataRecordResult> | undefined
>;
abort(): void;
hasNext(): boolean;
completeDeferredFragment(
deferredFragmentRecord: DeferredFragmentRecord,
): Array<ReconcilableDeferredGroupedFieldSetResult> | undefined;
completeDeferredFragment(deferredFragmentRecord: DeferredFragmentRecord):
| {
newRootNodes: ReadonlyArray<DeliveryGroup>;
successfulExecutionGroups: ReadonlyArray<SuccessfulExecutionGroup>;
}
| undefined;
removeDeferredFragment(

@@ -43,6 +40,8 @@ deferredFragmentRecord: DeferredFragmentRecord,

removeStream(streamRecord: StreamRecord): void;
private _removePending;
private _addDeferredGroupedFieldSetRecord;
private _addStreamRecord;
private _addDeferredFragmentNode;
private _removeRootNode;
private _addIncrementalDataRecords;
private _promoteNonEmptyToRoot;
private _completesRootNode;
private _addDeferredFragment;
private _onExecutionGroup;
private _onStreamItems;

@@ -49,0 +48,0 @@ private _yieldCurrentCompletedIncrementalData;

@@ -5,11 +5,6 @@ 'use strict';

const BoxedPromiseOrValue_js_1 = require('../jsutils/BoxedPromiseOrValue.js');
const invariant_js_1 = require('../jsutils/invariant.js');
const isPromise_js_1 = require('../jsutils/isPromise.js');
const promiseWithResolvers_js_1 = require('../jsutils/promiseWithResolvers.js');
const types_js_1 = require('./types.js');
function isDeferredFragmentNode(node) {
return node !== undefined;
}
function isStreamNode(record) {
return 'streamItemQueue' in record;
}
/**

@@ -20,216 +15,195 @@ * @internal

constructor() {
this._pending = new Set();
this._deferredFragmentNodes = new Map();
this._newIncrementalDataRecords = new Set();
this._newPending = new Set();
this._rootNodes = new Set();
this._completedQueue = [];
this._nextQueue = [];
}
addIncrementalDataRecords(incrementalDataRecords) {
for (const incrementalDataRecord of incrementalDataRecords) {
if (
(0, types_js_1.isDeferredGroupedFieldSetRecord)(incrementalDataRecord)
) {
this._addDeferredGroupedFieldSetRecord(incrementalDataRecord);
} else {
this._addStreamRecord(incrementalDataRecord);
}
}
getNewRootNodes(incrementalDataRecords) {
const initialResultChildren = new Set();
this._addIncrementalDataRecords(
incrementalDataRecords,
undefined,
initialResultChildren,
);
return this._promoteNonEmptyToRoot(initialResultChildren);
}
addCompletedReconcilableDeferredGroupedFieldSet(reconcilableResult) {
const deferredFragmentNodes =
reconcilableResult.deferredGroupedFieldSetRecord.deferredFragmentRecords
.map((deferredFragmentRecord) =>
this._deferredFragmentNodes.get(deferredFragmentRecord),
)
.filter(isDeferredFragmentNode);
for (const deferredFragmentNode of deferredFragmentNodes) {
deferredFragmentNode.deferredGroupedFieldSetRecords.delete(
reconcilableResult.deferredGroupedFieldSetRecord,
addCompletedSuccessfulExecutionGroup(successfulExecutionGroup) {
for (const deferredFragmentRecord of successfulExecutionGroup
.pendingExecutionGroup.deferredFragmentRecords) {
deferredFragmentRecord.pendingExecutionGroups.delete(
successfulExecutionGroup.pendingExecutionGroup,
);
deferredFragmentNode.reconcilableResults.add(reconcilableResult);
deferredFragmentRecord.successfulExecutionGroups.add(
successfulExecutionGroup,
);
}
const incrementalDataRecords =
successfulExecutionGroup.incrementalDataRecords;
if (incrementalDataRecords !== undefined) {
this._addIncrementalDataRecords(
incrementalDataRecords,
successfulExecutionGroup.pendingExecutionGroup.deferredFragmentRecords,
);
}
}
getNewPending() {
const newPending = [];
for (const node of this._newPending) {
if (isStreamNode(node)) {
this._pending.add(node);
newPending.push(node);
this._newIncrementalDataRecords.add(node);
} else if (node.deferredGroupedFieldSetRecords.size > 0) {
for (const deferredGroupedFieldSetNode of node.deferredGroupedFieldSetRecords) {
this._newIncrementalDataRecords.add(deferredGroupedFieldSetNode);
}
this._pending.add(node);
newPending.push(node.deferredFragmentRecord);
} else {
for (const child of node.children) {
this._newPending.add(child);
}
}
*currentCompletedBatch() {
let completed;
while ((completed = this._completedQueue.shift()) !== undefined) {
yield completed;
}
this._newPending.clear();
for (const incrementalDataRecord of this._newIncrementalDataRecords) {
if (isStreamNode(incrementalDataRecord)) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this._onStreamItems(
incrementalDataRecord,
incrementalDataRecord.streamItemQueue,
);
} else {
const deferredGroupedFieldSetResult = incrementalDataRecord.result;
const result =
deferredGroupedFieldSetResult instanceof
BoxedPromiseOrValue_js_1.BoxedPromiseOrValue
? deferredGroupedFieldSetResult.value
: deferredGroupedFieldSetResult().value;
if ((0, isPromise_js_1.isPromise)(result)) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
result.then((resolved) => this._enqueue(resolved));
} else {
this._enqueue(result);
}
if (this._rootNodes.size === 0) {
for (const resolve of this._nextQueue) {
resolve(undefined);
}
}
this._newIncrementalDataRecords.clear();
return newPending;
}
completedIncrementalData() {
return {
[Symbol.asyncIterator]() {
return this;
},
next: () => {
const firstResult = this._completedQueue.shift();
if (firstResult !== undefined) {
return Promise.resolve({
value: this._yieldCurrentCompletedIncrementalData(firstResult),
done: false,
});
}
const { promise, resolve } = (0,
promiseWithResolvers_js_1.promiseWithResolvers)();
this._nextQueue.push(resolve);
return promise;
},
return: () => {
for (const resolve of this._nextQueue) {
resolve({ value: undefined, done: true });
}
return Promise.resolve({ value: undefined, done: true });
},
};
nextCompletedBatch() {
const { promise, resolve } = (0,
promiseWithResolvers_js_1.promiseWithResolvers)();
this._nextQueue.push(resolve);
return promise;
}
abort() {
for (const resolve of this._nextQueue) {
resolve(undefined);
}
}
hasNext() {
return this._pending.size > 0;
return this._rootNodes.size > 0;
}
completeDeferredFragment(deferredFragmentRecord) {
const deferredFragmentNode = this._deferredFragmentNodes.get(
deferredFragmentRecord,
);
// TODO: add test case?
/* c8 ignore next 3 */
if (deferredFragmentNode === undefined) {
return undefined;
}
if (deferredFragmentNode.deferredGroupedFieldSetRecords.size > 0) {
if (
!this._rootNodes.has(deferredFragmentRecord) ||
deferredFragmentRecord.pendingExecutionGroups.size > 0
) {
return;
}
const reconcilableResults = Array.from(
deferredFragmentNode.reconcilableResults,
const successfulExecutionGroups = Array.from(
deferredFragmentRecord.successfulExecutionGroups,
);
for (const reconcilableResult of reconcilableResults) {
for (const otherDeferredFragmentRecord of reconcilableResult
.deferredGroupedFieldSetRecord.deferredFragmentRecords) {
const otherDeferredFragmentNode = this._deferredFragmentNodes.get(
otherDeferredFragmentRecord,
this._removeRootNode(deferredFragmentRecord);
for (const successfulExecutionGroup of successfulExecutionGroups) {
for (const otherDeferredFragmentRecord of successfulExecutionGroup
.pendingExecutionGroup.deferredFragmentRecords) {
otherDeferredFragmentRecord.successfulExecutionGroups.delete(
successfulExecutionGroup,
);
if (otherDeferredFragmentNode === undefined) {
continue;
}
otherDeferredFragmentNode.reconcilableResults.delete(
reconcilableResult,
);
}
}
this._removePending(deferredFragmentNode);
for (const child of deferredFragmentNode.children) {
this._newPending.add(child);
}
return reconcilableResults;
const newRootNodes = this._promoteNonEmptyToRoot(
deferredFragmentRecord.children,
);
return { newRootNodes, successfulExecutionGroups };
}
removeDeferredFragment(deferredFragmentRecord) {
const deferredFragmentNode = this._deferredFragmentNodes.get(
deferredFragmentRecord,
);
if (deferredFragmentNode === undefined) {
if (!this._rootNodes.has(deferredFragmentRecord)) {
return false;
}
this._removePending(deferredFragmentNode);
this._deferredFragmentNodes.delete(deferredFragmentRecord);
// TODO: add test case for an erroring deferred fragment with child defers
/* c8 ignore next 3 */
for (const child of deferredFragmentNode.children) {
this.removeDeferredFragment(child.deferredFragmentRecord);
}
this._removeRootNode(deferredFragmentRecord);
return true;
}
removeStream(streamRecord) {
this._removePending(streamRecord);
this._removeRootNode(streamRecord);
}
_removePending(subsequentResultNode) {
this._pending.delete(subsequentResultNode);
if (this._pending.size === 0) {
for (const resolve of this._nextQueue) {
resolve({ value: undefined, done: true });
_removeRootNode(deliveryGroup) {
this._rootNodes.delete(deliveryGroup);
}
_addIncrementalDataRecords(
incrementalDataRecords,
parents,
initialResultChildren,
) {
for (const incrementalDataRecord of incrementalDataRecords) {
if ((0, types_js_1.isPendingExecutionGroup)(incrementalDataRecord)) {
for (const deferredFragmentRecord of incrementalDataRecord.deferredFragmentRecords) {
this._addDeferredFragment(
deferredFragmentRecord,
initialResultChildren,
);
deferredFragmentRecord.pendingExecutionGroups.add(
incrementalDataRecord,
);
}
if (this._completesRootNode(incrementalDataRecord)) {
this._onExecutionGroup(incrementalDataRecord);
}
} else if (parents === undefined) {
initialResultChildren !== undefined ||
(0, invariant_js_1.invariant)(false);
initialResultChildren.add(incrementalDataRecord);
} else {
for (const parent of parents) {
this._addDeferredFragment(parent, initialResultChildren);
parent.children.add(incrementalDataRecord);
}
}
}
}
_addDeferredGroupedFieldSetRecord(deferredGroupedFieldSetRecord) {
for (const deferredFragmentRecord of deferredGroupedFieldSetRecord.deferredFragmentRecords) {
const deferredFragmentNode = this._addDeferredFragmentNode(
deferredFragmentRecord,
);
if (this._pending.has(deferredFragmentNode)) {
this._newIncrementalDataRecords.add(deferredGroupedFieldSetRecord);
_promoteNonEmptyToRoot(maybeEmptyNewRootNodes) {
const newRootNodes = [];
for (const node of maybeEmptyNewRootNodes) {
if ((0, types_js_1.isDeferredFragmentRecord)(node)) {
if (node.pendingExecutionGroups.size > 0) {
for (const pendingExecutionGroup of node.pendingExecutionGroups) {
if (!this._completesRootNode(pendingExecutionGroup)) {
this._onExecutionGroup(pendingExecutionGroup);
}
}
this._rootNodes.add(node);
newRootNodes.push(node);
continue;
}
for (const child of node.children) {
maybeEmptyNewRootNodes.add(child);
}
} else {
this._rootNodes.add(node);
newRootNodes.push(node);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this._onStreamItems(node);
}
deferredFragmentNode.deferredGroupedFieldSetRecords.add(
deferredGroupedFieldSetRecord,
);
}
return newRootNodes;
}
_addStreamRecord(streamRecord) {
this._newPending.add(streamRecord);
_completesRootNode(pendingExecutionGroup) {
return pendingExecutionGroup.deferredFragmentRecords.some(
(deferredFragmentRecord) => this._rootNodes.has(deferredFragmentRecord),
);
}
_addDeferredFragmentNode(deferredFragmentRecord) {
let deferredFragmentNode = this._deferredFragmentNodes.get(
deferredFragmentRecord,
);
if (deferredFragmentNode !== undefined) {
return deferredFragmentNode;
_addDeferredFragment(deferredFragmentRecord, initialResultChildren) {
if (this._rootNodes.has(deferredFragmentRecord)) {
return;
}
deferredFragmentNode = {
deferredFragmentRecord,
deferredGroupedFieldSetRecords: new Set(),
reconcilableResults: new Set(),
children: [],
};
this._deferredFragmentNodes.set(
deferredFragmentRecord,
deferredFragmentNode,
);
const parent = deferredFragmentRecord.parent;
if (parent === undefined) {
this._newPending.add(deferredFragmentNode);
return deferredFragmentNode;
initialResultChildren !== undefined ||
(0, invariant_js_1.invariant)(false);
initialResultChildren.add(deferredFragmentRecord);
return;
}
const parentNode = this._addDeferredFragmentNode(parent);
parentNode.children.push(deferredFragmentNode);
return deferredFragmentNode;
parent.children.add(deferredFragmentRecord);
this._addDeferredFragment(parent, initialResultChildren);
}
async _onStreamItems(streamRecord, streamItemQueue) {
_onExecutionGroup(pendingExecutionGroup) {
let completedExecutionGroup = pendingExecutionGroup.result;
if (
!(
completedExecutionGroup instanceof
BoxedPromiseOrValue_js_1.BoxedPromiseOrValue
)
) {
completedExecutionGroup = completedExecutionGroup();
}
const value = completedExecutionGroup.value;
if ((0, isPromise_js_1.isPromise)(value)) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
value.then((resolved) => this._enqueue(resolved));
} else {
this._enqueue(value);
}
}
async _onStreamItems(streamRecord) {
let items = [];
let errors = [];
let incrementalDataRecords = [];
const streamItemQueue = streamRecord.streamItemQueue;
let streamItemRecord;

@@ -292,6 +266,3 @@ while ((streamItemRecord = streamItemQueue.shift()) !== undefined) {

yield first;
let completed;
while ((completed = this._completedQueue.shift()) !== undefined) {
yield completed;
}
yield* this.currentCompletedBatch();
}

@@ -301,6 +272,3 @@ _enqueue(completed) {

if (next !== undefined) {
next({
value: this._yieldCurrentCompletedIncrementalData(completed),
done: false,
});
next(this._yieldCurrentCompletedIncrementalData(completed));
return;

@@ -307,0 +275,0 @@ }

@@ -35,5 +35,6 @@ 'use strict';

buildResponse(data, errors, incrementalDataRecords) {
this._incrementalGraph.addIncrementalDataRecords(incrementalDataRecords);
const newPending = this._incrementalGraph.getNewPending();
const pending = this._pendingSourcesToResults(newPending);
const newRootNodes = this._incrementalGraph.getNewRootNodes(
incrementalDataRecords,
);
const pending = this._toPendingResults(newRootNodes);
const initialResult =

@@ -48,13 +49,13 @@ errors === undefined

}
_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, Path_js_1.pathToArray)(pendingSource.path),
path: (0, Path_js_1.pathToArray)(node.path),
};
if (pendingSource.label !== undefined) {
pendingResult.label = pendingSource.label;
if (node.label !== undefined) {
pendingResult.label = node.label;
}

@@ -80,10 +81,5 @@ pendingResults.push(pendingResult);

};
const completedIncrementalData =
this._incrementalGraph.completedIncrementalData();
// use the raw iterator rather than 'for await ... of' so as not to trigger the
// '.return()' method on the iterator when exiting the loop with the next value
const asyncIterator = completedIncrementalData[Symbol.asyncIterator]();
let iteration = await asyncIterator.next();
while (!iteration.done) {
for (const completedResult of iteration.value) {
let batch = this._incrementalGraph.currentCompletedBatch();
do {
for (const completedResult of batch) {
this._handleCompletedIncrementalData(completedResult, context);

@@ -95,3 +91,2 @@ }

if (!hasNext) {
// eslint-disable-next-line require-atomic-updates
isDone = true;

@@ -113,4 +108,4 @@ }

// eslint-disable-next-line no-await-in-loop
iteration = await asyncIterator.next();
}
batch = await this._incrementalGraph.nextCompletedBatch();
} while (batch !== undefined);
await this._returnAsyncIteratorsIgnoringErrors();

@@ -121,2 +116,3 @@ return { value: undefined, done: true };

isDone = true;
this._incrementalGraph.abort();
await this._returnAsyncIterators();

@@ -127,2 +123,3 @@ return { value: undefined, done: true };

isDone = true;
this._incrementalGraph.abort();
await this._returnAsyncIterators();

@@ -141,26 +138,12 @@ return Promise.reject(error);

_handleCompletedIncrementalData(completedIncrementalData, context) {
if (
(0, types_js_1.isDeferredGroupedFieldSetResult)(completedIncrementalData)
) {
this._handleCompletedDeferredGroupedFieldSet(
completedIncrementalData,
context,
);
if ((0, types_js_1.isCompletedExecutionGroup)(completedIncrementalData)) {
this._handleCompletedExecutionGroup(completedIncrementalData, context);
} else {
this._handleCompletedStreamItems(completedIncrementalData, context);
}
const newPending = this._incrementalGraph.getNewPending();
context.pending.push(...this._pendingSourcesToResults(newPending));
}
_handleCompletedDeferredGroupedFieldSet(
deferredGroupedFieldSetResult,
context,
) {
if (
(0, types_js_1.isNonReconcilableDeferredGroupedFieldSetResult)(
deferredGroupedFieldSetResult,
)
) {
for (const deferredFragmentRecord of deferredGroupedFieldSetResult
.deferredGroupedFieldSetRecord.deferredFragmentRecords) {
_handleCompletedExecutionGroup(completedExecutionGroup, context) {
if ((0, types_js_1.isFailedExecutionGroup)(completedExecutionGroup)) {
for (const deferredFragmentRecord of completedExecutionGroup
.pendingExecutionGroup.deferredFragmentRecords) {
const id = deferredFragmentRecord.id;

@@ -176,3 +159,3 @@ if (

id,
errors: deferredGroupedFieldSetResult.errors,
errors: completedExecutionGroup.errors,
});

@@ -182,15 +165,11 @@ }

}
this._incrementalGraph.addCompletedReconcilableDeferredGroupedFieldSet(
deferredGroupedFieldSetResult,
this._incrementalGraph.addCompletedSuccessfulExecutionGroup(
completedExecutionGroup,
);
const incrementalDataRecords =
deferredGroupedFieldSetResult.incrementalDataRecords;
if (incrementalDataRecords !== undefined) {
this._incrementalGraph.addIncrementalDataRecords(incrementalDataRecords);
}
for (const deferredFragmentRecord of deferredGroupedFieldSetResult
.deferredGroupedFieldSetRecord.deferredFragmentRecords) {
const reconcilableResults =
this._incrementalGraph.completeDeferredFragment(deferredFragmentRecord);
if (reconcilableResults === undefined) {
for (const deferredFragmentRecord of completedExecutionGroup
.pendingExecutionGroup.deferredFragmentRecords) {
const completion = this._incrementalGraph.completeDeferredFragment(
deferredFragmentRecord,
);
if (completion === undefined) {
continue;

@@ -201,10 +180,12 @@ }

const incremental = context.incremental;
for (const reconcilableResult of reconcilableResults) {
const { newRootNodes, successfulExecutionGroups } = completion;
context.pending.push(...this._toPendingResults(newRootNodes));
for (const successfulExecutionGroup of successfulExecutionGroups) {
const { bestId, subPath } = this._getBestIdAndSubPath(
id,
deferredFragmentRecord,
reconcilableResult,
successfulExecutionGroup,
);
const incrementalEntry = {
...reconcilableResult.result,
...successfulExecutionGroup.result,
id: bestId,

@@ -253,6 +234,8 @@ };

context.incremental.push(incrementalEntry);
if (streamItemsResult.incrementalDataRecords !== undefined) {
this._incrementalGraph.addIncrementalDataRecords(
streamItemsResult.incrementalDataRecords,
const incrementalDataRecords = streamItemsResult.incrementalDataRecords;
if (incrementalDataRecords !== undefined) {
const newRootNodes = this._incrementalGraph.getNewRootNodes(
incrementalDataRecords,
);
context.pending.push(...this._toPendingResults(newRootNodes));
}

@@ -264,3 +247,3 @@ }

initialDeferredFragmentRecord,
deferredGroupedFieldSetResult,
completedExecutionGroup,
) {

@@ -271,4 +254,4 @@ let maxLength = (0, Path_js_1.pathToArray)(

let bestId = initialId;
for (const deferredFragmentRecord of deferredGroupedFieldSetResult
.deferredGroupedFieldSetRecord.deferredFragmentRecords) {
for (const deferredFragmentRecord of completedExecutionGroup
.pendingExecutionGroup.deferredFragmentRecords) {
if (deferredFragmentRecord === initialDeferredFragmentRecord) {

@@ -292,3 +275,3 @@ continue;

}
const subPath = deferredGroupedFieldSetResult.path.slice(maxLength);
const subPath = completedExecutionGroup.path.slice(maxLength);
return {

@@ -300,3 +283,2 @@ bestId,

async _returnAsyncIterators() {
await this._incrementalGraph.completedIncrementalData().return();
const cancellableStreams = this._context.cancellableStreams;

@@ -303,0 +285,0 @@ if (cancellableStreams === undefined) {

@@ -82,3 +82,3 @@ import type { BoxedPromiseOrValue } from '../jsutils/BoxedPromiseOrValue.js';

}
interface BareDeferredGroupedFieldSetResult<TData = ObjMap<unknown>> {
interface ExecutionGroupResult<TData = ObjMap<unknown>> {
errors?: ReadonlyArray<GraphQLError>;

@@ -90,3 +90,3 @@ data: TData;

TExtensions = ObjMap<unknown>,
> extends BareDeferredGroupedFieldSetResult<TData> {
> extends ExecutionGroupResult<TData> {
id: string;

@@ -106,3 +106,3 @@ subPath?: ReadonlyArray<string | number>;

}
interface BareStreamItemsResult<TData = ReadonlyArray<unknown>> {
interface StreamItemsRecordResult<TData = ReadonlyArray<unknown>> {
errors?: ReadonlyArray<GraphQLError>;

@@ -114,3 +114,3 @@ items: TData;

TExtensions = ObjMap<unknown>,
> extends BareStreamItemsResult<TData> {
> extends StreamItemsRecordResult<TData> {
id: string;

@@ -153,20 +153,20 @@ subPath?: ReadonlyArray<string | number>;

}
export declare function isDeferredGroupedFieldSetRecord(
export declare function isPendingExecutionGroup(
incrementalDataRecord: IncrementalDataRecord,
): incrementalDataRecord is DeferredGroupedFieldSetRecord;
export type DeferredGroupedFieldSetResult =
| ReconcilableDeferredGroupedFieldSetResult
| NonReconcilableDeferredGroupedFieldSetResult;
export declare function isDeferredGroupedFieldSetResult(
subsequentResult: DeferredGroupedFieldSetResult | StreamItemsResult,
): subsequentResult is DeferredGroupedFieldSetResult;
export interface ReconcilableDeferredGroupedFieldSetResult {
deferredGroupedFieldSetRecord: DeferredGroupedFieldSetRecord;
): incrementalDataRecord is PendingExecutionGroup;
export type CompletedExecutionGroup =
| SuccessfulExecutionGroup
| FailedExecutionGroup;
export declare function isCompletedExecutionGroup(
subsequentResult: CompletedExecutionGroup | StreamItemsResult,
): subsequentResult is CompletedExecutionGroup;
export interface SuccessfulExecutionGroup {
pendingExecutionGroup: PendingExecutionGroup;
path: Array<string | number>;
result: BareDeferredGroupedFieldSetResult;
result: ExecutionGroupResult;
incrementalDataRecords: ReadonlyArray<IncrementalDataRecord> | undefined;
errors?: never;
}
interface NonReconcilableDeferredGroupedFieldSetResult {
deferredGroupedFieldSetRecord: DeferredGroupedFieldSetRecord;
interface FailedExecutionGroup {
pendingExecutionGroup: PendingExecutionGroup;
path: Array<string | number>;

@@ -176,14 +176,15 @@ errors: ReadonlyArray<GraphQLError>;

}
export declare function isNonReconcilableDeferredGroupedFieldSetResult(
deferredGroupedFieldSetResult: DeferredGroupedFieldSetResult,
): deferredGroupedFieldSetResult is NonReconcilableDeferredGroupedFieldSetResult;
export declare function isFailedExecutionGroup(
completedExecutionGroup: CompletedExecutionGroup,
): completedExecutionGroup is FailedExecutionGroup;
type ThunkIncrementalResult<T> =
| BoxedPromiseOrValue<T>
| (() => BoxedPromiseOrValue<T>);
export interface DeferredGroupedFieldSetRecord {
export interface PendingExecutionGroup {
deferredFragmentRecords: ReadonlyArray<DeferredFragmentRecord>;
result: ThunkIncrementalResult<DeferredGroupedFieldSetResult>;
result: ThunkIncrementalResult<CompletedExecutionGroup>;
}
export type SubsequentResultRecord = DeferredFragmentRecord | StreamRecord;
export interface DeferredFragmentRecord {
export type DeliveryGroup = DeferredFragmentRecord | StreamRecord;
/** @internal */
export declare class DeferredFragmentRecord {
path: Path | undefined;

@@ -193,3 +194,14 @@ label: string | undefined;

parent: DeferredFragmentRecord | undefined;
pendingExecutionGroups: Set<PendingExecutionGroup>;
successfulExecutionGroups: Set<SuccessfulExecutionGroup>;
children: Set<DeliveryGroup>;
constructor(
path: Path | undefined,
label: string | undefined,
parent: DeferredFragmentRecord | undefined,
);
}
export declare function isDeferredFragmentRecord(
deliveryGroup: DeliveryGroup,
): deliveryGroup is DeferredFragmentRecord;
export interface StreamItemResult {

@@ -209,5 +221,5 @@ item?: unknown;

streamRecord: StreamRecord;
result?: BareStreamItemsResult | undefined;
errors?: ReadonlyArray<GraphQLError>;
result?: StreamItemsRecordResult;
incrementalDataRecords?: ReadonlyArray<IncrementalDataRecord> | undefined;
errors?: ReadonlyArray<GraphQLError> | undefined;
}

@@ -218,10 +230,8 @@ export interface CancellableStreamRecord extends StreamRecord {

export declare function isCancellableStreamRecord(
subsequentResultRecord: SubsequentResultRecord,
): subsequentResultRecord is CancellableStreamRecord;
export type IncrementalDataRecord =
| DeferredGroupedFieldSetRecord
| StreamRecord;
deliveryGroup: DeliveryGroup,
): deliveryGroup is CancellableStreamRecord;
export type IncrementalDataRecord = PendingExecutionGroup | StreamRecord;
export type IncrementalDataRecordResult =
| DeferredGroupedFieldSetResult
| CompletedExecutionGroup
| StreamItemsResult;
export {};
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.isCancellableStreamRecord =
exports.isNonReconcilableDeferredGroupedFieldSetResult =
exports.isDeferredGroupedFieldSetResult =
exports.isDeferredGroupedFieldSetRecord =
exports.isDeferredFragmentRecord =
exports.DeferredFragmentRecord =
exports.isFailedExecutionGroup =
exports.isCompletedExecutionGroup =
exports.isPendingExecutionGroup =
void 0;
function isDeferredGroupedFieldSetRecord(incrementalDataRecord) {
function isPendingExecutionGroup(incrementalDataRecord) {
return 'deferredFragmentRecords' in incrementalDataRecord;
}
exports.isDeferredGroupedFieldSetRecord = isDeferredGroupedFieldSetRecord;
function isDeferredGroupedFieldSetResult(subsequentResult) {
return 'deferredGroupedFieldSetRecord' in subsequentResult;
exports.isPendingExecutionGroup = isPendingExecutionGroup;
function isCompletedExecutionGroup(subsequentResult) {
return 'pendingExecutionGroup' in subsequentResult;
}
exports.isDeferredGroupedFieldSetResult = isDeferredGroupedFieldSetResult;
function isNonReconcilableDeferredGroupedFieldSetResult(
deferredGroupedFieldSetResult,
) {
return deferredGroupedFieldSetResult.errors !== undefined;
exports.isCompletedExecutionGroup = isCompletedExecutionGroup;
function isFailedExecutionGroup(completedExecutionGroup) {
return completedExecutionGroup.errors !== undefined;
}
exports.isNonReconcilableDeferredGroupedFieldSetResult =
isNonReconcilableDeferredGroupedFieldSetResult;
function isCancellableStreamRecord(subsequentResultRecord) {
return 'earlyReturn' in subsequentResultRecord;
exports.isFailedExecutionGroup = isFailedExecutionGroup;
/** @internal */
class DeferredFragmentRecord {
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();
}
}
exports.DeferredFragmentRecord = DeferredFragmentRecord;
function isDeferredFragmentRecord(deliveryGroup) {
return deliveryGroup instanceof DeferredFragmentRecord;
}
exports.isDeferredFragmentRecord = isDeferredFragmentRecord;
function isCancellableStreamRecord(deliveryGroup) {
return 'earlyReturn' in deliveryGroup;
}
exports.isCancellableStreamRecord = isCancellableStreamRecord;
{
"name": "graphql",
"version": "17.0.0-alpha.6",
"version": "17.0.0-alpha.7",
"description": "A Query Language and Runtime which can target any service.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -9,3 +9,3 @@ 'use strict';

*/
exports.version = '17.0.0-alpha.6';
exports.version = '17.0.0-alpha.7';
/**

@@ -18,3 +18,3 @@ * An object containing the components of the GraphQL.js version string

patch: 0,
preReleaseTag: 'alpha.6',
preReleaseTag: 'alpha.7',
});

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