packages feed

graphql-w-persistent 0.3.1.1 → 0.3.1.2

raw patch · 4 files changed

+49/−44 lines, 4 filesdep ~basedep ~containersdep ~jsonPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, containers, json, text

API changes (from Hackage documentation)

- GraphQL: processPersistentDataWithJson :: (MonadIO m) => FilePath -> [[[[Text]]]] -> [RootObject] -> m String
+ GraphQL: processPersistentDataWithJson :: MonadIO m => FilePath -> [[[[Text]]]] -> [RootObject] -> m String
- GraphQL: processQueryStringWithJson :: (MonadIO m) => String -> FilePath -> m ([RootObject], [[String]])
+ GraphQL: processQueryStringWithJson :: MonadIO m => String -> FilePath -> m ([RootObject], [[String]])
- GraphQL: processQueryStringWithJsonAndVariables :: (MonadIO m) => String -> String -> FilePath -> m ([RootObject], [[String]])
+ GraphQL: processQueryStringWithJsonAndVariables :: MonadIO m => String -> String -> FilePath -> m ([RootObject], [[String]])

Files

ChangeLog.md view
@@ -1,53 +1,57 @@ # Revision history for graphql-w-persistent
 
-## 0.1.0.0 -- 2018-10-18
+## 0.3.1.2 -- 2019-04-21
 
-* First version. Released on an unsuspecting world.
+* bug fix: nested objects are now supporting filters on attribute
 
-## 0.1.0.1 -- 2018-10-18
+## 0.3.1.1 -- 2018-11-07
 
-* Added documentation
+* bug fix: processing sql data was incorrect from object to nested object with generalized database entities, though this is now fixed.
 
-## 0.1.0.2 -- 2018-10-18
+## 0.3.1.0 -- 2018-11-07
 
-* Bug fixes
+* Give thrown exceptions
 
-## 0.1.0.3 -- 2018-10-18
+## 0.3.0.0 -- 2018-11-06
 
-* Revise documentation and Bug fix
+* Bug-fix to reenable relationship queries and casting returned values with Int, Rationals/Decimals, and Doubles...api change is arguments change to processing data function
 
-## 0.1.0.4 -- 2018-10-19
+## 0.2.0.1 -- 2018-11-05
 
-* Fix type heirarchies and arguments
+* Fix to accept empty variable arguments and default values
 
-## 0.1.0.5 -- 2018-10-22
+## 0.2.0.0 -- 2018-11-05
 
-* Add duplicated queries feature
+* Variables are available...api change is schema changes
 
+## 0.1.0.7 -- 2018-10-26 [stable release]
+
+* Json file schema
+
 ## 0.1.0.6 -- 2018-10-24
 
 * Revise documentation
 
-## 0.1.0.7 -- 2018-10-26 [stable release]
+## 0.1.0.5 -- 2018-10-22
 
-* Json file schema
+* Add duplicated queries feature
 
-## 0.2.0.0 -- 2018-11-05
+## 0.1.0.4 -- 2018-10-19
 
-* Variables are available...api change is schema changes
+* Fix type heirarchies and arguments
 
-## 0.2.0.1 -- 2018-11-05
+## 0.1.0.3 -- 2018-10-18
 
-* Fix to accept empty variable arguments and default values
+* Revise documentation and Bug fix
 
-## 0.3.0.0 -- 2018-11-06
+## 0.1.0.2 -- 2018-10-18
 
-* Bug-fix to reenable relationship queries and casting returned values with Int, Rationals/Decimals, and Doubles...api change is arguments change to processing data function
+* Bug fixes
 
-## 0.3.1.0 -- 2018-11-07
+## 0.1.0.1 -- 2018-10-18
 
-* Give thrown exceptions
+* Added documentation
 
-## 0.3.1.1 -- 2018-11-07
+## 0.1.0.0 -- 2018-10-18
 
-* bug fix: processing sql data was incorrect from object to nested object with generalized database entities, though this is now fixed.+* First version. Released on an unsuspecting world.
graphql-w-persistent.cabal view
@@ -10,13 +10,13 @@ -- PVP summary:      +-+------- breaking API changes
 --                   | | +----- non-breaking API additions
 --                   | | | +--- code changes with no API change
-version:             0.3.1.1
+version:             0.3.1.2
 
 -- A short (one-line) description of the package.
 synopsis:            Haskell GraphQL query parser-interpreter-data processor.
 
 -- A longer description of the package.
-description:      This is a general purpose Haskell GraphQL query parser and interpreter. It is including data processing to return GraphQL object formats. The query parser and interpreter are universal (on available database query types which is only SQL for now). It is accepting any string query, and it is returning a list of string database-queries. The data processing unit is designed around the return values from the Yesod and Persistent interface (cast as Text data values from PersistValue). With another server that is same data representation on the returned values from the database, this entire package is applicable. To read more detailed information, you should go to the below module page.
+description:      This is a general purpose Haskell GraphQL query parser and interpreter. It is including data processing to return GraphQL object formats. The query parser and interpreter are universal (on available database query types which is only SQL for now). It is accepting any string query, and it is returning a list of string database-queries. The data processing unit is designed around the return values from the Yesod and Persistent interface (cast as Text data values from PersistValue). With another server that is same data representation on the returned values from the database, this entire package is applicable. Examples are odbc package query function and HDBC package quickQuery. To read more detailed information, you should go to the below module page.
 
 -- URL for the project homepage or repository.
 homepage:            https://github.com/jasonsychau/graphql-w-persistent
@@ -77,10 +77,10 @@   --other-extensions:
 
   -- Other library packages from which modules are imported.
