Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
f68803e
Initial commit
shalarewicz May 14, 2022
0903e2e
added prettier config settings
evanmcneely May 14, 2022
bb3a2f1
Merge pull request #1 from oslabs-beta/sh/env-setup
shalarewicz May 17, 2022
07d76bc
intitial jest and typescript config
shalarewicz May 17, 2022
0656e58
RateLimiter spec closes #9. Test for token bucket algorithm closes #4.
shalarewicz May 17, 2022
778f0a6
updated test script to pass without any tests
shalarewicz May 17, 2022
53b01c9
eslint/prettier config. Name change
shalarewicz May 18, 2022
c3367cf
tsconfig tweak
shalarewicz May 18, 2022
37012d2
resolving some errors with eslint and ts
evanmcneely May 19, 2022
2aaf2f4
Created types and function definitions for the get type weights function
evanmcneely May 19, 2022
7973e37
renamed the file to buildTypeWeights
evanmcneely May 19, 2022
7f5f655
started to layout the test structure for buildTypeWeight function
evanmcneely May 19, 2022
3836d66
Added redis-mock for testing. Updated RateLimiter and TokenBucket spe…
shalarewicz May 19, 2022
62b89b6
added reset tests for rate limiter
shalarewicz May 19, 2022
c12b9e6
corrected jest config
shalarewicz May 19, 2022
094847e
added a default type weights configuration to the function parameters
evanmcneely May 19, 2022
06a119c
moved types to @types folder
evanmcneely May 20, 2022
f3c1118
wrote tests for buildTypeWeights functionality and configurability
evanmcneely May 20, 2022
45c0a61
Create pull_request_template.md
shalarewicz May 20, 2022
96ab047
added some tests and reworked expected output
evanmcneely May 20, 2022
43e0dd2
finish writing and proof reading tests
evanmcneely May 20, 2022
7b05588
finished writing an overview of implementation for buildTypeWeightsFr…
evanmcneely May 20, 2022
ee63bb7
added timestamp to processRequest for RateLimiters and overahauled To…
shalarewicz May 20, 2022
6f9d873
fixed a ts error in tokenBucket.ts
evanmcneely May 20, 2022
1164121
skipped all tests for now
evanmcneely May 20, 2022
572987a
Fixed test for negative tokenbucket refillRate and capacity
shalarewicz May 20, 2022
f579f1a
disabled TokenBucket tests for travis build
shalarewicz May 20, 2022
9d08980
added types to varibales in token bucket tests
evanmcneely May 20, 2022
e88e0c1
Made RateLimiter.processRequest async and updated TokenBucket tests a…
shalarewicz May 20, 2022
350a000
Merge pull request #13 from oslabs-beta/shalarewicz-patch-2
feiw101 May 21, 2022
d781198
add todo items to describe how additional functionality should be tested
evanmcneely May 21, 2022
cd0f1c1
separated allowed/blocked token bucket tests for clarity
shalarewicz May 21, 2022
5f69d87
futher separate token bucket tests.
shalarewicz May 21, 2022
f796230
Merge branch 'dev' into sh/jest-ts-config
shalarewicz May 21, 2022
f9d4246
created the function signature for getQueryComplexity and the framewo…
evanmcneely May 21, 2022
22bf283
Merge branch 'dev' into em/typeWeightsTest
evanmcneely May 21, 2022
2f838b8
Merge pull request #14 from oslabs-beta/em/typeWeightsTest
evanmcneely May 21, 2022
1854b48
Merge branch 'dev' into sh/jest-ts-config
shalarewicz May 21, 2022
f6241df
typescript tweak
shalarewicz May 21, 2022
1bbb5fc
Merge pull request #12 from oslabs-beta/sh/jest-ts-config
shalarewicz May 21, 2022
6566b9e
refactored the type weight object to be readonly
evanmcneely May 21, 2022
92a2569
renamed complexity analysis file structure to distinguish this feaure…
evanmcneely May 21, 2022
e059eab
commititng before power fail
evanmcneely May 21, 2022
09ab664
initial framework and spec for express rate limiting middleware.
shalarewicz May 21, 2022
f943940
added redis client connection options
shalarewicz May 21, 2022
4ee8a3a
added rate limiter options param
shalarewicz May 21, 2022
9bafb44
finished writing the bulk of the tests for getQueryTypeComplxity
evanmcneely May 21, 2022
20b088d
Merge branch 'dev' of https://github.com/oslabs-beta/GraphQL-Gate int…
evanmcneely May 21, 2022
80cf777
added more tests to the buildTypeWeights function to check for more s…
evanmcneely May 22, 2022
0ff813b
Removed tempalte schema code at the bottom of the file
evanmcneely May 22, 2022
3951486
updated the type weights object after rethinking how that function is…
evanmcneely May 22, 2022
3282b49
added some annotations at the end of the day
evanmcneely May 22, 2022
8f19ce2
Updated the error handling test
evanmcneely May 22, 2022
2fa2ad3
wrote out all af the possible graphql types and how they relate to th…
evanmcneely May 22, 2022
2ab8c5c
expanded on... something. Power went out and its 2 days later now.
evanmcneely May 23, 2022
2162d40
removed the topic type from the test schema and added scalars as a qu…
evanmcneely May 23, 2022
eb23356
added a test to check for error if schema is invalid
evanmcneely May 23, 2022
61e96b0
added timestamp task for express middleware
shalarewicz May 23, 2022
3384164
Merge pull request #19 from oslabs-beta/sh/middleware-framework
shalarewicz May 23, 2022
c435c93
merged the changes from buildTypeWeights tests
evanmcneely May 25, 2022
6a55933
Initial tests for middleware funcitonality.
shalarewicz May 25, 2022
16ea57a
minor test cleanup for express middleware and eslint config change.
shalarewicz May 26, 2022
e5c194c
broke the lists test into two, one for listss with arguments and the …
evanmcneely May 27, 2022
259da24
added readonly properites to the typeWeightObject types
evanmcneely May 27, 2022
4911724
split the test for lists into two, one for lists with arguments and t…
evanmcneely May 27, 2022
edab88d
addressing changes requested in PR
evanmcneely May 27, 2022
6243d26
Merge branch 'dev' into em/complexityTests
evanmcneely May 27, 2022
7202a25
addressing changes from PR review
evanmcneely May 27, 2022
760cdb5
skipping the tests to pass the Travis CI tests
evanmcneely May 27, 2022
1910d65
Merge branch 'em/complexityTests' of https://github.com/oslabs-beta/G…
evanmcneely May 27, 2022
e76c0ef
Merge branch 'dev' into em/typeWeightsTest
evanmcneely May 27, 2022
3510641
corrected an error with one of the expected results from a test.
evanmcneely May 27, 2022
3817cd4
update the expected typeWeightsObject in the comlpxity tests to inclu…
evanmcneely May 27, 2022
211fc29
removed some notes on implementation details. Not relevent in tests
evanmcneely May 27, 2022
b6b31cf
Merge branch 'em/typeWeightsTest' of https://github.com/oslabs-beta/G…
evanmcneely May 27, 2022
4fc2900
Updated redis tests
shalarewicz May 28, 2022
ad8cc4e
resolved PR comments.
shalarewicz May 28, 2022
1573f57
updated jest config to use typescript for module support.
shalarewicz May 28, 2022
f4c4c6c
lint fix
shalarewicz May 28, 2022
f2e5764
Merge pull request #22 from oslabs-beta/em/typeWeightsTest
evanmcneely May 28, 2022
4fd8bc4
Merge branch 'dev' into em/complexityTests
evanmcneely May 28, 2022
f0f9a01
lint fix
evanmcneely May 28, 2022
35a928d
Merge pull request #23 from oslabs-beta/em/complexityTests
evanmcneely May 28, 2022
1e67be0
corrected query complexity for express tests
shalarewicz May 28, 2022
206a859
Merge branch 'dev' of into sh/middleware-framework
shalarewicz May 28, 2022
541e22f
created the framework for the token bucket algo
evanmcneely May 28, 2022
5832d86
added the code to check elapsed time since last query and update toke…
evanmcneely May 28, 2022
abcf30c
trying to configure redis-mock to connect and read/write for the tests
evanmcneely May 28, 2022
c588c8d
refactored tokenBucket a bit
evanmcneely May 28, 2022
1fc467f
fixed ts errors
evanmcneely May 28, 2022
3f1b976
refactored the token bucket algo and tests to use ioredis client inst…
evanmcneely May 28, 2022
52db84f
token bucket is passing all of the tests minus 1 which i dont undrstand
evanmcneely May 29, 2022
4f77bb1
refactored the token bucket
evanmcneely May 29, 2022
f13ef9c
added a comment to tests
evanmcneely May 29, 2022
e3cddeb
added timestamp
evanmcneely May 29, 2022
8e55d04
Merge branch 'dev' into em/tokenBucketAlgo
evanmcneely May 29, 2022
c7827b5
tests worknig with require(ioredis-mock) mut ts-eslint dont like it. …
evanmcneely May 29, 2022
cabdebe
bypassed ellint errors for tests
evanmcneely May 31, 2022
946f616
Merge branch 'em/tokenBucketAlgo' of https://github.com/oslabs-beta/G…
evanmcneely May 31, 2022
6fcefc3
swaped note-redis for ioredis in index.ts
evanmcneely May 31, 2022
81d645b
wrote the framework for the express middleware.
evanmcneely May 31, 2022
acc95cc
added some comments ofr easiser draft review
evanmcneely May 31, 2022
1d47887
refactored token bucket tests to use ioredis
evanmcneely May 31, 2022
4074bc8
installed ioredis-mock
evanmcneely May 31, 2022
3ac1c94
refactored middleware and complexityAnalysis to use variables
evanmcneely May 31, 2022
18c06d2
removed query variables parameter in complexityAnalysis. An issue for…
evanmcneely May 31, 2022
0e9447f
refactored middleware to to .send an rejected request.
evanmcneely May 31, 2022
54283cc
updated jest config to typescript.
shalarewicz Jun 1, 2022
5fcd37b
Initial buildTypeWeight algorithm
shalarewicz Jun 1, 2022
2063e3f
middleware is now parseing and validating the query before processing…
evanmcneely Jun 1, 2022
cc97c8e
refactored the type complexity analysis function to accept query vari…
evanmcneely Jun 1, 2022
b24fcb9
fixed tests with variables
evanmcneely Jun 1, 2022
e0e540d
laid out the framework for the type complxity analysis algorithm
evanmcneely Jun 1, 2022
610d7b5
commiting changes. considering overall strategy
evanmcneely Jun 1, 2022
3d2cebf
minor cleanup and updated weight function
shalarewicz Jun 2, 2022
d29c6d4
Merge pull request #24 from oslabs-beta/sh/middleware-framework
shalarewicz Jun 2, 2022
cb183c0
started to refactor the complexity analysis to use seperate functions…
evanmcneely Jun 2, 2022
68ac079
Merge branch 'dev' of github.com:oslabs-beta/GraphQL-Gate into sh/bui…
shalarewicz Jun 2, 2022
92a0a6a
refactored the type complexity analysis to use several functions, eac…
evanmcneely Jun 2, 2022
8f5f86e
debugging comlpexity algorithm
evanmcneely Jun 2, 2022
57a8cd8
type complexity analysis working for first test. changed i + 1 to i += 1
evanmcneely Jun 2, 2022
9beb1ce
passing all test up to and including aliases
evanmcneely Jun 2, 2022
e55e2fe
changed hard coded numbers to to the proper variables
evanmcneely Jun 2, 2022
b6a7c0a
Merge branch 'dev' of https://github.com/oslabs-beta/GraphQL-Gate int…
evanmcneely Jun 2, 2022
82bd25b
refactoring middleware tests to use ioredis
evanmcneely Jun 2, 2022
cfbf8b9
refactored redis options in tests to work with ioredis
evanmcneely Jun 2, 2022
c118dc3
Merge pull request #29 from oslabs-beta/em/tokenBucketAlgo
evanmcneely Jun 2, 2022
9175747
resolved mergo conflicts from dev
evanmcneely Jun 2, 2022
2eedcbe
refactored the import of express rate limeter to work in test file
evanmcneely Jun 2, 2022
6923c53
resolved merge conflicts with dev
evanmcneely Jun 2, 2022
8d09a5c
added a chart to describe the AST node connections
evanmcneely Jun 2, 2022
92aa047
added a description for redis client options
evanmcneely Jun 2, 2022
1a75e56
converted type weight keys to lowercase
shalarewicz Jun 3, 2022
6e6a4fd
updated parameters for weight function in typeComplexity tests
shalarewicz Jun 3, 2022
11de437
comment cleanup for type weight tests
shalarewicz Jun 3, 2022
985d3b2
modularized typeWeight algorithm
shalarewicz Jun 3, 2022
706861a
added support for scalars and enums in type weight function
shalarewicz Jun 3, 2022
b92e08d
Merge branch 'dev' of github.com:oslabs-beta/GraphQL-Gate into sh/bui…
shalarewicz Jun 3, 2022
c3f5e1e
import cleanup
shalarewicz Jun 4, 2022
3cfbef4
Merge pull request #32 from oslabs-beta/em/middleware
shalarewicz Jun 4, 2022
c464162
Merge branch 'dev' of github.com:oslabs-beta/GraphQL-Gate into em/typ…
shalarewicz Jun 4, 2022
39473b5
Merge branch 'dev' into sh/build-type-weights
shalarewicz Jun 4, 2022
4cd7382
Merge pull request #33 from oslabs-beta/sh/build-type-weights
jondeweydev Jun 4, 2022
ece955b
Merge branch 'dev' into em/typeComplexityAlgo
shalarewicz Jun 4, 2022
4ea037f
exported types for succesful typescript build.
shalarewicz Jun 13, 2022
9ef5624
lint fix
shalarewicz Jun 13, 2022
1b0ac1b
Merge pull request #34 from oslabs-beta/em/typeComplexityAlgo
evanmcneely Jun 17, 2022
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
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [["@babel/preset-env", { "targets": { "node": "current" } }], "@babel/preset-typescript"],
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
30 changes: 30 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"airbnb-base",
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"project": "./tsconfig.json"
},
"plugins": ["import", "prettier"],
"rules": {
"no-plusplus": [2, {
"allowForLoopAfterthoughts": true
}],
"prettier/prettier": [
"error"
]
},
"ignorePatterns": ["jest.*", "build/*"]
}
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Summary
_Provide a short summary of the changes in this PR_

