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,107 @@
|
|
|
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
|
+
@source(
|
|
11
|
+
name: "twilio"
|
|
12
|
+
http: {
|
|
13
|
+
baseURL: "https://api.twilio.com/2010-04-01/Accounts/<YOUR_ACCOUNT_ID>/"
|
|
14
|
+
headers: [
|
|
15
|
+
{
|
|
16
|
+
name: "Authorization"
|
|
17
|
+
value: "Basic {$config.twilioKey}" # Base64(AccountSID:AuthToken)
|
|
18
|
+
}
|
|
19
|
+
{ name: "Content-Type", value: "application/x-www-form-urlencoded" }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
#this mutation allows you to send to Twilio or personal verified phone numbers
|
|
25
|
+
type Mutation {
|
|
26
|
+
sendSMS(to: String!, body: String!): SmsResponse
|
|
27
|
+
@connect(
|
|
28
|
+
source: "twilio"
|
|
29
|
+
http: {
|
|
30
|
+
POST: "Messages.json"
|
|
31
|
+
body: """
|
|
32
|
+
MessagingServiceSid: $('<YOUR_MESSAGING_SERVICE_SID>')
|
|
33
|
+
To: $args.to
|
|
34
|
+
Body: $args.body
|
|
35
|
+
"""
|
|
36
|
+
}
|
|
37
|
+
selection: """
|
|
38
|
+
sid
|
|
39
|
+
to
|
|
40
|
+
from
|
|
41
|
+
body
|
|
42
|
+
status
|
|
43
|
+
"""
|
|
44
|
+
errors: { message: "$.message" }
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#this query retrieves the last 5 messages sent or received from your Twilio account
|
|
49
|
+
type Query {
|
|
50
|
+
recentMessages(pageSize: Int=5): [SMSLog]
|
|
51
|
+
@connect(
|
|
52
|
+
source: "twilio"
|
|
53
|
+
http: { GET: "Messages.json?PageSize={$args.pageSize}" }
|
|
54
|
+
selection: """
|
|
55
|
+
$.messages{
|
|
56
|
+
accountSid: account_sid
|
|
57
|
+
apiVersion: api_version
|
|
58
|
+
body
|
|
59
|
+
dateCreated: date_created
|
|
60
|
+
dateSent: date_sent
|
|
61
|
+
dateUpdated: date_updated
|
|
62
|
+
direction
|
|
63
|
+
errorCode: error_code
|
|
64
|
+
errorMessage: error_message
|
|
65
|
+
from
|
|
66
|
+
messagingServiceSid: messaging_service_sid
|
|
67
|
+
numMedia: num_media
|
|
68
|
+
numSegments: num_segments
|
|
69
|
+
price
|
|
70
|
+
priceUnit: price_unit
|
|
71
|
+
sid
|
|
72
|
+
status
|
|
73
|
+
to
|
|
74
|
+
uri
|
|
75
|
+
}
|
|
76
|
+
"""
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
type SmsResponse {
|
|
81
|
+
sid: String
|
|
82
|
+
to: String
|
|
83
|
+
from: String
|
|
84
|
+
body: String
|
|
85
|
+
status: String
|
|
86
|
+
}
|
|
87
|
+
type SMSLog {
|
|
88
|
+
accountSid: String
|
|
89
|
+
apiVersion: String
|
|
90
|
+
body: String
|
|
91
|
+
dateCreated: String
|
|
92
|
+
dateSent: String
|
|
93
|
+
dateUpdated: String
|
|
94
|
+
direction: String
|
|
95
|
+
errorCode: Int
|
|
96
|
+
errorMessage: String
|
|
97
|
+
from: String
|
|
98
|
+
messagingServiceSid: String
|
|
99
|
+
numMedia: Int
|
|
100
|
+
numSegments: Int
|
|
101
|
+
price: Float
|
|
102
|
+
priceUnit: String
|
|
103
|
+
sid: String
|
|
104
|
+
status: String
|
|
105
|
+
to: String
|
|
106
|
+
uri: String
|
|
107
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# USGS earthquakes with location data from Nominatum REST Connector
|
|
2
|
+
|
|
3
|
+
This connector is a minimal implementation of USGS Earthquakes and Nominatum reverse geocoding API developed to support a tutorial demo in //blog link coming soon// and is implemented in [graphql-version branch](https://github.com/AmandaApollo/earthquake-finder/tree/graphql-version) of [this repository](https://github.com/AmandaApollo/earthquake-finder).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
USGS and Nominatum are free to access APIs that enforce their own rate limits.
|
|
8
|
+
[USGS API Documentation](https://earthquake.usgs.gov/fdsnws/event/1/)
|
|
9
|
+
[Nominatum API Documentation](https://nominatim.org/release-docs/develop/api/Overview/)
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
1. Create an [Apollo Studio](https://studio.apollographql.com/) account. This will provide the abilty to create and manage your graph including necesary credentials APOLLO_KEY and APOLLO_GRAPH_REF
|
|
14
|
+
2. [Install](https://www.apollographql.com/docs/rover/getting-started#installation-methods) and [authenticate](https://www.apollographql.com/docs/rover/configuring) Rover CLI to configure your graph and run locally.
|
|
15
|
+
3. Run `rover init` to generate a new connector. See the [Rover CLI documentation](https://www.apollographql.com/docs/rover) for more information and commands.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Additional Setup for VS Code Task runner
|
|
19
|
+
|
|
20
|
+
Edit your `.vscode/settings.json` to include the following keys:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
{
|
|
24
|
+
"terminal.integrated.profiles.osx": {
|
|
25
|
+
"graphos": {
|
|
26
|
+
"path": "zsh",
|
|
27
|
+
"args": ["-l"],
|
|
28
|
+
"env": {
|
|
29
|
+
"API_KEY": "",
|
|
30
|
+
"APOLLO_KEY": "",
|
|
31
|
+
...
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"terminal.integrated.defaultProfile.osx": "graphos"
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Once you've set this up, you can execute the `Tasks: Run Task` command in VS Code to run the `rover dev` task.
|
|
40
|
+
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`.
|
|
41
|
+
|
|
42
|
+
## Contributing
|
|
43
|
+
|
|
44
|
+
This implementation was created to support a tutorial and therefore will not accept modifications to evolve it at this time. If you are interested in contributing to this resource, you may do so as a separate .`graphql` file.
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(url: "https://specs.apollo.dev/federation/v2.10", import: ["@key"]) # Enable this schema to use Apollo Federation features
|
|
3
|
+
@link( # Enable this schema to use Apollo Connectors
|
|
4
|
+
url: "https://specs.apollo.dev/connect/v0.2"
|
|
5
|
+
import: ["@connect", "@source"]
|
|
6
|
+
)
|
|
7
|
+
@source(
|
|
8
|
+
name: "usgs"
|
|
9
|
+
http: { baseURL: "https://earthquake.usgs.gov/fdsnws/event/1/" }
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
type EarthquakeProperties {
|
|
13
|
+
mag: Float
|
|
14
|
+
place: String
|
|
15
|
+
time: Float
|
|
16
|
+
updated: Float
|
|
17
|
+
tz: Int
|
|
18
|
+
url: String
|
|
19
|
+
detail: String #detail contains the direct endpoint for earthquake by id
|
|
20
|
+
felt: Int
|
|
21
|
+
cdi: Float
|
|
22
|
+
mmi: Float
|
|
23
|
+
alert: String
|
|
24
|
+
status: String
|
|
25
|
+
tsunami: Int
|
|
26
|
+
sig: Int
|
|
27
|
+
net: String
|
|
28
|
+
code: String
|
|
29
|
+
ids: String
|
|
30
|
+
sources: String
|
|
31
|
+
types: String
|
|
32
|
+
nst: Int
|
|
33
|
+
dmin: Float
|
|
34
|
+
rms: Float
|
|
35
|
+
gap: Float
|
|
36
|
+
magType: String
|
|
37
|
+
type: String
|
|
38
|
+
title: String
|
|
39
|
+
products: [ProductEntry]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type ProductEntry {
|
|
43
|
+
name: String
|
|
44
|
+
products: [Product]
|
|
45
|
+
}
|
|
46
|
+
scalar JSON
|
|
47
|
+
|
|
48
|
+
type Product {
|
|
49
|
+
id: ID!
|
|
50
|
+
type: String
|
|
51
|
+
properties: JSON #data will vary
|
|
52
|
+
contents: JSON #data will vary
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
type EarthquakeGeometry {
|
|
56
|
+
#this returns 3 values - lon,lat,depth in km
|
|
57
|
+
coordinates: [Float]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type Earthquake @key(fields: "id") {
|
|
61
|
+
id: ID!
|
|
62
|
+
properties: EarthquakeProperties
|
|
63
|
+
geometry: EarthquakeGeometry
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type Query {
|
|
67
|
+
"""
|
|
68
|
+
Returns recent earthquakes with summary properties.
|
|
69
|
+
"""
|
|
70
|
+
recentEarthquakes(limit: Int = 5): [Earthquake]
|
|
71
|
+
@connect(
|
|
72
|
+
source: "usgs"
|
|
73
|
+
http: { GET: "query"
|
|
74
|
+
queryParams: """
|
|
75
|
+
limit: $args.limit
|
|
76
|
+
format: $('geojson')
|
|
77
|
+
"""
|
|
78
|
+
}
|
|
79
|
+
selection: """
|
|
80
|
+
$.features
|
|
81
|
+
{
|
|
82
|
+
id
|
|
83
|
+
properties{
|
|
84
|
+
mag
|
|
85
|
+
place
|
|
86
|
+
time
|
|
87
|
+
updated
|
|
88
|
+
tz
|
|
89
|
+
url
|
|
90
|
+
detail
|
|
91
|
+
felt
|
|
92
|
+
cdi
|
|
93
|
+
mmi
|
|
94
|
+
alert
|
|
95
|
+
status
|
|
96
|
+
tsunami
|
|
97
|
+
sig
|
|
98
|
+
net
|
|
99
|
+
code
|
|
100
|
+
ids
|
|
101
|
+
sources
|
|
102
|
+
types
|
|
103
|
+
nst
|
|
104
|
+
dmin
|
|
105
|
+
rms
|
|
106
|
+
gap
|
|
107
|
+
magType
|
|
108
|
+
type
|
|
109
|
+
title
|
|
110
|
+
}
|
|
111
|
+
geometry{
|
|
112
|
+
coordinates
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
"""
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
"""
|
|
119
|
+
Returns detailed earthquake data by Id.
|
|
120
|
+
"""
|
|
121
|
+
earthquakeById(id: ID!): Earthquake
|
|
122
|
+
@connect(
|
|
123
|
+
source: "usgs"
|
|
124
|
+
http: { GET: "query"
|
|
125
|
+
queryParams: """
|
|
126
|
+
eventid: $args.id
|
|
127
|
+
format: $('geojson')
|
|
128
|
+
"""
|
|
129
|
+
}
|
|
130
|
+
selection: """
|
|
131
|
+
id
|
|
132
|
+
properties {
|
|
133
|
+
mag
|
|
134
|
+
place
|
|
135
|
+
time
|
|
136
|
+
updated
|
|
137
|
+
tz
|
|
138
|
+
url
|
|
139
|
+
detail
|
|
140
|
+
felt
|
|
141
|
+
cdi
|
|
142
|
+
mmi
|
|
143
|
+
alert
|
|
144
|
+
status
|
|
145
|
+
tsunami
|
|
146
|
+
sig
|
|
147
|
+
net
|
|
148
|
+
code
|
|
149
|
+
ids
|
|
150
|
+
sources
|
|
151
|
+
types
|
|
152
|
+
nst
|
|
153
|
+
dmin
|
|
154
|
+
rms
|
|
155
|
+
gap
|
|
156
|
+
magType
|
|
157
|
+
type
|
|
158
|
+
title
|
|
159
|
+
products: products->entries {
|
|
160
|
+
name: key
|
|
161
|
+
products: value {
|
|
162
|
+
id
|
|
163
|
+
type
|
|
164
|
+
properties
|
|
165
|
+
contents
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
geometry{
|
|
170
|
+
coordinates
|
|
171
|
+
}
|
|
172
|
+
"""
|
|
173
|
+
entity: true
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
"""
|
|
177
|
+
Returns detailed earthquake data by a given radius for a locaation.
|
|
178
|
+
"""
|
|
179
|
+
recentEarthquakesInRadius(
|
|
180
|
+
limit: Int = 5
|
|
181
|
+
lat: String!
|
|
182
|
+
lon: String!
|
|
183
|
+
maxRadius: Int = 100
|
|
184
|
+
): [Earthquake]
|
|
185
|
+
@connect(
|
|
186
|
+
source: "usgs"
|
|
187
|
+
http: {
|
|
188
|
+
GET: "query"
|
|
189
|
+
queryParams: """
|
|
190
|
+
latitude: $args.lat
|
|
191
|
+
longitude: $args.lon
|
|
192
|
+
maxradiuskm: $args.maxRadius
|
|
193
|
+
limit: $args.limit
|
|
194
|
+
format: $('geojson')
|
|
195
|
+
"""
|
|
196
|
+
}
|
|
197
|
+
selection: """
|
|
198
|
+
$.features
|
|
199
|
+
{
|
|
200
|
+
id
|
|
201
|
+
properties{
|
|
202
|
+
mag
|
|
203
|
+
place
|
|
204
|
+
time
|
|
205
|
+
updated
|
|
206
|
+
tz
|
|
207
|
+
url
|
|
208
|
+
detail
|
|
209
|
+
felt
|
|
210
|
+
cdi
|
|
211
|
+
mmi
|
|
212
|
+
alert
|
|
213
|
+
status
|
|
214
|
+
tsunami
|
|
215
|
+
sig
|
|
216
|
+
net
|
|
217
|
+
code
|
|
218
|
+
ids
|
|
219
|
+
sources
|
|
220
|
+
types
|
|
221
|
+
nst
|
|
222
|
+
dmin
|
|
223
|
+
rms
|
|
224
|
+
gap
|
|
225
|
+
magType
|
|
226
|
+
type
|
|
227
|
+
title
|
|
228
|
+
}
|
|
229
|
+
geometry{
|
|
230
|
+
coordinates
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
"""
|
|
234
|
+
)
|
|
235
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# USGS earthquakes with location data from Nominatum REST Connector
|
|
2
|
+
|
|
3
|
+
This connector is a minimal implementation of USGS Earthquakes and Nominatum reverse geocoding API developed to support a tutorial demo in //blog link coming soon// and is implemented in [graphql-version branch](https://github.com/AmandaApollo/earthquake-finder/tree/graphql-version) of [this repository](https://github.com/AmandaApollo/earthquake-finder).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
USGS and Nominatum are free to access APIs that enforce their own rate limits.
|
|
8
|
+
[USGS API Documentation](https://earthquake.usgs.gov/fdsnws/event/1/)
|
|
9
|
+
[Nominatum API Documentation](https://nominatim.org/release-docs/develop/api/Overview/)
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
1. Create an [Apollo Studio](https://studio.apollographql.com/) account. This will provide the abilty to create and manage your graph including necesary credentials APOLLO_KEY and APOLLO_GRAPH_REF
|
|
14
|
+
2. [Install](https://www.apollographql.com/docs/rover/getting-started#installation-methods) and [authenticate](https://www.apollographql.com/docs/rover/configuring) Rover CLI to configure your graph and run locally.
|
|
15
|
+
3. Run `rover init` to generate a new connector. See the [Rover CLI documentation](https://www.apollographql.com/docs/rover) for more information and commands.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Additional Setup for VS Code Task runner
|
|
19
|
+
|
|
20
|
+
Edit your `.vscode/settings.json` to include the following keys:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
{
|
|
24
|
+
"terminal.integrated.profiles.osx": {
|
|
25
|
+
"graphos": {
|
|
26
|
+
"path": "zsh",
|
|
27
|
+
"args": ["-l"],
|
|
28
|
+
"env": {
|
|
29
|
+
"API_KEY": "",
|
|
30
|
+
"APOLLO_KEY": "",
|
|
31
|
+
...
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"terminal.integrated.defaultProfile.osx": "graphos"
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Once you've set this up, you can execute the `Tasks: Run Task` command in VS Code to run the `rover dev` task.
|
|
40
|
+
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`.
|
|
41
|
+
|
|
42
|
+
## Contributing
|
|
43
|
+
|
|
44
|
+
This implementation was created to support a tutorial and therefore will not accept modifications to evolve it at this time. If you are interested in contributing to this resource, you may do so as a separate .`graphql` file.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(url: "https://specs.apollo.dev/federation/v2.10", import: ["@key"]) # Enable this schema to use Apollo Federation features
|
|
3
|
+
@link( # Enable this schema to use Apollo Connectors
|
|
4
|
+
url: "https://specs.apollo.dev/connect/v0.2"
|
|
5
|
+
import: ["@connect", "@source"]
|
|
6
|
+
)
|
|
7
|
+
@source(
|
|
8
|
+
name: "usgs"
|
|
9
|
+
http: { baseURL: "https://earthquake.usgs.gov/fdsnws/event/1/" }
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
@source(
|
|
13
|
+
name: "location"
|
|
14
|
+
http: {
|
|
15
|
+
baseURL: "https://nominatim.openstreetmap.org/"
|
|
16
|
+
headers: [{ name: "User-Agent", value: "testing" }]
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
type EarthquakeProperties {
|
|
21
|
+
mag: Float
|
|
22
|
+
place: String
|
|
23
|
+
time: Float
|
|
24
|
+
updated: Float
|
|
25
|
+
url: String
|
|
26
|
+
title: String
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type EarthquakeGeometry {
|
|
30
|
+
#this returns 3 values - lon,lat,depth in km
|
|
31
|
+
coordinates: [Float]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type Earthquake {
|
|
35
|
+
id: ID!
|
|
36
|
+
properties: EarthquakeProperties
|
|
37
|
+
geometry: EarthquakeGeometry
|
|
38
|
+
display_name: String
|
|
39
|
+
@connect(
|
|
40
|
+
source: "location"
|
|
41
|
+
http: {
|
|
42
|
+
GET: "reverse"
|
|
43
|
+
queryParams: """
|
|
44
|
+
lat: $this.geometry.coordinates->slice(1,2)->first
|
|
45
|
+
lon: $this.geometry.coordinates->first
|
|
46
|
+
format: $('json')
|
|
47
|
+
"""
|
|
48
|
+
}
|
|
49
|
+
selection: """
|
|
50
|
+
$.display_name
|
|
51
|
+
"""
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
type Query {
|
|
56
|
+
recentEarthquakes(limit: Int = 5 lat: String! lon: String! maxRadius: Int = 100): [Earthquake]
|
|
57
|
+
@connect(
|
|
58
|
+
source: "usgs"
|
|
59
|
+
http: {
|
|
60
|
+
GET: "query?format=geojson"
|
|
61
|
+
queryParams: """
|
|
62
|
+
latitude: $args.lat
|
|
63
|
+
longitude: $args.lon
|
|
64
|
+
maxradiuskm: $args.maxRadius
|
|
65
|
+
limit: $args.limit
|
|
66
|
+
"""
|
|
67
|
+
}
|
|
68
|
+
selection: """
|
|
69
|
+
$.features
|
|
70
|
+
{
|
|
71
|
+
properties{
|
|
72
|
+
mag
|
|
73
|
+
place
|
|
74
|
+
time
|
|
75
|
+
updated
|
|
76
|
+
url
|
|
77
|
+
title
|
|
78
|
+
}
|
|
79
|
+
geometry{
|
|
80
|
+
coordinates
|
|
81
|
+
}
|
|
82
|
+
id
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
"""
|
|
86
|
+
)
|
|
87
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# USPS REST Connector
|
|
2
|
+
|
|
3
|
+
This connector currently covers the [Tracking object](https://developer.usps.com/trackingv3) in the [USPS REST API](https://developer.usps.com/). To use this, you'll need to add a `API_KEY` in your environment variables then running `rover` or the `router` with the config files in this folder.
|
|
4
|
+
|
|
5
|
+
## Additional Setup for VS Code Task runner
|
|
6
|
+
|
|
7
|
+
Edit your `.vscode/settings.json` to include the Strapi specific keys
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
{
|
|
11
|
+
"terminal.integrated.profiles.osx": {
|
|
12
|
+
"graphos": {
|
|
13
|
+
"path": "zsh",
|
|
14
|
+
"args": ["-l"],
|
|
15
|
+
"env": {
|
|
16
|
+
"API_KEY": "",
|
|
17
|
+
"APOLLO_KEY": "",
|
|
18
|
+
...
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"terminal.integrated.defaultProfile.osx": "graphos"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then you can execute the "Tasks: Run Task" command in VS code to execute the `rover dev` task or simply open a new terminal window in vscode with the `graphos` profile, then you can simply run `rover dev --supergraph-config supergraph.yaml --router-config router.yaml`.
|
|
28
|
+
|
|
29
|
+
## Contributing
|
|
30
|
+
|
|
31
|
+
The following schema modules need to include:
|
|
32
|
+
|
|
33
|
+
1. A schema designed for that portion of the rest API as a new `.graphql` file
|
|
34
|
+
2. Additions to the `router.yaml` and `supergraph.yaml` files
|
|
35
|
+
|
|
36
|
+
You can view the [USPS API Catalog](https://developer.usps.com/apis) for other modules to implement.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
supergraph:
|
|
2
|
+
listen: 0.0.0.0:${env.PORT:-4000}
|
|
3
|
+
|
|
4
|
+
headers:
|
|
5
|
+
all:
|
|
6
|
+
request:
|
|
7
|
+
- propagate:
|
|
8
|
+
matching: .*
|
|
9
|
+
telemetry:
|
|
10
|
+
instrumentation:
|
|
11
|
+
spans:
|
|
12
|
+
mode: spec_compliant
|
|
13
|
+
|
|
14
|
+
connectors:
|
|
15
|
+
subgraphs:
|
|
16
|
+
tracking:
|
|
17
|
+
$config:
|
|
18
|
+
apiKey: ${env.API_KEY}
|