UNPKG

grafast

Version:

Cutting edge GraphQL planning and execution engine

43 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.__CloneStreamStep = void 0; exports.__cloneStream = __cloneStream; const constants_ts_1 = require("../constants.js"); const step_ts_1 = require("../step.js"); class __CloneStreamStep extends step_ts_1.Step { static { this.$$export = { moduleName: "grafast", exportName: "__CloneStreamStep", }; } constructor($dep) { super(); this.isSyncAndSafe = false; this.addDependency($dep); } [constants_ts_1.$$deepDepSkip]() { return this.getDepOptions(0).step; } listItem($item) { const $dep = this.getDepOptions(0).step; return $dep.listItem?.($item) ?? $item; } optimize() { // IMPORTANT: optimization is handled in OperationPlan's inlineSteps() return this; } execute({ values: [val], indexMap }) { // The stream has already been cloned, we're just a placeholder really if (val.isBatch) { return val.entries; } else { const v = val.value; return indexMap(() => v); } } } exports.__CloneStreamStep = __CloneStreamStep; function __cloneStream($dep) { return new __CloneStreamStep($dep); } //# sourceMappingURL=__cloneStream.js.map