Skip to content

Commit 0bd5c2d

Browse files
authored
Merge pull request #1427 from maticzav/dependencies_updates
Bump Package Dependencies
2 parents 3082ebe + 32b91fe commit 0bd5c2d

25 files changed

+5750
-5342
lines changed

.changeset/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"commit": false,
55
"linked": [],
66
"access": "restricted",
7-
"baseBranch": "main",
7+
"baseBranch": "master",
88
"updateInternalDependencies": "patch",
9-
"ignore": ["@shield-examples/*", "@shield/website"]
9+
"ignore": ["@shield/website"]
1010
}

.changeset/rotten-falcons-tan.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphql-shield': minor
3+
---
4+
5+
Bump Package Dependencies

.yarn/releases/yarn-3.2.2.cjs

Lines changed: 783 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-berry.cjs

Lines changed: 0 additions & 55 deletions
This file was deleted.

.yarnrc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
yarnPath: ".yarn/releases/yarn-berry.cjs"
2-
31
enableInlineBuilds: true
2+
43
enableInlineHunks: true
54

65
nodeLinker: node-modules
76

7+
yarnPath: .yarn/releases/yarn-3.2.2.cjs

examples/advanced/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "advanced",
3+
"private": true,
34
"scripts": {
45
"start": "dotenv -- nodemon -e ts,graphql -x ts-node src/index.ts",
56
"dev": "npm-run-all --parallel start playground",
@@ -9,7 +10,7 @@
910
},
1011
"dependencies": {
1112
"bcryptjs": "2.4.3",
12-
"graphql-shield": "^6.1.0",
13+
"graphql-shield": "7.5.0",
1314
"graphql-yoga": "1.18.3",
1415
"jsonwebtoken": "8.5.1",
1516
"prisma-binding": "2.3.16"

examples/basic/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "basic",
3+
"private": true,
34
"version": "1.0.0",
45
"main": "index.js",
56
"license": "MIT",
67
"scripts": {
78
"start": "babel-node index.js"
89
},
910
"dependencies": {
10-
"graphql-shield": "6.1.0",
11+
"graphql-shield": "7.5.0",
1112
"graphql-yoga": "1.18.3"
1213
},
1314
"devDependencies": {

examples/with-apollo-server-lambda/handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { ApolloServer, gql } = require('apollo-server-lambda')
22
const { applyMiddleware } = require('graphql-middleware')
3-
const { makeExecutableSchema } = require('graphql-tools')
3+
const { makeExecutableSchema } = require('@graphql-tools/schema')
44
const { rule, shield } = require('graphql-shield')
55

66
const isAuthenticated = rule()(async (parent, args, ctx, info) => {

examples/with-apollo-server-lambda/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "example-shield-apollo-server-lambda",
3+
"private": true,
34
"version": "1.0.0",
45
"description": "",
56
"main": "index.js",
@@ -18,7 +19,7 @@
1819
"apollo-server-lambda": "^2.14.2",
1920
"graphql": "^14.0.2",
2021
"graphql-middleware": "^4.0.1",
21-
"graphql-shield": "^6.1.0",
22+
"graphql-shield": "7.5.0",
2223
"graphql-tools": "^4.0.3"
2324
},
2425
"devDependencies": {

examples/with-graphql-middleware-forward-binding/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "with-graphql-middleware-forward-binding",
3+
"private": true,
34
"scripts": {
45
"start": "dotenv -- ts-node src/index.ts",
56
"dev": "npm-run-all --parallel start playground",
@@ -8,7 +9,7 @@
89
"dependencies": {
910
"graphql-import": "0.7.1",
1011
"graphql-middleware-forward-binding": "^1.3.2",
11-
"graphql-shield": "^6.1.0",
12+
"graphql-shield": "7.5.0",
1213
"graphql-yoga": "^1.18.3",
1314
"prisma-binding": "2.3.16"
1415
},

examples/with-graphql-nexus/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "graphql_nexus_test",
3+
"private": true,
34
"version": "1.0.0",
45
"main": "src/index.js",
56
"license": "MIT",
@@ -18,7 +19,7 @@
1819
"express": "^4.17.1",
1920
"graphql": "^14.5.8",
2021
"graphql-middleware": "^4.0.1",
21-
"graphql-shield": "^6.1.0",
22+
"graphql-shield": "7.5.0",
2223
"jsonwebtoken": "^8.5.1",
2324
"nexus": "^0.11.7",
2425
"nexus-prisma": "^0.5.0",

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { pathsToModuleNameMapper } = require('ts-jest/utils')
1+
const { pathsToModuleNameMapper } = require('ts-jest')
22
const { compilerOptions } = require('./tsconfig.json')
33

44
module.exports = {

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@
1919
"prettier": "prettier --ignore-path .gitignore --write --list-different \"**/*.{ts,tsx,graphql,yml}\""
2020
},
2121
"devDependencies": {
22-
"@changesets/cli": "2.17.0",
23-
"@types/jest": "26.0.24",
24-
"@types/node": "15.6.1",
22+
"@changesets/cli": "2.24.2",
23+
"@types/jest": "28.1.6",
24+
"@types/node": "18.6.4",
2525
"codecov": "3.8.3",
26-
"husky": "6.0.0",
27-
"jest": "27.4.7",
28-
"lint-staged": "11.2.6",
29-
"prettier": "2.4.1",
26+
"husky": "8.0.1",
27+
"jest": "28.1.3",
28+
"lint-staged": "13.0.3",
29+
"prettier": "2.7.1",
3030
"pretty-quick": "3.1.3",
3131
"rimraf": "3.0.2",
32-
"ts-jest": "27.1.3",
33-
"ts-node": "10.4.0",
34-
"typescript": "4.3.5"
32+
"ts-jest": "28.0.7",
33+
"ts-node": "10.9.1",
34+
"typescript": "4.7.4"
3535
},
3636
"resolutions": {
37-
"@changesets/git": "1.1.2",
38-
"prettier": "2.4.1"
37+
"@changesets/git": "1.4.1",
38+
"prettier": "2.7.1"
3939
}
4040
}

packages/graphql-shield/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "graphql-shield",
33
"description": "GraphQL Server permissions as another layer of abstraction!",
4-
"version": "0.0.0-semantic-release",
4+
"version": "7.5.0",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
77
"author": "Matic Zavadlal <[email protected]>",
@@ -13,24 +13,24 @@
1313
"type": "git",
1414
"url": "https://github.com/maticzav/graphql-shield.git"
1515
},
16-
"scripts": {},
1716
"dependencies": {
1817
"@types/yup": "0.29.13",
19-
"object-hash": "^2.0.3",
18+
"object-hash": "^3.0.0",
2019
"yup": "^0.32.0"
2120
},
2221
"devDependencies": {
23-
"@types/node": "14.17.34",
24-
"@types/object-hash": "1.3.4",
22+
"@graphql-tools/schema": "8.5.1",
23+
"@graphql-tools/utils": "8.9.0",
24+
"@types/node": "18.6.3",
25+
"@types/object-hash": "2.2.1",
2526
"@types/request-promise-native": "1.0.18",
26-
"apollo-server": "2.25.3",
27-
"graphql": "15.8.0",
28-
"graphql-middleware": "6.1.13",
29-
"graphql-shield-rules": "0.0.1",
30-
"graphql-tools": "7.0.5"
27+
"apollo-server": "3.10.0",
28+
"graphql": "16.5.0",
29+
"graphql-middleware": "6.1.32",
30+
"graphql-shield-rules": "0.0.1"
3131
},
3232
"peerDependencies": {
33-
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0",
33+
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
3434
"graphql-middleware": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^6.0.0"
3535
},
3636
"license": "MIT"

packages/graphql-shield/src/constructors.ts

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,46 @@ import {
4545
* })
4646
*
4747
*/
48-
export const rule = (
49-
name?: string | IRuleConstructorOptions,
50-
options?: IRuleConstructorOptions,
51-
) => (func: IRuleFunction): Rule => {
52-
if (typeof name === 'object') {
53-
options = name
54-
name = Math.random().toString()
55-
} else if (typeof name === 'string') {
56-
options = options || {}
57-
} else {
58-
name = Math.random().toString()
59-
options = {}
60-
}
48+
export const rule =
49+
(
50+
name?: string | IRuleConstructorOptions,
51+
options?: IRuleConstructorOptions,
52+
) =>
53+
(func: IRuleFunction): Rule => {
54+
if (typeof name === 'object') {
55+
options = name
56+
name = Math.random().toString()
57+
} else if (typeof name === 'string') {
58+
options = options || {}
59+
} else {
60+
name = Math.random().toString()
61+
options = {}
62+
}
6163

62-
return new Rule(name, func, {
63-
fragment: options.fragment,
64-
cache: options.cache,
65-
})
66-
}
64+
return new Rule(name, func, {
65+
fragment: options.fragment,
66+
cache: options.cache,
67+
})
68+
}
6769

6870
/**
6971
*
7072
* Constructs a new InputRule based on the schema.
7173
*
7274
* @param schema
7375
*/
74-
export const inputRule = <T>(name?: string) => (
75-
schema: (yup: typeof Yup, ctx: IShieldContext) => Yup.Schema<T>,
76-
options?: Yup.ValidateOptions,
77-
) => {
78-
if (typeof name === 'string') {
79-
return new InputRule(name, schema, options)
80-
} else {
81-
return new InputRule(Math.random().toString(), schema, options)
76+
export const inputRule =
77+
<T>(name?: string) =>
78+
(
79+
schema: (yup: typeof Yup, ctx: IShieldContext) => Yup.BaseSchema<T>,
80+
options?: Parameters<Yup.BaseSchema<T>['validate']>[1],
81+
) => {
82+
if (typeof name === 'string') {
83+
return new InputRule(name, schema, options)
84+
} else {
85+
return new InputRule(Math.random().toString(), schema, options)
86+
}
8287
}
83-
}
8488

8589
/**
8690
*

packages/graphql-shield/src/rules.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ export class Rule implements IRule {
210210
export class InputRule<T> extends Rule {
211211
constructor(
212212
name: string,
213-
schema: (yup: typeof Yup, ctx: IShieldContext) => Yup.Schema<T>,
214-
options?: Yup.ValidateOptions,
213+
schema: (yup: typeof Yup, ctx: IShieldContext) => Yup.BaseSchema<T>,
214+
options?: Parameters<Yup.BaseSchema<T>['validate']>[1],
215215
) {
216216
const validationFunction: IRuleFunction = (
217217
parent: object,

packages/graphql-shield/tests/cache.test.ts

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { graphql } from 'graphql'
22
import { applyMiddleware } from 'graphql-middleware'
3-
import { makeExecutableSchema } from 'graphql-tools'
3+
import { makeExecutableSchema } from '@graphql-tools/schema'
44
import { shield, rule } from '../src/index'
55
import { IHashFunction } from '../src/types'
66

@@ -50,7 +50,11 @@ describe('caching:', () => {
5050
}
5151
}
5252
`
53-
const res = await graphql(schemaWithPermissions, query, undefined, {})
53+
const res = await graphql({
54+
schema: schemaWithPermissions,
55+
source: query,
56+
contextValue: {},
57+
})
5458

5559
expect(res).toEqual({
5660
data: {
@@ -109,7 +113,11 @@ describe('caching:', () => {
109113
f: c(arg: "foo")
110114
}
111115
`
112-
const res = await graphql(schemaWithPermissions, query, undefined, {})
116+
const res = await graphql({
117+
schema: schemaWithPermissions,
118+
source: query,
119+
contextValue: {},
120+
})
113121

114122
/* Tests */
115123

@@ -183,7 +191,11 @@ describe('caching:', () => {
183191
e
184192
}
185193
`
186-
const res = await graphql(schemaWithPermissions, query, undefined, {})
194+
const res = await graphql({
195+
schema: schemaWithPermissions,
196+
source: query,
197+
contextValue: {},
198+
})
187199

188200
/* Tests */
189201

@@ -249,7 +261,11 @@ describe('caching:', () => {
249261
e
250262
}
251263
`
252-
const res = await graphql(schemaWithPermissions, query, undefined, {})
264+
const res = await graphql({
265+
schema: schemaWithPermissions,
266+
source: query,
267+
contextValue: {},
268+
})
253269

254270
/* Tests */
255271

@@ -309,7 +325,11 @@ describe('caching:', () => {
309325
a3: a(arg: "boo")
310326
}
311327
`
312-
const res = await graphql(schemaWithPermissions, query, undefined, {})
328+
const res = await graphql({
329+
schema: schemaWithPermissions,
330+
source: query,
331+
contextValue: {},
332+
})
313333

314334
/* Tests */
315335

@@ -370,7 +390,11 @@ test('Customize hash function', async () => {
370390
b(arg: "bar")
371391
}
372392
`
373-
const res = await graphql(schemaWithPermissions, query, undefined, {})
393+
const res = await graphql({
394+
schema: schemaWithPermissions,
395+
source: query,
396+
contextValue: {},
397+
})
374398

375399
/* Tests */
376400

@@ -438,7 +462,11 @@ describe('legacy cache:', () => {
438462
}
439463
}
440464
`
441-
const res = await graphql(schemaWithPermissions, query, undefined, {})
465+
const res = await graphql({
466+
schema: schemaWithPermissions,
467+
source: query,
468+
contextValue: {},
469+
})
442470

443471
/* Tests */
444472

@@ -497,7 +525,11 @@ describe('legacy cache:', () => {
497525
e
498526
}
499527
`
500-
const res = await graphql(schemaWithPermissions, query, undefined, {})
528+
const res = await graphql({
529+
schema: schemaWithPermissions,
530+
source: query,
531+
contextValue: {},
532+
})
501533

502534
expect(res).toEqual({
503535
data: {

0 commit comments

Comments
 (0)