Skip to content

Commit

Permalink
Merge pull request #120 from rush-db/fix/docs-minor-fix-and-tmp-disab…
Browse files Browse the repository at this point in the history
…le-gh-auth

Minor docs update and temporary disabled gh auth
  • Loading branch information
1pxone authored Feb 5, 2025
2 parents 31e972c + c373116 commit 44180ea
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 34 deletions.
9 changes: 9 additions & 0 deletions .changeset/great-dodos-share.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions docs/docs/working-with-rushdb-sdk/rushdb-sdk-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
```
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
]
},
"engines": {
"pnpm": "9",
"pnpm": "10",
"node": ">=18.0.0 <=22.x.x"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
4 changes: 2 additions & 2 deletions platform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion platform/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -69,7 +65,8 @@ export class GithubOAuthController {
token: this.authService.createToken(user)
}
} catch (e) {
return new UnauthorizedException(e)
// console.log(e)
throw new UnauthorizedException()
}
}
}
28 changes: 14 additions & 14 deletions platform/core/src/dashboard/auth/providers/github/github.service.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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'

Expand All @@ -23,7 +29,6 @@ export class GithubOAuthService {
constructor(
private readonly userService: UserService,
private readonly encryptionService: EncryptionService,
private readonly jwtService: JwtService,
private readonly configService: ConfigService
) {}

Expand All @@ -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<TGithubEmailsData>(
'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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class GoogleOAuthController {
token: this.authService.createToken(user)
}
} catch (e) {
return new UnauthorizedException(e)
throw new UnauthorizedException(e)
}
}
}
2 changes: 1 addition & 1 deletion platform/dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 44180ea

Please sign in to comment.