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