vscode-apollo 2.5.6 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +17 -0
- package/.github/workflows/E2E.yml +3 -2
- package/.github/workflows/build-prs.yml +2 -1
- package/.github/workflows/release.yml +2 -2
- package/.prettierignore +3 -0
- package/.semgrepignore +2 -0
- package/.vscode/settings.json +7 -2
- package/CHANGELOG.md +12 -0
- package/apollo.connectors.mapping.configuration.json +10 -0
- package/package.json +38 -4
- package/sampleWorkspace/connectors-community/.github/ISSUE_TEMPLATE/connector-bug-report.md +36 -0
- package/sampleWorkspace/connectors-community/.github/ISSUE_TEMPLATE/new-connector.md +10 -0
- package/sampleWorkspace/connectors-community/.github/renovate.json5 +3 -0
- package/sampleWorkspace/connectors-community/.vscode/extensions.json +3 -0
- package/sampleWorkspace/connectors-community/.vscode/settings.json +13 -0
- package/sampleWorkspace/connectors-community/.vscode/tasks.json +10 -0
- package/sampleWorkspace/connectors-community/README.md +108 -0
- package/sampleWorkspace/connectors-community/apollo.config.json +5 -0
- package/sampleWorkspace/connectors-community/connectors/.template/Dockerfile +5 -0
- package/sampleWorkspace/connectors-community/connectors/.template/README +46 -0
- package/sampleWorkspace/connectors-community/connectors/.template/connector.graphql +31 -0
- package/sampleWorkspace/connectors-community/connectors/.template/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/.template/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/README +12 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/albums.graphql +48 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/comments.graphql +54 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/photos.graphql +54 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/posts.graphql +51 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/supergraph.yaml +26 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/todos.graphql +51 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/users.graphql +80 -0
- package/sampleWorkspace/connectors-community/connectors/TM-Forum/README.md +9 -0
- package/sampleWorkspace/connectors-community/connectors/TM-Forum/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/TM-Forum/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/TM-Forum/tmf622-ProductOrdering.graphql +296 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/README.md +7 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/addresses.graphql +30 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/customer.graphql +77 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/products.graphql +70 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/router.yaml +24 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/supergraph.yaml +14 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/swagger.json +69226 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/Dockerfile +5 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/README +61 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/messages.graphql +258 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/apollo-ecomm-simple/README +3 -0
- package/sampleWorkspace/connectors-community/connectors/apollo-ecomm-simple/connector.graphql +38 -0
- package/sampleWorkspace/connectors-community/connectors/apollo-ecomm-simple/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/apollo-ecomm-simple/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/apple/README +36 -0
- package/sampleWorkspace/connectors-community/connectors/apple/app-store-connect.graphql +100 -0
- package/sampleWorkspace/connectors-community/connectors/apple/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/apple/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/aws/README +125 -0
- package/sampleWorkspace/connectors-community/connectors/aws/dynamodb.graphql +130 -0
- package/sampleWorkspace/connectors-community/connectors/aws/json-responses/product-price.json +10 -0
- package/sampleWorkspace/connectors-community/connectors/aws/json-responses/products.json +53 -0
- package/sampleWorkspace/connectors-community/connectors/aws/lambda.graphql +179 -0
- package/sampleWorkspace/connectors-community/connectors/aws/router.yaml +54 -0
- package/sampleWorkspace/connectors-community/connectors/aws/supergraph.yaml +10 -0
- package/sampleWorkspace/connectors-community/connectors/bored/README.md +35 -0
- package/sampleWorkspace/connectors-community/connectors/bored/bored.graphql +87 -0
- package/sampleWorkspace/connectors-community/connectors/bored/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/README.md +23 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/contacts.graphql +141 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/json-responses/members_email_.json +61 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/README.md +58 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/distancematrix.graphql +155 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/places-legacy.graphql +117 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/places.graphql +399 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/supergraph.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/timezone.graphql +64 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/README +105 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/avatars.graphql +79 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/photo-avatars.graphql +454 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/router.yaml +21 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/supergraph.yaml +10 -0
- package/sampleWorkspace/connectors-community/connectors/jira/README +36 -0
- package/sampleWorkspace/connectors-community/connectors/jira/connector.graphql +197 -0
- package/sampleWorkspace/connectors-community/connectors/jira/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/jira/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/museums/README.md +40 -0
- package/sampleWorkspace/connectors-community/connectors/museums/chicagoArt.graphql +150 -0
- package/sampleWorkspace/connectors-community/connectors/museums/met.graphql +119 -0
- package/sampleWorkspace/connectors-community/connectors/museums/supergraph.yaml +10 -0
- package/sampleWorkspace/connectors-community/connectors/nws/README.md +45 -0
- package/sampleWorkspace/connectors-community/connectors/nws/alerts.graphql +598 -0
- package/sampleWorkspace/connectors-community/connectors/nws/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/odata/README +18 -0
- package/sampleWorkspace/connectors-community/connectors/odata/connector.graphql +171 -0
- package/sampleWorkspace/connectors-community/connectors/odata/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/odata/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/openai/README.md +61 -0
- package/sampleWorkspace/connectors-community/connectors/openai/assistants.graphql +285 -0
- package/sampleWorkspace/connectors-community/connectors/openai/chat-completions.graphql +169 -0
- package/sampleWorkspace/connectors-community/connectors/openai/models.graphql +47 -0
- package/sampleWorkspace/connectors-community/connectors/openai/router.yaml +24 -0
- package/sampleWorkspace/connectors-community/connectors/openai/supergraph.yaml +14 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/README +45 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/games.graphql +70 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/locations.graphql +127 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/moves.graphql +107 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/pokemon.graphql +539 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/supergraph.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/strapi/README.md +75 -0
- package/sampleWorkspace/connectors-community/connectors/strapi/router.yaml +19 -0
- package/sampleWorkspace/connectors-community/connectors/strapi/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/strapi/users.graphql +227 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/README.md +83 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/checkout.graphql +112 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/core-resources.graphql +868 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/payment-methods.graphql +526 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/products.graphql +162 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/router.yaml +26 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/supergraph.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/supabase/README.md +80 -0
- package/sampleWorkspace/connectors-community/connectors/supabase/router.yaml +5 -0
- package/sampleWorkspace/connectors-community/connectors/supabase/supabase.graphql +143 -0
- package/sampleWorkspace/connectors-community/connectors/supabase/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/README +46 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/agencies.graphql +193 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/api-throttle.graphql +33 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/astronauts.graphql +237 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/celestial-bodies.graphql +131 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/docking-events.graphql +3460 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/launches.graphql +1156 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/supergraph.yaml +77 -0
- package/sampleWorkspace/connectors-community/connectors/tint/README +35 -0
- package/sampleWorkspace/connectors-community/connectors/tint/accounts.graphql +69 -0
- package/sampleWorkspace/connectors-community/connectors/tint/router.yaml +21 -0
- package/sampleWorkspace/connectors-community/connectors/tint/social-feeds.graphql +62 -0
- package/sampleWorkspace/connectors-community/connectors/tint/supergraph.yaml +10 -0
- package/sampleWorkspace/connectors-community/connectors/todoist/README.md +48 -0
- package/sampleWorkspace/connectors-community/connectors/todoist/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/todoist/todoist.graphql +381 -0
- package/sampleWorkspace/connectors-community/connectors/trimblemaps/README +99 -0
- package/sampleWorkspace/connectors-community/connectors/trimblemaps/connector.graphql +66 -0
- package/sampleWorkspace/connectors-community/connectors/trimblemaps/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/trimblemaps/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/twilio/README.md +44 -0
- package/sampleWorkspace/connectors-community/connectors/twilio/messages.graphql +107 -0
- package/sampleWorkspace/connectors-community/connectors/twilio/router.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/twilio/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes/README.md +44 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes/earthquakes.graphql +235 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes-nominatum/README.md +44 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes-nominatum/earthquake-simple.graphql +87 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes-nominatum/router.yaml +3 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes-nominatum/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/usps/README +36 -0
- package/sampleWorkspace/connectors-community/connectors/usps/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/usps/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/usps/tracking.graphql +118 -0
- package/sampleWorkspace/connectors-community/connectors/zendesk/README +36 -0
- package/sampleWorkspace/connectors-community/connectors/zendesk/connector.graphql +98 -0
- package/sampleWorkspace/connectors-community/connectors/zendesk/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/zendesk/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/file-new/index.js +520 -0
- package/sampleWorkspace/connectors-community/package-lock.json +119 -0
- package/sampleWorkspace/connectors-community/package.json +20 -0
- package/sampleWorkspace/connectors-community/supergraph.yaml +6 -0
- package/sampleWorkspace/sampleWorkspace.code-workspace +29 -8
- package/src/__tests__/fixtures/textmate/test.apollo.connectors.mapping +213 -0
- package/src/__tests__/fixtures/textmate/test.connect.graphql +104 -0
- package/src/language-server/__tests__/fixtures/documents/functionCall.ts.snap +3 -3
- package/syntaxes/build.ts +266 -0
- package/syntaxes/connectors.mapping.json +532 -0
- package/syntaxes/connectors.mapping.yaml +440 -0
- package/syntaxes/graphql.connectors.json +426 -0
- package/syntaxes/graphql.connectors.yaml +254 -0
- package/syntaxes/graphql.json +8 -1
- package/syntaxes/publish.sh +43 -0
- package/syntaxes/tsconfig.json +6 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
federation_version: =2.11.0
|
|
2
|
+
subgraphs:
|
|
3
|
+
stripe-checkout:
|
|
4
|
+
routing_url: http://stripe-checkout
|
|
5
|
+
schema:
|
|
6
|
+
file: checkout.graphql
|
|
7
|
+
stripe-core-resources:
|
|
8
|
+
routing_url: http://stripe-core-resources
|
|
9
|
+
schema:
|
|
10
|
+
file: core-resources.graphql
|
|
11
|
+
stripe-payment-methods:
|
|
12
|
+
routing_url: http://stripe-payment-methods
|
|
13
|
+
schema:
|
|
14
|
+
file: payment-methods.graphql
|
|
15
|
+
stripe-product:
|
|
16
|
+
routing_url: http://stripe-products
|
|
17
|
+
schema:
|
|
18
|
+
file: products.graphql
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Stripe REST Connector
|
|
2
|
+
|
|
3
|
+
This connector currently covers a portion of the [Supabase API](https://supabase.com/docs/guides/api).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
To use the connector, you need to set up a new account in supabase and at least one table schema.
|
|
8
|
+
In the connector template you will point to your unique supabase url and update and table names and fields to match your schema.
|
|
9
|
+
Supabase requires passing a key on the header which can be found in your Supabase dashboard.
|
|
10
|
+
|
|
11
|
+
Please note that the queries and mutations in this template do not take into consideration RLS (Row Level Security) policies.
|
|
12
|
+
If you have any RLS policies set on your table for CRUD operations, you may need to adjust the schema.
|
|
13
|
+
|
|
14
|
+
See Supabase documentation for more information about working with [RLS policies](https://supabase.com/docs/guides/database/postgres/row-level-security)
|
|
15
|
+
|
|
16
|
+
## Getting started
|
|
17
|
+
|
|
18
|
+
1. If you haven't already, [create a new graph in GraphOS](https://www.apollographql.com/docs/graphos/get-started/guides/rest#step-1-set-up-your-graphql-api). Once you get to the **Set up your local development environment** modal in the [Create a graph](https://www.apollographql.com/docs/graphos/get-started/guides/rest#create-a-graph) section:
|
|
19
|
+
- Copy the `supergraph.yaml` and `router.yaml` files from this folder instead of the `supergraph.yaml` provided by the modal.
|
|
20
|
+
- Instead of downloading the example schema provided by the modal, copy the supabase schema files you want to use for this connector
|
|
21
|
+
1. Grab your Supabase anon API key and set it as an environment variable for your terminal:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
export anonKey=....
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
1. Run `rover dev` to start the local development session:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
APOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \
|
|
31
|
+
APOLLO_GRAPH_REF=My-Graph-s1ff1u@main \
|
|
32
|
+
rover dev --supergraph-config supergraph.yaml --router-config router.yaml
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
You’re all set! Open up http://localhost:4000 to query your graph using Apollo Sandbox.
|
|
36
|
+
|
|
37
|
+
### Adding to an existing graph in GraphOS
|
|
38
|
+
|
|
39
|
+
To add these connectors to an existing graph, publish the schema files to your graph ref using `rover subgraph publish`:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
APOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \
|
|
43
|
+
rover subgraph publish My-Graph-s1ff1u@main --name products --schema products.graphql --routing-url http://products
|
|
44
|
+
|
|
45
|
+
APOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \
|
|
46
|
+
rover subgraph publish My-Graph-s1ff1u@main --name checkout --schema checkout.graphql --routing-url http://checkout
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Additional setup for VS Code task runner
|
|
50
|
+
|
|
51
|
+
Edit your `.vscode/settings.json` to include the following Stripe-specific key:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
{
|
|
55
|
+
"terminal.integrated.profiles.osx": {
|
|
56
|
+
"graphos": {
|
|
57
|
+
"path": "zsh",
|
|
58
|
+
"args": ["-l"],
|
|
59
|
+
"env": {
|
|
60
|
+
"anonKey": "",
|
|
61
|
+
...
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"terminal.integrated.defaultProfile.osx": "graphos"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Once you've set this up, you can execute the `Tasks: Run Task` command in VS Code to run the `rover dev` task.
|
|
71
|
+
Alternatively, you can open a new terminal window in VS Code with the `graphos` profile, then run `rover dev --supergraph-config supergraph.yaml --router-config router.yaml`.
|
|
72
|
+
|
|
73
|
+
## Contributing
|
|
74
|
+
|
|
75
|
+
To contribute additional modules to this connector, make sure to:
|
|
76
|
+
|
|
77
|
+
1. Add a schema designed for the module as a new `.graphql` file.
|
|
78
|
+
2. Update the `router.yaml` and `supergraph.yaml` files accordingly.
|
|
79
|
+
|
|
80
|
+
See [REST API reference](https://docs.stripe.com/api) for other modules that can be implemented. You can use the current modules in this folder as examples to work with.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(
|
|
3
|
+
url: "https://specs.apollo.dev/federation/v2.11"
|
|
4
|
+
import: ["@key", "@shareable", "@external"]
|
|
5
|
+
) # Enable this schema to use Apollo Federation features
|
|
6
|
+
@link( # Enable this schema to use Apollo Connectors
|
|
7
|
+
url: "https://specs.apollo.dev/connect/v0.2"
|
|
8
|
+
import: ["@connect", "@source"]
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
#to use this prebuilt connector, you must create at least one table in your supabase project
|
|
12
|
+
#and replace <YOUR_TABLE_NAME> with the name of your table
|
|
13
|
+
#field names here are examples, you can change them to match your table schema
|
|
14
|
+
# to use this connector, you must also set the anonKey in the config
|
|
15
|
+
@source(
|
|
16
|
+
name: "supabase"
|
|
17
|
+
http: {
|
|
18
|
+
baseURL: "<YOUR_SUPABASE_URL>/rest/v1/"
|
|
19
|
+
headers: [{ name: "Authorization", value: "Bearer {$config.anonKey}" },
|
|
20
|
+
{name: "apiKey", value: "{$config.anonKey}"}]
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
type Query {
|
|
25
|
+
# Get all rows with pagination - pagination in supabase is a range of rows starting from 0.
|
|
26
|
+
#if null is passed, all rows will return
|
|
27
|
+
# single arguments will result in either all rows returned or an error
|
|
28
|
+
getAllRows(start: Int, end: Int): [Columns]
|
|
29
|
+
@connect(
|
|
30
|
+
source: "supabase"
|
|
31
|
+
http: {
|
|
32
|
+
GET: "<YOUR_TABLE_NAME>"
|
|
33
|
+
headers: [
|
|
34
|
+
{
|
|
35
|
+
name: "Range"
|
|
36
|
+
value: "{$args.start}-{$args.end}"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
selection: """
|
|
41
|
+
name
|
|
42
|
+
"""
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# Get filtered rows with pagination - pagination in supabase is a range of rows starting from 0.
|
|
46
|
+
#if null is passed, all rows will return
|
|
47
|
+
# single arguments will result in either all rows returned or an error
|
|
48
|
+
#see supbase documentation for more details on filtering
|
|
49
|
+
#https://supabase.com/docs/reference/javascript/using-filters
|
|
50
|
+
getFilteredRows(start: Int, end: Int): [Columns]
|
|
51
|
+
@connect(
|
|
52
|
+
source: "supabase"
|
|
53
|
+
http: {
|
|
54
|
+
GET: "<YOUR_TABLE_NAME>?select=<COLUMN_NAME>"
|
|
55
|
+
headers: [
|
|
56
|
+
{
|
|
57
|
+
name: "Range"
|
|
58
|
+
value: "{$args.start}-{$args.end}"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
selection: """
|
|
63
|
+
name
|
|
64
|
+
"""
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type Mutation {
|
|
69
|
+
insertRow(input: InputRow!): Submission!
|
|
70
|
+
@connect(
|
|
71
|
+
source: "supabase"
|
|
72
|
+
http: {
|
|
73
|
+
POST: "<YOUR_TABLE_NAME>"
|
|
74
|
+
body: """
|
|
75
|
+
name: $args.input.name
|
|
76
|
+
|
|
77
|
+
"""
|
|
78
|
+
}
|
|
79
|
+
selection: """
|
|
80
|
+
id
|
|
81
|
+
name
|
|
82
|
+
"""
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# for supabase this will return 204 no content unless you specify a header to return the row
|
|
86
|
+
updateRow(id: ID!, input: UpdateRow!): UpdateResponse!
|
|
87
|
+
@connect(
|
|
88
|
+
source: "supabase"
|
|
89
|
+
http: {
|
|
90
|
+
PATCH: "<YOUR_TABLE_NAME>?id=eq.{$args.id}"
|
|
91
|
+
body: """
|
|
92
|
+
name: $args.input.name
|
|
93
|
+
"""
|
|
94
|
+
}
|
|
95
|
+
selection: """
|
|
96
|
+
submission {
|
|
97
|
+
id
|
|
98
|
+
name
|
|
99
|
+
}
|
|
100
|
+
"""
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# for supabase this will return 204 no content unless you specify a header to return the row
|
|
104
|
+
deleteRow(id: ID!): DeleteResponse!
|
|
105
|
+
@connect(
|
|
106
|
+
source: "supabase"
|
|
107
|
+
http: {
|
|
108
|
+
DELETE: "<YOUR_TABLE_NAME>?id=eq.{$args.id}"
|
|
109
|
+
}
|
|
110
|
+
selection: """
|
|
111
|
+
message
|
|
112
|
+
"""
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
input InputRow {
|
|
118
|
+
name: String!
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
input UpdateRow {
|
|
123
|
+
name: String
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
type Columns {
|
|
128
|
+
name: String
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
type Submission {
|
|
133
|
+
id: ID!
|
|
134
|
+
name: String!
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type UpdateResponse {
|
|
138
|
+
submission: Submission!
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
type DeleteResponse {
|
|
142
|
+
message: String!
|
|
143
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# The Space Devs Launch Library REST Connector
|
|
2
|
+
|
|
3
|
+
This connector currently covers [The Space Devs Launch Library REST API](https://ll.thespacedevs.com/).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
The Space Devs is a free to access API that enforces their own rate limits; all the API data is available at no cost for up to 15 requests per hour.
|
|
8
|
+
|
|
9
|
+
## Additional Setup for VS Code Task runner
|
|
10
|
+
|
|
11
|
+
Edit your `.vscode/settings.json` to include the following keys:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
{
|
|
15
|
+
"terminal.integrated.profiles.osx": {
|
|
16
|
+
"graphos": {
|
|
17
|
+
"path": "zsh",
|
|
18
|
+
"args": ["-l"],
|
|
19
|
+
"env": {
|
|
20
|
+
"API_KEY": "",
|
|
21
|
+
"APOLLO_KEY": "",
|
|
22
|
+
...
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"terminal.integrated.defaultProfile.osx": "graphos"
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Once you've set this up, you can execute the `Tasks: Run Task` command in VS Code to run the `rover dev` task.
|
|
31
|
+
Alternatively, you can open a new terminal window in VS Code with the `graphos` profile, then run `rover dev --supergraph-config supergraph.yaml --router-config router.yaml`.
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
The following schema modules can be added to this connector:
|
|
37
|
+
|
|
38
|
+
- Example 1
|
|
39
|
+
- Example 2
|
|
40
|
+
|
|
41
|
+
To contribute them, make sure to:
|
|
42
|
+
|
|
43
|
+
1. Add a schema designed for the module as a new `.graphql` file.
|
|
44
|
+
2. Update the `router.yaml` and `supergraph.yaml` files accordingly.
|
|
45
|
+
|
|
46
|
+
See [REST API reference]() for other modules that can be implemented. You can use the current modules in this folder as examples to work with.
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(
|
|
3
|
+
url: "https://specs.apollo.dev/federation/v2.10"
|
|
4
|
+
import: ["@key", "@requires", "@shareable"]
|
|
5
|
+
)
|
|
6
|
+
@link(
|
|
7
|
+
url: "https://specs.apollo.dev/connect/v0.2"
|
|
8
|
+
import: ["@source", "@connect"]
|
|
9
|
+
)
|
|
10
|
+
@source(name: "llv2", http: { baseURL: "https://ll.thespacedevs.com/2.3.0/" })
|
|
11
|
+
|
|
12
|
+
type Agency @key(fields: "id") {
|
|
13
|
+
id: ID!
|
|
14
|
+
name: String @shareable
|
|
15
|
+
abbrev: String @shareable
|
|
16
|
+
type: String @shareable
|
|
17
|
+
featured: Boolean @shareable
|
|
18
|
+
country: [Country] @shareable
|
|
19
|
+
description: String @shareable
|
|
20
|
+
administrator: String @shareable
|
|
21
|
+
foundingYear: Int @shareable
|
|
22
|
+
spacecraft: String @shareable
|
|
23
|
+
image: Image @shareable
|
|
24
|
+
logo: Image @shareable
|
|
25
|
+
socialLogo: Image @shareable
|
|
26
|
+
}
|
|
27
|
+
type Image @shareable{
|
|
28
|
+
id: ID!
|
|
29
|
+
name: String
|
|
30
|
+
url: String
|
|
31
|
+
thumbnail: String
|
|
32
|
+
credit: String
|
|
33
|
+
singleUse: Boolean
|
|
34
|
+
license: ImageLicense
|
|
35
|
+
}
|
|
36
|
+
type ImageLicense @shareable{
|
|
37
|
+
name: String
|
|
38
|
+
link: String
|
|
39
|
+
}
|
|
40
|
+
type AgencyConnection {
|
|
41
|
+
pageInfo: PageInfo
|
|
42
|
+
results: [Agency]
|
|
43
|
+
}
|
|
44
|
+
type Country @shareable {
|
|
45
|
+
id: ID!
|
|
46
|
+
name: String
|
|
47
|
+
alpha2Code: String
|
|
48
|
+
alpha3Code: String
|
|
49
|
+
nationalityName: String
|
|
50
|
+
nationalityNameComposed: String
|
|
51
|
+
}
|
|
52
|
+
type PageInfo @shareable {
|
|
53
|
+
count: Int
|
|
54
|
+
next: String
|
|
55
|
+
previous: String
|
|
56
|
+
}
|
|
57
|
+
type Query {
|
|
58
|
+
agency(id: ID!): Agency
|
|
59
|
+
@connect(
|
|
60
|
+
source: "llv2"
|
|
61
|
+
entity: true
|
|
62
|
+
http: { GET: "/agencies/{$args.id}/?format=json" }
|
|
63
|
+
selection: """
|
|
64
|
+
id
|
|
65
|
+
name
|
|
66
|
+
abbrev
|
|
67
|
+
type: type.name
|
|
68
|
+
featured
|
|
69
|
+
country {
|
|
70
|
+
id
|
|
71
|
+
name
|
|
72
|
+
alpha2Code: alpha_2_code
|
|
73
|
+
alpha3Code: alpha_3_code
|
|
74
|
+
nationalityName: nationality_name
|
|
75
|
+
nationalityNameComposed: nationality_name_composed
|
|
76
|
+
}
|
|
77
|
+
description
|
|
78
|
+
administrator
|
|
79
|
+
foundingYear: founding_year
|
|
80
|
+
spacecraft
|
|
81
|
+
image {
|
|
82
|
+
id
|
|
83
|
+
name
|
|
84
|
+
url: image_url
|
|
85
|
+
thumbnail: thumbnail_url
|
|
86
|
+
credit
|
|
87
|
+
license {
|
|
88
|
+
name
|
|
89
|
+
link
|
|
90
|
+
}
|
|
91
|
+
singleUse: single_use
|
|
92
|
+
}
|
|
93
|
+
logo {
|
|
94
|
+
id
|
|
95
|
+
name
|
|
96
|
+
url: image_url
|
|
97
|
+
thumbnail: thumbnail_url
|
|
98
|
+
credit
|
|
99
|
+
license {
|
|
100
|
+
name
|
|
101
|
+
link
|
|
102
|
+
}
|
|
103
|
+
singleUse: single_use
|
|
104
|
+
}
|
|
105
|
+
socialLogo: social_logo {
|
|
106
|
+
id
|
|
107
|
+
name
|
|
108
|
+
url: image_url
|
|
109
|
+
thumbnail: thumbnail_url
|
|
110
|
+
credit
|
|
111
|
+
license {
|
|
112
|
+
name
|
|
113
|
+
link
|
|
114
|
+
}
|
|
115
|
+
singleUse: single_use
|
|
116
|
+
}
|
|
117
|
+
"""
|
|
118
|
+
)
|
|
119
|
+
agencies(search: String, offset: Int = 0, limit: Int = 20): AgencyConnection
|
|
120
|
+
@connect(
|
|
121
|
+
source: "llv2"
|
|
122
|
+
http: {
|
|
123
|
+
GET: "/agencies/?format=json"
|
|
124
|
+
queryParams: """
|
|
125
|
+
search: $args.search
|
|
126
|
+
limit: $args.limit
|
|
127
|
+
offset: $args.offset
|
|
128
|
+
"""
|
|
129
|
+
}
|
|
130
|
+
selection: """
|
|
131
|
+
pageInfo {
|
|
132
|
+
count
|
|
133
|
+
next
|
|
134
|
+
previous
|
|
135
|
+
}
|
|
136
|
+
results {
|
|
137
|
+
id
|
|
138
|
+
name
|
|
139
|
+
abbrev
|
|
140
|
+
type: type.name
|
|
141
|
+
featured
|
|
142
|
+
country {
|
|
143
|
+
id
|
|
144
|
+
name
|
|
145
|
+
alpha2Code: alpha_2_code
|
|
146
|
+
alpha3Code: alpha_3_code
|
|
147
|
+
nationalityName: nationality_name
|
|
148
|
+
nationalityNameComposed: nationality_name_composed
|
|
149
|
+
}
|
|
150
|
+
description
|
|
151
|
+
administrator
|
|
152
|
+
foundingYear: founding_year
|
|
153
|
+
spacecraft
|
|
154
|
+
image {
|
|
155
|
+
id
|
|
156
|
+
name
|
|
157
|
+
url: image_url
|
|
158
|
+
thumbnail: thumbnail_url
|
|
159
|
+
credit
|
|
160
|
+
license {
|
|
161
|
+
name
|
|
162
|
+
link
|
|
163
|
+
}
|
|
164
|
+
singleUse: single_use
|
|
165
|
+
}
|
|
166
|
+
logo {
|
|
167
|
+
id
|
|
168
|
+
name
|
|
169
|
+
url: image_url
|
|
170
|
+
thumbnail: thumbnail_url
|
|
171
|
+
credit
|
|
172
|
+
license {
|
|
173
|
+
name
|
|
174
|
+
link
|
|
175
|
+
}
|
|
176
|
+
singleUse: single_use
|
|
177
|
+
}
|
|
178
|
+
socialLogo: social_logo {
|
|
179
|
+
id
|
|
180
|
+
name
|
|
181
|
+
url: image_url
|
|
182
|
+
thumbnail: thumbnail_url
|
|
183
|
+
credit
|
|
184
|
+
license {
|
|
185
|
+
name
|
|
186
|
+
link
|
|
187
|
+
}
|
|
188
|
+
singleUse: single_use
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
"""
|
|
192
|
+
)
|
|
193
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(
|
|
3
|
+
url: "https://specs.apollo.dev/federation/v2.10"
|
|
4
|
+
import: ["@key", "@requires", "@shareable"]
|
|
5
|
+
)
|
|
6
|
+
@link(
|
|
7
|
+
url: "https://specs.apollo.dev/connect/v0.2"
|
|
8
|
+
import: ["@source", "@connect"]
|
|
9
|
+
)
|
|
10
|
+
@source(name: "llv2", http: { baseURL: "https://ll.thespacedevs.com/2.3.0/" })
|
|
11
|
+
|
|
12
|
+
type ApiThrottle{
|
|
13
|
+
yourRequestLimit: Int
|
|
14
|
+
limitFrequencySecs: Int
|
|
15
|
+
currentUse: Int
|
|
16
|
+
nextUseSecs: Int
|
|
17
|
+
ident: String
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type Query {
|
|
21
|
+
apiThrottle: ApiThrottle
|
|
22
|
+
@connect(
|
|
23
|
+
source: "llv2"
|
|
24
|
+
http: { GET: "/api-throttle/?format=json" }
|
|
25
|
+
selection: """
|
|
26
|
+
yourRequestLimit: your_request_limit
|
|
27
|
+
limitFrequencySecs: limit_frequency_secs
|
|
28
|
+
currentUse: current_use
|
|
29
|
+
nextUseSecs: next_use_secs
|
|
30
|
+
ident
|
|
31
|
+
"""
|
|
32
|
+
)
|
|
33
|
+
}
|