Skip to content

Commit

Permalink
🔖 release 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gitsunmin committed Jun 29, 2024
1 parent b5b9fba commit d01c5c0
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 36 deletions.
4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
{
"version": "0.2.0",
"configurations": [

{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/example/bun-graphql-server"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Change Log
<!-- Check [Keep a Changelog](http://keepachangelog.com/) -->

## [0.1.2] - 2024-06-20

### Added
- Added GraphQL Server Example to enable Graph Man

### Changed
- update [README.md](README.md)
- Change Graphqls View to Show Only ".gaph-man/" Subtrees

### Fixed
- Fix Commands, Send GraphQL: Update the icon to be seen in the ".gql" file as well
- Fix Commands, Show GraphQL: Update to display Error Message in case of GQL Errors

## [0.1.1] - 2024-06-26

### Added
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ This Extension is a Tester for GraphQL Queries and Mutations.
- [x] Test GraphQL Queries And Mutations
- [x] Save Queries And Mutations
- [x] Settings For Custom Headers
- [x] Settings For Custom Variables
- [ ] Load Schema From URL Or File
- [ ] Merge Queries And Mutations

Expand All @@ -24,10 +23,14 @@ This Extension is a Tester for GraphQL Queries and Mutations.
2. Create `.graph-man` folder in your project root
3. Create Configration File (name is `.graph-man/config.json`)
1. Example Config File: [config.json](.graph-man/config.json)
2. Example .graphql File: [test.graphql](.graph-man/example.graphql)
4. Create Queries And Mutations Files (`.graph-man/test.graphql`)
5. Select Your Environment to Side Bar
![usage0](.docs/images/usage0.png)
1. Run Your Query Or Mutation from (`.graph-man/**.graphql`) file
![usage1](.docs/images/usage1.png)
![usage2](.docs/images/usage2.png)
4. Create Queries And Mutations Files (`.graph-man/example.graphql`)
1. Example Query File: [test.graphql](.graph-man/example.graphql).
5. Select Your Environment to Side Bar
<image src="https://github.com/gitsunmin/graph-man/blob/master/.docs/images/usage0.png" width="500px" />

6. Run Your Query Or Mutation from (`.graph-man/**.graphql`) file

<image src="https://github.com/gitsunmin/graph-man/blob/master/.docs/images/usage1.png" width="800px"/>

<image src="https://github.com/gitsunmin/graph-man/blob/master/.docs/images/usage2.png" width="800px"/>

Binary file modified bun.lockb
Binary file not shown.
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "graph-man",
"displayName": "Graph Man",
"description": "This Extension is a Tester for GraphQL Queries and Mutations.",
"version": "0.1.1",
"version": "0.1.2",
"icon": "icon.webp",
"engines": {
"vscode": "^1.89.0"
Expand All @@ -11,6 +11,7 @@
"type": "git",
"url": "https://github.com/gitsunmin/graph-man.git"
},
"categories": ["Testing", "Other"],
"publisher": "gitsunmin",
"main": "./dist/extension.js",
"activationEvents": [
Expand Down Expand Up @@ -102,18 +103,18 @@
"publish": "vsce publish"
},
"devDependencies": {
"@biomejs/biome": "^1.8.2",
"@types/mocha": "^10.0.6",
"@types/node": "18.x",
"@biomejs/biome": "^1.8.3",
"@types/mocha": "^10.0.7",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/vscode": "^1.89.0",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@vscode/test-cli": "^0.0.9",
"@vscode/test-electron": "^2.3.9",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"eslint": "^8.57.0",
"esbuild": "^0.20.2",
"esbuild": "^0.21.5",
"eslint": "^9.6.0",
"npm-run-all": "^4.1.5",
"typescript": "5.3.3",
"vsce": "^2.15.0"
Expand Down
10 changes: 6 additions & 4 deletions src/commands/send-graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const sendGraphQL =
},
},
({ value: { environment } }) => {
const { url: endpoint = '', headers = {} } = environment[selectedEnvironment] || {};
const { url: endpoint = "", headers = {} } =
environment[selectedEnvironment] || {};

GQL.send({
query,
Expand All @@ -46,16 +47,17 @@ export const sendGraphQL =

match(result)
.with(E.LEFT, () => {
vscode.window.showErrorMessage(`GQL error | endpoint: ${endpoint}`);
vscode.window.showErrorMessage(
`GQL error | endpoint: ${endpoint}`,
);
})
.with(E.RIGHT, () => {
vscode.window.showInformationMessage(
`GQL success | endpoint: ${endpoint}`,
);
})
.exhaustive();
}
);
});
},
)
.otherwise(() => vscode.window.showErrorMessage("Environment not found"));
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function activate(context: vscode.ExtensionContext) {
rootPath,
);
const graphqlFilesTreeProvider = new GraphqlFilesProvider(
path.join(rootPath, '.graph-man'),
path.join(rootPath, ".graph-man"),
);

const environmentTreeview = vscode.window.createTreeView(
Expand Down
30 changes: 16 additions & 14 deletions src/lib/gql/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { P, match } from 'ts-pattern';
import { P, match } from "ts-pattern";
import { E } from "../fp/Either";

const send = async <D = unknown, E = unknown>({
const send = async <D = unknown, Err = { massege: string }>({
query = "",
variables = {},
endpoint,
Expand All @@ -14,18 +14,20 @@ const send = async <D = unknown, E = unknown>({
}) => {
try {
const response = await fetch(endpoint, {
method: "POST",
headers: {
Accept:
"application/graphql-response+json; charset=utf-8, application/json; charset=utf-8",
"Content-Type": "application/json",
...headers,
},
body: JSON.stringify({
query,
variables,
}),
}).then((res) => res.json() as Promise<{ data: D, errors?: E | undefined }>);
method: "POST",
headers: {
Accept:
"application/graphql-response+json; charset=utf-8, application/json; charset=utf-8",
"Content-Type": "application/json",
...headers,
},
body: JSON.stringify({
query,
variables,
}),
}).then(
(res) => res.json() as Promise<{ data: D; errors?: Err | undefined }>,
);

return match(response)
.with({ errors: P.nonNullable }, E.Left)
Expand Down

0 comments on commit d01c5c0

Please sign in to comment.