### Type of Change
Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

### Issues
- Link any issues this PR resolves using keywords (resolve, closes, fixed)

### Evidence
- Provide evidence of the the changes functioning as expected or describe your tests. If tests are included in the CI pipeline this may be omitted.


_(delete this line)_ Prior to submitting the PR assign a reviewer from each team to review this PR.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,5 @@ dist

# TernJS port file
.tern-port

build/*
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# Runs all code quality tools prior to each commit.
npx lint-staged
Empty file added .prettierignore
Empty file.
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"printWidth": 100,
"bracketSpacing": true,
"arrowParens": "always",
"proseWrap": "never"
}
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
node_js:
- 16
branches:
only:
- dev
script:
- 'npm run lint'
- 'npm run test'
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Jest Tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"-i", "--verbose", "--no-cache"
],
// "preLaunchTask": "build",
// "internalConsoleOptions": "openOnSessionStart",
// "outFiles": [
// "${workspaceRoot}/dist/**/*"
// ],
// "envFile": "${workspaceRoot}/.env"
}]
}
23 changes: 23 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"folders": [],
"settings": {},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": true,
"configurations": [{
"type": "node",
"request": "launch",
"name": "Jest Tests",
"program": "${workspaceRoot}\\node_modules\\jest\\bin\\jest.js",
"args": [
"-i"
],
// "preLaunchTask": "build",
"internalConsoleOptions": "openOnSessionStart",
"outFiles": [
"${workspaceRoot}/dist/**/*"
],
"envFile": "${workspaceRoot}/.env"
}]
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# graph-beaver
A GraphQL rate limiting library using query complexity analysis.
# GraphQL-Gate

A GraphQL rate limiting library using query complexity analysis.
11 changes: 11 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Config } from '@jest/types';

const config: Config.InitialOptions = {
verbose: true,
roots: ['./test'],
preset: 'ts-jest',
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'],
};

export default config;
Loading