Skip to content

Commit

Permalink
Merge pull request #137 from bakhtiyarneyman/main
Browse files Browse the repository at this point in the history
A bunch of improvements
  • Loading branch information
roryc89 authored Jun 17, 2024
2 parents e459880 + 7fa9862 commit 977598e
Show file tree
Hide file tree
Showing 65 changed files with 236 additions and 102 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ queryGql ::
GqlQuery Nil' OpQuery Schema query returns =>
DecodeJson returns =>
String -> query -> Aff returns
queryGql = query_ "http://localhost:4000/graphql" (Proxy :: Proxy Schema)
queryGql = query_ "http://localhost:4892/graphql" (Proxy :: Proxy Schema)
-- Schema
type Schema
Expand Down Expand Up @@ -129,7 +129,7 @@ const { generateSchema } = require('purescript-graphql-client')
generateSchema({
dir: './src/generated', // Where you want the generated code to go
modulePath: ['Generated', 'Gql'], // The name of the generated module
url: 'http://localhost:4000/graphql' // Your graphql enppdint
url: 'http://localhost:4892/graphql' // Your graphql enppdint
})
```

Expand All @@ -148,7 +148,7 @@ generateSchemas({
modulePath: ['Generated', 'Gql']
}, [
{
url: 'http://localhost:4000/graphql',
url: 'http://localhost:4892/graphql',
moduleName: 'MySchema' // The name of the module for this single schema
}
])
Expand Down Expand Up @@ -187,7 +187,7 @@ import Type.Data.List (Nil')
...
client :: Client _ Nil' Query Mutation Void <- createClient
{ url: "http://localhost:4000/graphql"
{ url: "http://localhost:4892/graphql"
, authToken: Nothing
, headers: []
}
Expand Down Expand Up @@ -217,10 +217,10 @@ import Type.Data.List (Nil')
client :: Client _ Nil' Query Mutation Subscription <-
createSubscriptionClient
{ url: "http://localhost:4000/graphql"
{ url: "http://localhost:4892/graphql"
, authToken: Nothing
, headers: []
, websocketUrl: "ws://localhost:4000/subscriptions"
, websocketUrl: "ws://localhost:4892/subscriptions"
}
let
event = subscription client "get_props"
Expand Down Expand Up @@ -478,5 +478,3 @@ Although the names and scope of the 2 packages are very similar they are not con
- This package uses record syntax to make queries whereas purescript-graphqlclient uses applicative/ado syntax
- This package allows use of Apollo if you wish (or other lower level graphQL clients)
- This package supports subscriptions, watch queries and client caching


6 changes: 3 additions & 3 deletions e2e/1-affjax/server-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = (onListening) => {
prop: String
widgets(id: Int): [Widget!]!
}
type Widget {
type Widget {
id: Int
name: String!
}
Expand Down Expand Up @@ -38,5 +38,5 @@ module.exports = (onListening) => {
graphiql: true
}))

app.listen(4000, onListening)
app.listen(4892, onListening)
}
2 changes: 1 addition & 1 deletion e2e/1-affjax/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import serverFn from './server-fn.js'
serverFn(() => {
console.info('Running a GraphQL API server at http://localhost:4000/graphql')
console.info('Running a GraphQL API server at http://localhost:4892/graphql')
})
2 changes: 1 addition & 1 deletion e2e/1-affjax/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ client
, mutation :: Void
, subscription :: Void
}
client = (Client $ AffjaxNodeClient "http://localhost:4000/graphql" [])
client = (Client $ AffjaxNodeClient "http://localhost:4892/graphql" [])

-- Schema
type Schema =
Expand Down
2 changes: 1 addition & 1 deletion e2e/2-comments/generate-purs-schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default () =>
useNewtypesForRecords: true
}, [
{
url: 'http://localhost:4000/graphql',
url: 'http://localhost:4892/graphql',
moduleName: 'Admin'
}
])
2 changes: 1 addition & 1 deletion e2e/2-comments/server-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ module.exports = (onListening) => {
graphiql: true
}))

app.listen(4000, onListening)
app.listen(4892, onListening)
}
2 changes: 1 addition & 1 deletion e2e/2-comments/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import serverFn from './server-fn.js'
serverFn(() => {
console.info('Running a GraphQL API server at http://localhost:4000/graphql')
console.info('Running a GraphQL API server at http://localhost:4892/graphql')
})
2 changes: 1 addition & 1 deletion e2e/2-comments/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ queryGql ::
GqlQuery Nil' OpQuery Query query returns =>
DecodeJson returns =>
String -> query -> Aff returns
queryGql = query_ "http://localhost:4000/graphql" (Proxy :: Proxy Query)
queryGql = query_ "http://localhost:4892/graphql" (Proxy :: Proxy Query)
6 changes: 3 additions & 3 deletions examples/1-simple/server-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = (onListening) => {
prop: String
widgets(id: Int): [Widget!]!
}
type Widget {
type Widget {
id: Int
name: String!
}
Expand Down Expand Up @@ -38,5 +38,5 @@ module.exports = (onListening) => {
graphiql: true
}))

app.listen(4000, onListening)
app.listen(4892, onListening)
}
2 changes: 1 addition & 1 deletion examples/1-simple/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import serverFn from './server-fn.js'
serverFn(() => {
console.info('Running a GraphQL API server at http://localhost:4000/graphql')
console.info('Running a GraphQL API server at http://localhost:4892/graphql')
})
2 changes: 1 addition & 1 deletion examples/1-simple/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ queryGql ::
GqlQuery Nil' OpQuery Schema query returns =>
DecodeJson returns =>
String -> query -> Aff returns
queryGql = query_ "http://localhost:4000/graphql" (Proxy :: Proxy Schema)
queryGql = query_ "http://localhost:4892/graphql" (Proxy :: Proxy Schema)

-- Schema
type Schema
Expand Down
6 changes: 3 additions & 3 deletions examples/10-aliases/server-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = (onListening) => {
prop: String
widgets(id: Int): [Widget!]!
}
type Widget {
type Widget {
id: Int
name: String!
}
Expand Down Expand Up @@ -38,5 +38,5 @@ module.exports = (onListening) => {
graphiql: true
}))

app.listen(4000, onListening)
app.listen(4892, onListening)
}
2 changes: 1 addition & 1 deletion examples/10-aliases/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import serverFn from './server-fn.js'
serverFn(() => {
console.info('Running a GraphQL API server at http://localhost:4000/graphql')
console.info('Running a GraphQL API server at http://localhost:4892/graphql')
})
2 changes: 1 addition & 1 deletion examples/10-aliases/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ queryGql ::
GqlQuery Nil' OpQuery Schema query returns =>
DecodeJson returns =>
String -> query -> Aff returns
queryGql = query_ "http://localhost:4000/graphql" (Proxy :: Proxy Schema)
queryGql = query_ "http://localhost:4892/graphql" (Proxy :: Proxy Schema)

-- Schema
type Schema
Expand Down
2 changes: 1 addition & 1 deletion examples/11-unions/generate-purs-schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default () =>
useNewtypesForRecords: false
}, [
{
url: 'http://localhost:4000/graphql',
url: 'http://localhost:4892/graphql',
moduleName: 'Admin'
}
])
4 changes: 2 additions & 2 deletions examples/11-unions/server-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = (onListening) => {
height: 1.8,
id: 1,
};
}else {
}else {
return {
__typename: "Droid",
name: "R2D2",
Expand All @@ -54,5 +54,5 @@ module.exports = (onListening) => {
})
);

app.listen(4000, onListening);
app.listen(4892, onListening);
};
2 changes: 1 addition & 1 deletion examples/11-unions/server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require('./server-fn')(() => {
console.info('Running a GraphQL API server at http://localhost:4000/graphql')
console.info('Running a GraphQL API server at http://localhost:4892/graphql')
})
2 changes: 1 addition & 1 deletion examples/11-unions/spago.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ You can edit this file as you like.
{ name = "my-project"
, dependencies = ../../test-deps.dhall
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs", "../../src/**/*.purs" ]
, sources = [ "src/**/*.purs", "../../src/**/*.purs" ]
}
4 changes: 2 additions & 2 deletions examples/11-unions/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import Effect.Aff (Aff, launchAff_)
import Effect.Class.Console (logShow)
import Generated.Gql.Schema.Admin (Query)
import GraphQL.Client.Args ((=>>))
import GraphQL.Client.Query (query_)
import GraphQL.Client.Operation (OpQuery)
import GraphQL.Client.Query (query_)
import GraphQL.Client.Types (class GqlQuery)
import GraphQL.Client.Union (GqlUnion(..))
import Type.Data.List (Nil')
Expand Down Expand Up @@ -39,4 +39,4 @@ queryGql
=> String
-> query
-> Aff returns
queryGql = query_ "http://localhost:4000/graphql" (Proxy :: Proxy Query)
queryGql = query_ "http://localhost:4892/graphql" (Proxy :: Proxy Query)
2 changes: 1 addition & 1 deletion examples/12-directives/generate-purs-schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default () =>
useNewtypesForRecords: false
}, [
{
url: 'http://localhost:4000/graphql',
url: 'http://localhost:4892/graphql',
moduleName: 'Admin'
}
])
8 changes: 4 additions & 4 deletions examples/12-directives/server-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = (onListening) => {
directive @cached(
"""measured in seconds"""
ttl: Int = 60
"""refresh the cache entry"""
refresh: Boolean = false
) on QUERY
Expand All @@ -18,8 +18,8 @@ module.exports = (onListening) => {
prop: String
widgets(id: Int): [Widget!]!
}
type Widget {
type Widget {
id: Int
name: String!
}
Expand Down Expand Up @@ -47,5 +47,5 @@ module.exports = (onListening) => {
graphiql: true
}))

app.listen(4000, onListening)
app.listen(4892, onListening)
}
2 changes: 1 addition & 1 deletion examples/12-directives/server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require('./server-fn')(() => {
console.info('Running a GraphQL API server at http://localhost:4000/graphql')
console.info('Running a GraphQL API server at http://localhost:4892/graphql')
})
2 changes: 1 addition & 1 deletion examples/12-directives/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ queryGql ::
GqlQuery Directives OpQuery Query query returns =>
DecodeJson returns =>
String -> query -> Aff returns
queryGql = query_ "http://localhost:4000/graphql" (Proxy :: Proxy Query)
queryGql = query_ "http://localhost:4892/graphql" (Proxy :: Proxy Query)
6 changes: 3 additions & 3 deletions examples/13-error-boundaries/server-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module.exports = (onListening) => {
prop: String
widgets(id: Int): [Widget!]!
}
type Widget {
type Widget {
id: Int
name: String!
contains_bad_type: BadType
Expand Down Expand Up @@ -51,5 +51,5 @@ module.exports = (onListening) => {
})
);

app.listen(4000, onListening);
app.listen(4892, onListening);
};
2 changes: 1 addition & 1 deletion examples/13-error-boundaries/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import serverFn from './server-fn.js'
serverFn(() => {
console.info('Running a GraphQL API server at http://localhost:4000/graphql')
console.info('Running a GraphQL API server at http://localhost:4892/graphql')
})
2 changes: 1 addition & 1 deletion examples/13-error-boundaries/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ queryGql name_ q = do
client <-
liftEffect
$ createClient
{ url: "http://localhost:4000/graphql"
{ url: "http://localhost:4892/graphql"
, headers: []
}
queryFullRes decodeJson identity (client :: Client UrqlClient { directives :: Proxy Nil', query :: Schema | _ }) name_ q
Expand Down
2 changes: 1 addition & 1 deletion examples/2-codegen/generate-purs-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export default () =>
dir: './src/generated',
modulePath: ['Generated', 'Gql', 'Admin'],
useNewtypesForRecords: false,
url: 'http://localhost:4000/graphql'
url: 'http://localhost:4892/graphql'
})
2 changes: 1 addition & 1 deletion examples/2-codegen/generate-purs-schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export default () =>
dir: './src/generated',
modulePath: ['Generated', 'Gql', 'Admin'],
useNewtypesForRecords: false,
url: 'http://localhost:4000/graphql'
url: 'http://localhost:4892/graphql'
})
6 changes: 3 additions & 3 deletions examples/2-codegen/server-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = (onListening) => {
prop: String
widgets(id: ID): [Widget!]!
}
type Widget {
type Widget {
id: ID
int: Int
name: String!
Expand Down Expand Up @@ -39,5 +39,5 @@ module.exports = (onListening) => {
graphiql: true
}))

app.listen(4000, onListening)
app.listen(4892, onListening)
}
2 changes: 1 addition & 1 deletion examples/2-codegen/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import serverFn from './server-fn.js'
serverFn(() => {
console.info('Running a GraphQL API server at http://localhost:4000/graphql')
console.info('Running a GraphQL API server at http://localhost:4892/graphql')
})
2 changes: 1 addition & 1 deletion examples/2-codegen/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ queryGql ::
GqlQuery Nil' OpQuery Query query returns =>
DecodeJson returns =>
String -> query -> Aff returns
queryGql = query_ "http://localhost:4000/graphql" (Proxy :: Proxy Query)
queryGql = query_ "http://localhost:4892/graphql" (Proxy :: Proxy Query)
2 changes: 1 addition & 1 deletion examples/3-enums/generate-purs-schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default () =>
useNewtypesForRecords: false
}, [
{
url: 'http://localhost:4000/graphql',
url: 'http://localhost:4892/graphql',
moduleName: 'Admin'
}
])
2 changes: 1 addition & 1 deletion examples/3-enums/server-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ module.exports = (onListening) => {
graphiql: true
}))

app.listen(4000, onListening)
app.listen(4892, onListening)
}
2 changes: 1 addition & 1 deletion examples/3-enums/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import serverFn from './server-fn.js'
serverFn(() => {
console.info('Running a GraphQL API server at http://localhost:4000/graphql')
console.info('Running a GraphQL API server at http://localhost:4892/graphql')
})
4 changes: 2 additions & 2 deletions examples/3-enums/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main =
{ widgets } <-
queryGql "WidgetColoursWithId1"
{ widgets: { colour: RED } =>> { colour } }

-- Will log [ RED ] as there is one red widget
logShow $ map _.colour widgets

Expand All @@ -32,4 +32,4 @@ queryGql ::
GqlQuery Nil' OpQuery Query query returns =>
DecodeJson returns =>
String -> query -> Aff returns
queryGql = query_ "http://localhost:4000/graphql" (Proxy :: Proxy Query)
queryGql = query_ "http://localhost:4892/graphql" (Proxy :: Proxy Query)
Loading

0 comments on commit 977598e

Please sign in to comment.