File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
55Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
66exports . GraphQLQueryPurifier = void 0 ;
77const fs_1 = __importDefault ( require ( "fs" ) ) ;
8- const glob_1 = require ( "glob" ) ;
98const graphql_1 = require ( "graphql" ) ;
109const path_1 = __importDefault ( require ( "path" ) ) ;
10+ // @ts -ignore
11+ const glob_1 = __importDefault ( require ( "glob" ) ) ;
1112const merge_1 = require ( "./merge" ) ;
1213class GraphQLQueryPurifier {
1314 constructor ( { gqlPath, allowAll = false , allowStudio = false , } ) {
@@ -47,8 +48,8 @@ class GraphQLQueryPurifier {
4748 this . allowAll = allowAll ;
4849 this . allowStudio = allowStudio ;
4950 }
50- async loadQueries ( ) {
51- const files = await ( 0 , glob_1 . glob ) ( `${ this . gqlPath } /**/*.gql` ) ;
51+ loadQueries ( ) {
52+ const files = glob_1 . default . sync ( `${ this . gqlPath } /**/*.gql` . replace ( / \\ / g , '/' ) ) ;
5253 files . forEach ( ( file ) => {
5354 if ( path_1 . default . extname ( file ) === '.gql' ) {
5455 const content = fs_1 . default . readFileSync ( file , 'utf8' ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " graphql-query-purifier" ,
3- "version" : " 1.0.4 " ,
3+ "version" : " 1.0.8 " ,
44 "description" : " A small library to match .gql queries vs user input. Removes fields from user requests that are not expected by your frontend code." ,
55 "main" : " ./dist/index.js" ,
66 "author" : " multipliedtwice" ,
77 "license" : " MIT" ,
88 "scripts" : {
99 "test" : " jest" ,
10- "build" : " tsc"
10+ "build" : " tsc" ,
11+ "prepublish" : " npm run build"
1112 },
1213 "repository" : {
1314 "type" : " git" ,
2627 "homepage" : " https://github.com/multipliedtwice/graphql-query-purifier#readme" ,
2728 "devDependencies" : {
2829 "@types/express" : " ^4.17.21" ,
29- "@types/glob" : " ^8.1.0" ,
3030 "@types/jest" : " ^29.5.7" ,
3131 "@types/node" : " ^20.8.10" ,
3232 "eslint" : " ^8.53.0" ,
33- "glob" : " ^10.3.10" ,
3433 "graphql" : " ^16.8.1" ,
3534 "jest" : " ^29.7.0" ,
3635 "prettier" : " ^3.0.3" ,
Original file line number Diff line number Diff line change 11import { NextFunction , Request , Response } from 'express' ;
22import fs from 'fs' ;
3- import { glob } from 'glob' ;
43import { OperationDefinitionNode , parse } from 'graphql' ;
54import path from 'path' ;
6-
5+ // @ts -ignore
6+ import glob from 'glob' ;
77import { mergeQueries } from './merge' ;
88
99export class GraphQLQueryPurifier {
@@ -28,10 +28,10 @@ export class GraphQLQueryPurifier {
2828 this . allowStudio = allowStudio ;
2929 }
3030
31- private async loadQueries ( ) {
32- const files = await glob ( `${ this . gqlPath } /**/*.gql` ) ;
31+ private loadQueries ( ) {
32+ const files = glob . sync ( `${ this . gqlPath } /**/*.gql` . replace ( / \\ / g , '/' ) ) ;
3333
34- files . forEach ( ( file ) => {
34+ files . forEach ( ( file : string ) => {
3535 if ( path . extname ( file ) === '.gql' ) {
3636 const content = fs . readFileSync ( file , 'utf8' ) ;
3737 const parsedQuery = parse ( content ) ;
Original file line number Diff line number Diff line change @@ -963,16 +963,6 @@ __metadata:
963963 languageName : node
964964 linkType : hard
965965
966- " @types/glob@npm:^8.1.0 " :
967- version : 8.1.0
968- resolution : " @types/glob@npm:8.1.0"
969- dependencies :
970- " @types/minimatch " : ^5.1.2
971- " @types/node " : " *"
972- checksum : 9101f3a9061e40137190f70626aa0e202369b5ec4012c3fabe6f5d229cce04772db9a94fa5a0eb39655e2e4ad105c38afbb4af56a56c0996a8c7d4fc72350e3d
973- languageName : node
974- linkType : hard
975-
976966" @types/graceful-fs@npm:^4.1.3 " :
977967 version : 4.1.9
978968 resolution : " @types/graceful-fs@npm:4.1.9"
@@ -1038,13 +1028,6 @@ __metadata:
10381028 languageName : node
10391029 linkType : hard
10401030
1041- " @types/minimatch@npm:^5.1.2 " :
1042- version : 5.1.2
1043- resolution : " @types/minimatch@npm:5.1.2"
1044- checksum : 0391a282860c7cb6fe262c12b99564732401bdaa5e395bee9ca323c312c1a0f45efbf34dce974682036e857db59a5c9b1da522f3d6055aeead7097264c8705a8
1045- languageName : node
1046- linkType : hard
1047-
10481031" @types/node@npm:*, @types/node@npm:^20.8.10 " :
10491032 version : 20.9.1
10501033 resolution : " @types/node@npm:20.9.1"
@@ -2191,11 +2174,9 @@ __metadata:
21912174 resolution : " graphql-query-purifier@workspace:."
21922175 dependencies :
21932176 " @types/express " : ^4.17.21
2194- " @types/glob " : ^8.1.0
21952177 " @types/jest " : ^29.5.7
21962178 " @types/node " : ^20.8.10
21972179 eslint : ^8.53.0
2198- glob : ^10.3.10
21992180 graphql : ^16.8.1
22002181 jest : ^29.7.0
22012182 prettier : ^3.0.3
You can’t perform that action at this time.
0 commit comments