UNPKG

solid-start-create-api-graphql-handler

Version:

A simple parser of an incoming event in solid-start to support a GraphQL endpoint

10 lines (9 loc) 409 B
export const isErrorBody = (body) => Boolean(body.errors && body.errors.length > 0); export const mapHeadersToMap = (headers) => new Map(Array.from(headers)); export const newErrorResult = (e) => { if (typeof e === 'string') { return { success: false, error: new Error(e) }; } return { success: false, error: e }; }; export const newSuccessfulResult = (data) => ({ success: true, data });