UNPKG

graphql-paper

Version:

A flexible in-memory store based on a GraphQL Schema

17 lines (15 loc) 474 B
'use strict'; var cloneDocument = require('../document/clone-document.js'); function cloneOperation(context, document) { const { store } = context; const cloned = cloneDocument.cloneDocument(document); const typename = cloned.__typename; // setup array of types if it doesn't already exist store[typename] = store[typename] || []; store[typename].push(cloned); return cloned; } exports.cloneOperation = cloneOperation; //# sourceMappingURL=clone.js.map