Skip to content

upgrade dependencies #626

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DATABASE_URL="mysql://fga:fga@localhost:3306/fga"
AUTH0_CLIENT_ID=<Client Id>
AUTH0_DOMAIN=<Domain>
AUTH0_AUDIENCE=<Audience>
GRAPHQL_END_POINT=http://localhost:5001/graphql
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.15.0
20.11.0
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
"**/.hg/store/**": true,
"**/graphql/**": true,
"**/ui/dist/index.d.ts": true
},
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma"
}
}
4 changes: 4 additions & 0 deletions apps/backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
module.exports = {
...require('config/eslint-server'),
rules: {
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unused-vars': 1,
},
}
69 changes: 34 additions & 35 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,44 @@
"postinstall": "prisma generate"
},
"dependencies": {
"@envelop/auth0": "4.0.6",
"@envelop/core": "3.0.6",
"@envelop/depth-limit": "2.0.6",
"@envelop/generic-auth": "5.0.6",
"@envelop/rate-limiter": "4.0.6",
"@fastify/compress": "6.2.1",
"@fastify/cors": "8.2.1",
"@fastify/helmet": "^9.1.0",
"@graphql-tools/schema": "9.0.18",
"@graphql-tools/utils": "^9.1.4",
"@prisma/client": "4.8.1",
"@envelop/auth0": "6.0.0",
"@envelop/core": "5.0.0",
"@envelop/depth-limit": "4.0.0",
"@envelop/generic-auth": "7.0.0",
"@fastify/compress": "7.0.0",
"@fastify/cors": "9.0.1",
"@fastify/helmet": "^11.1.1",
"@graphql-tools/schema": "10.0.3",
"@graphql-tools/utils": "^10.1.0",
"@prisma/client": "5.10.2",
"@types/got": "9.6.12",
"@types/jsonwebtoken": "8.5.9",
"@types/node": "16.18.24",
"fastify": "4.13.0",
"got": "11.8.6",
"graphql": "16.6.0",
"graphql-tools": "8.3.20",
"graphql-yoga": "3.9.1",
"jsonwebtoken": "8.5.1",
"jwks-rsa": "2.1.5",
"prisma": "4.8.1",
"ts-pattern": "^4.0.5",
"@types/jsonwebtoken": "9.0.6",
"@types/node": "20.11.24",
"fastify": "4.26.2",
"got": "14.2.0",
"graphql": "16.8.1",
"graphql-tools": "9.0.1",
"graphql-yoga": "5.1.1",
"jsonwebtoken": "9.0.2",
"jwks-rsa": "3.1.0",
"prisma": "5.10.2",
"ts-pattern": "^5.0.8",
"tsconfig": "workspace:*",
"typescript": "4.9.5",
"typescript": "5.3.3",
"validation-schema": "workspace:*",
"zod": "3.20.6"
"zod": "3.22.4"
},
"devDependencies": {
"@graphql-codegen/cli": "2.16.5",
"@graphql-codegen/typescript-resolvers": "2.7.13",
"@graphql-codegen/visitor-plugin-common": "2.13.8",
"@graphql-yoga/render-graphiql": "3.6.1",
"chalk": "4.1.2",
"@graphql-codegen/cli": "5.0.2",
"@graphql-codegen/typescript-resolvers": "4.0.6",
"@graphql-codegen/visitor-plugin-common": "5.1.0",
"@graphql-yoga/render-graphiql": "5.1.1",
"chalk": "5.3.0",
"config": "workspace:*",
"dotenv-cli": "6.0.0",
"nodemon": "2.0.22",
"tsc-alias": "1.8.5",
"tsconfig-paths": "4.1.2",
"tsx": "3.12.6"
"dotenv-cli": "7.3.0",
"nodemon": "3.1.0",
"tsc-alias": "1.8.8",
"tsconfig-paths": "4.2.0",
"tsx": "4.7.1"
}
}
}
92 changes: 50 additions & 42 deletions apps/backend/src/api/graphql/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
ID: { input: string; output: string; }
String: { input: string; output: string; }
Boolean: { input: boolean; output: boolean; }
Int: { input: number; output: number; }
Float: { input: number; output: number; }
};

