Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(graphql): introduce GraphQL package #240

Draft
wants to merge 2 commits into
base: feat_#232/introduce-graphql-importer
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 --passWithNoTests",
"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
Loading