Skip to content

Commit

Permalink
feat(graphql): introduce GraphQL package
Browse files Browse the repository at this point in the history
closes #237
  • Loading branch information
ostridm committed Mar 29, 2024
1 parent 585f7d2 commit 27e1414
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/graphql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# @har-sdk/graphql

[![Maintainability](https://api.codeclimate.com/v1/badges/4acaec95c82465cb2c3d/maintainability)](https://codeclimate.com/github/NeuraLegion/har-sdk/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/4acaec95c82465cb2c3d/test_coverage)](https://codeclimate.com/github/NeuraLegion/har-sdk/test_coverage)
[![Build Status](https://github.com/NeuraLegion/har-sdk/actions/workflows/auto-build.yml/badge.svg?branch=master)](https://github.com/NeuraLegion/har-sdk/actions/workflows/auto-build.yml?query=branch%3Amaster+event%3Apush)
[![NPM Downloads](https://img.shields.io/npm/dw/@har-sdk/graphql?label=NPM%20Downloads)](https://www.npmjs.com/package/@har-sdk/graphql)

Transform your [GraphQL introspection](https://spec.graphql.org/draft/#sec-Introspection) or [GraphQL schema collection](https://spec.graphql.org/draft) into a series of [HAR request objects](http://www.softwareishard.com/blog/har-12-spec/#request). This can be useful for a variety of purposes, such as analyzing network performance and debugging web applications.

- Automatically generates fake data for all parameters
- Simple and easy-to-use API.
- Supports variety of community adopted [custom SCALAR](https://spec.graphql.org/draft/#sec-Scalars.Custom-Scalars) types out of the box.
- Supports [GraphQL multipart request specification](https://github.com/jaydenseric/graphql-multipart-request-spec).

With this library, you can easily generate requests with fake data to test your API using [AutoCannon](https://github.com/mcollina/autocannon#readme) or [DevTools](https://developer.chrome.com/blog/new-in-devtools-62/#har-imports).

## Setup

To install the library, run the following command:

```bash
$ npm i --save @har-sdk/graphql
```

## License

Copyright © 2024 [Bright Security](https://brightsec.com/).

This project is licensed under the MIT License - see the [LICENSE file](https://github.com/NeuraLegion/har-sdk/blob/master/LICENSE) for details.
14 changes: 14 additions & 0 deletions packages/graphql/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
displayName: 'graphql',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.json'
}
},
transform: {
'^.+\\.[tj]s$': 'ts-jest'
},
moduleFileExtensions: ['ts', 'js', 'json'],
coverageDirectory: '../../coverage/graphql',
preset: '../../jest.preset.js'
};
48 changes: 48 additions & 0 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "@har-sdk/graphql",
"version": "0.0.0",
"private": false,
"repository": {
"type": "git",
"url": "git+https://github.com/NeuraLegion/har-sdk.git"
},
"author": {
"name": "Artem Derevnjuk",
"email": "[email protected]"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/NeuraLegion/har-sdk/issues"
},
"publishConfig": {
"access": "public"
},
"files": [
"dist/**"
],
"keywords": [
"graphql",
"har",
"api"
],
"main": "./dist/bundle.umd.js",
"module": "./dist/bundle.esm5.js",
"es2015": "./dist/index.js",
"types": "./dist/index.d.ts",
"homepage": "https://github.com/NeuraLegion/har-sdk/tree/master/packages/graphql#readme",
"scripts": {
"prebuild": "npm run compile -- --clean",
"build": "npm run compile && npm run bundle",
"bundle": "rollup -c ../../rollup.config.js",
"lint": "eslint --ignore-path ../../.eslintignore .",
"format": "prettier --ignore-path ../../.prettierignore --check .",
"compile": "tsc -b tsconfig.build.json",
"test": "cross-env NODE_ENV=test jest",
"coverage": "cross-env NODE_ENV=test jest --coverage"
},
"dependencies": {
"@har-sdk/core": "*",
"tslib": "^2.3.1"
},
"devDependencies": {}
}
Empty file added packages/graphql/src/index.ts
Empty file.
9 changes: 9 additions & 0 deletions packages/graphql/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.build.json",
"compilerOptions": {
"outDir": "./dist",
"declarationDir": "./dist"
},
"include": ["src/**/*"],
"exclude": ["src/**/*.spec.ts", "tests/**/*"]
}
8 changes: 8 additions & 0 deletions packages/graphql/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": "."
},
"include": ["src/**/*", "tests/**/*", "tests/**/*.json"]
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
{ "path": "packages/oas" },
{ "path": "packages/openapi-sampler" },
{ "path": "packages/postman" },
{ "path": "packages/graphql" },
{ "path": "packages/validator" },
{ "path": "packages/types" },
{ "path": "packages/editor" },
Expand Down

0 comments on commit 27e1414

Please sign in to comment.