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
Copy file name to clipboardexpand all lines: README.md
+3
Original file line number
Diff line number
Diff line change
@@ -160,6 +160,9 @@ Manage netlify functions
160
160
| Subcommand | description |
161
161
|:--------------------------- |:-----|
162
162
|[`graph:edit`](/docs/commands/graph.md#graphedit)| Launch the browser to edit your local graph functions from Netlify |
163
+
|[`graph:handler`](/docs/commands/graph.md#graphhandler)| Generate a handler for a Graph operation given its name. See `graph:operations` for a list of operations. |
164
+
|[`graph:library`](/docs/commands/graph.md#graphlibrary)| Generate the Graph function library |
165
+
|[`graph:operations`](/docs/commands/graph.md#graphoperations)| List all of the locally available operations |
163
166
|[`graph:pull`](/docs/commands/graph.md#graphpull)| Pull down your local Netlify Graph schema, and process pending Graph edit events |
Copy file name to clipboardexpand all lines: docs/README.md
+3
Original file line number
Diff line number
Diff line change
@@ -117,6 +117,9 @@ Manage netlify functions
117
117
| Subcommand | description |
118
118
|:--------------------------- |:-----|
119
119
|[`graph:edit`](/docs/commands/graph.md#graphedit)| Launch the browser to edit your local graph functions from Netlify |
120
+
|[`graph:handler`](/docs/commands/graph.md#graphhandler)| Generate a handler for a Graph operation given its name. See `graph:operations` for a list of operations. |
121
+
|[`graph:library`](/docs/commands/graph.md#graphlibrary)| Generate the Graph function library |
122
+
|[`graph:operations`](/docs/commands/graph.md#graphoperations)| List all of the locally available operations |
120
123
|[`graph:pull`](/docs/commands/graph.md#graphpull)| Pull down your local Netlify Graph schema, and process pending Graph edit events |
Copy file name to clipboardexpand all lines: docs/commands/graph.md
+58
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,9 @@ netlify graph
23
23
| Subcommand | description |
24
24
|:--------------------------- |:-----|
25
25
|[`graph:edit`](/docs/commands/graph.md#graphedit)| Launch the browser to edit your local graph functions from Netlify |
26
+
|[`graph:handler`](/docs/commands/graph.md#graphhandler)| Generate a handler for a Graph operation given its name. See `graph:operations` for a list of operations. |
27
+
|[`graph:library`](/docs/commands/graph.md#graphlibrary)| Generate the Graph function library |
28
+
|[`graph:operations`](/docs/commands/graph.md#graphoperations)| List all of the locally available operations |
26
29
|[`graph:pull`](/docs/commands/graph.md#graphpull)| Pull down your local Netlify Graph schema, and process pending Graph edit events |
27
30
28
31
@@ -50,6 +53,61 @@ netlify graph:edit
50
53
-`httpProxy` (*string*) - Proxy server address to route requests through.
51
54
-`httpProxyCertificateFilename` (*string*) - Certificate file to use when connecting using a proxy server
52
55
56
+
---
57
+
## `graph:handler`
58
+
59
+
Generate a handler for a Graph operation given its name. See `graph:operations` for a list of operations.
60
+
61
+
**Usage**
62
+
63
+
```bash
64
+
netlify graph:handler
65
+
```
66
+
67
+
**Arguments**
68
+
69
+
- name - Operation name
70
+
71
+
**Flags**
72
+
73
+
-`debug` (*boolean*) - Print debugging information
74
+
-`httpProxy` (*string*) - Proxy server address to route requests through.
75
+
-`httpProxyCertificateFilename` (*string*) - Certificate file to use when connecting using a proxy server
76
+
77
+
---
78
+
## `graph:library`
79
+
80
+
Generate the Graph function library
81
+
82
+
**Usage**
83
+
84
+
```bash
85
+
netlify graph:library
86
+
```
87
+
88
+
**Flags**
89
+
90
+
-`debug` (*boolean*) - Print debugging information
91
+
-`httpProxy` (*string*) - Proxy server address to route requests through.
92
+
-`httpProxyCertificateFilename` (*string*) - Certificate file to use when connecting using a proxy server
93
+
94
+
---
95
+
## `graph:operations`
96
+
97
+
List all of the locally available operations
98
+
99
+
**Usage**
100
+
101
+
```bash
102
+
netlify graph:operations
103
+
```
104
+
105
+
**Flags**
106
+
107
+
-`debug` (*boolean*) - Print debugging information
108
+
-`httpProxy` (*string*) - Proxy server address to route requests through.
109
+
-`httpProxyCertificateFilename` (*string*) - Certificate file to use when connecting using a proxy server
Copy file name to clipboardexpand all lines: docs/commands/index.md
+3
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,9 @@ Manage netlify functions
98
98
| Subcommand | description |
99
99
|:--------------------------- |:-----|
100
100
|[`graph:edit`](/docs/commands/graph.md#graphedit)| Launch the browser to edit your local graph functions from Netlify |
101
+
|[`graph:handler`](/docs/commands/graph.md#graphhandler)| Generate a handler for a Graph operation given its name. See `graph:operations` for a list of operations. |
102
+
|[`graph:library`](/docs/commands/graph.md#graphlibrary)| Generate the Graph function library |
103
+
|[`graph:operations`](/docs/commands/graph.md#graphoperations)| List all of the locally available operations |
101
104
|[`graph:pull`](/docs/commands/graph.md#graphpull)| Pull down your local Netlify Graph schema, and process pending Graph edit events |
* Keep track of which document hashes we've received from the server so we can ignore events from the filesystem based on them
37
+
*/
33
38
constwitnessedIncomingDocumentHashes=[]
34
39
35
-
// Keep track of which document hashes we've received from the server so we can ignore events from the filesystem based on them
36
40
InternalConsole.registerConsole(internalConsole)
37
41
38
42
/**
39
43
* Start polling for CLI events for a given session to process locally
40
44
* @param {object} input
41
45
* @param {string} input.appId The app to query against, typically the siteId
42
46
* @param {string} input.netlifyToken The (typically netlify) access token that is used for authentication, if any
43
-
* @param {NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
47
+
* @param {NetlifyGraph.NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
44
48
* @param {function} input.onClose A function to call when the polling loop is closed
45
49
* @param {function} input.onError A function to call when an error occurs
46
50
* @param {function} input.onEvents A function to call when CLI events are received and need to be processed
47
51
* @param {string} input.sessionId The session id to monitor CLI events for
48
-
* @param {state} input.state A function to call to set/get the current state of the local Netlify project
52
+
* @param {StateConfig} input.state A function to call to set/get the current state of the local Netlify project
* @param {NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
121
-
* @param {function} input.onAdd A callback function to handle when the operations document is added
122
-
* @param {function} input.onChange A callback function to handle when the operations document is changed
123
-
* @param {function} input.onUnlink A callback function to handle when the operations document is unlinked
124
-
* @returns {Promise<watcher>}
124
+
* @param {NetlifyGraph.NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
125
+
* @param {() => void} input.onAdd A callback function to handle when the operations document is added
126
+
* @param {() => void} input.onChange A callback function to handle when the operations document is changed
127
+
* @param {() => void=} input.onUnlink A callback function to handle when the operations document is unlinked
* @param {string} input.siteId The id of the site to query against
141
146
* @param {string} input.netlifyToken The (typically netlify) access token that is used for authentication, if any
142
-
* @param {NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
143
-
* @param {state} input.state A function to call to set/get the current state of the local Netlify project
147
+
* @param {NetlifyGraph.NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
148
+
* @param {StateConfig} input.state A function to call to set/get the current state of the local Netlify project
* Regenerate the function library based on the current operations document on disk
176
181
* @param {object} input
177
-
* @param {string} input.schema The GraphQL schema to use when generating code
178
-
* @param {NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
182
+
* @param {GraphQL.GraphQLSchema} input.schema The GraphQL schema to use when generating code
183
+
* @param {NetlifyGraph.NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
* @param {string} input.siteId The site id to query against
215
220
* @param {string} input.netlifyToken The (typically netlify) access token that is used for authentication, if any
216
221
* @param {string} input.docId The GraphQL operations document id to fetch
217
-
* @param {string} input.schema The GraphQL schema to use when generating code
218
-
* @param {NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
222
+
* @param {GraphQL.GraphQLSchema} input.schema The GraphQL schema to use when generating code
223
+
* @param {NetlifyGraph.NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
* Idemponentially save the CLI session id to the local state and start monitoring for CLI events, upstream schema changes, and local operation file changes
297
312
* @param {object} input
298
313
* @param {string} input.netlifyToken The (typically netlify) access token that is used for authentication, if any
299
-
* @param {NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
300
-
* @param {state} input.state A function to call to set/get the current state of the local Netlify project
301
-
* @param {site} input.site The site object
314
+
* @param {NetlifyGraph.NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
315
+
* @param {StateConfig} input.state A function to call to set/get the current state of the local Netlify project
316
+
* @param {any} input.site The site object
302
317
*/
303
318
conststartOneGraphCLISession=async(input)=>{
304
319
const{ netlifyGraphConfig, netlifyToken, site, state }=input
Copy file name to clipboardexpand all lines: tests/integration/assets/netlifyGraphOperationsLibrary.graphql
+387-6
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,391 @@
1
-
queryExampleQuery($package: String!) @netlify(id: "d86699fb-ddfc-4833-9d9a-f3497cb7c992", doc: "A test query to snapshot") {
2
-
npm {
3
-
package(name: $package) {
1
+
fragmentLoggedInServicesFragmentonOneGraphServiceMetadata@netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {
2
+
friendlyServiceName
3
+
service
4
+
isLoggedIn
5
+
usedTestFlow
6
+
serviceInfo {
7
+
logoUrl
8
+
availableScopes {
9
+
category
10
+
scope
11
+
display
12
+
isDefault
13
+
isRequired
14
+
description
15
+
title
16
+
}
17
+
}
18
+
grantedScopes {
19
+
scope
20
+
}
21
+
foreignUserId
22
+
}
23
+
24
+
fragmentServiceAuthFragmentonOneGraphServiceAuth@netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {
25
+
id
26
+
service
27
+
clientId
28
+
revealTokens
29
+
scopes
30
+
}
31
+
32
+
fragmentAppCORSOriginFragmentonOneGraphApp@netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {
33
+
id
34
+
corsOrigins
35
+
customCorsOrigins {
36
+
friendlyServiceName
37
+
displayName
38
+
encodedValue
39
+
}
40
+
netlifySiteNames
41
+
}
42
+
43
+
mutationUpdateCLISessionMetadataMutation($nfToken: String!, $sessionId: String!, $metadata: JSON!) @netlify(id: """16a58acb-8188-4a47-bc93-1f4a5ef805c0""", doc: """Modify the metadata of an existing CLI session (an intentionally untype bag of `JSON`).""") {
mutationDestroyTokenMutation($nfToken: String!, $token: String, $authlifyTokenId: String) @netlify(id: """3d069fc8-3a03-40c8-8637-ddcf33692c34""", doc: """Delete a OneGraph personal token for a user's site""") {
mutationSignOutServicesMutation($services: [OneGraphServiceEnum!]!, $nfToken: String!, $authlifyTokenId: String!) @netlify(id: """3d069fc8-3a03-40c8-8637-ddcf33692c99""", doc: """Sign out of a service associated with a Authlify token""") {
mutationCreateNewSchemaMutation($nfToken: String!, $input: OneGraphCreateGraphQLSchemaInput!) @netlify(id: """4fc2298a-225b-4329-b3f3-a8f8bc0513a8""", doc: """Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.""") {
mutationCreatePersistedQueryMutation($nfToken: String!, $appId: String!, $query: String!, $tags: [String!]!, $description: String!, $parent: OneGraphCreatePersistedQueryParentInput) @netlify(id: """5e855574-a316-4060-955c-85b1f8898c29""", doc: """Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.""") {
mutationCreateCLISessionEventMutation($nfToken: String!, $sessionId: String!, $payload: JSON!) @netlify(id: """6f42e462-7cbf-4d95-880b-16eb55ed7a1a""", doc: """Create a new session for the Netlify CLI to communicate with the React UI via events.""") {
queryDeprecated_FindLoggedInServicesQuery@netlify(id: """9ffe3872-4ae8-4f86-b5b7-ffcdfe7843fd""", doc: """(Deprecated) Find logged in services""") {
227
+
me {
228
+
serviceMetadata {
229
+
loggedInServices {
230
+
...LoggedInServicesFragment
231
+
}
232
+
}
233
+
}
234
+
}
235
+
236
+
mutationCreateEmptyPersonalTokenMutation($nfToken: String!, $siteId: String!) @netlify(id: """a64681f1-014c-4413-8a7d-b188c4dd5f55""", doc: """Create a new OneGraph personal token for a user's site""") {
queryServiceListQuery($logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) @netlify(id: """a6969eb4-5e17-43fb-a325-11566f7d1db3""", doc: """Retrieve a list of _all_ supported services from OneGraph""") {
queryCliSessionsByAppIdQuery($nfToken: String!, $appId: String!) @netlify(id: """e09d703b-468c-4c94-b098-f1ba09fdf692""", doc: """List all the CLI sessions belonging to a site""") {
queryListServicesQuery($nfToken: String!, $siteId: String!, $logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) @netlify(id: """e2394c86-260c-4646-88df-7bc7370de666""", doc: """Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.""") {
mutationUpsertAppForSiteMutation($nfToken: String!, $siteId: String!) @netlify(id: """e3d3bb8b-2fb5-48d8-b051-db602722419f""", doc: """Ensure that an app resource exists on the OneGraph servers for a given site.""") {
mutationAddCORSOriginMutation($nfToken: String!, $input: OneGraphAddCORSOriginToAppInput!) @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224101""", doc: """Add additional allowed CORS origins for calls to a site's Graph.""") {
mutationRemoveCORSOriginMutation($nfToken: String!, $input: OneGraphRemoveCORSOriginFromAppInput!) @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224112""", doc: """Remove the given CORS origins for calls to a site's Graph.""") {
queryCORSOriginsQuery($siteId: String!, $nfToken: String!) @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224190""", doc: """List the allowed CORS origins for calls to a site's Graph.""") {
subscriptionTestSubscription($minutes: Int = 1) @netlify(id: """e3d4bb8b-2fb5-9898-b051-db6027224112""", doc: """A subscription with variables and a fragment to test code generation.""") {
1 commit comments
github-actions[bot] commentedon Feb 8, 2022
📊 Benchmark results
Package size: 377 MB