vscode-apollo 2.3.5 → 2.4.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.
@@ -7,26 +7,63 @@ on:
7
7
  jobs:
8
8
  test:
9
9
  name: Run E2E tests
10
- runs-on: ubuntu-latest
10
+ runs-on: "${{ matrix.os }}"
11
11
  strategy:
12
12
  matrix:
13
13
  version: ["1.90.0", "stable", "insiders"]
14
+ os: [ubuntu-latest]
15
+ include:
16
+ - version: "stable"
17
+ os: "windows-latest"
14
18
  steps:
15
- - run: sudo apt update && sudo apt install -y libasound2t64 libgbm1 libgtk-3-0 libnss3 xvfb expect
19
+ - run: sudo apt update && sudo apt install -y libasound2 libgbm1 libgtk-3-0 libnss3 xvfb expect
20
+ if: runner.os == 'Linux'
16
21
  - uses: actions/checkout@v4
17
22
  - uses: actions/setup-node@v4
18
23
  with:
19
24
  cache: "npm"
20
25
  - run: npm install
21
- - run: npm run build:production
22
26
  - run: echo 'APOLLO_KEY="service:bob-123:489fhseo4"' > ./sampleWorkspace/spotifyGraph/.env
23
- - run: |
27
+ shell: bash
28
+ - name: Install & Configure Rover (Linux)
29
+ run: |
24
30
  expect <<EOF
25
31
  spawn ./node_modules/.bin/rover config auth --profile VSCode-E2E
26
32
  expect "Copy the key and paste it into the prompt below."
27
33
  send -- "test\n"
28
34
  expect eof
29
35
  EOF
