parseLiteral(ast) { if (ast.kind === _graphql.Kind.STRING) { return parseFileValue(ast.value); } else if (ast.kind === _graphql.Kind.OBJECT) { const __type = ast.fields.find(field => field.name.value === '__type'); const name = ast.fields.find(field => field.name.value === 'name'); const url = ast.fields.find(field => field.name.value === 'url'); if (__type && __type.value && name && name.value) { return parseFileValue({ __type: __type.value.value, name: name.value.value, url: url && url.value ? url.value.value : undefined }); } } throw new TypeValidationError(ast.kind, 'File'); }
parseLiteral(ast) { if (ast.kind === _graphql.Kind.STRING) { return { __type: 'Date', iso: parseDateIsoLiteral(ast) }; } else if (ast.kind === _graphql.Kind.OBJECT) { const __type = ast.fields.find(field => field.name.value === '__type'); const iso = ast.fields.find(field => field.name.value === 'iso'); if (__type && __type.value && __type.value.value === 'Date' && iso) { return { __type: __type.value.value, iso: parseDateIsoLiteral(iso.value) }; } } throw new TypeValidationError(ast.kind, 'Date'); }
parseLiteral(ast) { if (ast.kind === _graphql.Kind.STRING) { return { __type: 'Bytes', base64: ast.value }; } else if (ast.kind === _graphql.Kind.OBJECT) { const __type = ast.fields.find(field => field.name.value === '__type'); const base64 = ast.fields.find(field => field.name.value === 'base64'); if (__type && __type.value && __type.value.value === 'Bytes' && base64 && base64.value && typeof base64.value.value === 'string') { return { __type: __type.value.value, base64: base64.value.value }; } } throw new TypeValidationError(ast.kind, 'Bytes'); }