diff --git a/apps/api-gateway/src/authz/authz.module.ts b/apps/api-gateway/src/authz/authz.module.ts index b8e84d2ee..1e6b80cd2 100644 --- a/apps/api-gateway/src/authz/authz.module.ts +++ b/apps/api-gateway/src/authz/authz.module.ts @@ -11,10 +11,11 @@ import { JwtStrategy } from './jwt.strategy'; import { MobileJwtStrategy } from './mobile-jwt.strategy'; import { Module } from '@nestjs/common'; import { PassportModule } from '@nestjs/passport'; -import { VerificationService } from '../verification/verification.service'; import { SocketGateway } from './socket.gateway'; +import { SupabaseService } from '@credebl/supabase'; import { UserModule } from '../user/user.module'; import { UserService } from '../user/user.service'; +import { VerificationService } from '../verification/verification.service'; //import { WebhookService } from "../../../platform-service/src/webhook/webhook.service"; @@ -46,7 +47,8 @@ import { UserService } from '../user/user.service'; ConnectionService, AgentService, CommonService, - UserService + UserService, + SupabaseService ], exports: [ PassportModule, diff --git a/apps/api-gateway/src/authz/jwt.strategy.ts b/apps/api-gateway/src/authz/jwt.strategy.ts index a53a78e07..c435799d2 100644 --- a/apps/api-gateway/src/authz/jwt.strategy.ts +++ b/apps/api-gateway/src/authz/jwt.strategy.ts @@ -1,17 +1,12 @@ -// src/authz/jwt.strategy.ts - import * as dotenv from 'dotenv'; -import * as jwt from 'jsonwebtoken'; import { ExtractJwt, Strategy } from 'passport-jwt'; import { Injectable, Logger } from '@nestjs/common'; -import { CommonConstants } from '@credebl/common/common.constant'; import { JwtPayload } from './jwt-payload.interface'; import { NotFoundException } from '@nestjs/common'; import { PassportStrategy } from '@nestjs/passport'; import { UserService } from '../user/user.service'; -import { passportJwtSecret } from 'jwks-rsa'; dotenv.config(); @@ -23,33 +18,17 @@ export class JwtStrategy extends PassportStrategy(Strategy) { private readonly usersService: UserService ) { super({ - - secretOrKeyProvider: (request, jwtToken, done) => { - const decodedToken = jwt.decode(jwtToken) as jwt.JwtPayload; - const audiance = decodedToken.iss.toString(); - const jwtOptions = { - cache: true, - rateLimit: true, - jwksRequestsPerMinute: 5, - jwksUri: `${audiance}${CommonConstants.URL_KEYCLOAK_JWKS}` - }; - const secretprovider = passportJwtSecret(jwtOptions); - let certkey; - secretprovider(request, jwtToken, async (err, data) => { - certkey = data; - done(null, certkey); - }); - }, jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), - algorithms: ['RS256'] + secretOrKey: process.env.SUPABASE_JWT_SECRET, + ignoreExpiration: false }); } async validate(payload: JwtPayload): Promise { - - const userDetails = await this.usersService.findUserByKeycloakId(payload?.sub); + + const userDetails = await this.usersService.findUserinSupabase(payload.sub); if (!userDetails.response) { - throw new NotFoundException('Keycloak user not found'); + throw new NotFoundException('User not found'); } return { diff --git a/apps/api-gateway/src/user/user.service.ts b/apps/api-gateway/src/user/user.service.ts index 3d74c6ac0..fbc39fd23 100644 --- a/apps/api-gateway/src/user/user.service.ts +++ b/apps/api-gateway/src/user/user.service.ts @@ -69,16 +69,17 @@ export class UserService extends BaseService { } } - async findUserByKeycloakId(id: string): Promise<{ response: object }> { + async findUserinSupabase(id: string): Promise<{ response: object }> { const payload = { id }; try { - return this.sendNats(this.serviceProxy, 'get-user-by-keycloak-id', payload); + return this.sendNats(this.serviceProxy, 'get-user-by-supabase', payload); } catch (error) { this.logger.error(`Error in get user:${JSON.stringify(error)}`); } } + async invitations(id: number, status: string, getAllInvitationsDto: GetAllInvitationsDto): Promise<{ response: object }> { const {pageNumber, pageSize, search} = getAllInvitationsDto; const payload = { id, status, pageNumber, pageSize, search }; diff --git a/apps/user/interfaces/user.interface.ts b/apps/user/interfaces/user.interface.ts index cdb961191..b93da4280 100644 --- a/apps/user/interfaces/user.interface.ts +++ b/apps/user/interfaces/user.interface.ts @@ -9,7 +9,7 @@ export interface UserI { isEmailVerified?: boolean, clientId?: string, clientSecret?: string, - keycloakUserId?: string, + supabaseUserId?: string, userOrgRoles?: object } diff --git a/apps/user/repositories/fido-user.repository.ts b/apps/user/repositories/fido-user.repository.ts index 8c82d8b6a..812b4ba73 100644 --- a/apps/user/repositories/fido-user.repository.ts +++ b/apps/user/repositories/fido-user.repository.ts @@ -1,5 +1,3 @@ -import * as bcrypt from 'bcrypt'; - import { Injectable, Logger, NotFoundException } from '@nestjs/common'; import { CreateUserDto } from '../dtos/create-user.dto'; import { InternalServerErrorException } from '@nestjs/common'; @@ -34,7 +32,6 @@ export class FidoUserRepository { email: createUserDto.email, firstName: createUserDto.firstName, lastName: createUserDto.lastName, - password: await bcrypt.hash(createUserDto.password, 10), verificationCode: verifyCode } }); diff --git a/apps/user/repositories/user.repository.ts b/apps/user/repositories/user.repository.ts index d138a01a8..860e4a784 100644 --- a/apps/user/repositories/user.repository.ts +++ b/apps/user/repositories/user.repository.ts @@ -1,10 +1,10 @@ /* eslint-disable prefer-destructuring */ -import * as bcrypt from 'bcrypt'; import { Injectable, Logger, NotFoundException } from '@nestjs/common'; +import { UpdateUserProfile, UserEmailVerificationDto, UserI, userInfo } from '../interfaces/user.interface'; + import { InternalServerErrorException } from '@nestjs/common'; import { PrismaService } from '@credebl/prisma-service'; -import { UpdateUserProfile, UserEmailVerificationDto, UserI, userInfo } from '../interfaces/user.interface'; // eslint-disable-next-line camelcase import { user } from '@prisma/client'; import { v4 as uuidv4 } from 'uuid'; @@ -136,23 +136,22 @@ export class UserRepository { * @param id * @returns User data */ - async getUserByKeycloakId(id: string): Promise { + async getUserBySupabaseId(id: string): Promise { try { return this.prisma.user.findFirst({ where: { - keycloakUserId: id + supabaseUserId: id }, select: { id: true, username: true, - password: false, email: true, firstName: true, lastName: true, isEmailVerified: true, clientId: true, clientSecret: true, - keycloakUserId: true, + supabaseUserId: true, userOrgRoles: { include: { orgRole: true, @@ -195,7 +194,6 @@ export class UserRepository { select: { id: true, username: true, - password: false, email: true, firstName: true, lastName: true, @@ -204,7 +202,7 @@ export class UserRepository { isEmailVerified: true, clientId: true, clientSecret: true, - keycloakUserId: true, + supabaseUserId: true, userOrgRoles: { include: { orgRole: true, @@ -241,7 +239,6 @@ export class UserRepository { select: { id: true, username: true, - password: false, email: true, firstName: true, lastName: true, @@ -274,7 +271,7 @@ export class UserRepository { * @returns Updates organization details */ // eslint-disable-next-line camelcase - async updateUserDetails(id: number, keycloakUserId: string): Promise { + async updateUserDetails(id: number, supabaseUserId: string): Promise { try { const updateUserDetails = await this.prisma.user.update({ where: { @@ -282,7 +279,7 @@ export class UserRepository { }, data: { isEmailVerified: true, - keycloakUserId + supabaseUserId } }); return updateUserDetails; @@ -306,8 +303,7 @@ export class UserRepository { }, data: { firstName: userInfo.firstName, - lastName: userInfo.lastName, - password: await bcrypt.hash(userInfo.password, 10) + lastName: userInfo.lastName } }); return updateUserDetails; @@ -333,14 +329,13 @@ export class UserRepository { select: { id: true, username: true, - password: false, email: true, firstName: true, lastName: true, isEmailVerified: true, clientId: true, clientSecret: true, - keycloakUserId: true, + supabaseUserId: true, userOrgRoles: { where: { ...filterOptions @@ -399,14 +394,13 @@ export class UserRepository { select: { id: true, username: true, - password: false, email: true, firstName: true, lastName: true, isEmailVerified: true, clientId: false, clientSecret: false, - keycloakUserId: false + supabaseUserId: false }, take: pageSize, skip: (pageNumber - 1) * pageSize, diff --git a/apps/user/src/fido/fido.module.ts b/apps/user/src/fido/fido.module.ts index ee3b6b78e..a5106d814 100644 --- a/apps/user/src/fido/fido.module.ts +++ b/apps/user/src/fido/fido.module.ts @@ -11,6 +11,7 @@ import { KeycloakUrlService } from '@credebl/keycloak-url'; import { OrgRolesRepository } from 'libs/org-roles/repositories'; import { OrgRolesService } from '@credebl/org-roles'; import { PrismaService } from '@credebl/prisma-service'; +import { SupabaseService } from '@credebl/supabase'; import { UserActivityRepository } from 'libs/user-activity/repositories'; import { UserActivityService } from '@credebl/user-activity'; import { UserDevicesRepository } from '../../repositories/user-device.repository'; @@ -32,7 +33,7 @@ import { UserService } from '../user.service'; ]), HttpModule, CommonModule - ], +], controllers: [FidoController], providers: [ UserService, @@ -41,6 +42,7 @@ import { UserService } from '../user.service'; UserRepository, UserDevicesRepository, ClientRegistrationService, + SupabaseService, Logger, KeycloakUrlService, FidoUserRepository, diff --git a/apps/user/src/user.controller.ts b/apps/user/src/user.controller.ts index b74c728c2..952e84dcb 100644 --- a/apps/user/src/user.controller.ts +++ b/apps/user/src/user.controller.ts @@ -51,14 +51,15 @@ export class UserController { return this.userService.updateUserProfile(payload.updateUserProfileDto); } - @MessagePattern({ cmd: 'get-user-by-keycloak-id' }) - async findByKeycloakId(payload: { id }): Promise { - return this.userService.findByKeycloakId(payload); + @MessagePattern({ cmd: 'get-user-by-supabase' }) + async findSupabaseUser(payload: { id }): Promise { + return this.userService.findSupabaseUser(payload); } + @MessagePattern({ cmd: 'get-user-by-mail' }) async findUserByEmail(payload: { email }): Promise { - return this.userService.findUserByEmail(payload); + return this.userService.findUserByEmail(payload); } @MessagePattern({ cmd: 'get-org-invitations' }) @@ -106,7 +107,7 @@ export class UserController { } @MessagePattern({ cmd: 'add-user' }) async addUserDetailsInKeyCloak(payload: { userEmail: string, userInfo: userInfo }): Promise { - return this.userService.createUserInKeyCloak(payload.userEmail, payload.userInfo); + return this.userService.createUserForToken(payload.userEmail, payload.userInfo); } // Fetch Users recent activities diff --git a/apps/user/src/user.module.ts b/apps/user/src/user.module.ts index 603a20e6b..42362c279 100644 --- a/apps/user/src/user.module.ts +++ b/apps/user/src/user.module.ts @@ -8,6 +8,7 @@ import { FidoModule } from './fido/fido.module'; import { KeycloakUrlService } from '@credebl/keycloak-url'; import { OrgRolesRepository } from 'libs/org-roles/repositories'; import { PrismaService } from '@credebl/prisma-service'; +import { SupabaseService } from '@credebl/supabase'; import { UserActivityRepository } from 'libs/user-activity/repositories'; import { UserActivityService } from '@credebl/user-activity'; import { UserController } from './user.controller'; @@ -30,7 +31,7 @@ import { UserService } from './user.service'; CommonModule, FidoModule, OrgRolesModule - ], +], controllers: [UserController], providers: [ UserService, @@ -38,6 +39,7 @@ import { UserService } from './user.service'; PrismaService, Logger, ClientRegistrationService, + SupabaseService, KeycloakUrlService, OrgRolesService, UserOrgRolesService, diff --git a/apps/user/src/user.service.ts b/apps/user/src/user.service.ts index 4bcff0e1a..b9e42fcd4 100644 --- a/apps/user/src/user.service.ts +++ b/apps/user/src/user.service.ts @@ -1,4 +1,3 @@ -import * as bcrypt from 'bcrypt'; import { BadRequestException, @@ -31,6 +30,7 @@ import { HttpException } from '@nestjs/common'; import { InvitationsI, UpdateUserProfile, UserEmailVerificationDto, userInfo } from '../interfaces/user.interface'; import { AcceptRejectInvitationDto } from '../dtos/accept-reject-invitation.dto'; import { UserActivityService } from '@credebl/user-activity'; +import { SupabaseService } from '@credebl/supabase'; @Injectable() @@ -38,6 +38,7 @@ export class UserService { constructor( private readonly prisma: PrismaService, private readonly clientRegistrationService: ClientRegistrationService, + private readonly supabaseService: SupabaseService, private readonly commonService: CommonService, private readonly orgRoleService: OrgRolesService, private readonly userOrgRoleService: UserOrgRolesService, @@ -106,7 +107,7 @@ export class UserService { } } catch (error) { - this.logger.error(`error in create keycloak user: ${JSON.stringify(error)}`); + this.logger.error(`Error in sendEmailForVerification: ${JSON.stringify(error)}`); throw new InternalServerErrorException(error.message); } } @@ -148,13 +149,8 @@ export class UserService { } } - /** - * - * @param param email, verification code - * @returns Email verification succcess - */ - async createUserInKeyCloak(email: string, userInfo: userInfo): Promise { + async createUserForToken(email: string, userInfo: userInfo): Promise { try { if (!email) { throw new UnauthorizedException(ResponseMessages.user.error.invalidEmail); @@ -163,7 +159,7 @@ export class UserService { if (!checkUserDetails) { throw new NotFoundException(ResponseMessages.user.error.invalidEmail); } - if (checkUserDetails.keycloakUserId) { + if (checkUserDetails.supabaseUserId) { throw new ConflictException(ResponseMessages.user.error.exists); } if (false === checkUserDetails.isEmailVerified) { @@ -178,13 +174,20 @@ export class UserService { if (!userDetails) { throw new NotFoundException(ResponseMessages.user.error.adduser); } - const clientManagementToken = await this.clientRegistrationService.getManagementToken(); + const supaUser = await this.supabaseService.getClient().auth.signUp({ + email, + password: userInfo.password + }); - const keycloakDetails = await this.keycloakUserRegistration(userDetails, clientManagementToken); + if (supaUser.error) { + throw new InternalServerErrorException(supaUser.error?.message); + } + + const supaId = supaUser.data?.user?.id; await this.userRepository.updateUserDetails( userDetails.id, - keycloakDetails + supaId.toString() ); const holderRoleData = await this.orgRoleService.getRole(OrgRoles.HOLDER); @@ -192,79 +195,11 @@ export class UserService { return 'User created successfully'; } catch (error) { - this.logger.error(`error in create keycloak user: ${JSON.stringify(error)}`); + this.logger.error(`Error in createUserForToken: ${JSON.stringify(error)}`); throw new RpcException(error.response); } } - /** - * - * @param userName - * @param clientToken - * @returns Keycloak client details - */ - async keycloakClienGenerate(userName: string, clientToken: string): Promise<{ clientId; clientSecret }> { - try { - const userClient = await this.clientRegistrationService.createClient(userName, clientToken); - - return userClient; - } catch (error) { - this.logger.error(`error in keycloakClienGenerate: ${JSON.stringify(error)}`); - throw error; - } - } - - /** - * - * @param keycloakUserRegestrationDto - * @returns Email verification succcess - */ - - async keycloakUserRegistration(userDetails: user, clientToken: string): Promise { - const keycloakRegistrationPayload = { - email: userDetails.email, - firstName: userDetails.firstName, - lastName: userDetails.lastName, - username: userDetails.username, - enabled: true, - totp: true, - emailVerified: true, - notBefore: 0, - credentials: [ - { - type: 'password', - value: `${userDetails.password}`, - temporary: false - } - ], - access: { - manageGroupMembership: true, - view: true, - mapRoles: true, - impersonate: true, - manage: true - }, - realmRoles: ['user', 'offline_access'], - attributes: { - uid: [], - homedir: [], - shell: [] - } - }; - - try { - const createUserResponse = await this.clientRegistrationService.registerKeycloakUser( - keycloakRegistrationPayload, - process.env.KEYCLOAK_CREDEBL_REALM, - clientToken - ); - - return createUserResponse?.keycloakUserId; - } catch (error) { - this.logger.error(`error in keycloakUserRegistration: ${JSON.stringify(error)}`); - throw error; - } - } /** * @@ -290,27 +225,40 @@ export class UserService { } if (true === isPasskey && userData?.username && true === userData?.isFidoVerified) { - //Get user token from keycloak - const token = await this.clientRegistrationService.getUserToken(email, userData.password); - return token; - } - const comparePassword = await bcrypt.compare(password, userData.password); + return this.generateToken(email, password); - if (!comparePassword) { - this.logger.error(`Password Is wrong`); - throw new BadRequestException(ResponseMessages.user.error.invalidCredentials); } - //Get user token from kelycloak - const token = await this.clientRegistrationService.getUserToken(email, userData.password); - return token; + return this.generateToken(email, password); } catch (error) { this.logger.error(`In Login User : ${JSON.stringify(error)}`); throw new RpcException(error.response); } } + async generateToken(email: string, password: string): Promise { + const supaInstance = await this.supabaseService.getClient(); + + this.logger.error(`supaInstance::`, supaInstance); + + const { data, error } = await supaInstance.auth.signInWithPassword({ + email, + password + }); + + this.logger.error(`Supa Login Error::`, JSON.stringify(error)); + + if (error) { + throw new BadRequestException(error?.message); + } + + const token = data?.session; + + return token; + } + + async getProfile(payload: { id }): Promise { try { return this.userRepository.getUserById(payload.id); @@ -323,7 +271,7 @@ export class UserService { async getPublicProfile(payload: { id }): Promise { try { const userProfile = await this.userRepository.getUserPublicProfile(payload.id); - + if (!userProfile) { throw new NotFoundException(ResponseMessages.user.error.profileNotFound); } @@ -346,13 +294,22 @@ export class UserService { async findByKeycloakId(payload: { id }): Promise { try { - return this.userRepository.getUserByKeycloakId(payload.id); + return this.userRepository.getUserBySupabaseId(payload.id); } catch (error) { this.logger.error(`get user: ${JSON.stringify(error)}`); throw new RpcException(error.response); } } + async findSupabaseUser(payload: { id }): Promise { + try { + return this.userRepository.getUserBySupabaseId(payload.id); + } catch (error) { + this.logger.error(`Error in findSupabaseUser: ${JSON.stringify(error)}`); + throw new RpcException(error.response); + } + } + async findUserByEmail(payload: { email }): Promise { try { return this.userRepository.findUserByEmail(payload.email); @@ -515,12 +472,12 @@ export class UserService { } } - /** - * - * @param orgId - * @returns users list - */ - async get(pageNumber: number, pageSize: number, search: string): Promise { + /** + * + * @param orgId + * @returns users list + */ + async get(pageNumber: number, pageSize: number, search: string): Promise { try { const query = { OR: [ @@ -543,7 +500,7 @@ export class UserService { if (userDetails && !userDetails.isEmailVerified) { throw new ConflictException(ResponseMessages.user.error.verificationAlreadySent); - } else if (userDetails && userDetails.keycloakUserId) { + } else if (userDetails && userDetails.supabaseUserId) { throw new ConflictException(ResponseMessages.user.error.exists); } else if (null === userDetails) { return 'New User'; @@ -551,7 +508,7 @@ export class UserService { const userVerificationDetails = { isEmailVerified: userDetails.isEmailVerified, isFidoVerified: userDetails.isFidoVerified, - isKeycloak: null !== userDetails.keycloakUserId && undefined !== userDetails.keycloakUserId + isSupabase: null !== userDetails.supabaseUserId && undefined !== userDetails.supabaseUserId }; return userVerificationDetails; } @@ -566,7 +523,7 @@ export class UserService { async getUserActivity(userId: number, limit: number): Promise { try { - return this.userActivityService.getUserActivity(userId, limit); + return this.userActivityService.getUserActivity(userId, limit); } catch (error) { this.logger.error(`In getUserActivity : ${JSON.stringify(error)}`); diff --git a/libs/client-registration/src/dtos/create-user.dto.ts b/libs/client-registration/src/dtos/create-user.dto.ts index 4970d97d1..162a2dd35 100644 --- a/libs/client-registration/src/dtos/create-user.dto.ts +++ b/libs/client-registration/src/dtos/create-user.dto.ts @@ -18,6 +18,6 @@ export class CreateUserDto { createdBy?: number; clientId?: string; clientSecret?: string; - keycloakUserId?: string; + supabaseUserId?: string; } diff --git a/libs/prisma-service/prisma/migrations/20230809130946_user_activity/migration.sql b/libs/prisma-service/prisma/migrations/20230809130946_user_activity/migration.sql deleted file mode 100644 index d5f65cfcb..000000000 --- a/libs/prisma-service/prisma/migrations/20230809130946_user_activity/migration.sql +++ /dev/null @@ -1,18 +0,0 @@ --- CreateTable -CREATE TABLE "user_activity" ( - "id" SERIAL NOT NULL, - "userId" INTEGER NOT NULL, - "orgId" INTEGER NOT NULL, - "action" TEXT NOT NULL, - "details" TEXT NOT NULL, - "createDateTime" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "createdBy" INTEGER NOT NULL DEFAULT 1, - "lastChangedDateTime" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "lastChangedBy" INTEGER NOT NULL DEFAULT 1, - "deletedAt" TIMESTAMP(6), - - CONSTRAINT "user_activity_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "user_activity" ADD CONSTRAINT "user_activity_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/libs/prisma-service/prisma/migrations/20230809131143_user_activity_org/migration.sql b/libs/prisma-service/prisma/migrations/20230809131143_user_activity_org/migration.sql deleted file mode 100644 index 730d7d4e9..000000000 --- a/libs/prisma-service/prisma/migrations/20230809131143_user_activity_org/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AddForeignKey -ALTER TABLE "user_activity" ADD CONSTRAINT "user_activity_orgId_fkey" FOREIGN KEY ("orgId") REFERENCES "organisation"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/libs/prisma-service/prisma/migrations/20230809131410_org_status/migration.sql b/libs/prisma-service/prisma/migrations/20230809131410_org_status/migration.sql deleted file mode 100644 index a9946b817..000000000 --- a/libs/prisma-service/prisma/migrations/20230809131410_org_status/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "organisation" ADD COLUMN "status" TEXT; diff --git a/libs/prisma-service/prisma/migrations/20230809131741_org_slug/migration.sql b/libs/prisma-service/prisma/migrations/20230809131741_org_slug/migration.sql deleted file mode 100644 index ebc5f758a..000000000 --- a/libs/prisma-service/prisma/migrations/20230809131741_org_slug/migration.sql +++ /dev/null @@ -1,13 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `status` on the `organisation` table. All the data in the column will be lost. - - A unique constraint covering the columns `[orgSlug]` on the table `organisation` will be added. If there are existing duplicate values, this will fail. - -*/ --- AlterTable -ALTER TABLE "organisation" DROP COLUMN "status", -ADD COLUMN "orgSlug" TEXT; - --- CreateIndex -CREATE UNIQUE INDEX "organisation_orgSlug_key" ON "organisation"("orgSlug"); diff --git a/libs/prisma-service/prisma/migrations/20230811125950_add_public_profile_flag_org_user/migration.sql b/libs/prisma-service/prisma/migrations/20230811125950_add_public_profile_flag_org_user/migration.sql deleted file mode 100644 index 733c9568c..000000000 --- a/libs/prisma-service/prisma/migrations/20230811125950_add_public_profile_flag_org_user/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AlterTable -ALTER TABLE "organisation" ADD COLUMN "publicProfile" BOOLEAN NOT NULL DEFAULT false; - --- AlterTable -ALTER TABLE "user" ADD COLUMN "publicProfile" BOOLEAN NOT NULL DEFAULT false; diff --git a/libs/prisma-service/prisma/migrations/20230816140638_schema_attrs_data_type/migration.sql b/libs/prisma-service/prisma/migrations/20230816140638_schema_attrs_data_type/migration.sql deleted file mode 100644 index 6d1a2f8c9..000000000 --- a/libs/prisma-service/prisma/migrations/20230816140638_schema_attrs_data_type/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE "schema" ALTER COLUMN "attributes" SET NOT NULL, -ALTER COLUMN "attributes" SET DATA TYPE TEXT; diff --git a/libs/prisma-service/prisma/migrations/20230817071512_ledger_id_org_agents/migration.sql b/libs/prisma-service/prisma/migrations/20230817071512_ledger_id_org_agents/migration.sql deleted file mode 100644 index 64c46b42c..000000000 --- a/libs/prisma-service/prisma/migrations/20230817071512_ledger_id_org_agents/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AlterTable -ALTER TABLE "org_agents" ADD COLUMN "ledgerId" INTEGER; - --- AddForeignKey -ALTER TABLE "org_agents" ADD CONSTRAINT "org_agents_ledgerId_fkey" FOREIGN KEY ("ledgerId") REFERENCES "ledgers"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/libs/prisma-service/prisma/migrations/20230817143127_user_profile_img_type/migration.sql b/libs/prisma-service/prisma/migrations/20230817143127_user_profile_img_type/migration.sql deleted file mode 100644 index 5210b6748..000000000 --- a/libs/prisma-service/prisma/migrations/20230817143127_user_profile_img_type/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "user" ALTER COLUMN "profileImg" SET DATA TYPE TEXT; diff --git a/libs/prisma-service/prisma/migrations/0_init/migration.sql b/libs/prisma-service/prisma/migrations/20230825075815_init/migration.sql similarity index 90% rename from libs/prisma-service/prisma/migrations/0_init/migration.sql rename to libs/prisma-service/prisma/migrations/20230825075815_init/migration.sql index a231b6f80..d27203ae5 100644 --- a/libs/prisma-service/prisma/migrations/0_init/migration.sql +++ b/libs/prisma-service/prisma/migrations/20230825075815_init/migration.sql @@ -9,19 +9,35 @@ CREATE TABLE "user" ( "lastName" VARCHAR(500), "email" VARCHAR(500), "username" VARCHAR(500), - "password" VARCHAR(500), "verificationCode" VARCHAR(500), "isEmailVerified" BOOLEAN NOT NULL DEFAULT false, - "keycloakUserId" VARCHAR(500), + "supabaseUserId" VARCHAR(500), "clientId" VARCHAR(500), "clientSecret" VARCHAR(500), - "profileImg" VARCHAR(1000), + "profileImg" TEXT, "fidoUserId" VARCHAR(1000), "isFidoVerified" BOOLEAN NOT NULL DEFAULT false, + "publicProfile" BOOLEAN NOT NULL DEFAULT false, CONSTRAINT "PK_cace4a159ff9f2512dd42373760" PRIMARY KEY ("id") ); +-- CreateTable +CREATE TABLE "user_activity" ( + "id" SERIAL NOT NULL, + "userId" INTEGER NOT NULL, + "orgId" INTEGER NOT NULL, + "action" TEXT NOT NULL, + "details" TEXT NOT NULL, + "createDateTime" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "createdBy" INTEGER NOT NULL DEFAULT 1, + "lastChangedDateTime" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "lastChangedBy" INTEGER NOT NULL DEFAULT 1, + "deletedAt" TIMESTAMP(6), + + CONSTRAINT "user_activity_pkey" PRIMARY KEY ("id") +); + -- CreateTable CREATE TABLE "org_roles" ( "id" SERIAL NOT NULL, @@ -55,8 +71,10 @@ CREATE TABLE "organisation" ( "lastChangedBy" INTEGER NOT NULL DEFAULT 1, "name" VARCHAR(500), "description" VARCHAR(500), + "orgSlug" TEXT, "logoUrl" TEXT, "website" VARCHAR, + "publicProfile" BOOLEAN NOT NULL DEFAULT false, CONSTRAINT "organisation_pkey" PRIMARY KEY ("id") ); @@ -133,7 +151,8 @@ CREATE TABLE "org_agents" ( "apiKey" TEXT, "agentsTypeId" INTEGER NOT NULL, "orgId" INTEGER NOT NULL, - "orgAgentTypeId" INTEGER NOT NULL + "orgAgentTypeId" INTEGER NOT NULL, + "ledgerId" INTEGER ); -- CreateTable @@ -195,7 +214,7 @@ CREATE TABLE "schema" ( "lastChangedBy" INTEGER NOT NULL DEFAULT 1, "name" VARCHAR NOT NULL, "version" VARCHAR NOT NULL, - "attributes" TEXT[], + "attributes" TEXT NOT NULL, "schemaLedgerId" VARCHAR NOT NULL, "publisherDid" VARCHAR NOT NULL, "ledgerId" INTEGER NOT NULL DEFAULT 1, @@ -299,6 +318,9 @@ CREATE UNIQUE INDEX "UQ_e12875dfb3b1d92d7d7c5377e22" ON "user"("email"); -- CreateIndex CREATE UNIQUE INDEX "org_roles_name_key" ON "org_roles"("name"); +-- CreateIndex +CREATE UNIQUE INDEX "organisation_orgSlug_key" ON "organisation"("orgSlug"); + -- CreateIndex CREATE UNIQUE INDEX "UQ_7c903f5e362fe8fd3d3edba17b5" ON "user_devices"("credentialId"); @@ -326,6 +348,12 @@ CREATE UNIQUE INDEX "presentations_id_key" ON "presentations"("id"); -- CreateIndex CREATE UNIQUE INDEX "presentations_connectionId_key" ON "presentations"("connectionId"); +-- AddForeignKey +ALTER TABLE "user_activity" ADD CONSTRAINT "user_activity_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "user_activity" ADD CONSTRAINT "user_activity_orgId_fkey" FOREIGN KEY ("orgId") REFERENCES "organisation"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + -- AddForeignKey ALTER TABLE "user_org_roles" ADD CONSTRAINT "user_org_roles_orgId_fkey" FOREIGN KEY ("orgId") REFERENCES "organisation"("id") ON DELETE SET NULL ON UPDATE CASCADE; @@ -344,6 +372,9 @@ ALTER TABLE "org_invitations" ADD CONSTRAINT "org_invitations_orgId_fkey" FOREIG -- AddForeignKey ALTER TABLE "user_devices" ADD CONSTRAINT "FK_e12ac4f8016243ac71fd2e415af" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +-- AddForeignKey +ALTER TABLE "org_agents" ADD CONSTRAINT "org_agents_ledgerId_fkey" FOREIGN KEY ("ledgerId") REFERENCES "ledgers"("id") ON DELETE SET NULL ON UPDATE CASCADE; + -- AddForeignKey ALTER TABLE "org_agents" ADD CONSTRAINT "org_agents_agentsTypeId_fkey" FOREIGN KEY ("agentsTypeId") REFERENCES "agents_type"("id") ON DELETE RESTRICT ON UPDATE CASCADE; @@ -370,4 +401,3 @@ ALTER TABLE "credentials" ADD CONSTRAINT "credentials_orgId_fkey" FOREIGN KEY (" -- AddForeignKey ALTER TABLE "presentations" ADD CONSTRAINT "presentations_orgId_fkey" FOREIGN KEY ("orgId") REFERENCES "organisation"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - diff --git a/libs/prisma-service/prisma/schema.prisma b/libs/prisma-service/prisma/schema.prisma index bc9e1b5dc..23fb8d161 100644 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -17,10 +17,9 @@ model user { lastName String? @db.VarChar(500) email String? @unique(map: "UQ_e12875dfb3b1d92d7d7c5377e22") @db.VarChar(500) username String? @db.VarChar(500) - password String? @db.VarChar(500) verificationCode String? @db.VarChar(500) isEmailVerified Boolean @default(false) - keycloakUserId String? @db.VarChar(500) + supabaseUserId String? @db.VarChar(500) clientId String? @db.VarChar(500) clientSecret String? @db.VarChar(500) profileImg String? diff --git a/libs/supabase/src/index.ts b/libs/supabase/src/index.ts new file mode 100644 index 000000000..1b4bbcdf4 --- /dev/null +++ b/libs/supabase/src/index.ts @@ -0,0 +1,2 @@ +export * from './supabase.module'; +export * from './supabase.service'; diff --git a/libs/supabase/src/supabase.module.ts b/libs/supabase/src/supabase.module.ts new file mode 100644 index 000000000..1cd0a3c77 --- /dev/null +++ b/libs/supabase/src/supabase.module.ts @@ -0,0 +1,8 @@ +import { Module } from '@nestjs/common'; +import { SupabaseService } from './supabase.service'; + +@Module({ + providers: [SupabaseService], + exports: [SupabaseService] +}) +export class SupabaseModule {} diff --git a/libs/supabase/src/supabase.service.ts b/libs/supabase/src/supabase.service.ts new file mode 100644 index 000000000..83acf5d6f --- /dev/null +++ b/libs/supabase/src/supabase.service.ts @@ -0,0 +1,33 @@ +import { Injectable, Logger, Scope } from '@nestjs/common'; +import { SupabaseClient, createClient } from '@supabase/supabase-js'; + +@Injectable({ scope: Scope.REQUEST }) +export class SupabaseService { + + private readonly logger = new Logger(SupabaseService.name); + private clientInstance: SupabaseClient; + constructor( + ) { } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + getClient(): SupabaseClient { + this.logger.log('getting supabase client...'); + + if (this.clientInstance) { + this.logger.log('client exists - returning for current Scope.REQUEST'); + return this.clientInstance; + } + + this.logger.log('initialising new supabase client for new Scope.REQUEST'); + + this.clientInstance = createClient( + + process.env.SUPABASE_URL, + process.env.SUPABASE_KEY + ); + + this.logger.log('auth has been set!'); + + return this.clientInstance; + } +} diff --git a/libs/supabase/tsconfig.lib.json b/libs/supabase/tsconfig.lib.json new file mode 100644 index 000000000..fdd77eefc --- /dev/null +++ b/libs/supabase/tsconfig.lib.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "../../dist/libs/supabase" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] +} diff --git a/nest-cli.json b/nest-cli.json index e40641492..68dc6c90e 100644 --- a/nest-cli.json +++ b/nest-cli.json @@ -223,6 +223,15 @@ "compilerOptions": { "tsConfigPath": "libs/user-activity/tsconfig.lib.json" } + }, + "supabase": { + "type": "library", + "root": "libs/supabase", + "entryFile": "index", + "sourceRoot": "libs/supabase/src", + "compilerOptions": { + "tsConfigPath": "libs/supabase/tsconfig.lib.json" + } } } } \ No newline at end of file diff --git a/package.json b/package.json index bab2d9934..aa863013e 100755 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@nestjs/websockets": "^10.1.3", "@prisma/client": "^5.1.1", "@sendgrid/mail": "^7.7.0", + "@supabase/supabase-js": "^2.32.0", "@types/async-retry": "^1.4.5", "@types/crypto-js": "^4.1.1", "@types/pdfkit": "^0.12.6", @@ -69,6 +70,7 @@ "moment": "^2.29.3", "nanoid": "^4.0.2", "nats": "^2.15.1", + "nestjs-supabase-auth": "^1.0.9", "nestjs-typeorm-paginate": "^4.0.4", "node-qpdf2": "^2.0.0", "papaparse": "^5.4.1", @@ -164,7 +166,8 @@ "^@credebl/prisma-service(|/.*)$": "/libs/prisma-service/src/$1", "^@credebl/org-roles(|/.*)$": "/libs/org-roles/src/$1", "^@credebl/user-org-roles(|/.*)$": "/libs/user-org-roles/src/$1", - "^y/user-activity(|/.*)$": "/libs/user-activity/src/$1" + "^y/user-activity(|/.*)$": "/libs/user-activity/src/$1", + "^@app/supabase(|/.*)$": "/libs/supabase/src/$1" } } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 325ab3851..ae4d74c13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -134,6 +134,9 @@ dependencies: nats: specifier: ^2.15.1 version: 2.15.1 + nestjs-supabase-auth: + specifier: ^1.0.9 + version: 1.0.9 nestjs-typeorm-paginate: specifier: ^4.0.4 version: 4.0.4(@nestjs/common@10.1.3)(typeorm@0.3.10) @@ -1631,6 +1634,62 @@ packages: resolution: {integrity: sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==} dev: false + /@supabase/functions-js@2.1.2: + resolution: {integrity: sha512-QCR6pwJs9exCl37bmpMisUd6mf+0SUBJ6mUpiAjEkSJ/+xW8TCuO14bvkWHADd5hElJK9MxNlMQXxSA4DRz9nQ==} + dependencies: + cross-fetch: 3.1.8 + transitivePeerDependencies: + - encoding + dev: false + + /@supabase/gotrue-js@2.47.0: + resolution: {integrity: sha512-3e34/vsKH/DoSZCpB85UZpFWSJ2p4GRUUlqgAgeTPagPlx4xS+Nc5v7g7ic7vp3gK0J5PsYVCn9Qu2JQUp4vXg==} + dependencies: + cross-fetch: 3.1.8 + transitivePeerDependencies: + - encoding + dev: false + + /@supabase/postgrest-js@1.8.0: + resolution: {integrity: sha512-R6leDIC92NgjyG2/tCRJ42rWN7+fZY6ulTEE+c00tcnghn6cX4IYUlnTNMtrdfYC2JYNOTyM+rWj63Wdhr7Zig==} + dependencies: + cross-fetch: 3.1.8 + transitivePeerDependencies: + - encoding + dev: false + + /@supabase/realtime-js@2.7.3: + resolution: {integrity: sha512-c7TzL81sx2kqyxsxcDduJcHL9KJdCOoKimGP6lQSqiZKX42ATlBZpWbyy9KFGFBjAP4nyopMf5JhPi2ZH9jyNw==} + dependencies: + '@types/phoenix': 1.6.0 + '@types/websocket': 1.0.5 + websocket: 1.0.34 + transitivePeerDependencies: + - supports-color + dev: false + + /@supabase/storage-js@2.5.1: + resolution: {integrity: sha512-nkR0fQA9ScAtIKA3vNoPEqbZv1k5B5HVRYEvRWdlP6mUpFphM9TwPL2jZ/ztNGMTG5xT6SrHr+H7Ykz8qzbhjw==} + dependencies: + cross-fetch: 3.1.8 + transitivePeerDependencies: + - encoding + dev: false + + /@supabase/supabase-js@2.32.0: + resolution: {integrity: sha512-1ShFhuOI5Du7604nlCelBsRD61daXk2O0qwjumoz35bqrYThnSPPtpJqZOHw6Mg6o7mLjIInYLh/DBlh8UvzRg==} + dependencies: + '@supabase/functions-js': 2.1.2 + '@supabase/gotrue-js': 2.47.0 + '@supabase/postgrest-js': 1.8.0 + '@supabase/realtime-js': 2.7.3 + '@supabase/storage-js': 2.5.1 + cross-fetch: 3.1.8 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + /@swc/helpers@0.3.17: resolution: {integrity: sha512-tb7Iu+oZ+zWJZ3HJqwx8oNwSDIU440hmVMDPhpACWQWnrZHK99Bxs70gT1L2dnr5Hg50ZRWEFkQCAnOVVV0z1Q==} dependencies: @@ -1844,6 +1903,10 @@ packages: '@types/node': 20.4.6 dev: false + /@types/phoenix@1.6.0: + resolution: {integrity: sha512-qwfpsHmFuhAS/dVd4uBIraMxRd56vwBUYQGZ6GpXnFuM2XMRFJbIyruFKKlW2daQliuYZwe0qfn/UjFCDKic5g==} + dev: false + /@types/qs@6.9.7: resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==} @@ -1891,6 +1954,12 @@ packages: /@types/validator@13.9.0: resolution: {integrity: sha512-NclP0IbzHj/4tJZKFqKh8E7kZdgss+MCUYV9G+TLltFfDA4lFgE4PKPpDIyS2FlcdANIfSx273emkupvChigbw==} + /@types/websocket@1.0.5: + resolution: {integrity: sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ==} + dependencies: + '@types/node': 20.4.6 + dev: false + /@types/yargs-parser@21.0.0: resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} dev: true @@ -2836,6 +2905,14 @@ packages: engines: {node: '>=0.2.0'} dev: false + /bufferutil@4.0.7: + resolution: {integrity: sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==} + engines: {node: '>=6.14.2'} + requiresBuild: true + dependencies: + node-gyp-build: 4.6.0 + dev: false + /builtins@5.0.1: resolution: {integrity: sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==} dependencies: @@ -3261,6 +3338,14 @@ packages: luxon: 3.3.0 dev: false + /cross-fetch@3.1.8: + resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} + dependencies: + node-fetch: 2.6.12 + transitivePeerDependencies: + - encoding + dev: false + /cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} @@ -3281,6 +3366,13 @@ packages: type-fest: 2.19.0 dev: false + /d@1.0.1: + resolution: {integrity: sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==} + dependencies: + es5-ext: 0.10.62 + type: 1.2.0 + dev: false + /dashdash@1.14.1: resolution: {integrity: sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==} engines: {node: '>=0.10'} @@ -3684,10 +3776,35 @@ packages: is-symbol: 1.0.4 dev: true + /es5-ext@0.10.62: + resolution: {integrity: sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==} + engines: {node: '>=0.10'} + requiresBuild: true + dependencies: + es6-iterator: 2.0.3 + es6-symbol: 3.1.3 + next-tick: 1.1.0 + dev: false + + /es6-iterator@2.0.3: + resolution: {integrity: sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + es6-symbol: 3.1.3 + dev: false + /es6-promise@4.2.8: resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} dev: false + /es6-symbol@3.1.3: + resolution: {integrity: sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==} + dependencies: + d: 1.0.1 + ext: 1.7.0 + dev: false + /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -4132,6 +4249,12 @@ packages: transitivePeerDependencies: - supports-color + /ext@1.7.0: + resolution: {integrity: sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==} + dependencies: + type: 2.7.2 + dev: false + /extend@3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} requiresBuild: true @@ -5069,7 +5192,6 @@ packages: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} requiresBuild: true dev: false - optional: true /is-unicode-supported@0.1.0: resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} @@ -6223,6 +6345,10 @@ packages: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} dev: true + /nestjs-supabase-auth@1.0.9: + resolution: {integrity: sha512-1Aar5K2WuGggPV8q/xzJCIeAQz5wkPcvKGLPTUXwt1he1EKLg+OdWK2C0T7LzTgO4uX2WLakNWZBsUTZEOvt4Q==} + dev: false + /nestjs-typeorm-paginate@4.0.4(@nestjs/common@10.1.3)(typeorm@0.3.10): resolution: {integrity: sha512-arinWDc78wPV/EYWMmLYyeMSE5Lae1FHWD/2QpOdTmHaOVqK4PYf19EqZBqT9gbbPugkNW9JAMz3G2WmvSgR/A==} peerDependencies: @@ -6233,6 +6359,10 @@ packages: typeorm: 0.3.10(pg@8.11.2)(ts-node@10.9.1) dev: false + /next-tick@1.1.0: + resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} + dev: false + /nkeys.js@1.0.5: resolution: {integrity: sha512-u25YnRPHiGVsNzwyHnn+PT90sgAhnS8jUJ1nxmkHMFYCJ6+Ic0lv291w7uhRBpJVJ3PH2GWbYqA151lGCRrB5g==} engines: {node: '>=10.0.0'} @@ -6271,6 +6401,11 @@ packages: dev: false optional: true + /node-gyp-build@4.6.0: + resolution: {integrity: sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==} + hasBin: true + dev: false + /node-int64@0.4.0: resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} dev: true @@ -8059,6 +8194,14 @@ packages: media-typer: 0.3.0 mime-types: 2.1.35 + /type@1.2.0: + resolution: {integrity: sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==} + dev: false + + /type@2.7.2: + resolution: {integrity: sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==} + dev: false + /typed-array-buffer@1.0.0: resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} engines: {node: '>= 0.4'} @@ -8097,6 +8240,12 @@ packages: is-typed-array: 1.1.12 dev: true + /typedarray-to-buffer@3.1.5: + resolution: {integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==} + dependencies: + is-typedarray: 1.0.0 + dev: false + /typedarray@0.0.6: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} @@ -8267,6 +8416,14 @@ packages: resolution: {integrity: sha512-RtuPeMy7c1UrHwproMZN9gN6kiZ0SvJwRaEzwZY0j9MypEkFqyBaKv176jvlPtg58Zh36bOkS0NFABXMHvvGCA==} dev: false + /utf-8-validate@5.0.10: + resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} + engines: {node: '>=6.14.2'} + requiresBuild: true + dependencies: + node-gyp-build: 4.6.0 + dev: false + /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -8456,6 +8613,20 @@ packages: - uglify-js dev: true + /websocket@1.0.34: + resolution: {integrity: sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==} + engines: {node: '>=4.0.0'} + dependencies: + bufferutil: 4.0.7 + debug: 2.6.9 + es5-ext: 0.10.62 + typedarray-to-buffer: 3.1.5 + utf-8-validate: 5.0.10 + yaeti: 0.0.6 + transitivePeerDependencies: + - supports-color + dev: false + /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} dependencies: @@ -8604,6 +8775,11 @@ packages: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} + /yaeti@0.0.6: + resolution: {integrity: sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==} + engines: {node: '>=0.10.32'} + dev: false + /yallist@2.1.2: resolution: {integrity: sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==} dev: false diff --git a/tsconfig.json b/tsconfig.json index 3e71568cb..afa54f6bf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -94,6 +94,12 @@ ], "@credebl/user-activity/*": [ "libs/user-activity/src/*" + ], + "@credebl/supabase": [ + "libs/supabase/src" + ], + "@credebl/supabase/*": [ + "libs/supabase/src/*" ] } },