30
- - run: xvfb-run -a npm run test:extension
36
+ if: runner.os == 'Linux'
37
+ - name: Install Rover (Windows)
38
+ run: ./node_modules/.bin/rover.cmd --version
39
+ if: runner.os == 'Windows'
40
+ - name: Configure Rover (Windows)
41
+ run: |
42
+ [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
43
+ Start-Process -FilePath ./node_modules/.bin/rover.cmd -ArgumentList "config","auth","--profile","VSCode-E2E"
44
+
45
+ Start-Sleep -m 1000
46
+
47
+ [System.Windows.Forms.SendKeys]::SendWait("test")
48
+ [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
49
+ if: runner.os == 'Windows'
50
+ shell: powershell
51
+ - name: Adjust configuration (Windows)
52
+ run: |
53
+ sed -i -e 's/\(bin:.*\)/\1.exe/' sampleWorkspace/rover/apollo.config.yaml
54
+ cat sampleWorkspace/rover/apollo.config.yaml
55
+ # for some reason, windows seems to ignore the jest.e2e.config.js file
56
+ echo "module.exports = require('./jest.e2e.config')" > jest.config.ts
57
+ shell: bash
58
+ if: runner.os == 'Windows'
59
+ - run: npm run build:production
60
+ - name: "Run Extension E2E tests (Linux)"
61
+ run: xvfb-run -a npm run test:extension
62
+ env:
63
+ VSCODE_VERSION: "${{ matrix.version }}"
64
+ if: runner.os == 'Linux'
65
+ - name: "Run Extension E2E tests (Windows)"
66
+ run: npm run test:extension
31
67
  env:
32
68
  VSCODE_VERSION: "${{ matrix.version }}"
69
+ if: runner.os == 'Windows'
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#236](https://github.com/apollographql/vscode-graphql/pull/236) [`9a4403db`](https://github.com/apollographql/vscode-graphql/commit/9a4403db7b8f9cb03638d83a7e3c29dd3c3077b7) Thanks [@pubmodmatt](https://github.com/pubmodmatt)! - Add support for GraphQL in Notebook cells
8
+
9
+ ### Patch Changes
10
+
11
+ - [#240](https://github.com/apollographql/vscode-graphql/pull/240) [`3dfd9ac0`](https://github.com/apollographql/vscode-graphql/commit/3dfd9ac08a20ff92cafb398f1a8c71e5f7d03519) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug handling windows path separators in `FileSet` instances.
12
+
13
+ ## 2.3.6
14
+
15
+ ### Patch Changes
16
+
17
+ - [#216](https://github.com/apollographql/vscode-graphql/pull/216) [`1add31e0`](https://github.com/apollographql/vscode-graphql/commit/1add31e0e9bc2da92ea7c3a1c65206cc5d95bb68) Thanks [@phryneas](https://github.com/phryneas)! - Add JSON schema for `supergraph.yaml`.
18
+
3
19
  ## 2.3.5
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vscode-apollo",
3
3
  "displayName": "Apollo GraphQL",
4
4
  "description": "Rich editor support for GraphQL client and server development that seamlessly integrates with the Apollo platform",
5
- "version": "2.3.5",
5
+ "version": "2.4.0",
6
6
  "referenceID": "87197759-7617-40d0-b32e-46d378e907c7",
7
7
  "author": "Apollo GraphQL <opensource@apollographql.com>",
8
8
  "license": "MIT",
@@ -258,6 +258,10 @@
258
258
  {
259
259
  "fileMatch": "apollo.config.yaml",
260
260
  "url": "./schemas/apollo.config.schema.json"
261
+ },
262
+ {
263
+ "fileMatch": "supergraph.yaml",
264
+ "url": "./schemas/supergraph_config_schema.json"
261
265
  }
262
266
  ],
263
267
  "commands": [
@@ -0,0 +1,119 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "SupergraphConfig",
4
+ "description": "The configuration for a single supergraph composed of multiple subgraphs.",
5
+ "type": "object",
6
+ "required": [
7
+ "subgraphs"
8
+ ],
9
+ "properties": {
10
+ "federation_version": {
11
+ "anyOf": [
12
+ {
13
+ "$ref": "#/definitions/FederationVersion"
14
+ },
15
+ {
16
+ "type": "null"
17
+ }
18
+ ]
19
+ },
20
+ "subgraphs": {
21
+ "type": "object",
22
+ "additionalProperties": {
23
+ "$ref": "#/definitions/SubgraphConfig"
24
+ }
25
+ }
26
+ },
27
+ "definitions": {
28
+ "FederationVersion": {
29
+ "pattern": "^(1|2|=2\\.\\d+\\.\\d+.*)$"
30
+ },
31
+ "SchemaSource": {
32
+ "description": "Options for getting SDL: the graph registry, a file, or an introspection URL.\n\nNOTE: Introspection strips all comments and directives from the SDL.",
33
+ "anyOf": [
34
+ {
35
+ "type": "object",
36
+ "required": [
37
+ "file"
38
+ ],
39
+ "properties": {
40
+ "file": {
41
+ "type": "string"
42
+ }
43
+ }
44
+ },
45
+ {
46
+ "type": "object",
47
+ "required": [
48
+ "subgraph_url"
49
+ ],
50
+ "properties": {
51
+ "introspection_headers": {
52
+ "type": [
53
+ "object",
54
+ "null"
55
+ ],
56
+ "additionalProperties": {
57
+ "type": "string"
58
+ }
59
+ },
60
+ "subgraph_url": {
61
+ "type": "string",
62
+ "format": "uri"
63
+ }
64
+ }
65
+ },
66
+ {
67
+ "type": "object",
68
+ "required": [
69
+ "graphref",
70
+ "subgraph"
71
+ ],
72
+ "properties": {
73
+ "graphref": {
74
+ "type": "string"
75
+ },
76
+ "subgraph": {
77
+ "type": "string"
78
+ }
79
+ }
80
+ },
81
+ {
82
+ "type": "object",
83
+ "required": [
84
+ "sdl"
85
+ ],
86
+ "properties": {
87
+ "sdl": {
88
+ "type": "string"
89
+ }
90
+ }
91
+ }
92
+ ]
93
+ },
94
+ "SubgraphConfig": {
95
+ "description": "Config for a single [subgraph](https://www.apollographql.com/docs/federation/subgraphs/)",
96
+ "type": "object",
97
+ "required": [
98
+ "schema"
99
+ ],
100
+ "properties": {
101
+ "routing_url": {
102
+ "description": "The routing URL for the subgraph. This will appear in supergraph SDL and instructs the graph router to send all requests for this subgraph to this URL.",
103
+ "type": [
104
+ "string",
105
+ "null"
106
+ ]
107
+ },
108
+ "schema": {
109
+ "description": "The location of the subgraph's SDL",
110
+ "allOf": [
111
+ {
112
+ "$ref": "#/definitions/SchemaSource"
113
+ }
114
+ ]
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
@@ -41,6 +41,11 @@ if (test === origTest.skip) {
41
41
  );
42
42
  }
43
43
 
44
+ if (process.platform === "win32") {
45
+ console.info("Skipping rover E2E tests in Windows");
46
+ test = origTest.skip;
47
+ }
48
+
44
49
  let editor: TextEditor;
45
50
  let getPosition: GetPositionFn;
46
51
  beforeAll(async () => {
@@ -63,13 +63,13 @@ test("wrong token", async () => {
63
63
 
64
64
  // currently, this logs twice, along with a full stracktrace, but no indication of where it came from
65
65
  // this should be improved on.
66
- expect(output).toContain(
66
+ expect(output.replace(/\s/g, "")).toContain(
67
67
  `
68
68
  [GraphQL error]: HTTP fetch failed from 'kotlin': 406: Not Acceptable
69
69
  [GraphQL error]: Invalid credentials provided
70
70
  ApolloError: HTTP fetch failed from 'kotlin': 406: Not Acceptable
71
71
  Invalid credentials provided
72
- at new ApolloError`.trim(),
72
+ at new ApolloError`.replace(/\s/g, ""),
73
73
  );
74
74
  } finally {
75
75
  await mocks.loadDefaultMocks(baseUri);
@@ -2,7 +2,7 @@ import { minimatch } from "minimatch";
2
2
  import { globSync } from "glob";
3
3
  import { invariant } from "../tools";
4
4
  import { URI } from "vscode-uri";
5
- import { normalizeURI } from "./utilities";
5
+ import { normalizeURI, withUnixSeparator } from "./utilities";
6
6
  import { resolve } from "path";
7
7
 
8
8
  export class FileSet {
@@ -35,13 +35,13 @@ export class FileSet {
35
35
  this.includes.some((include) => {
36
36
  return minimatch(
37
37
  normalizedFilePath,
38
- resolve(this.rootURI.fsPath, include),
38
+ withUnixSeparator(resolve(this.rootURI.fsPath, include)),
39
39
  );
40
40
  }) &&
41
41
  !this.excludes.some((exclude) => {
42
42
  return minimatch(
43
43
  normalizedFilePath,
44
- resolve(this.rootURI.fsPath, exclude),
44
+ withUnixSeparator(resolve(this.rootURI.fsPath, exclude)),
45
45
  );
46
46
  })
47
47
  );
@@ -48,6 +48,7 @@ const fileAssociations: { [extension: string]: string } = {
48
48
  ".re": "reason",
49
49
  ".ex": "elixir",
50
50
  ".exs": "elixir",
51
+ ".ipynb": "python",
51
52
  };
52
53
 
53
54
  export interface GraphQLInternalProjectConfig extends GraphQLProjectConfig {
@@ -157,13 +157,14 @@ connection.onInitialized(async () => {
157
157
  });
158
158
 
159
159
  const documents = new TextDocuments(TextDocument);
160
+ const schemes = ["file", "vscode-notebook-cell"];
160
161
 
161
162
  // Make the text document manager listen on the connection
162
163
  // for open, change and close text document events
163
164
  documents.listen(connection);
164
165
 
165
- function isFile(uri: string) {
166
- return URI.parse(uri).scheme === "file";
166
+ function isEnabledDocument(uri: string) {
167
+ return schemes.includes(URI.parse(uri).scheme);
167
168
  }
168
169
 
169
170
  documents.onDidChangeContent((params) => {
@@ -173,8 +174,7 @@ documents.onDidChangeContent((params) => {
173
174
  );
174
175
  if (!project) return;
175
176
 
176
- // Only watch changes to files
177
- if (!isFile(params.document.uri)) {
177
+ if (!isEnabledDocument(params.document.uri)) {
178
178
  return;
179
179
  }
180
180
 
@@ -213,8 +213,7 @@ connection.onDidChangeWatchedFiles((params) => {
213
213
  continue;
214
214
  }
215
215
 
216
- // Only watch changes to files
217
- if (!isFile(uri)) {
216
+ if (!isEnabledDocument(uri)) {
218
217
  continue;
219
218
  }
220
219
 
@@ -1,6 +1,6 @@
1
1
  import { URI } from "vscode-uri";
2
2
 
3
- const withUnixSeparator = (uriString: string) =>
3
+ export const withUnixSeparator = (uriString: string) =>
4
4
  uriString.split(/[\/\\]/).join("/");
5
5
 
6
6
  export const normalizeURI = (uriString: string) => {
@@ -30,7 +30,7 @@ export const minimumKnownExtensions: Record<
30
30
  typescriptreact: [".tsx"],
31
31
  vue: [".vue"],
32
32
  svelte: [".svelte"],
33
- python: [".py"],
33
+ python: [".py", ".ipynb"],
34
34
  ruby: [".rb"],
35
35
  dart: [".dart"],
36
36
  reason: [".re"],