PostgREST # 22:module PostgREST.Parsers where Parsers Protolude hiding try intercalate replace option Control Monad Data Foldable foldl1 qualified Data HashMap Strict as M Data Text intercalate replace strip Data List init last Data Tree Data Either Combinators mapLeft PostgREST RangeQuery NonnegRange allRange PostgREST Types Text ParserCombinators Parsec hiding many Text Parsec Error pRequestSelect # 37:pRequestSelect :: Text Text Either ApiRequestError ReadRequest pRequestSelect rootName selStr mapError parse pReadRequest rootName toS selStr toS selStr pRequestFilter # 41:pRequestFilter :: Text Text Either ApiRequestError EmbedPath Filter pRequestFilter k v mapError path Filter fld oper treePath parse pTreePath toS k toS k oper parse pOpExpr pSingleVal pListVal toS v toS v path fst treePath fld snd treePath pRequestOrder # 49:pRequestOrder :: Text Text Either ApiRequestError EmbedPath OrderTerm pRequestOrder k v mapError path ord' treePath parse pTreePath toS k toS k path fst treePath ord' parse pOrder toS v toS v pRequestRange # 56:pRequestRange :: ByteString NonnegRange Either ApiRequestError EmbedPath NonnegRange pRequestRange k v mapError path pure v treePath parse pTreePath toS k toS k path fst treePath pRequestLogicTree # 62:pRequestLogicTree :: Text Text Either ApiRequestError EmbedPath LogicTree pRequestLogicTree k v mapError embedPath logicTree path parse pLogicPath toS k toS k embedPath fst path op snd path logicTree join parse pLogicTree toS v toS op pure v pRequestRpcQParam # 71:pRequestRpcQParam :: Text Text Either ApiRequestError RpcQParam pRequestRpcQParam k v mapError name val name parse pFieldName toS k toS k val toS parse many anyChar toS v v ws Parser Text ws toS many oneOf lexeme Parser a Parser a lexeme p ws p ws pReadRequest # 83:pReadRequest :: Text Parser ReadRequest pReadRequest rootNodeName fieldTree pFieldForest return foldr treeEntry Node readQuery rootNodeName Nothing Nothing Nothing fieldTree readQuery Select rootNodeName Nothing allRange treeEntry Tree SelectItem ReadRequest ReadRequest treeEntry Node fld fn alias relationDetail fldForest Node q i rForest fldForest Node q select fld select q i rForest Node q i newForest newForest foldr treeEntry Node Select fn Nothing allRange fn Nothing alias relationDetail fldForest rForest pTreePath # 98:pTreePath :: Parser (EmbedPath, Field) Parser EmbedPath Field pTreePath p pFieldName sepBy1 pDelimiter jp optionMaybe pJsonPath return init p last p jp pFieldForest # 104:pFieldForest :: Parser Parser Tree SelectItem pFieldForest pFieldTree sepBy1 lexeme char pFieldTree Parser Tree SelectItem pFieldTree try Node pRelationSelect between char char pFieldForest try Node pRelationSelect between char char pFieldForest Node pFieldSelect pure pStar Parser Text pStar toS string pure ByteString pFieldName # 116:pFieldName :: Parser Text Parser Text pFieldName matches many1 letter digit oneOf sepBy1 dash return intercalate map toS matches isDash GenParser Char st isDash try char notFollowedBy char dash Parser Char dash isDash pure pJsonPathStep # 129:pJsonPathStep :: Parser Text Parser Text pJsonPathStep toS try string pFieldName pJsonPath Parser Text pJsonPath many pJsonPathStep string pFieldName pField Parser Field pField lexeme pFieldName optionMaybe pJsonPath aliasSeparator Parser aliasSeparator char notFollowedBy char pRelationSelect # 138:pRelationSelect :: Parser SelectItem Parser SelectItem pRelationSelect lexeme try alias optionMaybe try pFieldName aliasSeparator fld pField relationDetail optionMaybe try char pFieldName return fld Nothing alias relationDetail pFieldSelect # 147:pFieldSelect :: Parser SelectItem Parser SelectItem pFieldSelect lexeme try alias optionMaybe try pFieldName aliasSeparator fld pField cast' optionMaybe string many letter return fld toS cast' alias Nothing s pStar return s Nothing Nothing Nothing Nothing pOpExpr # 160:pOpExpr :: Parser SingleVal Parser SingleVal Parser ListVal Parser OpExpr pOpExpr pSVal pLVal try string pDelimiter OpExpr True pOperation OpExpr False pOperation pOperation Parser Operation pOperation Op toS foldl1 try pDelimiter string toS M keys ops pSVal In string pDelimiter pLVal pFts pFts op foldl1 try string toS ftsOps lang optionMaybe try between char char many letter digit oneOf pDelimiter Fts toS op toS lang pSVal ops M filterWithKey const flip notElem ftsOps operators ftsOps M keys ftsOperators pSingleVal # 178:pSingleVal :: Parser SingleVal Parser SingleVal pSingleVal toS many anyChar pListVal Parser ListVal pListVal try lexeme char pListElement sepBy1 char lexeme char lexeme pListElement sepBy1 char pListElement # 185:pListElement :: Parser Text Parser Text pListElement try pQuotedValue toS many noneOf pQuotedValue Parser Text pQuotedValue toS char many noneOf char notFollowedBy noneOf pDelimiter Parser Char pDelimiter char pOrder Parser OrderTerm pOrder lexeme pOrderTerm sepBy char pOrderTerm # 197:pOrderTerm :: Parser OrderTerm Parser OrderTerm pOrderTerm try c pField d optionMaybe try pDelimiter try string pure OrderAsc try string pure OrderDesc nls optionMaybe pDelimiter try string pure OrderNullsLast try string pure OrderNullsFirst return OrderTerm c d nls OrderTerm pField pure Nothing pure Nothing pLogicTree # 213:pLogicTree :: Parser LogicTree Parser LogicTree pLogicTree Stmnt try pLogicFilter Expr pNot pLogicOp lexeme char pLogicTree sepBy1 lexeme char lexeme char pLogicFilter Parser Filter pLogicFilter Filter pField pDelimiter pOpExpr pLogicSingleVal pLogicListVal pNot Parser Bool pNot try string pDelimiter pure True pure False pLogicOp Parser LogicOperator pLogicOp try string pure And string pure Or pLogicSingleVal # 228:pLogicSingleVal :: Parser SingleVal Parser SingleVal pLogicSingleVal try pQuotedValue try pPgArray toS many noneOf pPgArray Parser Text pPgArray a string b many noneOf c string toS pure a b c pLogicListVal # 239:pLogicListVal :: Parser ListVal Parser ListVal pLogicListVal lexeme char pListElement sepBy1 char lexeme char pLogicPath Parser EmbedPath Text pLogicPath path pFieldName sepBy1 pDelimiter op last path notOp op return filter init path elem path notOp op mapError # 249:mapError :: Either ParseError Either ParseError a Either ApiRequestError a mapError mapLeft translateError translateError e ParseRequestError message details message show errorPos e details strip replace toS showErrorMessages errorMessages e allRange # 259:allRange :: NonnegRange NonnegRange allRange rangeGeq