Skip to content

Commit

Permalink
feat(deps): Upgrade dependencies to support newer versions of nexus a…
Browse files Browse the repository at this point in the history
…nd graphql
  • Loading branch information
Sytten committed May 23, 2022
1 parent ae0cc46 commit 6b068e5
Show file tree
Hide file tree
Showing 9 changed files with 2,778 additions and 5,794 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
extends: [
'plugin:jest/recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
'plugin:import/errors',
],
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
verbose: true,
globals: {
'ts-jest': {
tsConfig: 'tsconfig.test.json',
tsconfig: 'tsconfig.test.json',
},
},
};
47 changes: 23 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,40 @@
"test:lint": "eslint --ext .ts,.js src/"
},
"dependencies": {
"object-hash": "^2.0.3"
"object-hash": "^3.0.0"
},
"devDependencies": {
"nexus": "1.1.0",
"@types/jest": "26.0.24",
"@types/node": "14.18.0",
"nexus": "1.3.0",
"@types/jest": "27.5.1",
"@types/node": "17.0.35",
"@types/object-hash": "2.2.1",
"@types/request-promise-native": "1.0.18",
"@typescript-eslint/eslint-plugin": "4.33.0",
"@typescript-eslint/parser": "4.33.0",
"apollo-server": "2.25.3",
"apollo-server-testing": "2.25.3",
"@typescript-eslint/eslint-plugin": "5.26.0",
"@typescript-eslint/parser": "5.26.0",
"apollo-server": "3.7.0",
"codecov": "3.8.3",
"coveralls": "3.1.1",
"eslint": "7.32.0",
"eslint-config-prettier": "7.2.0",
"eslint-import-resolver-typescript": "2.5.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jest": "24.7.0",
"eslint-plugin-prettier": "3.4.1",
"eslint": "8.16.0",
"eslint-config-prettier": "8.5.0",
"eslint-import-resolver-typescript": "2.7.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jest": "26.2.2",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-simple-import-sort": "7.0.0",
"graphql": "15.7.2",
"graphql-tools": "7.0.5",
"jest": "26.6.3",
"jest-mock-extended": "1.0.18",
"prettier": "2.2.1",
"semantic-release": "17.4.7",
"ts-jest": "26.5.6",
"ts-node": "9.1.1",
"graphql": "16.5.0",
"graphql-tools": "8.2.11",
"jest": "28.1.0",
"jest-mock-extended": "2.0.6",
"prettier": "2.6.2",
"semantic-release": "19.0.2",
"ts-jest": "28.0.2",
"ts-node": "10.8.0",
"ts-node-dev": "1.1.8",
"typescript": "4.5.2"
"typescript": "4.6.4"
},
"peerDependencies": {
"nexus": "^1.0.0",
"graphql": "^14.5.0 || ^15.0.0"
"graphql": "^14.5.0 || ^15.0.0 || ^16.0.0"
},
"files": [
"dist"
Expand Down
8 changes: 1 addition & 7 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@
"lockFileMaintenance": {
"enabled": true,
"schedule": "before 10am on Friday"
},
"packageRules": [
{
"updateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
}
]
}
}
39 changes: 22 additions & 17 deletions src/builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ import {
* })
*
*/
export const rule = (options?: ShieldRuleOptions) => <
TypeName extends string,
FieldName extends string
>(
func: ShieldRuleFunction<TypeName, FieldName>
): ShieldRule<TypeName, FieldName> => {
options = options || {};
return new BaseRule<TypeName, FieldName>(options, func);
};
export const rule =
(options?: ShieldRuleOptions) =>
<TypeName extends string, FieldName extends string>(
func: ShieldRuleFunction<TypeName, FieldName>
): ShieldRule<TypeName, FieldName> => {
options = options || {};
return new BaseRule<TypeName, FieldName>(options, func);
};

/**
*
Expand Down Expand Up @@ -164,17 +163,23 @@ export const deny = new RuleFalse();
* Helper for generic rules
*
*/
export const generic = (rule: ShieldRule<any, any>) => <
TypeName extends string,
FieldName extends string
>(): ShieldRule<TypeName, FieldName> => rule;
export const generic =
(rule: ShieldRule<any, any>) =>
<TypeName extends string, FieldName extends string>(): ShieldRule<
TypeName,
FieldName
> =>
rule;

/**
*
* Helper for partial rules
*
*/
export const partial = <Type extends string>(rule: ShieldRule<Type, any>) => <
TypeName extends Type,
FieldName extends string
>(): ShieldRule<TypeName, FieldName> => rule;
export const partial =
<Type extends string>(rule: ShieldRule<Type, any>) =>
<TypeName extends Type, FieldName extends string>(): ShieldRule<
TypeName,
FieldName
> =>
rule;
3 changes: 2 additions & 1 deletion src/rules/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
} from './interface';

export class BaseRule<TypeName extends string, FieldName extends string>
implements ShieldRule<TypeName, FieldName> {
implements ShieldRule<TypeName, FieldName>
{
readonly name: string;

private cache: ShieldCache;
Expand Down
3 changes: 2 additions & 1 deletion src/rules/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { ShieldPluginOptions } from '../config';
import { ShieldContext, ShieldRule, ShieldRuleResult } from './interface';

export class LogicRule<TypeName extends string, FieldName extends string>
implements ShieldRule<TypeName, FieldName> {
implements ShieldRule<TypeName, FieldName>
{
protected rules: ShieldRule<TypeName, FieldName>[];

constructor(rules: ShieldRule<TypeName, FieldName>[]) {
Expand Down
18 changes: 4 additions & 14 deletions tests/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
import { gql } from 'apollo-server';
import {
ApolloServerTestClient,
createTestClient,
} from 'apollo-server-testing';

import { server } from './fixtures/server';

describe('Integration tests', () => {
let client: ApolloServerTestClient;

beforeAll(() => {
client = createTestClient(server);
});

test('Server should return data', async () => {
const query = gql`
query {
Expand All @@ -22,7 +12,7 @@ describe('Integration tests', () => {
}
`;

const result = await client.query({ query });
const result = await server.executeOperation({ query });

expect(result.data).toEqual({ test: { publicProp: 'public' } });
});
Expand All @@ -36,7 +26,7 @@ describe('Integration tests', () => {
}
`;

const result = await client.query({ query });
const result = await server.executeOperation({ query });

expect(result.errors[0].message).toEqual('DEFAULT');
});
Expand All @@ -50,7 +40,7 @@ describe('Integration tests', () => {
}
`;

const result = await client.query({ query });
const result = await server.executeOperation({ query });

expect(result.errors[0].message).toEqual('CUSTOM');
});
Expand All @@ -64,7 +54,7 @@ describe('Integration tests', () => {
}
`;

const result = await client.query({ query });
const result = await server.executeOperation({ query });

expect(result.errors[0].message).toEqual('OBJECT');
});
Expand Down
Loading

0 comments on commit 6b068e5

Please sign in to comment.