-  build-depends:       base >=4.11 && <4.12,
-                       containers >=0.5.11 && <0.6,
-                       json >=0.9.2 && <0.10,
-                       text >=1.2.3.0 && <1.3
+  build-depends:       base >=4.11 && <4.13,
+                       containers >=0.5 && <0.7,
+                       json >=0.9 && <0.10,
+                       text >=1.2 && <1.3
 
 
   -- Directories containing source files.
src/Components/Parsers/QueryParser.hs view
@@ -301,8 +301,8 @@     | h==' ' = parseSubFieldsHelper t acc1 acc2 svrobjs
     | h==','&&(length acc1)>0 = (Left $ createScalarType acc1 :: Field):parseSubFieldsHelper t [] [] svrobjs
     | h==','&&(length acc2)>0 = (Left $ createScalarType acc2 :: Field):parseSubFieldsHelper t [] [] svrobjs
-    | h=='('&&(length acc1)>0 = parseSubFieldsHelper (removeSubSelection t) (acc1++(getSubSelection t)) [] svrobjs
-    | h=='('&&(length acc2)>0 = parseSubFieldsHelper (removeSubSelection t) (acc2++(getSubSelection t)) [] svrobjs
+    | h=='('&&(length acc1)>0 = parseSubFieldsHelper selectTail (acc1++[h]++subselect) [] svrobjs
+    | h=='('&&(length acc2)>0 = parseSubFieldsHelper selectTail (acc2++[h]++subselect) [] svrobjs
     | h=='{'&&(length acc1)>0 = (Right $ (createNestedObject (acc1++[h]++level) svrobjs) :: Field):parseSubFieldsHelper levelTail [] [] svrobjs
     | h=='{'&&(length acc2)>0 = (Right $ (createNestedObject (acc2++[h]++level) svrobjs) :: Field):parseSubFieldsHelper levelTail [] [] svrobjs
     | h=='}' = parseSubFieldsHelper t acc1 acc2 svrobjs
@@ -310,17 +310,18 @@     | otherwise = parseSubFieldsHelper t (acc1++[h]) [] svrobjs
   where
     (level,levelTail) = splitLevel t "" 0
+    (subselect,selectTail) = getSubSelection t
 removeLeadingSpaces :: String -> String
 removeLeadingSpaces [] = []
 removeLeadingSpaces (h:t) = if h==' ' then removeLeadingSpaces t else (h:t)
--- EFFECTS: return subfields code without closing bracket
-removeSubSelection :: String -> String
-removeSubSelection [] = []
-removeSubSelection (h:t) = if h==')' then t else removeSubSelection t
--- EFFECTS: return subselection specification without closing bracket
-getSubSelection :: String -> String
-getSubSelection [] = []
-getSubSelection (h:t) = if h==')' then [] else h:getSubSelection t
+-- EFFECTS: return subselection and String remainder
+getSubSelection :: String -> (String,String)
+getSubSelection str = getSubSelectionHelper str ""
+getSubSelectionHelper :: String -> String -> (String,String)
+getSubSelectionHelper [] acc = ([],[])
+getSubSelectionHelper (h:t) acc 
+    | h==')' = (acc++[h], t)
+    | otherwise = getSubSelectionHelper t (acc++[h])
 -- split level at and without uneven brace.
 splitLevel :: String -> String -> Int -> (String,String)
 splitLevel [] acc _ = (acc,[])
src/GraphQL.hs view
@@ -166,7 +166,7 @@   
    @"In contrast, GraphQL only returns the data that's explicitly requested, so new capabilities can be added via new types and new fields on those types without creating a breaking change. This has lead to a common practice of always avoiding breaking changes and serving a versionless API."@ - <https://graphql.github.io/learn/best-practices/>
   
-   With respect to that, you should be sure to be explicit with your here representation on your data schema. You should give as all planned details, and you should make adjustments when you feel to evolve your server with your desired schema.   
+   With respect to that, you should be sure to be explicit with your here representation on your data schema. You should give all planned details, and you should make adjustments when you feel to evolve your server with your desired schema.   
 -}
 processQueryString :: String                        -- ^ GraphQL query argument as String.
                    -> [(String,[String])]           -- ^ unique server object name to list of query reference names.
@@ -183,7 +183,7 @@ 
    The expected variables string is json syntax.
 
-   When you declare variable types at the beginning of the query, valid types are Text, ByteString, Int, Double, Rational, Bool, Day, TimeOfDay, or UTCTime
+   When you declare variable types at the beginning of the query, valid types are Text, ByteString, Int, Double, Rational, Bool, Day, TimeOfDay, or UTCTime.
 
    There are additional thrown exceptions:
 
@@ -196,7 +196,7 @@ 
    NOTE: the variable-value json string is variable names without $ at the beginning while all other calls are with preceding $.
 -}
-processQueryStringWithVariables :: String                               -- ^ This is the GraphQL query
+processQueryStringWithVariables :: String                        -- ^ This is the GraphQL query
                                 -> String                        -- ^ This is the variables string
                                 -> [(String,[String])]           -- ^ unique server object name to list of query reference names.
                                 -> [(String,[(String,String)])]  -- ^ unique server object name to list of valid scalar subfields (which are exactly named after database column names) and the subfield type.
@@ -335,7 +335,7 @@ 
    The expected variables string is json syntax.
 
-   When you declare variable types at the beginning of the query, valid types are Text, ByteString, Int, Double, Rational, Bool, Day, TimeOfDay, or UTCTime
+   When you declare variable types at the beginning of the query, valid types are Text, ByteString, Int, Double, Rational, Bool, Day, TimeOfDay, or UTCTime.
 
    There are additional thrown exceptions: