vscode-apollo 2.5.6 → 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 +3 -2
- 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 +6 -0
- package/apollo.connectors.mapping.configuration.json +10 -0
- package/package.json +37 -3
- 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/tsconfig.json +6 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
# Run `npm run watch:textmate-yaml` while working on this file.
|
|
2
|
+
# roughly based on this grammar:
|
|
3
|
+
# ```ebnf
|
|
4
|
+
# JSONSelection ::= PathSelection | NamedSelection*
|
|
5
|
+
# SubSelection ::= "{" NamedSelection* "}"
|
|
6
|
+
# NamedSelection ::= (Alias | "...")? PathSelection | Alias SubSelection
|
|
7
|
+
# Alias ::= Key ":"
|
|
8
|
+
# Path ::= VarPath | KeyPath | AtPath | ExprPath
|
|
9
|
+
# PathSelection ::= Path SubSelection?
|
|
10
|
+
# VarPath ::= "$" (NO_SPACE Identifier)? PathTail
|
|
11
|
+
# KeyPath ::= Key NonEmptyPathTail
|
|
12
|
+
# AtPath ::= "@" PathTail
|
|
13
|
+
# ExprPath ::= "$(" LitExpr ")" PathTail
|
|
14
|
+
# PathTail ::= "?"? (PathStep "?"?)*
|
|
15
|
+
# NonEmptyPathTail ::= "?"? (PathStep "?"?)+
|
|
16
|
+
# PathStep ::= "." Key | "->" Identifier MethodArgs?
|
|
17
|
+
# Key ::= Identifier | LitString
|
|
18
|
+
# Identifier ::= [a-zA-Z_] NO_SPACE [0-9a-zA-Z_]*
|
|
19
|
+
# MethodArgs ::= "(" (LitExpr ("," LitExpr)* ","?)? ")"
|
|
20
|
+
# LitExpr ::= LitPath | LitOpChain | LitPrimitive | LitObject | LitArray | PathSelection
|
|
21
|
+
# LitPath ::= (LitPrimitive | LitObject | LitArray) NonEmptyPathTail
|
|
22
|
+
# LitOpChain ::= LitExpr LitOp LitExpr
|
|
23
|
+
# LitPrimitive ::= LitString | LitNumber | "true" | "false" | "null"
|
|
24
|
+
# LitString ::= "'" ("\\'" | [^'])* "'" | '"' ('\\"' | [^"])* '"'
|
|
25
|
+
# LitNumber ::= "-"? ([0-9]+ ("." [0-9]*)? | "." [0-9]+)
|
|
26
|
+
# LitObject ::= "{" (LitProperty ("," LitProperty)* ","?)? "}"
|
|
27
|
+
# LitProperty ::= Key ":" LitExpr
|
|
28
|
+
# LitArray ::= "[" (LitExpr ("," LitExpr)* ","?)? "]"
|
|
29
|
+
# LitOp ::= "??" | "?!" | "&&" | "||" | "==" | "!=" | "<" | "<=" | ">" | ">=" | +" | "-" | "*" | "/" | "%"
|
|
30
|
+
# NO_SPACE ::= !SpacesOrComments
|
|
31
|
+
# SpacesOrComments ::= (Spaces | Comment)+
|
|
32
|
+
# Spaces ::= ("⎵" | "\t" | "\r" | "\n")+
|
|
33
|
+
# Comment ::= "#" [^\n]*
|
|
34
|
+
# ```
|
|
35
|
+
$schema: https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json
|
|
36
|
+
name: "Apollo Connectors Mapping Syntax"
|
|
37
|
+
scopeName: "source.apollo.connectors.mapping"
|
|
38
|
+
patterns:
|
|
39
|
+
- include: "#JSONSelection"
|
|
40
|
+
- include: "#Comment"
|
|
41
|
+
- include: "source.graphql#graphql-skip-newlines"
|
|
42
|
+
# can be referenced from `begin`, `end` or `match` properties like `{{identifier}}` or `{{key}}`
|
|
43
|
+
# within those fields, it's also possible to reference evaluated earlier patterns like `{{#PathSelection.begin}}`
|
|
44
|
+
variables:
|
|
45
|
+
identifier: "[a-zA-Z_][0-9a-zA-Z_]*"
|
|
46
|
+
# prettier-ignore
|
|
47
|
+
string: "\"[^\"]*\"|'[^']*'"
|
|
48
|
+
key: "{{identifier}}|{{string}}"
|
|
49
|
+
operator: "[?][?]|[?][!]|&&|[|][|]|==|!=|<|<=|(?<!-)>|(?<!-)>=|[+]|-(?!>)|[*]|/|%"
|
|
50
|
+
operatorCharacter: "[?!&|=<>*/%+-]"
|
|
51
|
+
alias: "{{key}}\\s*:"
|
|
52
|
+
varPathMatch: "[$]"
|
|
53
|
+
keyPathMatch: "({{key}})(?={{pathTailMatch}})"
|
|
54
|
+
pathStepMatch: "[.]{{key}}|->{{identifier}}"
|
|
55
|
+
pathTailMatch: "\\s*(?:[?])?(?=\\s*{{pathStepMatch}})"
|
|
56
|
+
atPathMatch: "@"
|
|
57
|
+
exprPathMatch: "$[(]"
|
|
58
|
+
notEscaped: "(?<![\\\\])(?:[\\\\]{2})*"
|
|
59
|
+
builtinMethod: "echo|map|eq|match|first|last|slice|size|entries|or|and|jsonStringify|joinNotNull|filter|gte|lte|ne|gt|lt"
|
|
60
|
+
reservedMethod: "typeof|matchIf|match_if|add|sub|mul|div|mod|has|get|keys|values|not"
|
|
61
|
+
# can be referenced from `name` properties or other styles like `{{.identifier}}` or `{{.key}}`
|
|
62
|
+
styles:
|
|
63
|
+
alias: "variable.other.property.alias"
|
|
64
|
+
alias_colon: "{{.colon}}" # just an example - we can reference other styles here
|
|
65
|
+
colon: "punctuation.colon.alias"
|
|
66
|
+
field: "variable.graphql"
|
|
67
|
+
property: "variable.other.property"
|
|
68
|
+
method: "support.function"
|
|
69
|
+
builtinMethod: "support.function.builtin"
|
|
70
|
+
arrow: "keyword.operator.arrow"
|
|
71
|
+
comma: "punctuation.separator.comma"
|
|
72
|
+
brace_open: "punctuation.brace.open" #{
|
|
73
|
+
brace_close: "punctuation.brace.close" #}
|
|
74
|
+
paren_open: "punctuation.paren.open" #(
|
|
75
|
+
paren_close: "punctuation.paren.close" #)
|
|
76
|
+
bracket_open: "punctuation.bracket.open" #[
|
|
77
|
+
bracket_close: "punctuation.bracket.close" #]
|
|
78
|
+
optional_chain: "variable.question.mark"
|
|
79
|
+
expr_dollar: "variable.other.constant"
|
|
80
|
+
var_dollar: "variable.other.constant"
|
|
81
|
+
at: "variable.other.constant"
|
|
82
|
+
spread: "keyword.operator.spread"
|
|
83
|
+
dot: "variable.dot"
|
|
84
|
+
operator: "keyword.operator"
|
|
85
|
+
fixedPrimitive: "constant.language"
|
|
86
|
+
string: "string.quoted.graphql"
|
|
87
|
+
string_single: "string.quoted.single.graphql"
|
|
88
|
+
string_double: "string.quoted.double.graphql"
|
|
89
|
+
string_open: "punctuation.definition.string.begin.graphql"
|
|
90
|
+
string_close: "punctuation.definition.string.end.graphql"
|
|
91
|
+
number: "constant.numeric"
|
|
92
|
+
comment: "comment.line.connectors.mapping"
|
|
93
|
+
comment_leading_ws: "punctuation.whitespace.comment.leading.connectors.mapping"
|
|
94
|
+
|
|
95
|
+
repository:
|
|
96
|
+
# JSONSelection ::= PathSelection | NamedSelection*
|
|
97
|
+
JSONSelection:
|
|
98
|
+
patterns:
|
|
99
|
+
- include: "#NamedSelection"
|
|
100
|
+
- include: "#PathSelection"
|
|
101
|
+
- include: "#Comment"
|
|
102
|
+
# SubSelection ::= "{" NamedSelection* "}"
|
|
103
|
+
SubSelection:
|
|
104
|
+
begin: "\\s*({)"
|
|
105
|
+
beginCaptures:
|
|
106
|
+
"1":
|
|
107
|
+
name: "{{.brace_open}}"
|
|
108
|
+
end: "\\s*(})"
|
|
109
|
+
endCaptures:
|
|
110
|
+
"1":
|
|
111
|
+
name: "{{.brace_close}}"
|
|
112
|
+
patterns:
|
|
113
|
+
- include: "#NamedSelection"
|
|
114
|
+
- include: "#Comment"
|
|
115
|
+
# NamedSelection ::= (Alias | "...")? PathSelection | Alias SubSelection
|
|
116
|
+
# Alias ::= Key ":"
|
|
117
|
+
# Path ::= VarPath | KeyPath | AtPath | ExprPath
|
|
118
|
+
# PathSelection ::= Path SubSelection?
|
|
119
|
+
PathSelection:
|
|
120
|
+
begin: "(?={{varPathMatch}}|{{keyPathMatch}}|{{atPathMatch}}|{{exprPathMatch}})"
|
|
121
|
+
end: "(?=.)"
|
|
122
|
+
applyEndPatternLast: 1
|
|
123
|
+
patterns:
|
|
124
|
+
- include: "#ExprPath" # needs higher priority that `VarPath`
|
|
125
|
+
- include: "#VarPath"
|
|
126
|
+
- include: "#KeyPath"
|
|
127
|
+
- include: "#AtPath"
|
|
128
|
+
NamedSelection:
|
|
129
|
+
patterns:
|
|
130
|
+
- begin: "({{key}})\\s*(:)\\s*{{#PathSelection.begin}}"
|
|
131
|
+
beginCaptures:
|
|
132
|
+
"1":
|
|
133
|
+
name: "{{.alias}}"
|
|
134
|
+
"2":
|
|
135
|
+
name: "{{.alias_colon}}"
|
|
136
|
+
end: "(?=.)"
|
|
137
|
+
applyEndPatternLast: 1
|
|
138
|
+
patterns:
|
|
139
|
+
- include: "#PathSelection"
|
|
140
|
+
- begin: "([.][.][.])\\s*{{#PathSelection.begin}}"
|
|
141
|
+
beginCaptures:
|
|
142
|
+
"1":
|
|
143
|
+
name: "{{.spread}}"
|
|
144
|
+
end: "(?=.)"
|
|
145
|
+
applyEndPatternLast: 1
|
|
146
|
+
patterns:
|
|
147
|
+
- include: "#PathSelection"
|
|
148
|
+
- include: "#PathSelection"
|
|
149
|
+
- begin: "({{key}})\\s*(:)\\s*(?={{#SubSelection.begin}})"
|
|
150
|
+
beginCaptures:
|
|
151
|
+
"1":
|
|
152
|
+
name: "{{.alias}}"
|
|
153
|
+
"2":
|
|
154
|
+
name: "{{.alias_colon}}"
|
|
155
|
+
end: "(?=.)"
|
|
156
|
+
applyEndPatternLast: 1
|
|
157
|
+
patterns:
|
|
158
|
+
- include: "#SubSelection"
|
|
159
|
+
# added back even though it's not part of the current spec: NamedFieldSelection
|
|
160
|
+
- include: "#NamedFieldSelection"
|
|
161
|
+
# temporarily added back
|
|
162
|
+
# NamedFieldSelection ::= Alias? Key SubSelection?
|
|
163
|
+
NamedFieldSelection:
|
|
164
|
+
begin: "(?:({{key}})\\s*(:)\\s*)?({{key}})"
|
|
165
|
+
beginCaptures:
|
|
166
|
+
"1":
|
|
167
|
+
name: "{{.alias}}"
|
|
168
|
+
"2":
|
|
169
|
+
name: "{{.alias_colon}}"
|
|
170
|
+
"3":
|
|
171
|
+
name: "{{.field}}"
|
|
172
|
+
end: "(?=.)"
|
|
173
|
+
applyEndPatternLast: 1
|
|
174
|
+
patterns:
|
|
175
|
+
- include: "#SubSelection"
|
|
176
|
+
# VarPath ::= "$" (NO_SPACE Identifier)? PathTail
|
|
177
|
+
VarPath:
|
|
178
|
+
begin: "([$])({{identifier}})?(?!\\w)"
|
|
179
|
+
beginCaptures:
|
|
180
|
+
"1":
|
|
181
|
+
name: "{{.var_dollar}}"
|
|
182
|
+
"2":
|
|
183
|
+
name: "{{.field}}"
|
|
184
|
+
end: "(?=.)"
|
|
185
|
+
applyEndPatternLast: 1
|
|
186
|
+
patterns:
|
|
187
|
+
- include: "#PathTail"
|
|
188
|
+
# KeyPath ::= Key NonEmptyPathTail
|
|
189
|
+
KeyPath:
|
|
190
|
+
begin: "({{key}})(?={{pathTailMatch}})"
|
|
191
|
+
beginCaptures:
|
|
192
|
+
"1":
|
|
193
|
+
name: "{{.field}}"
|
|
194
|
+
end: "(?=.)"
|
|
195
|
+
applyEndPatternLast: 1
|
|
196
|
+
patterns:
|
|
197
|
+
# "nonEmpty" part already covered through `(?={{pathTailMatch}})` in `begin`
|
|
198
|
+
#- include: "#NonEmptyPathTail"
|
|
199
|
+
- include: "#PathTail"
|
|
200
|
+
# AtPath ::= "@" PathTail
|
|
201
|
+
AtPath:
|
|
202
|
+
begin: "(@)"
|
|
203
|
+
beginCaptures:
|
|
204
|
+
"1":
|
|
205
|
+
name: "{{.at}}"
|
|
206
|
+
end: "(?=.)"
|
|
207
|
+
applyEndPatternLast: 1
|
|
208
|
+
patterns:
|
|
209
|
+
- include: "#PathTail"
|
|
210
|
+
# ExprPath ::= "$(" LitExpr ")" PathTail
|
|
211
|
+
ExprPath:
|
|
212
|
+
begin: "([$])(?=[(])"
|
|
213
|
+
beginCaptures:
|
|
214
|
+
"1":
|
|
215
|
+
name: "{{.expr_dollar}}"
|
|
216
|
+
end: "(?=.)"
|
|
217
|
+
applyEndPatternLast: 1
|
|
218
|
+
patterns:
|
|
219
|
+
- begin: "([(])"
|
|
220
|
+
beginCaptures:
|
|
221
|
+
"1":
|
|
222
|
+
name: "{{.paren_open}}"
|
|
223
|
+
end: "([)])"
|
|
224
|
+
endCaptures:
|
|
225
|
+
"1":
|
|
226
|
+
name: "{{.paren_close}}"
|
|
227
|
+
patterns:
|
|
228
|
+
- include: "#LitExpr"
|
|
229
|
+
- include: "#PathStep"
|
|
230
|
+
# PathTail ::= "?"? (PathStep "?"?)*
|
|
231
|
+
# optional chaining moved into `PathStep` later
|
|
232
|
+
PathTail:
|
|
233
|
+
begin: "([?])?(?=\\s*{{pathStepMatch}})"
|
|
234
|
+
beginCaptures:
|
|
235
|
+
"1":
|
|
236
|
+
name: "{{.optional_chain}}"
|
|
237
|
+
end: "(?=.)"
|
|
238
|
+
applyEndPatternLast: 1
|
|
239
|
+
patterns:
|
|
240
|
+
- include: "#PathStep"
|
|
241
|
+
# NonEmptyPathTail ::= "?"? (PathStep "?"?)+
|
|
242
|
+
# PathStep ::= "." Key | "->" Identifier MethodArgs?
|
|
243
|
+
# changed to and added optional chaining that would usually live in `PathTail`|`NonEmptyPathTail`:
|
|
244
|
+
# PathStepDotAccess ::= "." Key "?"?
|
|
245
|
+
# PathStepArrowMethodArgs ::= "->" Identifier MethodArgs "?"?
|
|
246
|
+
# PathStepArrowAccess ::= "->" Identifier "?"?
|
|
247
|
+
# PathStep ::= PathStepDotAccess | PathStepArrowMethodArgs | PathStepArrowAccess
|
|
248
|
+
PathStepDotAccess:
|
|
249
|
+
match: "([.])({{key}})([?]?)"
|
|
250
|
+
captures:
|
|
251
|
+
"1":
|
|
252
|
+
name: "{{.dot}}"
|
|
253
|
+
"2":
|
|
254
|
+
name: "{{.field}}"
|
|
255
|
+
"3":
|
|
256
|
+
name: "{{.optional_chain}}"
|
|
257
|
+
PathStepArrowMethodArgs:
|
|
258
|
+
begin: "(->)(({{builtinMethod}})|{{identifier}})([(])"
|
|
259
|
+
end: "([)])([?]?)"
|
|
260
|
+
applyEndPatternLast: 1
|
|
261
|
+
beginCaptures:
|
|
262
|
+
"1":
|
|
263
|
+
name: "{{.arrow}}"
|
|
264
|
+
"2":
|
|
265
|
+
name: "{{.method}}"
|
|
266
|
+
"3":
|
|
267
|
+
name: "{{.builtinMethod}}"
|
|
268
|
+
"4":
|
|
269
|
+
name: "{{.brace_open}}"
|
|
270
|
+
endCaptures:
|
|
271
|
+
"1":
|
|
272
|
+
name: "{{.brace_close}}"
|
|
273
|
+
"2":
|
|
274
|
+
name: "{{.optional_chain}}"
|
|
275
|
+
patterns:
|
|
276
|
+
- include: "#LitExpr"
|
|
277
|
+
- match: ","
|
|
278
|
+
name: "{{.comma}}"
|
|
279
|
+
PathStepArrowAccess:
|
|
280
|
+
match: "(->)({{identifier}})([?]?)"
|
|
281
|
+
captures:
|
|
282
|
+
"1":
|
|
283
|
+
name: "{{.arrow}}"
|
|
284
|
+
"2":
|
|
285
|
+
name: "{{.field}}"
|
|
286
|
+
"3":
|
|
287
|
+
name: "{{.optional_chain}}"
|
|
288
|
+
PathStep:
|
|
289
|
+
patterns:
|
|
290
|
+
- include: "#PathStepDotAccess"
|
|
291
|
+
- include: "#PathStepArrowMethodArgs"
|
|
292
|
+
- include: "#PathStepArrowAccess"
|
|
293
|
+
# Key (in variables) ::= Identifier | LitString
|
|
294
|
+
# Identifier (in variables) ::= [a-zA-Z_] NO_SPACE [0-9a-zA-Z_]*
|
|
295
|
+
# MethodArgs (inlined into PathStepArrowMethodArgs) ::= "(" (LitExpr ("," LitExpr)* ","?)? ")"
|
|
296
|
+
# LitExpr ::= LitPath | LitOpChain | LitPrimitive | LitObject | LitArray | PathSelection
|
|
297
|
+
LitExpr:
|
|
298
|
+
patterns:
|
|
299
|
+
# - include: "#LitOpChain"
|
|
300
|
+
- include: "#LitOpChainCenter"
|
|
301
|
+
# - include: "#LitPath"
|
|
302
|
+
- include: "#LitPathTail"
|
|
303
|
+
- include: "#LitPrimitive"
|
|
304
|
+
- include: "#LitObject"
|
|
305
|
+
- include: "#LitArray"
|
|
306
|
+
- include: "#PathSelection"
|
|
307
|
+
- include: "#Comment"
|
|
308
|
+
# LitPath ::= (LitPrimitive | LitObject | LitArray) NonEmptyPathTail
|
|
309
|
+
# changed to
|
|
310
|
+
# LitPathTail ::= NonEmptyPathTail
|
|
311
|
+
# but ensures that it's not the first `LitExpr` by doing a negative lookbehind for `(`, which would indicate we're the first entry in a `ExprPath`.
|
|
312
|
+
LitPathTail:
|
|
313
|
+
begin: "(?<![(])(?={{pathTailMatch}})"
|
|
314
|
+
end: "(?=.)"
|
|
315
|
+
applyEndPatternLast: 1
|
|
316
|
+
patterns:
|
|
317
|
+
# "nonEmpty" part already covered through `(?={{pathTailMatch}})` in `begin`
|
|
318
|
+
#- include: "#NonEmptyPathTail"
|
|
319
|
+
- include: "#PathTail"
|
|
320
|
+
# LitOpChain ::= LitExpr LitOp LitExpr
|
|
321
|
+
# changed to
|
|
322
|
+
# LitOpChainCenter ::= LitOp
|
|
323
|
+
# as `MethodArgs` might match `LitExpr` more than once anyways.
|
|
324
|
+
# Does lookarounds to ensure that it's in the middle of an expression, i.e. not at the start or end.
|
|
325
|
+
LitOpChainCenter:
|
|
326
|
+
match: "(?<![(]|{{operatorCharacter}})({{operator}})(?!\\s*(?:{{operatorCharacter}}|[)]))"
|
|
327
|
+
captures:
|
|
328
|
+
"1":
|
|
329
|
+
name: "{{.operator}}"
|
|
330
|
+
# LitPrimitive ::= LitString | LitNumber | "true" | "false" | "null"
|
|
331
|
+
LitPrimitive:
|
|
332
|
+
patterns:
|
|
333
|
+
- include: "#LitString"
|
|
334
|
+
- include: "#LitNumber"
|
|
335
|
+
- match: "\\b(true|false|null)\\b"
|
|
336
|
+
name: "{{.fixedPrimitive}}"
|
|
337
|
+
# LitString ::= "'" ("\\'" | [^'])* "'" | '"' ('\\"' | [^"])* '"'
|
|
338
|
+
LitString:
|
|
339
|
+
# prettier-ignore
|
|
340
|
+
begin: "((\")|('))"
|
|
341
|
+
end: "{{notEscaped}}(?=\\1)((\")|('))"
|
|
342
|
+
contentName: "{{.string}}"
|
|
343
|
+
beginCaptures:
|
|
344
|
+
"1":
|
|
345
|
+
name: "{{.string_open}}"
|
|
346
|
+
"2":
|
|
347
|
+
name: "{{.string_double}}"
|
|
348
|
+
"3":
|
|
349
|
+
name: "{{.string_single}}"
|
|
350
|
+
endCaptures:
|
|
351
|
+
"1":
|
|
352
|
+
name: "{{.string_close}}"
|
|
353
|
+
"2":
|
|
354
|
+
name: "{{.string_double}}"
|
|
355
|
+
"3":
|
|
356
|
+
name: "{{.string_single}}"
|
|
357
|
+
|
|
358
|
+
# LitNumber ::= "-"? ([0-9]+ ("." [0-9]*)? | "." [0-9]+)
|
|
359
|
+
LitNumber:
|
|
360
|
+
name: "{{.number}}"
|
|
361
|
+
match: "(-?)([0-9]+([.][0-9]*)?|[.][0-9]+)"
|
|
362
|
+
# LitObject ::= "{" (LitProperty ("," LitProperty)* ","?)? "}"
|
|
363
|
+
LitObject:
|
|
364
|
+
begin: "\\s*({)"
|
|
365
|
+
beginCaptures:
|
|
366
|
+
"1":
|
|
367
|
+
name: "{{.brace_open}}"
|
|
368
|
+
end: "\\s*(})"
|
|
369
|
+
endCaptures:
|
|
370
|
+
"1":
|
|
371
|
+
name: "{{.brace_close}}"
|
|
372
|
+
patterns:
|
|
373
|
+
- include: "#LitProperty"
|
|
374
|
+
- match: ","
|
|
375
|
+
name: "{{.comma}}"
|
|
376
|
+
- include: "#Comment"
|
|
377
|
+
# LitProperty ::= Key ":" LitExpr
|
|
378
|
+
LitProperty:
|
|
379
|
+
begin: "\\b({{identifier}})\\s*(:)\\s*"
|
|
380
|
+
beginCaptures:
|
|
381
|
+
"1":
|
|
382
|
+
name: "{{.property}}"
|
|
383
|
+
"2":
|
|
384
|
+
name: "{{.colon}}"
|
|
385
|
+
end: "(?=.)"
|
|
386
|
+
applyEndPatternLast: 1
|
|
387
|
+
patterns:
|
|
388
|
+
- include: "#LitExpr"
|
|
389
|
+
# LitArray ::= "[" (LitExpr ("," LitExpr)* ","?)? "]"
|
|
390
|
+
LitArray:
|
|
391
|
+
begin: "\\s*(\\[)"
|
|
392
|
+
beginCaptures:
|
|
393
|
+
"1":
|
|
394
|
+
name: "{{.bracket_open}}"
|
|
395
|
+
end: "\\s*(\\])"
|
|
396
|
+
endCaptures:
|
|
397
|
+
"1":
|
|
398
|
+
name: "{{.bracket_close}}"
|
|
399
|
+
patterns:
|
|
400
|
+
- include: "#LitExpr"
|
|
401
|
+
- match: ","
|
|
402
|
+
name: "{{.comma}}"
|
|
403
|
+
# LitOp ::= "??" | "?!" | "&&" | "||" | "==" | "!=" | "<" | "<=" | ">" | ">=" | +" | "-" | "*" | "/" | "%"
|
|
404
|
+
# inlined into `LitOpChainCenter`
|
|
405
|
+
# NO_SPACE ::= !SpacesOrComments
|
|
406
|
+
# SpacesOrComments ::= (Spaces | Comment)+
|
|
407
|
+
# Spaces ::= ("⎵" | "\t" | "\r" | "\n")+
|
|
408
|
+
# Comment ::= "#" [^\n]*
|
|
409
|
+
Comment:
|
|
410
|
+
match: "(\\s*)(#.*?)$"
|
|
411
|
+
captures:
|
|
412
|
+
"1":
|
|
413
|
+
name: "{{.comment_leading_ws}}"
|
|
414
|
+
"2":
|
|
415
|
+
name: "{{.comment}}"
|
|
416
|
+
|
|
417
|
+
# additional rules used for strings, e.g. in `POST: "/foo/bar/{$id}"`
|
|
418
|
+
JSONSelectionString:
|
|
419
|
+
contentName: string.quoted
|
|
420
|
+
begin: '(")'
|
|
421
|
+
beginCaptures:
|
|
422
|
+
"1":
|
|
423
|
+
name: "string.quoted.double.graphql {{.string_open}}"
|
|
424
|
+
end: '(")'
|
|
425
|
+
endCaptures:
|
|
426
|
+
"1":
|
|
427
|
+
name: "string.quoted.double.graphql {{.string_close}}"
|
|
428
|
+
patterns:
|
|
429
|
+
- begin: "\\s*({)"
|
|
430
|
+
beginCaptures:
|
|
431
|
+
"1":
|
|
432
|
+
name: "punctuation.section.embedded {{.brace_open}}"
|
|
433
|
+
end: "\\s*(})"
|
|
434
|
+
endCaptures:
|
|
435
|
+
"1":
|
|
436
|
+
name: "punctuation.section.embedded {{.brace_close}}"
|
|
437
|
+
contentName: meta.embedded.string.connectors.mapping.selectionstring.graphql
|
|
438
|
+
debugName: "embedded"
|
|
439
|
+
patterns:
|
|
440
|
+
- include: "#PathSelection"
|