UNPKG

polen

Version:

A framework for delightful GraphQL developer portals

16 lines 532 B
export const MutationType = { Create: `create`, Update: `update`, Delete: `delete`, }; export const getMutationType = (diff) => { if (!diff.before && diff.after) return MutationType.Create; if (diff.before && diff.after) return MutationType.Update; if (diff.before && !diff.after) return MutationType.Delete; // TypeScript ensures we handle all cases exhaustively throw new Error(`Invalid existence diff: ${JSON.stringify(diff)}`); }; //# sourceMappingURL=mutation-type.js.map