export type Mutation = {
Expand All @@ -23,7 +25,7 @@ export type Mutation = {


export type MutationCompleteTodoArgs = {
id: Scalars['ID'];
id: Scalars['ID']['input'];
};


Expand All @@ -44,14 +46,14 @@ export type Query = {
allUsers: Array<User>;
currentUser?: Maybe<User>;
getProfile?: Maybe<ProfileResult>;
time: Scalars['Int'];
time: Scalars['Int']['output'];
todo?: Maybe<Todo>;
todosByCurrentUser: Array<Todo>;
};


export type QueryTodoArgs = {
id: Scalars['ID'];
id: Scalars['ID']['input'];
};

export const Role = {
Expand All @@ -63,35 +65,35 @@ export type Role = typeof Role[keyof typeof Role];
export type Todo = {
__typename?: 'Todo';
author?: Maybe<User>;
authorId: Scalars['String'];
completed: Scalars['Boolean'];
content?: Maybe<Scalars['String']>;
createdAt?: Maybe<Scalars['String']>;
id: Scalars['ID'];
title: Scalars['String'];
updatedAt?: Maybe<Scalars['String']>;
authorId: Scalars['String']['output'];
completed: Scalars['Boolean']['output'];
content?: Maybe<Scalars['String']['output']>;
createdAt?: Maybe<Scalars['String']['output']>;
id: Scalars['ID']['output'];
title: Scalars['String']['output'];
updatedAt?: Maybe<Scalars['String']['output']>;
};

export type TodoInput = {
content?: InputMaybe<Scalars['String']>;
title: Scalars['String'];
content?: InputMaybe<Scalars['String']['input']>;
title: Scalars['String']['input'];
};

export type User = {
__typename?: 'User';
email: Scalars['String'];
id: Scalars['ID'];
name?: Maybe<Scalars['String']>;
email: Scalars['String']['output'];
id: Scalars['ID']['output'];
name?: Maybe<Scalars['String']['output']>;
role: Role;
};

export type UserInput = {
name: Scalars['String'];
name: Scalars['String']['input'];
};

export type UserNotFound = {
__typename?: 'UserNotFound';
message: Scalars['String'];
message: Scalars['String']['output'];
role: Role;
};

Expand All @@ -103,7 +105,7 @@ export type ResolverTypeWrapper<T> = Promise<T> | T;
export type ResolverWithResolve<TResult, TParent, TContext, TArgs> = {
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
};
export type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> = ResolverFn<TResult, TParent, TContext, TArgs> | ResolverWithResolve<TResult, TParent, TContext, TArgs>;
export type Resolver<TResult, TParent = object, TContext = object, TArgs = object> = ResolverFn<TResult, TParent, TContext, TArgs> | ResolverWithResolve<TResult, TParent, TContext, TArgs>;

export type ResolverFn<TResult, TParent, TContext, TArgs> = (
parent: TParent,
Expand Down Expand Up @@ -140,38 +142,44 @@ export type SubscriptionObject<TResult, TKey extends string, TParent, TContext,
| SubscriptionSubscriberObject<TResult, TKey, TParent, TContext, TArgs>
| SubscriptionResolverObject<TResult, TParent, TContext, TArgs>;

export type SubscriptionResolver<TResult, TKey extends string, TParent = {}, TContext = {}, TArgs = {}> =
export type SubscriptionResolver<TResult, TKey extends string, TParent = object, TContext = object, TArgs = object> =
| ((...args: any[]) => SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>)
| SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>;

export type TypeResolveFn<TTypes, TParent = {}, TContext = {}> = (
export type TypeResolveFn<TTypes, TParent = object, TContext = object> = (
parent: TParent,
context: TContext,
info: GraphQLResolveInfo
) => Maybe<TTypes> | Promise<Maybe<TTypes>>;

export type IsTypeOfResolverFn<T = {}, TContext = {}> = (obj: T, context: TContext, info: GraphQLResolveInfo) => boolean | Promise<boolean>;
export type IsTypeOfResolverFn<T = object, TContext = object> = (obj: T, context: TContext, info: GraphQLResolveInfo) => boolean | Promise<boolean>;

export type NextResolverFn<T> = () => Promise<T>;

export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs = {}> = (
export type DirectiveResolverFn<TResult = object, TParent = object, TContext = object, TArgs = object> = (
next: NextResolverFn<TResult>,
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo
) => TResult | Promise<TResult>;

/** Mapping of union types */
export type ResolversUnionTypes<RefType extends Record<string, unknown>> = {
ProfileResult: (User) | (UserNotFound);
};


/** Mapping between all available schema types and the resolvers types */
export type ResolversTypes = {
Boolean: ResolverTypeWrapper<Scalars['Boolean']>;
ID: ResolverTypeWrapper<Scalars['ID']>;
Int: ResolverTypeWrapper<Scalars['Int']>;
Mutation: ResolverTypeWrapper<{}>;
ProfileResult: ResolversTypes['User'] | ResolversTypes['UserNotFound'];
Query: ResolverTypeWrapper<{}>;
Boolean: ResolverTypeWrapper<Scalars['Boolean']['output']>;
ID: ResolverTypeWrapper<Scalars['ID']['output']>;
Int: ResolverTypeWrapper<Scalars['Int']['output']>;
Mutation: ResolverTypeWrapper<object>;
ProfileResult: ResolverTypeWrapper<ResolversUnionTypes<ResolversTypes>['ProfileResult']>;
Query: ResolverTypeWrapper<object>;
Role: Role;
String: ResolverTypeWrapper<Scalars['String']>;
String: ResolverTypeWrapper<Scalars['String']['output']>;
Todo: ResolverTypeWrapper<Todo>;
TodoInput: TodoInput;
User: ResolverTypeWrapper<User>;
Expand All @@ -181,13 +189,13 @@ export type ResolversTypes = {

/** Mapping between all available schema types and the resolvers parents */
export type ResolversParentTypes = {
Boolean: Scalars['Boolean'];
ID: Scalars['ID'];
Int: Scalars['Int'];
Mutation: {};
ProfileResult: ResolversParentTypes['User'] | ResolversParentTypes['UserNotFound'];
Query: {};
String: Scalars['String'];
Boolean: Scalars['Boolean']['output'];
ID: Scalars['ID']['output'];
Int: Scalars['Int']['output'];
Mutation: object;
ProfileResult: ResolversUnionTypes<ResolversParentTypes>['ProfileResult'];
Query: object;
String: Scalars['String']['output'];
Todo: Todo;
TodoInput: TodoInput;
User: User;
Expand All @@ -202,7 +210,7 @@ export type AuthDirectiveArgs = {
export type AuthDirectiveResolver<Result, Parent, ContextType = any, Args = AuthDirectiveArgs> = DirectiveResolverFn<Result, Parent, ContextType, Args>;

export type IsOwnerDirectiveArgs = {
ownerField?: Maybe<Scalars['String']>;
ownerField?: Maybe<Scalars['String']['input']>;
};

export type IsOwnerDirectiveResolver<Result, Parent, ContextType = any, Args = IsOwnerDirectiveArgs> = DirectiveResolverFn<Result, Parent, ContextType, Args>;
Expand Down
38 changes: 19 additions & 19 deletions apps/backend/src/api/graphql/resolvers/todoResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ export const todoResolvers: gql.TodoResolvers<GraphqlServerContext> = {
}

export const todoMutationResolvers: gql.MutationResolvers<GraphqlServerContext> =
{
saveTodo: async (_, params, ctx) => {
validateParams(params, TodoInputSchema)
{
saveTodo: async (_, params, ctx) => {
validateParams(params, TodoInputSchema)

const result = await ctx.useCase.todo.save(params.todo)
return match(result)
.with(whenIsErr, handleAppError)
.with(whenIsOk, ({ value }) => {
return TodoMapper.toGql(value)
})
.exhaustive()
},
completeTodo: async (_, params, ctx) => {
const result = await ctx.useCase.todo.markAsCompleted(Number(params.id))
return match(result)
.with(whenIsErr, handleAppError)
.with(whenIsOk, ({ value }) => TodoMapper.toGql(value))
.exhaustive()
},
}
const result = await ctx.useCase.todo.save(params.todo)
return match(result)
.with(whenIsErr, handleAppError)
.with(whenIsOk, ({ value }) => {
return TodoMapper.toGql(value)
})
.exhaustive()
},
completeTodo: async (_, params, ctx) => {
const result = await ctx.useCase.todo.markAsCompleted(Number(params.id))
return match(result)
.with(whenIsErr, handleAppError)
.with(whenIsOk, ({ value }) => TodoMapper.toGql(value))
.exhaustive()
},
}
6 changes: 3 additions & 3 deletions apps/backend/src/common/result.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GraphQLError } from 'graphql'
import { match, P } from 'ts-pattern'
import { match } from 'ts-pattern'

import { AppErrorType } from './error'

Expand All @@ -19,8 +19,8 @@ export const err = <E extends AppErrorType>(error: E): Err<E> => ({
error: error,
})

export const matchResult = <T extends Result<any, AppErrorType>>(result: T) =>
match(result).with<P.Pattern<any>, unknown, any>(
export const matchResult = (result: unknown) =>
match(result).with(
{ type: 'error', error: 'DATABASE' },
() => {
throw new GraphQLError('database error')
Expand Down
3 changes: 1 addition & 2 deletions apps/backend/src/useCases/userUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class UserUseCase extends UseCase {
public async save(
user: UserInput
): Promise<Result<User, 'AUTH0' | 'DATABASE'>> {
const auth0UserInfo = await got<{ email: string }>(
const auth0UserInfo: any = await got(
`https://${process.env.AUTH0_DOMAIN}/userinfo`,
{
headers: {
Expand All @@ -27,7 +27,6 @@ export class UserUseCase extends UseCase {
},
}
)
.json<{ email: string }>()
.catch((e) => {
console.log(e)
return null
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ module.exports = {
ignore: ['jsx', 'global'],
},
],
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unused-vars': 1,
},
}
Loading