vscode-apollo 2.5.5 → 2.6.0
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 +25 -5
- package/.github/workflows/build-prs.yml +2 -1
- package/.prettierignore +3 -0
- package/.semgrepignore +2 -0
- package/.vscode/settings.json +7 -2
- package/CHANGELOG.md +14 -0
- package/apollo.connectors.mapping.configuration.json +10 -0
- package/package.json +39 -5
- 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/rover/apollo.config.yaml +1 -1
- package/sampleWorkspace/rover/supergraph.yaml +4 -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/__e2e__/configFileTypes.e2e.ts +2 -2
- package/src/language-server/__e2e__/rover.e2e.ts +37 -49
- package/src/language-server/__tests__/fixtures/documents/functionCall.ts.snap +3 -3
- package/src/language-server/config/config.ts +4 -2
- 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 +22 -1
- package/syntaxes/tsconfig.json +6 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Common Room REST Connector
|
|
2
|
+
|
|
3
|
+
This connector currently covers the Contact object in Common Room](https://api.commonroom.io/docs/) REST API. To use this, you'll need to add a `COMMON_ROOM_API_KEY` in your environment variables then running `rover` or the `router` binary with the config files in this folder (`router.yaml` and `supergraph.yaml`).
|
|
4
|
+
|
|
5
|
+
## Contributing
|
|
6
|
+
|
|
7
|
+
A partial implementation of the `Contacts` API has been implemented including:
|
|
8
|
+
|
|
9
|
+
- GET contact by email
|
|
10
|
+
- POST add note to contact
|
|
11
|
+
|
|
12
|
+
The following schema modules still need to be implemented:
|
|
13
|
+
|
|
14
|
+
- Activities
|
|
15
|
+
- Segments
|
|
16
|
+
- Tags
|
|
17
|
+
- Right to be Forgotten
|
|
18
|
+
|
|
19
|
+
To contribute any of these modules, you'll need to:
|
|
20
|
+
|
|
21
|
+
1. A schema designed for that portion of the rest API as a new `.graphql` file
|
|
22
|
+
2. Add the new `.graphql` file to the `supergraph.yaml`
|
|
23
|
+
3. Add the connector config to the `router.yaml` and be sure to use the subgraph name you populated in the previous step (referenced in `supergraph.yaml`)
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(
|
|
3
|
+
url: "https://specs.apollo.dev/federation/v2.10"
|
|
4
|
+
import: ["@key", "@requires"]
|
|
5
|
+
)
|
|
6
|
+
@link(
|
|
7
|
+
url: "https://specs.apollo.dev/connect/v0.2"
|
|
8
|
+
import: ["@source", "@connect"]
|
|
9
|
+
)
|
|
10
|
+
@source(
|
|
11
|
+
name: "common-room"
|
|
12
|
+
http: {
|
|
13
|
+
# https://api.commonroom.io/docs
|
|
14
|
+
baseURL: "https://api.commonroom.io/community/v1"
|
|
15
|
+
headers: [{ name: "Authorization", value: "Bearer {$config.apiKey}" }]
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
type Contact {
|
|
20
|
+
email: String!
|
|
21
|
+
fullName: String
|
|
22
|
+
activities: Int
|
|
23
|
+
avatar: String
|
|
24
|
+
bio: String
|
|
25
|
+
organization: Organization
|
|
26
|
+
title: String
|
|
27
|
+
firstSeen: String
|
|
28
|
+
lastActive: String
|
|
29
|
+
location: Location
|
|
30
|
+
tags: [MemberTag]
|
|
31
|
+
segments: [Segment]
|
|
32
|
+
emails: [Email]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type Email {
|
|
36
|
+
email: String
|
|
37
|
+
sources: [String]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type Segment {
|
|
41
|
+
id: ID
|
|
42
|
+
name: String
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type MemberTag {
|
|
46
|
+
id: ID
|
|
47
|
+
name: String
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type Location {
|
|
51
|
+
full: String
|
|
52
|
+
city: String
|
|
53
|
+
region: String
|
|
54
|
+
country: String
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type Organization {
|
|
58
|
+
name: String
|
|
59
|
+
url: String
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
type Query {
|
|
63
|
+
contact(email: String!): Contact
|
|
64
|
+
@connect(
|
|
65
|
+
source: "common-room"
|
|
66
|
+
http: { GET: "/members?email={$args.email}" }
|
|
67
|
+
selection: """
|
|
68
|
+
# JSON Example Response 👇
|
|
69
|
+
# https://github.com/apollographql/connectors-community/tree/main/connectors/common-room/json-responses/members%3Femail%3D.json
|
|
70
|
+
$->first {
|
|
71
|
+
email: $args.email
|
|
72
|
+
fullName
|
|
73
|
+
activities: activities_count
|
|
74
|
+
avatar
|
|
75
|
+
bio
|
|
76
|
+
organization: {
|
|
77
|
+
name: organization
|
|
78
|
+
url: organization_domain
|
|
79
|
+
}
|
|
80
|
+
title
|
|
81
|
+
firstSeen: first_seen
|
|
82
|
+
lastActive: last_active
|
|
83
|
+
location {
|
|
84
|
+
full: raw
|
|
85
|
+
city
|
|
86
|
+
region
|
|
87
|
+
country
|
|
88
|
+
}
|
|
89
|
+
tags: member_tags {
|
|
90
|
+
id
|
|
91
|
+
name
|
|
92
|
+
}
|
|
93
|
+
segments {
|
|
94
|
+
id
|
|
95
|
+
name
|
|
96
|
+
}
|
|
97
|
+
emails: email {
|
|
98
|
+
email
|
|
99
|
+
sources
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
"""
|
|
103
|
+
entity: true
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
type Mutation {
|
|
108
|
+
addNoteToContact(social: SocialType!, id: ID!, note: String!): Boolean
|
|
109
|
+
@connect(
|
|
110
|
+
source: "common-room"
|
|
111
|
+
http: {
|
|
112
|
+
POST: "/members/note"
|
|
113
|
+
body: """
|
|
114
|
+
socialType: $args.social->match(
|
|
115
|
+
["EMAIL","email"],
|
|
116
|
+
["TWITTER","twitter"],
|
|
117
|
+
["GITHUB","github"],
|
|
118
|
+
["LINKEDIN","linkedin"],
|
|
119
|
+
)
|
|
120
|
+
value: $args.id
|
|
121
|
+
note: $args.note
|
|
122
|
+
"""
|
|
123
|
+
}
|
|
124
|
+
selection: """
|
|
125
|
+
# JSON Example Response 👇 - It's the Common Room user id
|
|
126
|
+
# {
|
|
127
|
+
# "id": [
|
|
128
|
+
# 123456789
|
|
129
|
+
# ]
|
|
130
|
+
# }
|
|
131
|
+
$(true)
|
|
132
|
+
"""
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
enum SocialType {
|
|
137
|
+
EMAIL
|
|
138
|
+
TWITTER
|
|
139
|
+
GITHUB
|
|
140
|
+
LINKEDIN
|
|
141
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"fullName": "Michael Watson",
|
|
4
|
+
"activities_count": 3334,
|
|
5
|
+
"avatar": "https://avatars.githubusercontent.com/u/8645958?u=2d97981f1bbdf44e76a47e67fdaa3d26354ddb74&v=4",
|
|
6
|
+
"bio": "Developer Advocate for Apollo Federation - Previous Solutions Architect - 5+ yrs",
|
|
7
|
+
"organization": "Apollo GraphQL",
|
|
8
|
+
"organization_domain": "http://www.apollographql.com",
|
|
9
|
+
"title": "Head of DevRel",
|
|
10
|
+
"first_seen": "2018-10-03T14:37:25.000Z",
|
|
11
|
+
"last_active": "2025-02-14T22:23:57.000Z",
|
|
12
|
+
"location": {
|
|
13
|
+
"raw": "San Francisco, California, United States",
|
|
14
|
+
"city": "San Francisco",
|
|
15
|
+
"region": "California",
|
|
16
|
+
"country": "United States"
|
|
17
|
+
},
|
|
18
|
+
"member_tags": [
|
|
19
|
+
{
|
|
20
|
+
"id": 731426,
|
|
21
|
+
"name": "team_member"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": 731431,
|
|
25
|
+
"name": "contributor"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"segments": [
|
|
29
|
+
{
|
|
30
|
+
"id": 123456,
|
|
31
|
+
"name": "Segment Name"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"email": [
|
|
35
|
+
{
|
|
36
|
+
"email": "watson+connectors+live@apollographql.com",
|
|
37
|
+
"sources": [
|
|
38
|
+
"ConnectorsLiveUsers"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"url": [],
|
|
43
|
+
"twitter": [],
|
|
44
|
+
"github": [
|
|
45
|
+
"michael-watson"
|
|
46
|
+
],
|
|
47
|
+
"linkedin": [
|
|
48
|
+
"in/michael-watson-85844442"
|
|
49
|
+
],
|
|
50
|
+
"discord": [],
|
|
51
|
+
"youtube": [],
|
|
52
|
+
"common_room_member_url": "https://app.commonroom.io/community/1337/member/1337",
|
|
53
|
+
"custom_fields": [
|
|
54
|
+
{
|
|
55
|
+
"name": "Custom Field Name",
|
|
56
|
+
"type": "string",
|
|
57
|
+
"value": ""
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
supergraph:
|
|
2
|
+
listen: 127.0.0.1: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
|
+
contacts:
|
|
17
|
+
$config:
|
|
18
|
+
apiKey: ${env.COMMON_ROOM_API_KEY}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Google Maps REST Connector
|
|
2
|
+
|
|
3
|
+
This connector currently covers a portion of the [Google Maps Legacy API](https://developers.google.com/maps/documentation/places/web-service/legacy/details).
|
|
4
|
+
|
|
5
|
+
Including:
|
|
6
|
+
[Place Search](https://developers.google.com/maps/documentation/places/web-service/legacy/search)
|
|
7
|
+
[Distance Matrix](https://developers.google.com/maps/documentation/distance-matrix/distance-matrix)
|
|
8
|
+
[Timezone](https://developers.google.com/maps/documentation/timezone/requests-timezone)
|
|
9
|
+
|
|
10
|
+
Google Maps has two types of REST APIs, legacy requires an [API KEY passed via the URL](https://developers.google.com/maps/documentation/places/web-service/get-api-key#creating-api-keys).
|
|
11
|
+
|
|
12
|
+
It is important to restrict the use of these keys and to not expose these calls to the client.
|
|
13
|
+
|
|
14
|
+
If you require any features from the new API's, they use [OAUTH2](https://developers.google.com/maps/documentation/places/web-service/oauth-token) and will require updates to this schema to use.
|
|
15
|
+
|
|
16
|
+
At the time of this writing legacy maps API's are stable for use but will not recieve new features.
|
|
17
|
+
|
|
18
|
+
You can read more in Google Maps Documenation.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
To use the connector, you need a [Google Maps API key](https://developers.google.com/maps/documentation/places/web-service/get-api-key#creating-api-keys).
|
|
23
|
+
|
|
24
|
+
## Getting started
|
|
25
|
+
|
|
26
|
+
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:
|
|
27
|
+
- Copy the `supergraph.yaml` file from this folder instead of the `supergraph.yaml` provided by the modal.
|
|
28
|
+
- Instead of downloading the example schema provided by the modal, copy the schema files from this folder
|
|
29
|
+
- *Note: If you only want to one of the schema files, you need to modify the `supergraph.yaml` file to only contain the respective schema file .*
|
|
30
|
+
|
|
31
|
+
1. Run `rover dev` to start the local development session:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
APOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \
|
|
35
|
+
APOLLO_GRAPH_REF=My-Graph-s1ff1u@main \
|
|
36
|
+
rover dev --supergraph-config supergraph.yaml
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
You’re all set! Open up http://localhost:4000 to query your graph using Apollo Sandbox.
|
|
40
|
+
|
|
41
|
+
### Adding to an existing graph in GraphOS
|
|
42
|
+
|
|
43
|
+
To add these connectors to an existing graph, publish the schema files to your graph ref using `rover subgraph publish` example below:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
APOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \
|
|
47
|
+
rover subgraph publish My-Graph-s1ff1u@main --name places --schema places.graphql --routing-url http://places
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Contributing
|
|
52
|
+
|
|
53
|
+
To add other modules to this schema, see the [Google Maps API list](https://console.cloud.google.com/google/maps-apis/api-list) - only legacy API KEY endpoints should be added to this schema
|
|
54
|
+
|
|
55
|
+
To contribute them, make sure to:
|
|
56
|
+
|
|
57
|
+
1. Add a schema designed for the module as a new `.graphql` file.
|
|
58
|
+
2. Update the `supergraph.yaml` file accordingly.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(
|
|
3
|
+
url: "https://specs.apollo.dev/federation/v2.11"
|
|
4
|
+
import: ["@key", "@shareable", "@external", "@requires"]
|
|
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
|
+
#this connector uses the legacy ditance API. To enable this in Google, you must create an API key and give permissions to this API
|
|
11
|
+
@source(
|
|
12
|
+
name: "distance"
|
|
13
|
+
http: { baseURL: "https://maps.googleapis.com/maps/api/" }
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
type Query {
|
|
17
|
+
# Direct distance calculation between two named locations
|
|
18
|
+
getDistanceByLocation(from: String!, to: String!): TravelEstimate
|
|
19
|
+
@connect(
|
|
20
|
+
source: "distance"
|
|
21
|
+
http: {
|
|
22
|
+
GET: "/distancematrix/json?origins={$args.from}&destinations={$args.to}&key=YOUR_API_KEY"
|
|
23
|
+
}
|
|
24
|
+
selection: """
|
|
25
|
+
destinationAddresses: destination_addresses
|
|
26
|
+
originAddresses: origin_addresses
|
|
27
|
+
rows {
|
|
28
|
+
elements {
|
|
29
|
+
distance {
|
|
30
|
+
text
|
|
31
|
+
value
|
|
32
|
+
}
|
|
33
|
+
duration {
|
|
34
|
+
text
|
|
35
|
+
value
|
|
36
|
+
}
|
|
37
|
+
status
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
status
|
|
41
|
+
"""
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# Direct distance calculation between two place IDs
|
|
45
|
+
getDistanceByPlaceId(fromPlaceId: String!, toPlaceId: String!): TravelEstimate
|
|
46
|
+
@connect(
|
|
47
|
+
source: "distance"
|
|
48
|
+
http: {
|
|
49
|
+
GET: "/distancematrix/json?origins=place_id:{$args.fromPlaceId}&destinations=place_id:{$args.toPlaceId}&key=YOUR_API_KEY"
|
|
50
|
+
}
|
|
51
|
+
selection: """
|
|
52
|
+
destinationAddresses: destination_addresses
|
|
53
|
+
originAddresses: origin_addresses
|
|
54
|
+
rows {
|
|
55
|
+
elements {
|
|
56
|
+
distance {
|
|
57
|
+
text
|
|
58
|
+
value
|
|
59
|
+
}
|
|
60
|
+
duration {
|
|
61
|
+
text
|
|
62
|
+
value
|
|
63
|
+
}
|
|
64
|
+
status
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
status
|
|
68
|
+
"""
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type TravelEstimate {
|
|
73
|
+
destinationAddresses: [String]
|
|
74
|
+
originAddresses: [String]
|
|
75
|
+
rows: [TravelEstimateRow]
|
|
76
|
+
status: String
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type TravelEstimateRow {
|
|
80
|
+
elements: [TravelEstimateElement]
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type TravelEstimateElement {
|
|
84
|
+
distance: TravelEstimateDistance
|
|
85
|
+
duration: TravelEstimateDuration
|
|
86
|
+
status: String
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type TravelEstimateDistance {
|
|
90
|
+
text: String
|
|
91
|
+
value: Int
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
type TravelEstimateDuration {
|
|
95
|
+
text: String
|
|
96
|
+
value: Int
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
type Place @key(fields: "id", resolvable: false) {
|
|
100
|
+
id: String @external
|
|
101
|
+
|
|
102
|
+
# Get travel distance and duration to another place by id
|
|
103
|
+
travelTo(destinationPlaceId: String!): TravelEstimate
|
|
104
|
+
@connect(
|
|
105
|
+
source: "distance"
|
|
106
|
+
http: {
|
|
107
|
+
GET: "/distancematrix/json?origins=place_id:{$this.id}&destinations=place_id:{$args.destinationPlaceId}&key=YOUR_API_KEY"
|
|
108
|
+
}
|
|
109
|
+
selection: """
|
|
110
|
+
destinationAddresses: destination_addresses
|
|
111
|
+
originAddresses: origin_addresses
|
|
112
|
+
rows {
|
|
113
|
+
elements {
|
|
114
|
+
distance {
|
|
115
|
+
text
|
|
116
|
+
value
|
|
117
|
+
}
|
|
118
|
+
duration {
|
|
119
|
+
text
|
|
120
|
+
value
|
|
121
|
+
}
|
|
122
|
+
status
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
status
|
|
126
|
+
"""
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
# Get travel distance and duration to a named location
|
|
130
|
+
travelToLocation(destination: String!): TravelEstimate
|
|
131
|
+
@connect(
|
|
132
|
+
source: "distance"
|
|
133
|
+
http: {
|
|
134
|
+
GET: "/distancematrix/json?origins=place_id:{$this.id}&destinations={$args.destination}&key=YOUR_API_KEY"
|
|
135
|
+
}
|
|
136
|
+
selection: """
|
|
137
|
+
destinationAddresses: destination_addresses
|
|
138
|
+
originAddresses: origin_addresses
|
|
139
|
+
rows {
|
|
140
|
+
elements {
|
|
141
|
+
distance {
|
|
142
|
+
text
|
|
143
|
+
value
|
|
144
|
+
}
|
|
145
|
+
duration {
|
|
146
|
+
text
|
|
147
|
+
value
|
|
148
|
+
}
|
|
149
|
+
status
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
status
|
|
153
|
+
"""
|
|
154
|
+
)
|
|
155
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
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: "places"
|
|
12
|
+
http: { baseURL: "https://maps.googleapis.com/maps/api/place/" }
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
type Query {
|
|
16
|
+
searchForPlace(query: String): [Place]
|
|
17
|
+
@connect(
|
|
18
|
+
source: "places"
|
|
19
|
+
http: {
|
|
20
|
+
GET: "textsearch/json?query={$args.query}&key=YOUR_API_KEY"
|
|
21
|
+
}
|
|
22
|
+
selection: """
|
|
23
|
+
$.results {
|
|
24
|
+
businessStatus: business_status
|
|
25
|
+
formattedAddress: formatted_address
|
|
26
|
+
location: $.geometry.location {
|
|
27
|
+
latitude: lat
|
|
28
|
+
longitude: lng
|
|
29
|
+
}
|
|
30
|
+
openingHours: opening_hours {
|
|
31
|
+
openNow: open_now
|
|
32
|
+
}
|
|
33
|
+
photos {
|
|
34
|
+
photoReference: photo_reference
|
|
35
|
+
htmlAttributions: html_attributions
|
|
36
|
+
}
|
|
37
|
+
id: place_id
|
|
38
|
+
rating
|
|
39
|
+
reference
|
|
40
|
+
types
|
|
41
|
+
userRatingsTotal: user_ratings_total
|
|
42
|
+
}
|
|
43
|
+
"""
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
getPlaceDetailsById(id: String!): Place
|
|
47
|
+
@connect(
|
|
48
|
+
source: "places"
|
|
49
|
+
http: {
|
|
50
|
+
GET: "details/json?place_id={$args.id}&key=YOUR_API_KEY"
|
|
51
|
+
}
|
|
52
|
+
entity: true
|
|
53
|
+
selection: """
|
|
54
|
+
$.result {
|
|
55
|
+
businessStatus: business_status
|
|
56
|
+
formattedAddress: formatted_address
|
|
57
|
+
location: $.geometry.location {
|
|
58
|
+
latitude: lat
|
|
59
|
+
longitude: lng
|
|
60
|
+
}
|
|
61
|
+
openingHours: opening_hours {
|
|
62
|
+
openNow: open_now
|
|
63
|
+
}
|
|
64
|
+
photos {
|
|
65
|
+
photoReference: photo_reference
|
|
66
|
+
htmlAttributions: html_attributions
|
|
67
|
+
}
|
|
68
|
+
id: place_id
|
|
69
|
+
rating
|
|
70
|
+
reference
|
|
71
|
+
types
|
|
72
|
+
userRatingsTotal: user_ratings_total
|
|
73
|
+
}
|
|
74
|
+
"""
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type Place @key(fields: "id") {
|
|
79
|
+
id: String
|
|
80
|
+
businessStatus: String
|
|
81
|
+
formattedAddress: String
|
|
82
|
+
location: Location
|
|
83
|
+
openingHours: OpeningHours
|
|
84
|
+
photos: [Photo]
|
|
85
|
+
rating: Float
|
|
86
|
+
reference: String
|
|
87
|
+
types: [String]
|
|
88
|
+
userRatingsTotal: Int
|
|
89
|
+
}
|
|
90
|
+
type Location {
|
|
91
|
+
latitude: Float
|
|
92
|
+
longitude: Float
|
|
93
|
+
}
|
|
94
|
+
type OpeningHours {
|
|
95
|
+
openNow: Boolean
|
|
96
|
+
}
|
|
97
|
+
type Photo {
|
|
98
|
+
photoReference: String
|
|
99
|
+
htmlAttributions: [String]
|
|
100
|
+
url(height: Int = 720, width: Int = 1280): String
|
|
101
|
+
@connect(
|
|
102
|
+
source: "places"
|
|
103
|
+
http: {
|
|
104
|
+
GET: "/photo"
|
|
105
|
+
queryParams: """
|
|
106
|
+
photo_reference: $this.photoReference
|
|
107
|
+
maxwidth: $args.width
|
|
108
|
+
maxheight: $args.height
|
|
109
|
+
key:$(config.key)
|
|
110
|
+
skipHttpRedirect: $(true)
|
|
111
|
+
"""
|
|
112
|
+
}
|
|
113
|
+
selection: """
|
|
114
|
+
url
|
|
115
|
+
"""
|
|
116
|
+
)
|
|
117
|
+
}
|