[refactor] upgrade flake, spago repo

Biggest change is bumping up graphql client version.
parent 84be6407
Pipeline #7447 passed with stages
in 29 minutes and 52 seconds
......@@ -21,11 +21,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
......@@ -36,16 +36,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1717179513,
"narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=",
"lastModified": 1731603435,
"narHash": "sha256-CqCX4JG7UiHvkrBTpYC3wcEurvbtTADLbo3Ns2CEoL8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0",
"rev": "8b27c1239e5c421a2bbc2c65d52e4a6fbf2ff296",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "24.05",
"ref": "24.11",
"repo": "nixpkgs",
"type": "github"
}
......@@ -59,11 +59,11 @@
"slimlock": "slimlock"
},
"locked": {
"lastModified": 1727269424,
"narHash": "sha256-uoVjAkKbuJSA7++kyBjxLozICDdukZ+Mjj5Z/K5qMak=",
"lastModified": 1739795788,
"narHash": "sha256-PG4lO49fvWHpQoCN3mIGflisXF+5vEf91ceV9hsWTLU=",
"owner": "thomashoneyman",
"repo": "purescript-overlay",
"rev": "5a28abe663758634b1e5ca7053e08af62fd3be80",
"rev": "f754c2ef94cef46e5d5223c25d3f361e1f6cb509",
"type": "github"
},
"original": {
......
......@@ -2,9 +2,7 @@
description = "Gargantext PureScript frontend";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=24.05";
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=24.11";
inputs.purescript-overlay = {
url = "github:thomashoneyman/purescript-overlay";
inputs.nixpkgs.follows = "nixpkgs";
......@@ -21,12 +19,12 @@
dependencies = with pkgs; [
purs-bin.purs-0_15_16-1 # from the purescript-overlay
spago-bin.spago-0_93_37
nodePackages.purs-tidy
watchexec
spago-bin.spago-0_93_43
esbuild
nodejs
nodePackages.npm
nodePackages.purs-tidy
watchexec
];
serve = pkgs.writeShellScriptBin "serve" ''
......
This diff is collapsed.
workspace:
packageSet:
registry: 53.2.0
registry: 63.5.0
extraPackages:
# garganscript packages
d3:
......@@ -16,9 +16,61 @@ workspace:
data-default:
git: https://github.com/garganscript/purescript-data-default.git
ref: v0.4.0
# apparently, this project doesn't push often
# https://github.com/OxfordAbstracts/purescript-graphql-client/issues/138
graphql-client:
git: https://github.com/garganscript/purescript-graphql-client.git
ref: spago-next-9.3.2
git: https://github.com/OxfordAbstracts/purescript-graphql-client
ref: v10.0.3
dependencies:
- aff
- affjax
- affjax-node
- affjax-web
- argonaut-codecs
- argonaut-core
- arrays
- bifunctors
- console
- control
- datetime
- debug
- effect
- either
- enums
- filterable
- foldable-traversable
- foreign
- foreign-object
- functions
- halogen-subscriptions
- heterogeneous
- http-methods
- identity
- integers
- lists
- maybe
- media-types
- newtype
- now
- nullable
- numbers
- ordered-collections
- partial
- prelude
- psci-support
- quickcheck
- record
- spec
- spec-discovery
- string-parsers
- strings
- transformers
- tuples
- typelevel-lists
- unfoldable
- unicode
- unsafe-coerce
- variant
markdown-it:
git: https://github.com/garganscript/purescript-markdown-it.git
ref: spago-next
......@@ -27,8 +79,16 @@ workspace:
ref: v3.0.2-spago-next
simple-json-generics: 0.2.1
tuples-native:
git: https://github.com/garganscript/purescript-tuples-native.git
ref: v2.3.0-spago-next
git: https://github.com/athanclark/purescript-tuples-native
ref: 9af22d1533725853df2a48009e63ea9e374b8abb
dependencies:
- console
- effect
- functions
- prelude
- tuples
- typelevel
- typelevel-prelude
var:
# git: https://github.com/zudov/purescript-var
git: https://github.com/garganscript/purescript-var
......@@ -41,6 +101,11 @@ workspace:
url-validator:
git: https://github.com/bbarker/purescript-url-validator
ref: master
dependencies:
- either
- maybe
- prelude
- strings
# for tests
spec-discovery:
......@@ -51,7 +116,13 @@ package:
name: gargantext
dependencies:
# debugging
- aff: ">=7.1.0 <8.0.0"
- refs
- typelevel-lists
- url-validator
- var
- web-socket
- websocket-simple
- aff: ">=8.0.0 <9.0.0"
- aff-promise: ">=4.0.0 <5.0.0"
- affjax: ">=13.0.0 <14.0.0"
- affjax-web: ">=1.0.0 <2.0.0"
......@@ -69,14 +140,14 @@ package:
- d3: "*"
- data-default: "*"
- datetime: ">=6.1.0 <7.0.0"
- debouncing: ">=0.1.0 <0.2.0"
- debouncing: ">=0.1.2 <0.2.0"
- debug: ">=6.0.2 <7.0.0"
- dom-filereader: ">=7.0.0 <8.0.0"
- dom-simple: ">=0.4.0 <0.5.0"
- effect: ">=4.0.0 <5.0.0"
- either: ">=6.1.0 <7.0.0"
- enums: ">=6.0.1 <7.0.0"
- exceptions: ">=6.0.0 <7.0.0"
- exceptions: ">=6.1.0 <7.0.0"
- ffi-simple: ">=0.5.1 <0.6.0"
- foldable-traversable: ">=6.0.0 <7.0.0"
- foreign: ">=7.0.0 <8.0.0"
......@@ -103,14 +174,13 @@ package:
- orders: ">=6.0.0 <7.0.0"
- parallel: ">=7.0.0 <8.0.0"
- partial: ">=4.0.0 <5.0.0"
- prelude: ">=6.0.1 <7.0.0"
- prelude: ">=6.0.2 <7.0.0"
- profunctor-lenses: ">=8.0.0 <9.0.0"
- random: ">=6.0.0 <7.0.0"
- react: ">=11.0.0 <12.0.0"
- reactix: ">=0.6.1 <0.7.0"
- record: ">=4.0.0 <5.0.0"
- record-extra: ">=5.0.1 <6.0.0"
- refs
- routing: ">=11.0.0 <12.0.0"
- sequences: "*"
- simple-json: ">=9.0.0 <10.0.0"
......@@ -121,7 +191,7 @@ package:
- stringutils: ">=0.0.12 <0.0.13"
- these: ">=6.0.0 <7.0.0"
- toestand: ">=0.9.0 <0.10.0"
- transformers: ">=6.0.0 <7.0.0"
- transformers: ">=6.1.0 <7.0.0"
- tuples: ">=7.0.0 <8.0.0"
- tuples-native: "*"
- typelevel: ">=6.0.0 <7.0.0"
......@@ -130,17 +200,13 @@ package:
- unordered-collections: ">=3.1.0 <4.0.0"
- unsafe-coerce: ">=6.0.0 <7.0.0"
- uri: ">=9.0.0 <10.0.0"
- url-validator
- uuid: ">=9.0.0 <10.0.0"
- validation: ">=6.0.0 <7.0.0"
- var
- web-file: ">=4.0.0 <5.0.0"
- web-html: ">=4.1.0 <5.0.0"
- web-socket
- web-storage: ">=5.0.0 <6.0.0"
- web-url: ">=2.0.0 <3.0.0"
- web-xhr: ">=5.0.1 <6.0.0"
- websocket-simple
build:
# Be strict about missing packages
......
......@@ -451,7 +451,7 @@ uploadFile' nodeType fileType fileFormat lang mName contents p@{ boxes: { errors
eTask <- uploadFile { contents, fileFormat, fileType, id, lang, mName, nodeType, selection, session }
handleRESTError (R2.herePrefix here "[uploadFile']") errors eTask $ \task -> liftEffect $ do
-- GAT.insert id task tasks
here.log "[uplaodFile'] TODO: IMPLEMENT ME!"
here.log "[uploadFile'] TODO: IMPLEMENT ME!"
here.log2 "[uploadFile'] UploadFile, uploaded, task:" task
closeBox p
......@@ -459,13 +459,13 @@ uploadArbitraryFile' fileFormat mName blob { boxes: { errors, tasks }, session,
eTask <- uploadArbitraryFile session id { blob, fileFormat, mName }
handleRESTError (R2.herePrefix here "[uploadArbitraryFile']") errors eTask $ \task -> liftEffect $ do
-- GAT.insert id task tasks
here.log "[uplaodArbitraryFile'] TODO: IMPLEMENT ME!"
here.log "[uploadArbitraryFile'] TODO: IMPLEMENT ME!"
uploadFrameCalc' lang { boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadFrameCalc session id lang selection
handleRESTError (R2.herePrefix here "[uploadFrameCalc']") errors eTask $ \task -> liftEffect $ do
-- GAT.insert id task tasks
here.log "[uplaodFrameCalc'] TODO: IMPLEMENT ME!"
here.log "[uploadFrameCalc'] TODO: IMPLEMENT ME!"
moveNode params p@{ boxes: { errors, forestOpen }, session } = traverse_ f params
where
......
......@@ -26,12 +26,14 @@ import Gargantext.Sessions (Session(..))
import Gargantext.Types (NodeType)
import Gargantext.Utils.Reactix as R2
import GraphQL.Client.BaseClients.Urql (UrqlClient, createClient)
import GraphQL.Client.Operation (OpMutation, OpQuery)
import GraphQL.Client.Query (decodeGqlRes) --, mutationJson)
import GraphQL.Client.SafeQueryName (safeQueryName)
import GraphQL.Client.ToGqlString (toGqlQueryString)
import GraphQL.Client.Types (class GqlQuery, Client(..), class QueryClient, clientQuery, defQueryOpts, clientMutation, defMutationOpts)
import GraphQL.Client.Variables (class VarsTypeChecked, getVarsJson, getVarsTypeNames)
import Simple.JSON as JSON
import Type.Data.List (Nil')
import Type.Proxy (Proxy(..))
import Unsafe.Coerce (unsafeCoerce)
......@@ -43,19 +45,19 @@ type E a = Either JsonDecodeError a
-- | Run a graphQL query with a custom decoder
gqlQuery
:: forall client schema query returns a b queryOpts mutationOpts
:: forall client directives schema query returns queryOpts mutationOpts sr
. QueryClient client queryOpts mutationOpts
=> GqlQuery schema query returns
=> GqlQuery directives OpQuery schema query returns
-- VarsTypeChecked query =>
=> JSON.ReadForeign returns
--(queryOpts -> queryOpts) ->
=> Client client schema a b
=> (Client client { directives :: Proxy directives, query :: schema | sr })
-> String
-> query
-> REST.AffRESTError returns
gqlQuery (Client client) queryNameUnsafe q = do
let opts = defQueryOpts client
json <- clientQuery opts client queryName (getVarsTypeNames q <> toGqlQueryString q) (getVarsJson q)
json <- clientQuery opts client queryName (getVarsTypeNames (Proxy :: _ schema) q <> toGqlQueryString q) (getVarsJson (Proxy :: _ schema) q)
pure $ parseGQLJson json
where
......@@ -63,19 +65,18 @@ gqlQuery (Client client) queryNameUnsafe q = do
-- | Run a graphQL mutation with a custom decoder
gqlMutation
:: forall client schema query returns qOpts mOpts a b
:: forall client directives schema query returns qOpts mOpts sr
. QueryClient client qOpts mOpts
=> GqlQuery schema query returns
=> VarsTypeChecked query
=> GqlQuery directives OpMutation schema query returns
=> VarsTypeChecked schema query
=> JSON.ReadForeign returns
=> Client client a schema b
-> Proxy schema
=> (Client client { directives :: Proxy directives, mutation :: schema | sr })
-> String
-> query
-> REST.AffRESTError returns
gqlMutation (Client client) _ queryNameUnsafe q = do
gqlMutation (Client client) queryNameUnsafe q = do
let opts = defMutationOpts client
json <- clientMutation opts client queryName (getVarsTypeNames q <> toGqlQueryString q) (getVarsJson q)
json <- clientMutation opts client queryName (getVarsTypeNames (Proxy :: _ schema) q <> toGqlQueryString q) (getVarsJson (Proxy :: _ schema) q)
liftEffect $ here.log2 "[gqlMutation] json" json
......@@ -110,7 +111,7 @@ parseGQLJson json =
toJsonError :: Foreign.MultipleErrors -> JsonDecodeError
toJsonError = unsafeCoerce -- map ForeignErrors to JsonDecodeError as you wish
getClient :: Session -> Effect (Client UrqlClient Schema Mutation Void)
getClient :: forall schema. Session -> Effect (Client UrqlClient schema)
getClient (Session { token, backend: Backend b }) = createClient { headers, url: b.baseUrl <> "/gql" }
where
headers =
......@@ -120,7 +121,7 @@ getClient (Session { token, backend: Backend b }) = createClient { headers, url:
queryGql
:: forall query returns
. GqlQuery Schema query returns
. GqlQuery Nil' OpQuery Schema query returns
=> JSON.ReadForeign returns
=> Session
-> String
......@@ -128,11 +129,11 @@ queryGql
-> REST.AffRESTError returns
queryGql session name q = do
client <- liftEffect $ getClient session
gqlQuery (client :: Client UrqlClient Schema Mutation Void) name q
gqlQuery (client :: Client UrqlClient { directives :: Proxy Nil', query :: Schema | _ }) name q
mutationGql
:: forall query returns
. GqlQuery Mutation query returns
. GqlQuery Nil' OpMutation Mutation query returns
=> JSON.ReadForeign returns
=> Session
-> String
......@@ -140,7 +141,7 @@ mutationGql
-> REST.AffRESTError returns
mutationGql session name q = do
client <- liftEffect $ getClient session
gqlMutation (client :: Client UrqlClient Schema Mutation Void) (Proxy :: Proxy Mutation) name q
gqlMutation (client :: Client UrqlClient { directives :: Proxy Nil', mutation :: Mutation | _ }) name q
-- mutationJson (defQueryOpts client) (client :: Client UrqlClient Schema Mutation Void) name q
......@@ -149,7 +150,7 @@ type Schema =
{ annuaire_contacts :: { contact_id :: Int } -> Array AnnuaireContact
, context_ngrams :: { context_id :: Int, list_id :: Int } -> Array String
, contexts :: { context_id :: Int, node_id :: Int } -> Array GQLCTX.NodeContext
, contexts_for_ngrams :: { corpus_id :: Int, ngrams_terms :: Array String, and_logic :: String } -> Array GQLCTX.Context
, contexts_for_ngrams :: { corpus_id :: Int, ngrams_terms :: GQLCTX.NgramsTerms, and_logic :: String } -> Array GQLCTX.Context
, imt_schools :: {} -> Array GQLIMT.School
, languages :: {} -> Array GQLNLP.Language
, node_children :: { node_id :: Int, child_type :: NodeType } -> Array GQLNode.Node
......
......@@ -13,12 +13,14 @@ module Gargantext.Components.GraphQL.Context
) where
import Data.Argonaut (class EncodeJson, encodeJson)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe)
import Data.Newtype (class Newtype)
import Gargantext.Prelude
import Gargantext.Utils.GraphQL as GGQL
import GraphQL.Client.Args (Args, NotNull, (=>>), class ArgGql)
import GraphQL.Client.Variable (Var(..))
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import GraphQL.Client.GqlType (class GqlType)
import Type.Proxy (Proxy(..))
type Context_ =
......@@ -166,9 +168,10 @@ type NodeContextCategoryM =
newtype NgramsTerms = NgramsTerms (Array String)
derive instance Newtype NgramsTerms _
derive instance Generic NgramsTerms _
instance EncodeJson NgramsTerms where
encodeJson (NgramsTerms ngramsTerms) = encodeJson ngramsTerms
instance ArgGql String NgramsTerms
instance VarTypeName NgramsTerms where
varTypeName _ = "[String!]!"
-- instance ArgGql String NgramsTerms
instance GqlType NgramsTerms "[String!]!"
......@@ -3,6 +3,7 @@ module Gargantext.Components.Nodes.Annuaire.User
, userLayout
) where
import Data.Bifunctor (rmap)
import Data.Either (Either(..))
import Data.Lens as L
import Data.Maybe (Maybe(..), fromMaybe)
......@@ -10,7 +11,7 @@ import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.App.Store as AppStore
import Gargantext.Components.GraphQL (getClient)
import Gargantext.Components.GraphQL (getClient, mutationGql)
import Gargantext.Components.GraphQL.Endpoints (getUserInfo, getUser, updateUserPubmedAPIKey, updateUserEPOAPIUser, updateUserEPOAPIToken)
import Gargantext.Components.GraphQL.User (UserInfo, _ui_cwCity, _ui_cwCountry, _ui_cwFirstName, _ui_cwLabTeamDeptsFirst, _ui_cwLastName, _ui_cwOffice, _ui_cwOrganizationFirst, _ui_cwRole, _ui_cwTouchMail, _ui_cwTouchPhone, _ui_cwDescription)
import Gargantext.Components.InputWithEnter (inputWithEnter)
......@@ -24,7 +25,7 @@ import Gargantext.Types (CorpusId, FrontendError)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import GraphQL.Client.Args (IgnoreArg(..), OrArg(..), onlyArgs)
import GraphQL.Client.Query (mutation)
-- import GraphQL.Client.Query (mutation)
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
......@@ -485,9 +486,8 @@ itemEditingCpt = here.component "itemNotEditing" cpt
saveUserInfo :: Session -> Int -> UserInfo -> AffRESTError Int
saveUserInfo session id ui = do
let token = getToken session
client <- liftEffect $ getClient session
res <- mutation
client
eRes <- mutationGql
session
"update user_info"
{ update_user_info: onlyArgs
{ token: token
......@@ -505,7 +505,7 @@ saveUserInfo session id ui = do
, ui_cwDescription: ga ui.ui_cwDescription
}
}
pure $ Right res.update_user_info
pure $ rmap (_.update_user_info) eRes
where
ga Nothing = ArgL IgnoreArg
ga (Just val) = ArgR val
......
......@@ -10,7 +10,6 @@ import Gargantext.Types (ChartOpts, ChartType, CorpusMetricOpts, CTabNgramType,
import Gargantext.Types as GT
import Gargantext.Utils.SimpleJSON (encodeJsonArgonaut)
import GraphQL.Client.Args (class ArgGql)
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import Simple.JSON as JSON
data AppRoute
......
......@@ -20,7 +20,7 @@ import Gargantext.Config.REST (RESTError, AffRESTError)
import Gargantext.Utils.Glyphicon (classNamePrefix, glyphiconToCharCode)
import Gargantext.Utils.SimpleJSON (encodeJsonArgonaut)
import GraphQL.Client.Args (class ArgGql)
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import GraphQL.Client.GqlType (class GqlType)
import Prim.Row (class Union)
import Reactix as R
import Simple.JSON as JSON
......@@ -195,10 +195,9 @@ instance JSON.WriteForeign NodeType where
instance Argonaut.EncodeJson NodeType where
encodeJson = encodeJsonArgonaut
instance ArgGql String NodeType
instance ArgGql NodeType NodeType
instance VarTypeName NodeType where
varTypeName _ = "NodeType!"
-- instance ArgGql String NodeType
-- instance ArgGql NodeType NodeType
instance GqlType NodeType "NodeType!"
instance Show NodeType where
show NodeUser = "NodeUser"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment