Skip to content

Commit e2ff960

Browse files
committed
Go
1 parent f6d329f commit e2ff960

File tree

5 files changed

+27
-14
lines changed

5 files changed

+27
-14
lines changed

packages/handlers/postgraphile/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export default class PostGraphileHandler implements MeshHandler {
135135
defaultExportName: 'default',
136136
});
137137
if (typeof contextOptions !== 'function') contextOptions = () => ({});
138-
138+
139139
return {
140140
schema,
141141
executor({

packages/handlers/postgraphile/yaml-config.graphql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ type PostGraphileHandler @md {
3838
Enables live-query support via GraphQL subscriptions (sends updated payload any time nested collections/records change) (default: true)
3939
"""
4040
live: Boolean
41+
"""
42+
A file that exports a function which takes context as a paramter and returns postgraphile context options (e.g. "./my-function#pgSettings"). See the [postgraphile docs](https://www.graphile.org/postgraphile/usage-schema/) for more information.
43+
"""
44+
contextOptions: Any
4145
}
4246

4347
union PostgraphileExternalOptions = JSON | String

packages/types/src/config-schema.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2881,6 +2881,22 @@
28812881
"live": {
28822882
"type": "boolean",
28832883
"description": "Enables live-query support via GraphQL subscriptions (sends updated payload any time nested collections/records change) (default: true)"
2884+
},
2885+
"contextOptions": {
2886+
"anyOf": [
2887+
{
2888+
"type": "object",
2889+
"additionalProperties": true
2890+
},
2891+
{
2892+
"type": "string"
2893+
},
2894+
{
2895+
"type": "array",
2896+
"additionalItems": true
2897+
}
2898+
],
2899+
"description": "A file that exports a function which takes context as a paramter and returns postgraphile context options (e.g. \"./my-function#pgSettings\"). See the [postgraphile docs](https://www.graphile.org/postgraphile/usage-schema/) for more information."
28842900
}
28852901
}
28862902
},

packages/types/src/config.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -896,18 +896,6 @@ export interface PostGraphileHandler {
896896
[k: string]: any;
897897
}
898898
| string;
899-
/**
900-
* A function which takes context as a paramter and returns postgraphile context options. It can either be a function or a string pointing to the function's path (e.g. "./my-function#pgSettings"). See the [postgraphile docs](https://www.graphile.org/postgraphile/usage-schema/) for more information. (Any of: Function, String)
901-
*/
902-
contextOptions?: (context: any) => {
903-
jwtToken?: string;
904-
jwtSecret?: string;
905-
jwtAudiences?: string;
906-
jwtRole?: string;
907-
jwtVerifyOptions?: any;
908-
pgDefaultRole?: string;
909-
pgSettings?: {}
910-
} | string;
911899
/**
912900
* Enable GraphQL websocket transport support for subscriptions (default: true)
913901
*/
@@ -916,6 +904,10 @@ export interface PostGraphileHandler {
916904
* Enables live-query support via GraphQL subscriptions (sends updated payload any time nested collections/records change) (default: true)
917905
*/
918906
live?: boolean;
907+
/**
908+
* A file that exports a function which takes context as a paramter and returns postgraphile context options (e.g. "./my-function#pgSettings"). See the [postgraphile docs](https://www.graphile.org/postgraphile/usage-schema/) for more information.
909+
*/
910+
contextOptions?: any;
919911
}
920912
export interface RAMLHandler {
921913
source: string;

website/src/generated-markdown/PostGraphileHandler.generated.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
* `JSON`
99
* `String`
1010
* `subscriptions` (type: `Boolean`) - Enable GraphQL websocket transport support for subscriptions (default: true)
11-
* `live` (type: `Boolean`) - Enables live-query support via GraphQL subscriptions (sends updated payload any time nested collections/records change) (default: true)
11+
* `live` (type: `Boolean`) - Enables live-query support via GraphQL subscriptions (sends updated payload any time nested collections/records change) (default: true)
12+
* `contextOptions` (type: `Any`) - A file that exports a function which takes context as a paramter and returns postgraphile context options (e.g. "./my-function#pgSettings"). See the [postgraphile docs](https://www.graphile.org/postgraphile/usage-schema/) for more information.

0 commit comments

Comments
 (0)