From c37311622b357fb0cae5287215c3ebe57e909d08 Mon Sep 17 00:00:00 2001 From: Artemiy Vereshchinskiy Date: Thu, 6 Feb 2025 01:02:41 +0700 Subject: [PATCH] Minor docs update and temporary disabled gh auth --- .changeset/great-dodos-share.md | 9 ++++++ .github/workflows/release.yml | 2 +- .../rushdb-sdk-intro.md | 10 ++++--- docs/package.json | 2 +- package.json | 4 +-- platform/Dockerfile | 4 +-- platform/core/README.md | 2 +- .../providers/github/github.controller.ts | 11 +++----- .../auth/providers/github/github.service.ts | 28 +++++++++---------- .../providers/google/google.controller.ts | 2 +- platform/dashboard/README.md | 2 +- 11 files changed, 42 insertions(+), 34 deletions(-) create mode 100644 .changeset/great-dodos-share.md diff --git a/.changeset/great-dodos-share.md b/.changeset/great-dodos-share.md new file mode 100644 index 0000000..bdb631b --- /dev/null +++ b/.changeset/great-dodos-share.md @@ -0,0 +1,9 @@ +--- +'rushdb-dashboard': patch +'rushdb-core': patch +'rushdb-docs': patch +'@rushdb/javascript-sdk': patch +'rushdb-website': patch +--- + +Minor docs update and temporary disabled gh auth diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 760ed40..eaad100 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 9.1.0 + version: 10.1.0 - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/docs/docs/working-with-rushdb-sdk/rushdb-sdk-intro.md b/docs/docs/working-with-rushdb-sdk/rushdb-sdk-intro.md index 924a36b..002b74c 100644 --- a/docs/docs/working-with-rushdb-sdk/rushdb-sdk-intro.md +++ b/docs/docs/working-with-rushdb-sdk/rushdb-sdk-intro.md @@ -42,11 +42,13 @@ type ApiConnectionConfig = { url: string; }; +export type Logger = (payload: any) => void + type CommonUserProvidedConfig = { - httpClient?: HttpClientInterface; - timeout?: number; - validator?: Validator; -} & ApiConnectionConfig; + httpClient?: HttpClientInterface + timeout?: number + logger?: Logger +} & ApiConnectionConfig export type UserProvidedConfig = CommonUserProvidedConfig; ``` diff --git a/docs/package.json b/docs/package.json index b890e34..5b2ef9b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -52,7 +52,7 @@ ] }, "engines": { - "pnpm": "9", + "pnpm": "10", "node": ">=18.0.0 <=22.x.x" } } diff --git a/package.json b/package.json index c536ccf..ef5101a 100644 --- a/package.json +++ b/package.json @@ -41,9 +41,9 @@ "rimraf": "^6.0.1", "typescript": "5.7.2" }, - "packageManager": "pnpm@9.1.0", + "packageManager": "pnpm@10.1.0", "engines": { - "pnpm": "9", + "pnpm": "10", "node": ">=18.0.0 <=22.x.x" }, "workspaces": [ diff --git a/platform/Dockerfile b/platform/Dockerfile index e75b025..b54c0a0 100644 --- a/platform/Dockerfile +++ b/platform/Dockerfile @@ -2,7 +2,7 @@ FROM node:18-alpine AS builder # Install pnpm -RUN npm install -g pnpm@9.1.0 +RUN npm install -g pnpm@10.1.0 # Set working directory WORKDIR /app @@ -68,7 +68,7 @@ COPY ../../package.json ../../pnpm-lock.yaml ../../pnpm-workspace.yaml ./ COPY ./platform/core/package.json ./platform/core/package.json # Install pnpm and production dependencies -RUN npm install -g pnpm@9.1.0 +RUN npm install -g pnpm@10.1.0 RUN pnpm install --prod --frozen-lockfile --no-optional # Copy built files from builder diff --git a/platform/core/README.md b/platform/core/README.md index dffee83..0720518 100644 --- a/platform/core/README.md +++ b/platform/core/README.md @@ -20,7 +20,7 @@ Before running the application, ensure that you have the following installed: 1. **PNPM**: Install PNPM globally by running: ```bash - npm install -g pnpm@9.1.0 + npm install -g pnpm@10.1.0 ``` 2. **Docker**: The application requires a running Docker instance to start the Neo4j database. Make sure Docker is installed and running on your machine. diff --git a/platform/core/src/dashboard/auth/providers/github/github.controller.ts b/platform/core/src/dashboard/auth/providers/github/github.controller.ts index 0f6b4be..69cb6f9 100755 --- a/platform/core/src/dashboard/auth/providers/github/github.controller.ts +++ b/platform/core/src/dashboard/auth/providers/github/github.controller.ts @@ -46,13 +46,9 @@ export class GithubOAuthController { @ApiTags('Auth') @CommonResponseDecorator(GetUserDto) @UseInterceptors(NeogmaTransactionInterceptor, NeogmaDataInterceptor, ChangeCorsInterceptor) - async githubAuthRedirect( - @TransactionDecorator() transaction: Transaction, - @Query() - params: { code: string; scope: string; authuser: string; prompt: string } - ) { + async githubAuthRedirect(@TransactionDecorator() transaction: Transaction, @Query('code') code: string) { try { - const user = await this.githubOAuthService.githubLogin(params.code, transaction) + const user = await this.githubOAuthService.githubLogin(code, transaction) if (!user) { throw new UnauthorizedException() @@ -69,7 +65,8 @@ export class GithubOAuthController { token: this.authService.createToken(user) } } catch (e) { - return new UnauthorizedException(e) + // console.log(e) + throw new UnauthorizedException() } } } diff --git a/platform/core/src/dashboard/auth/providers/github/github.service.ts b/platform/core/src/dashboard/auth/providers/github/github.service.ts index 7a39d4e..22888d3 100755 --- a/platform/core/src/dashboard/auth/providers/github/github.service.ts +++ b/platform/core/src/dashboard/auth/providers/github/github.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common' import { ConfigService } from '@nestjs/config' -import { JwtService } from '@nestjs/jwt' import axios from 'axios' import { Transaction } from 'neo4j-driver' @@ -15,6 +14,13 @@ type TGithubAuthData = { name: string } +type TGithubEmailsData = { + email: string + primary: boolean + verified: boolean + visibility: 'private' | null +}[] + const GITHUB_TOKEN_URL = 'https://github.com/login/oauth/access_token' const GITHUB_OAUTH_URL = 'https://api.github.com/user' @@ -23,7 +29,6 @@ export class GithubOAuthService { constructor( private readonly userService: UserService, private readonly encryptionService: EncryptionService, - private readonly jwtService: JwtService, private readonly configService: ConfigService ) {} @@ -37,23 +42,18 @@ export class GithubOAuthService { const data = userResponse // if user email is set to private - if (!userResponse.email) { - const { data: emailResponse } = await axios.get< + if (!data?.email) { + const { data: emailResponse } = await axios.get( + 'https://api.github.com/user/emails', { - email: string - primary: boolean - verified: boolean - visibility: 'private' | null - }[] - >('https://api.github.com/user/emails', { - headers: { - Authorization: `Bearer ${accessToken}` + headers: { + Authorization: `Bearer ${accessToken}` + } } - }) + ) data.email = emailResponse.find((email) => email.primary)?.email } - return data } diff --git a/platform/core/src/dashboard/auth/providers/google/google.controller.ts b/platform/core/src/dashboard/auth/providers/google/google.controller.ts index 2fc4c60..7f2e516 100755 --- a/platform/core/src/dashboard/auth/providers/google/google.controller.ts +++ b/platform/core/src/dashboard/auth/providers/google/google.controller.ts @@ -72,7 +72,7 @@ export class GoogleOAuthController { token: this.authService.createToken(user) } } catch (e) { - return new UnauthorizedException(e) + throw new UnauthorizedException(e) } } } diff --git a/platform/dashboard/README.md b/platform/dashboard/README.md index 5a09017..39bd1dc 100644 --- a/platform/dashboard/README.md +++ b/platform/dashboard/README.md @@ -23,7 +23,7 @@ Before running the application, ensure the following are installed on your syste 1. **Node.js**: Recommended version 18 or above. 2. **PNPM**: Install PNPM globally by running: ```bash - npm install -g pnpm@9.1.0 + npm install -g pnpm@10.1.0 ``` ## Environment Variable