You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a Postgres schema to be introspected. Use commas to define multiple schemas
106
106
*`-S`, `--subscriptions`
107
-
Enable GraphQL websocket transport support for subscriptions (you still need a subscriptions plugin currently)
107
+
Enable GraphQL support for subscriptions (you still need a subscriptions plugin currently)
108
+
*`--websockets <string>`
109
+
Choose which websocket transport libraries to use. Use commas to define multiple. Defaults to 'v0,v1' if `--subscriptions` or `--live` were passed, '[]' otherwise
110
+
*`--websocket-operations <operations>`
111
+
Toggle which GraphQL websocket transport operations are supported: 'subscriptions' or 'all'. Defaults to 'subscriptions'
108
112
*`-L`, `--live`
109
113
[EXPERIMENTAL] Enables live-query support via GraphQL subscriptions (sends updated payload any time nested collections/records change). Implies --subscriptions
This function takes the same options as `createPostGraphileSchema`; but with
180
-
one addition: a function `onNewSchema` that is called every time a new schema is
184
+
This function takes the same options as `createPostGraphileSchema`; but with one
185
+
addition: a function `onNewSchema` that is called every time a new schema is
181
186
generated, passing the new schema as the first argument. `onNewSchema` is
182
187
guaranteed to be called before the `watchPostGraphileSchema` promise resolves.
183
188
It resolves to an asynchronus function that can be called to stop listening for
@@ -245,18 +250,26 @@ look at the `postgraphile-core` and `graphile-build-pg` modules.
245
250
You can issue GraphQL requests from various contexts, including within a
246
251
resolver. To do so you need the following:
247
252
248
-
* Access to the `graphql` function from the `graphql` module
249
-
* In a PostGraphile plugin, if you have access to the build object (which you usually will), you should get this from `build.graphql.graphql`
250
-
* Failing that, you can `import { graphql } from 'graphql'` or `const { graphql } = require('graphql')`, but this has caveats.
251
-
* A reference to the GraphQL schema object. You can get this from many sources:
252
-
* in a resolver, you should extract it from `info.schema`
253
-
* if you have access to the PostGraphile middleware, you can issue `await postgraphileMiddleware.getGqlSchema()`
254
-
* if you don't need the PostGraphile middleware, you can use `await createPostGraphileSchema(...)` - see [schema only usage](/postgraphile/usage-schema/) - do this once and cache it because it's expensive to compute
255
-
* A GraphQL operation (aka query, but includes mutations, subscriptions) to execute; this can be a string or an AST
256
-
* The variables to feed to the operation (if necessary)
257
-
* A valid GraphQL context for PostGraphile
258
-
* inside a resolver, you can just pass the resolver's context straight through
259
-
* in other situations, have a look at `withPostGraphileContext` in the [schema only usage](/postgraphile/usage-schema/)
253
+
- Access to the `graphql` function from the `graphql` module
254
+
- In a PostGraphile plugin, if you have access to the build object (which you
255
+
usually will), you should get this from `build.graphql.graphql`
256
+
- Failing that, you can `import { graphql } from 'graphql'` or
257
+
`const { graphql } = require('graphql')`, but this has caveats.
258
+
- A reference to the GraphQL schema object. You can get this from many sources:
259
+
- in a resolver, you should extract it from `info.schema`
260
+
- if you have access to the PostGraphile middleware, you can issue
261
+
`await postgraphileMiddleware.getGqlSchema()`
262
+
- if you don't need the PostGraphile middleware, you can use
263
+
`await createPostGraphileSchema(...)` - see
264
+
[schema only usage](/postgraphile/usage-schema/) - do this once and cache it
265
+
because it's expensive to compute
266
+
- A GraphQL operation (aka query, but includes mutations, subscriptions) to
267
+
execute; this can be a string or an AST
268
+
- The variables to feed to the operation (if necessary)
269
+
- A valid GraphQL context for PostGraphile
270
+
- inside a resolver, you can just pass the resolver's context straight through
271
+
- in other situations, have a look at `withPostGraphileContext` in the
272
+
[schema only usage](/postgraphile/usage-schema/)
260
273
261
274
Issuing a GraphQL operation from inside a resolver example:
0 commit comments