From 2d536ab0bcf66159e3309ac521aba76e2e93753a Mon Sep 17 00:00:00 2001 From: pallavicoder Date: Mon, 23 Oct 2023 15:55:25 +0530 Subject: [PATCH 01/51] feat:NATS Configuration SetUp with Nkeys and Seed Signed-off-by: pallavicoder --- .../src/agent-provisioning.module.ts | 3 +- .../agent-service/src/agent-service.module.ts | 2 + .../src/agent-service/agent-service.module.ts | 2 + apps/api-gateway/src/authz/authz.module.ts | 2 + .../src/connection/connection.module.ts | 2 + .../credential-definition.module.ts | 2 + .../src/ecosystem/ecosystem.module.ts | 4 +- apps/api-gateway/src/fido/fido.module.ts | 2 + .../src/issuance/issuance.module.ts | 2 + .../src/organization/organization.module.ts | 2 + .../src/platform/platform.module.ts | 2 + apps/api-gateway/src/schema/schema.module.ts | 4 +- apps/api-gateway/src/user/user.module.ts | 2 + .../src/verification/verification.module.ts | 2 + apps/connection/src/connection.module.ts | 4 +- apps/ecosystem/src/ecosystem.module.ts | 4 +- apps/issuance/src/issuance.module.ts | 2 + apps/ledger/src/ledger.module.ts | 2 + apps/organization/src/organization.module.ts | 2 + apps/user/src/user.module.ts | 2 + apps/verification/src/verification.module.ts | 2 + docker-compose.yml | 152 +-- libs/service/nats.options.ts | 4 + nats-server.conf | 11 + package-lock.json | 986 +++++++++++++----- 25 files changed, 801 insertions(+), 403 deletions(-) create mode 100644 nats-server.conf diff --git a/apps/agent-provisioning/src/agent-provisioning.module.ts b/apps/agent-provisioning/src/agent-provisioning.module.ts index 933b9dcf8..7e7a58b0b 100644 --- a/apps/agent-provisioning/src/agent-provisioning.module.ts +++ b/apps/agent-provisioning/src/agent-provisioning.module.ts @@ -3,7 +3,7 @@ import { AgentProvisioningController } from './agent-provisioning.controller'; import { AgentProvisioningService } from './agent-provisioning.service'; import { ClientsModule, Transport } from '@nestjs/microservices'; import { ConfigModule } from '@nestjs/config'; - +// import { Authenticator, nkeyAuthenticator } from 'nats'; @Module({ imports: [ ConfigModule.forRoot(), @@ -13,6 +13,7 @@ import { ConfigModule } from '@nestjs/config'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.AGENT_PROVISIONING_NKEY_SEED)), } } ]) diff --git a/apps/agent-service/src/agent-service.module.ts b/apps/agent-service/src/agent-service.module.ts index b51014f93..bd7957d6c 100644 --- a/apps/agent-service/src/agent-service.module.ts +++ b/apps/agent-service/src/agent-service.module.ts @@ -8,6 +8,7 @@ import { AgentServiceRepository } from './repositories/agent-service.repository' import { ConfigModule } from '@nestjs/config'; import { ConnectionService } from 'apps/connection/src/connection.service'; import { ConnectionRepository } from 'apps/connection/src/connection.repository'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -18,6 +19,7 @@ import { ConnectionRepository } from 'apps/connection/src/connection.repository' transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.AGENT_SERVICE_NKEY_SEED)), } } ]), diff --git a/apps/api-gateway/src/agent-service/agent-service.module.ts b/apps/api-gateway/src/agent-service/agent-service.module.ts index 4662016a0..741fd4280 100644 --- a/apps/api-gateway/src/agent-service/agent-service.module.ts +++ b/apps/api-gateway/src/agent-service/agent-service.module.ts @@ -6,6 +6,7 @@ import { CommonService } from '../../../../libs/common/src/common.service'; import { ConfigModule } from '@nestjs/config'; import { AgentController } from './agent-service.controller'; import { AgentService } from './agent-service.service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -17,6 +18,7 @@ import { AgentService } from './agent-service.service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.AGENT_SERVICE_NKEY_SEED)), } }, CommonModule diff --git a/apps/api-gateway/src/authz/authz.module.ts b/apps/api-gateway/src/authz/authz.module.ts index 3c9448584..6b757b456 100644 --- a/apps/api-gateway/src/authz/authz.module.ts +++ b/apps/api-gateway/src/authz/authz.module.ts @@ -17,6 +17,7 @@ import { UserModule } from '../user/user.module'; import { UserService } from '../user/user.service'; import { VerificationService } from '../verification/verification.service'; import { EcosystemService } from '../ecosystem/ecosystem.service'; +// import { nkeyAuthenticator } from 'nats'; //import { WebhookService } from "../../../platform-service/src/webhook/webhook.service"; @@ -33,6 +34,7 @@ import { EcosystemService } from '../ecosystem/ecosystem.service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.API_GATEWAY_NKEY_SEED)), } }, CommonModule diff --git a/apps/api-gateway/src/connection/connection.module.ts b/apps/api-gateway/src/connection/connection.module.ts index 4568fa599..43f6665c1 100644 --- a/apps/api-gateway/src/connection/connection.module.ts +++ b/apps/api-gateway/src/connection/connection.module.ts @@ -1,3 +1,4 @@ +// import { nkeyAuthenticator } from 'nats'; import { ConnectionController } from './connection.controller'; import { ConnectionService } from './connection.service'; import { Module } from '@nestjs/common'; @@ -12,6 +13,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.CONNECTION_NKEY_SEED)), } } ]) diff --git a/apps/api-gateway/src/credential-definition/credential-definition.module.ts b/apps/api-gateway/src/credential-definition/credential-definition.module.ts index c7ffed996..4e0f54a12 100644 --- a/apps/api-gateway/src/credential-definition/credential-definition.module.ts +++ b/apps/api-gateway/src/credential-definition/credential-definition.module.ts @@ -3,6 +3,7 @@ import { Logger, Module } from '@nestjs/common'; import { CredentialDefinitionController } from './credential-definition.controller'; import { CredentialDefinitionService } from './credential-definition.service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports:[ @@ -12,6 +13,7 @@ import { CredentialDefinitionService } from './credential-definition.service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + } } ]) diff --git a/apps/api-gateway/src/ecosystem/ecosystem.module.ts b/apps/api-gateway/src/ecosystem/ecosystem.module.ts index 24a59ec00..d3938775e 100644 --- a/apps/api-gateway/src/ecosystem/ecosystem.module.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.module.ts @@ -6,6 +6,7 @@ import { HttpModule } from '@nestjs/axios'; import { Module } from '@nestjs/common'; import { EcosystemController } from './ecosystem.controller'; import { EcosystemService } from './ecosystem.service'; +import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -16,7 +17,8 @@ import { EcosystemService } from './ecosystem.service'; name: 'NATS_CLIENT', transport: Transport.NATS, options: { - servers: [`${process.env.NATS_URL}`] + servers: [`${process.env.NATS_URL}`], + authenticator: nkeyAuthenticator(new TextEncoder().encode('SUAG4DUOUYQLU2QKQUBCF74LV3CYHIHGNZVAGH4P3Q4NLBRVDZF6UZ6CNY')) } }, CommonModule diff --git a/apps/api-gateway/src/fido/fido.module.ts b/apps/api-gateway/src/fido/fido.module.ts index 1011c9b95..99c12c242 100644 --- a/apps/api-gateway/src/fido/fido.module.ts +++ b/apps/api-gateway/src/fido/fido.module.ts @@ -2,6 +2,7 @@ import { Module } from '@nestjs/common'; import { ClientsModule, Transport } from '@nestjs/microservices'; import { FidoController } from './fido.controller'; import { FidoService } from './fido.service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports:[ @@ -11,6 +12,7 @@ import { FidoService } from './fido.service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + } } ]) diff --git a/apps/api-gateway/src/issuance/issuance.module.ts b/apps/api-gateway/src/issuance/issuance.module.ts index 5e339bd5b..ce62618b4 100644 --- a/apps/api-gateway/src/issuance/issuance.module.ts +++ b/apps/api-gateway/src/issuance/issuance.module.ts @@ -4,6 +4,7 @@ import { IssuanceController } from './issuance.controller'; import { IssuanceService } from './issuance.service'; import { CommonService } from '@credebl/common'; import { HttpModule } from '@nestjs/axios'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -14,6 +15,7 @@ import { HttpModule } from '@nestjs/axios'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.ISSUANCE_NKEY_SEED)), } } ]) diff --git a/apps/api-gateway/src/organization/organization.module.ts b/apps/api-gateway/src/organization/organization.module.ts index 9357db1bd..df063767e 100644 --- a/apps/api-gateway/src/organization/organization.module.ts +++ b/apps/api-gateway/src/organization/organization.module.ts @@ -6,6 +6,7 @@ import { HttpModule } from '@nestjs/axios'; import { Module } from '@nestjs/common'; import { OrganizationController } from './organization.controller'; import { OrganizationService } from './organization.service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -17,6 +18,7 @@ import { OrganizationService } from './organization.service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.ORGANIZATION_NKEY_SEED)), } }, CommonModule diff --git a/apps/api-gateway/src/platform/platform.module.ts b/apps/api-gateway/src/platform/platform.module.ts index 692fe9918..cafab062b 100644 --- a/apps/api-gateway/src/platform/platform.module.ts +++ b/apps/api-gateway/src/platform/platform.module.ts @@ -3,6 +3,7 @@ import { PlatformController } from './platform.controller'; import { PlatformService } from './platform.service'; import { ClientsModule, Transport } from '@nestjs/microservices'; import { ConfigModule } from '@nestjs/config'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -13,6 +14,7 @@ import { ConfigModule } from '@nestjs/config'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + } } ]) diff --git a/apps/api-gateway/src/schema/schema.module.ts b/apps/api-gateway/src/schema/schema.module.ts index c1649fe9d..22635721c 100644 --- a/apps/api-gateway/src/schema/schema.module.ts +++ b/apps/api-gateway/src/schema/schema.module.ts @@ -4,6 +4,7 @@ import { ConfigModule } from '@nestjs/config'; import { Module } from '@nestjs/common'; import { SchemaController } from './schema.controller'; import { SchemaService } from './schema.service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -14,7 +15,8 @@ import { SchemaService } from './schema.service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] - } + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.API_GATEWAY_NKEY_SEED)), + } } ]) ], diff --git a/apps/api-gateway/src/user/user.module.ts b/apps/api-gateway/src/user/user.module.ts index 7d494c009..3e5d01753 100644 --- a/apps/api-gateway/src/user/user.module.ts +++ b/apps/api-gateway/src/user/user.module.ts @@ -5,6 +5,7 @@ import { HttpModule } from '@nestjs/axios'; import { Module } from '@nestjs/common'; import { UserController } from './user.controller'; import { UserService } from './user.service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -16,6 +17,7 @@ import { UserService } from './user.service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.USER_NKEY_SEED)), } } ]) diff --git a/apps/api-gateway/src/verification/verification.module.ts b/apps/api-gateway/src/verification/verification.module.ts index 0c71b71bf..768ed72b6 100644 --- a/apps/api-gateway/src/verification/verification.module.ts +++ b/apps/api-gateway/src/verification/verification.module.ts @@ -4,6 +4,7 @@ import { ConfigModule } from '@nestjs/config'; import { Module } from '@nestjs/common'; import { VerificationController } from './verification.controller'; import { VerificationService } from './verification.service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -14,6 +15,7 @@ import { VerificationService } from './verification.service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.VERIFICATION_NKEY_SEED)), } } ]) diff --git a/apps/connection/src/connection.module.ts b/apps/connection/src/connection.module.ts index e9cc372a8..d1b6d49e4 100644 --- a/apps/connection/src/connection.module.ts +++ b/apps/connection/src/connection.module.ts @@ -5,6 +5,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; import { CommonModule } from '@credebl/common'; import { ConnectionRepository } from './connection.repository'; import { PrismaService } from '@credebl/prisma-service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -14,7 +15,8 @@ import { PrismaService } from '@credebl/prisma-service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] - } + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.CONNECTION_NKEY_SEED)), + } } ]), diff --git a/apps/ecosystem/src/ecosystem.module.ts b/apps/ecosystem/src/ecosystem.module.ts index 17bec847f..978d17a86 100644 --- a/apps/ecosystem/src/ecosystem.module.ts +++ b/apps/ecosystem/src/ecosystem.module.ts @@ -5,6 +5,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; import { CommonModule } from '@credebl/common'; import { EcosystemRepository } from './ecosystem.repository'; import { PrismaService } from '@credebl/prisma-service'; +import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -13,7 +14,8 @@ import { PrismaService } from '@credebl/prisma-service'; name: 'NATS_CLIENT', transport: Transport.NATS, options: { - servers: [`${process.env.NATS_URL}`] + servers: [`${process.env.NATS_URL}`], + authenticator: nkeyAuthenticator(new TextEncoder().encode('SUAG4DUOUYQLU2QKQUBCF74LV3CYHIHGNZVAGH4P3Q4NLBRVDZF6UZ6CNY')) } } ]), diff --git a/apps/issuance/src/issuance.module.ts b/apps/issuance/src/issuance.module.ts index 732e40f35..b5f545dbf 100644 --- a/apps/issuance/src/issuance.module.ts +++ b/apps/issuance/src/issuance.module.ts @@ -6,6 +6,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; import { IssuanceController } from './issuance.controller'; import { IssuanceRepository } from './issuance.repository'; import { IssuanceService } from './issuance.service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -16,6 +17,7 @@ import { IssuanceService } from './issuance.service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.ISSUANCE_NKEY_SEED)), } } ]), diff --git a/apps/ledger/src/ledger.module.ts b/apps/ledger/src/ledger.module.ts index 7d65d6fc6..709d3ccd2 100644 --- a/apps/ledger/src/ledger.module.ts +++ b/apps/ledger/src/ledger.module.ts @@ -6,6 +6,7 @@ import { PrismaService } from '@credebl/prisma-service'; import { CredentialDefinitionModule } from './credential-definition/credential-definition.module'; import { ClientsModule, Transport } from '@nestjs/microservices'; import { LedgerRepository } from './repositories/ledger.repository'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -15,6 +16,7 @@ import { LedgerRepository } from './repositories/ledger.repository'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.LEDGER_NKEY_SEED)), } } ]), diff --git a/apps/organization/src/organization.module.ts b/apps/organization/src/organization.module.ts index 07612f636..8f05b495d 100644 --- a/apps/organization/src/organization.module.ts +++ b/apps/organization/src/organization.module.ts @@ -13,6 +13,7 @@ import { UserActivityService } from '@credebl/user-activity'; import { UserOrgRolesRepository } from 'libs/user-org-roles/repositories'; import { UserOrgRolesService } from '@credebl/user-org-roles'; import { UserRepository } from 'apps/user/repositories/user.repository'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -22,6 +23,7 @@ import { UserRepository } from 'apps/user/repositories/user.repository'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.ORGANIZATION_NKEY_SEED)), } } ]), diff --git a/apps/user/src/user.module.ts b/apps/user/src/user.module.ts index 865dc6e04..bf65c8a43 100644 --- a/apps/user/src/user.module.ts +++ b/apps/user/src/user.module.ts @@ -17,6 +17,7 @@ import { UserOrgRolesService } from '@credebl/user-org-roles'; import { UserRepository } from '../repositories/user.repository'; import { UserService } from './user.service'; import { UserDevicesRepository } from '../repositories/user-device.repository'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -26,6 +27,7 @@ import { UserDevicesRepository } from '../repositories/user-device.repository'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.USER_NKEY_SEED)), } } ]), diff --git a/apps/verification/src/verification.module.ts b/apps/verification/src/verification.module.ts index 4b6ea652f..55083954b 100644 --- a/apps/verification/src/verification.module.ts +++ b/apps/verification/src/verification.module.ts @@ -5,6 +5,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; import { CommonModule } from '@credebl/common'; import { VerificationRepository } from './repositories/verification.repository'; import { PrismaService } from '@credebl/prisma-service'; +// import { nkeyAuthenticator } from 'nats'; @Module({ imports: [ @@ -14,6 +15,7 @@ import { PrismaService } from '@credebl/prisma-service'; transport: Transport.NATS, options: { servers: [`${process.env.NATS_URL}`] + // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.VERIFICATION_NKEY_SEED)), } } ]), diff --git a/docker-compose.yml b/docker-compose.yml index c7116e0ff..7473ec329 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,142 +1,12 @@ -version: '3' - +version: '3.3' services: - nats: - container_name: nats - entrypoint: '/nats-server -c /nats-server.conf -DV' # Corrected the path to nats-server.conf - image: nats - ports: - - '4222:4222' - - '6222:6222' - - '8222:8222' - # volumes: - # - ./nats-server.conf:/nats-server.conf # Mount the config file - redis: - image: redis:6.2-alpine - restart: always - ports: - - '6379:6379' - command: redis-server --save 20 1 --loglevel warning - volumes: - - cache:/data - api-gateway: - depends_on: - - nats # Use depends_on instead of needs - - redis - build: - context: ./ # Adjust the context path as needed - dockerfile: Dockerfiles/Dockerfile.api-gateway - ports: - - '5000:5000' - env_file: - - ./.env - user: - depends_on: - - nats # Use depends_on instead of needs - - api-gateway - build: - context: ./ # Adjust the context path as needed - dockerfile: Dockerfiles/Dockerfile.user - env_file: - - ./.env - connection: - depends_on: - - nats # Use depends_on instead of needs - - api-gateway - - user - build: - context: ./ # Adjust the context path as needed - dockerfile: Dockerfiles/Dockerfile.connection - env_file: - - ./.env - issuance: - depends_on: - - nats # Use depends_on instead of needs - - api-gateway - - user - - connection - build: - context: ./ # Adjust the context path as needed - dockerfile: Dockerfiles/Dockerfile.issuance - env_file: - - ./.env - ledger: - depends_on: - - nats # Use depends_on instead of needs - - api-gateway - - user - - connection - - issuance - build: - context: ./ # Adjust the context path as needed - dockerfile: Dockerfiles/Dockerfile.ledger - env_file: - - ./.env - organization: - depends_on: - - nats # Use depends_on instead of needs - - api-gateway - - user - - connection - - issuance - - ledger - build: - context: ./ # Adjust the context path as needed - dockerfile: Dockerfiles/Dockerfile.organization - env_file: - - ./.env - verification: - depends_on: - - nats # Use depends_on instead of needs - - api-gateway - - user - - connection - - issuance - - ledger - - organization - build: - context: ./ # Adjust the context path as needed - dockerfile: Dockerfiles/Dockerfile.verification - env_file: - - ./.env - agent-provisioning: - depends_on: - - nats # Use depends_on instead of needs - - api-gateway - - user - - connection - - issuance - - ledger - - organization - - verification - build: - context: ./ # Adjust the context path as needed - dockerfile: Dockerfiles/Dockerfile.agnet-provisioning - env_file: - - ./.env - agent-service: - depends_on: - - nats # Use depends_on instead of needs - - api-gateway - - user - - connection - - issuance - - ledger - - organization - - verification - - agent-provisioning - build: - context: ./ # Adjust the context path as needed - dockerfile: Dockerfiles/Dockerfile.agent-service - env_file: - - ./.env - - - - - - - -volumes: - cache: - driver: local + nats: + container_name: nats-server + ports: + + - '4222:4222' + + volumes: + - './nats-server.conf:/nats-server.conf' + restart: unless-stopped + image: nats \ No newline at end of file diff --git a/libs/service/nats.options.ts b/libs/service/nats.options.ts index 6bea3c62d..de86d0ecb 100644 --- a/libs/service/nats.options.ts +++ b/libs/service/nats.options.ts @@ -1,9 +1,13 @@ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ import { NatsOptions, Transport } from '@nestjs/microservices'; +// import { nkeyAuthenticator } from 'nats'; +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export const commonNatsOptions = (name: string, isClient = true) => { const common: NatsOptions = { transport: Transport.NATS, options: { url: `nats://${process.env.NATS_HOST}:${process.env.NATS_PORT}`, + // authenticator: nkeyAuthenticator(new TextEncoder().encode('SUADBTFIXH3YRTN3HR33SKP7SWEGW62MAXHCXPIAJHPVVUOVDLU3TPA53M')), name, maxReconnectAttempts: -1, reconnectTimeWait: 3000 diff --git a/nats-server.conf b/nats-server.conf new file mode 100644 index 000000000..f4d3b537c --- /dev/null +++ b/nats-server.conf @@ -0,0 +1,11 @@ +authorization: { + users: [ + { nkey:UDHTNJ3F7X6YMPW2UGAIGUWAEZCI3CICCPTSTJ6WZ3WTFGME5I7ZBHXP, + permissions = { + publish = ["*"] # Define the permissions for publishing + subscribe = ["*"] # Define the permissions for subscribing + } + + } + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d057da9c0..21556e6ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,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", @@ -52,6 +53,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", @@ -61,7 +63,7 @@ "path": "^0.12.7", "pdfkit": "^0.13.0", "pg": "^8.11.2", - "qrcode": "^1.5.1", + "qrcode": "^1.5.3", "qs": "^6.11.2", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", @@ -156,6 +158,28 @@ } } }, + "node_modules/@angular-devkit/core/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@angular-devkit/core/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/@angular-devkit/schematics": { "version": "16.1.4", "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-16.1.4.tgz", @@ -917,7 +941,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, + "devOptional": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -929,7 +953,7 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, + "devOptional": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -982,28 +1006,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@eslint/eslintrc/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, "node_modules/@eslint/js": { "version": "8.47.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.47.0.tgz", @@ -1455,7 +1457,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6.0.0" } @@ -1483,7 +1485,7 @@ "version": "1.4.15", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true + "devOptional": true }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.19", @@ -2088,6 +2090,28 @@ "yarn": ">= 1.13.0" } }, + "node_modules/@nestjs/schematics/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@nestjs/schematics/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/@nestjs/swagger": { "version": "7.1.8", "resolved": "https://registry.npmjs.org/@nestjs/swagger/-/swagger-7.1.8.tgz", @@ -2270,7 +2294,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.1.1.tgz", "integrity": "sha512-NV/4nVNWFZSJCCIA3HIFJbbDKO/NARc9ej0tX5S9k2EVbkrFJC4Xt9b0u4rNZWL4V+F5LAjvta8vzEUw0rw+HA==", - "dev": true, + "devOptional": true, "hasInstallScript": true }, "node_modules/@prisma/engines-version": { @@ -2290,6 +2314,14 @@ "node": "6.* || 8.* || >=10.*" } }, + "node_modules/@sendgrid/client/node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, "node_modules/@sendgrid/helpers": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/@sendgrid/helpers/-/helpers-7.7.0.tgz", @@ -2347,6 +2379,73 @@ "resolved": "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.5.tgz", "integrity": "sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==" }, + "node_modules/@supabase/functions-js": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.1.5.tgz", + "integrity": "sha512-BNzC5XhCzzCaggJ8s53DP+WeHHGT/NfTsx2wUSSGKR2/ikLFQTBCDzMvGz/PxYMqRko/LwncQtKXGOYp1PkPaw==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "node_modules/@supabase/gotrue-js": { + "version": "2.56.0", + "resolved": "https://registry.npmjs.org/@supabase/gotrue-js/-/gotrue-js-2.56.0.tgz", + "integrity": "sha512-UJEPWls3fN2TfqiDWP/b78Kby4VjPcXnMGmF2lfzP5IDS4xr1+kxBugGmrQXxX8mxBsmvmW1ATahzyBUU9FZyQ==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "node_modules/@supabase/node-fetch": { + "version": "2.6.14", + "resolved": "https://registry.npmjs.org/@supabase/node-fetch/-/node-fetch-2.6.14.tgz", + "integrity": "sha512-w/Tsd22e/5fAeoxqQ4P2MX6EyF+iM6rc9kmlMVFkHuG0rAltt2TLhFbDJfemnHbtvnazWaRfy5KnFU/SYT37dQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/@supabase/postgrest-js": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.8.5.tgz", + "integrity": "sha512-XvoqN5e5Z4TsQOYWLQYLW0HIlZtFSzwAcwiuToaSBSTpLOGCg4NaZ7au5GfBzCQJZdZPY5vk5FvwthfDsQK/Jw==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "node_modules/@supabase/realtime-js": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.8.1.tgz", + "integrity": "sha512-bka5U4OeoKMdorGMPjdF30cl8n8nbhn+I9H4iySKzbN45W6AGxi7xoODnxdq/QwaDGtVyTMVbU+GVWre0QCdtw==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14", + "@types/phoenix": "^1.5.4", + "@types/websocket": "^1.0.3", + "websocket": "^1.0.34" + } + }, + "node_modules/@supabase/storage-js": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.5.4.tgz", + "integrity": "sha512-yspHD19I9uQUgfTh0J94+/r/g6hnhdQmw6Y7OWqr/EbnL6uvicGV1i1UDkkmeUHqfF9Mbt2sLtuxRycYyKv2ew==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "node_modules/@supabase/supabase-js": { + "version": "2.38.1", + "resolved": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.38.1.tgz", + "integrity": "sha512-WbdwKiZMMPiELL+8A4WJRHHq+xVKN+3tXxKnJWbR0XZG8HgeGVeQWhlchatTttaxsNKyx68gE7wWNvhin0V+Mg==", + "dependencies": { + "@supabase/functions-js": "^2.1.5", + "@supabase/gotrue-js": "^2.54.2", + "@supabase/node-fetch": "^2.6.14", + "@supabase/postgrest-js": "^1.8.5", + "@supabase/realtime-js": "^2.8.0", + "@supabase/storage-js": "^2.5.4" + } + }, "node_modules/@swc/helpers": { "version": "0.3.17", "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.3.17.tgz", @@ -2359,25 +2458,25 @@ "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true + "devOptional": true }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true + "devOptional": true }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true + "devOptional": true }, "node_modules/@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true + "devOptional": true }, "node_modules/@types/async-retry": { "version": "1.4.5", @@ -2659,6 +2758,11 @@ "@types/node": "*" } }, + "node_modules/@types/phoenix": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@types/phoenix/-/phoenix-1.6.3.tgz", + "integrity": "sha512-D8TtchWVnU2ZdPVDY6tBJuz8MUDmCNVduilZTrf0Gn/u5I/uZEXOsaL4Gs4F0j43cysHsU/4h7eqAKc+SF2boQ==" + }, "node_modules/@types/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", @@ -2729,6 +2833,14 @@ "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.11.1.tgz", "integrity": "sha512-d/MUkJYdOeKycmm75Arql4M5+UuXmf4cHdHKsyw1GcvnNgL6s77UkgSgJ8TE/rI5PYsnwYq5jkcWBLuN/MpQ1A==" }, + "node_modules/@types/websocket": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/websocket/-/websocket-1.0.8.tgz", + "integrity": "sha512-wvkOpWApbuxVfHhSQ1XrjVN4363vsfLJwEo4AboIZk0g1vJA5nmLp8GXUHuIdf4/Fe7+/V0Efe2HvWiLqHtlqw==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/yargs": { "version": "17.0.24", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", @@ -3113,7 +3225,7 @@ "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "dev": true, + "devOptional": true, "bin": { "acorn": "bin/acorn" }, @@ -3143,7 +3255,7 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, + "devOptional": true, "engines": { "node": ">=0.4.0" } @@ -3160,14 +3272,14 @@ } }, "node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "devOptional": true, "dependencies": { "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" }, "funding": { @@ -3192,6 +3304,28 @@ } } }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", @@ -3324,7 +3458,7 @@ "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "devOptional": true }, "node_modules/argparse": { "version": "2.0.1", @@ -3546,11 +3680,28 @@ "optional": true }, "node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", + "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", + "peer": true, "dependencies": { - "follow-redirects": "^1.14.8" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "peer": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" } }, "node_modules/babel-jest": { @@ -4003,6 +4154,18 @@ "node": ">=0.2.0" } }, + "node_modules/bufferutil": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz", + "integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==", + "hasInstallScript": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, "node_modules/builtins": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", @@ -4646,7 +4809,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "devOptional": true }, "node_modules/cron": { "version": "2.4.0", @@ -4700,6 +4863,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "dependencies": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -4916,7 +5088,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, + "devOptional": true, "engines": { "node": ">=0.3.1" } @@ -5254,11 +5426,44 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es5-ext": { + "version": "0.10.62", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", + "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", + "hasInstallScript": true, + "dependencies": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "dependencies": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, "node_modules/es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" }, + "node_modules/es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "dependencies": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -5795,22 +6000,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/eslint/node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -5823,12 +6012,6 @@ "node": ">=10.13.0" } }, - "node_modules/eslint/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -6083,6 +6266,19 @@ "node": ">= 0.8" } }, + "node_modules/ext": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", + "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", + "dependencies": { + "type": "^2.7.2" + } + }, + "node_modules/ext/node_modules/type": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", + "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" + }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -6829,28 +7025,6 @@ "node": ">=6" } }, - "node_modules/har-validator/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "optional": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/har-validator/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "optional": true - }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -7567,8 +7741,7 @@ "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "optional": true + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" }, "node_modules/is-unicode-supported": { "version": "0.1.0", @@ -8372,10 +8545,10 @@ "optional": true }, "node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "devOptional": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -9204,7 +9377,7 @@ "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "devOptional": true }, "node_modules/makeerror": { "version": "1.0.12", @@ -9510,6 +9683,11 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "node_modules/nestjs-supabase-auth": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/nestjs-supabase-auth/-/nestjs-supabase-auth-1.0.9.tgz", + "integrity": "sha512-1Aar5K2WuGggPV8q/xzJCIeAQz5wkPcvKGLPTUXwt1he1EKLg+OdWK2C0T7LzTgO4uX2WLakNWZBsUTZEOvt4Q==" + }, "node_modules/nestjs-typeorm-paginate": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/nestjs-typeorm-paginate/-/nestjs-typeorm-paginate-4.0.4.tgz", @@ -9519,6 +9697,11 @@ "typeorm": "^0.3.0" } }, + "node_modules/next-tick": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" + }, "node_modules/nkeys.js": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nkeys.js/-/nkeys.js-1.0.5.tgz", @@ -9569,6 +9752,16 @@ } } }, + "node_modules/node-gyp-build": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", + "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/node-gyp-build-optional-packages": { "version": "5.0.7", "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz", @@ -10500,7 +10693,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.1.1.tgz", "integrity": "sha512-WJFG/U7sMmcc6TjJTTifTfpI6Wjoh55xl4AzopVwAdyK68L9/ogNo8QQ2cxuUjJf/Wa82z/uhyh3wMzvRIBphg==", - "dev": true, + "devOptional": true, "hasInstallScript": true, "dependencies": { "@prisma/engines": "5.1.1" @@ -10559,6 +10752,12 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "peer": true + }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -11265,28 +11464,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/schema-utils/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/schema-utils/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, "node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -12335,7 +12512,7 @@ "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, + "devOptional": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -12454,6 +12631,11 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, + "node_modules/type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -12568,6 +12750,14 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, "node_modules/typeorm": { "version": "0.3.17", "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.17.tgz", @@ -12728,7 +12918,7 @@ "version": "5.1.6", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", - "dev": true, + "devOptional": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -12869,6 +13059,18 @@ "resolved": "https://registry.npmjs.org/urlsafe-base64/-/urlsafe-base64-1.0.0.tgz", "integrity": "sha512-RtuPeMy7c1UrHwproMZN9gN6kiZ0SvJwRaEzwZY0j9MypEkFqyBaKv176jvlPtg58Zh36bOkS0NFABXMHvvGCA==" }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "hasInstallScript": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, "node_modules/util": { "version": "0.10.4", "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", @@ -12907,7 +13109,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "devOptional": true }, "node_modules/v8-to-istanbul": { "version": "9.1.0", @@ -13148,6 +13350,35 @@ "node": ">=4.0" } }, + "node_modules/websocket": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", + "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", + "dependencies": { + "bufferutil": "^4.0.1", + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "typedarray-to-buffer": "^3.1.5", + "utf-8-validate": "^5.0.2", + "yaeti": "^0.0.6" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/websocket/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/websocket/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -13388,6 +13619,14 @@ "node": ">=10" } }, + "node_modules/yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==", + "engines": { + "node": ">=0.10.32" + } + }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -13441,7 +13680,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6" } @@ -13487,6 +13726,26 @@ "jsonc-parser": "3.2.0", "rxjs": "7.8.1", "source-map": "0.7.4" + }, + "dependencies": { + "ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } } }, "@angular-devkit/schematics": { @@ -14074,7 +14333,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, + "devOptional": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -14083,7 +14342,7 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, + "devOptional": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -14118,29 +14377,9 @@ "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - } + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" } }, "@eslint/js": { @@ -14495,7 +14734,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true + "devOptional": true }, "@jridgewell/set-array": { "version": "1.1.2", @@ -14517,7 +14756,7 @@ "version": "1.4.15", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true + "devOptional": true }, "@jridgewell/trace-mapping": { "version": "0.3.19", @@ -14589,7 +14828,8 @@ "@nestjs/axios": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.0.tgz", - "integrity": "sha512-ULdH03jDWkS5dy9X69XbUVbhC+0pVnrRcj7bIK/ytTZ76w7CgvTZDJqsIyisg3kNOiljRW/4NIjSf3j6YGvl+g==" + "integrity": "sha512-ULdH03jDWkS5dy9X69XbUVbhC+0pVnrRcj7bIK/ytTZ76w7CgvTZDJqsIyisg3kNOiljRW/4NIjSf3j6YGvl+g==", + "requires": {} }, "@nestjs/bull": { "version": "10.0.1", @@ -14765,7 +15005,8 @@ "@nestjs/mapped-types": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@nestjs/mapped-types/-/mapped-types-2.0.2.tgz", - "integrity": "sha512-V0izw6tWs6fTp9+KiiPUbGHWALy563Frn8X6Bm87ANLRuE46iuBMD5acKBDP5lKL/75QFvrzSJT7HkCbB0jTpg==" + "integrity": "sha512-V0izw6tWs6fTp9+KiiPUbGHWALy563Frn8X6Bm87ANLRuE46iuBMD5acKBDP5lKL/75QFvrzSJT7HkCbB0jTpg==", + "requires": {} }, "@nestjs/microservices": { "version": "10.1.3", @@ -14786,7 +15027,8 @@ "@nestjs/passport": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/@nestjs/passport/-/passport-10.0.0.tgz", - "integrity": "sha512-IlKKc6M7JOe+4dBbW6gZsXBSD05ZYgwfGf3GJhgCmUGYVqffpDdALQSS6JftnExrE+12rACoEmHkzYwKAGVK0Q==" + "integrity": "sha512-IlKKc6M7JOe+4dBbW6gZsXBSD05ZYgwfGf3GJhgCmUGYVqffpDdALQSS6JftnExrE+12rACoEmHkzYwKAGVK0Q==", + "requires": {} }, "@nestjs/platform-express": { "version": "10.1.3", @@ -14870,6 +15112,24 @@ "ora": "5.4.1", "rxjs": "7.8.1" } + }, + "ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true } } }, @@ -14975,7 +15235,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.1.1.tgz", "integrity": "sha512-NV/4nVNWFZSJCCIA3HIFJbbDKO/NARc9ej0tX5S9k2EVbkrFJC4Xt9b0u4rNZWL4V+F5LAjvta8vzEUw0rw+HA==", - "dev": true + "devOptional": true }, "@prisma/engines-version": { "version": "5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e", @@ -14989,6 +15249,16 @@ "requires": { "@sendgrid/helpers": "^7.7.0", "axios": "^0.26.0" + }, + "dependencies": { + "axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "requires": { + "follow-redirects": "^1.14.8" + } + } } }, "@sendgrid/helpers": { @@ -15042,6 +15312,70 @@ "resolved": "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.5.tgz", "integrity": "sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==" }, + "@supabase/functions-js": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.1.5.tgz", + "integrity": "sha512-BNzC5XhCzzCaggJ8s53DP+WeHHGT/NfTsx2wUSSGKR2/ikLFQTBCDzMvGz/PxYMqRko/LwncQtKXGOYp1PkPaw==", + "requires": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "@supabase/gotrue-js": { + "version": "2.56.0", + "resolved": "https://registry.npmjs.org/@supabase/gotrue-js/-/gotrue-js-2.56.0.tgz", + "integrity": "sha512-UJEPWls3fN2TfqiDWP/b78Kby4VjPcXnMGmF2lfzP5IDS4xr1+kxBugGmrQXxX8mxBsmvmW1ATahzyBUU9FZyQ==", + "requires": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "@supabase/node-fetch": { + "version": "2.6.14", + "resolved": "https://registry.npmjs.org/@supabase/node-fetch/-/node-fetch-2.6.14.tgz", + "integrity": "sha512-w/Tsd22e/5fAeoxqQ4P2MX6EyF+iM6rc9kmlMVFkHuG0rAltt2TLhFbDJfemnHbtvnazWaRfy5KnFU/SYT37dQ==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "@supabase/postgrest-js": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.8.5.tgz", + "integrity": "sha512-XvoqN5e5Z4TsQOYWLQYLW0HIlZtFSzwAcwiuToaSBSTpLOGCg4NaZ7au5GfBzCQJZdZPY5vk5FvwthfDsQK/Jw==", + "requires": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "@supabase/realtime-js": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.8.1.tgz", + "integrity": "sha512-bka5U4OeoKMdorGMPjdF30cl8n8nbhn+I9H4iySKzbN45W6AGxi7xoODnxdq/QwaDGtVyTMVbU+GVWre0QCdtw==", + "requires": { + "@supabase/node-fetch": "^2.6.14", + "@types/phoenix": "^1.5.4", + "@types/websocket": "^1.0.3", + "websocket": "^1.0.34" + } + }, + "@supabase/storage-js": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.5.4.tgz", + "integrity": "sha512-yspHD19I9uQUgfTh0J94+/r/g6hnhdQmw6Y7OWqr/EbnL6uvicGV1i1UDkkmeUHqfF9Mbt2sLtuxRycYyKv2ew==", + "requires": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "@supabase/supabase-js": { + "version": "2.38.1", + "resolved": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.38.1.tgz", + "integrity": "sha512-WbdwKiZMMPiELL+8A4WJRHHq+xVKN+3tXxKnJWbR0XZG8HgeGVeQWhlchatTttaxsNKyx68gE7wWNvhin0V+Mg==", + "requires": { + "@supabase/functions-js": "^2.1.5", + "@supabase/gotrue-js": "^2.54.2", + "@supabase/node-fetch": "^2.6.14", + "@supabase/postgrest-js": "^1.8.5", + "@supabase/realtime-js": "^2.8.0", + "@supabase/storage-js": "^2.5.4" + } + }, "@swc/helpers": { "version": "0.3.17", "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.3.17.tgz", @@ -15054,25 +15388,25 @@ "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true + "devOptional": true }, "@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true + "devOptional": true }, "@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true + "devOptional": true }, "@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true + "devOptional": true }, "@types/async-retry": { "version": "1.4.5", @@ -15354,6 +15688,11 @@ "@types/node": "*" } }, + "@types/phoenix": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@types/phoenix/-/phoenix-1.6.3.tgz", + "integrity": "sha512-D8TtchWVnU2ZdPVDY6tBJuz8MUDmCNVduilZTrf0Gn/u5I/uZEXOsaL4Gs4F0j43cysHsU/4h7eqAKc+SF2boQ==" + }, "@types/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", @@ -15424,6 +15763,14 @@ "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.11.1.tgz", "integrity": "sha512-d/MUkJYdOeKycmm75Arql4M5+UuXmf4cHdHKsyw1GcvnNgL6s77UkgSgJ8TE/rI5PYsnwYq5jkcWBLuN/MpQ1A==" }, + "@types/websocket": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/websocket/-/websocket-1.0.8.tgz", + "integrity": "sha512-wvkOpWApbuxVfHhSQ1XrjVN4363vsfLJwEo4AboIZk0g1vJA5nmLp8GXUHuIdf4/Fe7+/V0Efe2HvWiLqHtlqw==", + "requires": { + "@types/node": "*" + } + }, "@types/yargs": { "version": "17.0.24", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", @@ -15716,25 +16063,27 @@ "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "dev": true + "devOptional": true }, "acorn-import-assertions": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", - "dev": true + "dev": true, + "requires": {} }, "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true + "dev": true, + "requires": {} }, "acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true + "devOptional": true }, "agent-base": { "version": "6.0.2", @@ -15745,14 +16094,14 @@ } }, "ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "devOptional": true, "requires": { "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, @@ -15763,13 +16112,34 @@ "dev": true, "requires": { "ajv": "^8.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } } }, "ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true + "dev": true, + "requires": {} }, "ansi-colors": { "version": "4.1.3", @@ -15862,7 +16232,7 @@ "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "devOptional": true }, "argparse": { "version": "2.0.1", @@ -16036,11 +16406,27 @@ "optional": true }, "axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", + "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", + "peer": true, "requires": { - "follow-redirects": "^1.14.8" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + }, + "dependencies": { + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "peer": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + } } }, "babel-jest": { @@ -16369,6 +16755,14 @@ "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", "integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==" }, + "bufferutil": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz", + "integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==", + "requires": { + "node-gyp-build": "^4.3.0" + } + }, "builtins": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", @@ -16842,7 +17236,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "devOptional": true }, "cron": { "version": "2.4.0", @@ -16884,6 +17278,15 @@ "type-fest": "^2.12.2" } }, + "d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -16918,7 +17321,8 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", - "dev": true + "dev": true, + "requires": {} }, "deep-equal": { "version": "2.2.2", @@ -17036,7 +17440,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true + "devOptional": true }, "diff-sequences": { "version": "29.4.3", @@ -17318,11 +17722,40 @@ "is-symbol": "^1.0.2" } }, + "es5-ext": { + "version": "0.10.62", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", + "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", + "requires": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, "es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" }, + "es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -17384,18 +17817,6 @@ "text-table": "^0.2.0" }, "dependencies": { - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, "glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -17404,12 +17825,6 @@ "requires": { "is-glob": "^4.0.3" } - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true } } }, @@ -17417,13 +17832,15 @@ "version": "8.10.0", "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", - "dev": true + "dev": true, + "requires": {} }, "eslint-config-standard": { "version": "17.1.0", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.1.0.tgz", "integrity": "sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==", - "dev": true + "dev": true, + "requires": {} }, "eslint-config-standard-with-typescript": { "version": "37.0.0", @@ -17667,7 +18084,8 @@ "version": "6.1.1", "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==", - "dev": true + "dev": true, + "requires": {} }, "eslint-scope": { "version": "7.2.2", @@ -17899,6 +18317,21 @@ } } }, + "ext": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", + "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", + "requires": { + "type": "^2.7.2" + }, + "dependencies": { + "type": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", + "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" + } + } + }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -18472,26 +18905,6 @@ "requires": { "ajv": "^6.12.3", "har-schema": "^2.0.0" - }, - "dependencies": { - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "optional": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "optional": true - } } }, "has": { @@ -18967,8 +19380,7 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "optional": true + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" }, "is-unicode-supported": { "version": "0.1.0", @@ -19327,7 +19739,8 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", - "dev": true + "dev": true, + "requires": {} }, "jest-regex-util": { "version": "29.4.3", @@ -19590,10 +20003,10 @@ "optional": true }, "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "devOptional": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -20183,7 +20596,7 @@ "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "devOptional": true }, "makeerror": { "version": "1.0.12", @@ -20413,10 +20826,21 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "nestjs-supabase-auth": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/nestjs-supabase-auth/-/nestjs-supabase-auth-1.0.9.tgz", + "integrity": "sha512-1Aar5K2WuGggPV8q/xzJCIeAQz5wkPcvKGLPTUXwt1he1EKLg+OdWK2C0T7LzTgO4uX2WLakNWZBsUTZEOvt4Q==" + }, "nestjs-typeorm-paginate": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/nestjs-typeorm-paginate/-/nestjs-typeorm-paginate-4.0.4.tgz", - "integrity": "sha512-arinWDc78wPV/EYWMmLYyeMSE5Lae1FHWD/2QpOdTmHaOVqK4PYf19EqZBqT9gbbPugkNW9JAMz3G2WmvSgR/A==" + "integrity": "sha512-arinWDc78wPV/EYWMmLYyeMSE5Lae1FHWD/2QpOdTmHaOVqK4PYf19EqZBqT9gbbPugkNW9JAMz3G2WmvSgR/A==", + "requires": {} + }, + "next-tick": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" }, "nkeys.js": { "version": "1.0.5", @@ -20454,6 +20878,11 @@ "whatwg-url": "^5.0.0" } }, + "node-gyp-build": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", + "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==" + }, "node-gyp-build-optional-packages": { "version": "5.0.7", "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz", @@ -20893,7 +21322,8 @@ "pg-pool": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.1.tgz", - "integrity": "sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og==" + "integrity": "sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og==", + "requires": {} }, "pg-protocol": { "version": "1.6.0", @@ -21138,7 +21568,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.1.1.tgz", "integrity": "sha512-WJFG/U7sMmcc6TjJTTifTfpI6Wjoh55xl4AzopVwAdyK68L9/ogNo8QQ2cxuUjJf/Wa82z/uhyh3wMzvRIBphg==", - "dev": true, + "devOptional": true, "requires": { "@prisma/engines": "5.1.1" } @@ -21178,6 +21608,12 @@ "ipaddr.js": "1.9.1" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "peer": true + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -21688,26 +22124,6 @@ "@types/json-schema": "^7.0.8", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" - }, - "dependencies": { - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - } } }, "semver": { @@ -22461,7 +22877,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.1.tgz", "integrity": "sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==", - "dev": true + "dev": true, + "requires": {} }, "ts-jest": { "version": "29.1.1", @@ -22495,7 +22912,7 @@ "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, + "devOptional": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -22578,6 +22995,11 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, + "type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" + }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -22659,6 +23081,14 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, "typeorm": { "version": "0.3.17", "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.17.tgz", @@ -22720,7 +23150,7 @@ "version": "5.1.6", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", - "dev": true + "devOptional": true }, "uid": { "version": "2.0.2", @@ -22822,6 +23252,14 @@ "resolved": "https://registry.npmjs.org/urlsafe-base64/-/urlsafe-base64-1.0.0.tgz", "integrity": "sha512-RtuPeMy7c1UrHwproMZN9gN6kiZ0SvJwRaEzwZY0j9MypEkFqyBaKv176jvlPtg58Zh36bOkS0NFABXMHvvGCA==" }, + "utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "requires": { + "node-gyp-build": "^4.3.0" + } + }, "util": { "version": "0.10.4", "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", @@ -22856,7 +23294,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "devOptional": true }, "v8-to-istanbul": { "version": "9.1.0", @@ -23051,6 +23489,34 @@ "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", "dev": true }, + "websocket": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", + "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", + "requires": { + "bufferutil": "^4.0.1", + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "typedarray-to-buffer": "^3.1.5", + "utf-8-validate": "^5.0.2", + "yaeti": "^0.0.6" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + } + } + }, "whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -23193,7 +23659,8 @@ "ws": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==" + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "requires": {} }, "xml-js": { "version": "1.6.11", @@ -23218,6 +23685,11 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==" + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -23262,7 +23734,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true + "devOptional": true }, "yocto-queue": { "version": "0.1.0", From ad9d90d6250eb053121fcd527391250237114597 Mon Sep 17 00:00:00 2001 From: Nishad Date: Tue, 7 Nov 2023 12:03:46 +0530 Subject: [PATCH 02/51] Worked on NATs security setup with nkeys Signed-off-by: Nishad --- .../agent-service/src/agent-service.module.ts | 7 ++---- apps/agent-service/src/main.ts | 6 ++--- .../src/agent-service/agent-service.module.ts | 8 +++---- apps/api-gateway/src/app.module.ts | 8 ++++--- apps/api-gateway/src/authz/authz.module.ts | 9 ++------ .../src/connection/connection.module.ts | 7 ++---- .../credential-definition.module.ts | 7 ++---- .../src/ecosystem/ecosystem.module.ts | 7 ++---- apps/api-gateway/src/fido/fido.module.ts | 8 +++---- .../src/issuance/issuance.module.ts | 7 ++---- apps/api-gateway/src/main.ts | 23 +++++++------------ .../src/organization/organization.module.ts | 8 +++---- .../src/platform/platform.module.ts | 7 ++---- apps/api-gateway/src/schema/schema.module.ts | 8 +++---- apps/api-gateway/src/user/user.module.ts | 8 +++---- .../src/verification/verification.module.ts | 7 ++---- apps/connection/src/connection.module.ts | 6 ++--- apps/connection/src/main.ts | 5 ++-- apps/ecosystem/src/ecosystem.module.ts | 7 ++---- apps/ecosystem/src/main.ts | 5 ++-- apps/issuance/src/issuance.module.ts | 7 ++---- apps/issuance/src/main.ts | 6 ++--- apps/ledger/src/ledger.module.ts | 8 +++---- apps/ledger/src/main.ts | 6 ++--- apps/organization/src/main.ts | 7 +++--- apps/organization/src/organization.module.ts | 7 ++---- apps/user/src/main.ts | 5 ++-- apps/user/src/user.module.ts | 7 ++---- apps/verification/src/main.ts | 6 ++--- apps/verification/src/verification.module.ts | 8 +++---- libs/common/src/nats.config.ts | 9 ++++++++ nats-server.conf | 6 +---- 32 files changed, 92 insertions(+), 148 deletions(-) create mode 100644 libs/common/src/nats.config.ts diff --git a/apps/agent-service/src/agent-service.module.ts b/apps/agent-service/src/agent-service.module.ts index bd7957d6c..49a44e888 100644 --- a/apps/agent-service/src/agent-service.module.ts +++ b/apps/agent-service/src/agent-service.module.ts @@ -8,7 +8,7 @@ import { AgentServiceRepository } from './repositories/agent-service.repository' import { ConfigModule } from '@nestjs/config'; import { ConnectionService } from 'apps/connection/src/connection.service'; import { ConnectionRepository } from 'apps/connection/src/connection.repository'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -17,10 +17,7 @@ import { ConnectionRepository } from 'apps/connection/src/connection.repository' { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.AGENT_SERVICE_NKEY_SEED)), - } + options: getNatsOptions() } ]), CommonModule diff --git a/apps/agent-service/src/main.ts b/apps/agent-service/src/main.ts index 53d5fbba0..9acdca77d 100644 --- a/apps/agent-service/src/main.ts +++ b/apps/agent-service/src/main.ts @@ -5,6 +5,7 @@ import { AgentServiceModule } from './agent-service.module'; import { AgentServiceService } from './agent-service.service'; import { IAgentSpinupDto, IUserRequestInterface } from './interface/agent-service.interface'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; +import { getNatsOptions } from '@credebl/common/nats.config'; const logger = new Logger(); @@ -12,9 +13,8 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(AgentServiceModule, { transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions() + }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/api-gateway/src/agent-service/agent-service.module.ts b/apps/api-gateway/src/agent-service/agent-service.module.ts index 741fd4280..2bbb3e232 100644 --- a/apps/api-gateway/src/agent-service/agent-service.module.ts +++ b/apps/api-gateway/src/agent-service/agent-service.module.ts @@ -6,7 +6,7 @@ import { CommonService } from '../../../../libs/common/src/common.service'; import { ConfigModule } from '@nestjs/config'; import { AgentController } from './agent-service.controller'; import { AgentService } from './agent-service.service'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -16,10 +16,8 @@ import { AgentService } from './agent-service.service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.AGENT_SERVICE_NKEY_SEED)), - } + options: getNatsOptions() + }, CommonModule ]) diff --git a/apps/api-gateway/src/app.module.ts b/apps/api-gateway/src/app.module.ts index 792999579..8af86d258 100644 --- a/apps/api-gateway/src/app.module.ts +++ b/apps/api-gateway/src/app.module.ts @@ -5,7 +5,7 @@ import { AppController } from './app.controller'; import { AppService } from './app.service'; import { AuthzMiddleware } from './authz/authz.middleware'; import { AuthzModule } from './authz/authz.module'; -import { ClientsModule } from '@nestjs/microservices'; +import { ClientsModule, Transport } from '@nestjs/microservices'; import { ConfigModule } from '@nestjs/config'; import { CredentialDefinitionModule } from './credential-definition/credential-definition.module'; import { FidoModule } from './fido/fido.module'; @@ -16,10 +16,11 @@ import { VerificationModule } from './verification/verification.module'; import { RevocationController } from './revocation/revocation.controller'; import { RevocationModule } from './revocation/revocation.module'; import { SchemaModule } from './schema/schema.module'; -import { commonNatsOptions } from 'libs/service/nats.options'; +// import { commonNatsOptions } from 'libs/service/nats.options'; import { UserModule } from './user/user.module'; import { ConnectionModule } from './connection/connection.module'; import { EcosystemModule } from './ecosystem/ecosystem.module'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -27,7 +28,8 @@ import { EcosystemModule } from './ecosystem/ecosystem.module'; ClientsModule.register([ { name: 'NATS_CLIENT', - ...commonNatsOptions('AGENT_SERVICE:REQUESTER') + transport: Transport.NATS, + options: getNatsOptions() } ]), AgentModule, diff --git a/apps/api-gateway/src/authz/authz.module.ts b/apps/api-gateway/src/authz/authz.module.ts index 6b757b456..f2cf6bda4 100644 --- a/apps/api-gateway/src/authz/authz.module.ts +++ b/apps/api-gateway/src/authz/authz.module.ts @@ -17,9 +17,7 @@ import { UserModule } from '../user/user.module'; import { UserService } from '../user/user.service'; import { VerificationService } from '../verification/verification.service'; import { EcosystemService } from '../ecosystem/ecosystem.service'; -// import { nkeyAuthenticator } from 'nats'; - -//import { WebhookService } from "../../../platform-service/src/webhook/webhook.service"; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -32,10 +30,7 @@ import { EcosystemService } from '../ecosystem/ecosystem.service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.API_GATEWAY_NKEY_SEED)), - } + options: getNatsOptions() }, CommonModule ]), diff --git a/apps/api-gateway/src/connection/connection.module.ts b/apps/api-gateway/src/connection/connection.module.ts index 43f6665c1..76b48aefd 100644 --- a/apps/api-gateway/src/connection/connection.module.ts +++ b/apps/api-gateway/src/connection/connection.module.ts @@ -1,4 +1,4 @@ -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; import { ConnectionController } from './connection.controller'; import { ConnectionService } from './connection.service'; import { Module } from '@nestjs/common'; @@ -11,10 +11,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.CONNECTION_NKEY_SEED)), - } + options: getNatsOptions() } ]) ], diff --git a/apps/api-gateway/src/credential-definition/credential-definition.module.ts b/apps/api-gateway/src/credential-definition/credential-definition.module.ts index 4e0f54a12..be384d2b3 100644 --- a/apps/api-gateway/src/credential-definition/credential-definition.module.ts +++ b/apps/api-gateway/src/credential-definition/credential-definition.module.ts @@ -3,7 +3,7 @@ import { Logger, Module } from '@nestjs/common'; import { CredentialDefinitionController } from './credential-definition.controller'; import { CredentialDefinitionService } from './credential-definition.service'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports:[ @@ -11,10 +11,7 @@ import { CredentialDefinitionService } from './credential-definition.service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - - } + options: getNatsOptions() } ]) ], diff --git a/apps/api-gateway/src/ecosystem/ecosystem.module.ts b/apps/api-gateway/src/ecosystem/ecosystem.module.ts index d3938775e..b35d3a323 100644 --- a/apps/api-gateway/src/ecosystem/ecosystem.module.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.module.ts @@ -6,7 +6,7 @@ import { HttpModule } from '@nestjs/axios'; import { Module } from '@nestjs/common'; import { EcosystemController } from './ecosystem.controller'; import { EcosystemService } from './ecosystem.service'; -import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -16,10 +16,7 @@ import { nkeyAuthenticator } from 'nats'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`], - authenticator: nkeyAuthenticator(new TextEncoder().encode('SUAG4DUOUYQLU2QKQUBCF74LV3CYHIHGNZVAGH4P3Q4NLBRVDZF6UZ6CNY')) - } + options: getNatsOptions() }, CommonModule ]) diff --git a/apps/api-gateway/src/fido/fido.module.ts b/apps/api-gateway/src/fido/fido.module.ts index 99c12c242..2c6500169 100644 --- a/apps/api-gateway/src/fido/fido.module.ts +++ b/apps/api-gateway/src/fido/fido.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { ClientsModule, Transport } from '@nestjs/microservices'; import { FidoController } from './fido.controller'; import { FidoService } from './fido.service'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports:[ @@ -10,10 +10,8 @@ import { FidoService } from './fido.service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - - } + options: getNatsOptions() + } ]) ], diff --git a/apps/api-gateway/src/issuance/issuance.module.ts b/apps/api-gateway/src/issuance/issuance.module.ts index ce62618b4..d68bf29d1 100644 --- a/apps/api-gateway/src/issuance/issuance.module.ts +++ b/apps/api-gateway/src/issuance/issuance.module.ts @@ -4,7 +4,7 @@ import { IssuanceController } from './issuance.controller'; import { IssuanceService } from './issuance.service'; import { CommonService } from '@credebl/common'; import { HttpModule } from '@nestjs/axios'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -13,10 +13,7 @@ import { HttpModule } from '@nestjs/axios'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.ISSUANCE_NKEY_SEED)), - } + options: getNatsOptions() } ]) ], diff --git a/apps/api-gateway/src/main.ts b/apps/api-gateway/src/main.ts index 828a21b51..4473a0af5 100644 --- a/apps/api-gateway/src/main.ts +++ b/apps/api-gateway/src/main.ts @@ -7,30 +7,23 @@ import { Logger, ValidationPipe } from '@nestjs/common'; import { AppModule } from './app.module'; import { HttpAdapterHost, NestFactory } from '@nestjs/core'; import { AllExceptionsFilter } from '@credebl/common/exception-handler'; - -// const fs = require('fs'); +import { MicroserviceOptions, Transport } from '@nestjs/microservices'; +import { getNatsOptions } from '@credebl/common/nats.config'; dotenv.config(); -// async function readSecretFile(filename: string): Promise { -// return fs.readFile(filename, 'utf8', function (err, data) { -// // Display the file content -// return data; -// }); -// } - async function bootstrap(): Promise { - // const httpsOptions = { - // key: await readSecretFile(''), - // cert: await readSecretFile(''), - // }; - - // const config = new ConfigService(); const app = await NestFactory.create(AppModule, { // httpsOptions, }); + + app.connectMicroservice({ + transport: Transport.NATS, + options: getNatsOptions() + }); + app.use(express.json({ limit: '50mb' })); app.use(express.urlencoded({ limit: '50mb' })); diff --git a/apps/api-gateway/src/organization/organization.module.ts b/apps/api-gateway/src/organization/organization.module.ts index df063767e..ead0ab6eb 100644 --- a/apps/api-gateway/src/organization/organization.module.ts +++ b/apps/api-gateway/src/organization/organization.module.ts @@ -6,7 +6,7 @@ import { HttpModule } from '@nestjs/axios'; import { Module } from '@nestjs/common'; import { OrganizationController } from './organization.controller'; import { OrganizationService } from './organization.service'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -16,10 +16,8 @@ import { OrganizationService } from './organization.service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.ORGANIZATION_NKEY_SEED)), - } + options: getNatsOptions() + }, CommonModule ]) diff --git a/apps/api-gateway/src/platform/platform.module.ts b/apps/api-gateway/src/platform/platform.module.ts index cafab062b..5d902d84e 100644 --- a/apps/api-gateway/src/platform/platform.module.ts +++ b/apps/api-gateway/src/platform/platform.module.ts @@ -3,7 +3,7 @@ import { PlatformController } from './platform.controller'; import { PlatformService } from './platform.service'; import { ClientsModule, Transport } from '@nestjs/microservices'; import { ConfigModule } from '@nestjs/config'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -12,10 +12,7 @@ import { ConfigModule } from '@nestjs/config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - - } + options: getNatsOptions() } ]) ], diff --git a/apps/api-gateway/src/schema/schema.module.ts b/apps/api-gateway/src/schema/schema.module.ts index 22635721c..29f2398cc 100644 --- a/apps/api-gateway/src/schema/schema.module.ts +++ b/apps/api-gateway/src/schema/schema.module.ts @@ -4,7 +4,7 @@ import { ConfigModule } from '@nestjs/config'; import { Module } from '@nestjs/common'; import { SchemaController } from './schema.controller'; import { SchemaService } from './schema.service'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -13,10 +13,8 @@ import { SchemaService } from './schema.service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.API_GATEWAY_NKEY_SEED)), - } + options: getNatsOptions() + } ]) ], diff --git a/apps/api-gateway/src/user/user.module.ts b/apps/api-gateway/src/user/user.module.ts index 3e5d01753..7e50be462 100644 --- a/apps/api-gateway/src/user/user.module.ts +++ b/apps/api-gateway/src/user/user.module.ts @@ -5,7 +5,7 @@ import { HttpModule } from '@nestjs/axios'; import { Module } from '@nestjs/common'; import { UserController } from './user.controller'; import { UserService } from './user.service'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -15,10 +15,8 @@ import { UserService } from './user.service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.USER_NKEY_SEED)), - } + options: getNatsOptions() + } ]) ], diff --git a/apps/api-gateway/src/verification/verification.module.ts b/apps/api-gateway/src/verification/verification.module.ts index 768ed72b6..7d9bb4613 100644 --- a/apps/api-gateway/src/verification/verification.module.ts +++ b/apps/api-gateway/src/verification/verification.module.ts @@ -4,7 +4,7 @@ import { ConfigModule } from '@nestjs/config'; import { Module } from '@nestjs/common'; import { VerificationController } from './verification.controller'; import { VerificationService } from './verification.service'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -13,10 +13,7 @@ import { VerificationService } from './verification.service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.VERIFICATION_NKEY_SEED)), - } + options: getNatsOptions() } ]) ], diff --git a/apps/connection/src/connection.module.ts b/apps/connection/src/connection.module.ts index d1b6d49e4..928769828 100644 --- a/apps/connection/src/connection.module.ts +++ b/apps/connection/src/connection.module.ts @@ -5,6 +5,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; import { CommonModule } from '@credebl/common'; import { ConnectionRepository } from './connection.repository'; import { PrismaService } from '@credebl/prisma-service'; +import { getNatsOptions } from '@credebl/common/nats.config'; // import { nkeyAuthenticator } from 'nats'; @Module({ @@ -13,10 +14,7 @@ import { PrismaService } from '@credebl/prisma-service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.CONNECTION_NKEY_SEED)), - } + options: getNatsOptions() } ]), diff --git a/apps/connection/src/main.ts b/apps/connection/src/main.ts index 345e7a0f9..c4f262c48 100644 --- a/apps/connection/src/main.ts +++ b/apps/connection/src/main.ts @@ -3,6 +3,7 @@ import { ConnectionModule } from './connection.module'; import { HttpExceptionFilter } from 'libs/http-exception.filter'; import { Logger } from '@nestjs/common'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; +import { getNatsOptions } from '@credebl/common/nats.config'; const logger = new Logger(); @@ -10,9 +11,7 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(ConnectionModule, { transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions() }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/ecosystem/src/ecosystem.module.ts b/apps/ecosystem/src/ecosystem.module.ts index 978d17a86..c9368612d 100644 --- a/apps/ecosystem/src/ecosystem.module.ts +++ b/apps/ecosystem/src/ecosystem.module.ts @@ -5,7 +5,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; import { CommonModule } from '@credebl/common'; import { EcosystemRepository } from './ecosystem.repository'; import { PrismaService } from '@credebl/prisma-service'; -import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -13,10 +13,7 @@ import { nkeyAuthenticator } from 'nats'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`], - authenticator: nkeyAuthenticator(new TextEncoder().encode('SUAG4DUOUYQLU2QKQUBCF74LV3CYHIHGNZVAGH4P3Q4NLBRVDZF6UZ6CNY')) - } + options: getNatsOptions() } ]), diff --git a/apps/ecosystem/src/main.ts b/apps/ecosystem/src/main.ts index 6bd3f0259..32c057c1f 100644 --- a/apps/ecosystem/src/main.ts +++ b/apps/ecosystem/src/main.ts @@ -3,6 +3,7 @@ import { EcosystemModule } from './ecosystem.module'; import { HttpExceptionFilter } from 'libs/http-exception.filter'; import { Logger } from '@nestjs/common'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; +import { getNatsOptions } from '@credebl/common/nats.config'; const logger = new Logger(); @@ -10,9 +11,7 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(EcosystemModule, { transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions() }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/issuance/src/issuance.module.ts b/apps/issuance/src/issuance.module.ts index b5f545dbf..a7fa41f17 100644 --- a/apps/issuance/src/issuance.module.ts +++ b/apps/issuance/src/issuance.module.ts @@ -6,7 +6,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; import { IssuanceController } from './issuance.controller'; import { IssuanceRepository } from './issuance.repository'; import { IssuanceService } from './issuance.service'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -15,10 +15,7 @@ import { IssuanceService } from './issuance.service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.ISSUANCE_NKEY_SEED)), - } + options: getNatsOptions() } ]), CommonModule diff --git a/apps/issuance/src/main.ts b/apps/issuance/src/main.ts index b08fcd872..fc67f58c4 100644 --- a/apps/issuance/src/main.ts +++ b/apps/issuance/src/main.ts @@ -3,6 +3,7 @@ import { HttpExceptionFilter } from 'libs/http-exception.filter'; import { Logger } from '@nestjs/common'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { IssuanceModule } from '../src/issuance.module'; +import { getNatsOptions } from '@credebl/common/nats.config'; const logger = new Logger(); @@ -10,9 +11,8 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(IssuanceModule, { transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions() + }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/ledger/src/ledger.module.ts b/apps/ledger/src/ledger.module.ts index 709d3ccd2..176dcba1b 100644 --- a/apps/ledger/src/ledger.module.ts +++ b/apps/ledger/src/ledger.module.ts @@ -6,7 +6,7 @@ import { PrismaService } from '@credebl/prisma-service'; import { CredentialDefinitionModule } from './credential-definition/credential-definition.module'; import { ClientsModule, Transport } from '@nestjs/microservices'; import { LedgerRepository } from './repositories/ledger.repository'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -14,10 +14,8 @@ import { LedgerRepository } from './repositories/ledger.repository'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.LEDGER_NKEY_SEED)), - } + options: getNatsOptions() + } ]), SchemaModule, CredentialDefinitionModule diff --git a/apps/ledger/src/main.ts b/apps/ledger/src/main.ts index c92cc071b..da13f7239 100644 --- a/apps/ledger/src/main.ts +++ b/apps/ledger/src/main.ts @@ -3,14 +3,14 @@ import { LedgerModule } from './ledger.module'; import { HttpExceptionFilter } from 'libs/http-exception.filter'; import { Logger } from '@nestjs/common'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; +import { getNatsOptions } from '@credebl/common/nats.config'; async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(LedgerModule, { transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions() + }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/organization/src/main.ts b/apps/organization/src/main.ts index a99f36f39..75a5de60e 100644 --- a/apps/organization/src/main.ts +++ b/apps/organization/src/main.ts @@ -3,6 +3,8 @@ import { Logger } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { OrganizationModule } from './organization.module'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; +// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; const logger = new Logger(); @@ -10,9 +12,8 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(OrganizationModule, { transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions() + }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/organization/src/organization.module.ts b/apps/organization/src/organization.module.ts index 8f05b495d..75219c023 100644 --- a/apps/organization/src/organization.module.ts +++ b/apps/organization/src/organization.module.ts @@ -13,7 +13,7 @@ import { UserActivityService } from '@credebl/user-activity'; import { UserOrgRolesRepository } from 'libs/user-org-roles/repositories'; import { UserOrgRolesService } from '@credebl/user-org-roles'; import { UserRepository } from 'apps/user/repositories/user.repository'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -21,10 +21,7 @@ import { UserRepository } from 'apps/user/repositories/user.repository'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.ORGANIZATION_NKEY_SEED)), - } + options: getNatsOptions() } ]), CommonModule diff --git a/apps/user/src/main.ts b/apps/user/src/main.ts index 09b218941..0080fa03a 100644 --- a/apps/user/src/main.ts +++ b/apps/user/src/main.ts @@ -3,15 +3,14 @@ import { Logger } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { UserModule } from './user.module'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; +import { getNatsOptions } from '@credebl/common/nats.config'; const logger = new Logger(); async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(UserModule, { transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions() }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/user/src/user.module.ts b/apps/user/src/user.module.ts index bf65c8a43..847f167ff 100644 --- a/apps/user/src/user.module.ts +++ b/apps/user/src/user.module.ts @@ -17,7 +17,7 @@ import { UserOrgRolesService } from '@credebl/user-org-roles'; import { UserRepository } from '../repositories/user.repository'; import { UserService } from './user.service'; import { UserDevicesRepository } from '../repositories/user-device.repository'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -25,10 +25,7 @@ import { UserDevicesRepository } from '../repositories/user-device.repository'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.USER_NKEY_SEED)), - } + options: getNatsOptions() } ]), CommonModule, diff --git a/apps/verification/src/main.ts b/apps/verification/src/main.ts index e3b1a968a..284108239 100644 --- a/apps/verification/src/main.ts +++ b/apps/verification/src/main.ts @@ -3,6 +3,7 @@ import { HttpExceptionFilter } from 'libs/http-exception.filter'; import { Logger } from '@nestjs/common'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { VerificationModule } from './verification.module'; +import { getNatsOptions } from '@credebl/common/nats.config'; const logger = new Logger(); @@ -10,9 +11,8 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(VerificationModule, { transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions() + }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/verification/src/verification.module.ts b/apps/verification/src/verification.module.ts index 55083954b..168c44cee 100644 --- a/apps/verification/src/verification.module.ts +++ b/apps/verification/src/verification.module.ts @@ -5,7 +5,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; import { CommonModule } from '@credebl/common'; import { VerificationRepository } from './repositories/verification.repository'; import { PrismaService } from '@credebl/prisma-service'; -// import { nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ @@ -13,10 +13,8 @@ import { PrismaService } from '@credebl/prisma-service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.VERIFICATION_NKEY_SEED)), - } + options: getNatsOptions() + } ]), diff --git a/libs/common/src/nats.config.ts b/libs/common/src/nats.config.ts new file mode 100644 index 000000000..1c9411e46 --- /dev/null +++ b/libs/common/src/nats.config.ts @@ -0,0 +1,9 @@ +import { Authenticator, nkeyAuthenticator } from 'nats'; + +export const getNatsOptions = (): { + servers: string[]; + authenticator: Authenticator; + } => ({ + servers: [`${process.env.NATS_URL}`], + authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.NKEY_SEED)) + }); \ No newline at end of file diff --git a/nats-server.conf b/nats-server.conf index f4d3b537c..92cfd20bc 100644 --- a/nats-server.conf +++ b/nats-server.conf @@ -1,10 +1,6 @@ authorization: { users: [ - { nkey:UDHTNJ3F7X6YMPW2UGAIGUWAEZCI3CICCPTSTJ6WZ3WTFGME5I7ZBHXP, - permissions = { - publish = ["*"] # Define the permissions for publishing - subscribe = ["*"] # Define the permissions for subscribing - } + { nkey:UAMX54EI4CIOEZPLVOUGS6A6I6STWJZJRHDJGDOIA3JB4IV4ZEAGYLAV, } ] From 8d9fb52f0a42d200ff849204cb6ab04778557119 Mon Sep 17 00:00:00 2001 From: pallavicoder Date: Wed, 8 Nov 2023 18:02:33 +0530 Subject: [PATCH 03/51] Feat:NATS-Security setup authenticating with Nkeys Signed-off-by: pallavicoder --- .../src/agent-provisioning.module.ts | 8 +++--- apps/agent-provisioning/src/main.ts | 6 ++--- .../agent-service/src/agent-service.module.ts | 2 +- apps/agent-service/src/main.ts | 2 +- .../src/agent-service/agent-service.module.ts | 2 +- apps/api-gateway/src/app.module.ts | 2 +- apps/api-gateway/src/authz/authz.module.ts | 2 +- .../src/connection/connection.module.ts | 2 +- .../credential-definition.module.ts | 2 +- .../src/ecosystem/ecosystem.module.ts | 2 +- apps/api-gateway/src/fido/fido.module.ts | 2 +- .../src/issuance/issuance.module.ts | 2 +- apps/api-gateway/src/main.ts | 2 +- .../src/organization/organization.module.ts | 2 +- .../src/platform/platform.module.ts | 2 +- apps/api-gateway/src/schema/schema.module.ts | 2 +- apps/api-gateway/src/user/user.module.ts | 2 +- .../src/verification/verification.module.ts | 2 +- apps/connection/src/connection.module.ts | 2 +- apps/ecosystem/src/ecosystem.module.ts | 2 +- apps/ecosystem/src/main.ts | 2 +- apps/issuance/src/issuance.module.ts | 2 +- apps/issuance/src/main.ts | 2 +- apps/ledger/src/ledger.module.ts | 2 +- apps/ledger/src/main.ts | 2 +- apps/organization/src/main.ts | 2 +- apps/organization/src/organization.module.ts | 2 +- apps/user/src/main.ts | 2 +- apps/user/src/user.controller.ts | 2 +- apps/user/src/user.module.ts | 2 +- apps/verification/src/main.ts | 2 +- apps/verification/src/verification.module.ts | 2 +- libs/common/src/nats.config.ts | 26 ++++++++++++++----- nats-server.conf | 15 ++++++++--- 34 files changed, 65 insertions(+), 50 deletions(-) diff --git a/apps/agent-provisioning/src/agent-provisioning.module.ts b/apps/agent-provisioning/src/agent-provisioning.module.ts index 7e7a58b0b..ba467e06d 100644 --- a/apps/agent-provisioning/src/agent-provisioning.module.ts +++ b/apps/agent-provisioning/src/agent-provisioning.module.ts @@ -3,7 +3,7 @@ import { AgentProvisioningController } from './agent-provisioning.controller'; import { AgentProvisioningService } from './agent-provisioning.service'; import { ClientsModule, Transport } from '@nestjs/microservices'; import { ConfigModule } from '@nestjs/config'; -// import { Authenticator, nkeyAuthenticator } from 'nats'; +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ ConfigModule.forRoot(), @@ -11,10 +11,8 @@ import { ConfigModule } from '@nestjs/config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - // authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.AGENT_PROVISIONING_NKEY_SEED)), - } + options: getNatsOptions(process.env.AGENT_PROVISIONING_NKEY_SEED) + } ]) ], diff --git a/apps/agent-provisioning/src/main.ts b/apps/agent-provisioning/src/main.ts index 1b93c0175..f0c623640 100644 --- a/apps/agent-provisioning/src/main.ts +++ b/apps/agent-provisioning/src/main.ts @@ -3,16 +3,14 @@ import { HttpExceptionFilter } from 'libs/http-exception.filter'; import { Logger } from '@nestjs/common'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { AgentProvisioningModule } from './agent-provisioning.module'; - +import { getNatsOptions } from '@credebl/common/nats.config'; const logger = new Logger(); async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(AgentProvisioningModule, { transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions(process.env.AGENT_PROVISIONING_NKEY_SEED) }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/agent-service/src/agent-service.module.ts b/apps/agent-service/src/agent-service.module.ts index 49a44e888..56c20192c 100644 --- a/apps/agent-service/src/agent-service.module.ts +++ b/apps/agent-service/src/agent-service.module.ts @@ -17,7 +17,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.AGENT_SERVICE_NKEY_SEED) } ]), CommonModule diff --git a/apps/agent-service/src/main.ts b/apps/agent-service/src/main.ts index 4033a2099..6bdc7c59f 100644 --- a/apps/agent-service/src/main.ts +++ b/apps/agent-service/src/main.ts @@ -13,7 +13,7 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(AgentServiceModule, { transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.AGENT_SERVICE_NKEY_SEED) }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/api-gateway/src/agent-service/agent-service.module.ts b/apps/api-gateway/src/agent-service/agent-service.module.ts index 2bbb3e232..0c3484cc7 100644 --- a/apps/api-gateway/src/agent-service/agent-service.module.ts +++ b/apps/api-gateway/src/agent-service/agent-service.module.ts @@ -16,7 +16,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) }, CommonModule diff --git a/apps/api-gateway/src/app.module.ts b/apps/api-gateway/src/app.module.ts index 9f389e565..389dc8442 100644 --- a/apps/api-gateway/src/app.module.ts +++ b/apps/api-gateway/src/app.module.ts @@ -30,7 +30,7 @@ import { BullModule } from '@nestjs/bull'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) } ]), AgentModule, diff --git a/apps/api-gateway/src/authz/authz.module.ts b/apps/api-gateway/src/authz/authz.module.ts index f2cf6bda4..13ebeb461 100644 --- a/apps/api-gateway/src/authz/authz.module.ts +++ b/apps/api-gateway/src/authz/authz.module.ts @@ -30,7 +30,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) }, CommonModule ]), diff --git a/apps/api-gateway/src/connection/connection.module.ts b/apps/api-gateway/src/connection/connection.module.ts index 76b48aefd..bc2b5be51 100644 --- a/apps/api-gateway/src/connection/connection.module.ts +++ b/apps/api-gateway/src/connection/connection.module.ts @@ -11,7 +11,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) } ]) ], diff --git a/apps/api-gateway/src/credential-definition/credential-definition.module.ts b/apps/api-gateway/src/credential-definition/credential-definition.module.ts index be384d2b3..f7c2ac8a3 100644 --- a/apps/api-gateway/src/credential-definition/credential-definition.module.ts +++ b/apps/api-gateway/src/credential-definition/credential-definition.module.ts @@ -11,7 +11,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) } ]) ], diff --git a/apps/api-gateway/src/ecosystem/ecosystem.module.ts b/apps/api-gateway/src/ecosystem/ecosystem.module.ts index b35d3a323..91146eb15 100644 --- a/apps/api-gateway/src/ecosystem/ecosystem.module.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.module.ts @@ -16,7 +16,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) }, CommonModule ]) diff --git a/apps/api-gateway/src/fido/fido.module.ts b/apps/api-gateway/src/fido/fido.module.ts index 2c6500169..e6bd502f9 100644 --- a/apps/api-gateway/src/fido/fido.module.ts +++ b/apps/api-gateway/src/fido/fido.module.ts @@ -10,7 +10,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) } ]) diff --git a/apps/api-gateway/src/issuance/issuance.module.ts b/apps/api-gateway/src/issuance/issuance.module.ts index dc78e6163..1d2629105 100644 --- a/apps/api-gateway/src/issuance/issuance.module.ts +++ b/apps/api-gateway/src/issuance/issuance.module.ts @@ -14,7 +14,7 @@ import { ImageServiceService } from '@credebl/image-service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) } ]) ], diff --git a/apps/api-gateway/src/main.ts b/apps/api-gateway/src/main.ts index 937fa9206..595f0f586 100644 --- a/apps/api-gateway/src/main.ts +++ b/apps/api-gateway/src/main.ts @@ -21,7 +21,7 @@ async function bootstrap(): Promise { app.connectMicroservice({ transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) }); const expressApp = app.getHttpAdapter().getInstance(); diff --git a/apps/api-gateway/src/organization/organization.module.ts b/apps/api-gateway/src/organization/organization.module.ts index 15d97d2cc..a76b0d726 100644 --- a/apps/api-gateway/src/organization/organization.module.ts +++ b/apps/api-gateway/src/organization/organization.module.ts @@ -17,7 +17,7 @@ import { ImageServiceService } from '@credebl/image-service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) }, CommonModule diff --git a/apps/api-gateway/src/platform/platform.module.ts b/apps/api-gateway/src/platform/platform.module.ts index 5d902d84e..817f7db0a 100644 --- a/apps/api-gateway/src/platform/platform.module.ts +++ b/apps/api-gateway/src/platform/platform.module.ts @@ -12,7 +12,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) } ]) ], diff --git a/apps/api-gateway/src/schema/schema.module.ts b/apps/api-gateway/src/schema/schema.module.ts index 29f2398cc..b584a1c26 100644 --- a/apps/api-gateway/src/schema/schema.module.ts +++ b/apps/api-gateway/src/schema/schema.module.ts @@ -13,7 +13,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) } ]) diff --git a/apps/api-gateway/src/user/user.module.ts b/apps/api-gateway/src/user/user.module.ts index 7e50be462..8df176a23 100644 --- a/apps/api-gateway/src/user/user.module.ts +++ b/apps/api-gateway/src/user/user.module.ts @@ -15,7 +15,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) } ]) diff --git a/apps/api-gateway/src/verification/verification.module.ts b/apps/api-gateway/src/verification/verification.module.ts index 2f9241229..cf6097cf0 100644 --- a/apps/api-gateway/src/verification/verification.module.ts +++ b/apps/api-gateway/src/verification/verification.module.ts @@ -14,7 +14,7 @@ import { ImageServiceService } from '@credebl/image-service'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) } ]) ], diff --git a/apps/connection/src/connection.module.ts b/apps/connection/src/connection.module.ts index 928769828..076be8311 100644 --- a/apps/connection/src/connection.module.ts +++ b/apps/connection/src/connection.module.ts @@ -14,7 +14,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.CONNECTION_NKEY_SEED) } ]), diff --git a/apps/ecosystem/src/ecosystem.module.ts b/apps/ecosystem/src/ecosystem.module.ts index c9368612d..74ee61499 100644 --- a/apps/ecosystem/src/ecosystem.module.ts +++ b/apps/ecosystem/src/ecosystem.module.ts @@ -13,7 +13,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.ECOSYSTEM_NKEY_SEED) } ]), diff --git a/apps/ecosystem/src/main.ts b/apps/ecosystem/src/main.ts index 32c057c1f..47a5e9775 100644 --- a/apps/ecosystem/src/main.ts +++ b/apps/ecosystem/src/main.ts @@ -11,7 +11,7 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(EcosystemModule, { transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.ECOSYSTEM_NKEY_SEED) }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/issuance/src/issuance.module.ts b/apps/issuance/src/issuance.module.ts index ab2824eb4..78af7f468 100644 --- a/apps/issuance/src/issuance.module.ts +++ b/apps/issuance/src/issuance.module.ts @@ -21,7 +21,7 @@ import { BulkIssuanceProcessor } from './issuance.processor'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.ISSUANCE_NKEY_SEED) } ]), CommonModule, diff --git a/apps/issuance/src/main.ts b/apps/issuance/src/main.ts index fc67f58c4..d48f23f02 100644 --- a/apps/issuance/src/main.ts +++ b/apps/issuance/src/main.ts @@ -11,7 +11,7 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(IssuanceModule, { transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.ISSUANCE_NKEY_SEED) }); diff --git a/apps/ledger/src/ledger.module.ts b/apps/ledger/src/ledger.module.ts index 176dcba1b..14e7abb9f 100644 --- a/apps/ledger/src/ledger.module.ts +++ b/apps/ledger/src/ledger.module.ts @@ -14,7 +14,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.LEDGER_NKEY_SEED) } ]), diff --git a/apps/ledger/src/main.ts b/apps/ledger/src/main.ts index da13f7239..00d5623f1 100644 --- a/apps/ledger/src/main.ts +++ b/apps/ledger/src/main.ts @@ -9,7 +9,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(LedgerModule, { transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.LEDGER_NKEY_SEED) }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/organization/src/main.ts b/apps/organization/src/main.ts index 75a5de60e..c23f7e9f1 100644 --- a/apps/organization/src/main.ts +++ b/apps/organization/src/main.ts @@ -12,7 +12,7 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(OrganizationModule, { transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.ORGANIZATION_NKEY_SEED) }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/organization/src/organization.module.ts b/apps/organization/src/organization.module.ts index 75219c023..62eb05f7a 100644 --- a/apps/organization/src/organization.module.ts +++ b/apps/organization/src/organization.module.ts @@ -21,7 +21,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.ORGANIZATION_NKEY_SEED) } ]), CommonModule diff --git a/apps/user/src/main.ts b/apps/user/src/main.ts index 0080fa03a..4acd6ddeb 100644 --- a/apps/user/src/main.ts +++ b/apps/user/src/main.ts @@ -10,7 +10,7 @@ const logger = new Logger(); async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(UserModule, { transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.USER_NKEY_SEED) }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/apps/user/src/user.controller.ts b/apps/user/src/user.controller.ts index 5d3c3b3bb..de80b0ce0 100644 --- a/apps/user/src/user.controller.ts +++ b/apps/user/src/user.controller.ts @@ -33,7 +33,7 @@ export class UserController { @MessagePattern({ cmd: 'user-holder-login' }) async login(payload: LoginUserDto): Promise { - return this.userService.login(payload); + return this.userService.login(payload); } @MessagePattern({ cmd: 'get-user-profile' }) diff --git a/apps/user/src/user.module.ts b/apps/user/src/user.module.ts index 847f167ff..ff17ff34b 100644 --- a/apps/user/src/user.module.ts +++ b/apps/user/src/user.module.ts @@ -25,7 +25,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.USER_NKEY_SEED) } ]), CommonModule, diff --git a/apps/verification/src/main.ts b/apps/verification/src/main.ts index 284108239..7c0bcf689 100644 --- a/apps/verification/src/main.ts +++ b/apps/verification/src/main.ts @@ -11,7 +11,7 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(VerificationModule, { transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.VERIFICATION_NKEY_SEED) }); diff --git a/apps/verification/src/verification.module.ts b/apps/verification/src/verification.module.ts index 5343f1b41..9c65becb2 100644 --- a/apps/verification/src/verification.module.ts +++ b/apps/verification/src/verification.module.ts @@ -15,7 +15,7 @@ import { EmailDto } from '@credebl/common/dtos/email.dto'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.VERIFICATION_NKEY_SEED) } ]), diff --git a/libs/common/src/nats.config.ts b/libs/common/src/nats.config.ts index 1c9411e46..a5feb9b60 100644 --- a/libs/common/src/nats.config.ts +++ b/libs/common/src/nats.config.ts @@ -1,9 +1,21 @@ import { Authenticator, nkeyAuthenticator } from 'nats'; -export const getNatsOptions = (): { - servers: string[]; - authenticator: Authenticator; - } => ({ - servers: [`${process.env.NATS_URL}`], - authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.NKEY_SEED)) - }); \ No newline at end of file +// export const getNatsOptions = (): { +// servers: string[]; +// authenticator: Authenticator; +// } => ({ +// servers: [`${process.env.NATS_URL}`], +// authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.NKEY_SEED)) +// }); + +export const getNatsOptions = ( + nkeySeed?: string +): { + servers: string[]; + authenticator?: Authenticator; +} => nkeySeed +? { + servers: [`${process.env.NATS_URL}`], + authenticator: nkeyAuthenticator(new TextEncoder().encode(nkeySeed)) + } + : { servers: [`${process.env.NATS_URL}`] }; diff --git a/nats-server.conf b/nats-server.conf index 92cfd20bc..070eb2b42 100644 --- a/nats-server.conf +++ b/nats-server.conf @@ -1,7 +1,14 @@ authorization: { users: [ - { nkey:UAMX54EI4CIOEZPLVOUGS6A6I6STWJZJRHDJGDOIA3JB4IV4ZEAGYLAV, - - } - ] + { nkey:UBAYKP4KNT6J4UNGFWVA2KHPFGNCYR6IM7DKWRF6UWII3MISWNIYCHZ2}, + { nkey:UDOTYZPSAZJH6XMHKK73EBVYB4WZEHTYIDZ2NZF6JIDLF4HV7DEZRZMH}, + { nkey:UBQQ4X4ONWH7IPA6TXHE35UNSLET6UUO7KKBQNXIMX7UUHPCUDEP3LVA}, + { nkey:UCDRQLYNAHZ2CJJXZBCV77PATO77J7ZES2DXDXGMYCVV7XWB3SPN3AEG}, + { nkey:UBCCECTBSHHBDV7HZBDRLPQ7JT2O3PRHAHOPDFOOXJ5B32ZZHVHQSNCS}, + { nkey:UDP4CJJIQPOL7ZYT75PAK342X434T3S5AAX5I6LMDUGJ3LZZDYEPRPAW}, + { nkey:UBHU4FCZASGVXSDNZPIJ2TTZAQF4BRQHPLA6JX7ORDAJBFMYIWK3JAEL}, + { nkey:UC4JCPW22M55DZA3OE6Z6ARCR2N3QTLLU5T7SF2IP2DKIA4WC46NFV4J}, + { nkey:UCR5JAVOBQBFVBC4KNEGLAA62VPN3QL27AKWDDPOBXOFYD6X73Y5356Q}, + { nkey:UDKMURT2SRCPAO3NFK4QVCCQH5HGIC3FUWLUAEQENJ2ONV6MQ2HUGLZM} + ] } \ No newline at end of file From 82c306e2586ec41ecfc286de627d82bc1349ebfe Mon Sep 17 00:00:00 2001 From: Nishad Date: Wed, 29 Nov 2023 11:41:18 +0530 Subject: [PATCH 04/51] worked on the ecosystem organization model mapping Signed-off-by: Nishad --- .../dtos/accept-reject-invitations.dto.ts | 16 +----- .../ecosystem/dtos/create-ecosystem-dto.ts | 16 +----- .../src/ecosystem/ecosystem.controller.ts | 4 +- .../accept-reject-ecosysteminvitation.dto.ts | 4 +- .../dtos/update-ecosystemOrgs.dto.ts | 2 - .../interfaces/ecosystem.interfaces.ts | 30 +++++++++++ apps/ecosystem/src/ecosystem.repository.ts | 36 +++++++++---- apps/ecosystem/src/ecosystem.service.ts | 54 ++++++++++++++++--- libs/common/src/response-messages/index.ts | 4 +- .../migration.sql | 16 ++++++ libs/prisma-service/prisma/schema.prisma | 6 +-- libs/prisma-service/prisma/seed.ts | 8 +-- 12 files changed, 134 insertions(+), 62 deletions(-) create mode 100644 libs/prisma-service/prisma/migrations/20231127132350_map_ecosystem_orgs/migration.sql diff --git a/apps/api-gateway/src/ecosystem/dtos/accept-reject-invitations.dto.ts b/apps/api-gateway/src/ecosystem/dtos/accept-reject-invitations.dto.ts index 57fa80731..429ddfba2 100644 --- a/apps/api-gateway/src/ecosystem/dtos/accept-reject-invitations.dto.ts +++ b/apps/api-gateway/src/ecosystem/dtos/accept-reject-invitations.dto.ts @@ -1,4 +1,4 @@ -import { IsEnum, IsNotEmpty, IsString, MaxLength, MinLength} from 'class-validator'; +import { IsEnum, IsNotEmpty} from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { Invitation } from '@credebl/enum/enum'; @@ -11,20 +11,6 @@ export class AcceptRejectEcosystemInvitationDto { invitationId: string; orgId: string; - @ApiProperty() - @Transform(({ value }) => trim(value)) - @IsNotEmpty({ message: 'organization name is required.' }) - @MinLength(2, { message: 'organization name must be at least 2 characters.' }) - @MaxLength(50, { message: 'organization name must be at most 50 characters.' }) - @IsString({ message: 'organization name must be in string format.' }) - orgName: string; - - @ApiProperty() - @Transform(({ value }) => trim(value)) - @IsNotEmpty({ message: 'organization did is required.' }) - @IsString({ message: 'organization did must be in string format.' }) - orgDid: string; - @ApiProperty({ enum: [Invitation.ACCEPTED, Invitation.REJECTED] }) diff --git a/apps/api-gateway/src/ecosystem/dtos/create-ecosystem-dto.ts b/apps/api-gateway/src/ecosystem/dtos/create-ecosystem-dto.ts index 1d57ee8b0..6c8d5d9a0 100644 --- a/apps/api-gateway/src/ecosystem/dtos/create-ecosystem-dto.ts +++ b/apps/api-gateway/src/ecosystem/dtos/create-ecosystem-dto.ts @@ -1,5 +1,5 @@ import { ApiExtraModels, ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { IsBoolean, IsInt, IsNotEmpty, IsOptional, IsString, MaxLength, MinLength } from 'class-validator'; +import { IsBoolean, IsNotEmpty, IsOptional, IsString, MaxLength, MinLength } from 'class-validator'; import { Transform } from 'class-transformer'; import { trim } from '@credebl/common/cast.helper'; @@ -39,20 +39,6 @@ export class CreateEcosystemDto { @IsString({ message: 'logo must be in string format.' }) logo?: string; - @ApiProperty() - @Transform(({ value }) => trim(value)) - @IsNotEmpty({ message: 'organization name is required.' }) - @MinLength(2, { message: 'organization name must be at least 2 characters.' }) - @MaxLength(50, { message: 'organization name must be at most 50 characters.' }) - @IsString({ message: 'organization name must be in string format.' }) - orgName: string; - - @ApiProperty() - @Transform(({ value }) => trim(value)) - @IsNotEmpty({ message: 'organization did is required.' }) - @IsString({ message: 'organization did must be in string format.' }) - orgDid: string; - @ApiPropertyOptional({ example: 'false' }) @IsBoolean() @IsOptional() diff --git a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts index 6cb7d6219..9a8a6715b 100644 --- a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts @@ -122,7 +122,7 @@ export class EcosystemController { @ApiOperation({ summary: 'Get all organization ecosystems', description: 'Get all existing ecosystems of an specific organization' }) @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) @UseGuards(AuthGuard('jwt'), OrgRolesGuard) - @Roles(OrgRoles.OWNER, OrgRoles.ADMIN) + @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER) @ApiBearerAuth() async getEcosystem( @Param('orgId') orgId: string, @@ -141,7 +141,7 @@ export class EcosystemController { @ApiOperation({ summary: 'Get ecosystem dashboard details', description: 'Get ecosystem dashboard details' }) @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) @UseGuards(AuthGuard('jwt'), OrgRolesGuard, EcosystemRolesGuard) - @Roles(OrgRoles.OWNER, OrgRoles.ADMIN) + @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER) @EcosystemsRoles(EcosystemRoles.ECOSYSTEM_OWNER, EcosystemRoles.ECOSYSTEM_LEAD, EcosystemRoles.ECOSYSTEM_MEMBER) @ApiBearerAuth() async getEcosystemDashboardDetails(@Param('ecosystemId') ecosystemId: string, @Param('orgId') orgId: string, @Res() res: Response): Promise { diff --git a/apps/ecosystem/dtos/accept-reject-ecosysteminvitation.dto.ts b/apps/ecosystem/dtos/accept-reject-ecosysteminvitation.dto.ts index cf885b6cb..1bc76de4f 100644 --- a/apps/ecosystem/dtos/accept-reject-ecosysteminvitation.dto.ts +++ b/apps/ecosystem/dtos/accept-reject-ecosysteminvitation.dto.ts @@ -4,7 +4,7 @@ export class AcceptRejectEcosystemInvitationDto { orgId: string; invitationId: string; status: Invitation; - orgName: string; - orgDid: string; + orgName?: string; + orgDid?: string; userId?: string; } diff --git a/apps/ecosystem/dtos/update-ecosystemOrgs.dto.ts b/apps/ecosystem/dtos/update-ecosystemOrgs.dto.ts index d8e1dd41e..c1d431a77 100644 --- a/apps/ecosystem/dtos/update-ecosystemOrgs.dto.ts +++ b/apps/ecosystem/dtos/update-ecosystemOrgs.dto.ts @@ -1,7 +1,5 @@ export class updateEcosystemOrgsDto { orgId: string; - orgName: string; - orgDid: string; status: string; ecosystemId: string; ecosystemRoleId: string; diff --git a/apps/ecosystem/interfaces/ecosystem.interfaces.ts b/apps/ecosystem/interfaces/ecosystem.interfaces.ts index e90e623f5..bb3e8b94f 100644 --- a/apps/ecosystem/interfaces/ecosystem.interfaces.ts +++ b/apps/ecosystem/interfaces/ecosystem.interfaces.ts @@ -195,4 +195,34 @@ export interface CreateEcosystem { orgId?: string; autoEndorsement: boolean +} + +export interface OrganizationData { + id: string; + createDateTime: string; + createdBy: string; + lastChangedDateTime: string; + lastChangedBy: string; + name: string; + description: string; + orgSlug: string; + logoUrl: string; + website: string; + publicProfile: boolean; + org_agents: OrgAgent[]; +} + +export interface OrgAgent { + id: string; + orgDid: string; + verkey: string; + agentEndPoint: string; + isDidPublic: boolean; + agentSpinUpStatus: number; + walletName: string; + tenantId: string; + agentsTypeId: string; + orgId: string; + orgAgentTypeId: string; + ledgerId: string; } \ No newline at end of file diff --git a/apps/ecosystem/src/ecosystem.repository.ts b/apps/ecosystem/src/ecosystem.repository.ts index 4dae01570..4f3a08866 100644 --- a/apps/ecosystem/src/ecosystem.repository.ts +++ b/apps/ecosystem/src/ecosystem.repository.ts @@ -28,7 +28,7 @@ export class EcosystemRepository { async createNewEcosystem(createEcosystemDto): Promise { try { const transaction = await this.prisma.$transaction(async (prisma) => { - const { name, description, userId, logo, tags, orgId, orgName, orgDid, autoEndorsement } = createEcosystemDto; + const { name, description, userId, logo, tags, orgId, autoEndorsement } = createEcosystemDto; const createdEcosystem = await prisma.ecosystem.create({ data: { name, @@ -64,8 +64,6 @@ export class EcosystemRepository { status: EcosystemOrgStatus.ACTIVE, ecosystemId: createdEcosystem.id, ecosystemRoleId: ecosystemRoleDetails.id, - orgName, - orgDid, deploymentMode: DeploymentModeType.PROVIDER_HOSTED, createdBy: userId, lastChangedBy: userId @@ -367,7 +365,7 @@ export class EcosystemRepository { // eslint-disable-next-line camelcase async updateEcosystemOrgs(createEcosystemOrgsDto: updateEcosystemOrgsDto): Promise { try { - const { orgId, status, ecosystemRoleId, ecosystemId, orgName, orgDid, createdBy, lastChangedBy } = createEcosystemOrgsDto; + const { orgId, status, ecosystemRoleId, ecosystemId, createdBy, lastChangedBy } = createEcosystemOrgsDto; return this.prisma.ecosystem_orgs.create({ data: { @@ -375,8 +373,6 @@ export class EcosystemRepository { ecosystemId, status, ecosystemRoleId, - orgName, - orgDid, deploymentMode: DeploymentModeType.PROVIDER_HOSTED, createdBy, lastChangedBy @@ -449,10 +445,10 @@ export class EcosystemRepository { try { const query = { ecosystemId, - OR: - [{ orgId: { contains: search, mode: 'insensitive' } }] + OR: [{ organisation: { name: { contains: search, mode: 'insensitive' } } }] }; return await this.getEcosystemMembersPagination(query, pageNumber, pageSize); + } catch (error) { this.logger.error(`error: ${JSON.stringify(error)}`); throw new InternalServerErrorException(error); @@ -468,7 +464,16 @@ export class EcosystemRepository { }, include: { ecosystem: true, - ecosystemRole: true + ecosystemRole: true, + organisation: { + select:{ + name: true, + orgSlug: true, + // eslint-disable-next-line camelcase + org_agents: true + + } + } }, take: pageSize, skip: (pageNumber - 1) * pageSize, @@ -545,7 +550,7 @@ export class EcosystemRepository { select: { ecosystem: true, ecosystemRole: true, - orgName: true + organisation: true } }); @@ -565,7 +570,16 @@ export class EcosystemRepository { authorDid: true, status: true, type: true, - ecosystemOrgs: true, + ecosystemOrgs: { + include:{ + organisation: { + select:{ + name: true, + orgSlug: true + } + } + } + }, requestPayload: true, responsePayload: true, createDateTime: true, diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 16fb17585..5e213796f 100644 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -14,7 +14,7 @@ import { EcosystemConfigSettings, Invitation, OrgAgentType } from '@credebl/enum import { EcosystemOrgStatus, EcosystemRoles, endorsementTransactionStatus, endorsementTransactionType } from '../enums/ecosystem.enum'; import { FetchInvitationsPayload } from '../interfaces/invitations.interface'; import { EcosystemMembersPayload } from '../interfaces/ecosystemMembers.interface'; -import { CreateEcosystem, CredDefMessage, RequestCredDeffEndorsement, RequestSchemaEndorsement, SaveSchema, SchemaMessage, SignedTransactionMessage, saveCredDef, submitTransactionPayload } from '../interfaces/ecosystem.interfaces'; +import { CreateEcosystem, CredDefMessage, OrganizationData, RequestCredDeffEndorsement, RequestSchemaEndorsement, SaveSchema, SchemaMessage, SignedTransactionMessage, saveCredDef, submitTransactionPayload } from '../interfaces/ecosystem.interfaces'; import { GetAllSchemaList, GetEndorsementsPayload } from '../interfaces/endorsements.interface'; import { CommonConstants } from '@credebl/common/common.constant'; // eslint-disable-next-line camelcase @@ -58,6 +58,17 @@ export class EcosystemService { } } } + + const orgDetails: OrganizationData = await this.getOrganizationDetails(createEcosystemDto.orgId, createEcosystemDto.userId); + + if (!orgDetails) { + throw new NotFoundException(ResponseMessages.ecosystem.error.orgNotExist); + } + + if (0 === orgDetails.org_agents.length) { + throw new NotFoundException(ResponseMessages.ecosystem.error.orgDidNotExist); + } + const createEcosystem = await this.ecosystemRepository.createNewEcosystem(createEcosystemDto); if (!createEcosystem) { throw new NotFoundException(ResponseMessages.ecosystem.error.notCreated); @@ -65,6 +76,27 @@ export class EcosystemService { return createEcosystem; } + async getOrganizationDetails(orgId: string, userId: string): Promise { + const pattern = { cmd: 'get-organization-by-id' }; + const payload = { orgId, userId }; + + const orgData = await this.ecosystemServiceProxy + .send(pattern, payload) + .toPromise() + .catch((error) => { + this.logger.error(`catch: ${JSON.stringify(error)}`); + throw new HttpException( + { + status: error.status, + error: error.message + }, + error.status + ); + }); + + return orgData; + } + /** * @@ -123,7 +155,7 @@ export class EcosystemService { endorsementsCount: endorseMemberCount.endorsementsCount, ecosystemLead: { role: ecosystemDetails['ecosystemRole']['name'], - orgName: ecosystemDetails['orgName'], + orgName: ecosystemDetails['organisation']['name'], config: endorseMemberCount.ecosystemConfigData } }; @@ -214,13 +246,23 @@ export class EcosystemService { }; } - const { orgId, status, invitationId, orgName, orgDid, userId } = acceptRejectInvitation; + const { orgId, status, invitationId, userId } = acceptRejectInvitation; const invitation = await this.ecosystemRepository.getEcosystemInvitationById(invitationId); if (!invitation) { throw new NotFoundException(ResponseMessages.ecosystem.error.invitationNotFound); } + const orgDetails: OrganizationData = await this.getOrganizationDetails(acceptRejectInvitation.orgId, acceptRejectInvitation.userId); + + if (!orgDetails) { + throw new NotFoundException(ResponseMessages.ecosystem.error.orgNotExist); + } + + if (0 === orgDetails.org_agents.length) { + throw new NotFoundException(ResponseMessages.ecosystem.error.orgDidNotExist); + } + const updatedInvitation = await this.updateEcosystemInvitation(invitationId, orgId, status); if (!updatedInvitation) { throw new NotFoundException(ResponseMessages.ecosystem.error.invitationNotUpdate); @@ -231,7 +273,7 @@ export class EcosystemService { } const ecosystemRole = await this.ecosystemRepository.getEcosystemRole(EcosystemRoles.ECOSYSTEM_MEMBER); - const updateEcosystemOrgs = await this.updatedEcosystemOrgs(orgId, orgName, orgDid, invitation.ecosystemId, ecosystemRole.id, userId); + const updateEcosystemOrgs = await this.updatedEcosystemOrgs(orgId, invitation.ecosystemId, ecosystemRole.id, userId); if (!updateEcosystemOrgs) { throw new NotFoundException(ResponseMessages.ecosystem.error.orgsNotUpdate); @@ -244,15 +286,13 @@ export class EcosystemService { } } - async updatedEcosystemOrgs(orgId: string, orgName: string, orgDid: string, ecosystemId: string, ecosystemRoleId: string, userId: string): Promise { + async updatedEcosystemOrgs(orgId: string, ecosystemId: string, ecosystemRoleId: string, userId: string): Promise { try { const data: updateEcosystemOrgsDto = { orgId, status: EcosystemOrgStatus.ACTIVE, ecosystemId, ecosystemRoleId, - orgName, - orgDid, createdBy: userId, lastChangedBy: userId }; diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 22606bf8c..a082f4e1c 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -58,7 +58,7 @@ export const ResponseMessages = { getOrgDashboard: 'Organization dashboard details fetched', getOrganizations: 'Organizations details fetched successfully', updateUserRoles: 'User roles updated successfully', - delete: 'Organization deleted successfully', + delete: 'Organization deleted successfully' }, error: { exists: 'An organization name is already exist', @@ -235,6 +235,8 @@ export const ResponseMessages = { }, error: { notCreated: 'Error while creating ecosystem', + orgNotExist: 'Organization does not exist', + orgDidNotExist: 'Organization did does not exist', exists: 'An ecosystem name is already exist', update: 'Error while updating ecosystem', invalidInvitationStatus: 'Invalid invitation status', diff --git a/libs/prisma-service/prisma/migrations/20231127132350_map_ecosystem_orgs/migration.sql b/libs/prisma-service/prisma/migrations/20231127132350_map_ecosystem_orgs/migration.sql new file mode 100644 index 000000000..f0ff9d370 --- /dev/null +++ b/libs/prisma-service/prisma/migrations/20231127132350_map_ecosystem_orgs/migration.sql @@ -0,0 +1,16 @@ +/* + Warnings: + + - You are about to drop the column `orgDid` on the `ecosystem_orgs` table. All the data in the column will be lost. + - You are about to drop the column `orgName` on the `ecosystem_orgs` table. All the data in the column will be lost. + - Changed the type of `orgId` on the `ecosystem_orgs` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. + +*/ +-- AlterTable +ALTER TABLE "ecosystem_orgs" DROP COLUMN "orgDid", +DROP COLUMN "orgName", +DROP COLUMN "orgId", +ADD COLUMN "orgId" UUID NOT NULL; + +-- AddForeignKey +ALTER TABLE "ecosystem_orgs" ADD CONSTRAINT "ecosystem_orgs_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 24e1ea358..a5ea40211 100644 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -101,6 +101,7 @@ model organisation { agent_invitations agent_invitations[] credential_definition credential_definition[] file_upload file_upload[] + ecosystemOrgs ecosystem_orgs[] } model org_invitations { @@ -371,9 +372,7 @@ model ecosystem_users { model ecosystem_orgs { id String @id @default(uuid()) @db.Uuid - orgId String - orgName String? - orgDid String? @db.VarChar + orgId String @db.Uuid status String deploymentMode String? ecosystemId String @db.Uuid @@ -386,6 +385,7 @@ model ecosystem_orgs { ecosystem ecosystem @relation(fields: [ecosystemId], references: [id]) ecosystemRole ecosystem_roles @relation(fields: [ecosystemRoleId], references: [id]) endorsementTransaction endorsement_transaction[] + organisation organisation? @relation(fields: [orgId], references: [id]) } model endorsement_transaction { diff --git a/libs/prisma-service/prisma/seed.ts b/libs/prisma-service/prisma/seed.ts index e81b282e3..e6513e575 100644 --- a/libs/prisma-service/prisma/seed.ts +++ b/libs/prisma-service/prisma/seed.ts @@ -101,26 +101,26 @@ const createPlatformUserOrgRoles = async (): Promise => { where: { email: `${CommonConstants.PLATFORM_ADMIN_EMAIL}` } - }) + }); const orgId = await prisma.organisation.findFirst({ where: { name: `${CommonConstants.PLATFORM_ADMIN_ORG}` } - }) + }); const orgRoleId = await prisma.org_roles.findUnique({ where: { name: `${CommonConstants.PLATFORM_ADMIN_ORG_ROLE}` } - }) + }); const platformOrganization = await prisma.user_org_roles.create({ data: { userId: userId.id, orgRoleId: orgRoleId.id, orgId: orgId.id - }, + } }); logger.log(platformOrganization); From 704b648fbd8227057c04a0deef70bd0cf7c86767 Mon Sep 17 00:00:00 2001 From: Nishad Date: Wed, 29 Nov 2023 17:03:49 +0530 Subject: [PATCH 05/51] refactor migration file for ecosystem-orgs Signed-off-by: Nishad --- .../20231127132350_map_ecosystem_orgs/migration.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/prisma-service/prisma/migrations/20231127132350_map_ecosystem_orgs/migration.sql b/libs/prisma-service/prisma/migrations/20231127132350_map_ecosystem_orgs/migration.sql index f0ff9d370..2cbb36783 100644 --- a/libs/prisma-service/prisma/migrations/20231127132350_map_ecosystem_orgs/migration.sql +++ b/libs/prisma-service/prisma/migrations/20231127132350_map_ecosystem_orgs/migration.sql @@ -7,10 +7,11 @@ */ -- AlterTable -ALTER TABLE "ecosystem_orgs" DROP COLUMN "orgDid", +ALTER TABLE "ecosystem_orgs" +DROP COLUMN "orgDid", DROP COLUMN "orgName", -DROP COLUMN "orgId", -ADD COLUMN "orgId" UUID NOT NULL; +ALTER COLUMN "orgId" TYPE uuid USING "orgId"::uuid; + -- AddForeignKey ALTER TABLE "ecosystem_orgs" ADD CONSTRAINT "ecosystem_orgs_orgId_fkey" FOREIGN KEY ("orgId") REFERENCES "organisation"("id") ON DELETE RESTRICT ON UPDATE CASCADE; From 2bcc6c6a2afd6dca8712a9069da448551a20f06f Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Fri, 1 Dec 2023 16:58:50 +0530 Subject: [PATCH 06/51] feat: oob issuance for multiple records Signed-off-by: bhavanakarwade --- apps/api-gateway/common/exception-handler.ts | 63 ++++-- .../src/issuance/dtos/issuance.dto.ts | 5 +- .../src/issuance/issuance.controller.ts | 188 +++++++++--------- apps/issuance/src/issuance.service.ts | 9 +- libs/common/src/response-messages/index.ts | 6 +- 5 files changed, 148 insertions(+), 123 deletions(-) diff --git a/apps/api-gateway/common/exception-handler.ts b/apps/api-gateway/common/exception-handler.ts index c31ae3741..b8a21f30a 100644 --- a/apps/api-gateway/common/exception-handler.ts +++ b/apps/api-gateway/common/exception-handler.ts @@ -1,5 +1,6 @@ import { Catch, ArgumentsHost, HttpException, HttpStatus, Logger } from '@nestjs/common'; import { BaseExceptionFilter } from '@nestjs/core'; +import { isArray } from 'class-validator'; @Catch() export class CustomExceptionFilter extends BaseExceptionFilter { @@ -20,12 +21,18 @@ export class CustomExceptionFilter extends BaseExceptionFilter { } let errorResponse; - if (exception && exception["statusCode"] === HttpStatus.INTERNAL_SERVER_ERROR) { - if (exception.message && exception.message["message"]) { + if (isArray(exception)) { + errorResponse = { + statusCode: status, + message: exception[0], + error: exception[0] + }; + } else if (exception && exception['statusCode'] === HttpStatus.INTERNAL_SERVER_ERROR) { + if (exception.message && exception.message['message']) { errorResponse = { statusCode: status, - message: exception.message["message"], - error: exception.message["message"] + message: exception.message['message'], + error: exception.message['message'] }; } else { errorResponse = { @@ -34,45 +41,57 @@ export class CustomExceptionFilter extends BaseExceptionFilter { error: 'Oops! Something went wrong. Please try again' }; } - } else if (exception && exception["error"] && exception["error"].message && (exception["error"].statusCode || exception["error"].code)) { - - const statusCode = exception["error"].statusCode || exception["error"].code || status; + } else if ( + exception && + exception['error'] && + exception['error'].message && + (exception['error'].statusCode || exception['error'].code) + ) { + const statusCode = exception['error'].statusCode || exception['error'].code || status; errorResponse = { statusCode, - message: exception["error"].message || 'Internal server error', - error: exception["error"].message || 'Internal server error' + message: exception['error'].message || 'Internal server error', + error: exception['error'].message || 'Internal server error' }; - } else if (exception && exception["statusCode"] === undefined && status === HttpStatus.INTERNAL_SERVER_ERROR) { + } else if (exception && exception['statusCode'] === undefined && status === HttpStatus.INTERNAL_SERVER_ERROR) { errorResponse = { statusCode: status, message: 'Oops! Something went wrong. Please try again', error: 'Oops! Something went wrong. Please try again' }; } else { - if (exception && exception["response"] && exception.message) { - - if (Array.isArray(exception["response"].message)) { - + if (exception && exception['response'] && exception.message) { + if (Array.isArray(exception['response'].message)) { errorResponse = { - statusCode: exception["statusCode"] ? exception["statusCode"] : status, + statusCode: exception['statusCode'] ? exception['statusCode'] : status, message: exception.message ? exception.message : 'Internal server error', - error: exception["response"].message ? exception["response"].message : exception["response"] ? exception["response"] : 'Internal server error' + error: exception['response'].message + ? exception['response'].message + : exception['response'] + ? exception['response'] + : 'Internal server error' }; } else { errorResponse = { - statusCode: exception["statusCode"] ? exception["statusCode"] : status, - message: exception["response"].message ? exception["response"].message : exception["response"] ? exception["response"] : 'Internal server error', - error: exception["response"].message ? exception["response"].message : exception["response"] ? exception["response"] : 'Internal server error' + statusCode: exception['statusCode'] ? exception['statusCode'] : status, + message: exception['response'].message + ? exception['response'].message + : exception['response'] + ? exception['response'] + : 'Internal server error', + error: exception['response'].message + ? exception['response'].message + : exception['response'] + ? exception['response'] + : 'Internal server error' }; } } else if (exception && exception.message) { - errorResponse = { - statusCode: exception["statusCode"] ? exception["statusCode"] : status, + statusCode: exception['statusCode'] ? exception['statusCode'] : status, message: exception.message || 'Internal server error', error: exception.message || 'Internal server error' }; - } } diff --git a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts index fba865b58..4f3aa1d1e 100644 --- a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts @@ -1,4 +1,4 @@ -import { IsArray, IsNotEmpty, IsOptional, IsString, IsEmail } from 'class-validator'; +import { IsArray, IsNotEmpty, IsOptional, IsString, IsEmail, ArrayMaxSize } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { Transform, Type } from 'class-transformer'; import { toNumber } from '@credebl/common/cast.helper'; @@ -109,7 +109,8 @@ export class OutOfBandCredentialDto { @ApiProperty({ example: [{ 'emailId': 'abc@example.com', 'attribute': [{ 'value': 'string', 'name': 'string' }] }] }) @IsNotEmpty({ message: 'Please provide valid attributes' }) - @IsArray({ message: 'attributes should be array' }) + @IsArray({ message: 'attributes should be array'}) + @ArrayMaxSize(Number(process.env.OOB_BATCH_SIZE), { message: `Limit reached (${process.env.OOB_BATCH_SIZE} credentials max). Easily handle larger batches via seamless CSV file uploads`}) @IsOptional() credentialOffer: CredentialOffer[]; diff --git a/apps/api-gateway/src/issuance/issuance.controller.ts b/apps/api-gateway/src/issuance/issuance.controller.ts index 715b34db1..4c5e090f6 100644 --- a/apps/api-gateway/src/issuance/issuance.controller.ts +++ b/apps/api-gateway/src/issuance/issuance.controller.ts @@ -38,7 +38,14 @@ import { CommonService } from '@credebl/common/common.service'; import { Response } from 'express'; import IResponseType from '@credebl/common/interfaces/response.interface'; import { IssuanceService } from './issuance.service'; -import { ClientDetails, FileParameter, IssuanceDto, IssueCredentialDto, OutOfBandCredentialDto, PreviewFileDetails } from './dtos/issuance.dto'; +import { + ClientDetails, + FileParameter, + IssuanceDto, + IssueCredentialDto, + OutOfBandCredentialDto, + PreviewFileDetails +} from './dtos/issuance.dto'; import { IUserRequest } from '@credebl/user-request/user-request.interface'; import { User } from '../authz/decorators/user.decorator'; import { ResponseMessages } from '@credebl/common/response-messages'; @@ -61,15 +68,13 @@ import { user } from '@prisma/client'; @ApiTags('credentials') @ApiUnauthorizedResponse({ status: 401, description: 'Unauthorized', type: UnauthorizedErrorDto }) @ApiForbiddenResponse({ status: 403, description: 'Forbidden', type: ForbiddenErrorDto }) - export class IssuanceController { constructor( private readonly issueCredentialService: IssuanceService, private readonly imageServiceService: ImageServiceService, private readonly awsService: AwsService, private readonly commonService: CommonService - - ) { } + ) {} private readonly logger = new Logger('IssuanceController'); private readonly PAGE: number = 1; @@ -77,25 +82,22 @@ export class IssuanceController { @ApiOperation({ summary: 'Out-Of-Band issuance QR', description: 'Out-Of-Band issuance QR' }) @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) @ApiExcludeEndpoint() - @ApiQuery( - { name: 'base64Image', required: true } - ) + @ApiQuery({ name: 'base64Image', required: true }) async getQrCode(@Query('base64Image') base64Image: string, @Res() res: Response): Promise { - const getImageBuffer = await this.imageServiceService.getBase64Image(base64Image); res.setHeader('Content-Type', 'image/png'); return res.send(getImageBuffer); } /** - * Description: Get all issued credentials - * @param user - * @param threadId - * @param connectionId - * @param state - * @param orgId - * - */ + * Description: Get all issued credentials + * @param user + * @param threadId + * @param connectionId + * @param state + * @param orgId + * + */ @Get('/orgs/:orgId/credentials') @UseGuards(AuthGuard('jwt')) @ApiBearerAuth() @@ -104,15 +106,9 @@ export class IssuanceController { description: `Get all issued credentials for a specific organization` }) @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) - @ApiQuery( - { name: 'threadId', required: false } - ) - @ApiQuery( - { name: 'connectionId', required: false } - ) - @ApiQuery( - { name: 'state', enum: IssueCredential, required: false } - ) + @ApiQuery({ name: 'threadId', required: false }) + @ApiQuery({ name: 'connectionId', required: false }) + @ApiQuery({ name: 'state', enum: IssueCredential, required: false }) @ApiBearerAuth() @UseGuards(AuthGuard('jwt'), OrgRolesGuard) @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER) @@ -124,8 +120,13 @@ export class IssuanceController { @Param('orgId') orgId: string, @Res() res: Response ): Promise { - - const getCredentialDetails = await this.issueCredentialService.getIssueCredentials(user, threadId, connectionId, state, orgId); + const getCredentialDetails = await this.issueCredentialService.getIssueCredentials( + user, + threadId, + connectionId, + state, + orgId + ); const finalResponse: IResponseType = { statusCode: HttpStatus.OK, @@ -136,12 +137,12 @@ export class IssuanceController { } /** - * Description: Get all issued credentials - * @param user - * @param credentialRecordId - * @param orgId - * - */ + * Description: Get all issued credentials + * @param user + * @param credentialRecordId + * @param orgId + * + */ @Get('/orgs/:orgId/credentials/:credentialRecordId') @ApiBearerAuth() @ApiOperation({ @@ -158,8 +159,11 @@ export class IssuanceController { @Res() res: Response ): Promise { - - const getCredentialDetails = await this.issueCredentialService.getIssueCredentialsbyCredentialRecordId(user, credentialRecordId, orgId); + const getCredentialDetails = await this.issueCredentialService.getIssueCredentialsbyCredentialRecordId( + user, + credentialRecordId, + orgId + ); const finalResponse: IResponseType = { statusCode: HttpStatus.OK, @@ -184,11 +188,14 @@ export class IssuanceController { @Res() res: Response ): Promise { try { - const exportedData: FileExportResponse = await this.issueCredentialService.exportSchemaToCSV(credentialDefinitionId); - return res.header('Content-Disposition', `attachment; filename="${exportedData.fileName}.csv"`).status(200).send(exportedData.fileContent); - } catch (error) { - } - + const exportedData: FileExportResponse = await this.issueCredentialService.exportSchemaToCSV( + credentialDefinitionId + ); + return res + .header('Content-Disposition', `attachment; filename="${exportedData.fileName}.csv"`) + .status(200) + .send(exportedData.fileContent); + } catch (error) {} } @Post('/orgs/:orgId/bulk/upload') @@ -235,28 +242,21 @@ export class IssuanceController { @Res() res: Response ): Promise { try { - if (file) { const fileKey: string = uuidv4(); try { - await this.awsService.uploadCsvFile(fileKey, file?.buffer); - } catch (error) { - throw new RpcException(error.response ? error.response : error); - } const reqPayload: RequestPayload = { credDefId: credentialDefinitionId, fileKey, - fileName: fileDetails["fileName"].split('.csv')[0] + fileName: fileDetails['fileName'].split('.csv')[0] }; - const importCsvDetails = await this.issueCredentialService.importCsv( - reqPayload - ); + const importCsvDetails = await this.issueCredentialService.importCsv(reqPayload); const finalResponse: IResponseType = { statusCode: HttpStatus.CREATED, message: ResponseMessages.issuance.success.importCSV, @@ -269,7 +269,6 @@ export class IssuanceController { } } - @Get('/orgs/:orgId/:requestId/preview') @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER) @UseGuards(AuthGuard('jwt'), OrgRolesGuard) @@ -289,7 +288,6 @@ export class IssuanceController { summary: 'file-preview', description: 'file-preview' }) - @ApiQuery({ name: 'pageNumber', type: Number, @@ -321,11 +319,7 @@ export class IssuanceController { @Query() previewFileDetails: PreviewFileDetails, @Res() res: Response ): Promise { - const perviewCSVDetails = await this.issueCredentialService.previewCSVDetails( - requestId, - orgId, - previewFileDetails - ); + const perviewCSVDetails = await this.issueCredentialService.previewCSVDetails(requestId, orgId, previewFileDetails); const finalResponse: IResponseType = { statusCode: HttpStatus.OK, message: ResponseMessages.issuance.success.previewCSV, @@ -353,7 +347,13 @@ export class IssuanceController { summary: 'bulk issue credential', description: 'bulk issue credential' }) - async issueBulkCredentials(@Param('requestId') requestId: string, @Param('orgId') orgId: string, @Res() res: Response, @Body() clientDetails: ClientDetails, @User() user: user): Promise { + async issueBulkCredentials( + @Param('requestId') requestId: string, + @Param('orgId') orgId: string, + @Res() res: Response, + @Body() clientDetails: ClientDetails, + @User() user: user + ): Promise { clientDetails.userId = user.id; const bulkIssunaceDetails = await this.issueCredentialService.issueBulkCredential(requestId, orgId, clientDetails); const finalResponse: IResponseType = { @@ -383,7 +383,6 @@ export class IssuanceController { summary: 'Get the file list for bulk operation', description: 'Get all the file list for organization for bulk operation' }) - @ApiQuery({ name: 'pageNumber', type: Number, @@ -414,10 +413,7 @@ export class IssuanceController { @Query() fileParameter: FileParameter, @Res() res: Response ): Promise { - const issuedFileDetails = await this.issueCredentialService.issuedFileDetails( - orgId, - fileParameter - ); + const issuedFileDetails = await this.issueCredentialService.issuedFileDetails(orgId, fileParameter); const finalResponse: IResponseType = { statusCode: HttpStatus.OK, message: ResponseMessages.issuance.success.previewCSV, @@ -445,7 +441,6 @@ export class IssuanceController { summary: 'Get the file data', description: 'Get the file data by file id' }) - @ApiQuery({ name: 'pageNumber', type: Number, @@ -477,11 +472,7 @@ export class IssuanceController { @Query() fileParameter: FileParameter, @Res() res: Response ): Promise { - const issuedFileDetails = await this.issueCredentialService.getFileDetailsByFileId( - orgId, - fileId, - fileParameter - ); + const issuedFileDetails = await this.issueCredentialService.getFileDetailsByFileId(orgId, fileId, fileParameter); const finalResponse: IResponseType = { statusCode: HttpStatus.OK, message: ResponseMessages.issuance.success.previewCSV, @@ -509,8 +500,17 @@ export class IssuanceController { summary: 'Retry bulk issue credential', description: 'Retry bulk issue credential' }) - async retryBulkCredentials(@Param('fileId') fileId: string, @Param('orgId') orgId: string, @Res() res: Response, @Body() clientDetails: ClientDetails): Promise { - const bulkIssunaceDetails = await this.issueCredentialService.retryBulkCredential(fileId, orgId, clientDetails.clientId); + async retryBulkCredentials( + @Param('fileId') fileId: string, + @Param('orgId') orgId: string, + @Res() res: Response, + @Body() clientDetails: ClientDetails + ): Promise { + const bulkIssunaceDetails = await this.issueCredentialService.retryBulkCredential( + fileId, + orgId, + clientDetails.clientId + ); const finalResponse: IResponseType = { statusCode: HttpStatus.CREATED, message: ResponseMessages.issuance.success.bulkIssuance, @@ -519,7 +519,6 @@ export class IssuanceController { return res.status(HttpStatus.CREATED).json(finalResponse); } - /** * Description: Issuer send credential to create offer * @param user @@ -540,7 +539,6 @@ export class IssuanceController { @Body() issueCredentialDto: IssueCredentialDto, @Res() res: Response ): Promise { - issueCredentialDto.orgId = orgId; const attrData = issueCredentialDto.attributes; @@ -552,10 +550,7 @@ export class IssuanceController { } }); - const getCredentialDetails = await this.issueCredentialService.sendCredentialCreateOffer( - issueCredentialDto, - user - ); + const getCredentialDetails = await this.issueCredentialService.sendCredentialCreateOffer(issueCredentialDto, user); const finalResponse: IResponseType = { statusCode: HttpStatus.CREATED, @@ -567,11 +562,11 @@ export class IssuanceController { /** * Description: credential issuance out-of-band - * @param user - * @param outOfBandCredentialDto - * @param orgId - * @param res - * @returns + * @param user + * @param outOfBandCredentialDto + * @param orgId + * @param res + * @returns */ @Post('/orgs/:orgId/credentials/oob') @UseGuards(AuthGuard('jwt')) @@ -589,9 +584,24 @@ export class IssuanceController { @Param('orgId') orgId: string, @Res() res: Response ): Promise { - outOfBandCredentialDto.orgId = orgId; - const getCredentialDetails = await this.issueCredentialService.outOfBandCredentialOffer(user, outOfBandCredentialDto); + + const credOffer = outOfBandCredentialDto?.credentialOffer || []; + if (credOffer.every(item => Boolean(!item?.emailId || '' === item?.emailId.trim()))) { + throw new BadRequestException(ResponseMessages.issuance.error.emailIdNotPresent); + } + + if (credOffer.every(offer => (!offer?.attributes || 0 === offer?.attributes?.length || + !offer?.attributes?.every(item => item?.name) + )) + ) { + throw new BadRequestException(ResponseMessages.issuance.error.attributesNotPresent); + } + + const getCredentialDetails = await this.issueCredentialService.outOfBandCredentialOffer( + user, + outOfBandCredentialDto + ); const finalResponse: IResponseType = { statusCode: HttpStatus.CREATED, @@ -602,10 +612,10 @@ export class IssuanceController { } /** - * Description: webhook Save issued credential details - * @param user - * @param issueCredentialDto - */ + * Description: webhook Save issued credential details + * @param user + * @param issueCredentialDto + */ @Post('wh/:id/credentials') @ApiExcludeEndpoint() @ApiOperation({ @@ -619,7 +629,6 @@ export class IssuanceController { ): Promise { this.logger.debug(`issueCredentialDto ::: ${JSON.stringify(issueCredentialDto)}`); - const getCredentialDetails = await this.issueCredentialService.getIssueCredentialWebhook(issueCredentialDto, id); const finalResponse: IResponseType = { statusCode: HttpStatus.CREATED, @@ -627,8 +636,5 @@ export class IssuanceController { data: getCredentialDetails.response }; return res.status(HttpStatus.CREATED).json(finalResponse); - } - - } diff --git a/apps/issuance/src/issuance.service.ts b/apps/issuance/src/issuance.service.ts index a8b8f847b..95807f65b 100644 --- a/apps/issuance/src/issuance.service.ts +++ b/apps/issuance/src/issuance.service.ts @@ -299,9 +299,6 @@ export class IssuanceService { emailId } = outOfBandCredential; - // Define a batch size - const batchSize = 100; // Adjust this based on your needs - const agentDetails = await this.issuanceRepository.getAgentEndPoint(orgId); if (!agentDetails) { throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound); @@ -336,7 +333,6 @@ export class IssuanceService { label: organizationDetails?.name }; - const credentialCreateOfferDetails = await this._outOfBandCredentialOffer(outOfBandIssuancePayload, url, apiKey); if (!credentialCreateOfferDetails) { errors.push(ResponseMessages.issuance.error.credentialOfferNotFound); @@ -393,8 +389,9 @@ export class IssuanceService { }; if (credentialOffer) { - for (let i = 0; i < credentialOffer.length; i += batchSize) { - const batch = credentialOffer.slice(i, i + batchSize); + + for (let i = 0; i < credentialOffer.length; i += Number(process.env.OOB_BATCH_SIZE)) { + const batch = credentialOffer.slice(i, i + Number(process.env.OOB_BATCH_SIZE)); // Process each batch in parallel const batchPromises = batch.map((iterator) => sendEmailForCredentialOffer(iterator, iterator.emailId)); diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index a082f4e1c..8e29f1e89 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -167,7 +167,7 @@ export const ResponseMessages = { issuance: { success: { create: 'Credentials offer created successfully', - fetch: 'Credentials fetched successfully', + fetch: 'Credentials offer send successfully', importCSV: 'File imported sucessfully', previewCSV: 'File details fetched sucessfully', bulkIssuance: 'Issuance process started. It will take some time', @@ -191,7 +191,9 @@ export const ResponseMessages = { fileNotFound: 'File details not found', fileData: 'File data does not exist for the specific file', retry: 'Credentials do not exist for retry', - walletError: 'Credential Issuance failed due to error in Wallet Agent' + walletError: 'Credential Issuance failed due to error in Wallet Agent', + emailIdNotPresent: 'EmailId is empty or not present', + attributesNotPresent: 'Attributes are not present or not empty' } }, verification: { From 9b44c294faa4eea60327ac71cfc4d5d4a132d80e Mon Sep 17 00:00:00 2001 From: bhavanakarwade <137506897+bhavanakarwade@users.noreply.github.com> Date: Sun, 3 Dec 2023 09:13:37 +0530 Subject: [PATCH 07/51] refactor: content on certificates templates (#321) Signed-off-by: bhavanakarwade --- apps/user/templates/arbiter-template.ts | 7 +++---- apps/user/templates/participant-template.ts | 7 +++---- apps/user/templates/winner-template.ts | 7 +++---- apps/user/templates/world-record-template.ts | 7 +++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/apps/user/templates/arbiter-template.ts b/apps/user/templates/arbiter-template.ts index 483c0f296..efeee0331 100644 --- a/apps/user/templates/arbiter-template.ts +++ b/apps/user/templates/arbiter-template.ts @@ -7,10 +7,9 @@ export class ArbiterTemplate { async getArbiterTemplate(attributes: Attribute[]): Promise { try { - const [name, issuedBy] = await Promise.all(attributes).then((attributes) => { + const [name] = await Promise.all(attributes).then((attributes) => { const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? ''; - const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? ''; - return [name, issuedBy]; + return [name]; }); return ` @@ -75,7 +74,7 @@ export class ArbiterTemplate {

has served as an Arbiter at the - ${issuedBy} World Memory Championship 2023. + IAM World Memory Championship 2023.

diff --git a/apps/user/templates/participant-template.ts b/apps/user/templates/participant-template.ts index 75b4f0cac..f2738fb23 100644 --- a/apps/user/templates/participant-template.ts +++ b/apps/user/templates/participant-template.ts @@ -8,10 +8,9 @@ export class ParticipantTemplate { async getParticipantTemplate(attributes: Attribute[]): Promise { try { - const [name, issuedBy] = await Promise.all(attributes).then((attributes) => { + const [name] = await Promise.all(attributes).then((attributes) => { const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? ''; - const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? ''; - return [name, issuedBy]; + return [name]; }); return ` @@ -76,7 +75,7 @@ export class ParticipantTemplate { margin: 15px;">${name}

for successfully participating in the - ${issuedBy} World Memory Championship 2023. + IAM World Memory Championship 2023.

We acknowledge your dedication, hard work, and

diff --git a/apps/user/templates/winner-template.ts b/apps/user/templates/winner-template.ts index 49526e6da..6bb087c7e 100644 --- a/apps/user/templates/winner-template.ts +++ b/apps/user/templates/winner-template.ts @@ -7,14 +7,13 @@ export class WinnerTemplate { async getWinnerTemplate(attributes: Attribute[]): Promise { try { - const [name, position, discipline, issuedBy, category] = await Promise.all(attributes).then((attributes) => { + const [name, position, discipline, category] = await Promise.all(attributes).then((attributes) => { const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? ''; const position = this.findAttributeByName(attributes, 'position')?.position ?? ''; const discipline = this.findAttributeByName(attributes, 'discipline')?.discipline ?? ''; - const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? ''; const category = this.findAttributeByName(attributes, 'category')?.category ?? ''; const date = this.findAttributeByName(attributes, 'issued_date')?.issued_date ?? ''; - return [name, position, discipline, issuedBy, category, date]; + return [name, position, discipline, category, date]; }); return ` @@ -79,7 +78,7 @@ export class WinnerTemplate {

has secured ${position} position for ${discipline}

in ${category} category at the

- ${issuedBy} World Memory Championship 2023. + IAM World Memory Championship 2023.

diff --git a/apps/user/templates/world-record-template.ts b/apps/user/templates/world-record-template.ts index 70f9b8d36..3eb30cf8c 100644 --- a/apps/user/templates/world-record-template.ts +++ b/apps/user/templates/world-record-template.ts @@ -7,11 +7,10 @@ export class WorldRecordTemplate { async getWorldRecordTemplate(attributes: Attribute[]): Promise { try { - const [name, discipline, issuedBy] = await Promise.all(attributes).then((attributes) => { + const [name, discipline] = await Promise.all(attributes).then((attributes) => { const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? ''; const discipline = this.findAttributeByName(attributes, 'discipline')?.discipline ?? ''; - const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? ''; - return [name, discipline, issuedBy]; + return [name, discipline]; }); return ` @@ -77,7 +76,7 @@ export class WorldRecordTemplate { for successfully creating the world record in the ${discipline}

discipline during the - ${issuedBy} World Memory Championship 2023. + IAM World Memory Championship 2023.

From 1a2a422d5733bbc03b2d57f92ed47a77dc1ff3e8 Mon Sep 17 00:00:00 2001 From: Moulika Kulkarni Date: Mon, 4 Dec 2023 12:43:15 +0530 Subject: [PATCH 08/51] refactor:API-response-refactor Signed-off-by: Moulika Kulkarni --- apps/ecosystem/src/ecosystem.repository.ts | 8 +++++- .../repositories/organization.repository.ts | 26 ++++++++++++++++--- libs/user-activity/repositories/index.ts | 9 +++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/apps/ecosystem/src/ecosystem.repository.ts b/apps/ecosystem/src/ecosystem.repository.ts index 4f3a08866..9dc1a3665 100644 --- a/apps/ecosystem/src/ecosystem.repository.ts +++ b/apps/ecosystem/src/ecosystem.repository.ts @@ -510,7 +510,13 @@ export class EcosystemRepository { ...queryObject }, include: { - ecosystem: true + ecosystem: { + select: { + id: true, + name: true, + logoUrl: true + } + } }, take: pageSize, skip: (pageNumber - 1) * pageSize, diff --git a/apps/organization/repositories/organization.repository.ts b/apps/organization/repositories/organization.repository.ts index 22549d8ac..ece7cab81 100644 --- a/apps/organization/repositories/organization.repository.ts +++ b/apps/organization/repositories/organization.repository.ts @@ -212,7 +212,15 @@ export class OrganizationRepository { ...queryObject }, include: { - organisation: true + organisation: { + select: { + id: true, + name: true, + logoUrl: true + //orgSlug: true + // publicProfile: true + } + } }, take: pageSize, skip: (pageNumber - 1) * pageSize, @@ -389,10 +397,20 @@ export class OrganizationRepository { where: { ...queryObject }, - include: { + select: { + id: true, + name: true, + description: true, + logoUrl: true, userOrgRoles: { - include: { - orgRole: true + select: { + id: true, + orgRole: { + select: { + id: true, + name: true + } + } }, where: { ...filterOptions diff --git a/libs/user-activity/repositories/index.ts b/libs/user-activity/repositories/index.ts index ed616ca69..dd66d72f3 100644 --- a/libs/user-activity/repositories/index.ts +++ b/libs/user-activity/repositories/index.ts @@ -28,6 +28,15 @@ export class UserActivityRepository { where: { userId }, + select: { + id: true, + userId: true, + orgId: true, + action: true, + details: true, + createDateTime:true, + lastChangedDateTime: true + }, orderBy: { createDateTime: 'desc' }, From adec4af719a784dedaf572fc392f2c558451bcf4 Mon Sep 17 00:00:00 2001 From: Moulika Kulkarni Date: Mon, 4 Dec 2023 13:01:22 +0530 Subject: [PATCH 09/51] Merge branch 'develop' of https://github.com/credebl/platform into api-response Signed-off-by: Moulika Kulkarni --- apps/organization/repositories/organization.repository.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/organization/repositories/organization.repository.ts b/apps/organization/repositories/organization.repository.ts index ece7cab81..50a1a8e57 100644 --- a/apps/organization/repositories/organization.repository.ts +++ b/apps/organization/repositories/organization.repository.ts @@ -217,8 +217,6 @@ export class OrganizationRepository { id: true, name: true, logoUrl: true - //orgSlug: true - // publicProfile: true } } }, From e3434feb604155887ce87c9bb114c9da3145d7ab Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Mon, 4 Dec 2023 17:43:45 +0530 Subject: [PATCH 10/51] refactor: get api of connection Signed-off-by: bhavanakarwade --- apps/connection/src/connection.repository.ts | 1 + apps/issuance/interfaces/issuance.interfaces.ts | 1 + libs/prisma-service/prisma/schema.prisma | 2 ++ 3 files changed, 4 insertions(+) diff --git a/apps/connection/src/connection.repository.ts b/apps/connection/src/connection.repository.ts index 770c92fc2..ccd465581 100644 --- a/apps/connection/src/connection.repository.ts +++ b/apps/connection/src/connection.repository.ts @@ -113,6 +113,7 @@ export class ConnectionRepository { lastChangedBy: orgId, connectionId, state, + theirLabel, orgId } }); diff --git a/apps/issuance/interfaces/issuance.interfaces.ts b/apps/issuance/interfaces/issuance.interfaces.ts index 4725e367d..77709e3c2 100644 --- a/apps/issuance/interfaces/issuance.interfaces.ts +++ b/apps/issuance/interfaces/issuance.interfaces.ts @@ -37,6 +37,7 @@ export interface IIssuanceWebhookInterface { protocolVersion: string; credentialAttributes: ICredentialAttributesInterface[]; orgId: string; + schemaName: string; id: string; state: string; } diff --git a/libs/prisma-service/prisma/schema.prisma b/libs/prisma-service/prisma/schema.prisma index a5ea40211..df1242b70 100644 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -283,6 +283,7 @@ model connections { lastChangedDateTime DateTime @default(now()) @db.Timestamptz(6) lastChangedBy String @db.Uuid connectionId String @unique + theirLabel String state String orgId String? @db.Uuid organisation organisation? @relation(fields: [orgId], references: [id]) @@ -298,6 +299,7 @@ model credentials { threadId String @unique credentialExchangeId String @default("") state String @default("") + schemaId String orgId String? @db.Uuid organisation organisation? @relation(fields: [orgId], references: [id]) } From 53835c254c298b39ea84002e7409fa61f7c13790 Mon Sep 17 00:00:00 2001 From: pallavicoder Date: Mon, 4 Dec 2023 19:37:33 +0530 Subject: [PATCH 11/51] fix:added seed inside connection service Signed-off-by: pallavicoder --- apps/connection/src/main.ts | 2 +- package-lock.json | 1722 +++++++++++++++++++++++++++++++---- package.json | 2 +- 3 files changed, 1565 insertions(+), 161 deletions(-) diff --git a/apps/connection/src/main.ts b/apps/connection/src/main.ts index c4f262c48..b92f88d1e 100644 --- a/apps/connection/src/main.ts +++ b/apps/connection/src/main.ts @@ -11,7 +11,7 @@ async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(ConnectionModule, { transport: Transport.NATS, - options: getNatsOptions() + options: getNatsOptions(process.env.CONNECTION_NKEY_SEED) }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/package-lock.json b/package-lock.json index 970155b11..510772f69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "@types/pdfkit": "^0.12.6", "async-retry": "^1.3.3", "auth0-js": "^9.22.1", - "aws-sdk": "^2.1492.0", + "aws-sdk": "^2.1510.0", "bcrypt": "^5.1.0", "blob-stream": "^0.1.3", "body-parser": "^1.20.1", @@ -51,6 +51,7 @@ "generate-password": "^1.7.0", "helmet": "^7.0.0", "html-pdf": "^3.0.1", + "html-to-image": "^1.11.11", "json2csv": "^5.0.7", "jsonwebtoken": "^9.0.1", "jwks-rsa": "^3.0.1", @@ -61,6 +62,7 @@ "nats": "^2.15.1", "nestjs-supabase-auth": "^1.0.9", "nestjs-typeorm-paginate": "^4.0.4", + "node-html-to-image": "^4.0.0", "node-qpdf2": "^2.0.0", "papaparse": "^5.4.1", "passport": "^0.6.0", @@ -69,6 +71,7 @@ "path": "^0.12.7", "pdfkit": "^0.13.0", "pg": "^8.11.2", + "puppeteer": "^21.5.0", "qrcode": "^1.5.3", "qs": "^6.11.2", "reflect-metadata": "^0.1.13", @@ -257,7 +260,6 @@ "version": "7.22.10", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.10.tgz", "integrity": "sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA==", - "dev": true, "dependencies": { "@babel/highlight": "^7.22.10", "chalk": "^2.4.2" @@ -270,7 +272,6 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, "dependencies": { "color-convert": "^1.9.0" }, @@ -282,7 +283,6 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -296,7 +296,6 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, "dependencies": { "color-name": "1.1.3" } @@ -304,14 +303,12 @@ "node_modules/@babel/code-frame/node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, "engines": { "node": ">=0.8.0" } @@ -320,7 +317,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, "engines": { "node": ">=4" } @@ -329,7 +325,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "dependencies": { "has-flag": "^3.0.0" }, @@ -557,7 +552,6 @@ "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -589,7 +583,6 @@ "version": "7.22.10", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.10.tgz", "integrity": "sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==", - "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.5", "chalk": "^2.4.2", @@ -603,7 +596,6 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, "dependencies": { "color-convert": "^1.9.0" }, @@ -615,7 +607,6 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -629,7 +620,6 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, "dependencies": { "color-name": "1.1.3" } @@ -637,14 +627,12 @@ "node_modules/@babel/highlight/node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, "engines": { "node": ">=0.8.0" } @@ -653,7 +641,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, "engines": { "node": ">=4" } @@ -662,7 +649,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "dependencies": { "has-flag": "^3.0.0" }, @@ -2338,6 +2324,67 @@ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e.tgz", "integrity": "sha512-owZqbY/wucbr65bXJ/ljrHPgQU5xXTSkmcE/JcbqE1kusuAXV/TLN3/exmz21SZ5rJ7WDkyk70J2G/n68iogbQ==" }, + "node_modules/@puppeteer/browsers": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.8.0.tgz", + "integrity": "sha512-TkRHIV6k2D8OlUe8RtG+5jgOF/H98Myx0M6AOafC8DdNVOFiBSFa5cpRDtpm8LXOa9sVwe0+e6Q3FC56X/DZfg==", + "dependencies": { + "debug": "4.3.4", + "extract-zip": "2.0.1", + "progress": "2.0.3", + "proxy-agent": "6.3.1", + "tar-fs": "3.0.4", + "unbzip2-stream": "1.4.3", + "yargs": "17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=16.3.0" + } + }, + "node_modules/@puppeteer/browsers/node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/@puppeteer/browsers/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@puppeteer/browsers/node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/@sendgrid/client": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-7.7.0.tgz", @@ -2490,6 +2537,11 @@ "tslib": "^2.4.0" } }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==" + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -2900,6 +2952,15 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.3.0.tgz", @@ -3669,6 +3730,17 @@ "node": ">=0.8" } }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/async-retry": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", @@ -3709,9 +3781,9 @@ } }, "node_modules/aws-sdk": { - "version": "2.1492.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1492.0.tgz", - "integrity": "sha512-3q17ruBkwb3pL87CHSbRlYiwx1LCq7D7hIjHgZ/5SPeKknkXgkHnD20SD2lC8Nj3xGbpIUhoKXcpDAGgIM5DBA==", + "version": "2.1510.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1510.0.tgz", + "integrity": "sha512-XQj3QINBNseA5G9Vaa/iihNz3HCrzeyhxrOUjuH0AVxYqa5Q4cxaQhrWiAiUndtO2F70nfukEYe4cCUoTalUoQ==", "dependencies": { "buffer": "4.9.2", "events": "1.1.1", @@ -3821,6 +3893,11 @@ "node": ">= 6" } }, + "node_modules/b4a": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", + "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==" + }, "node_modules/babel-jest": { "version": "29.6.2", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.6.2.tgz", @@ -3944,6 +4021,14 @@ "node": "^4.5.0 || >= 5.9" } }, + "node_modules/basic-ftp": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.3.tgz", + "integrity": "sha512-QHX8HLlncOLpy54mh+k/sWIFd0ThmRqwe9ZjELybGZK+tZ8rUb9VO0saKJUROTbE+KhzDUT7xziGpGrW8Kmd+g==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/bcrypt": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.1.0.tgz", @@ -4232,7 +4317,6 @@ "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", - "optional": true, "engines": { "node": "*" } @@ -4372,7 +4456,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, "engines": { "node": ">=6" } @@ -4496,6 +4579,18 @@ "node": ">=6.0" } }, + "node_modules/chromium-bidi": { + "version": "0.4.33", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.33.tgz", + "integrity": "sha512-IxoFM5WGQOIAd95qrSXzJUv4eXIrh+RvU3rwwqIiwYuvfE7U/Llj4fejbsJnjJMUYCuGtVQsY2gv7oGl4aTNSQ==", + "dependencies": { + "mitt": "3.0.1", + "urlpattern-polyfill": "9.0.0" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, "node_modules/ci-info": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", @@ -4947,6 +5042,14 @@ "node": ">=12.0.0" } }, + "node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -5001,6 +5104,14 @@ "node": ">=0.10" } }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.1.tgz", + "integrity": "sha512-MZd3VlchQkp8rdend6vrx7MmVDJzSNTBvghvKjirLkD+WTChA3KUf0jkE68Q4UyctNqI11zZO9/x2Yx+ub5Cvg==", + "engines": { + "node": ">= 14" + } + }, "node_modules/date-fns": { "version": "2.30.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", @@ -5132,6 +5243,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -5187,6 +5311,11 @@ "node": ">=8" } }, + "node_modules/devtools-protocol": { + "version": "0.0.1203626", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1203626.tgz", + "integrity": "sha512-nEzHZteIUZfGCZtTiS1fRpC8UZmsfD1SiyPvaUNvS13dvKf666OAm8YTi0+Ca3n1nLEyu49Cy4+dPWpaHFJk9g==" + }, "node_modules/dezalgo": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", @@ -5350,7 +5479,6 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "dependencies": { "once": "^1.4.0" } @@ -5420,7 +5548,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, "dependencies": { "is-arrayish": "^0.2.1" } @@ -5606,6 +5733,35 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/escodegen/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/eslint": { "version": "8.47.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz", @@ -6150,7 +6306,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -6187,7 +6342,6 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, "engines": { "node": ">=4.0" } @@ -6196,7 +6350,6 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -6467,6 +6620,11 @@ "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", "dev": true }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==" + }, "node_modules/fast-glob": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", @@ -6522,7 +6680,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", - "optional": true, "dependencies": { "pend": "~1.2.0" } @@ -6989,6 +7146,49 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-uri": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.2.tgz", + "integrity": "sha512-5KLucCJobh8vBY1K07EFV4+cPZH3mrV9YeAruUseCQKHB58SGjjT2l9/eA9LD082IiuMjSlFJEcdJ27TXvbZNw==", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.0", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/get-uri/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/get-uri/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/get-uri/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -7119,6 +7319,34 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/handlebars/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -7297,6 +7525,11 @@ "phantomjs-prebuilt": "^2.1.16" } }, + "node_modules/html-to-image": { + "version": "1.11.11", + "resolved": "https://registry.npmjs.org/html-to-image/-/html-to-image-1.11.11.tgz", + "integrity": "sha512-9gux8QhvjRO/erSnDPv28noDZcPZmYE7e1vFsBLKLlRlKDSqNJYebj6Qz1TGd5lsRV+X+xYyjCKjuZdABinWjA==" + }, "node_modules/http_ece": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/http_ece/-/http_ece-1.1.0.tgz", @@ -7323,6 +7556,29 @@ "node": ">= 0.8" } }, + "node_modules/http-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", + "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -7430,7 +7686,6 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -7555,6 +7810,11 @@ "url": "https://opencollective.com/ioredis" } }, + "node_modules/ip": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", + "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -7594,8 +7854,7 @@ "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" }, "node_modules/is-bigint": { "version": "1.0.4", @@ -8648,8 +8907,7 @@ "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/js-yaml": { "version": "4.1.0", @@ -8682,8 +8940,7 @@ "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "node_modules/json-schema": { "version": "0.4.0", @@ -8928,8 +9185,7 @@ "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "node_modules/lint-staged": { "version": "13.3.0", @@ -9695,6 +9951,11 @@ "node": ">=8" } }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + }, "node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", @@ -9706,6 +9967,11 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, "node_modules/moment": { "version": "2.29.4", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", @@ -9832,8 +10098,7 @@ "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, "node_modules/nestjs-supabase-auth": { "version": "1.0.9", @@ -9849,6 +10114,14 @@ "typeorm": "^0.3.0" } }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/next-tick": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", @@ -9925,62 +10198,282 @@ "node-gyp-build-optional-packages-test": "build-test.js" } }, - "node_modules/node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "dev": true - }, - "node_modules/node-qpdf2": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/node-qpdf2/-/node-qpdf2-2.0.0.tgz", - "integrity": "sha512-Xoxe53XsEriaVLWJTl3YtHE54qaZnO2GeoNKKALLy6cKUAjYZuFlTaNCcsVkfoIbZv2YYWuggeuqhTQ1XPbvgw==", - "engines": { - "node": ">=10.17.0" + "node_modules/node-html-to-image": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/node-html-to-image/-/node-html-to-image-4.0.0.tgz", + "integrity": "sha512-lB8fkRleAKG4afJ2Wr7qJzIA5+//ue9OEoz+BMxQsowriGKR8sf4j4lK/pIXKakYwf/3aZHoDUNgOXuJ4HOzYA==", + "dependencies": { + "handlebars": "4.7.8", + "puppeteer": "21.0.1", + "puppeteer-cluster": "^0.23.0" } }, - "node_modules/node-releases": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", - "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", - "dev": true - }, - "node_modules/nopt": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", - "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "node_modules/node-html-to-image/node_modules/@puppeteer/browsers": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.5.0.tgz", + "integrity": "sha512-za318PweGINh5LnHSph7C4xhs0tmRjCD8EPpzcKlw4nzSPhnULj+LTG3+TGefZvW1ti5gjw2JkdQvQsivBeZlg==", "dependencies": { - "abbrev": "1" + "debug": "4.3.4", + "extract-zip": "2.0.1", + "progress": "2.0.3", + "proxy-agent": "6.3.0", + "tar-fs": "3.0.4", + "unbzip2-stream": "1.4.3", + "yargs": "17.7.1" }, "bin": { - "nopt": "bin/nopt.js" + "browsers": "lib/cjs/main-cli.js" }, "engines": { - "node": ">=6" + "node": ">=16.3.0" } }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, + "node_modules/node-html-to-image/node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dependencies": { + "debug": "^4.3.4" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 14" } }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, + "node_modules/node-html-to-image/node_modules/chromium-bidi": { + "version": "0.4.20", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.20.tgz", + "integrity": "sha512-ruHgVZFEv00mAQMz1tQjfjdG63jiPWrQPF6HLlX2ucqLqVTJoWngeBEKHaJ6n1swV/HSvgnBNbtTRIlcVyW3Fw==", "dependencies": { - "path-key": "^3.0.0" + "mitt": "3.0.1" }, - "engines": { - "node": ">=8" + "peerDependencies": { + "devtools-protocol": "*" } }, - "node_modules/npmlog": { + "node_modules/node-html-to-image/node_modules/cosmiconfig": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.2.0.tgz", + "integrity": "sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==", + "dependencies": { + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + } + }, + "node_modules/node-html-to-image/node_modules/devtools-protocol": { + "version": "0.0.1147663", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1147663.tgz", + "integrity": "sha512-hyWmRrexdhbZ1tcJUGpO95ivbRhWXz++F4Ko+n21AY5PNln2ovoJw+8ZMNDTtip+CNFQfrtLVh/w4009dXO/eQ==" + }, + "node_modules/node-html-to-image/node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/node-html-to-image/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/node-html-to-image/node_modules/https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/node-html-to-image/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/node-html-to-image/node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/node-html-to-image/node_modules/proxy-agent": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.0.tgz", + "integrity": "sha512-0LdR757eTj/JfuU7TL2YCuAZnxWXu3tkJbg4Oq3geW/qFNT/32T0sp2HnZ9O0lMR4q3vwAt0+xCA8SR0WAD0og==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/node-html-to-image/node_modules/puppeteer": { + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-21.0.1.tgz", + "integrity": "sha512-KTjmSdPZ6bMkq3EbAzAUhcB3gMDXvdwd6912rxG9hNtjwRJzHSA568vh6vIbO2WQeNmozRdt1LtiUMLSWfeMrg==", + "hasInstallScript": true, + "dependencies": { + "@puppeteer/browsers": "1.5.0", + "cosmiconfig": "8.2.0", + "puppeteer-core": "21.0.1" + }, + "engines": { + "node": ">=16.3.0" + } + }, + "node_modules/node-html-to-image/node_modules/puppeteer-core": { + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-21.0.1.tgz", + "integrity": "sha512-E8eWLGhaZZpa7dYe/58qGX7SLb4mTg42NP5M7B+ibPrncgNjTOQa9x1sFIlTn1chF/BmoZqOcMIvwuxcb/9XzQ==", + "dependencies": { + "@puppeteer/browsers": "1.5.0", + "chromium-bidi": "0.4.20", + "cross-fetch": "4.0.0", + "debug": "4.3.4", + "devtools-protocol": "0.0.1147663", + "ws": "8.13.0" + }, + "engines": { + "node": ">=16.3.0" + } + }, + "node_modules/node-html-to-image/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/node-html-to-image/node_modules/yargs": { + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node_modules/node-qpdf2": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/node-qpdf2/-/node-qpdf2-2.0.0.tgz", + "integrity": "sha512-Xoxe53XsEriaVLWJTl3YtHE54qaZnO2GeoNKKALLy6cKUAjYZuFlTaNCcsVkfoIbZv2YYWuggeuqhTQ1XPbvgw==", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/node-releases": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "dev": true + }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npmlog": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", @@ -10247,6 +10740,60 @@ "node": ">=6" } }, + "node_modules/pac-proxy-agent": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.1.tgz", + "integrity": "sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "pac-resolver": "^7.0.0", + "socks-proxy-agent": "^8.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.0.tgz", + "integrity": "sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==", + "dependencies": { + "degenerator": "^5.0.0", + "ip": "^1.1.8", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/packet-reader": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", @@ -10266,7 +10813,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, "dependencies": { "callsites": "^3.0.0" }, @@ -10278,7 +10824,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -10428,7 +10973,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, "engines": { "node": ">=8" } @@ -10452,8 +10996,7 @@ "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "optional": true + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==" }, "node_modules/performance-now": { "version": "2.1.0", @@ -10904,11 +11447,59 @@ "node": ">= 0.10" } }, + "node_modules/proxy-agent": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.1.tgz", + "integrity": "sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.1", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "peer": true + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "node_modules/pseudomap": { "version": "1.0.2", @@ -10925,7 +11516,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -10940,6 +11530,92 @@ "node": ">=6" } }, + "node_modules/puppeteer": { + "version": "21.5.2", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-21.5.2.tgz", + "integrity": "sha512-BaAGJOq8Fl6/cck6obmwaNLksuY0Bg/lIahCLhJPGXBFUD2mCffypa4A592MaWnDcye7eaHmSK9yot0pxctY8A==", + "hasInstallScript": true, + "dependencies": { + "@puppeteer/browsers": "1.8.0", + "cosmiconfig": "8.3.6", + "puppeteer-core": "21.5.2" + }, + "engines": { + "node": ">=16.13.2" + } + }, + "node_modules/puppeteer-cluster": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/puppeteer-cluster/-/puppeteer-cluster-0.23.0.tgz", + "integrity": "sha512-108terIWDzPrQopmoYSPd5yDoy3FGJ2dNnoGMkGYPs6xtkdhgaECwpfZkzaRToMQPZibUOz0/dSSGgPEdXEhkQ==", + "dependencies": { + "debug": "^4.3.3" + }, + "peerDependencies": { + "puppeteer": ">=1.5.0" + } + }, + "node_modules/puppeteer-core": { + "version": "21.5.2", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-21.5.2.tgz", + "integrity": "sha512-v4T0cWnujSKs+iEfmb8ccd7u4/x8oblEyKqplqKnJ582Kw8PewYAWvkH4qUWhitN3O2q9RF7dzkvjyK5HbzjLA==", + "dependencies": { + "@puppeteer/browsers": "1.8.0", + "chromium-bidi": "0.4.33", + "cross-fetch": "4.0.0", + "debug": "4.3.4", + "devtools-protocol": "0.0.1203626", + "ws": "8.14.2" + }, + "engines": { + "node": ">=16.13.2" + } + }, + "node_modules/puppeteer-core/node_modules/ws": { + "version": "8.14.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", + "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/puppeteer/node_modules/cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "dependencies": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/pure-rand": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", @@ -11125,6 +11801,11 @@ } ] }, + "node_modules/queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -11431,7 +12112,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, "engines": { "node": ">=4" } @@ -11840,6 +12520,15 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, "node_modules/socket.io": { "version": "4.7.1", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.1.tgz", @@ -11891,6 +12580,48 @@ "node": ">=10.0.0" } }, + "node_modules/socks": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", + "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "dependencies": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.13.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.2.tgz", + "integrity": "sha512-8zuqoLv1aP/66PHF5TqwJ7Czm3Yv32urJQHrVyhD7mmA6d61Zv8cIXQYPTWwmg6qlupnPvs/QKDmfa4P/qct2g==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "socks": "^2.7.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/socks-proxy-agent/node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/socks/node_modules/ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + }, "node_modules/source-map": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", @@ -12023,6 +12754,15 @@ "node": ">=10.0.0" } }, + "node_modules/streamx": { + "version": "2.15.5", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.5.tgz", + "integrity": "sha512-9thPGMkKC2GctCzyCUjME3yR03x2xNo0GPKGkRw2UMYN+gqWa9uqpyNWhmsNCutU5zHmkUum0LsCRQTXUgUCAg==", + "dependencies": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -12359,6 +13099,26 @@ "node": ">=10" } }, + "node_modules/tar-fs": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz", + "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==", + "dependencies": { + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + } + }, + "node_modules/tar-stream": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz", + "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==", + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, "node_modules/tar/node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -12505,8 +13265,7 @@ "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, "node_modules/tiny-inflate": { "version": "1.0.3", @@ -13088,6 +13847,18 @@ "node": ">=14.17" } }, + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/uid": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", @@ -13114,6 +13885,38 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/unbzip2-stream/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/unfetch": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", @@ -13229,6 +14032,11 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" }, + "node_modules/urlpattern-polyfill": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-9.0.0.tgz", + "integrity": "sha512-WHN8KDQblxd32odxeIgo83rdVDE2bvdkb86it7bMhYZwWKJz0+O0RK/eZiHYnM+zgt/U7hAHOlCQGfjjvSkw2g==" + }, "node_modules/urlsafe-base64": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/urlsafe-base64/-/urlsafe-base64-1.0.0.tgz", @@ -13705,6 +14513,11 @@ "node": ">=8.12.0" } }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -13865,7 +14678,6 @@ "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", - "optional": true, "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" @@ -13999,7 +14811,6 @@ "version": "7.22.10", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.10.tgz", "integrity": "sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA==", - "dev": true, "requires": { "@babel/highlight": "^7.22.10", "chalk": "^2.4.2" @@ -14009,7 +14820,6 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, "requires": { "color-convert": "^1.9.0" } @@ -14018,7 +14828,6 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, "requires": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -14029,7 +14838,6 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, "requires": { "color-name": "1.1.3" } @@ -14037,26 +14845,22 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "requires": { "has-flag": "^3.0.0" } @@ -14234,8 +15038,7 @@ "@babel/helper-validator-identifier": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", - "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", - "dev": true + "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==" }, "@babel/helper-validator-option": { "version": "7.22.5", @@ -14258,7 +15061,6 @@ "version": "7.22.10", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.10.tgz", "integrity": "sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==", - "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.22.5", "chalk": "^2.4.2", @@ -14269,7 +15071,6 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, "requires": { "color-convert": "^1.9.0" } @@ -14278,7 +15079,6 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, "requires": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -14289,7 +15089,6 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, "requires": { "color-name": "1.1.3" } @@ -14297,26 +15096,22 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "requires": { "has-flag": "^3.0.0" } @@ -15457,6 +16252,46 @@ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e.tgz", "integrity": "sha512-owZqbY/wucbr65bXJ/ljrHPgQU5xXTSkmcE/JcbqE1kusuAXV/TLN3/exmz21SZ5rJ7WDkyk70J2G/n68iogbQ==" }, + "@puppeteer/browsers": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.8.0.tgz", + "integrity": "sha512-TkRHIV6k2D8OlUe8RtG+5jgOF/H98Myx0M6AOafC8DdNVOFiBSFa5cpRDtpm8LXOa9sVwe0+e6Q3FC56X/DZfg==", + "requires": { + "debug": "4.3.4", + "extract-zip": "2.0.1", + "progress": "2.0.3", + "proxy-agent": "6.3.1", + "tar-fs": "3.0.4", + "unbzip2-stream": "1.4.3", + "yargs": "17.7.2" + }, + "dependencies": { + "extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + } + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" + } + } + }, "@sendgrid/client": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-7.7.0.tgz", @@ -15599,6 +16434,11 @@ "tslib": "^2.4.0" } }, + "@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==" + }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -16009,6 +16849,15 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, + "@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "optional": true, + "requires": { + "@types/node": "*" + } + }, "@typescript-eslint/eslint-plugin": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.3.0.tgz", @@ -16583,6 +17432,14 @@ "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "optional": true }, + "ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "requires": { + "tslib": "^2.0.1" + } + }, "async-retry": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", @@ -16617,9 +17474,9 @@ "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" }, "aws-sdk": { - "version": "2.1492.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1492.0.tgz", - "integrity": "sha512-3q17ruBkwb3pL87CHSbRlYiwx1LCq7D7hIjHgZ/5SPeKknkXgkHnD20SD2lC8Nj3xGbpIUhoKXcpDAGgIM5DBA==", + "version": "2.1510.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1510.0.tgz", + "integrity": "sha512-XQj3QINBNseA5G9Vaa/iihNz3HCrzeyhxrOUjuH0AVxYqa5Q4cxaQhrWiAiUndtO2F70nfukEYe4cCUoTalUoQ==", "requires": { "buffer": "4.9.2", "events": "1.1.1", @@ -16718,6 +17575,11 @@ } } }, + "b4a": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", + "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==" + }, "babel-jest": { "version": "29.6.2", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.6.2.tgz", @@ -16803,6 +17665,11 @@ "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==" }, + "basic-ftp": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.3.tgz", + "integrity": "sha512-QHX8HLlncOLpy54mh+k/sWIFd0ThmRqwe9ZjELybGZK+tZ8rUb9VO0saKJUROTbE+KhzDUT7xziGpGrW8Kmd+g==" + }, "bcrypt": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.1.0.tgz", @@ -17016,8 +17883,7 @@ "buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", - "optional": true + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==" }, "buffer-equal-constant-time": { "version": "1.0.1", @@ -17124,8 +17990,7 @@ "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" }, "camelcase": { "version": "5.3.1", @@ -17200,6 +18065,15 @@ "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", "dev": true }, + "chromium-bidi": { + "version": "0.4.33", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.33.tgz", + "integrity": "sha512-IxoFM5WGQOIAd95qrSXzJUv4eXIrh+RvU3rwwqIiwYuvfE7U/Llj4fejbsJnjJMUYCuGtVQsY2gv7oGl4aTNSQ==", + "requires": { + "mitt": "3.0.1", + "urlpattern-polyfill": "9.0.0" + } + }, "ci-info": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", @@ -17543,6 +18417,14 @@ "luxon": "^3.2.1" } }, + "cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "requires": { + "node-fetch": "^2.6.12" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -17585,6 +18467,11 @@ "assert-plus": "^1.0.0" } }, + "data-uri-to-buffer": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.1.tgz", + "integrity": "sha512-MZd3VlchQkp8rdend6vrx7MmVDJzSNTBvghvKjirLkD+WTChA3KUf0jkE68Q4UyctNqI11zZO9/x2Yx+ub5Cvg==" + }, "date-fns": { "version": "2.30.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", @@ -17675,6 +18562,16 @@ "object-keys": "^1.1.1" } }, + "degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "requires": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -17711,6 +18608,11 @@ "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", "dev": true }, + "devtools-protocol": { + "version": "0.0.1203626", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1203626.tgz", + "integrity": "sha512-nEzHZteIUZfGCZtTiS1fRpC8UZmsfD1SiyPvaUNvS13dvKf666OAm8YTi0+Ca3n1nLEyu49Cy4+dPWpaHFJk9g==" + }, "dezalgo": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", @@ -17846,7 +18748,6 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "requires": { "once": "^1.4.0" } @@ -17906,7 +18807,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, "requires": { "is-arrayish": "^0.2.1" } @@ -18061,6 +18961,25 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, + "escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "requires": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "optional": true + } + } + }, "eslint": { "version": "8.47.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz", @@ -18423,8 +19342,7 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esquery": { "version": "1.5.0", @@ -18447,14 +19365,12 @@ "estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" }, "esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" }, "etag": { "version": "1.8.1", @@ -18685,6 +19601,11 @@ "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", "dev": true }, + "fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==" + }, "fast-glob": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", @@ -18737,7 +19658,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", - "optional": true, "requires": { "pend": "~1.2.0" } @@ -19084,6 +20004,42 @@ "get-intrinsic": "^1.1.1" } }, + "get-uri": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.2.tgz", + "integrity": "sha512-5KLucCJobh8vBY1K07EFV4+cPZH3mrV9YeAruUseCQKHB58SGjjT2l9/eA9LD082IiuMjSlFJEcdJ27TXvbZNw==", + "requires": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.0", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + } + } + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -19180,6 +20136,25 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -19298,6 +20273,11 @@ "phantomjs-prebuilt": "^2.1.16" } }, + "html-to-image": { + "version": "1.11.11", + "resolved": "https://registry.npmjs.org/html-to-image/-/html-to-image-1.11.11.tgz", + "integrity": "sha512-9gux8QhvjRO/erSnDPv28noDZcPZmYE7e1vFsBLKLlRlKDSqNJYebj6Qz1TGd5lsRV+X+xYyjCKjuZdABinWjA==" + }, "http_ece": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/http_ece/-/http_ece-1.1.0.tgz", @@ -19318,6 +20298,25 @@ "toidentifier": "1.0.1" } }, + "http-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", + "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "requires": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "dependencies": { + "agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "requires": { + "debug": "^4.3.4" + } + } + } + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -19386,7 +20385,6 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, "requires": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -19477,6 +20475,11 @@ "standard-as-callback": "^2.1.0" } }, + "ip": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", + "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" + }, "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -19504,8 +20507,7 @@ "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" }, "is-bigint": { "version": "1.0.4", @@ -20275,8 +21277,7 @@ "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { "version": "4.1.0", @@ -20300,8 +21301,7 @@ "json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "json-schema": { "version": "0.4.0", @@ -20503,8 +21503,7 @@ "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "lint-staged": { "version": "13.3.0", @@ -21031,6 +22030,11 @@ } } }, + "mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + }, "mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", @@ -21039,6 +22043,11 @@ "minimist": "^1.2.6" } }, + "mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, "moment": { "version": "2.29.4", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", @@ -21135,8 +22144,7 @@ "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, "nestjs-supabase-auth": { "version": "1.0.9", @@ -21149,6 +22157,11 @@ "integrity": "sha512-arinWDc78wPV/EYWMmLYyeMSE5Lae1FHWD/2QpOdTmHaOVqK4PYf19EqZBqT9gbbPugkNW9JAMz3G2WmvSgR/A==", "requires": {} }, + "netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==" + }, "next-tick": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", @@ -21201,6 +22214,160 @@ "integrity": "sha512-YlCCc6Wffkx0kHkmam79GKvDQ6x+QZkMjFGrIMxgFNILFvGSbCp2fCBC55pGTT9gVaz8Na5CLmxt/urtzRv36w==", "optional": true }, + "node-html-to-image": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/node-html-to-image/-/node-html-to-image-4.0.0.tgz", + "integrity": "sha512-lB8fkRleAKG4afJ2Wr7qJzIA5+//ue9OEoz+BMxQsowriGKR8sf4j4lK/pIXKakYwf/3aZHoDUNgOXuJ4HOzYA==", + "requires": { + "handlebars": "4.7.8", + "puppeteer": "21.0.1", + "puppeteer-cluster": "^0.23.0" + }, + "dependencies": { + "@puppeteer/browsers": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.5.0.tgz", + "integrity": "sha512-za318PweGINh5LnHSph7C4xhs0tmRjCD8EPpzcKlw4nzSPhnULj+LTG3+TGefZvW1ti5gjw2JkdQvQsivBeZlg==", + "requires": { + "debug": "4.3.4", + "extract-zip": "2.0.1", + "progress": "2.0.3", + "proxy-agent": "6.3.0", + "tar-fs": "3.0.4", + "unbzip2-stream": "1.4.3", + "yargs": "17.7.1" + } + }, + "agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "requires": { + "debug": "^4.3.4" + } + }, + "chromium-bidi": { + "version": "0.4.20", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.20.tgz", + "integrity": "sha512-ruHgVZFEv00mAQMz1tQjfjdG63jiPWrQPF6HLlX2ucqLqVTJoWngeBEKHaJ6n1swV/HSvgnBNbtTRIlcVyW3Fw==", + "requires": { + "mitt": "3.0.1" + } + }, + "cosmiconfig": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.2.0.tgz", + "integrity": "sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==", + "requires": { + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0" + } + }, + "devtools-protocol": { + "version": "0.0.1147663", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1147663.tgz", + "integrity": "sha512-hyWmRrexdhbZ1tcJUGpO95ivbRhWXz++F4Ko+n21AY5PNln2ovoJw+8ZMNDTtip+CNFQfrtLVh/w4009dXO/eQ==" + }, + "extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + } + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "requires": { + "agent-base": "^7.0.2", + "debug": "4" + } + }, + "lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==" + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" + }, + "proxy-agent": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.0.tgz", + "integrity": "sha512-0LdR757eTj/JfuU7TL2YCuAZnxWXu3tkJbg4Oq3geW/qFNT/32T0sp2HnZ9O0lMR4q3vwAt0+xCA8SR0WAD0og==", + "requires": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.1" + } + }, + "puppeteer": { + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-21.0.1.tgz", + "integrity": "sha512-KTjmSdPZ6bMkq3EbAzAUhcB3gMDXvdwd6912rxG9hNtjwRJzHSA568vh6vIbO2WQeNmozRdt1LtiUMLSWfeMrg==", + "requires": { + "@puppeteer/browsers": "1.5.0", + "cosmiconfig": "8.2.0", + "puppeteer-core": "21.0.1" + } + }, + "puppeteer-core": { + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-21.0.1.tgz", + "integrity": "sha512-E8eWLGhaZZpa7dYe/58qGX7SLb4mTg42NP5M7B+ibPrncgNjTOQa9x1sFIlTn1chF/BmoZqOcMIvwuxcb/9XzQ==", + "requires": { + "@puppeteer/browsers": "1.5.0", + "chromium-bidi": "0.4.20", + "cross-fetch": "4.0.0", + "debug": "4.3.4", + "devtools-protocol": "0.0.1147663", + "ws": "8.13.0" + } + }, + "ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "requires": {} + }, + "yargs": { + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + } + } + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -21427,6 +22594,50 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, + "pac-proxy-agent": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.1.tgz", + "integrity": "sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==", + "requires": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "pac-resolver": "^7.0.0", + "socks-proxy-agent": "^8.0.2" + }, + "dependencies": { + "agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "requires": { + "debug": "^4.3.4" + } + }, + "https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "requires": { + "agent-base": "^7.0.2", + "debug": "4" + } + } + } + }, + "pac-resolver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.0.tgz", + "integrity": "sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==", + "requires": { + "degenerator": "^5.0.0", + "ip": "^1.1.8", + "netmask": "^2.0.2" + } + }, "packet-reader": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", @@ -21446,7 +22657,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, "requires": { "callsites": "^3.0.0" } @@ -21455,7 +22665,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -21569,8 +22778,7 @@ "path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" }, "pause": { "version": "0.0.1", @@ -21591,8 +22799,7 @@ "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "optional": true + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==" }, "performance-now": { "version": "2.1.0", @@ -21920,11 +23127,49 @@ "ipaddr.js": "1.9.1" } }, + "proxy-agent": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.1.tgz", + "integrity": "sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==", + "requires": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.1", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.2" + }, + "dependencies": { + "agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "requires": { + "debug": "^4.3.4" + } + }, + "https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "requires": { + "agent-base": "^7.0.2", + "debug": "4" + } + }, + "lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==" + } + } + }, "proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "peer": true + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "pseudomap": { "version": "1.0.2", @@ -21941,7 +23186,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -21953,6 +23197,58 @@ "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "devOptional": true }, + "puppeteer": { + "version": "21.5.2", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-21.5.2.tgz", + "integrity": "sha512-BaAGJOq8Fl6/cck6obmwaNLksuY0Bg/lIahCLhJPGXBFUD2mCffypa4A592MaWnDcye7eaHmSK9yot0pxctY8A==", + "requires": { + "@puppeteer/browsers": "1.8.0", + "cosmiconfig": "8.3.6", + "puppeteer-core": "21.5.2" + }, + "dependencies": { + "cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "requires": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + } + } + } + }, + "puppeteer-cluster": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/puppeteer-cluster/-/puppeteer-cluster-0.23.0.tgz", + "integrity": "sha512-108terIWDzPrQopmoYSPd5yDoy3FGJ2dNnoGMkGYPs6xtkdhgaECwpfZkzaRToMQPZibUOz0/dSSGgPEdXEhkQ==", + "requires": { + "debug": "^4.3.3" + } + }, + "puppeteer-core": { + "version": "21.5.2", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-21.5.2.tgz", + "integrity": "sha512-v4T0cWnujSKs+iEfmb8ccd7u4/x8oblEyKqplqKnJ582Kw8PewYAWvkH4qUWhitN3O2q9RF7dzkvjyK5HbzjLA==", + "requires": { + "@puppeteer/browsers": "1.8.0", + "chromium-bidi": "0.4.33", + "cross-fetch": "4.0.0", + "debug": "4.3.4", + "devtools-protocol": "0.0.1203626", + "ws": "8.14.2" + }, + "dependencies": { + "ws": { + "version": "8.14.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", + "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", + "requires": {} + } + } + }, "pure-rand": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", @@ -22076,6 +23372,11 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -22317,8 +23618,7 @@ "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" }, "resolve.exports": { "version": "2.0.2", @@ -22618,6 +23918,11 @@ } } }, + "smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" + }, "socket.io": { "version": "4.7.1", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.1.tgz", @@ -22660,6 +23965,42 @@ "debug": "~4.3.1" } }, + "socks": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", + "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "requires": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, + "dependencies": { + "ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + } + } + }, + "socks-proxy-agent": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.2.tgz", + "integrity": "sha512-8zuqoLv1aP/66PHF5TqwJ7Czm3Yv32urJQHrVyhD7mmA6d61Zv8cIXQYPTWwmg6qlupnPvs/QKDmfa4P/qct2g==", + "requires": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "socks": "^2.7.1" + }, + "dependencies": { + "agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "requires": { + "debug": "^4.3.4" + } + } + } + }, "source-map": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", @@ -22766,6 +24107,15 @@ "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" }, + "streamx": { + "version": "2.15.5", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.5.tgz", + "integrity": "sha512-9thPGMkKC2GctCzyCUjME3yR03x2xNo0GPKGkRw2UMYN+gqWa9uqpyNWhmsNCutU5zHmkUum0LsCRQTXUgUCAg==", + "requires": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -23024,6 +24374,26 @@ } } }, + "tar-fs": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz", + "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==", + "requires": { + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + } + }, + "tar-stream": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz", + "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==", + "requires": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, "terser": { "version": "5.19.2", "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz", @@ -23121,8 +24491,7 @@ "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, "tiny-inflate": { "version": "1.0.3", @@ -23469,6 +24838,12 @@ "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "devOptional": true }, + "uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "optional": true + }, "uid": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", @@ -23489,6 +24864,26 @@ "which-boxed-primitive": "^1.0.2" } }, + "unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "requires": { + "buffer": "^5.2.1", + "through": "^2.3.8" + }, + "dependencies": { + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + } + } + }, "unfetch": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", @@ -23580,6 +24975,11 @@ "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" }, + "urlpattern-polyfill": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-9.0.0.tgz", + "integrity": "sha512-WHN8KDQblxd32odxeIgo83rdVDE2bvdkb86it7bMhYZwWKJz0+O0RK/eZiHYnM+zgt/U7hAHOlCQGfjjvSkw2g==" + }, "urlsafe-base64": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/urlsafe-base64/-/urlsafe-base64-1.0.0.tgz", @@ -23964,6 +25364,11 @@ } } }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" + }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -24071,7 +25476,6 @@ "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", - "optional": true, "requires": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" diff --git a/package.json b/package.json index 426b0aef1..f50840e2e 100755 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "@types/pdfkit": "^0.12.6", "async-retry": "^1.3.3", "auth0-js": "^9.22.1", - "aws-sdk": "^2.1492.0", + "aws-sdk": "^2.1510.0", "bcrypt": "^5.1.0", "blob-stream": "^0.1.3", "body-parser": "^1.20.1", From fb3e4903b78daf91faf11bd84469cb1f4192832c Mon Sep 17 00:00:00 2001 From: Moulika Kulkarni Date: Mon, 4 Dec 2023 19:52:14 +0530 Subject: [PATCH 12/51] refactor: API-response-refactor Signed-off-by: Moulika Kulkarni --- libs/user-activity/repositories/index.ts | 2 +- libs/user-activity/src/user-activity.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/user-activity/repositories/index.ts b/libs/user-activity/repositories/index.ts index dd66d72f3..c0a3d730e 100644 --- a/libs/user-activity/repositories/index.ts +++ b/libs/user-activity/repositories/index.ts @@ -23,7 +23,7 @@ export class UserActivityRepository { } - async getRecentActivities(userId: string, limit: number): Promise { + async getRecentActivities(userId: string, limit: number): Promise { return this.prisma.user_activity.findMany({ where: { userId diff --git a/libs/user-activity/src/user-activity.service.ts b/libs/user-activity/src/user-activity.service.ts index 76ec86c49..74f4f193d 100644 --- a/libs/user-activity/src/user-activity.service.ts +++ b/libs/user-activity/src/user-activity.service.ts @@ -15,7 +15,7 @@ export class UserActivityService { return this.userActivityRepository.logActivity(userId, orgId, action, details); } - async getUserActivity(userId: string, limit: number): Promise { + async getUserActivity(userId: string, limit: number): Promise { return this.userActivityRepository.getRecentActivities(userId, limit); } } From da1f27382012bf09a35ae1023b5a8cabaae54626 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Tue, 5 Dec 2023 11:22:34 +0530 Subject: [PATCH 13/51] refactor: get API of fetch all connection Signed-off-by: bhavanakarwade --- .../src/connection/connection.controller.ts | 115 ++++++++++++----- .../src/connection/connection.service.ts | 12 +- apps/connection/src/connection.controller.ts | 13 +- apps/connection/src/connection.repository.ts | 14 +++ apps/connection/src/connection.service.ts | 116 ++++++++++-------- .../src/interfaces/connection.interfaces.ts | 12 +- .../migration.sql | 11 ++ libs/prisma-service/prisma/schema.prisma | 2 +- 8 files changed, 199 insertions(+), 96 deletions(-) create mode 100644 libs/prisma-service/prisma/migrations/20231204142322_connection_their_label_credentials_schema_id/migration.sql diff --git a/apps/api-gateway/src/connection/connection.controller.ts b/apps/api-gateway/src/connection/connection.controller.ts index 8c598a292..f7fa74499 100644 --- a/apps/api-gateway/src/connection/connection.controller.ts +++ b/apps/api-gateway/src/connection/connection.controller.ts @@ -1,8 +1,8 @@ import IResponseType from '@credebl/common/interfaces/response.interface'; import { ResponseMessages } from '@credebl/common/response-messages'; -import { Controller, Logger, Post, Body, UseGuards, HttpStatus, Res, Get, Param, Query, UseFilters } from '@nestjs/common'; +import { Controller, Logger, Post, Body, UseGuards, HttpStatus, Res, Get, Param, UseFilters } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; -import { ApiBearerAuth, ApiExcludeEndpoint, ApiForbiddenResponse, ApiOperation, ApiQuery, ApiResponse, ApiTags, ApiUnauthorizedResponse } from '@nestjs/swagger'; +import { ApiBearerAuth, ApiExcludeEndpoint, ApiForbiddenResponse, ApiOperation, ApiResponse, ApiTags, ApiUnauthorizedResponse } from '@nestjs/swagger'; import { User } from '../authz/decorators/user.decorator'; import { AuthTokenResponse } from '../authz/dtos/auth-token-res.dto'; import { ForbiddenErrorDto } from '../dtos/forbidden-error.dto'; @@ -11,7 +11,7 @@ import { ConnectionService } from './connection.service'; import { ConnectionDto, CreateConnectionDto } from './dtos/connection.dto'; import { IUserRequestInterface } from './interfaces'; import { Response } from 'express'; -import { Connections } from './enums/connections.enum'; +// import { Connections } from './enums/connections.enum'; import { IUserRequest } from '@credebl/user-request/user-request.interface'; import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler'; import { OrgRoles } from 'libs/org-roles/enums'; @@ -70,6 +70,86 @@ export class ConnectionController { * @param orgId * */ + // @Get('/orgs/:orgId/connections') + // @UseGuards(AuthGuard('jwt'), OrgRolesGuard) + // @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER) + // @ApiOperation({ + // summary: `Fetch all connection details`, + // description: `Fetch all connection details` + // }) + // @ApiResponse({ status: 200, description: 'Success', type: AuthTokenResponse }) + // @ApiQuery( + // { name: 'outOfBandId', required: false } + // ) + // @ApiQuery( + // { name: 'alias', required: false } + // ) + // @ApiQuery( + // { name: 'state', enum: Connections, required: false } + // ) + // @ApiQuery( + // { name: 'myDid', required: false } + // ) + // @ApiQuery( + // { name: 'theirDid', required: false } + // ) + // @ApiQuery( + // { name: 'theirLabel', required: false } + // ) + // async getConnections( + // @User() user: IUserRequest, + // @Query('outOfBandId') outOfBandId: string, + // @Query('alias') alias: string, + // @Query('state') state: string, + // @Query('myDid') myDid: string, + // @Query('theirDid') theirDid: string, + // @Query('theirLabel') theirLabel: string, + // @Param('orgId') orgId: string, + // @Res() res: Response + // ): Promise { + + // // eslint-disable-next-line no-param-reassign + // state = state || undefined; + // const connectionDetails = await this.connectionService.getConnections(user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId); + + // const finalResponse: IResponseType = { + // statusCode: HttpStatus.OK, + // message: ResponseMessages.connection.success.fetch, + // data: connectionDetails.response + // }; + // return res.status(HttpStatus.OK).json(finalResponse); + // } + + // /** + // * Create out-of-band connection legacy invitation + // * @param connectionDto + // * @param res + // * @returns Created out-of-band connection invitation url + // */ + // @Post('/orgs/:orgId/connections') + // @ApiOperation({ summary: 'Create outbound out-of-band connection (Legacy Invitation)', description: 'Create outbound out-of-band connection (Legacy Invitation)' }) + // @UseGuards(AuthGuard('jwt'), OrgRolesGuard) + // @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER) + // @ApiResponse({ status: 201, description: 'Success', type: AuthTokenResponse }) + // async createLegacyConnectionInvitation( + // @Param('orgId') orgId: string, + // @Body() connectionDto: CreateConnectionDto, + // @User() reqUser: IUserRequestInterface, + // @Res() res: Response + // ): Promise { + + // connectionDto.orgId = orgId; + // const connectionData = await this.connectionService.createLegacyConnectionInvitation(connectionDto, reqUser); + // const finalResponse: IResponseType = { + // statusCode: HttpStatus.CREATED, + // message: ResponseMessages.connection.success.create, + // data: connectionData.response + // }; + // return res.status(HttpStatus.CREATED).json(finalResponse); + + // } + + @Get('/orgs/:orgId/connections') @UseGuards(AuthGuard('jwt'), OrgRolesGuard) @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER) @@ -78,39 +158,13 @@ export class ConnectionController { description: `Fetch all connection details` }) @ApiResponse({ status: 200, description: 'Success', type: AuthTokenResponse }) - @ApiQuery( - { name: 'outOfBandId', required: false } - ) - @ApiQuery( - { name: 'alias', required: false } - ) - @ApiQuery( - { name: 'state', enum: Connections, required: false } - ) - @ApiQuery( - { name: 'myDid', required: false } - ) - @ApiQuery( - { name: 'theirDid', required: false } - ) - @ApiQuery( - { name: 'theirLabel', required: false } - ) async getConnections( @User() user: IUserRequest, - @Query('outOfBandId') outOfBandId: string, - @Query('alias') alias: string, - @Query('state') state: string, - @Query('myDid') myDid: string, - @Query('theirDid') theirDid: string, - @Query('theirLabel') theirLabel: string, @Param('orgId') orgId: string, @Res() res: Response ): Promise { - // eslint-disable-next-line no-param-reassign - state = state || undefined; - const connectionDetails = await this.connectionService.getConnections(user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId); + const connectionDetails = await this.connectionService.getConnections(user, orgId); const finalResponse: IResponseType = { statusCode: HttpStatus.OK, @@ -149,6 +203,7 @@ export class ConnectionController { } + /** * Catch connection webhook responses. * @Body connectionDto diff --git a/apps/api-gateway/src/connection/connection.service.ts b/apps/api-gateway/src/connection/connection.service.ts index 702556404..628794332 100644 --- a/apps/api-gateway/src/connection/connection.service.ts +++ b/apps/api-gateway/src/connection/connection.service.ts @@ -47,13 +47,21 @@ export class ConnectionService extends BaseService { } } - getConnections(user: IUserRequest, outOfBandId: string, alias: string, state: string, myDid: string, theirDid: string, theirLabel: string, orgId: string): Promise<{ + // getConnections(user: IUserRequest, outOfBandId: string, alias: string, state: string, myDid: string, theirDid: string, theirLabel: string, orgId: string): Promise<{ + // response: object; + // }> { + // const payload = { user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId }; + // return this.sendNats(this.connectionServiceProxy, 'get-all-connections', payload); + // } + + getConnections(user: IUserRequest, orgId: string): Promise<{ response: object; }> { - const payload = { user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId }; + const payload = { user, orgId }; return this.sendNats(this.connectionServiceProxy, 'get-all-connections', payload); } + getConnectionsById(user: IUserRequest, connectionId: string, orgId: string): Promise<{ response: object; }> { diff --git a/apps/connection/src/connection.controller.ts b/apps/connection/src/connection.controller.ts index 073547e5e..df69fd203 100644 --- a/apps/connection/src/connection.controller.ts +++ b/apps/connection/src/connection.controller.ts @@ -40,12 +40,19 @@ export class ConnectionController { return this.connectionService.getUrl(payload.referenceId); } + // @MessagePattern({ cmd: 'get-all-connections' }) + // async getConnections(payload: IFetchConnectionInterface): Promise { + // const { user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId } = payload; + // return this.connectionService.getConnections(user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId); + // } + @MessagePattern({ cmd: 'get-all-connections' }) - async getConnections(payload: IFetchConnectionInterface): Promise { - const { user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId } = payload; - return this.connectionService.getConnections(user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId); + async getConnections(payload: IFetchConnectionInterface): Promise { + const { user, orgId } = payload; + return this.connectionService.getConnections(user, orgId); } + @MessagePattern({ cmd: 'get-all-connections-by-connectionId' }) async getConnectionsById(payload: IFetchConnectionById): Promise { const { user, connectionId, orgId } = payload; diff --git a/apps/connection/src/connection.repository.ts b/apps/connection/src/connection.repository.ts index ccd465581..dac0099aa 100644 --- a/apps/connection/src/connection.repository.ts +++ b/apps/connection/src/connection.repository.ts @@ -3,6 +3,7 @@ import { PrismaService } from '@credebl/prisma-service'; // eslint-disable-next-line camelcase import { agent_invitations, connections, platform_config, shortening_url } from '@prisma/client'; import { OrgAgent } from './interfaces/connection.interfaces'; +import { IUserRequest } from '@credebl/user-request/user-request.interface'; // import { OrgAgent } from './interfaces/connection.interfaces'; @Injectable() export class ConnectionRepository { @@ -186,6 +187,19 @@ export class ConnectionRepository { } } + async getAllConnections(user: IUserRequest, orgId: string): Promise { + try { + const connectionsList = await this.prisma.connections.findMany({ + where: { + orgId + } + }); + return connectionsList; + } catch (error) { + this.logger.error(`[getConnectionDetails] - error: ${JSON.stringify(error)}`); + throw error; + } + } async getOrgAgentType(orgAgentId: string): Promise { try { diff --git a/apps/connection/src/connection.service.ts b/apps/connection/src/connection.service.ts index 6aec955fa..cbfc93c67 100644 --- a/apps/connection/src/connection.service.ts +++ b/apps/connection/src/connection.service.ts @@ -189,63 +189,71 @@ export class ConnectionService { * * @returns get all connections details */ - async getConnections(user: IUserRequest, outOfBandId: string, alias: string, state: string, myDid: string, theirDid: string, theirLabel: string, orgId: string): Promise { + // async getConnections(user: IUserRequest, outOfBandId: string, alias: string, state: string, myDid: string, theirDid: string, theirLabel: string, orgId: string): Promise { + // try { + // const agentDetails = await this.connectionRepository.getAgentEndPoint(orgId); + // const orgAgentType = await this.connectionRepository.getOrgAgentType(agentDetails?.orgAgentTypeId); + // const platformConfig: platform_config = await this.connectionRepository.getPlatformConfigDetails(); + + // const { agentEndPoint } = agentDetails; + // if (!agentDetails) { + // throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound); + // } + // const params = { + // outOfBandId, + // alias, + // state, + // myDid, + // theirDid, + // theirLabel + // }; + + // let url; + // if (orgAgentType === OrgAgentType.DEDICATED) { + + // url = `${agentEndPoint}${CommonConstants.URL_CONN_GET_CONNECTIONS}`; + + // } else if (orgAgentType === OrgAgentType.SHARED) { + + // url = `${agentEndPoint}${CommonConstants.URL_SHAGENT_GET_CREATEED_INVITATIONS}`.replace('#', agentDetails.tenantId); + // } else { + + // throw new NotFoundException(ResponseMessages.connection.error.agentUrlNotFound); + // } + + // Object.keys(params).forEach((element: string) => { + // const appendParams: string = url.includes('?') ? '&' : '?'; + + // if (params[element] !== undefined) { + // url = `${url + appendParams + element}=${params[element]}`; + // } + // }); + // const apiKey = platformConfig?.sgApiKey; + // const connectionsDetails = await this._getAllConnections(url, apiKey); + // return connectionsDetails?.response; + // } catch (error) { + // this.logger.error(`Error in get url in connection service: ${JSON.stringify(error)}`); + // if (error && error?.status && error?.status?.message && error?.status?.message?.error) { + // throw new RpcException({ + // message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, + // statusCode: error?.status?.code + // }); + + // } else { + // throw new RpcException(error.response ? error.response : error); + // } + // } + // } + + async getConnections(user: IUserRequest, orgId: string): Promise { try { - const agentDetails = await this.connectionRepository.getAgentEndPoint(orgId); - const orgAgentType = await this.connectionRepository.getOrgAgentType(agentDetails?.orgAgentTypeId); - const platformConfig: platform_config = await this.connectionRepository.getPlatformConfigDetails(); - - const { agentEndPoint } = agentDetails; - if (!agentDetails) { - throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound); - } - const params = { - outOfBandId, - alias, - state, - myDid, - theirDid, - theirLabel - }; - - let url; - if (orgAgentType === OrgAgentType.DEDICATED) { - - url = `${agentEndPoint}${CommonConstants.URL_CONN_GET_CONNECTIONS}`; - - } else if (orgAgentType === OrgAgentType.SHARED) { - - url = `${agentEndPoint}${CommonConstants.URL_SHAGENT_GET_CREATEED_INVITATIONS}`.replace('#', agentDetails.tenantId); - } else { - - throw new NotFoundException(ResponseMessages.connection.error.agentUrlNotFound); - } - - Object.keys(params).forEach((element: string) => { - const appendParams: string = url.includes('?') ? '&' : '?'; - - if (params[element] !== undefined) { - url = `${url + appendParams + element}=${params[element]}`; - } - }); - const apiKey = platformConfig?.sgApiKey; - const connectionsDetails = await this._getAllConnections(url, apiKey); - return connectionsDetails?.response; - } catch (error) { - this.logger.error(`Error in get url in connection service: ${JSON.stringify(error)}`); - if (error && error?.status && error?.status?.message && error?.status?.message?.error) { - throw new RpcException({ - message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, - statusCode: error?.status?.code - }); - - } else { - throw new RpcException(error.response ? error.response : error); + const getConnectionList = await this.connectionRepository.getAllConnections(user, orgId); + return getConnectionList; + } catch (error) { + throw new RpcException(`[_getAllConnections] [NATS call]- error in fetch connections details : ${JSON.stringify(error)}`); } } - } - - + async _getAllConnections(url: string, apiKey: string): Promise<{ response: string; }> { diff --git a/apps/connection/src/interfaces/connection.interfaces.ts b/apps/connection/src/interfaces/connection.interfaces.ts index d7b7e802b..bbbd5f6a4 100644 --- a/apps/connection/src/interfaces/connection.interfaces.ts +++ b/apps/connection/src/interfaces/connection.interfaces.ts @@ -67,12 +67,12 @@ export class IConnectionInterface { export class IFetchConnectionInterface { user: IUserRequest; - outOfBandId: string; - alias: string; - state: string; - myDid: string; - theirDid: string; - theirLabel: string; + // outOfBandId: string; + // alias: string; + // state: string; + // myDid: string; + // theirDid: string; + // theirLabel: string; orgId: string; } diff --git a/libs/prisma-service/prisma/migrations/20231204142322_connection_their_label_credentials_schema_id/migration.sql b/libs/prisma-service/prisma/migrations/20231204142322_connection_their_label_credentials_schema_id/migration.sql new file mode 100644 index 000000000..b9b1a6d0c --- /dev/null +++ b/libs/prisma-service/prisma/migrations/20231204142322_connection_their_label_credentials_schema_id/migration.sql @@ -0,0 +1,11 @@ +/* + Warnings: + + - Added the required column `schemaId` to the `credentials` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "connections" ADD COLUMN "theirLabel" TEXT NOT NULL DEFAULT ''; + +-- AlterTable +ALTER TABLE "credentials" ADD COLUMN "schemaId" TEXT NOT NULL DEFAULT ''; diff --git a/libs/prisma-service/prisma/schema.prisma b/libs/prisma-service/prisma/schema.prisma index df1242b70..771f57b74 100644 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -283,7 +283,7 @@ model connections { lastChangedDateTime DateTime @default(now()) @db.Timestamptz(6) lastChangedBy String @db.Uuid connectionId String @unique - theirLabel String + theirLabel String @default("") state String orgId String? @db.Uuid organisation organisation? @relation(fields: [orgId], references: [id]) From 148e978771a56941594de744da801ec3e9cbc379 Mon Sep 17 00:00:00 2001 From: Moulika Kulkarni Date: Tue, 5 Dec 2023 13:00:45 +0530 Subject: [PATCH 14/51] refactor: API-response-refactor Signed-off-by: Moulika Kulkarni --- apps/organization/repositories/organization.repository.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/organization/repositories/organization.repository.ts b/apps/organization/repositories/organization.repository.ts index 50a1a8e57..4249acc55 100644 --- a/apps/organization/repositories/organization.repository.ts +++ b/apps/organization/repositories/organization.repository.ts @@ -400,6 +400,7 @@ export class OrganizationRepository { name: true, description: true, logoUrl: true, + orgSlug: true, userOrgRoles: { select: { id: true, From ff6d8428659ddd261bea07598e403adacd1be50a Mon Sep 17 00:00:00 2001 From: pallavicoder Date: Tue, 5 Dec 2023 15:31:58 +0530 Subject: [PATCH 15/51] refact:added nkeys inside cred-def and schema service Signed-off-by: pallavicoder --- .../credential-definition/credential-definition.module.ts | 6 ++---- apps/ledger/src/schema/schema.module.ts | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/ledger/src/credential-definition/credential-definition.module.ts b/apps/ledger/src/credential-definition/credential-definition.module.ts index 11d80f2e4..035e4d041 100644 --- a/apps/ledger/src/credential-definition/credential-definition.module.ts +++ b/apps/ledger/src/credential-definition/credential-definition.module.ts @@ -7,16 +7,14 @@ import { CredentialDefinitionRepository } from './repositories/credential-defini import { CredentialDefinitionService } from './credential-definition.service'; import { HttpModule } from '@nestjs/axios'; import { PrismaService } from '@credebl/prisma-service'; - +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ ClientsModule.register([ { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions(process.env.CREDENTAILDEFINITION_NKEY_SEED) } ]), HttpModule, diff --git a/apps/ledger/src/schema/schema.module.ts b/apps/ledger/src/schema/schema.module.ts index d4e409750..2d5bacba8 100644 --- a/apps/ledger/src/schema/schema.module.ts +++ b/apps/ledger/src/schema/schema.module.ts @@ -7,16 +7,14 @@ import { SchemaRepository } from './repositories/schema.repository'; import { SchemaService } from './schema.service'; import { HttpModule } from '@nestjs/axios'; import { PrismaService } from '@credebl/prisma-service'; - +import { getNatsOptions } from '@credebl/common/nats.config'; @Module({ imports: [ ClientsModule.register([ { name: 'NATS_CLIENT', transport: Transport.NATS, - options: { - servers: [`${process.env.NATS_URL}`] - } + options: getNatsOptions(process.env.SCHEMA_NKEY_SEED) } ]), From 5b5fe5378819216939aa5cdb6b93e1ab631520f4 Mon Sep 17 00:00:00 2001 From: Moulika Kulkarni Date: Tue, 5 Dec 2023 16:20:52 +0530 Subject: [PATCH 16/51] refactor: API-response-refactor Signed-off-by: Moulika Kulkarni --- apps/ecosystem/src/ecosystem.repository.ts | 80 +++++++++++-------- .../repositories/organization.repository.ts | 49 +++++++++--- apps/organization/src/organization.service.ts | 6 +- 3 files changed, 87 insertions(+), 48 deletions(-) diff --git a/apps/ecosystem/src/ecosystem.repository.ts b/apps/ecosystem/src/ecosystem.repository.ts index 9dc1a3665..65533b9ac 100644 --- a/apps/ecosystem/src/ecosystem.repository.ts +++ b/apps/ecosystem/src/ecosystem.repository.ts @@ -113,7 +113,18 @@ export class EcosystemRepository { * @returns Get all ecosystem details */ // eslint-disable-next-line camelcase - async getAllEcosystemDetails(orgId: string): Promise { + async getAllEcosystemDetails(orgId: string): Promise<{ + ecosystemOrgs: { + ecosystemRole: { + id: string; + name: string; + description: string; + createDateTime: Date; + lastChangedDateTime: Date; + deletedAt: Date; + }; + }[]; + }[]> { try { const ecosystemDetails = await this.prisma.ecosystem.findMany({ where: { @@ -123,12 +134,17 @@ export class EcosystemRepository { } } }, - include: { + select: { + id: true, + name: true, + description: true, + logoUrl: true, + autoEndorsement: true, ecosystemOrgs: { where: { orgId }, - include: { + select: { ecosystemRole: true } } @@ -188,7 +204,7 @@ export class EcosystemRepository { where: { orgId }, - include:{ + include: { ecosystemRole: true } }); @@ -230,21 +246,21 @@ export class EcosystemRepository { } } - // eslint-disable-next-line camelcase - async getSpecificEcosystemConfig(key: string): Promise { - try { - return await this.prisma.ecosystem_config.findFirst( - { - where: { - key - } + // eslint-disable-next-line camelcase + async getSpecificEcosystemConfig(key: string): Promise { + try { + return await this.prisma.ecosystem_config.findFirst( + { + where: { + key } - ); - } catch (error) { - this.logger.error(`error: ${JSON.stringify(error)}`); - throw error; - } + } + ); + } catch (error) { + this.logger.error(`error: ${JSON.stringify(error)}`); + throw error; } + } async getEcosystemMembersCount(ecosystemId: string): Promise { try { @@ -398,7 +414,7 @@ export class EcosystemRepository { // eslint-disable-next-line camelcase ): Promise { try { - + return this.prisma.ecosystem_invitations.create({ data: { email, @@ -466,7 +482,7 @@ export class EcosystemRepository { ecosystem: true, ecosystemRole: true, organisation: { - select:{ + select: { name: true, orgSlug: true, // eslint-disable-next-line camelcase @@ -577,9 +593,9 @@ export class EcosystemRepository { status: true, type: true, ecosystemOrgs: { - include:{ + include: { organisation: { - select:{ + select: { name: true, orgSlug: true } @@ -672,7 +688,7 @@ export class EcosystemRepository { } }); const schemasCount = schemaArray.length; - + this.logger.error(`In error schemaDetails3: ${JSON.stringify(schemasResult)}`); return { schemasCount, schemasResult }; @@ -695,7 +711,7 @@ export class EcosystemRepository { } const agentDetails = await this.prisma.org_agents.findFirst({ where: { - orgId:orgId.toString() + orgId: orgId.toString() } }); return agentDetails; @@ -1079,16 +1095,16 @@ export class EcosystemRepository { async getOrgAgentType(orgAgentId: string): Promise { try { - const { agent } = await this.prisma.org_agents_type.findFirst({ - where: { - id: orgAgentId - } - }); + const { agent } = await this.prisma.org_agents_type.findFirst({ + where: { + id: orgAgentId + } + }); - return agent; + return agent; } catch (error) { - this.logger.error(`[getOrgAgentType] - error: ${JSON.stringify(error)}`); - throw error; + this.logger.error(`[getOrgAgentType] - error: ${JSON.stringify(error)}`); + throw error; } -} + } } diff --git a/apps/organization/repositories/organization.repository.ts b/apps/organization/repositories/organization.repository.ts index 4249acc55..a56b2ec65 100644 --- a/apps/organization/repositories/organization.repository.ts +++ b/apps/organization/repositories/organization.repository.ts @@ -261,26 +261,49 @@ export class OrganizationRepository { } } - async getOrganization(queryObject: object): Promise { + async getOrganization(queryObject: object): Promise { try { return this.prisma.organisation.findFirst({ where: { ...queryObject }, - include: { - schema: true, - org_agents: { - include: { - agents_type: true, - agent_invitations: true, - org_agent_type: true, - ledgers: true + select: { + id: true, + name: true, + description: true, + orgSlug: true, + logoUrl: true, + website: true, + publicProfile: true, + schema: { + select: { + id: true, + name: true } }, - userOrgRoles: { - include: { - user: true, - orgRole: true + org_agents: { + select: { + orgDid: true, + id: true, + walletName: true, + agentSpinUpStatus: true, + agentsTypeId: true, + agent_invitations: { + select: { + id: true, + connectionInvitation: true, + multiUse: true, + createDateTime: true, + lastChangedDateTime:true + } + }, + ledgers: { + select: { + id: true, + name: true, + networkType: true + } + } } } } diff --git a/apps/organization/src/organization.service.ts b/apps/organization/src/organization.service.ts index 37ab5fc68..d5755864e 100644 --- a/apps/organization/src/organization.service.ts +++ b/apps/organization/src/organization.service.ts @@ -181,10 +181,10 @@ export class OrganizationService { } } - async getPublicProfile(payload: { orgSlug: string }): Promise { + async getPublicProfile(payload: { orgSlug: string }): Promise { const { orgSlug } = payload; try { - + const query = { orgSlug, publicProfile: true @@ -195,7 +195,7 @@ export class OrganizationService { throw new NotFoundException(ResponseMessages.organisation.error.profileNotFound); } - const credentials = await this.organizationRepository.getCredDefByOrg(organizationDetails.id); + const credentials = await this.organizationRepository.getCredDefByOrg(organizationDetails['id']); organizationDetails['credential_definitions'] = credentials; return organizationDetails; From 98c602886aff8a2aab0550f701885a905ee5490f Mon Sep 17 00:00:00 2001 From: Moulika Kulkarni Date: Tue, 5 Dec 2023 17:15:57 +0530 Subject: [PATCH 17/51] refactor: API-response-refactor Signed-off-by: Moulika Kulkarni --- apps/organization/repositories/organization.repository.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/organization/repositories/organization.repository.ts b/apps/organization/repositories/organization.repository.ts index a56b2ec65..5e56ceb56 100644 --- a/apps/organization/repositories/organization.repository.ts +++ b/apps/organization/repositories/organization.repository.ts @@ -288,6 +288,8 @@ export class OrganizationRepository { walletName: true, agentSpinUpStatus: true, agentsTypeId: true, + createDateTime: true, + orgAgentTypeId:true, agent_invitations: { select: { id: true, @@ -297,6 +299,7 @@ export class OrganizationRepository { lastChangedDateTime:true } }, + org_agent_type: true, ledgers: { select: { id: true, From 091e054915ce3ce90afbc6f555dd31faa50d7d5d Mon Sep 17 00:00:00 2001 From: Moulika Kulkarni Date: Tue, 5 Dec 2023 18:36:16 +0530 Subject: [PATCH 18/51] refactor: API-response-refactor Signed-off-by: Moulika Kulkarni --- apps/ecosystem/interfaces/ecosystem.interfaces.ts | 13 +++++++++++++ apps/ecosystem/src/ecosystem.repository.ts | 15 ++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/apps/ecosystem/interfaces/ecosystem.interfaces.ts b/apps/ecosystem/interfaces/ecosystem.interfaces.ts index bb3e8b94f..e37bee334 100644 --- a/apps/ecosystem/interfaces/ecosystem.interfaces.ts +++ b/apps/ecosystem/interfaces/ecosystem.interfaces.ts @@ -225,4 +225,17 @@ export interface OrgAgent { orgId: string; orgAgentTypeId: string; ledgerId: string; +} + +export interface EcosystemDetails { + ecosystemOrgs: { + ecosystemRole: { + id: string; + name: string; + description: string; + createDateTime: Date; + lastChangedDateTime: Date; + deletedAt: Date; + }; + }[]; } \ No newline at end of file diff --git a/apps/ecosystem/src/ecosystem.repository.ts b/apps/ecosystem/src/ecosystem.repository.ts index 65533b9ac..a8be10f59 100644 --- a/apps/ecosystem/src/ecosystem.repository.ts +++ b/apps/ecosystem/src/ecosystem.repository.ts @@ -4,7 +4,7 @@ import { PrismaService } from '@credebl/prisma-service'; import { credential_definition, ecosystem, ecosystem_config, ecosystem_invitations, ecosystem_orgs, ecosystem_roles, endorsement_transaction, org_agents, platform_config, schema } from '@prisma/client'; import { DeploymentModeType, EcosystemInvitationStatus, EcosystemOrgStatus, EcosystemRoles, endorsementTransactionStatus, endorsementTransactionType } from '../enums/ecosystem.enum'; import { updateEcosystemOrgsDto } from '../dtos/update-ecosystemOrgs.dto'; -import { SaveSchema, SchemaTransactionResponse, saveCredDef } from '../interfaces/ecosystem.interfaces'; +import { EcosystemDetails, SaveSchema, SchemaTransactionResponse, saveCredDef } from '../interfaces/ecosystem.interfaces'; import { ResponseMessages } from '@credebl/common/response-messages'; import { NotFoundException } from '@nestjs/common'; import { CommonConstants } from '@credebl/common/common.constant'; @@ -113,18 +113,7 @@ export class EcosystemRepository { * @returns Get all ecosystem details */ // eslint-disable-next-line camelcase - async getAllEcosystemDetails(orgId: string): Promise<{ - ecosystemOrgs: { - ecosystemRole: { - id: string; - name: string; - description: string; - createDateTime: Date; - lastChangedDateTime: Date; - deletedAt: Date; - }; - }[]; - }[]> { + async getAllEcosystemDetails(orgId: string): Promise { try { const ecosystemDetails = await this.prisma.ecosystem.findMany({ where: { From fd8ed5021f917fb9e3390afa34c6e2ce789c2adb Mon Sep 17 00:00:00 2001 From: pallavicoder Date: Tue, 5 Dec 2023 19:27:09 +0530 Subject: [PATCH 19/51] chore:removed commented code Signed-off-by: pallavicoder --- docker-compose.yml | 152 ++++++++++++++++++++++++++++++--- libs/common/src/nats.config.ts | 8 -- libs/service/nats.options.ts | 2 - 3 files changed, 141 insertions(+), 21 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7473ec329..b05c9ab25 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,142 @@ -version: '3.3' +version: '3' + services: - nats: - container_name: nats-server - ports: - - - '4222:4222' - - volumes: - - './nats-server.conf:/nats-server.conf' - restart: unless-stopped - image: nats \ No newline at end of file + nats: + container_name: nats + entrypoint: '/nats-server -c /nats-server.conf -DV' # Corrected the path to nats-server.conf + image: nats + ports: + - '4222:4222' + - '6222:6222' + - '8222:8222' + # volumes: + # - ./nats-server.conf:/nats-server.conf # Mount the config file + redis: + image: redis:6.2-alpine + restart: always + ports: + - '6379:6379' + command: redis-server --save 20 1 --loglevel warning + volumes: + - cache:/data + api-gateway: + depends_on: + - nats # Use depends_on instead of needs + - redis + build: + context: ./ # Adjust the context path as needed + dockerfile: Dockerfiles/Dockerfile.api-gateway + ports: + - '5000:5000' + env_file: + - ./.env + user: + depends_on: + - nats # Use depends_on instead of needs + - api-gateway + build: + context: ./ # Adjust the context path as needed + dockerfile: Dockerfiles/Dockerfile.user + env_file: + - ./.env + connection: + depends_on: + - nats # Use depends_on instead of needs + - api-gateway + - user + build: + context: ./ # Adjust the context path as needed + dockerfile: Dockerfiles/Dockerfile.connection + env_file: + - ./.env + issuance: + depends_on: + - nats # Use depends_on instead of needs + - api-gateway + - user + - connection + build: + context: ./ # Adjust the context path as needed + dockerfile: Dockerfiles/Dockerfile.issuance + env_file: + - ./.env + ledger: + depends_on: + - nats # Use depends_on instead of needs + - api-gateway + - user + - connection + - issuance + build: + context: ./ # Adjust the context path as needed + dockerfile: Dockerfiles/Dockerfile.ledger + env_file: + - ./.env + organization: + depends_on: + - nats # Use depends_on instead of needs + - api-gateway + - user + - connection + - issuance + - ledger + build: + context: ./ # Adjust the context path as needed + dockerfile: Dockerfiles/Dockerfile.organization + env_file: + - ./.env + verification: + depends_on: + - nats # Use depends_on instead of needs + - api-gateway + - user + - connection + - issuance + - ledger + - organization + build: + context: ./ # Adjust the context path as needed + dockerfile: Dockerfiles/Dockerfile.verification + env_file: + - ./.env + agent-provisioning: + depends_on: + - nats # Use depends_on instead of needs + - api-gateway + - user + - connection + - issuance + - ledger + - organization + - verification + build: + context: ./ # Adjust the context path as needed + dockerfile: Dockerfiles/Dockerfile.agnet-provisioning + env_file: + - ./.env + agent-service: + depends_on: + - nats # Use depends_on instead of needs + - api-gateway + - user + - connection + - issuance + - ledger + - organization + - verification + - agent-provisioning + build: + context: ./ # Adjust the context path as needed + dockerfile: Dockerfiles/Dockerfile.agent-service + env_file: + - ./.env + + + + + + + +volumes: + cache: + driver: local \ No newline at end of file diff --git a/libs/common/src/nats.config.ts b/libs/common/src/nats.config.ts index a5feb9b60..3af2b867f 100644 --- a/libs/common/src/nats.config.ts +++ b/libs/common/src/nats.config.ts @@ -1,13 +1,5 @@ import { Authenticator, nkeyAuthenticator } from 'nats'; -// export const getNatsOptions = (): { -// servers: string[]; -// authenticator: Authenticator; -// } => ({ -// servers: [`${process.env.NATS_URL}`], -// authenticator: nkeyAuthenticator(new TextEncoder().encode(process.env.NKEY_SEED)) -// }); - export const getNatsOptions = ( nkeySeed?: string ): { diff --git a/libs/service/nats.options.ts b/libs/service/nats.options.ts index de86d0ecb..6051ec0f3 100644 --- a/libs/service/nats.options.ts +++ b/libs/service/nats.options.ts @@ -1,13 +1,11 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ import { NatsOptions, Transport } from '@nestjs/microservices'; -// import { nkeyAuthenticator } from 'nats'; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export const commonNatsOptions = (name: string, isClient = true) => { const common: NatsOptions = { transport: Transport.NATS, options: { url: `nats://${process.env.NATS_HOST}:${process.env.NATS_PORT}`, - // authenticator: nkeyAuthenticator(new TextEncoder().encode('SUADBTFIXH3YRTN3HR33SKP7SWEGW62MAXHCXPIAJHPVVUOVDLU3TPA53M')), name, maxReconnectAttempts: -1, reconnectTimeWait: 3000 From 00234698e758f460ce746bf52cd91644b1da36a0 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Tue, 5 Dec 2023 23:58:48 +0530 Subject: [PATCH 20/51] feat: added pagination and sorting features Signed-off-by: bhavanakarwade --- .../src/connection/connection.controller.ts | 122 +-- .../src/connection/connection.service.ts | 117 ++- .../src/connection/dtos/connection.dto.ts | 5 +- .../dtos/get-all-connections.dto.ts | 27 + .../src/interfaces/ISchemaSearch.interface.ts | 10 +- .../dtos/get-all-issued-credentials.dto.ts | 27 + .../src/issuance/dtos/issuance.dto.ts | 8 + .../src/issuance/interfaces/index.ts | 9 + .../src/issuance/issuance.controller.ts | 150 ++- .../src/issuance/issuance.service.ts | 14 +- .../dto/get-all-proof-requests.dto.ts | 27 + .../src/verification/dto/webhook-proof.dto.ts | 4 + .../interfaces/verification.interface.ts | 13 +- .../verification/verification.controller.ts | 107 +- .../src/verification/verification.service.ts | 10 +- apps/connection/src/connection.controller.ts | 52 +- apps/connection/src/connection.repository.ts | 419 ++++---- apps/connection/src/connection.service.ts | 320 +++--- .../src/interfaces/connection.interfaces.ts | 41 +- .../interfaces/issuance.interfaces.ts | 171 ++-- apps/issuance/src/issuance.controller.ts | 15 +- apps/issuance/src/issuance.repository.ts | 961 ++++++++++-------- apps/issuance/src/issuance.service.ts | 141 ++- .../src/interfaces/verification.interface.ts | 26 + .../repositories/verification.repository.ts | 303 ++++-- .../src/verification.controller.ts | 16 +- apps/verification/src/verification.service.ts | 116 ++- 27 files changed, 1985 insertions(+), 1246 deletions(-) create mode 100644 apps/api-gateway/src/connection/dtos/get-all-connections.dto.ts create mode 100644 apps/api-gateway/src/issuance/dtos/get-all-issued-credentials.dto.ts create mode 100644 apps/api-gateway/src/verification/dto/get-all-proof-requests.dto.ts diff --git a/apps/api-gateway/src/connection/connection.controller.ts b/apps/api-gateway/src/connection/connection.controller.ts index f7fa74499..3f0cebe30 100644 --- a/apps/api-gateway/src/connection/connection.controller.ts +++ b/apps/api-gateway/src/connection/connection.controller.ts @@ -1,8 +1,8 @@ import IResponseType from '@credebl/common/interfaces/response.interface'; import { ResponseMessages } from '@credebl/common/response-messages'; -import { Controller, Logger, Post, Body, UseGuards, HttpStatus, Res, Get, Param, UseFilters } from '@nestjs/common'; +import { Controller, Logger, Post, Body, UseGuards, HttpStatus, Res, Get, Param, UseFilters, Query } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; -import { ApiBearerAuth, ApiExcludeEndpoint, ApiForbiddenResponse, ApiOperation, ApiResponse, ApiTags, ApiUnauthorizedResponse } from '@nestjs/swagger'; +import { ApiBearerAuth, ApiExcludeEndpoint, ApiForbiddenResponse, ApiOperation, ApiQuery, ApiResponse, ApiTags, ApiUnauthorizedResponse } from '@nestjs/swagger'; import { User } from '../authz/decorators/user.decorator'; import { AuthTokenResponse } from '../authz/dtos/auth-token-res.dto'; import { ForbiddenErrorDto } from '../dtos/forbidden-error.dto'; @@ -17,6 +17,8 @@ import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler import { OrgRoles } from 'libs/org-roles/enums'; import { Roles } from '../authz/decorators/roles.decorator'; import { OrgRolesGuard } from '../authz/guards/org-roles.guard'; +import { GetAllConnectionsDto } from './dtos/get-all-connections.dto'; +import { IConnectionSearchinterface } from '../interfaces/ISchemaSearch.interface'; @UseFilters(CustomExceptionFilter) @Controller() @@ -70,86 +72,6 @@ export class ConnectionController { * @param orgId * */ - // @Get('/orgs/:orgId/connections') - // @UseGuards(AuthGuard('jwt'), OrgRolesGuard) - // @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER) - // @ApiOperation({ - // summary: `Fetch all connection details`, - // description: `Fetch all connection details` - // }) - // @ApiResponse({ status: 200, description: 'Success', type: AuthTokenResponse }) - // @ApiQuery( - // { name: 'outOfBandId', required: false } - // ) - // @ApiQuery( - // { name: 'alias', required: false } - // ) - // @ApiQuery( - // { name: 'state', enum: Connections, required: false } - // ) - // @ApiQuery( - // { name: 'myDid', required: false } - // ) - // @ApiQuery( - // { name: 'theirDid', required: false } - // ) - // @ApiQuery( - // { name: 'theirLabel', required: false } - // ) - // async getConnections( - // @User() user: IUserRequest, - // @Query('outOfBandId') outOfBandId: string, - // @Query('alias') alias: string, - // @Query('state') state: string, - // @Query('myDid') myDid: string, - // @Query('theirDid') theirDid: string, - // @Query('theirLabel') theirLabel: string, - // @Param('orgId') orgId: string, - // @Res() res: Response - // ): Promise { - - // // eslint-disable-next-line no-param-reassign - // state = state || undefined; - // const connectionDetails = await this.connectionService.getConnections(user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId); - - // const finalResponse: IResponseType = { - // statusCode: HttpStatus.OK, - // message: ResponseMessages.connection.success.fetch, - // data: connectionDetails.response - // }; - // return res.status(HttpStatus.OK).json(finalResponse); - // } - - // /** - // * Create out-of-band connection legacy invitation - // * @param connectionDto - // * @param res - // * @returns Created out-of-band connection invitation url - // */ - // @Post('/orgs/:orgId/connections') - // @ApiOperation({ summary: 'Create outbound out-of-band connection (Legacy Invitation)', description: 'Create outbound out-of-band connection (Legacy Invitation)' }) - // @UseGuards(AuthGuard('jwt'), OrgRolesGuard) - // @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER) - // @ApiResponse({ status: 201, description: 'Success', type: AuthTokenResponse }) - // async createLegacyConnectionInvitation( - // @Param('orgId') orgId: string, - // @Body() connectionDto: CreateConnectionDto, - // @User() reqUser: IUserRequestInterface, - // @Res() res: Response - // ): Promise { - - // connectionDto.orgId = orgId; - // const connectionData = await this.connectionService.createLegacyConnectionInvitation(connectionDto, reqUser); - // const finalResponse: IResponseType = { - // statusCode: HttpStatus.CREATED, - // message: ResponseMessages.connection.success.create, - // data: connectionData.response - // }; - // return res.status(HttpStatus.CREATED).json(finalResponse); - - // } - - @Get('/orgs/:orgId/connections') @UseGuards(AuthGuard('jwt'), OrgRolesGuard) @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER) @@ -157,14 +79,48 @@ export class ConnectionController { summary: `Fetch all connection details`, description: `Fetch all connection details` }) + @ApiQuery({ + name: 'pageNumber', + type: Number, + required: false + }) + @ApiQuery({ + name: 'searchByText', + type: String, + required: false + }) + @ApiQuery({ + name: 'pageSize', + type: Number, + required: false + }) + @ApiQuery({ + name: 'sorting', + type: String, + required: false + }) + @ApiQuery({ + name: 'sortByValue', + type: String, + required: false + }) @ApiResponse({ status: 200, description: 'Success', type: AuthTokenResponse }) async getConnections( + @Query() getAllConnectionsDto: GetAllConnectionsDto, @User() user: IUserRequest, @Param('orgId') orgId: string, @Res() res: Response ): Promise { - const connectionDetails = await this.connectionService.getConnections(user, orgId); + const { pageSize, searchByText, pageNumber, sorting, sortByValue } = getAllConnectionsDto; + const connectionSearchCriteria: IConnectionSearchinterface = { + pageNumber, + searchByText, + pageSize, + sorting, + sortByValue + }; + const connectionDetails = await this.connectionService.getConnections(connectionSearchCriteria, user, orgId); const finalResponse: IResponseType = { statusCode: HttpStatus.OK, diff --git a/apps/api-gateway/src/connection/connection.service.ts b/apps/api-gateway/src/connection/connection.service.ts index 628794332..214a5c013 100644 --- a/apps/api-gateway/src/connection/connection.service.ts +++ b/apps/api-gateway/src/connection/connection.service.ts @@ -4,68 +4,77 @@ import { ClientProxy, RpcException } from '@nestjs/microservices'; import { BaseService } from 'libs/service/base.service'; import { ConnectionDto, CreateConnectionDto } from './dtos/connection.dto'; import { IUserRequestInterface } from './interfaces'; - +import { IConnectionSearchinterface } from '../interfaces/ISchemaSearch.interface'; @Injectable() export class ConnectionService extends BaseService { - constructor( - @Inject('NATS_CLIENT') private readonly connectionServiceProxy: ClientProxy - ) { - super('ConnectionService'); - } - - createLegacyConnectionInvitation(connectionDto: CreateConnectionDto, user: IUserRequestInterface): Promise<{ - response: object; - }> { - try { - - const connectionDetails = { orgId: connectionDto.orgId, alias: connectionDto.alias, label: connectionDto.label, imageUrl: connectionDto.imageUrl, multiUseInvitation: connectionDto.multiUseInvitation, autoAcceptConnection: connectionDto.autoAcceptConnection, user }; + constructor(@Inject('NATS_CLIENT') private readonly connectionServiceProxy: ClientProxy) { + super('ConnectionService'); + } - return this.sendNats(this.connectionServiceProxy, 'create-connection', connectionDetails); - } catch (error) { - throw new RpcException(error.response); - - } - } + createLegacyConnectionInvitation( + connectionDto: CreateConnectionDto, + user: IUserRequestInterface + ): Promise<{ + response: object; + }> { + try { + const connectionDetails = { + orgId: connectionDto.orgId, + alias: connectionDto.alias, + label: connectionDto.label, + imageUrl: connectionDto.imageUrl, + multiUseInvitation: connectionDto.multiUseInvitation, + autoAcceptConnection: connectionDto.autoAcceptConnection, + user + }; - getConnectionWebhook(connectionDto: ConnectionDto, id: string): Promise<{ - response: object; - }> { - const payload = { connectionId: connectionDto.id, state: connectionDto.state, orgDid: connectionDto.theirDid, theirLabel: connectionDto.theirLabel, autoAcceptConnection: connectionDto.autoAcceptConnection, outOfBandId: connectionDto.outOfBandId, createDateTime: connectionDto.createdAt, lastChangedDateTime: connectionDto.updatedAt, orgId: id }; - return this.sendNats(this.connectionServiceProxy, 'webhook-get-connection', payload); + return this.sendNats(this.connectionServiceProxy, 'create-connection', connectionDetails); + } catch (error) { + throw new RpcException(error.response); } + } - getUrl(referenceId: string): Promise<{ - response: object; - }> { - try { - const connectionDetails = { referenceId }; - return this.sendNats(this.connectionServiceProxy, 'get-connection-url', connectionDetails); - } catch (error) { - throw new RpcException(error.response); + getConnectionWebhook( + connectionDto: ConnectionDto, + id: string + ): Promise<{ + response: object; + }> { + const payload = { connectionDto, orgId: id }; + return this.sendNats(this.connectionServiceProxy, 'webhook-get-connection', payload); + } - } + getUrl(referenceId: string): Promise<{ + response: object; + }> { + try { + const connectionDetails = { referenceId }; + return this.sendNats(this.connectionServiceProxy, 'get-connection-url', connectionDetails); + } catch (error) { + throw new RpcException(error.response); } + } - // getConnections(user: IUserRequest, outOfBandId: string, alias: string, state: string, myDid: string, theirDid: string, theirLabel: string, orgId: string): Promise<{ - // response: object; - // }> { - // const payload = { user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId }; - // return this.sendNats(this.connectionServiceProxy, 'get-all-connections', payload); - // } + getConnections( + connectionSearchCriteria: IConnectionSearchinterface, + user: IUserRequest, + orgId: string + ): Promise<{ + response: object; + }> { + const payload = { connectionSearchCriteria, user, orgId }; + return this.sendNats(this.connectionServiceProxy, 'get-all-connections', payload); + } - getConnections(user: IUserRequest, orgId: string): Promise<{ - response: object; - }> { - const payload = { user, orgId }; - return this.sendNats(this.connectionServiceProxy, 'get-all-connections', payload); - } - - - getConnectionsById(user: IUserRequest, connectionId: string, orgId: string): Promise<{ - response: object; - }> { - const payload = { user, connectionId, orgId }; - return this.sendNats(this.connectionServiceProxy, 'get-all-connections-by-connectionId', payload); - } -} \ No newline at end of file + getConnectionsById( + user: IUserRequest, + connectionId: string, + orgId: string + ): Promise<{ + response: object; + }> { + const payload = { user, connectionId, orgId }; + return this.sendNats(this.connectionServiceProxy, 'get-all-connections-by-connectionId', payload); + } +} diff --git a/apps/api-gateway/src/connection/dtos/connection.dto.ts b/apps/api-gateway/src/connection/dtos/connection.dto.ts index 25f1b07f2..fe225792b 100644 --- a/apps/api-gateway/src/connection/dtos/connection.dto.ts +++ b/apps/api-gateway/src/connection/dtos/connection.dto.ts @@ -33,7 +33,6 @@ export class CreateConnectionDto { orgId: string; } - export class ConnectionDto { @ApiProperty() @IsOptional() @@ -94,4 +93,8 @@ export class ConnectionDto { @ApiProperty() @IsOptional() updatedAt: string; + + @ApiProperty() + @IsOptional() + contextCorrelationId: string; } \ No newline at end of file diff --git a/apps/api-gateway/src/connection/dtos/get-all-connections.dto.ts b/apps/api-gateway/src/connection/dtos/get-all-connections.dto.ts new file mode 100644 index 000000000..2e15c095f --- /dev/null +++ b/apps/api-gateway/src/connection/dtos/get-all-connections.dto.ts @@ -0,0 +1,27 @@ +import { ApiProperty } from "@nestjs/swagger"; +import { Type } from "class-transformer"; +import { IsOptional } from "class-validator"; +import { SortValue } from "../../enum"; + +export class GetAllConnectionsDto { + @ApiProperty({ required: false }) + @IsOptional() + pageNumber: number = 1; + + @ApiProperty({ required: false }) + @IsOptional() + @Type(() => String) + searchByText: string = ''; + + @ApiProperty({ required: false }) + @IsOptional() + pageSize: number = 10; + + @ApiProperty({ required: false }) + @IsOptional() + sorting: string = 'id'; + + @ApiProperty({ required: false }) + @IsOptional() + sortByValue: string = SortValue.DESC; +} diff --git a/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts b/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts index 3979fe62c..168e60fbd 100644 --- a/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts +++ b/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts @@ -15,4 +15,12 @@ export interface ICredDeffSchemaSearchInterface { sorting: string; sortByValue: string; user?: IUserRequestInterface -} \ No newline at end of file +} +export interface IConnectionSearchinterface { + pageNumber: number; + pageSize: number; + sorting: string; + sortByValue: string; + searchByText: string; + user?: IUserRequestInterface +} diff --git a/apps/api-gateway/src/issuance/dtos/get-all-issued-credentials.dto.ts b/apps/api-gateway/src/issuance/dtos/get-all-issued-credentials.dto.ts new file mode 100644 index 000000000..57305e80c --- /dev/null +++ b/apps/api-gateway/src/issuance/dtos/get-all-issued-credentials.dto.ts @@ -0,0 +1,27 @@ +import { ApiProperty } from "@nestjs/swagger"; +import { Type } from "class-transformer"; +import { IsOptional } from "class-validator"; +import { SortValue } from "../../enum"; + +export class GetAllIssuedCredentialsDto { + @ApiProperty({ required: false }) + @IsOptional() + pageNumber: number = 1; + + @ApiProperty({ required: false }) + @IsOptional() + @Type(() => String) + searchByText: string = ''; + + @ApiProperty({ required: false }) + @IsOptional() + pageSize: number = 10; + + @ApiProperty({ required: false }) + @IsOptional() + sorting: string = 'id'; + + @ApiProperty({ required: false }) + @IsOptional() + sortByValue: string = SortValue.DESC; +} diff --git a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts index 4f3aa1d1e..8b49e224c 100644 --- a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts @@ -81,6 +81,10 @@ export class IssuanceDto { @IsOptional() threadId: string; + @ApiProperty() + @IsOptional() + schemaId: string; + @ApiProperty() @IsOptional() credentialAttributes: CredentialAttributes[]; @@ -88,6 +92,10 @@ export class IssuanceDto { @ApiProperty() @IsOptional() autoAcceptCredential: string; + + @ApiProperty() + @IsOptional() + contextCorrelationId: string; } diff --git a/apps/api-gateway/src/issuance/interfaces/index.ts b/apps/api-gateway/src/issuance/interfaces/index.ts index 7ba1e9d64..c492d9ed4 100644 --- a/apps/api-gateway/src/issuance/interfaces/index.ts +++ b/apps/api-gateway/src/issuance/interfaces/index.ts @@ -67,3 +67,12 @@ export interface RequestPayload { fileKey: string; fileName: string; } +export interface IIssuedCredentialSearchinterface { + pageNumber: number; + pageSize: number; + sorting: string; + sortByValue: string; + searchByText: string; + // user: IUserRequestInterface +} + diff --git a/apps/api-gateway/src/issuance/issuance.controller.ts b/apps/api-gateway/src/issuance/issuance.controller.ts index 4c5e090f6..70899b98c 100644 --- a/apps/api-gateway/src/issuance/issuance.controller.ts +++ b/apps/api-gateway/src/issuance/issuance.controller.ts @@ -49,19 +49,19 @@ import { import { IUserRequest } from '@credebl/user-request/user-request.interface'; import { User } from '../authz/decorators/user.decorator'; import { ResponseMessages } from '@credebl/common/response-messages'; -import { IssueCredential } from './enums/Issuance.enum'; import { Roles } from '../authz/decorators/roles.decorator'; import { OrgRoles } from 'libs/org-roles/enums'; import { OrgRolesGuard } from '../authz/guards/org-roles.guard'; import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler'; import { ImageServiceService } from '@credebl/image-service'; -import { FileExportResponse, RequestPayload } from './interfaces'; +import { FileExportResponse, IIssuedCredentialSearchinterface, RequestPayload } from './interfaces'; import { AwsService } from '@credebl/aws'; import { FileInterceptor } from '@nestjs/platform-express'; import { v4 as uuidv4 } from 'uuid'; import { RpcException } from '@nestjs/microservices'; /* eslint-disable @typescript-eslint/no-unused-vars */ import { user } from '@prisma/client'; +import { GetAllIssuedCredentialsDto } from './dtos/get-all-issued-credentials.dto'; @Controller() @UseFilters(CustomExceptionFilter) @@ -89,6 +89,54 @@ export class IssuanceController { return res.send(getImageBuffer); } + // /** + // * Description: Get all issued credentials + // * @param user + // * @param threadId + // * @param connectionId + // * @param state + // * @param orgId + // * + // */ + // @Get('/orgs/:orgId/credentials') + // @UseGuards(AuthGuard('jwt')) + // @ApiBearerAuth() + // @ApiOperation({ + // summary: `Get all issued credentials for a specific organization`, + // description: `Get all issued credentials for a specific organization` + // }) + // @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) + // @ApiQuery({ name: 'threadId', required: false }) + // @ApiQuery({ name: 'connectionId', required: false }) + // @ApiQuery({ name: 'state', enum: IssueCredential, required: false }) + // @ApiBearerAuth() + // @UseGuards(AuthGuard('jwt'), OrgRolesGuard) + // @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER) + // async getIssueCredentials( + // @User() user: IUserRequest, + // @Query('threadId') threadId: string, + // @Query('connectionId') connectionId: string, + // @Query('state') state: string, + // @Param('orgId') orgId: string, + // @Res() res: Response + // ): Promise { + // const getCredentialDetails = await this.issueCredentialService.getIssueCredentials( + // user, + // threadId, + // connectionId, + // state, + // orgId + // ); + + // const finalResponse: IResponseType = { + // statusCode: HttpStatus.OK, + // message: ResponseMessages.issuance.success.fetch, + // data: getCredentialDetails.response + // }; + // return res.status(HttpStatus.OK).json(finalResponse); + // } + + /** * Description: Get all issued credentials * @param user @@ -98,43 +146,69 @@ export class IssuanceController { * @param orgId * */ - @Get('/orgs/:orgId/credentials') - @UseGuards(AuthGuard('jwt')) - @ApiBearerAuth() - @ApiOperation({ - summary: `Get all issued credentials for a specific organization`, - description: `Get all issued credentials for a specific organization` - }) - @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) - @ApiQuery({ name: 'threadId', required: false }) - @ApiQuery({ name: 'connectionId', required: false }) - @ApiQuery({ name: 'state', enum: IssueCredential, required: false }) - @ApiBearerAuth() - @UseGuards(AuthGuard('jwt'), OrgRolesGuard) - @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER) - async getIssueCredentials( - @User() user: IUserRequest, - @Query('threadId') threadId: string, - @Query('connectionId') connectionId: string, - @Query('state') state: string, - @Param('orgId') orgId: string, - @Res() res: Response - ): Promise { - const getCredentialDetails = await this.issueCredentialService.getIssueCredentials( - user, - threadId, - connectionId, - state, - orgId - ); + @Get('/orgs/:orgId/credentials') + @UseGuards(AuthGuard('jwt')) + @ApiBearerAuth() + @ApiOperation({ + summary: `Get all issued credentials for a specific organization`, + description: `Get all issued credentials for a specific organization` + }) + @ApiQuery({ + name: 'pageNumber', + type: Number, + required: false + }) + @ApiQuery({ + name: 'searchByText', + type: String, + required: false + }) + @ApiQuery({ + name: 'pageSize', + type: Number, + required: false + }) + @ApiQuery({ + name: 'sorting', + type: String, + required: false + }) + @ApiQuery({ + name: 'sortByValue', + type: String, + required: false + }) - const finalResponse: IResponseType = { - statusCode: HttpStatus.OK, - message: ResponseMessages.issuance.success.fetch, - data: getCredentialDetails.response - }; - return res.status(HttpStatus.OK).json(finalResponse); - } + @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) + @ApiBearerAuth() + @UseGuards(AuthGuard('jwt'), OrgRolesGuard) + @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER) + async getIssueCredentials( + @Query() getAllIssuedCredentials: GetAllIssuedCredentialsDto, + @User() user: IUserRequest, + @Param('orgId') orgId: string, + @Res() res: Response + ): Promise { + + const { pageSize, searchByText, pageNumber, sorting, sortByValue } = getAllIssuedCredentials; + const issuedCredentialsSearchCriteria: IIssuedCredentialSearchinterface = { + pageNumber, + searchByText, + pageSize, + sorting, + sortByValue + }; + + const getCredentialDetails = await this.issueCredentialService.getIssueCredentials(issuedCredentialsSearchCriteria, user, orgId); + + const finalResponse: IResponseType = { + statusCode: HttpStatus.OK, + message: ResponseMessages.issuance.success.fetch, + data: getCredentialDetails.response + }; + return res.status(HttpStatus.OK).json(finalResponse); + } + /** * Description: Get all issued credentials diff --git a/apps/api-gateway/src/issuance/issuance.service.ts b/apps/api-gateway/src/issuance/issuance.service.ts index 15d45a990..90c6e2563 100644 --- a/apps/api-gateway/src/issuance/issuance.service.ts +++ b/apps/api-gateway/src/issuance/issuance.service.ts @@ -4,7 +4,7 @@ import { ClientProxy } from '@nestjs/microservices'; import { BaseService } from 'libs/service/base.service'; import { IUserRequest } from '@credebl/user-request/user-request.interface'; import { ClientDetails, FileParameter, IssuanceDto, IssueCredentialDto, OutOfBandCredentialDto, PreviewFileDetails } from './dtos/issuance.dto'; -import { FileExportResponse, RequestPayload } from './interfaces'; +import { FileExportResponse, IIssuedCredentialSearchinterface, RequestPayload } from './interfaces'; @Injectable() export class IssuanceService extends BaseService { @@ -33,13 +33,21 @@ export class IssuanceService extends BaseService { } - getIssueCredentials(user: IUserRequest, threadId: string, connectionId: string, state: string, orgId: string): Promise<{ + // getIssueCredentials(user: IUserRequest, threadId: string, connectionId: string, state: string, orgId: string): Promise<{ + // response: object; + // }> { + // const payload = { user, threadId, connectionId, state, orgId }; + // return this.sendNats(this.issuanceProxy, 'get-all-issued-credentials', payload); + // } + + getIssueCredentials(issuedCredentialsSearchCriteria: IIssuedCredentialSearchinterface, user: IUserRequest, orgId: string): Promise<{ response: object; }> { - const payload = { user, threadId, connectionId, state, orgId }; + const payload = { issuedCredentialsSearchCriteria, user, orgId }; return this.sendNats(this.issuanceProxy, 'get-all-issued-credentials', payload); } + getIssueCredentialsbyCredentialRecordId(user: IUserRequest, credentialRecordId: string, orgId: string): Promise<{ response: object; }> { diff --git a/apps/api-gateway/src/verification/dto/get-all-proof-requests.dto.ts b/apps/api-gateway/src/verification/dto/get-all-proof-requests.dto.ts new file mode 100644 index 000000000..aaadfe80d --- /dev/null +++ b/apps/api-gateway/src/verification/dto/get-all-proof-requests.dto.ts @@ -0,0 +1,27 @@ +import { ApiProperty } from "@nestjs/swagger"; +import { Type } from "class-transformer"; +import { IsOptional } from "class-validator"; +import { SortValue } from "../../enum"; + +export class GetAllProofRequestsDto { + @ApiProperty({ required: false }) + @IsOptional() + pageNumber: number = 1; + + @ApiProperty({ required: false }) + @IsOptional() + @Type(() => String) + searchByText: string = ''; + + @ApiProperty({ required: false }) + @IsOptional() + pageSize: number = 10; + + @ApiProperty({ required: false }) + @IsOptional() + sorting: string = 'id'; + + @ApiProperty({ required: false }) + @IsOptional() + sortByValue: string = SortValue.DESC; +} diff --git a/apps/api-gateway/src/verification/dto/webhook-proof.dto.ts b/apps/api-gateway/src/verification/dto/webhook-proof.dto.ts index 4eb3c10a6..b40ad5964 100644 --- a/apps/api-gateway/src/verification/dto/webhook-proof.dto.ts +++ b/apps/api-gateway/src/verification/dto/webhook-proof.dto.ts @@ -52,4 +52,8 @@ export class WebhookPresentationProof { @ApiProperty() @IsOptional() isVerified: boolean; + + @ApiProperty() + @IsOptional() + contextCorrelationId: string; } \ No newline at end of file diff --git a/apps/api-gateway/src/verification/interfaces/verification.interface.ts b/apps/api-gateway/src/verification/interfaces/verification.interface.ts index 978f1a039..b23294011 100644 --- a/apps/api-gateway/src/verification/interfaces/verification.interface.ts +++ b/apps/api-gateway/src/verification/interfaces/verification.interface.ts @@ -1,7 +1,18 @@ +import { IUserRequestInterface } from "../../interfaces/IUserRequestInterface"; + export interface IProofRequestAttribute { attributeName: string; condition?: string; value?: string; credDefId: string; credentialName: string; -} \ No newline at end of file +} + +export interface IProofRequestsSearchCriteria { + pageNumber: number; + pageSize: number; + sorting: string; + sortByValue: string; + searchByText: string; + user?: IUserRequestInterface +} diff --git a/apps/api-gateway/src/verification/verification.controller.ts b/apps/api-gateway/src/verification/verification.controller.ts index 28c668bf5..84eeef5f5 100644 --- a/apps/api-gateway/src/verification/verification.controller.ts +++ b/apps/api-gateway/src/verification/verification.controller.ts @@ -30,6 +30,8 @@ import { WebhookPresentationProof } from './dto/webhook-proof.dto'; import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler'; import { ImageServiceService } from '@credebl/image-service'; import { User } from '../authz/decorators/user.decorator'; +import { GetAllProofRequestsDto } from './dto/get-all-proof-requests.dto'; +import { IProofRequestsSearchCriteria } from './interfaces/verification.interface'; @UseFilters(CustomExceptionFilter) @Controller() @@ -115,6 +117,69 @@ export class VerificationController { return res.status(HttpStatus.OK).json(finalResponse); } + // @Get('/orgs/:orgId/credentials') + // @UseGuards(AuthGuard('jwt')) + // @ApiBearerAuth() + // @ApiOperation({ + // summary: `Get all issued credentials for a specific organization`, + // description: `Get all issued credentials for a specific organization` + // }) + // @ApiQuery({ + // name: 'pageNumber', + // type: Number, + // required: false + // }) + // @ApiQuery({ + // name: 'searchByText', + // type: String, + // required: false + // }) + // @ApiQuery({ + // name: 'pageSize', + // type: Number, + // required: false + // }) + // @ApiQuery({ + // name: 'sorting', + // type: String, + // required: false + // }) + // @ApiQuery({ + // name: 'sortByValue', + // type: String, + // required: false + // }) + + // @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) + // @ApiBearerAuth() + // @UseGuards(AuthGuard('jwt'), OrgRolesGuard) + // @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER) + // async getIssueCredentials( + // @Query() getAllIssuedCredentials: GetAllIssuedCredentialsDto, + // @User() user: IUserRequest, + // @Param('orgId') orgId: string, + // @Res() res: Response + // ): Promise { + + // const { pageSize, searchByText, pageNumber, sorting, sortByValue } = getAllIssuedCredentials; + // const issuedCredentialsSearchCriteria: IIssuedCredentialSearchinterface = { + // pageNumber, + // searchByText, + // pageSize, + // sorting, + // sortByValue + // }; + + // const getCredentialDetails = await this.issueCredentialService.getIssueCredentials(issuedCredentialsSearchCriteria, user, orgId); + + // const finalResponse: IResponseType = { + // statusCode: HttpStatus.OK, + // message: ResponseMessages.issuance.success.fetch, + // data: getCredentialDetails.response + // }; + // return res.status(HttpStatus.OK).json(finalResponse); + // } + /** * Get all proof presentations * @param user @@ -126,6 +191,33 @@ export class VerificationController { summary: `Get all proof presentations`, description: `Get all proof presentations` }) + + @ApiQuery({ + name: 'pageNumber', + type: Number, + required: false + }) + @ApiQuery({ + name: 'searchByText', + type: String, + required: false + }) + @ApiQuery({ + name: 'pageSize', + type: Number, + required: false + }) + @ApiQuery({ + name: 'sorting', + type: String, + required: false + }) + @ApiQuery({ + name: 'sortByValue', + type: String, + required: false + }) + @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) @ApiUnauthorizedResponse({ status: 401, description: 'Unauthorized', type: UnauthorizedErrorDto }) @ApiForbiddenResponse({ status: 403, description: 'Forbidden', type: ForbiddenErrorDto }) @@ -136,12 +228,21 @@ export class VerificationController { @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER) @UseGuards(AuthGuard('jwt'), OrgRolesGuard) async getProofPresentations( + @Query() getAllProofRequests: GetAllProofRequestsDto, @Res() res: Response, @User() user: IUserRequest, - @Param('orgId') orgId: string, - @Query('threadId') threadId: string + @Param('orgId') orgId: string ): Promise { - const proofPresentationDetails = await this.verificationService.getProofPresentations(orgId, threadId, user); + const { pageSize, searchByText, pageNumber, sorting, sortByValue } = getAllProofRequests; + const proofRequestsSearchCriteria: IProofRequestsSearchCriteria = { + pageNumber, + searchByText, + pageSize, + sorting, + sortByValue + }; + + const proofPresentationDetails = await this.verificationService.getProofPresentations(proofRequestsSearchCriteria, user, orgId); const finalResponse: IResponseType = { statusCode: HttpStatus.OK, message: ResponseMessages.verification.success.fetch, diff --git a/apps/api-gateway/src/verification/verification.service.ts b/apps/api-gateway/src/verification/verification.service.ts index e62afb157..2583be4f1 100644 --- a/apps/api-gateway/src/verification/verification.service.ts +++ b/apps/api-gateway/src/verification/verification.service.ts @@ -4,6 +4,7 @@ import { BaseService } from 'libs/service/base.service'; import { OutOfBandRequestProof, RequestProof } from './dto/request-proof.dto'; import { IUserRequest } from '@credebl/user-request/user-request.interface'; import { WebhookPresentationProof } from './dto/webhook-proof.dto'; +import { IProofRequestsSearchCriteria } from './interfaces/verification.interface'; @Injectable() @@ -20,8 +21,13 @@ export class VerificationService extends BaseService { * @param user * @returns Get all proof presentation */ - getProofPresentations(orgId: string, threadId: string, user: IUserRequest): Promise<{ response: object }> { - const payload = { user, threadId, orgId }; + // getProofPresentations(orgId: string, threadId: string, user: IUserRequest): Promise<{ response: object }> { + // const payload = { user, threadId, orgId }; + // return this.sendNats(this.verificationServiceProxy, 'get-proof-presentations', payload); + // } + + getProofPresentations(proofRequestsSearchCriteria: IProofRequestsSearchCriteria, user: IUserRequest, orgId: string): Promise<{ response: object }> { + const payload = { proofRequestsSearchCriteria, user, orgId }; return this.sendNats(this.verificationServiceProxy, 'get-proof-presentations', payload); } diff --git a/apps/connection/src/connection.controller.ts b/apps/connection/src/connection.controller.ts index df69fd203..3bb9a2572 100644 --- a/apps/connection/src/connection.controller.ts +++ b/apps/connection/src/connection.controller.ts @@ -1,62 +1,66 @@ import { Controller } from '@nestjs/common'; // Import the common service in the library import { ConnectionService } from './connection.service'; // Import the common service in connection module import { MessagePattern } from '@nestjs/microservices'; // Import the nestjs microservices package -import { IConnection, IConnectionInterface, IFetchConnectionById, IFetchConnectionInterface } from './interfaces/connection.interfaces'; +import { + IConnection, + IConnectionInterface, + IFetchConnectionById, + IFetchConnectionInterface +} from './interfaces/connection.interfaces'; @Controller() export class ConnectionController { - constructor(private readonly connectionService: ConnectionService) { } + constructor(private readonly connectionService: ConnectionService) {} /** * Description: Create out-of-band connection legacy invitation - * @param payload + * @param payload * @returns Created connection invitation for out-of-band */ @MessagePattern({ cmd: 'create-connection' }) async createLegacyConnectionInvitation(payload: IConnection): Promise { const { orgId, user, multiUseInvitation, autoAcceptConnection, alias, imageUrl, label } = payload; - return this.connectionService.createLegacyConnectionInvitation(orgId, user, multiUseInvitation, autoAcceptConnection, alias, imageUrl, label); + return this.connectionService.createLegacyConnectionInvitation( + orgId, + user, + multiUseInvitation, + autoAcceptConnection, + alias, + imageUrl, + label + ); } /** - * Description: Catch connection webhook responses and save details in connection table - * @param payload - * @returns Callback URL for connection and created connections details - */ + * Description: Catch connection webhook responses and save details in connection table + * @param payload + * @returns Callback URL for connection and created connections details + */ @MessagePattern({ cmd: 'webhook-get-connection' }) async getConnectionWebhook(payload: IConnectionInterface): Promise { - const { createDateTime, lastChangedDateTime, connectionId, state, orgDid, theirLabel, autoAcceptConnection, outOfBandId, orgId } = payload; - return this.connectionService.getConnectionWebhook(createDateTime, lastChangedDateTime, connectionId, state, orgDid, theirLabel, autoAcceptConnection, outOfBandId, orgId); + return this.connectionService.getConnectionWebhook(payload); } /** - * Description: Fetch connection url by refernceId. - * @param payload - * @returns Created connection invitation for out-of-band - */ + * Description: Fetch connection url by refernceId. + * @param payload + * @returns Created connection invitation for out-of-band + */ @MessagePattern({ cmd: 'get-connection-url' }) async getUrl(payload: { referenceId }): Promise { return this.connectionService.getUrl(payload.referenceId); } - // @MessagePattern({ cmd: 'get-all-connections' }) - // async getConnections(payload: IFetchConnectionInterface): Promise { - // const { user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId } = payload; - // return this.connectionService.getConnections(user, outOfBandId, alias, state, myDid, theirDid, theirLabel, orgId); - // } - @MessagePattern({ cmd: 'get-all-connections' }) async getConnections(payload: IFetchConnectionInterface): Promise { - const { user, orgId } = payload; - return this.connectionService.getConnections(user, orgId); + const { user, orgId, connectionSearchCriteria } = payload; + return this.connectionService.getConnections(user, orgId, connectionSearchCriteria); } - @MessagePattern({ cmd: 'get-all-connections-by-connectionId' }) async getConnectionsById(payload: IFetchConnectionById): Promise { const { user, connectionId, orgId } = payload; return this.connectionService.getConnectionsById(user, connectionId, orgId); } - } diff --git a/apps/connection/src/connection.repository.ts b/apps/connection/src/connection.repository.ts index dac0099aa..57c93f3aa 100644 --- a/apps/connection/src/connection.repository.ts +++ b/apps/connection/src/connection.repository.ts @@ -1,218 +1,275 @@ import { Injectable, Logger } from '@nestjs/common'; import { PrismaService } from '@credebl/prisma-service'; // eslint-disable-next-line camelcase -import { agent_invitations, connections, platform_config, shortening_url } from '@prisma/client'; -import { OrgAgent } from './interfaces/connection.interfaces'; +import { agent_invitations, org_agents, platform_config, shortening_url } from '@prisma/client'; +import { IConnectionInterface, IConnectionSearchCriteria, OrgAgent } from './interfaces/connection.interfaces'; import { IUserRequest } from '@credebl/user-request/user-request.interface'; // import { OrgAgent } from './interfaces/connection.interfaces'; @Injectable() export class ConnectionRepository { + constructor( + private readonly prisma: PrismaService, + private readonly logger: Logger + ) {} - constructor( - private readonly prisma: PrismaService, - private readonly logger: Logger - ) { } - - /** - * Description: Get getAgentEndPoint by orgId - * @param connectionId - * @returns Get getAgentEndPoint details - */ - // eslint-disable-next-line camelcase - async getAgentEndPoint(orgId: string): Promise { - try { - - const agentDetails = await this.prisma.org_agents.findFirst({ - where: { - orgId - }, - include: { - organisation: true - } - }); - return agentDetails; - - } catch (error) { - this.logger.error(`Error in get getAgentEndPoint: ${error.message} `); - throw error; + /** + * Description: Get getAgentEndPoint by orgId + * @param connectionId + * @returns Get getAgentEndPoint details + */ + // eslint-disable-next-line camelcase + async getAgentEndPoint(orgId: string): Promise { + try { + const agentDetails = await this.prisma.org_agents.findFirst({ + where: { + orgId + }, + include: { + organisation: true } + }); + return agentDetails; + } catch (error) { + this.logger.error(`Error in get getAgentEndPoint: ${error.message} `); + throw error; } + } - /** - * Description: Save connection details - * @param connectionInvitation - * @param agentId - * @param orgId - * @returns Get connection details - */ + /** + * Description: Save connection details + * @param connectionInvitation + * @param agentId + * @param orgId + * @returns Get connection details + */ + // eslint-disable-next-line camelcase + async saveAgentConnectionInvitations( + connectionInvitation: string, + agentId: string, + orgId: string // eslint-disable-next-line camelcase - async saveAgentConnectionInvitations(connectionInvitation: string, agentId: string, orgId: string): Promise { - try { - - const agentDetails = await this.prisma.agent_invitations.create({ - data: { - orgId: String(orgId), - agentId, - connectionInvitation, - multiUse: true - } - }); - return agentDetails; - - } catch (error) { - this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); - throw error; + ): Promise { + try { + const agentDetails = await this.prisma.agent_invitations.create({ + data: { + orgId: String(orgId), + agentId, + connectionInvitation, + multiUse: true } + }); + return agentDetails; + } catch (error) { + this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); + throw error; } + } - /** - * Get agent invitation by orgId - * @param orgId - * @returns Get connection details - */ - // eslint-disable-next-line camelcase - async getConnectionInvitationByOrgId(orgId: string): Promise { - try { - - const agentInvitationDetails = await this.prisma.agent_invitations.findFirst({ - where: { - orgId - } - }); - return agentInvitationDetails; - - } catch (error) { - this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); - throw error; + /** + * Get agent invitation by orgId + * @param orgId + * @returns Get connection details + */ + // eslint-disable-next-line camelcase + async getConnectionInvitationByOrgId(orgId: string): Promise { + try { + const agentInvitationDetails = await this.prisma.agent_invitations.findFirst({ + where: { + orgId } + }); + return agentInvitationDetails; + } catch (error) { + this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); + throw error; } + } - /** - * Description: Save connection details - * @param connectionInvitation - * @param agentId - * @param orgId - * @returns Get connection details - */ - // eslint-disable-next-line camelcase - async saveConnectionWebhook(createDateTime: string, lastChangedDateTime: string, connectionId: string, state: string, orgDid: string, theirLabel: string, autoAcceptConnection: boolean, outOfBandId: string, orgId: string): Promise { - try { + /** + * Description: Save connection details + * @param connectionInvitation + * @param agentId + * @param orgId + * @returns Get connection details + */ + // eslint-disable-next-line camelcase + async saveConnectionWebhook(payload: IConnectionInterface): Promise { + try { + let organisationId: string; + const { connectionDto, orgId } = payload; - const agentDetails = await this.prisma.connections.upsert({ - where: { - connectionId - }, - update: { - lastChangedDateTime, - lastChangedBy: orgId, - state - }, - create: { - createDateTime, - lastChangedDateTime, - createdBy: orgId, - lastChangedBy: orgId, - connectionId, - state, - theirLabel, - orgId - } - }); - return agentDetails; + if (connectionDto?.contextCorrelationId) { + const getOrganizationId = await this.getOrganization(connectionDto?.contextCorrelationId); + organisationId = getOrganizationId?.orgId; + } else { + organisationId = orgId; + } - } catch (error) { - this.logger.error(`Error in saveConnectionWebhook: ${error.message} `); - throw error; + const agentDetails = await this.prisma.connections.upsert({ + where: { + connectionId: connectionDto?.id + }, + update: { + lastChangedDateTime: connectionDto?.lastChangedDateTime, + lastChangedBy: organisationId, + state: connectionDto?.state + }, + create: { + createDateTime: connectionDto?.createDateTime, + lastChangedDateTime: connectionDto?.lastChangedDateTime, + createdBy: organisationId, + lastChangedBy: organisationId, + connectionId: connectionDto?.id, + state: connectionDto?.state, + theirLabel: connectionDto?.theirLabel, + orgId: organisationId } + }); + return agentDetails; + } catch (error) { + this.logger.error(`Error in saveConnectionWebhook: ${error.message} `); + throw error; } + } - /** - * Description: Save ShorteningUrl details - * @param referenceId - * @param connectionInvitationUrl - * @returns Get storeShorteningUrl details - */ - // eslint-disable-next-line camelcase - async storeShorteningUrl(referenceId: string, connectionInvitationUrl: string): Promise { - try { - - return this.prisma.shortening_url.create({ - data: { - referenceId, - url: connectionInvitationUrl, - type: null - } - }); - - } catch (error) { - this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); - throw error; + /** + * Description: Save ShorteningUrl details + * @param referenceId + * @param connectionInvitationUrl + * @returns Get storeShorteningUrl details + */ + // eslint-disable-next-line camelcase + async storeShorteningUrl(referenceId: string, connectionInvitationUrl: string): Promise { + try { + return this.prisma.shortening_url.create({ + data: { + referenceId, + url: connectionInvitationUrl, + type: null } + }); + } catch (error) { + this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); + throw error; } + } - /** - * Description: Fetch ShorteningUrl details - * @param referenceId - * @returns Get storeShorteningUrl details - */ - // eslint-disable-next-line camelcase - async getShorteningUrl(referenceId: string): Promise { - try { - - return this.prisma.shortening_url.findFirst({ - where: { - referenceId - } - }); - - } catch (error) { - this.logger.error(`Error in getShorteningUrl in connection repository: ${error.message} `); - throw error; + // eslint-disable-next-line camelcase + async getOrganization(tenantId: string): Promise { + try { + return this.prisma.org_agents.findFirst({ + where: { + tenantId } + }); + } catch (error) { + this.logger.error(`Error in getOrganization in connection repository: ${error.message} `); + throw error; } + } - /** - * Get platform config details - * @returns - */ - // eslint-disable-next-line camelcase - async getPlatformConfigDetails(): Promise { - try { - - return this.prisma.platform_config.findFirst(); - - } catch (error) { - this.logger.error(`[getPlatformConfigDetails] - error: ${JSON.stringify(error)}`); - throw error; + /** + * Description: Fetch ShorteningUrl details + * @param referenceId + * @returns Get storeShorteningUrl details + */ + // eslint-disable-next-line camelcase + async getShorteningUrl(referenceId: string): Promise { + try { + return this.prisma.shortening_url.findFirst({ + where: { + referenceId } + }); + } catch (error) { + this.logger.error(`Error in getShorteningUrl in connection repository: ${error.message} `); + throw error; } + } - async getAllConnections(user: IUserRequest, orgId: string): Promise { - try { - const connectionsList = await this.prisma.connections.findMany({ - where: { - orgId - } - }); - return connectionsList; - } catch (error) { - this.logger.error(`[getConnectionDetails] - error: ${JSON.stringify(error)}`); - throw error; - } + /** + * Get platform config details + * @returns + */ + // eslint-disable-next-line camelcase + async getPlatformConfigDetails(): Promise { + try { + return this.prisma.platform_config.findFirst(); + } catch (error) { + this.logger.error(`[getPlatformConfigDetails] - error: ${JSON.stringify(error)}`); + throw error; } - async getOrgAgentType(orgAgentId: string): Promise { - try { + } - const { agent } = await this.prisma.org_agents_type.findFirst({ - where: { - id: orgAgentId - } - }); + async getAllConnections( + user: IUserRequest, + orgId: string, + connectionSearchCriteria: IConnectionSearchCriteria + ): Promise<{ + connectionCount: number; + connectionsList: { + createDateTime: Date; + createdBy: string; + connectionId: string; + theirLabel: string; + state: string; + orgId: string; + }[]; + }> { + try { + const connectionsList = await this.prisma.connections.findMany({ + where: { + orgId, + OR: [ + { theirLabel: { contains: connectionSearchCriteria.searchByText, mode: 'insensitive' } }, + { connectionId: { contains: connectionSearchCriteria.searchByText, mode: 'insensitive' } } + ] + }, + select: { + createDateTime: true, + createdBy: true, + orgId: true, + state: true, + theirLabel: true, + connectionId: true + }, + orderBy: { + [connectionSearchCriteria.sorting]: + 'DESC' === connectionSearchCriteria.sortByValue + ? 'desc' + : 'ASC' === connectionSearchCriteria.sortByValue + ? 'asc' + : 'desc' + }, + take: Number(connectionSearchCriteria.pageSize), + skip: (connectionSearchCriteria.pageNumber - 1) * connectionSearchCriteria.pageSize + }); + const connectionCount = await this.prisma.connections.count({ + where: { + organisation: { + id: orgId + } + } + }); - return agent; - } catch (error) { - this.logger.error(`[getOrgAgentType] - error: ${JSON.stringify(error)}`); - throw error; + return { connectionCount, connectionsList }; + } catch (error) { + this.logger.error(`[getAllConnections] - error: ${JSON.stringify(error)}`); + throw error; + } + } + async getOrgAgentType(orgAgentId: string): Promise { + try { + const { agent } = await this.prisma.org_agents_type.findFirst({ + where: { + id: orgAgentId } + }); + + return agent; + } catch (error) { + this.logger.error(`[getOrgAgentType] - error: ${JSON.stringify(error)}`); + throw error; } -} \ No newline at end of file + } +} diff --git a/apps/connection/src/connection.service.ts b/apps/connection/src/connection.service.ts index cbfc93c67..14d5a5f30 100644 --- a/apps/connection/src/connection.service.ts +++ b/apps/connection/src/connection.service.ts @@ -1,20 +1,13 @@ /* eslint-disable camelcase */ import { CommonService } from '@credebl/common'; import { CommonConstants } from '@credebl/common/common.constant'; -import { - HttpException, - Inject, - Injectable, - Logger, - NotFoundException -} from '@nestjs/common'; -import { - ClientProxy, - RpcException -} from '@nestjs/microservices'; +import { HttpException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common'; +import { ClientProxy, RpcException } from '@nestjs/microservices'; import { map } from 'rxjs'; import { ConnectionInvitationResponse, + IConnectionInterface, + IConnectionSearchCriteria, IUserRequestInterface } from './interfaces/connection.interfaces'; import { ConnectionRepository } from './connection.repository'; @@ -23,28 +16,31 @@ import { IUserRequest } from '@credebl/user-request/user-request.interface'; import { OrgAgentType } from '@credebl/enum/enum'; import { platform_config } from '@prisma/client'; - @Injectable() export class ConnectionService { - constructor( private readonly commonService: CommonService, @Inject('NATS_CLIENT') private readonly connectionServiceProxy: ClientProxy, private readonly connectionRepository: ConnectionRepository, private readonly logger: Logger - ) { } + ) {} /** - * Description: create connection legacy invitation - * @param orgId - * @param user + * Description: create connection legacy invitation + * @param orgId + * @param user * @returns Connection legacy invitation URL */ async createLegacyConnectionInvitation( - orgId: string, user: IUserRequestInterface, multiUseInvitation: boolean, autoAcceptConnection: boolean, alias: string, imageUrl: string, label: string + orgId: string, + user: IUserRequestInterface, + multiUseInvitation: boolean, + autoAcceptConnection: boolean, + alias: string, + imageUrl: string, + label: string ): Promise { try { - const connectionInvitationExist = await this.connectionRepository.getConnectionInvitationByOrgId(orgId); if (connectionInvitationExist) { @@ -89,35 +85,37 @@ export class ConnectionService { shortenedUrl = `${agentEndPoint}/url/${invitationObject}`; } - const saveConnectionDetails = await this.connectionRepository.saveAgentConnectionInvitations(shortenedUrl, agentId, orgId); + const saveConnectionDetails = await this.connectionRepository.saveAgentConnectionInvitations( + shortenedUrl, + agentId, + orgId + ); return saveConnectionDetails; } catch (error) { this.logger.error(`[createLegacyConnectionInvitation] - error in connection invitation: ${error}`); if (error && error?.status && error?.status?.message && error?.status?.message?.error) { throw new RpcException({ - message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, + message: error?.status?.message?.error?.reason + ? error?.status?.message?.error?.reason + : error?.status?.message?.error, statusCode: error?.status?.code }); - } else { throw new RpcException(error.response ? error.response : error); } } } - /** - * Description: create connection legacy invitation - * @param orgId - * @param user + * Description: create connection legacy invitation + * @param orgId + * @param user * @returns Connection legacy invitation URL */ - async getConnectionWebhook( - createDateTime: string, lastChangedDateTime: string, connectionId: string, state: string, orgDid: string, theirLabel: string, autoAcceptConnection: boolean, outOfBandId: string, orgId: string - ): Promise { + async getConnectionWebhook(payload: IConnectionInterface): Promise { try { - const saveConnectionDetails = await this.connectionRepository.saveConnectionWebhook(createDateTime, lastChangedDateTime, connectionId, state, orgDid, theirLabel, autoAcceptConnection, outOfBandId, orgId); + const saveConnectionDetails = await this.connectionRepository.saveConnectionWebhook(payload); return saveConnectionDetails; } catch (error) { this.logger.error(`[getConnectionWebhook] - error in fetch connection webhook: ${error}`); @@ -125,14 +123,17 @@ export class ConnectionService { } } - /** - * Description: Store shortening URL - * @param referenceId - * @param url + * Description: Store shortening URL + * @param referenceId + * @param url * @returns connection invitation URL */ - async _createConnectionInvitation(connectionPayload: object, url: string, apiKey: string): Promise { + async _createConnectionInvitation( + connectionPayload: object, + url: string, + apiKey: string + ): Promise { const pattern = { cmd: 'agent-create-connection-legacy-invitation' }; const payload = { connectionPayload, url, apiKey }; @@ -142,18 +143,19 @@ export class ConnectionService { return { message }; } catch (error) { this.logger.error(`catch: ${JSON.stringify(error)}`); - throw new HttpException({ - status: error.status, - error: error.message - }, error.status); + throw new HttpException( + { + status: error.status, + error: error.message + }, + error.status + ); } } - async storeShorteningUrl(referenceId: string, connectionInvitationUrl: string): Promise { try { return this.connectionRepository.storeShorteningUrl(referenceId, connectionInvitationUrl); - } catch (error) { this.logger.error(`Error in store agent details : ${JSON.stringify(error)}`); throw error; @@ -161,12 +163,11 @@ export class ConnectionService { } /** - * Description: Fetch connection invitaion by referenceId - * @param referenceId - * @returns Connection legacy invitation URL - */ - async getUrl( - referenceId: string): Promise { + * Description: Fetch connection invitaion by referenceId + * @param referenceId + * @returns Connection legacy invitation URL + */ + async getUrl(referenceId: string): Promise { try { const urlDetails = await this.connectionRepository.getShorteningUrl(referenceId); return urlDetails.url; @@ -177,84 +178,80 @@ export class ConnectionService { } /** - * Description: Fetch all connections - * @param outOfBandId - * @param alias - * @param state - * @param myDid - * @param theirDid - * @param theirLabel - * @param orgId - * @param user - * - * @returns get all connections details - */ - // async getConnections(user: IUserRequest, outOfBandId: string, alias: string, state: string, myDid: string, theirDid: string, theirLabel: string, orgId: string): Promise { - // try { - // const agentDetails = await this.connectionRepository.getAgentEndPoint(orgId); - // const orgAgentType = await this.connectionRepository.getOrgAgentType(agentDetails?.orgAgentTypeId); - // const platformConfig: platform_config = await this.connectionRepository.getPlatformConfigDetails(); - - // const { agentEndPoint } = agentDetails; - // if (!agentDetails) { - // throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound); - // } - // const params = { - // outOfBandId, - // alias, - // state, - // myDid, - // theirDid, - // theirLabel - // }; - - // let url; - // if (orgAgentType === OrgAgentType.DEDICATED) { - - // url = `${agentEndPoint}${CommonConstants.URL_CONN_GET_CONNECTIONS}`; - - // } else if (orgAgentType === OrgAgentType.SHARED) { - - // url = `${agentEndPoint}${CommonConstants.URL_SHAGENT_GET_CREATEED_INVITATIONS}`.replace('#', agentDetails.tenantId); - // } else { - - // throw new NotFoundException(ResponseMessages.connection.error.agentUrlNotFound); - // } - - // Object.keys(params).forEach((element: string) => { - // const appendParams: string = url.includes('?') ? '&' : '?'; - - // if (params[element] !== undefined) { - // url = `${url + appendParams + element}=${params[element]}`; - // } - // }); - // const apiKey = platformConfig?.sgApiKey; - // const connectionsDetails = await this._getAllConnections(url, apiKey); - // return connectionsDetails?.response; - // } catch (error) { - // this.logger.error(`Error in get url in connection service: ${JSON.stringify(error)}`); - // if (error && error?.status && error?.status?.message && error?.status?.message?.error) { - // throw new RpcException({ - // message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, - // statusCode: error?.status?.code - // }); - - // } else { - // throw new RpcException(error.response ? error.response : error); - // } - // } - // } - - async getConnections(user: IUserRequest, orgId: string): Promise { + * Description: Fetch all connections + * @param orgId + * @param user + * + * @returns get all connections details + */ + async getConnections( + user: IUserRequest, + orgId: string, + connectionSearchCriteria: IConnectionSearchCriteria + ): Promise<{ + totalItems: number; + hasNextPage: boolean; + hasPreviousPage: boolean; + nextPage: number; + previousPage: number; + lastPage: number; + data: { + createDateTime: Date; + createdBy: string; + connectionId: string; + theirLabel: string; + state: string; + orgId: string; + }[]; + }> { try { - const getConnectionList = await this.connectionRepository.getAllConnections(user, orgId); - return getConnectionList; - } catch (error) { - throw new RpcException(`[_getAllConnections] [NATS call]- error in fetch connections details : ${JSON.stringify(error)}`); + const getConnectionList = await this.connectionRepository.getAllConnections( + user, + orgId, + connectionSearchCriteria + ); + const connectionResponse: { + totalItems: number; + hasNextPage: boolean; + hasPreviousPage: boolean; + nextPage: number; + previousPage: number; + lastPage: number; + data: { + createDateTime: Date; + createdBy: string; + connectionId: string; + theirLabel: string; + state: string; + orgId: string; + }[]; + } = { + totalItems: getConnectionList.connectionCount, + hasNextPage: + connectionSearchCriteria.pageSize * connectionSearchCriteria.pageNumber < getConnectionList.connectionCount, + hasPreviousPage: 1 < connectionSearchCriteria.pageNumber, + nextPage: Number(connectionSearchCriteria.pageNumber) + 1, + previousPage: connectionSearchCriteria.pageNumber - 1, + lastPage: Math.ceil(getConnectionList.connectionCount / connectionSearchCriteria.pageSize), + data: getConnectionList.connectionsList + }; + + if (0 !== getConnectionList.connectionCount) { + return connectionResponse; + } else { + throw new NotFoundException(ResponseMessages.connection.error.connectionNotFound); } + } catch (error) { + throw new RpcException( + `[getConnections] [NATS call]- error in fetch connections details : ${JSON.stringify(error)}` + ); } - - async _getAllConnections(url: string, apiKey: string): Promise<{ + } + + async _getAllConnections( + url: string, + apiKey: string + ): Promise<{ response: string; }> { try { @@ -263,28 +260,31 @@ export class ConnectionService { return this.connectionServiceProxy .send(pattern, payload) .pipe( - map((response) => ( - { - response - })) - ).toPromise() - .catch(error => { + map((response) => ({ + response + })) + ) + .toPromise() + .catch((error) => { this.logger.error(`catch: ${JSON.stringify(error)}`); throw new HttpException( { status: error.statusCode, error: error.message - }, error.error); + }, + error.error + ); }); } catch (error) { - this.logger.error(`[_getAllConnections] [NATS call]- error in fetch connections details : ${JSON.stringify(error)}`); + this.logger.error( + `[_getAllConnections] [NATS call]- error in fetch connections details : ${JSON.stringify(error)}` + ); throw error; } } async getConnectionsById(user: IUserRequest, connectionId: string, orgId: string): Promise { try { - const agentDetails = await this.connectionRepository.getAgentEndPoint(orgId); const orgAgentType = await this.connectionRepository.getOrgAgentType(agentDetails?.orgAgentTypeId); const platformConfig: platform_config = await this.connectionRepository.getPlatformConfigDetails(); @@ -296,13 +296,12 @@ export class ConnectionService { let url; if (orgAgentType === OrgAgentType.DEDICATED) { - url = `${agentEndPoint}${CommonConstants.URL_CONN_GET_CONNECTION_BY_ID}`.replace('#', connectionId); } else if (orgAgentType === OrgAgentType.SHARED) { - - url = `${agentEndPoint}${CommonConstants.URL_SHAGENT_GET_CREATEED_INVITATION_BY_CONNECTIONID}`.replace('#', connectionId).replace('@', agentDetails.tenantId); + url = `${agentEndPoint}${CommonConstants.URL_SHAGENT_GET_CREATEED_INVITATION_BY_CONNECTIONID}` + .replace('#', connectionId) + .replace('@', agentDetails.tenantId); } else { - throw new NotFoundException(ResponseMessages.connection.error.agentUrlNotFound); } @@ -310,22 +309,25 @@ export class ConnectionService { const createConnectionInvitation = await this._getConnectionsByConnectionId(url, apiKey); return createConnectionInvitation?.response; } catch (error) { - this.logger.error(`[getConnectionsById] - error in get connections : ${JSON.stringify(error)}`); if (error && error?.status && error?.status?.message && error?.status?.message?.error) { throw new RpcException({ - message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, + message: error?.status?.message?.error?.reason + ? error?.status?.message?.error?.reason + : error?.status?.message?.error, statusCode: error?.status?.code }); - } else { throw new RpcException(error.response ? error.response : error); } } } - async _getConnectionsByConnectionId(url: string, apiKey: string): Promise<{ + async _getConnectionsByConnectionId( + url: string, + apiKey: string + ): Promise<{ response: string; }> { try { @@ -334,53 +336,47 @@ export class ConnectionService { return this.connectionServiceProxy .send(pattern, payload) .pipe( - map((response) => ( - { - response - })) - ).toPromise() - .catch(error => { + map((response) => ({ + response + })) + ) + .toPromise() + .catch((error) => { this.logger.error(`catch: ${JSON.stringify(error)}`); throw new HttpException( { status: error.statusCode, error: error.message - }, error.error); + }, + error.error + ); }); } catch (error) { - this.logger.error(`[_getConnectionsByConnectionId] [NATS call]- error in fetch connections : ${JSON.stringify(error)}`); + this.logger.error( + `[_getConnectionsByConnectionId] [NATS call]- error in fetch connections : ${JSON.stringify(error)}` + ); throw error; } } /** - * Description: Fetch agent url - * @param referenceId - * @returns agent URL - */ - async getAgentUrl( - orgAgentType: string, - agentEndPoint: string, - tenantId?: string - ): Promise { + * Description: Fetch agent url + * @param referenceId + * @returns agent URL + */ + async getAgentUrl(orgAgentType: string, agentEndPoint: string, tenantId?: string): Promise { try { - let url; if (orgAgentType === OrgAgentType.DEDICATED) { - url = `${agentEndPoint}${CommonConstants.URL_CONN_LEGACY_INVITE}`; } else if (orgAgentType === OrgAgentType.SHARED) { - url = `${agentEndPoint}${CommonConstants.URL_SHAGENT_CREATE_INVITATION}`.replace('#', tenantId); } else { - throw new NotFoundException(ResponseMessages.connection.error.agentUrlNotFound); } return url; - } catch (error) { this.logger.error(`Error in get agent url: ${JSON.stringify(error)}`); throw error; - } } } diff --git a/apps/connection/src/interfaces/connection.interfaces.ts b/apps/connection/src/interfaces/connection.interfaces.ts index bbbd5f6a4..a9afc22c6 100644 --- a/apps/connection/src/interfaces/connection.interfaces.ts +++ b/apps/connection/src/interfaces/connection.interfaces.ts @@ -4,13 +4,13 @@ import { organisation } from '@prisma/client'; import { UserRoleOrgPermsDto } from 'apps/api-gateway/src/dtos/user-role-org-perms.dto'; export interface IConnection { - user: IUserRequestInterface, - alias: string; - label: string; - imageUrl: string; - multiUseInvitation: boolean; - autoAcceptConnection: boolean; - orgId: string; + user: IUserRequestInterface; + alias: string; + label: string; + imageUrl: string; + multiUseInvitation: boolean; + autoAcceptConnection: boolean; + orgId: string; } export interface IUserRequestInterface { userId: string; @@ -38,8 +38,7 @@ export interface ISelectedOrgInterface { export interface IOrganizationInterface { name: string; description: string; - org_agents: IOrgAgentInterface[] - + org_agents: IOrgAgentInterface[]; } export interface IOrgAgentInterface { @@ -52,20 +51,26 @@ export interface IOrgAgentInterface { orgId: string; } - export class IConnectionInterface { + connectionDto: ConnectionPayload; + orgId: string; +} + +export class ConnectionPayload { createDateTime: string; lastChangedDateTime: string; - connectionId: string; + id: string; state: string; orgDid?: string; theirLabel: string; autoAcceptConnection: boolean; outOfBandId: string; orgId: string; + contextCorrelationId: string; } export class IFetchConnectionInterface { + connectionSearchCriteria: IConnectionSearchCriteria; user: IUserRequest; // outOfBandId: string; // alias: string; @@ -110,3 +115,17 @@ export interface OrgAgent { orgAgentTypeId: string; tenantId: string; } +export interface IConnectionSearchInterface { + schemaSearchCriteria: IConnectionSearchCriteria, + user: IUserRequestInterface, + orgId: string +} +export interface IConnectionSearchCriteria { + pageNumber: number; + pageSize: number; + sorting: string; + sortByValue: string; + searchByText: string; + user: IUserRequestInterface +} + diff --git a/apps/issuance/interfaces/issuance.interfaces.ts b/apps/issuance/interfaces/issuance.interfaces.ts index 77709e3c2..2ab6a84b0 100644 --- a/apps/issuance/interfaces/issuance.interfaces.ts +++ b/apps/issuance/interfaces/issuance.interfaces.ts @@ -1,120 +1,143 @@ // eslint-disable-next-line camelcase import { IUserRequest } from '@credebl/user-request/user-request.interface'; - +import { IUserRequestInterface } from 'apps/agent-service/src/interface/agent-service.interface'; export interface Attributes { - name: string; - value: string; + name: string; + value: string; } export interface IIssuance { - user: IUserRequest; - credentialDefinitionId: string; - comment: string; - connectionId: string; - attributes: Attributes[]; - orgId: string; - protocolVersion: string; + user: IUserRequest; + credentialDefinitionId: string; + comment: string; + connectionId: string; + attributes: Attributes[]; + orgId: string; + protocolVersion: string; } export interface IIssueCredentials { - user: IUserRequest; - connectionId: string; - threadId: string; - orgId: string; - state: string; + issuedCredentialsSearchCriteria: IIssuedCredentialsSearchCriteria; + user: IUserRequest; + // connectionId: string; + // threadId: string; + orgId: string; + // state: string; } export interface IIssueCredentialsDefinitions { - user: IUserRequest; - credentialRecordId: string; - orgId: string; + user: IUserRequest; + credentialRecordId: string; + orgId: string; } export interface IIssuanceWebhookInterface { - createDateTime: string; - connectionId: string; - threadId: string; - protocolVersion: string; - credentialAttributes: ICredentialAttributesInterface[]; - orgId: string; - schemaName: string; - id: string; - state: string; + createDateTime: string; + connectionId: string; + threadId: string; + protocolVersion: string; + credentialAttributes: ICredentialAttributesInterface[]; + orgId: string; + schemaId: string; + id: string; + state: string; + contextCorrelationId: string; + metadata: Metadata; +} + +interface Metadata { + '_anoncreds/credential': AnoncredsMetadata; +} + +interface AnoncredsMetadata { + schemaId?: string; + credentialDefinitionId?: string; } export interface IssueCredentialWebhookPayload { - issueCredentialDto: IIssuanceWebhookInterface; - id: string; + issueCredentialDto: IIssuanceWebhookInterface; + id: string; } export interface ICredentialAttributesInterface { - 'mime-type': string; - name: string; - value: string; + 'mime-type': string; + name: string; + value: string; } export interface CredentialOffer { - emailId: string; - attributes: Attributes[]; + emailId: string; + attributes: Attributes[]; } export interface OutOfBandCredentialOfferPayload { - credentialDefinitionId: string; - orgId: string; - comment?: string; - credentialOffer?: CredentialOffer[]; - emailId?: string; - attributes?: Attributes[]; - protocolVersion?: string; + credentialDefinitionId: string; + orgId: string; + comment?: string; + credentialOffer?: CredentialOffer[]; + emailId?: string; + attributes?: Attributes[]; + protocolVersion?: string; } export interface OutOfBandCredentialOffer { - user: IUserRequest; - outOfBandCredentialDto: OutOfBandCredentialOfferPayload; + user: IUserRequest; + outOfBandCredentialDto: OutOfBandCredentialOfferPayload; } export interface SchemaDetails { - credentialDefinitionId: string; - tag: string; - schemaLedgerId: string; - attributes: string; + credentialDefinitionId: string; + tag: string; + schemaLedgerId: string; + attributes: string; } export interface ImportFileDetails { - credDefId: string; - fileKey: string; - fileName: string; + credDefId: string; + fileKey: string; + fileName: string; } export interface PreviewRequest { - pageNumber?: number, - search?: string, - pageSize?: number, - sortBy?: string, - sortValue?: string + pageNumber?: number; + search?: string; + pageSize?: number; + sortBy?: string; + sortValue?: string; } export interface FileUpload { - name?: string; - upload_type?: string; - status?: string; - orgId?: string; - createDateTime?: Date; - lastChangedDateTime?: Date; + name?: string; + upload_type?: string; + status?: string; + orgId?: string; + createDateTime?: Date; + lastChangedDateTime?: Date; } export interface FileUploadData { - fileUpload: string; - fileRow: string; - isError: boolean; - referenceId: string; - createDateTime: Date; - error?: string; - detailError?: string; - jobId: string; + fileUpload: string; + fileRow: string; + isError: boolean; + referenceId: string; + createDateTime: Date; + error?: string; + detailError?: string; + jobId: string; } export interface ClientDetails { + clientId: string; - clientId: string; - - userId?: string; - -} \ No newline at end of file + userId?: string; +} +export interface IIssuedCredentialsSearchInterface { + issuedCredentialsSearchCriteria: IIssuedCredentialsSearchCriteria; + user: IUserRequestInterface; + orgId: string; +} +export interface IIssuedCredentialsSearchCriteria { + pageNumber: number; + pageSize: number; + sorting: string; + sortByValue: string; + searchByText: string; + user?: IUserRequestInterface; +} diff --git a/apps/issuance/src/issuance.controller.ts b/apps/issuance/src/issuance.controller.ts index 6e789c488..a32b62d15 100644 --- a/apps/issuance/src/issuance.controller.ts +++ b/apps/issuance/src/issuance.controller.ts @@ -22,10 +22,16 @@ export class IssuanceController { return this.issuanceService.sendCredentialOutOfBand(orgId, user, credentialDefinitionId, comment, connectionId, attributes); } + // @MessagePattern({ cmd: 'get-all-issued-credentials' }) + // async getIssueCredentials(payload: IIssueCredentials): Promise { + // const { user, threadId, connectionId, state, orgId } = payload; + // return this.issuanceService.getIssueCredentials(user, threadId, connectionId, state, orgId); + // } + @MessagePattern({ cmd: 'get-all-issued-credentials' }) - async getIssueCredentials(payload: IIssueCredentials): Promise { - const { user, threadId, connectionId, state, orgId } = payload; - return this.issuanceService.getIssueCredentials(user, threadId, connectionId, state, orgId); + async getIssueCredentials(payload: IIssueCredentials): Promise { + const { user, orgId, issuedCredentialsSearchCriteria} = payload; + return this.issuanceService.getIssueCredentials(user, orgId, issuedCredentialsSearchCriteria); } @MessagePattern({ cmd: 'get-issued-credentials-by-credentialDefinitionId' }) @@ -36,8 +42,7 @@ export class IssuanceController { @MessagePattern({ cmd: 'webhook-get-issue-credential' }) async getIssueCredentialWebhook(payload: IssueCredentialWebhookPayload): Promise { - const { issueCredentialDto, id } = payload; - return this.issuanceService.getIssueCredentialWebhook(issueCredentialDto, id); + return this.issuanceService.getIssueCredentialWebhook(payload); } @MessagePattern({ cmd: 'out-of-band-credential-offer' }) diff --git a/apps/issuance/src/issuance.repository.ts b/apps/issuance/src/issuance.repository.ts index 7877e7940..b110f5e25 100644 --- a/apps/issuance/src/issuance.repository.ts +++ b/apps/issuance/src/issuance.repository.ts @@ -2,493 +2,586 @@ import { Injectable, InternalServerErrorException, Logger, NotFoundException } from '@nestjs/common'; import { PrismaService } from '@credebl/prisma-service'; // eslint-disable-next-line camelcase -import { agent_invitations, credentials, file_data, file_upload, org_agents, organisation, platform_config, shortening_url } from '@prisma/client'; +import { + agent_invitations, + credentials, + file_data, + file_upload, + org_agents, + organisation, + platform_config, + shortening_url +} from '@prisma/client'; import { ResponseMessages } from '@credebl/common/response-messages'; -import { FileUploadData, IIssuanceWebhookInterface, PreviewRequest, SchemaDetails } from '../interfaces/issuance.interfaces'; +import { + FileUploadData, + IssueCredentialWebhookPayload, + PreviewRequest, + SchemaDetails +} from '../interfaces/issuance.interfaces'; import { FileUploadStatus } from 'apps/api-gateway/src/enum'; +import { IUserRequest } from '@credebl/user-request/user-request.interface'; +import { IIssuedCredentialSearchinterface } from 'apps/api-gateway/src/issuance/interfaces'; @Injectable() export class IssuanceRepository { + constructor( + private readonly prisma: PrismaService, + private readonly logger: Logger + ) {} + + /** + * Description: Get getAgentEndPoint by orgId + * @param connectionId + * @returns Get getAgentEndPoint details + */ + // eslint-disable-next-line camelcase + async getAgentEndPoint(orgId: string): Promise { + try { + const agentDetails = await this.prisma.org_agents.findFirst({ + where: { + orgId + } + }); - constructor( - private readonly prisma: PrismaService, - private readonly logger: Logger - ) { } - - /** - * Description: Get getAgentEndPoint by orgId - * @param connectionId - * @returns Get getAgentEndPoint details - */ - // eslint-disable-next-line camelcase - async getAgentEndPoint(orgId: string): Promise { - try { - - const agentDetails = await this.prisma.org_agents.findFirst({ - where: { - orgId - } - }); - - if (!agentDetails) { - throw new NotFoundException(ResponseMessages.issuance.error.notFound); - } + if (!agentDetails) { + throw new NotFoundException(ResponseMessages.issuance.error.notFound); + } - return agentDetails; + return agentDetails; + } catch (error) { + this.logger.error(`Error in get getAgentEndPoint: ${error.message} `); + throw error; + } + } - } catch (error) { - this.logger.error(`Error in get getAgentEndPoint: ${error.message} `); - throw error; + async getOrganizationByTenantId(tenantId: string): Promise { + try { + return this.prisma.org_agents.findFirst({ + where: { + tenantId } + }); + } catch (error) { + this.logger.error(`Error in getOrganization in issuance repository: ${error.message} `); + throw error; } + } + + async getAllIssuedCredentials( + user: IUserRequest, + orgId: string, + issuedCredentialsSearchCriteria: IIssuedCredentialSearchinterface + ): Promise<{ + issuedCredentialsCount: number; + issuedCredentialsList: { + createDateTime: Date; + createdBy: string; + connectionId: string; + schemaId: string; + state: string; + orgId: string; + }[]; + }> { + try { + const issuedCredentialsList = await this.prisma.credentials.findMany({ + where: { + orgId, + OR: [ + { schemaId: { contains: issuedCredentialsSearchCriteria.searchByText, mode: 'insensitive' } }, + { connectionId: { contains: issuedCredentialsSearchCriteria.searchByText, mode: 'insensitive' } } + ] + }, + select: { + createDateTime: true, + createdBy: true, + orgId: true, + state: true, + schemaId: true, + connectionId: true + }, + orderBy: { + [issuedCredentialsSearchCriteria.sorting]: + 'DESC' === issuedCredentialsSearchCriteria.sortByValue + ? 'desc' + : 'ASC' === issuedCredentialsSearchCriteria.sortByValue + ? 'asc' + : 'desc' + }, + take: Number(issuedCredentialsSearchCriteria.pageSize), + skip: (issuedCredentialsSearchCriteria.pageNumber - 1) * issuedCredentialsSearchCriteria.pageSize + }); + const issuedCredentialsCount = await this.prisma.credentials.count({ + where: { + organisation: { + id: orgId + } + } + }); + return { issuedCredentialsCount, issuedCredentialsList }; + } catch (error) { + this.logger.error(`[getAllredentials] - error: ${JSON.stringify(error)}`); + throw error; + } + } - /** - * Description: save credentials - * @param connectionId - * @returns Get saved credential details - */ - // eslint-disable-next-line camelcase - async saveIssuedCredentialDetails(payload: IIssuanceWebhookInterface, orgId: string): Promise { - try { - - const { connectionId, createDateTime, id, threadId, state } = payload; - const credentialDetails = await this.prisma.credentials.upsert({ - where: { - threadId - }, - update: { - lastChangedBy: orgId, - createDateTime, - threadId, - connectionId, - state - }, - create: { - createDateTime, - lastChangedBy: orgId, - createdBy: orgId, - connectionId, - state, - threadId, - credentialExchangeId: id, - orgId - } - }); - return credentialDetails; - - } catch (error) { - this.logger.error(`Error in get saveIssuedCredentialDetails: ${error.message} `); - throw error; + /** + * Description: save credentials + * @param connectionId + * @returns Get saved credential details + */ + // eslint-disable-next-line camelcase + async saveIssuedCredentialDetails(payload: IssueCredentialWebhookPayload): Promise { + try { + let organisationId: string; + const { issueCredentialDto, id } = payload; + + if (issueCredentialDto?.contextCorrelationId) { + const getOrganizationId = await this.getOrganizationByTenantId(issueCredentialDto?.contextCorrelationId); + organisationId = getOrganizationId?.orgId; + } else { + organisationId = id; + } + + let schemaId = ''; + if (issueCredentialDto?.metadata?.['_anoncreds/credential']?.schemaId) { + schemaId = issueCredentialDto?.metadata?.['_anoncreds/credential']?.schemaId; + } + + const credentialDetails = await this.prisma.credentials.upsert({ + where: { + threadId: issueCredentialDto?.threadId + }, + update: { + lastChangedBy: organisationId, + createDateTime: issueCredentialDto?.createDateTime, + threadId: issueCredentialDto?.threadId, + connectionId: issueCredentialDto?.connectionId, + state: issueCredentialDto?.state + }, + create: { + createDateTime: issueCredentialDto?.createDateTime, + lastChangedBy: organisationId, + createdBy: organisationId, + connectionId: issueCredentialDto?.connectionId, + state: issueCredentialDto?.state, + threadId: issueCredentialDto?.threadId, + schemaId, + credentialExchangeId: issueCredentialDto?.id, + orgId: organisationId } + }); + return credentialDetails; + } catch (error) { + this.logger.error(`Error in get saveIssuedCredentialDetails: ${error.message} `); + throw error; } - - /** - * Description: Save connection details - * @param connectionInvitation - * @param agentId - * @param orgId - * @returns Get connection details - */ - // eslint-disable-next-line camelcase - async saveAgentConnectionInvitations(connectionInvitation: string, agentId: string, orgId: string): Promise { - try { - - const agentInvitationData = await this.prisma.agent_invitations.create({ - data: { - orgId, - agentId, - connectionInvitation, - multiUse: true - } - }); - return agentInvitationData; - } catch (error) { - this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); - throw error; + } + + /** + * Description: Save connection details + * @param connectionInvitation + * @param agentId + * @param orgId + * @returns Get connection details + */ + // eslint-disable-next-line camelcase + async saveAgentConnectionInvitations( + connectionInvitation: string, + agentId: string, + orgId: string + ): Promise { + try { + const agentInvitationData = await this.prisma.agent_invitations.create({ + data: { + orgId, + agentId, + connectionInvitation, + multiUse: true } + }); + return agentInvitationData; + } catch (error) { + this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); + throw error; } + } - /** - * Description: Save ShorteningUrl details - * @param referenceId - * @param connectionInvitationUrl - * @returns Get storeShorteningUrl details - */ - // eslint-disable-next-line camelcase - async storeShorteningUrl(referenceId: string, connectionInvitationUrl: string): Promise { - try { - - const createShorteningUrl = await this.prisma.shortening_url.create({ - data: { - referenceId, - url: connectionInvitationUrl, - type: null - } - }); - return createShorteningUrl; - } catch (error) { - this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); - throw error; + /** + * Description: Save ShorteningUrl details + * @param referenceId + * @param connectionInvitationUrl + * @returns Get storeShorteningUrl details + */ + // eslint-disable-next-line camelcase + async storeShorteningUrl(referenceId: string, connectionInvitationUrl: string): Promise { + try { + const createShorteningUrl = await this.prisma.shortening_url.create({ + data: { + referenceId, + url: connectionInvitationUrl, + type: null } + }); + return createShorteningUrl; + } catch (error) { + this.logger.error(`Error in saveAgentConnectionInvitations: ${error.message} `); + throw error; } + } - /** + /** * Get platform config details - * @returns + * @returns */ - // eslint-disable-next-line camelcase - async getPlatformConfigDetails(): Promise { - try { - - return this.prisma.platform_config.findFirst(); - - } catch (error) { - this.logger.error(`[getPlatformConfigDetails] - error: ${JSON.stringify(error)}`); - throw new InternalServerErrorException(error); - } + // eslint-disable-next-line camelcase + async getPlatformConfigDetails(): Promise { + try { + return this.prisma.platform_config.findFirst(); + } catch (error) { + this.logger.error(`[getPlatformConfigDetails] - error: ${JSON.stringify(error)}`); + throw new InternalServerErrorException(error); } + } - /** - * Get organization details - * @returns - */ - async getOrganization(orgId: string): Promise { - try { - - const organizationDetails = await this.prisma.organisation.findUnique({ where: { id: orgId } }); - return organizationDetails; - - } catch (error) { - this.logger.error(`[getOrganization] - error: ${JSON.stringify(error)}`); - throw new InternalServerErrorException(error); - } + /** + * Get organization details + * @returns + */ + async getOrganization(orgId: string): Promise { + try { + const organizationDetails = await this.prisma.organisation.findUnique({ where: { id: orgId } }); + return organizationDetails; + } catch (error) { + this.logger.error(`[getOrganization] - error: ${JSON.stringify(error)}`); + throw new InternalServerErrorException(error); } + } - async getCredentialDefinitionDetails(credentialDefinitionId: string): Promise { - try { - const credentialDefinitionDetails = await this.prisma.credential_definition.findFirst({ - where: { - credentialDefinitionId - } - }); - - if (!credentialDefinitionDetails) { - throw new NotFoundException(`Credential definition not found for ID: ${credentialDefinitionId}`); - } - - const schemaDetails = await this.prisma.schema.findFirst({ - where: { - schemaLedgerId: credentialDefinitionDetails.schemaLedgerId - } - }); - - if (!schemaDetails) { - throw new NotFoundException(`Schema not found for credential definition ID: ${credentialDefinitionId}`); - } - - const credentialDefRes = { - credentialDefinitionId: credentialDefinitionDetails.credentialDefinitionId, - tag: credentialDefinitionDetails.tag, - schemaLedgerId: schemaDetails.schemaLedgerId, - attributes: schemaDetails.attributes - }; - - return credentialDefRes; - } catch (error) { - this.logger.error(`Error in getCredentialDefinitionDetails: ${error.message}`); - throw new InternalServerErrorException(error.message); + async getCredentialDefinitionDetails(credentialDefinitionId: string): Promise { + try { + const credentialDefinitionDetails = await this.prisma.credential_definition.findFirst({ + where: { + credentialDefinitionId } - } + }); - async saveFileUploadDetails(fileUploadPayload, userId: string): Promise { - try { - const { name, status, upload_type, orgId } = fileUploadPayload; - return this.prisma.file_upload.create({ - data: { - name: String(name), - orgId: String(orgId), - status, - upload_type, - createdBy: userId, - lastChangedBy: userId - } - }); - - } catch (error) { - this.logger.error(`[saveFileUploadDetails] - error: ${JSON.stringify(error)}`); - throw error; - } - } + if (!credentialDefinitionDetails) { + throw new NotFoundException(`Credential definition not found for ID: ${credentialDefinitionId}`); + } - async updateFileUploadDetails(fileId: string, fileUploadPayload): Promise { - try { - const { status } = fileUploadPayload; - return this.prisma.file_upload.update({ - where: { - id: fileId - }, - data: { - status - } - }); - - } catch (error) { - this.logger.error(`[updateFileUploadDetails] - error: ${JSON.stringify(error)}`); - throw error; + const schemaDetails = await this.prisma.schema.findFirst({ + where: { + schemaLedgerId: credentialDefinitionDetails.schemaLedgerId } + }); + + if (!schemaDetails) { + throw new NotFoundException(`Schema not found for credential definition ID: ${credentialDefinitionId}`); + } + + const credentialDefRes = { + credentialDefinitionId: credentialDefinitionDetails.credentialDefinitionId, + tag: credentialDefinitionDetails.tag, + schemaLedgerId: schemaDetails.schemaLedgerId, + attributes: schemaDetails.attributes + }; + + return credentialDefRes; + } catch (error) { + this.logger.error(`Error in getCredentialDefinitionDetails: ${error.message}`); + throw new InternalServerErrorException(error.message); } - - async countErrorsForFile(fileUploadId: string): Promise { - try { - const errorCount = await this.prisma.file_data.count({ - where: { - fileUploadId, - isError: true - } - }); - - return errorCount; - } catch (error) { - this.logger.error(`[countErrorsForFile] - error: ${JSON.stringify(error)}`); - throw error; + } + + async saveFileUploadDetails(fileUploadPayload, userId: string): Promise { + try { + const { name, status, upload_type, orgId } = fileUploadPayload; + return this.prisma.file_upload.create({ + data: { + name: String(name), + orgId: String(orgId), + status, + upload_type, + createdBy: userId, + lastChangedBy: userId } + }); + } catch (error) { + this.logger.error(`[saveFileUploadDetails] - error: ${JSON.stringify(error)}`); + throw error; } - async getAllFileDetails(orgId: string, getAllfileDetails: PreviewRequest): Promise<{ - fileCount: number; - fileList: { - id: string; - name: string; - status: string; - upload_type: string; - orgId: string; - createDateTime: Date; - createdBy: string; - lastChangedDateTime: Date; - lastChangedBy: string; - deletedAt: Date; - failedRecords: number; - totalRecords: number; - }[]; - }> { - try { - const fileList = await this.prisma.file_upload.findMany({ - where: { - orgId: String(orgId), - OR: [ - { name: { contains: getAllfileDetails?.search, mode: 'insensitive' } }, - { status: { contains: getAllfileDetails?.search, mode: 'insensitive' } }, - { upload_type: { contains: getAllfileDetails?.search, mode: 'insensitive' } } - ] - }, - take: Number(getAllfileDetails?.pageSize), - skip: (getAllfileDetails?.pageNumber - 1) * getAllfileDetails?.pageSize, - orderBy: { - createDateTime: 'desc' - } - }); - - const fileListWithDetails = await Promise.all( - fileList.map(async (file) => { - const failedRecords = await this.countErrorsForFile(file.id); - const totalRecords = await this.prisma.file_data.count({ - where: { - fileUploadId: file.id - } - }); - const successfulRecords = totalRecords - failedRecords; - return { ...file, failedRecords, totalRecords, successfulRecords }; - }) - ); - - const fileCount = await this.prisma.file_upload.count({ - where: { - orgId: String(orgId) - } - }); - - return { fileCount, fileList: fileListWithDetails }; - } catch (error) { - this.logger.error(`[getFileUploadDetails] - error: ${JSON.stringify(error)}`); - throw error; + } + + async updateFileUploadDetails(fileId: string, fileUploadPayload): Promise { + try { + const { status } = fileUploadPayload; + return this.prisma.file_upload.update({ + where: { + id: fileId + }, + data: { + status } + }); + } catch (error) { + this.logger.error(`[updateFileUploadDetails] - error: ${JSON.stringify(error)}`); + throw error; } - - async getFileDetailsByFileId(fileId: unknown, getAllfileDetails: PreviewRequest): Promise<{ - fileCount: number - fileDataList: { - id: string; - referenceId: string; - isError: boolean; - error: string; - detailError: string; - createDateTime: Date; - createdBy: string; - lastChangedDateTime: Date; - lastChangedBy: string; - deletedAt: Date; - fileUploadId: string; - }[] - }> { - try { - const fileDataList = await this.prisma.file_data.findMany({ - where: { - fileUploadId: fileId, - OR: [ - { error: { contains: getAllfileDetails?.search, mode: 'insensitive' } }, - { referenceId: { contains: getAllfileDetails?.search, mode: 'insensitive' } }, - { detailError: { contains: getAllfileDetails?.search, mode: 'insensitive' } } - ] - }, - take: Number(getAllfileDetails?.pageSize), - skip: (getAllfileDetails?.pageNumber - 1) * getAllfileDetails?.pageSize, - orderBy: { - createDateTime: 'desc' - } - }); - const fileCount = await this.prisma.file_data.count({ - where: { - fileUploadId: fileId - } - }); - return { fileCount, fileDataList }; - } catch (error) { - this.logger.error(`[getFileDetailsByFileId] - error: ${JSON.stringify(error)}`); - throw error; + } + + async countErrorsForFile(fileUploadId: string): Promise { + try { + const errorCount = await this.prisma.file_data.count({ + where: { + fileUploadId, + isError: true } - } - + }); - async updateFileUploadData(fileUploadData: FileUploadData): Promise { - try { - const { jobId, fileUpload, isError, referenceId, error, detailError } = fileUploadData; - if (jobId) { - return this.prisma.file_data.update({ - where: { id: jobId }, - data: { - detailError, - error, - isError, - referenceId, - fileUploadId: fileUpload - } - }); - } else { - throw error; + return errorCount; + } catch (error) { + this.logger.error(`[countErrorsForFile] - error: ${JSON.stringify(error)}`); + throw error; + } + } + async getAllFileDetails( + orgId: string, + getAllfileDetails: PreviewRequest + ): Promise<{ + fileCount: number; + fileList: { + id: string; + name: string; + status: string; + upload_type: string; + orgId: string; + createDateTime: Date; + createdBy: string; + lastChangedDateTime: Date; + lastChangedBy: string; + deletedAt: Date; + failedRecords: number; + totalRecords: number; + }[]; + }> { + try { + const fileList = await this.prisma.file_upload.findMany({ + where: { + orgId: String(orgId), + OR: [ + { name: { contains: getAllfileDetails?.search, mode: 'insensitive' } }, + { status: { contains: getAllfileDetails?.search, mode: 'insensitive' } }, + { upload_type: { contains: getAllfileDetails?.search, mode: 'insensitive' } } + ] + }, + take: Number(getAllfileDetails?.pageSize), + skip: (getAllfileDetails?.pageNumber - 1) * getAllfileDetails?.pageSize, + orderBy: { + createDateTime: 'desc' + } + }); + + const fileListWithDetails = await Promise.all( + fileList.map(async (file) => { + const failedRecords = await this.countErrorsForFile(file.id); + const totalRecords = await this.prisma.file_data.count({ + where: { + fileUploadId: file.id } - } catch (error) { - this.logger.error(`[saveFileUploadData] - error: ${JSON.stringify(error)}`); - throw error; + }); + const successfulRecords = totalRecords - failedRecords; + return { ...file, failedRecords, totalRecords, successfulRecords }; + }) + ); + + const fileCount = await this.prisma.file_upload.count({ + where: { + orgId: String(orgId) } + }); + + return { fileCount, fileList: fileListWithDetails }; + } catch (error) { + this.logger.error(`[getFileUploadDetails] - error: ${JSON.stringify(error)}`); + throw error; } - async deleteFileDataByJobId(jobId: string): Promise { - try { - if (jobId) { - return this.prisma.file_data.update({ - where: { id: jobId }, - data: { - credential_data: null - } - }); - } - } catch (error) { - this.logger.error(`[saveFileUploadData] - error: ${JSON.stringify(error)}`); - throw error; + } + + async getFileDetailsByFileId( + fileId: unknown, + getAllfileDetails: PreviewRequest + ): Promise<{ + fileCount: number; + fileDataList: { + id: string; + referenceId: string; + isError: boolean; + error: string; + detailError: string; + createDateTime: Date; + createdBy: string; + lastChangedDateTime: Date; + lastChangedBy: string; + deletedAt: Date; + fileUploadId: string; + }[]; + }> { + try { + const fileDataList = await this.prisma.file_data.findMany({ + where: { + fileUploadId: fileId, + OR: [ + { error: { contains: getAllfileDetails?.search, mode: 'insensitive' } }, + { referenceId: { contains: getAllfileDetails?.search, mode: 'insensitive' } }, + { detailError: { contains: getAllfileDetails?.search, mode: 'insensitive' } } + ] + }, + take: Number(getAllfileDetails?.pageSize), + skip: (getAllfileDetails?.pageNumber - 1) * getAllfileDetails?.pageSize, + orderBy: { + createDateTime: 'desc' + } + }); + const fileCount = await this.prisma.file_data.count({ + where: { + fileUploadId: fileId } + }); + return { fileCount, fileDataList }; + } catch (error) { + this.logger.error(`[getFileDetailsByFileId] - error: ${JSON.stringify(error)}`); + throw error; } - - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-unused-vars - async saveFileDetails(fileData, userId: string) { - try { - const { credential_data, schemaId, credDefId, status, isError, fileUploadId } = fileData; - return this.prisma.file_data.create({ - data: { - credential_data, - schemaId, - credDefId, - status, - fileUploadId, - isError, - createdBy: userId, - lastChangedBy: userId - } - }); - - } catch (error) { - this.logger.error(`[saveFileUploadData] - error: ${JSON.stringify(error)}`); - throw error; + } + + async updateFileUploadData(fileUploadData: FileUploadData): Promise { + try { + const { jobId, fileUpload, isError, referenceId, error, detailError } = fileUploadData; + if (jobId) { + return this.prisma.file_data.update({ + where: { id: jobId }, + data: { + detailError, + error, + isError, + referenceId, + fileUploadId: fileUpload + } + }); + } else { + throw error; + } + } catch (error) { + this.logger.error(`[saveFileUploadData] - error: ${JSON.stringify(error)}`); + throw error; + } + } + async deleteFileDataByJobId(jobId: string): Promise { + try { + if (jobId) { + return this.prisma.file_data.update({ + where: { id: jobId }, + data: { + credential_data: null + } + }); + } + } catch (error) { + this.logger.error(`[saveFileUploadData] - error: ${JSON.stringify(error)}`); + throw error; + } + } + + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-unused-vars + async saveFileDetails(fileData, userId: string) { + try { + const { credential_data, schemaId, credDefId, status, isError, fileUploadId } = fileData; + return this.prisma.file_data.create({ + data: { + credential_data, + schemaId, + credDefId, + status, + fileUploadId, + isError, + createdBy: userId, + lastChangedBy: userId } + }); + } catch (error) { + this.logger.error(`[saveFileUploadData] - error: ${JSON.stringify(error)}`); + throw error; } + } - async getOrgAgentType(orgAgentId: string): Promise { - try { - - const { agent } = await this.prisma.org_agents_type.findFirst({ - where: { - id: orgAgentId - } - }); - - return agent; - } catch (error) { - this.logger.error(`[getOrgAgentType] - error: ${JSON.stringify(error)}`); + async getOrgAgentType(orgAgentId: string): Promise { + try { + const { agent } = await this.prisma.org_agents_type.findFirst({ + where: { + id: orgAgentId } + }); + + return agent; + } catch (error) { + this.logger.error(`[getOrgAgentType] - error: ${JSON.stringify(error)}`); } + } - async getFileDetails(fileId: string): Promise { - try { - return this.prisma.file_data.findMany({ - where: { - fileUploadId: fileId - } - }); - } catch (error) { - this.logger.error(`[getFileDetails] - error: ${JSON.stringify(error)}`); - throw error; + async getFileDetails(fileId: string): Promise { + try { + return this.prisma.file_data.findMany({ + where: { + fileUploadId: fileId } + }); + } catch (error) { + this.logger.error(`[getFileDetails] - error: ${JSON.stringify(error)}`); + throw error; } - - async getFailedCredentials(fileId: string): Promise { - try { - return this.prisma.file_data.findMany({ - where: { - fileUploadId: fileId, - isError: true - } - }); - } catch (error) { - this.logger.error(`[getFileDetails] - error: ${JSON.stringify(error)}`); - throw error; + } + + async getFailedCredentials(fileId: string): Promise { + try { + return this.prisma.file_data.findMany({ + where: { + fileUploadId: fileId, + isError: true } + }); + } catch (error) { + this.logger.error(`[getFileDetails] - error: ${JSON.stringify(error)}`); + throw error; } - - async updateFileUploadStatus(fileId: string): Promise { - try { - return this.prisma.file_upload.update({ - where: { - id: fileId - }, - data: { - status: FileUploadStatus.retry - } - }); - - } catch (error) { - this.logger.error(`[updateFileUploadStatus] - error: ${JSON.stringify(error)}`); - throw error; + } + + async updateFileUploadStatus(fileId: string): Promise { + try { + return this.prisma.file_upload.update({ + where: { + id: fileId + }, + data: { + status: FileUploadStatus.retry } + }); + } catch (error) { + this.logger.error(`[updateFileUploadStatus] - error: ${JSON.stringify(error)}`); + throw error; } + } - async getFileDetailsById(fileId: string): Promise { - try { - return this.prisma.file_upload.findUnique({ - where: { - id: fileId - } - }); - - } catch (error) { - this.logger.error(`[updateFileUploadStatus] - error: ${JSON.stringify(error)}`); - throw error; + async getFileDetailsById(fileId: string): Promise { + try { + return this.prisma.file_upload.findUnique({ + where: { + id: fileId } + }); + } catch (error) { + this.logger.error(`[updateFileUploadStatus] - error: ${JSON.stringify(error)}`); + throw error; } -} \ No newline at end of file + } +} diff --git a/apps/issuance/src/issuance.service.ts b/apps/issuance/src/issuance.service.ts index 95807f65b..58f446d51 100644 --- a/apps/issuance/src/issuance.service.ts +++ b/apps/issuance/src/issuance.service.ts @@ -8,7 +8,7 @@ import { CommonConstants } from '@credebl/common/common.constant'; import { ResponseMessages } from '@credebl/common/response-messages'; import { ClientProxy, RpcException } from '@nestjs/microservices'; import { map } from 'rxjs'; -import { ClientDetails, FileUploadData, IIssuanceWebhookInterface, ImportFileDetails, OutOfBandCredentialOfferPayload, PreviewRequest, SchemaDetails } from '../interfaces/issuance.interfaces'; +import { ClientDetails, FileUploadData, ImportFileDetails, IssueCredentialWebhookPayload, OutOfBandCredentialOfferPayload, PreviewRequest, SchemaDetails } from '../interfaces/issuance.interfaces'; import { OrgAgentType } from '@credebl/enum/enum'; import { platform_config } from '@prisma/client'; import * as QRCode from 'qrcode'; @@ -28,6 +28,7 @@ import { Queue } from 'bull'; import { FileUploadStatus, FileUploadType } from 'apps/api-gateway/src/enum'; import { AwsService } from '@credebl/aws'; import { io } from 'socket.io-client'; +import { IIssuedCredentialSearchinterface } from 'apps/api-gateway/src/issuance/interfaces'; @Injectable() export class IssuanceService { @@ -174,46 +175,110 @@ export class IssuanceService { } } - async getIssueCredentials(user: IUserRequest, threadId: string, connectionId: string, state: string, orgId: string): Promise { + // async getIssueCredentials(user: IUserRequest, threadId: string, connectionId: string, state: string, orgId: string): Promise { + // try { + // const agentDetails = await this.issuanceRepository.getAgentEndPoint(orgId); + // const platformConfig: platform_config = await this.issuanceRepository.getPlatformConfigDetails(); + + // const { agentEndPoint } = agentDetails; + // if (!agentDetails) { + // throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound); + // } + // const params = { + // threadId, + // connectionId, + // state + // }; + + // const orgAgentType = await this.issuanceRepository.getOrgAgentType(agentDetails?.orgAgentTypeId); + // const issuanceMethodLabel = 'get-issue-credentials'; + // let url = await this.getAgentUrl(issuanceMethodLabel, orgAgentType, agentEndPoint, agentDetails?.tenantId); + + // Object.keys(params).forEach((element: string) => { + // const appendParams: string = url.includes('?') ? '&' : '?'; + + // if (params[element] !== undefined) { + // url = `${url + appendParams + element}=${params[element]}`; + // } + // }); + // const apiKey = platformConfig?.sgApiKey; + // const issueCredentialsDetails = await this._getIssueCredentials(url, apiKey); + // return issueCredentialsDetails?.response; + // } catch (error) { + // this.logger.error(`[sendCredentialCreateOffer] - error in create credentials : ${JSON.stringify(error)}`); + // if (error && error?.status && error?.status?.message && error?.status?.message?.error) { + // throw new RpcException({ + // message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, + // statusCode: error?.status?.code + // }); + + // } else { + // throw new RpcException(error.response ? error.response : error); + // } + // } + // } + + async getIssueCredentials( + user: IUserRequest, + orgId: string, + issuedCredentialsSearchCriteria: IIssuedCredentialSearchinterface + ): Promise<{ + totalItems: number; + hasNextPage: boolean; + hasPreviousPage: boolean; + nextPage: number; + previousPage: number; + lastPage: number; + data: { + createDateTime: Date; + createdBy: string; + connectionId: string; + schemaId: string; + state: string; + orgId: string; + }[]; + }> { try { - const agentDetails = await this.issuanceRepository.getAgentEndPoint(orgId); - const platformConfig: platform_config = await this.issuanceRepository.getPlatformConfigDetails(); - - const { agentEndPoint } = agentDetails; - if (!agentDetails) { - throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound); - } - const params = { - threadId, - connectionId, - state + const getIssuedCredentialsList = await this.issuanceRepository.getAllIssuedCredentials( + user, + orgId, + issuedCredentialsSearchCriteria + ); + const issuedCredentialsResponse: { + totalItems: number; + hasNextPage: boolean; + hasPreviousPage: boolean; + nextPage: number; + previousPage: number; + lastPage: number; + data: { + createDateTime: Date; + createdBy: string; + connectionId: string; + schemaId: string; + state: string; + orgId: string; + }[]; + } = { + totalItems: getIssuedCredentialsList.issuedCredentialsCount, + hasNextPage: + issuedCredentialsSearchCriteria.pageSize * issuedCredentialsSearchCriteria.pageNumber < getIssuedCredentialsList.issuedCredentialsCount, + hasPreviousPage: 1 < issuedCredentialsSearchCriteria.pageNumber, + nextPage: Number(issuedCredentialsSearchCriteria.pageNumber) + 1, + previousPage: issuedCredentialsSearchCriteria.pageNumber - 1, + lastPage: Math.ceil(getIssuedCredentialsList.issuedCredentialsCount / issuedCredentialsSearchCriteria.pageSize), + data: getIssuedCredentialsList.issuedCredentialsList }; - const orgAgentType = await this.issuanceRepository.getOrgAgentType(agentDetails?.orgAgentTypeId); - const issuanceMethodLabel = 'get-issue-credentials'; - let url = await this.getAgentUrl(issuanceMethodLabel, orgAgentType, agentEndPoint, agentDetails?.tenantId); - - Object.keys(params).forEach((element: string) => { - const appendParams: string = url.includes('?') ? '&' : '?'; - - if (params[element] !== undefined) { - url = `${url + appendParams + element}=${params[element]}`; - } - }); - const apiKey = platformConfig?.sgApiKey; - const issueCredentialsDetails = await this._getIssueCredentials(url, apiKey); - return issueCredentialsDetails?.response; - } catch (error) { - this.logger.error(`[sendCredentialCreateOffer] - error in create credentials : ${JSON.stringify(error)}`); - if (error && error?.status && error?.status?.message && error?.status?.message?.error) { - throw new RpcException({ - message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, - statusCode: error?.status?.code - }); - + if (0 !== getIssuedCredentialsList.issuedCredentialsCount) { + return issuedCredentialsResponse; } else { - throw new RpcException(error.response ? error.response : error); + throw new NotFoundException(ResponseMessages.connection.error.connectionNotFound); } + } catch (error) { + throw new RpcException( + `[getConnections] [NATS call]- error in fetch connections details : ${JSON.stringify(error)}` + ); } } @@ -262,9 +327,9 @@ export class IssuanceService { } } - async getIssueCredentialWebhook(payload: IIssuanceWebhookInterface, id: string): Promise { + async getIssueCredentialWebhook(payload: IssueCredentialWebhookPayload): Promise { try { - const agentDetails = await this.issuanceRepository.saveIssuedCredentialDetails(payload, id); + const agentDetails = await this.issuanceRepository.saveIssuedCredentialDetails(payload); return agentDetails; } catch (error) { this.logger.error(`[getIssueCredentialsbyCredentialRecordId] - error in get credentials : ${JSON.stringify(error)}`); diff --git a/apps/verification/src/interfaces/verification.interface.ts b/apps/verification/src/interfaces/verification.interface.ts index fc99e0b68..fe4ce1645 100644 --- a/apps/verification/src/interfaces/verification.interface.ts +++ b/apps/verification/src/interfaces/verification.interface.ts @@ -99,6 +99,10 @@ interface IWebhookPresentationProof { connectionId } +export interface IWebhookProofPresentationPayload { + proofPresentationDto: IWebhookProofPresentation; + id: string; +} export interface IWebhookProofPresentation { metadata: object; _tags: IWebhookPresentationProof; @@ -111,4 +115,26 @@ export interface IWebhookProofPresentation { autoAcceptProof: string; updatedAt: string; isVerified: boolean; + contextCorrelationId: string; +} + +export interface ProofPresentationPayload { + proofPresentationPayload: IWebhookProofPresentation; + id: string; } + +export interface IProofRequests { + proofRequestsSearchCriteria: IProofRequestsSearchCriteria; + user: IUserRequest; + orgId: string; + } + +export interface IProofRequestsSearchCriteria { + pageNumber: number; + pageSize: number; + sorting: string; + sortByValue: string; + searchByText: string; + // user?: IUserRequestInterface; + } + diff --git a/apps/verification/src/repositories/verification.repository.ts b/apps/verification/src/repositories/verification.repository.ts index 895e01a96..bb1eed3f8 100644 --- a/apps/verification/src/repositories/verification.repository.ts +++ b/apps/verification/src/repositories/verification.repository.ts @@ -1,115 +1,218 @@ -import { ResponseMessages } from "@credebl/common/response-messages"; -import { PrismaService } from "@credebl/prisma-service"; -import { Injectable, Logger, NotFoundException } from "@nestjs/common"; +import { ResponseMessages } from '@credebl/common/response-messages'; +import { PrismaService } from '@credebl/prisma-service'; +import { Injectable, Logger, NotFoundException } from '@nestjs/common'; // eslint-disable-next-line camelcase -import { org_agents, organisation, platform_config, presentations } from "@prisma/client"; -import { IWebhookProofPresentation } from "../interfaces/verification.interface"; - +import { org_agents, organisation, platform_config, presentations } from '@prisma/client'; +import { ProofPresentationPayload } from '../interfaces/verification.interface'; +import { IUserRequest } from '@credebl/user-request/user-request.interface'; +import { IProofRequestsSearchCriteria } from 'apps/api-gateway/src/verification/interfaces/verification.interface'; @Injectable() export class VerificationRepository { - constructor(private readonly prisma: PrismaService, private readonly logger: Logger) { } - - /** - * Get org agent details - * @param orgId - * @returns - */ - // eslint-disable-next-line camelcase - async getAgentEndPoint(orgId: string): Promise { - try { - - const agentDetails = await this.prisma.org_agents.findFirst({ - where: { - orgId - } - }); - - if (!agentDetails) { - throw new NotFoundException(ResponseMessages.verification.error.notFound); - } - - return agentDetails; - - } catch (error) { - this.logger.error(`[getProofPresentations] - error in get agent endpoint : ${error.message} `); - throw error; - } - } - - async storeProofPresentation(id: string, proofPresentationPayload: IWebhookProofPresentation): Promise { - try { - - return await this.prisma.presentations.upsert({ - where: { - threadId: proofPresentationPayload.threadId - }, - update: { - state: proofPresentationPayload.state, - threadId: proofPresentationPayload.threadId, - isVerified: proofPresentationPayload.isVerified - }, - create: { - connectionId: proofPresentationPayload.connectionId, - createdBy: id, - lastChangedBy: id, - state: proofPresentationPayload.state, - threadId: proofPresentationPayload.threadId, - isVerified: proofPresentationPayload.isVerified, - orgId: id - } - }); - - } catch (error) { - this.logger.error(`[getProofPresentations] - error in get agent endpoint : ${error.message} `); - throw error; + constructor( + private readonly prisma: PrismaService, + private readonly logger: Logger + ) {} + + /** + * Get org agent details + * @param orgId + * @returns + */ + // eslint-disable-next-line camelcase + async getAgentEndPoint(orgId: string): Promise { + try { + const agentDetails = await this.prisma.org_agents.findFirst({ + where: { + orgId } - } - - /** - * Get platform config details - * @returns - */ - // eslint-disable-next-line camelcase - async getPlatformConfigDetails(): Promise { - try { + }); - return this.prisma.platform_config.findFirst(); + if (!agentDetails) { + throw new NotFoundException(ResponseMessages.verification.error.notFound); + } - } catch (error) { - this.logger.error(`[getPlatformConfigDetails] - error: ${JSON.stringify(error)}`); - throw error; + return agentDetails; + } catch (error) { + this.logger.error(`[getProofPresentations] - error in get agent endpoint : ${error.message} `); + throw error; + } + } + + // eslint-disable-next-line camelcase + async getOrganizationByTenantId(tenantId: string): Promise { + try { + return this.prisma.org_agents.findFirst({ + where: { + tenantId } + }); + } catch (error) { + this.logger.error(`Error in getOrganization in issuance repository: ${error.message} `); + throw error; } + } + + async getAllProofRequests( + user: IUserRequest, + orgId: string, + proofRequestsSearchCriteria: IProofRequestsSearchCriteria + ): Promise<{ + proofRequestsCount: number; + proofRequestsList: { + createDateTime: Date; + createdBy: string; + connectionId: string; + state: string; + orgId: string; + }[]; + }> { + try { + const proofRequestsList = await this.prisma.presentations.findMany({ + where: { + orgId, + OR: [{ connectionId: { contains: proofRequestsSearchCriteria.searchByText, mode: 'insensitive' } }] + }, + select: { + createDateTime: true, + createdBy: true, + orgId: true, + state: true, + connectionId: true + }, + orderBy: { + [proofRequestsSearchCriteria.sorting]: + 'DESC' === proofRequestsSearchCriteria.sortByValue + ? 'desc' + : 'ASC' === proofRequestsSearchCriteria.sortByValue + ? 'asc' + : 'desc' + }, + take: Number(proofRequestsSearchCriteria.pageSize), + skip: (proofRequestsSearchCriteria.pageNumber - 1) * proofRequestsSearchCriteria.pageSize + }); + const proofRequestsCount = await this.prisma.presentations.count({ + where: { + organisation: { + id: orgId + } + } + }); - /** - * Get organization details - * @returns - */ - async getOrganization(orgId: string): Promise { - try { - - return this.prisma.organisation.findFirst({ where: { id: orgId } }); - - } catch (error) { - this.logger.error(`[getOrganization] - error: ${JSON.stringify(error)}`); - throw error; + return { proofRequestsCount, proofRequestsList }; + } catch (error) { + this.logger.error(`[getAllProofRequests] - error: ${JSON.stringify(error)}`); + throw error; + } + } + + // async storeProofPresentation(id: string, proofPresentationPayload: IWebhookProofPresentation): Promise { + // try { + + // return await this.prisma.presentations.upsert({ + // where: { + // threadId: proofPresentationPayload.threadId + // }, + // update: { + // state: proofPresentationPayload.state, + // threadId: proofPresentationPayload.threadId, + // isVerified: proofPresentationPayload.isVerified + // }, + // create: { + // connectionId: proofPresentationPayload.connectionId, + // createdBy: id, + // lastChangedBy: id, + // state: proofPresentationPayload.state, + // threadId: proofPresentationPayload.threadId, + // isVerified: proofPresentationPayload.isVerified, + // orgId: id + // } + // }); + + // } catch (error) { + // this.logger.error(`[getProofPresentations] - error in get agent endpoint : ${error.message} `); + // throw error; + // } + // } + + async storeProofPresentation(payload: ProofPresentationPayload): Promise { + try { + let organisationId: string; + const { proofPresentationPayload, id } = payload; + + if (proofPresentationPayload?.contextCorrelationId) { + const getOrganizationId = await this.getOrganizationByTenantId(proofPresentationPayload?.contextCorrelationId); + organisationId = getOrganizationId?.orgId; + } else { + organisationId = id; + } + + const proofPresentationsDetails = await this.prisma.presentations.upsert({ + where: { + threadId: proofPresentationPayload?.threadId + }, + update: { + state: proofPresentationPayload.state, + threadId: proofPresentationPayload.threadId, + isVerified: proofPresentationPayload.isVerified, + lastChangedBy: organisationId + }, + create: { + connectionId: proofPresentationPayload.connectionId, + createdBy: organisationId, + lastChangedBy: organisationId, + state: proofPresentationPayload.state, + threadId: proofPresentationPayload.threadId, + isVerified: proofPresentationPayload.isVerified, + orgId: organisationId } + }); + return proofPresentationsDetails; + } catch (error) { + this.logger.error(`Error in get saveIssuedCredentialDetails: ${error.message} `); + throw error; } + } + + /** + * Get platform config details + * @returns + */ + // eslint-disable-next-line camelcase + async getPlatformConfigDetails(): Promise { + try { + return this.prisma.platform_config.findFirst(); + } catch (error) { + this.logger.error(`[getPlatformConfigDetails] - error: ${JSON.stringify(error)}`); + throw error; + } + } + + /** + * Get organization details + * @returns + */ + async getOrganization(orgId: string): Promise { + try { + return this.prisma.organisation.findFirst({ where: { id: orgId } }); + } catch (error) { + this.logger.error(`[getOrganization] - error: ${JSON.stringify(error)}`); + throw error; + } + } - async getOrgAgentType(orgAgentId: string): Promise { - try { - - const { agent } = await this.prisma.org_agents_type.findFirst({ - where: { - id: orgAgentId - } - }); - - return agent; - } catch (error) { - this.logger.error(`[getOrgAgentType] - error: ${JSON.stringify(error)}`); - throw error; + async getOrgAgentType(orgAgentId: string): Promise { + try { + const { agent } = await this.prisma.org_agents_type.findFirst({ + where: { + id: orgAgentId } + }); + + return agent; + } catch (error) { + this.logger.error(`[getOrgAgentType] - error: ${JSON.stringify(error)}`); + throw error; } -} \ No newline at end of file + } +} diff --git a/apps/verification/src/verification.controller.ts b/apps/verification/src/verification.controller.ts index 248ee5e31..b42809911 100644 --- a/apps/verification/src/verification.controller.ts +++ b/apps/verification/src/verification.controller.ts @@ -1,7 +1,7 @@ import { Controller } from '@nestjs/common'; import { VerificationService } from './verification.service'; import { MessagePattern } from '@nestjs/microservices'; -import { IRequestProof, IWebhookProofPresentation, ProofFormData } from './interfaces/verification.interface'; +import { IProofRequests, IRequestProof, ProofFormData, ProofPresentationPayload } from './interfaces/verification.interface'; import { IUserRequest } from '@credebl/user-request/user-request.interface'; import { presentations } from '@prisma/client'; @@ -14,9 +14,15 @@ export class VerificationController { * @param payload * @returns Get all proof presentation */ + // @MessagePattern({ cmd: 'get-proof-presentations' }) + // async getProofPresentations(payload: { user: IUserRequest, threadId: string, orgId: string }): Promise { + // return this.verificationService.getProofPresentations(payload.orgId, payload.threadId); + // } + @MessagePattern({ cmd: 'get-proof-presentations' }) - async getProofPresentations(payload: { user: IUserRequest, threadId: string, orgId: string }): Promise { - return this.verificationService.getProofPresentations(payload.orgId, payload.threadId); + async getProofPresentations(payload: IProofRequests): Promise { + const { user, orgId, proofRequestsSearchCriteria} = payload; + return this.verificationService.getProofPresentations(user, orgId, proofRequestsSearchCriteria); } /** @@ -50,8 +56,8 @@ export class VerificationController { } @MessagePattern({ cmd: 'webhook-proof-presentation' }) - async webhookProofPresentation(payload: { id: string, proofPresentationPayload: IWebhookProofPresentation }): Promise { - return this.verificationService.webhookProofPresentation(payload.id, payload.proofPresentationPayload); + async webhookProofPresentation(payload: ProofPresentationPayload): Promise { + return this.verificationService.webhookProofPresentation(payload); } @MessagePattern({ cmd: 'send-out-of-band-proof-request' }) diff --git a/apps/verification/src/verification.service.ts b/apps/verification/src/verification.service.ts index 5a1e1c474..f39f29c59 100644 --- a/apps/verification/src/verification.service.ts +++ b/apps/verification/src/verification.service.ts @@ -2,7 +2,7 @@ import { BadRequestException, HttpException, Inject, Injectable, InternalServerErrorException, Logger, NotFoundException } from '@nestjs/common'; import { ClientProxy, RpcException } from '@nestjs/microservices'; import { map } from 'rxjs/operators'; -import { IGetAllProofPresentations, IGetProofPresentationById, IProofRequestPayload, IRequestProof, ISendProofRequestPayload, IVerifyPresentation, IWebhookProofPresentation, ProofFormDataPayload } from './interfaces/verification.interface'; +import { IGetAllProofPresentations, IGetProofPresentationById, IProofRequestPayload, IRequestProof, ISendProofRequestPayload, IVerifyPresentation, ProofFormDataPayload, ProofPresentationPayload } from './interfaces/verification.interface'; import { VerificationRepository } from './repositories/verification.repository'; import { CommonConstants } from '@credebl/common/common.constant'; import { org_agents, organisation, presentations } from '@prisma/client'; @@ -12,6 +12,8 @@ import * as QRCode from 'qrcode'; import { OutOfBandVerification } from '../templates/out-of-band-verification.template'; import { EmailDto } from '@credebl/common/dtos/email.dto'; import { sendEmail } from '@credebl/common/send-grid-helper-file'; +import { IUserRequest } from '@credebl/user-request/user-request.interface'; +import { IProofRequestsSearchCriteria } from 'apps/api-gateway/src/verification/interfaces/verification.interface'; @Injectable() export class VerificationService { @@ -32,34 +34,96 @@ export class VerificationService { * @param orgId * @returns Get all proof presentation */ - async getProofPresentations(orgId: string, threadId: string): Promise { + // async getProofPresentations(orgId: string, threadId: string): Promise { + // try { + // const getAgentDetails = await this.verificationRepository.getAgentEndPoint(orgId); + + // const orgAgentType = await this.verificationRepository.getOrgAgentType(getAgentDetails?.orgAgentTypeId); + // const verificationMethodLabel = 'get-proof-presentation'; + // let url; + // if (threadId) { + // url = await this.getAgentUrl(verificationMethodLabel, orgAgentType, getAgentDetails?.agentEndPoint, getAgentDetails?.tenantId, threadId); + // } else { + // url = await this.getAgentUrl(verificationMethodLabel, orgAgentType, getAgentDetails?.agentEndPoint, getAgentDetails?.tenantId); + // } + + // const payload = { apiKey: getAgentDetails.apiKey, url }; + // const getProofPresentationsDetails = await this._getProofPresentations(payload); + // return getProofPresentationsDetails?.response; + + // } catch (error) { + // this.logger.error(`[getProofPresentations] - error in get proof presentation : ${JSON.stringify(error)}`); + // if (error && error?.status && error?.status?.message && error?.status?.message?.error) { + // throw new RpcException({ + // message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, + // statusCode: error?.status?.code + // }); + + // } else { + // throw new RpcException(error.response ? error.response : error); + // } + // } + // } + + async getProofPresentations( + user: IUserRequest, + orgId: string, + proofRequestsSearchCriteria: IProofRequestsSearchCriteria + ): Promise<{ + totalItems: number; + hasNextPage: boolean; + hasPreviousPage: boolean; + nextPage: number; + previousPage: number; + lastPage: number; + data: { + createDateTime: Date; + createdBy: string; + connectionId: string; + state: string; + orgId: string; + }[]; + }> { try { - const getAgentDetails = await this.verificationRepository.getAgentEndPoint(orgId); + const getProofRequestsList = await this.verificationRepository.getAllProofRequests( + user, + orgId, + proofRequestsSearchCriteria + ); + const issuedCredentialsResponse: { + totalItems: number; + hasNextPage: boolean; + hasPreviousPage: boolean; + nextPage: number; + previousPage: number; + lastPage: number; + data: { + createDateTime: Date; + createdBy: string; + connectionId: string; + state: string; + orgId: string; + }[]; + } = { + totalItems: getProofRequestsList.proofRequestsCount, + hasNextPage: + proofRequestsSearchCriteria.pageSize * proofRequestsSearchCriteria.pageNumber < getProofRequestsList.proofRequestsCount, + hasPreviousPage: 1 < proofRequestsSearchCriteria.pageNumber, + nextPage: Number(proofRequestsSearchCriteria.pageNumber) + 1, + previousPage: proofRequestsSearchCriteria.pageNumber - 1, + lastPage: Math.ceil(getProofRequestsList.proofRequestsCount / proofRequestsSearchCriteria.pageSize), + data: getProofRequestsList.proofRequestsList + }; - const orgAgentType = await this.verificationRepository.getOrgAgentType(getAgentDetails?.orgAgentTypeId); - const verificationMethodLabel = 'get-proof-presentation'; - let url; - if (threadId) { - url = await this.getAgentUrl(verificationMethodLabel, orgAgentType, getAgentDetails?.agentEndPoint, getAgentDetails?.tenantId, threadId); + if (0 !== getProofRequestsList.proofRequestsCount) { + return issuedCredentialsResponse; } else { - url = await this.getAgentUrl(verificationMethodLabel, orgAgentType, getAgentDetails?.agentEndPoint, getAgentDetails?.tenantId); + throw new NotFoundException(ResponseMessages.verification.error.proofPresentationNotFound); } - - const payload = { apiKey: getAgentDetails.apiKey, url }; - const getProofPresentationsDetails = await this._getProofPresentations(payload); - return getProofPresentationsDetails?.response; - } catch (error) { - this.logger.error(`[getProofPresentations] - error in get proof presentation : ${JSON.stringify(error)}`); - if (error && error?.status && error?.status?.message && error?.status?.message?.error) { - throw new RpcException({ - message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, - statusCode: error?.status?.code - }); - - } else { - throw new RpcException(error.response ? error.response : error); - } + throw new RpcException( + `[getConnections] [NATS call]- error in fetch proof requests details : ${JSON.stringify(error)}` + ); } } @@ -340,10 +404,10 @@ export class VerificationService { } } - async webhookProofPresentation(id: string, proofPresentationPayload: IWebhookProofPresentation): Promise { + async webhookProofPresentation(proofPresentationPayload: ProofPresentationPayload): Promise { try { - const proofPresentation = await this.verificationRepository.storeProofPresentation(id, proofPresentationPayload); + const proofPresentation = await this.verificationRepository.storeProofPresentation(proofPresentationPayload); return proofPresentation; } catch (error) { From 6f714d48dfad0cc39d9ae2c6869ba74b98e1f29e Mon Sep 17 00:00:00 2001 From: Nishad Date: Wed, 6 Dec 2023 11:55:48 +0530 Subject: [PATCH 21/51] worked on the schema name version validations Signed-off-by: Nishad --- .../src/ecosystem/dtos/request-schema.dto.ts | 10 +++++- .../src/ecosystem/ecosystem.controller.ts | 36 ++++++++++--------- apps/ecosystem/src/ecosystem.service.ts | 24 ++++++++++++- libs/common/src/response-messages/index.ts | 2 ++ 4 files changed, 53 insertions(+), 19 deletions(-) diff --git a/apps/api-gateway/src/ecosystem/dtos/request-schema.dto.ts b/apps/api-gateway/src/ecosystem/dtos/request-schema.dto.ts index 641a16168..f39e29f0c 100644 --- a/apps/api-gateway/src/ecosystem/dtos/request-schema.dto.ts +++ b/apps/api-gateway/src/ecosystem/dtos/request-schema.dto.ts @@ -1,6 +1,9 @@ import { ApiExtraModels, ApiProperty } from '@nestjs/swagger'; -import { Type } from 'class-transformer'; +import { Transform, Type } from 'class-transformer'; import { IsArray, IsBoolean, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator'; +import { trim } from '@credebl/common/cast.helper'; + + @ApiExtraModels() class AttributeValue { @@ -20,11 +23,16 @@ class AttributeValue { export class RequestSchemaDto { + @ApiProperty() + @Transform(({ value }) => trim(value)) + @IsNotEmpty({ message: 'Schema name is required' }) @IsString({ message: 'name must be in string format.' }) name: string; @ApiProperty() + @Transform(({ value }) => trim(value)) + @IsNotEmpty({ message: 'Schema version is required' }) @IsString({ message: 'version must be in string format.' }) version: string; diff --git a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts index 9a8a6715b..fb477e265 100644 --- a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts @@ -282,6 +282,25 @@ export class EcosystemController { return res.status(HttpStatus.OK).json(finalResponse); } + @Post('/:ecosystemId/:orgId/transaction/schema') + @ApiOperation({ summary: 'Request new schema', description: 'Request new schema' }) + @ApiResponse({ status: 201, description: 'Success', type: ApiResponseDto }) + @UseGuards(AuthGuard('jwt'), EcosystemRolesGuard, OrgRolesGuard) + @ApiBearerAuth() + @EcosystemsRoles(EcosystemRoles.ECOSYSTEM_MEMBER, EcosystemRoles.ECOSYSTEM_LEAD, EcosystemRoles.ECOSYSTEM_OWNER) + @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER) + async requestSchemaTransaction(@Body() requestSchemaPayload: RequestSchemaDto, @Param('orgId') orgId: string, @Param('ecosystemId') ecosystemId: string, @Res() res: Response, @User() user: user): Promise { + requestSchemaPayload.userId = user.id; + + await this.ecosystemService.schemaEndorsementRequest(requestSchemaPayload, orgId, ecosystemId); + const finalResponse: IResponseType = { + statusCode: HttpStatus.CREATED, + message: ResponseMessages.ecosystem.success.schemaRequest + }; + return res.status(HttpStatus.CREATED).json(finalResponse); + } + + /** * * @param createOrgDto @@ -309,23 +328,6 @@ export class EcosystemController { return res.status(HttpStatus.CREATED).json(finalResponse); } - @Post('/:ecosystemId/:orgId/transaction/schema') - @ApiOperation({ summary: 'Request new schema', description: 'Request new schema' }) - @ApiResponse({ status: 201, description: 'Success', type: ApiResponseDto }) - @UseGuards(AuthGuard('jwt'), EcosystemRolesGuard, OrgRolesGuard) - @ApiBearerAuth() - @EcosystemsRoles(EcosystemRoles.ECOSYSTEM_MEMBER) - @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER) - async requestSchemaTransaction(@Body() requestSchemaPayload: RequestSchemaDto, @Param('orgId') orgId: string, @Param('ecosystemId') ecosystemId: string, @Res() res: Response, @User() user: user): Promise { - requestSchemaPayload.userId = user.id; - await this.ecosystemService.schemaEndorsementRequest(requestSchemaPayload, orgId, ecosystemId); - const finalResponse: IResponseType = { - statusCode: HttpStatus.CREATED, - message: ResponseMessages.ecosystem.success.schemaRequest - }; - return res.status(HttpStatus.CREATED).json(finalResponse); - } - @Post('/:ecosystemId/:orgId/transaction/cred-def') @ApiOperation({ summary: 'Request new credential-definition', description: 'Request new credential-definition' }) diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 5e213796f..247ea5124 100644 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -1,6 +1,6 @@ /* eslint-disable prefer-destructuring */ // eslint-disable-next-line camelcase -import { ConflictException, ForbiddenException, HttpException, Inject, Injectable, InternalServerErrorException, Logger, NotFoundException } from '@nestjs/common'; +import { BadRequestException, ConflictException, ForbiddenException, HttpException, Inject, Injectable, InternalServerErrorException, Logger, NotAcceptableException, NotFoundException } from '@nestjs/common'; import { EcosystemRepository } from './ecosystem.repository'; import { ResponseMessages } from '@credebl/common/response-messages'; import { BulkSendInvitationDto } from '../dtos/send-invitation.dto'; @@ -424,6 +424,28 @@ export class EcosystemService { try { const getEcosystemLeadDetails = await this.ecosystemRepository.getEcosystemLeadDetails(ecosystemId); + const {name, version} = requestSchemaPayload; + + if (0 === name.length) { + throw new BadRequestException(ResponseMessages.schema.error.nameNotEmpty); + } + + if (0 === version.length) { + throw new BadRequestException(ResponseMessages.schema.error.versionNotEmpty); + } + + const schemaVersionIndexOf = -1; + + if ( + isNaN(parseFloat(version)) || + version.toString().indexOf('.') === + schemaVersionIndexOf + ) { + throw new NotAcceptableException( + ResponseMessages.schema.error.invalidVersion + ); + } + const [schemaRequestExist, ecosystemMemberDetails, platformConfig, ecosystemLeadAgentDetails, getEcosystemOrgDetailsByOrgId] = await Promise.all([ this.ecosystemRepository.findRecordsByNameAndVersion(requestSchemaPayload?.name, requestSchemaPayload?.version), this.ecosystemRepository.getAgentDetails(orgId), diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 8e29f1e89..98045a561 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -103,6 +103,8 @@ export const ResponseMessages = { }, error: { invalidSchemaId: 'Invalid schema Id provided.', + nameNotEmpty: 'Schema name is required', + versionNotEmpty: 'Schema version is required', invalidVersion: 'Invalid schema version provided.', insufficientAttributes: 'Please provide at least one attribute.', invalidAttributes: 'Please provide unique attributes', From 231ea7a1c91e51d1b322c66c40228d41f23670ce Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Wed, 6 Dec 2023 18:01:39 +0530 Subject: [PATCH 22/51] feat: applied pagination and sorting feature for connections issuance and verification Signed-off-by: bhavanakarwade --- .../src/connection/connection.controller.ts | 3 - .../src/issuance/dtos/issuance.dto.ts | 5 +- .../src/issuance/issuance.controller.ts | 51 -------------- .../src/issuance/issuance.service.ts | 8 --- .../verification/verification.controller.ts | 66 ------------------- .../src/verification/verification.service.ts | 4 -- .../interfaces/issuance.interfaces.ts | 1 + apps/issuance/src/issuance.controller.ts | 6 -- apps/issuance/src/issuance.repository.ts | 9 ++- apps/issuance/src/issuance.service.ts | 43 ------------ .../repositories/verification.repository.ts | 34 ++-------- .../src/verification.controller.ts | 5 -- apps/verification/src/verification.service.ts | 30 --------- .../migration.sql | 4 ++ libs/prisma-service/prisma/schema.prisma | 3 +- 15 files changed, 23 insertions(+), 249 deletions(-) diff --git a/apps/api-gateway/src/connection/connection.controller.ts b/apps/api-gateway/src/connection/connection.controller.ts index 3f0cebe30..967eea60d 100644 --- a/apps/api-gateway/src/connection/connection.controller.ts +++ b/apps/api-gateway/src/connection/connection.controller.ts @@ -66,9 +66,6 @@ export class ConnectionController { /** * Description: Get all connections * @param user - * @param threadId - * @param connectionId - * @param state * @param orgId * */ diff --git a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts index 8b49e224c..6cacdb7fe 100644 --- a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts @@ -43,7 +43,6 @@ export class IssueCredentialDto { orgId: string; } - export class IssuanceDto { @ApiProperty() @IsOptional() @@ -85,6 +84,10 @@ export class IssuanceDto { @IsOptional() schemaId: string; + @ApiProperty() + @IsOptional() + credDefId: string; + @ApiProperty() @IsOptional() credentialAttributes: CredentialAttributes[]; diff --git a/apps/api-gateway/src/issuance/issuance.controller.ts b/apps/api-gateway/src/issuance/issuance.controller.ts index 70899b98c..71019f5f4 100644 --- a/apps/api-gateway/src/issuance/issuance.controller.ts +++ b/apps/api-gateway/src/issuance/issuance.controller.ts @@ -89,60 +89,9 @@ export class IssuanceController { return res.send(getImageBuffer); } - // /** - // * Description: Get all issued credentials - // * @param user - // * @param threadId - // * @param connectionId - // * @param state - // * @param orgId - // * - // */ - // @Get('/orgs/:orgId/credentials') - // @UseGuards(AuthGuard('jwt')) - // @ApiBearerAuth() - // @ApiOperation({ - // summary: `Get all issued credentials for a specific organization`, - // description: `Get all issued credentials for a specific organization` - // }) - // @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) - // @ApiQuery({ name: 'threadId', required: false }) - // @ApiQuery({ name: 'connectionId', required: false }) - // @ApiQuery({ name: 'state', enum: IssueCredential, required: false }) - // @ApiBearerAuth() - // @UseGuards(AuthGuard('jwt'), OrgRolesGuard) - // @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER) - // async getIssueCredentials( - // @User() user: IUserRequest, - // @Query('threadId') threadId: string, - // @Query('connectionId') connectionId: string, - // @Query('state') state: string, - // @Param('orgId') orgId: string, - // @Res() res: Response - // ): Promise { - // const getCredentialDetails = await this.issueCredentialService.getIssueCredentials( - // user, - // threadId, - // connectionId, - // state, - // orgId - // ); - - // const finalResponse: IResponseType = { - // statusCode: HttpStatus.OK, - // message: ResponseMessages.issuance.success.fetch, - // data: getCredentialDetails.response - // }; - // return res.status(HttpStatus.OK).json(finalResponse); - // } - - /** * Description: Get all issued credentials * @param user - * @param threadId - * @param connectionId - * @param state * @param orgId * */ diff --git a/apps/api-gateway/src/issuance/issuance.service.ts b/apps/api-gateway/src/issuance/issuance.service.ts index 90c6e2563..1f9611a6c 100644 --- a/apps/api-gateway/src/issuance/issuance.service.ts +++ b/apps/api-gateway/src/issuance/issuance.service.ts @@ -31,14 +31,6 @@ export class IssuanceService extends BaseService { const payload = { attributes: issueCredentialDto.attributes, comment: issueCredentialDto.comment, credentialDefinitionId: issueCredentialDto.credentialDefinitionId, connectionId: issueCredentialDto.connectionId, orgId: issueCredentialDto.orgId, user }; return this.sendNats(this.issuanceProxy, 'send-credential-create-offer-oob', payload); } - - - // getIssueCredentials(user: IUserRequest, threadId: string, connectionId: string, state: string, orgId: string): Promise<{ - // response: object; - // }> { - // const payload = { user, threadId, connectionId, state, orgId }; - // return this.sendNats(this.issuanceProxy, 'get-all-issued-credentials', payload); - // } getIssueCredentials(issuedCredentialsSearchCriteria: IIssuedCredentialSearchinterface, user: IUserRequest, orgId: string): Promise<{ response: object; diff --git a/apps/api-gateway/src/verification/verification.controller.ts b/apps/api-gateway/src/verification/verification.controller.ts index 84eeef5f5..d5b02bef6 100644 --- a/apps/api-gateway/src/verification/verification.controller.ts +++ b/apps/api-gateway/src/verification/verification.controller.ts @@ -117,69 +117,6 @@ export class VerificationController { return res.status(HttpStatus.OK).json(finalResponse); } - // @Get('/orgs/:orgId/credentials') - // @UseGuards(AuthGuard('jwt')) - // @ApiBearerAuth() - // @ApiOperation({ - // summary: `Get all issued credentials for a specific organization`, - // description: `Get all issued credentials for a specific organization` - // }) - // @ApiQuery({ - // name: 'pageNumber', - // type: Number, - // required: false - // }) - // @ApiQuery({ - // name: 'searchByText', - // type: String, - // required: false - // }) - // @ApiQuery({ - // name: 'pageSize', - // type: Number, - // required: false - // }) - // @ApiQuery({ - // name: 'sorting', - // type: String, - // required: false - // }) - // @ApiQuery({ - // name: 'sortByValue', - // type: String, - // required: false - // }) - - // @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) - // @ApiBearerAuth() - // @UseGuards(AuthGuard('jwt'), OrgRolesGuard) - // @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER) - // async getIssueCredentials( - // @Query() getAllIssuedCredentials: GetAllIssuedCredentialsDto, - // @User() user: IUserRequest, - // @Param('orgId') orgId: string, - // @Res() res: Response - // ): Promise { - - // const { pageSize, searchByText, pageNumber, sorting, sortByValue } = getAllIssuedCredentials; - // const issuedCredentialsSearchCriteria: IIssuedCredentialSearchinterface = { - // pageNumber, - // searchByText, - // pageSize, - // sorting, - // sortByValue - // }; - - // const getCredentialDetails = await this.issueCredentialService.getIssueCredentials(issuedCredentialsSearchCriteria, user, orgId); - - // const finalResponse: IResponseType = { - // statusCode: HttpStatus.OK, - // message: ResponseMessages.issuance.success.fetch, - // data: getCredentialDetails.response - // }; - // return res.status(HttpStatus.OK).json(finalResponse); - // } - /** * Get all proof presentations * @param user @@ -221,9 +158,6 @@ export class VerificationController { @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) @ApiUnauthorizedResponse({ status: 401, description: 'Unauthorized', type: UnauthorizedErrorDto }) @ApiForbiddenResponse({ status: 403, description: 'Forbidden', type: ForbiddenErrorDto }) - @ApiQuery( - { name: 'threadId', required: false } - ) @ApiBearerAuth() @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER) @UseGuards(AuthGuard('jwt'), OrgRolesGuard) diff --git a/apps/api-gateway/src/verification/verification.service.ts b/apps/api-gateway/src/verification/verification.service.ts index 2583be4f1..3148fcd64 100644 --- a/apps/api-gateway/src/verification/verification.service.ts +++ b/apps/api-gateway/src/verification/verification.service.ts @@ -21,10 +21,6 @@ export class VerificationService extends BaseService { * @param user * @returns Get all proof presentation */ - // getProofPresentations(orgId: string, threadId: string, user: IUserRequest): Promise<{ response: object }> { - // const payload = { user, threadId, orgId }; - // return this.sendNats(this.verificationServiceProxy, 'get-proof-presentations', payload); - // } getProofPresentations(proofRequestsSearchCriteria: IProofRequestsSearchCriteria, user: IUserRequest, orgId: string): Promise<{ response: object }> { const payload = { proofRequestsSearchCriteria, user, orgId }; diff --git a/apps/issuance/interfaces/issuance.interfaces.ts b/apps/issuance/interfaces/issuance.interfaces.ts index 2ab6a84b0..1eba6fb3d 100644 --- a/apps/issuance/interfaces/issuance.interfaces.ts +++ b/apps/issuance/interfaces/issuance.interfaces.ts @@ -39,6 +39,7 @@ export interface IIssuanceWebhookInterface { credentialAttributes: ICredentialAttributesInterface[]; orgId: string; schemaId: string; + credDefId: string; id: string; state: string; contextCorrelationId: string; diff --git a/apps/issuance/src/issuance.controller.ts b/apps/issuance/src/issuance.controller.ts index a32b62d15..62e96bd6c 100644 --- a/apps/issuance/src/issuance.controller.ts +++ b/apps/issuance/src/issuance.controller.ts @@ -22,12 +22,6 @@ export class IssuanceController { return this.issuanceService.sendCredentialOutOfBand(orgId, user, credentialDefinitionId, comment, connectionId, attributes); } - // @MessagePattern({ cmd: 'get-all-issued-credentials' }) - // async getIssueCredentials(payload: IIssueCredentials): Promise { - // const { user, threadId, connectionId, state, orgId } = payload; - // return this.issuanceService.getIssueCredentials(user, threadId, connectionId, state, orgId); - // } - @MessagePattern({ cmd: 'get-all-issued-credentials' }) async getIssueCredentials(payload: IIssueCredentials): Promise { const { user, orgId, issuedCredentialsSearchCriteria} = payload; diff --git a/apps/issuance/src/issuance.repository.ts b/apps/issuance/src/issuance.repository.ts index b110f5e25..6e24ce1d6 100644 --- a/apps/issuance/src/issuance.repository.ts +++ b/apps/issuance/src/issuance.repository.ts @@ -144,12 +144,18 @@ export class IssuanceRepository { } let schemaId = ''; + if (issueCredentialDto?.metadata?.['_anoncreds/credential']?.schemaId) { schemaId = issueCredentialDto?.metadata?.['_anoncreds/credential']?.schemaId; + } + + let credDefId = ''; + if (issueCredentialDto?.metadata?.['_anoncreds/credential']?.credentialDefinitionId) { + credDefId = issueCredentialDto?.metadata?.['_anoncreds/credential']?.credentialDefinitionId; } const credentialDetails = await this.prisma.credentials.upsert({ - where: { + where: { threadId: issueCredentialDto?.threadId }, update: { @@ -167,6 +173,7 @@ export class IssuanceRepository { state: issueCredentialDto?.state, threadId: issueCredentialDto?.threadId, schemaId, + credDefId, credentialExchangeId: issueCredentialDto?.id, orgId: organisationId } diff --git a/apps/issuance/src/issuance.service.ts b/apps/issuance/src/issuance.service.ts index 58f446d51..e7cf33135 100644 --- a/apps/issuance/src/issuance.service.ts +++ b/apps/issuance/src/issuance.service.ts @@ -175,49 +175,6 @@ export class IssuanceService { } } - // async getIssueCredentials(user: IUserRequest, threadId: string, connectionId: string, state: string, orgId: string): Promise { - // try { - // const agentDetails = await this.issuanceRepository.getAgentEndPoint(orgId); - // const platformConfig: platform_config = await this.issuanceRepository.getPlatformConfigDetails(); - - // const { agentEndPoint } = agentDetails; - // if (!agentDetails) { - // throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound); - // } - // const params = { - // threadId, - // connectionId, - // state - // }; - - // const orgAgentType = await this.issuanceRepository.getOrgAgentType(agentDetails?.orgAgentTypeId); - // const issuanceMethodLabel = 'get-issue-credentials'; - // let url = await this.getAgentUrl(issuanceMethodLabel, orgAgentType, agentEndPoint, agentDetails?.tenantId); - - // Object.keys(params).forEach((element: string) => { - // const appendParams: string = url.includes('?') ? '&' : '?'; - - // if (params[element] !== undefined) { - // url = `${url + appendParams + element}=${params[element]}`; - // } - // }); - // const apiKey = platformConfig?.sgApiKey; - // const issueCredentialsDetails = await this._getIssueCredentials(url, apiKey); - // return issueCredentialsDetails?.response; - // } catch (error) { - // this.logger.error(`[sendCredentialCreateOffer] - error in create credentials : ${JSON.stringify(error)}`); - // if (error && error?.status && error?.status?.message && error?.status?.message?.error) { - // throw new RpcException({ - // message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, - // statusCode: error?.status?.code - // }); - - // } else { - // throw new RpcException(error.response ? error.response : error); - // } - // } - // } - async getIssueCredentials( user: IUserRequest, orgId: string, diff --git a/apps/verification/src/repositories/verification.repository.ts b/apps/verification/src/repositories/verification.repository.ts index bb1eed3f8..be8fee631 100644 --- a/apps/verification/src/repositories/verification.repository.ts +++ b/apps/verification/src/repositories/verification.repository.ts @@ -71,7 +71,10 @@ export class VerificationRepository { const proofRequestsList = await this.prisma.presentations.findMany({ where: { orgId, - OR: [{ connectionId: { contains: proofRequestsSearchCriteria.searchByText, mode: 'insensitive' } }] + OR: [ + { connectionId: { contains: proofRequestsSearchCriteria.searchByText, mode: 'insensitive' } }, + { state: { contains: proofRequestsSearchCriteria.searchByText, mode: 'insensitive' } } + ] }, select: { createDateTime: true, @@ -106,35 +109,6 @@ export class VerificationRepository { } } - // async storeProofPresentation(id: string, proofPresentationPayload: IWebhookProofPresentation): Promise { - // try { - - // return await this.prisma.presentations.upsert({ - // where: { - // threadId: proofPresentationPayload.threadId - // }, - // update: { - // state: proofPresentationPayload.state, - // threadId: proofPresentationPayload.threadId, - // isVerified: proofPresentationPayload.isVerified - // }, - // create: { - // connectionId: proofPresentationPayload.connectionId, - // createdBy: id, - // lastChangedBy: id, - // state: proofPresentationPayload.state, - // threadId: proofPresentationPayload.threadId, - // isVerified: proofPresentationPayload.isVerified, - // orgId: id - // } - // }); - - // } catch (error) { - // this.logger.error(`[getProofPresentations] - error in get agent endpoint : ${error.message} `); - // throw error; - // } - // } - async storeProofPresentation(payload: ProofPresentationPayload): Promise { try { let organisationId: string; diff --git a/apps/verification/src/verification.controller.ts b/apps/verification/src/verification.controller.ts index b42809911..23946706e 100644 --- a/apps/verification/src/verification.controller.ts +++ b/apps/verification/src/verification.controller.ts @@ -14,11 +14,6 @@ export class VerificationController { * @param payload * @returns Get all proof presentation */ - // @MessagePattern({ cmd: 'get-proof-presentations' }) - // async getProofPresentations(payload: { user: IUserRequest, threadId: string, orgId: string }): Promise { - // return this.verificationService.getProofPresentations(payload.orgId, payload.threadId); - // } - @MessagePattern({ cmd: 'get-proof-presentations' }) async getProofPresentations(payload: IProofRequests): Promise { const { user, orgId, proofRequestsSearchCriteria} = payload; diff --git a/apps/verification/src/verification.service.ts b/apps/verification/src/verification.service.ts index f39f29c59..5348ef169 100644 --- a/apps/verification/src/verification.service.ts +++ b/apps/verification/src/verification.service.ts @@ -34,36 +34,6 @@ export class VerificationService { * @param orgId * @returns Get all proof presentation */ - // async getProofPresentations(orgId: string, threadId: string): Promise { - // try { - // const getAgentDetails = await this.verificationRepository.getAgentEndPoint(orgId); - - // const orgAgentType = await this.verificationRepository.getOrgAgentType(getAgentDetails?.orgAgentTypeId); - // const verificationMethodLabel = 'get-proof-presentation'; - // let url; - // if (threadId) { - // url = await this.getAgentUrl(verificationMethodLabel, orgAgentType, getAgentDetails?.agentEndPoint, getAgentDetails?.tenantId, threadId); - // } else { - // url = await this.getAgentUrl(verificationMethodLabel, orgAgentType, getAgentDetails?.agentEndPoint, getAgentDetails?.tenantId); - // } - - // const payload = { apiKey: getAgentDetails.apiKey, url }; - // const getProofPresentationsDetails = await this._getProofPresentations(payload); - // return getProofPresentationsDetails?.response; - - // } catch (error) { - // this.logger.error(`[getProofPresentations] - error in get proof presentation : ${JSON.stringify(error)}`); - // if (error && error?.status && error?.status?.message && error?.status?.message?.error) { - // throw new RpcException({ - // message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error, - // statusCode: error?.status?.code - // }); - - // } else { - // throw new RpcException(error.response ? error.response : error); - // } - // } - // } async getProofPresentations( user: IUserRequest, diff --git a/libs/prisma-service/prisma/migrations/20231204142322_connection_their_label_credentials_schema_id/migration.sql b/libs/prisma-service/prisma/migrations/20231204142322_connection_their_label_credentials_schema_id/migration.sql index b9b1a6d0c..18c6a35fd 100644 --- a/libs/prisma-service/prisma/migrations/20231204142322_connection_their_label_credentials_schema_id/migration.sql +++ b/libs/prisma-service/prisma/migrations/20231204142322_connection_their_label_credentials_schema_id/migration.sql @@ -9,3 +9,7 @@ ALTER TABLE "connections" ADD COLUMN "theirLabel" TEXT NOT NULL DEFAULT ''; -- AlterTable ALTER TABLE "credentials" ADD COLUMN "schemaId" TEXT NOT NULL DEFAULT ''; + +-- AlterTable +ALTER TABLE "credentials" ADD COLUMN "credDefId" TEXT NOT NULL DEFAULT ''; + diff --git a/libs/prisma-service/prisma/schema.prisma b/libs/prisma-service/prisma/schema.prisma index 771f57b74..bd18d1e34 100644 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -299,7 +299,8 @@ model credentials { threadId String @unique credentialExchangeId String @default("") state String @default("") - schemaId String + schemaId String @default("") + credDefId String @default("") orgId String? @db.Uuid organisation organisation? @relation(fields: [orgId], references: [id]) } From e065ad426d40864306c2d5520d81e57cbc766f2b Mon Sep 17 00:00:00 2001 From: Moulika Kulkarni Date: Wed, 6 Dec 2023 20:32:04 +0530 Subject: [PATCH 23/51] refactor:API response Signed-off-by: Moulika Kulkarni --- apps/ecosystem/src/ecosystem.repository.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/ecosystem/src/ecosystem.repository.ts b/apps/ecosystem/src/ecosystem.repository.ts index a8be10f59..56faf8901 100644 --- a/apps/ecosystem/src/ecosystem.repository.ts +++ b/apps/ecosystem/src/ecosystem.repository.ts @@ -128,12 +128,22 @@ export class EcosystemRepository { name: true, description: true, logoUrl: true, + createDateTime: true, + lastChangedDateTime: true, + createdBy: true, autoEndorsement: true, ecosystemOrgs: { where: { orgId }, select: { + id: true, + orgId:true, + status: true, + createDateTime: true, + lastChangedDateTime: true, + ecosystemId: true, + ecosystemRoleId: true, ecosystemRole: true } } From 95a3f1f22f8299ea709bb58c9a839987f18de8d4 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Thu, 7 Dec 2023 17:08:40 +0530 Subject: [PATCH 24/51] refactor: applied trim validations on oob issuance payload Signed-off-by: bhavanakarwade --- .../api-gateway/src/dtos/create-schema.dto.ts | 8 +++-- .../ecosystem/dtos/create-ecosystem-dto.ts | 8 ++--- .../src/issuance/dtos/issuance.dto.ts | 34 +++++++++++++++---- apps/ledger/src/schema/schema.service.ts | 13 ++++--- 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/apps/api-gateway/src/dtos/create-schema.dto.ts b/apps/api-gateway/src/dtos/create-schema.dto.ts index 34d8c177c..c776de70e 100644 --- a/apps/api-gateway/src/dtos/create-schema.dto.ts +++ b/apps/api-gateway/src/dtos/create-schema.dto.ts @@ -1,11 +1,13 @@ import { IsArray, IsNotEmpty, IsOptional, IsString } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; +import { Transform } from 'class-transformer'; class AttributeValue { @IsString() @IsNotEmpty({ message: 'attributeName is required.' }) + @Transform(({ value }) => value.trim()) attributeName: string; @IsString() @@ -19,11 +21,13 @@ class AttributeValue { export class CreateSchemaDto { @ApiProperty() - @IsString({ message: 'schema version must be a string' }) @IsNotEmpty({ message: 'please provide valid schema version' }) + @IsString({ message: 'schema version must be a string' }) + @IsNotEmpty({ message: 'please provide valid schema version' }) schemaVersion: string; @ApiProperty() - @IsString({ message: 'schema name must be a string' }) @IsNotEmpty({ message: 'please provide valid schema name' }) + @IsString({ message: 'schema name must be a string' }) + @IsNotEmpty({ message: 'please provide valid schema name' }) schemaName: string; @ApiProperty({ diff --git a/apps/api-gateway/src/ecosystem/dtos/create-ecosystem-dto.ts b/apps/api-gateway/src/ecosystem/dtos/create-ecosystem-dto.ts index 6c8d5d9a0..6407189bf 100644 --- a/apps/api-gateway/src/ecosystem/dtos/create-ecosystem-dto.ts +++ b/apps/api-gateway/src/ecosystem/dtos/create-ecosystem-dto.ts @@ -15,19 +15,19 @@ export class CreateEcosystemDto { @IsString({ message: 'ecosystem name must be in string format.' }) name: string; - @ApiPropertyOptional() + @ApiProperty() @Transform(({ value }) => trim(value)) + @IsNotEmpty({ message: 'Description is required.' }) @MinLength(2, { message: 'Description must be at least 2 characters.' }) @MaxLength(255, { message: 'Description must be at most 255 characters.' }) @IsString({ message: 'Description must be in string format.' }) - @IsOptional() - description?: string; + description?: string; @ApiPropertyOptional() @IsOptional() @Transform(({ value }) => trim(value)) @IsString({ message: 'tag must be in string format.' }) - tags?: string; + tags? = ''; @ApiPropertyOptional() diff --git a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts index 4f3aa1d1e..1b3facc51 100644 --- a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts @@ -1,18 +1,35 @@ -import { IsArray, IsNotEmpty, IsOptional, IsString, IsEmail, ArrayMaxSize } from 'class-validator'; +import { IsArray, IsNotEmpty, IsOptional, IsString, IsEmail, ArrayMaxSize, ValidateNested } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { Transform, Type } from 'class-transformer'; import { toNumber } from '@credebl/common/cast.helper'; -interface CredentialOffer { - emailId: string; - attributes: Attribute[]; -} +class Attribute { -interface Attribute { + @IsNotEmpty({ message: 'Please provide a valid attribute name' }) + @Transform(({ value }) => value.trim()) name: string; + value: string; } +class CredentialOffer { + @ApiProperty({ example: 'awqx@getnada.com' }) + @IsEmail() + @IsNotEmpty({ message: 'Please provide valid email' }) + @IsString({ message: 'email should be string' }) + @Transform(({ value }) => value.trim()) + @IsOptional() + emailId: string; + + @ApiProperty({ example: [{ 'value': 'string', 'name': 'string' }] }) + @IsNotEmpty({ message: 'Please provide valid attributes' }) + @IsArray({ message: 'attributes should be array' }) + @ValidateNested({ each: true }) + @Type(() => Attribute) + @IsOptional() + attributes: Attribute[]; +} + export class IssueCredentialDto { @ApiProperty({ example: [{ 'value': 'string', 'name': 'string' }] }) @@ -43,7 +60,6 @@ export class IssueCredentialDto { orgId: string; } - export class IssuanceDto { @ApiProperty() @IsOptional() @@ -118,18 +134,22 @@ export class OutOfBandCredentialDto { @IsEmail() @IsNotEmpty({ message: 'Please provide valid email' }) @IsString({ message: 'email should be string' }) + @Transform(({ value }) => value.trim()) @IsOptional() emailId: string; @ApiProperty({ example: [{ 'value': 'string', 'name': 'string' }] }) @IsNotEmpty({ message: 'Please provide valid attributes' }) @IsArray({ message: 'attributes should be array' }) + @ValidateNested({ each: true }) + @Type(() => Attribute) @IsOptional() attributes: Attribute[]; @ApiProperty({ example: 'string' }) @IsNotEmpty({ message: 'Please provide valid credential definition id' }) @IsString({ message: 'credential definition id should be string' }) + @Transform(({ value }) => value.trim()) credentialDefinitionId: string; @ApiProperty({ example: 'string' }) diff --git a/apps/ledger/src/schema/schema.service.ts b/apps/ledger/src/schema/schema.service.ts index 666b4fe56..be924e17f 100644 --- a/apps/ledger/src/schema/schema.service.ts +++ b/apps/ledger/src/schema/schema.service.ts @@ -63,23 +63,28 @@ export class SchemaService extends BaseService { ResponseMessages.schema.error.insufficientAttributes ); } else if (schema.attributes.length > schemaAttributeLength) { - const schemaAttibute = schema.attributes; + + const trimmedAttributes = schema.attributes.map(attribute => ({ + attributeName: attribute.attributeName.trim(), + schemaDataType: attribute.schemaDataType, + displayName: attribute.displayName + })); + const findDuplicates: boolean = - new Set(schemaAttibute).size !== schemaAttibute.length; + new Set(trimmedAttributes).size !== trimmedAttributes.length; if (true === findDuplicates) { throw new NotAcceptableException( ResponseMessages.schema.error.invalidAttributes ); } schema.schemaName = schema.schemaName.trim(); - const { agentEndPoint, orgDid } = await this.schemaRepository.getAgentDetailsByOrgId(orgId); const getAgentDetails = await this.schemaRepository.getAgentType(orgId); // eslint-disable-next-line yoda const did = schema.orgDid?.split(':').length >= 4 ? schema.orgDid : orgDid; const orgAgentType = await this.schemaRepository.getOrgAgentType(getAgentDetails.org_agents[0].orgAgentTypeId); - const attributeArray = schema.attributes.map(item => item.attributeName); + const attributeArray = trimmedAttributes.map(item => item.attributeName); let schemaResponseFromAgentService; if (OrgAgentType.DEDICATED === orgAgentType) { const issuerId = did; From 49ea78be23a92080b6b7efbf324a86e420bf3a63 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Thu, 7 Dec 2023 17:17:35 +0530 Subject: [PATCH 25/51] resolved sonar lint checks Signed-off-by: bhavanakarwade --- .../src/issuance/dtos/issuance.dto.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts index 1b3facc51..31f44cd4e 100644 --- a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts @@ -13,14 +13,7 @@ class Attribute { } class CredentialOffer { - @ApiProperty({ example: 'awqx@getnada.com' }) - @IsEmail() - @IsNotEmpty({ message: 'Please provide valid email' }) - @IsString({ message: 'email should be string' }) - @Transform(({ value }) => value.trim()) - @IsOptional() - emailId: string; - + @ApiProperty({ example: [{ 'value': 'string', 'name': 'string' }] }) @IsNotEmpty({ message: 'Please provide valid attributes' }) @IsArray({ message: 'attributes should be array' }) @@ -28,6 +21,14 @@ class CredentialOffer { @Type(() => Attribute) @IsOptional() attributes: Attribute[]; + + @ApiProperty({ example: 'awqx@getnada.com' }) + @IsEmail() + @IsNotEmpty({ message: 'Please provide valid email' }) + @IsString({ message: 'email should be string' }) + @Transform(({ value }) => value.trim()) + @IsOptional() + emailId: string; } export class IssueCredentialDto { From cfc5959b5dfcac88723144c0f1bd37c8a6e2a54f Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Thu, 7 Dec 2023 18:57:44 +0530 Subject: [PATCH 26/51] resolved comments Signed-off-by: bhavanakarwade --- apps/api-gateway/src/issuance/dtos/issuance.dto.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts index 31f44cd4e..e0456146e 100644 --- a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts @@ -135,7 +135,7 @@ export class OutOfBandCredentialDto { @IsEmail() @IsNotEmpty({ message: 'Please provide valid email' }) @IsString({ message: 'email should be string' }) - @Transform(({ value }) => value.trim()) + @Transform(({ value }) => value.trim().toLowerCase()) @IsOptional() emailId: string; From 1e5e0ab421bcbd6a6e38513b7a290a2f5578633d Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Mon, 11 Dec 2023 11:47:09 +0530 Subject: [PATCH 27/51] fix: retrieve a list of schemas by network Signed-off-by: bhavanakarwade --- .../src/interfaces/ISchemaSearch.interface.ts | 1 + apps/api-gateway/src/platform/platform.controller.ts | 4 ++-- .../api-gateway/src/schema/dtos/get-all-schema.dto.ts | 7 ++++++- .../src/schema/interfaces/schema-payload.interface.ts | 1 + .../src/schema/repositories/schema.repository.ts | 11 ++++++++--- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts b/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts index 3979fe62c..e29091876 100644 --- a/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts +++ b/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts @@ -1,6 +1,7 @@ import { IUserRequestInterface } from '../schema/interfaces'; export interface ISchemaSearchInterface { + ledgerId?: string; pageNumber: number; pageSize: number; sorting: string; diff --git a/apps/api-gateway/src/platform/platform.controller.ts b/apps/api-gateway/src/platform/platform.controller.ts index 92fc479be..7f11d05e9 100644 --- a/apps/api-gateway/src/platform/platform.controller.ts +++ b/apps/api-gateway/src/platform/platform.controller.ts @@ -33,8 +33,9 @@ export class PlatformController { @Res() res: Response, @User() user: IUserRequestInterface ): Promise { - const { pageSize, searchByText, pageNumber, sorting, sortByValue } = getAllSchemaDto; + const { ledgerId, pageSize, searchByText, pageNumber, sorting, sortByValue } = getAllSchemaDto; const schemaSearchCriteria: ISchemaSearchInterface = { + ledgerId, pageNumber, searchByText, pageSize, @@ -42,7 +43,6 @@ export class PlatformController { sortByValue }; const schemasResponse = await this.platformService.getAllSchema(schemaSearchCriteria, user); - const finalResponse: IResponseType = { statusCode: HttpStatus.OK, message: ResponseMessages.schema.success.fetch, diff --git a/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts b/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts index 0004e716d..c56b29dca 100644 --- a/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts +++ b/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-inferrable-types */ /* eslint-disable camelcase */ -import { ApiProperty } from '@nestjs/swagger'; +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { SortValue } from '../../enum'; import { Type } from 'class-transformer'; import { IsOptional } from 'class-validator'; @@ -49,6 +49,11 @@ export class GetCredentialDefinitionBySchemaIdDto { } export class GetAllSchemaByPlatformDto { + + @ApiPropertyOptional() + @IsOptional() + ledgerId?: string; + @ApiProperty({ required: false }) @IsOptional() pageNumber: number = 1; diff --git a/apps/ledger/src/schema/interfaces/schema-payload.interface.ts b/apps/ledger/src/schema/interfaces/schema-payload.interface.ts index a79275ddc..35f59ea71 100644 --- a/apps/ledger/src/schema/interfaces/schema-payload.interface.ts +++ b/apps/ledger/src/schema/interfaces/schema-payload.interface.ts @@ -48,6 +48,7 @@ export interface ISchemaSearchInterface { } export interface ISchemaSearchCriteria { + ledgerId?: string; pageNumber: number; pageSize: number; sorting: string; diff --git a/apps/ledger/src/schema/repositories/schema.repository.ts b/apps/ledger/src/schema/repositories/schema.repository.ts index ffbb3edf7..aa55d1652 100644 --- a/apps/ledger/src/schema/repositories/schema.repository.ts +++ b/apps/ledger/src/schema/repositories/schema.repository.ts @@ -202,7 +202,7 @@ export class SchemaRepository { throw error; } } - + async getAllSchemaDetails(payload: ISchemaSearchCriteria): Promise<{ schemasCount: number; schemasResult: { @@ -216,10 +216,11 @@ export class SchemaRepository { issuerId: string; orgId: string; }[]; - }> { + }> { try { const schemasResult = await this.prisma.schema.findMany({ where: { + ledgerId: payload.ledgerId, OR: [ { name: { contains: payload.searchByText, mode: 'insensitive' } }, { version: { contains: payload.searchByText, mode: 'insensitive' } }, @@ -245,7 +246,11 @@ export class SchemaRepository { skip: (payload.pageNumber - 1) * payload.pageSize }); - const schemasCount = await this.prisma.schema.count(); + const schemasCount = await this.prisma.schema.count({ + where: { + ledgerId: payload.ledgerId + } + }); return { schemasCount, schemasResult }; } catch (error) { this.logger.error(`Error in getting schemas: ${error}`); From 2240df56507afb28668e77898d17fd7808701084 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Mon, 11 Dec 2023 11:54:52 +0530 Subject: [PATCH 28/51] added class validator in dto Signed-off-by: bhavanakarwade --- apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts b/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts index c56b29dca..c0e955d43 100644 --- a/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts +++ b/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts @@ -50,6 +50,7 @@ export class GetCredentialDefinitionBySchemaIdDto { export class GetAllSchemaByPlatformDto { + @ApiProperty() @ApiPropertyOptional() @IsOptional() ledgerId?: string; From 59e919ad3456f49213780068a055be8dbcefe6b3 Mon Sep 17 00:00:00 2001 From: Nishad Date: Mon, 11 Dec 2023 20:08:12 +0530 Subject: [PATCH 29/51] worked on the ecosystem ledgers restrictions Signed-off-by: Nishad --- .../interfaces/ecosystem.interfaces.ts | 23 +++---- apps/ecosystem/src/ecosystem.repository.ts | 39 +++++++---- apps/ecosystem/src/ecosystem.service.ts | 68 ++++++++++++++++--- libs/common/src/response-messages/index.ts | 1 + .../migration.sql | 2 + libs/prisma-service/prisma/schema.prisma | 1 + 6 files changed, 99 insertions(+), 35 deletions(-) create mode 100644 libs/prisma-service/prisma/migrations/20231211112032_ecosystem_ledgers_column/migration.sql diff --git a/apps/ecosystem/interfaces/ecosystem.interfaces.ts b/apps/ecosystem/interfaces/ecosystem.interfaces.ts index e37bee334..477ad391c 100644 --- a/apps/ecosystem/interfaces/ecosystem.interfaces.ts +++ b/apps/ecosystem/interfaces/ecosystem.interfaces.ts @@ -178,23 +178,17 @@ export interface EndorsementTransactionPayloadDetails { } export interface CreateEcosystem { - name: string; - + name?: string; description?: string; - tags?: string; - - userId: string; - + userId?: string; logo?: string; - - orgName: string; - - orgDid: string; - + orgName?: string; + orgDid?: string; orgId?: string; - - autoEndorsement: boolean + autoEndorsement?: boolean; + lastChangedBy?: string; + ledgers?: string[]; } export interface OrganizationData { @@ -224,7 +218,8 @@ export interface OrgAgent { agentsTypeId: string; orgId: string; orgAgentTypeId: string; - ledgerId: string; + ledgerId?: string; + ledgers?: {id: string}; } export interface EcosystemDetails { diff --git a/apps/ecosystem/src/ecosystem.repository.ts b/apps/ecosystem/src/ecosystem.repository.ts index 56faf8901..fddcefe07 100644 --- a/apps/ecosystem/src/ecosystem.repository.ts +++ b/apps/ecosystem/src/ecosystem.repository.ts @@ -4,7 +4,7 @@ import { PrismaService } from '@credebl/prisma-service'; import { credential_definition, ecosystem, ecosystem_config, ecosystem_invitations, ecosystem_orgs, ecosystem_roles, endorsement_transaction, org_agents, platform_config, schema } from '@prisma/client'; import { DeploymentModeType, EcosystemInvitationStatus, EcosystemOrgStatus, EcosystemRoles, endorsementTransactionStatus, endorsementTransactionType } from '../enums/ecosystem.enum'; import { updateEcosystemOrgsDto } from '../dtos/update-ecosystemOrgs.dto'; -import { EcosystemDetails, SaveSchema, SchemaTransactionResponse, saveCredDef } from '../interfaces/ecosystem.interfaces'; +import { CreateEcosystem, EcosystemDetails, SaveSchema, SchemaTransactionResponse, saveCredDef } from '../interfaces/ecosystem.interfaces'; import { ResponseMessages } from '@credebl/common/response-messages'; import { NotFoundException } from '@nestjs/common'; import { CommonConstants } from '@credebl/common/common.constant'; @@ -25,7 +25,7 @@ export class EcosystemRepository { * @returns ecosystem */ // eslint-disable-next-line camelcase - async createNewEcosystem(createEcosystemDto): Promise { + async createNewEcosystem(createEcosystemDto: CreateEcosystem, ecosystemLedgers: string[]): Promise { try { const transaction = await this.prisma.$transaction(async (prisma) => { const { name, description, userId, logo, tags, orgId, autoEndorsement } = createEcosystemDto; @@ -37,7 +37,8 @@ export class EcosystemRepository { autoEndorsement, logoUrl: logo, createdBy: userId, - lastChangedBy: userId + lastChangedBy: userId, + ledgers: ecosystemLedgers } }); let ecosystemUser; @@ -86,19 +87,13 @@ export class EcosystemRepository { * @returns ecosystem details */ // eslint-disable-next-line camelcase - async updateEcosystemById(createEcosystemDto, ecosystemId): Promise { + async updateEcosystemById( + data: object, + ecosystemId: string): Promise { try { - const { name, description, tags, logo, autoEndorsement, userId } = createEcosystemDto; const editEcosystem = await this.prisma.ecosystem.update({ where: { id: ecosystemId }, - data: { - name, - description, - autoEndorsement, - tags, - logoUrl: logo, - lastChangedBy: userId - } + data }); return editEcosystem; } catch (error) { @@ -721,6 +716,24 @@ export class EcosystemRepository { } } + // eslint-disable-next-line camelcase + async getAllAgentDetails(orgId: string): Promise { + try { + if (!orgId) { + throw new InternalServerErrorException(ResponseMessages.ecosystem.error.invalidOrgId); + } + return await this.prisma.org_agents.findMany({ + where: { + orgId: orgId.toString() + } + }); + + } catch (error) { + this.logger.error(`Error in getAllAgentDetails for the ecosystem: ${error.message} `); + throw error; + } + } + /** * Description: Get getAgentEndPoint by invalidEcosystemId * @param invalidEcosystemId diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 247ea5124..8024dbca9 100644 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -60,7 +60,7 @@ export class EcosystemService { } const orgDetails: OrganizationData = await this.getOrganizationDetails(createEcosystemDto.orgId, createEcosystemDto.userId); - + if (!orgDetails) { throw new NotFoundException(ResponseMessages.ecosystem.error.orgNotExist); } @@ -69,7 +69,9 @@ export class EcosystemService { throw new NotFoundException(ResponseMessages.ecosystem.error.orgDidNotExist); } - const createEcosystem = await this.ecosystemRepository.createNewEcosystem(createEcosystemDto); + const ecosystemLedgers = orgDetails.org_agents.map((agent) => agent.ledgers.id); + + const createEcosystem = await this.ecosystemRepository.createNewEcosystem(createEcosystemDto, ecosystemLedgers); if (!createEcosystem) { throw new NotFoundException(ResponseMessages.ecosystem.error.notCreated); } @@ -105,12 +107,28 @@ export class EcosystemService { */ // eslint-disable-next-line camelcase - async editEcosystem(editEcosystemDto, ecosystemId): Promise { - const editOrganization = await this.ecosystemRepository.updateEcosystemById(editEcosystemDto, ecosystemId); - if (!editOrganization) { + async editEcosystem(editEcosystemDto: CreateEcosystem, ecosystemId: string): Promise { + const { name, description, tags, logo, autoEndorsement, userId } = editEcosystemDto; + + const updateData : CreateEcosystem = { + lastChangedBy: userId + }; + + if (name) { updateData.name = name; } + + if (description) { updateData.description = description; } + + if (tags) { updateData.tags = tags; } + + if (logo) { updateData.logo = tags; } + + if ('' !== autoEndorsement.toString()) { updateData.autoEndorsement = autoEndorsement; } + + const editEcosystem = await this.ecosystemRepository.updateEcosystemById(updateData, ecosystemId); + if (!editEcosystem) { throw new NotFoundException(ResponseMessages.ecosystem.error.update); } - return editOrganization; + return editEcosystem; } /** @@ -200,9 +218,25 @@ export class EcosystemService { async createInvitation(bulkInvitationDto: BulkSendInvitationDto, userId: string, userEmail: string): Promise { const { invitations, ecosystemId } = bulkInvitationDto; - try { - const ecosystemDetails = await this.ecosystemRepository.getEcosystemDetails(ecosystemId); + const ecosystemDetails = await this.ecosystemRepository.getEcosystemDetails(ecosystemId); + + if (!ecosystemDetails.ledgers + || (Array.isArray(ecosystemDetails.ledgers) + && 0 === ecosystemDetails.ledgers.length)) { + + const ecosystemLeadDetails = await this.ecosystemRepository.getEcosystemLeadDetails(ecosystemId); + + const ecosystemAgents = await this.ecosystemRepository.getAllAgentDetails(ecosystemLeadDetails.orgId); + + const ecosystemLedgers = ecosystemAgents.map((agent) => agent.ledgerId); + + const updateData : CreateEcosystem = { + ledgers: ecosystemLedgers + }; + + await this.ecosystemRepository.updateEcosystemById(updateData, ecosystemId); + } for (const invitation of invitations) { const { email } = invitation; @@ -263,6 +297,24 @@ export class EcosystemService { throw new NotFoundException(ResponseMessages.ecosystem.error.orgDidNotExist); } + const orgLedgers = orgDetails.org_agents.map((agent) => agent.ledgers.id); + + const ecosystemDetails = await this.ecosystemRepository.getEcosystemDetails(invitation.ecosystemId); + + let isLedgerFound = false; + + for (const ledger of orgLedgers) { + // Check if the ledger is present in the ecosystem + if (Array.isArray(ecosystemDetails.ledgers) && ecosystemDetails.ledgers.includes(ledger)) { + // If a ledger is found, return true + isLedgerFound = true; + } + } + + if (!isLedgerFound) { + throw new NotFoundException(ResponseMessages.ecosystem.error.ledgerNotMatch); + } + const updatedInvitation = await this.updateEcosystemInvitation(invitationId, orgId, status); if (!updatedInvitation) { throw new NotFoundException(ResponseMessages.ecosystem.error.invitationNotUpdate); diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 98045a561..7a0f76166 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -246,6 +246,7 @@ export const ResponseMessages = { invalidInvitationStatus: 'Invalid invitation status', invitationNotFound: 'Ecosystem Invitation not found', invitationNotUpdate: 'Ecosystem Invitation not updated', + ledgerNotMatch: 'Organization ledger network not matched with Ecosystem', orgsNotUpdate: 'Ecosystem Orgs not updated', ecosystemNotEnabled: 'Ecosystem service is not enabled', sumbitTransaction: 'Error while submitting transaction', diff --git a/libs/prisma-service/prisma/migrations/20231211112032_ecosystem_ledgers_column/migration.sql b/libs/prisma-service/prisma/migrations/20231211112032_ecosystem_ledgers_column/migration.sql new file mode 100644 index 000000000..6887e3368 --- /dev/null +++ b/libs/prisma-service/prisma/migrations/20231211112032_ecosystem_ledgers_column/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "ecosystem" ADD COLUMN "ledgers" JSONB; diff --git a/libs/prisma-service/prisma/schema.prisma b/libs/prisma-service/prisma/schema.prisma index a5ea40211..96e95c998 100644 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -341,6 +341,7 @@ model ecosystem { ecosystemInvitations ecosystem_invitations[] ecosystemOrgs ecosystem_orgs[] ecosystemUsers ecosystem_users[] + ledgers Json? } model ecosystem_invitations { From 93a644435e3bfb6547a68430b6213d030544c7a2 Mon Sep 17 00:00:00 2001 From: Nishad Date: Tue, 12 Dec 2023 15:56:49 +0530 Subject: [PATCH 30/51] worked on the fetch ledger details for ecosystem. Signed-off-by: Nishad --- .../interfaces/ecosystem.interfaces.ts | 49 ++++++++++++++++++- apps/ecosystem/src/ecosystem.repository.ts | 7 +-- apps/ecosystem/src/ecosystem.service.ts | 43 +++++++++++++++- .../src/interfaces/ledgers.interface.ts | 6 +++ apps/ledger/src/ledger.controller.ts | 6 +++ apps/ledger/src/ledger.service.ts | 16 ++++++ .../src/repositories/ledger.repository.ts | 21 ++++++++ 7 files changed, 141 insertions(+), 7 deletions(-) create mode 100644 apps/ledger/src/interfaces/ledgers.interface.ts diff --git a/apps/ecosystem/interfaces/ecosystem.interfaces.ts b/apps/ecosystem/interfaces/ecosystem.interfaces.ts index 477ad391c..2ba6d3aeb 100644 --- a/apps/ecosystem/interfaces/ecosystem.interfaces.ts +++ b/apps/ecosystem/interfaces/ecosystem.interfaces.ts @@ -219,7 +219,14 @@ export interface OrgAgent { orgId: string; orgAgentTypeId: string; ledgerId?: string; - ledgers?: {id: string}; + ledgers?: LedgerDetails; +} + +export interface LedgerDetails { + id: string, + name: string, + indyNamespace: string, + networkUrl: string } export interface EcosystemDetails { @@ -233,4 +240,42 @@ export interface EcosystemDetails { deletedAt: Date; }; }[]; -} \ No newline at end of file +} + +export interface EcosystemInvitationDetails { + name: string; + id: string; + logoUrl: string; + description?: string; + tags?: string; + createDateTime?: Date; + createdBy?: string; + lastChangedDateTime?: Date; + lastChangedBy?: string; + deletedAt?: Date; + autoEndorsement?: boolean; + ledgers: Prisma.JsonValue; + networkDetails?: LedgerDetails[]; +} + + +export interface InvitationResponse { + id: string; + email: string; + status: string; + ecosystemId: string; + userId: string; + orgId: string; + deletedAt: Date; + ecosystem: EcosystemInvitationDetails; + createDateTime: Date; + createdBy: string; + lastChangedDateTime: Date; + lastChangedBy: string; +} + +export interface EcoInvitationsPagination { + invitations: InvitationResponse[]; + totalPages: number; +} + diff --git a/apps/ecosystem/src/ecosystem.repository.ts b/apps/ecosystem/src/ecosystem.repository.ts index fddcefe07..090583dbf 100644 --- a/apps/ecosystem/src/ecosystem.repository.ts +++ b/apps/ecosystem/src/ecosystem.repository.ts @@ -4,7 +4,7 @@ import { PrismaService } from '@credebl/prisma-service'; import { credential_definition, ecosystem, ecosystem_config, ecosystem_invitations, ecosystem_orgs, ecosystem_roles, endorsement_transaction, org_agents, platform_config, schema } from '@prisma/client'; import { DeploymentModeType, EcosystemInvitationStatus, EcosystemOrgStatus, EcosystemRoles, endorsementTransactionStatus, endorsementTransactionType } from '../enums/ecosystem.enum'; import { updateEcosystemOrgsDto } from '../dtos/update-ecosystemOrgs.dto'; -import { CreateEcosystem, EcosystemDetails, SaveSchema, SchemaTransactionResponse, saveCredDef } from '../interfaces/ecosystem.interfaces'; +import { CreateEcosystem, EcoInvitationsPagination, EcosystemDetails, SaveSchema, SchemaTransactionResponse, saveCredDef } from '../interfaces/ecosystem.interfaces'; import { ResponseMessages } from '@credebl/common/response-messages'; import { NotFoundException } from '@nestjs/common'; import { CommonConstants } from '@credebl/common/common.constant'; @@ -512,7 +512,7 @@ export class EcosystemRepository { } - async getEcosystemInvitationsPagination(queryObject: object, pageNumber: number, pageSize: number): Promise { + async getEcosystemInvitationsPagination(queryObject: object, pageNumber: number, pageSize: number): Promise { try { const result = await this.prisma.$transaction([ this.prisma.ecosystem_invitations.findMany({ @@ -524,7 +524,8 @@ export class EcosystemRepository { select: { id: true, name: true, - logoUrl: true + logoUrl: true, + ledgers: true } } }, diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 8024dbca9..d48fe8b46 100644 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -14,7 +14,7 @@ import { EcosystemConfigSettings, Invitation, OrgAgentType } from '@credebl/enum import { EcosystemOrgStatus, EcosystemRoles, endorsementTransactionStatus, endorsementTransactionType } from '../enums/ecosystem.enum'; import { FetchInvitationsPayload } from '../interfaces/invitations.interface'; import { EcosystemMembersPayload } from '../interfaces/ecosystemMembers.interface'; -import { CreateEcosystem, CredDefMessage, OrganizationData, RequestCredDeffEndorsement, RequestSchemaEndorsement, SaveSchema, SchemaMessage, SignedTransactionMessage, saveCredDef, submitTransactionPayload } from '../interfaces/ecosystem.interfaces'; +import { CreateEcosystem, CredDefMessage, LedgerDetails, OrganizationData, RequestCredDeffEndorsement, RequestSchemaEndorsement, SaveSchema, SchemaMessage, SignedTransactionMessage, saveCredDef, submitTransactionPayload } from '../interfaces/ecosystem.interfaces'; import { GetAllSchemaList, GetEndorsementsPayload } from '../interfaces/endorsements.interface'; import { CommonConstants } from '@credebl/common/common.constant'; // eslint-disable-next-line camelcase @@ -185,6 +185,26 @@ export class EcosystemService { } } + async fetchLedgerDetailsbyId(id: string): Promise { + const pattern = { cmd: 'get-network-details-by-id' }; + const payload = { id }; + + return this.ecosystemServiceProxy + .send(pattern, payload) + .toPromise() + .catch((error) => { + this.logger.error(`catch: ${JSON.stringify(error)}`); + throw new HttpException( + { + status: error.status, + error: error.message + }, + error.status + ); + }); + } + + /** * Description: get an ecosystem invitation * @returns Get sent ecosystem invitation details @@ -201,7 +221,26 @@ export class EcosystemService { ] }; - return await this.ecosystemRepository.getEcosystemInvitationsPagination(query, pageNumber, pageSize); + const ecosystemInvitations = await this.ecosystemRepository.getEcosystemInvitationsPagination(query, pageNumber, pageSize); + + for (const invitation of ecosystemInvitations.invitations) { + + const ledgerNetworks = invitation.ecosystem.ledgers; + + const ledgerData = []; + + if (Array.isArray(ledgerNetworks)) { + for (const ledger of ledgerNetworks) { + const ledgerDetails = await this.fetchLedgerDetailsbyId(ledger.toString()); + ledgerData.push(ledgerDetails); + } + invitation.ecosystem.networkDetails = ledgerData; + } + + } + + return ecosystemInvitations; + } catch (error) { this.logger.error(`In error getEcosystemInvitations: ${JSON.stringify(error)}`); throw new InternalServerErrorException(error); diff --git a/apps/ledger/src/interfaces/ledgers.interface.ts b/apps/ledger/src/interfaces/ledgers.interface.ts new file mode 100644 index 000000000..e8ca2d5f3 --- /dev/null +++ b/apps/ledger/src/interfaces/ledgers.interface.ts @@ -0,0 +1,6 @@ +export interface LedgerDetails { + id: string, + name: string, + indyNamespace: string, + networkUrl: string +} \ No newline at end of file diff --git a/apps/ledger/src/ledger.controller.ts b/apps/ledger/src/ledger.controller.ts index f7c38642e..02c337b59 100644 --- a/apps/ledger/src/ledger.controller.ts +++ b/apps/ledger/src/ledger.controller.ts @@ -2,6 +2,7 @@ import { Controller } from '@nestjs/common'; import { LedgerService } from './ledger.service'; import { MessagePattern } from '@nestjs/microservices'; import { ledgers } from '@prisma/client'; +import { LedgerDetails } from './interfaces/ledgers.interface'; @Controller() export class LedgerController { @@ -18,4 +19,9 @@ export class LedgerController { }> { return this.ledgerService.getNetworkUrl(payload); } + + @MessagePattern({ cmd: 'get-network-details-by-id' }) + async getNetworkDetailsById(payload: {id: string}): Promise { + return this.ledgerService.getLedgerDetailsById(payload.id); + } } diff --git a/apps/ledger/src/ledger.service.ts b/apps/ledger/src/ledger.service.ts index d13c2668b..dda91313a 100644 --- a/apps/ledger/src/ledger.service.ts +++ b/apps/ledger/src/ledger.service.ts @@ -4,6 +4,7 @@ import { LedgerRepository } from './repositories/ledger.repository'; import { RpcException } from '@nestjs/microservices'; import { ledgers } from '@prisma/client'; import { ResponseMessages } from '@credebl/common/response-messages'; +import { LedgerDetails } from './interfaces/ledgers.interface'; @Injectable() export class LedgerService extends BaseService { @@ -45,4 +46,19 @@ export class LedgerService extends BaseService { throw new RpcException(error.response ? error.response : error); } } + + async getLedgerDetailsById(id: string): Promise { + try { + const getAllLedgerDetails = await this.ledgerRepository.getNetworkById(id); + + if (!getAllLedgerDetails) { + throw new NotFoundException(ResponseMessages.ledger.error.NotFound); + } + + return getAllLedgerDetails; + } catch (error) { + this.logger.error(`Error in getLedgerDetailsById: ${error}`); + throw new RpcException(error.response ? error.response : error); + } + } } diff --git a/apps/ledger/src/repositories/ledger.repository.ts b/apps/ledger/src/repositories/ledger.repository.ts index db2b290be..dcfd68aac 100644 --- a/apps/ledger/src/repositories/ledger.repository.ts +++ b/apps/ledger/src/repositories/ledger.repository.ts @@ -1,6 +1,7 @@ import { PrismaService } from "@credebl/prisma-service"; import { Injectable, Logger } from "@nestjs/common"; import { ledgers } from "@prisma/client"; +import { LedgerDetails } from "../interfaces/ledgers.interface"; @Injectable() @@ -38,4 +39,24 @@ export class LedgerRepository { throw error; } } + + async getNetworkById(ledgerId: string): Promise { + + try { + return this.prisma.ledgers.findFirst({ + where: { + id: ledgerId + }, + select: { + id: true, + name: true, + indyNamespace: true, + networkUrl: true + } + }); + } catch (error) { + this.logger.error(`Error in getNetworkById: ${error}`); + throw error; + } + } } \ No newline at end of file From 1c948833bea54165ef497adea81285750375e881 Mon Sep 17 00:00:00 2001 From: Nishad Date: Tue, 12 Dec 2023 16:17:18 +0530 Subject: [PATCH 31/51] added ecosystem & org role guard Signed-off-by: Nishad --- apps/api-gateway/src/ecosystem/dtos/edit-ecosystem-dto.ts | 3 ++- apps/api-gateway/src/ecosystem/ecosystem.controller.ts | 2 +- libs/common/src/response-messages/index.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/api-gateway/src/ecosystem/dtos/edit-ecosystem-dto.ts b/apps/api-gateway/src/ecosystem/dtos/edit-ecosystem-dto.ts index dc0fd4231..2c09343b6 100644 --- a/apps/api-gateway/src/ecosystem/dtos/edit-ecosystem-dto.ts +++ b/apps/api-gateway/src/ecosystem/dtos/edit-ecosystem-dto.ts @@ -18,6 +18,7 @@ export class EditEcosystemDto { @ApiPropertyOptional() @Transform(({ value }) => trim(value)) @IsOptional() + @IsNotEmpty({ message: 'Description is required.' }) @MinLength(2, { message: 'Description must be at least 2 characters.' }) @MaxLength(255, { message: 'Description must be at most 255 characters.' }) @IsString({ message: 'Description must be in string format.' }) @@ -27,7 +28,7 @@ export class EditEcosystemDto { @IsOptional() @Transform(({ value }) => trim(value)) @IsString({ message: 'tag must be in string format.' }) - tags?: string; + tags? = ''; @ApiPropertyOptional() @IsOptional() diff --git a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts index fb477e265..a75c9fe67 100644 --- a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts @@ -474,7 +474,7 @@ export class EcosystemController { @Put('/:ecosystemId/:orgId') @ApiOperation({ summary: 'Edit ecosystem', description: 'Edit existing ecosystem' }) @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) - @UseGuards(AuthGuard('jwt')) + @UseGuards(AuthGuard('jwt'), OrgRolesGuard, EcosystemRolesGuard) @ApiBearerAuth() @EcosystemsRoles(EcosystemRoles.ECOSYSTEM_OWNER, EcosystemRoles.ECOSYSTEM_LEAD) @Roles(OrgRoles.OWNER) diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 7a0f76166..0a4e655fd 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -219,7 +219,7 @@ export const ResponseMessages = { ecosystem: { success: { create: 'Ecosystem created successfully', - update: 'Ecosystem updated successfully', + update: 'Ecosystem details updated successfully', delete: 'Ecosystem invitations deleted successfully', fetch: 'Ecosystem fetched successfully', getEcosystemDashboard: 'Ecosystem dashboard details fetched successfully', From 870e454f462459ffd3334383294be5ed266b0679 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Wed, 13 Dec 2023 11:53:22 +0530 Subject: [PATCH 32/51] feat: masked pi data Signed-off-by: bhavanakarwade --- apps/connection/src/connection.repository.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/connection/src/connection.repository.ts b/apps/connection/src/connection.repository.ts index 57c93f3aa..993b2f220 100644 --- a/apps/connection/src/connection.repository.ts +++ b/apps/connection/src/connection.repository.ts @@ -95,6 +95,7 @@ export class ConnectionRepository { // eslint-disable-next-line camelcase async saveConnectionWebhook(payload: IConnectionInterface): Promise { try { + let organisationId: string; const { connectionDto, orgId } = payload; @@ -105,6 +106,14 @@ export class ConnectionRepository { organisationId = orgId; } + const walletLabelabelName = connectionDto.theirLabel; + + const firstThreeLetters = walletLabelabelName.slice(0, 3); + const lastThreeLetters = walletLabelabelName.slice(-3); + const middleMasked = walletLabelabelName.slice(3, -3).replace(/./g, '*'); + + const maskedTheirLabel = firstThreeLetters + middleMasked + lastThreeLetters; + const agentDetails = await this.prisma.connections.upsert({ where: { connectionId: connectionDto?.id @@ -121,7 +130,7 @@ export class ConnectionRepository { lastChangedBy: organisationId, connectionId: connectionDto?.id, state: connectionDto?.state, - theirLabel: connectionDto?.theirLabel, + theirLabel: maskedTheirLabel, orgId: organisationId } }); @@ -131,7 +140,7 @@ export class ConnectionRepository { throw error; } } - + /** * Description: Save ShorteningUrl details * @param referenceId From 35595ae4a2cd74c3ff6b58916686eb1d3b7b81f0 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Wed, 13 Dec 2023 16:41:36 +0530 Subject: [PATCH 33/51] feat: applied pagination and sorting Signed-off-by: bhavanakarwade --- .../src/issuance/interfaces/index.ts | 1 - apps/connection/src/connection.repository.ts | 45 ++++++++++++++++--- .../src/interfaces/connection.interfaces.ts | 6 --- .../interfaces/issuance.interfaces.ts | 3 -- .../src/interfaces/verification.interface.ts | 1 - 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/apps/api-gateway/src/issuance/interfaces/index.ts b/apps/api-gateway/src/issuance/interfaces/index.ts index c492d9ed4..1b3eb5bf5 100644 --- a/apps/api-gateway/src/issuance/interfaces/index.ts +++ b/apps/api-gateway/src/issuance/interfaces/index.ts @@ -73,6 +73,5 @@ export interface IIssuedCredentialSearchinterface { sorting: string; sortByValue: string; searchByText: string; - // user: IUserRequestInterface } diff --git a/apps/connection/src/connection.repository.ts b/apps/connection/src/connection.repository.ts index 993b2f220..74a715955 100644 --- a/apps/connection/src/connection.repository.ts +++ b/apps/connection/src/connection.repository.ts @@ -106,14 +106,45 @@ export class ConnectionRepository { organisationId = orgId; } - const walletLabelabelName = connectionDto.theirLabel; - - const firstThreeLetters = walletLabelabelName.slice(0, 3); - const lastThreeLetters = walletLabelabelName.slice(-3); - const middleMasked = walletLabelabelName.slice(3, -3).replace(/./g, '*'); - - const maskedTheirLabel = firstThreeLetters + middleMasked + lastThreeLetters; + const walletLabelName = connectionDto?.theirLabel; + let maskedTheirLabel: string; + let firstLetters: string; + let maskedMiddleLetters: string; + let lastLetters: string; + switch (true) { + case 3 >= walletLabelName.length: + firstLetters = walletLabelName.slice(0, 1); + maskedMiddleLetters = walletLabelName.slice(1).replace(/./g, '*'); + maskedTheirLabel = firstLetters + maskedMiddleLetters; + break; + + case 3 < walletLabelName.length && 6 > walletLabelName.length: + firstLetters = walletLabelName.slice(0, 1); + lastLetters = walletLabelName.slice(-1); + maskedMiddleLetters = walletLabelName.slice(1, -1).replace(/./g, '*'); + maskedTheirLabel = firstLetters + lastLetters + maskedMiddleLetters; + break; + + case 6 <= walletLabelName.length && 8 >= walletLabelName.length: + firstLetters = walletLabelName.slice(0, 2); + lastLetters = walletLabelName.slice(-2); + maskedMiddleLetters = walletLabelName.slice(2, -2).replace(/./g, '*'); + maskedTheirLabel = firstLetters + lastLetters + maskedMiddleLetters; + break; + + case 8 < walletLabelName.length: + firstLetters = walletLabelName.slice(0, 3); + lastLetters = walletLabelName.slice(-3); + maskedMiddleLetters = walletLabelName.slice(3, -3).replace(/./g, '*'); + maskedTheirLabel = firstLetters + lastLetters + maskedMiddleLetters; + break; + + default: + maskedTheirLabel = walletLabelName; + break; + } + const agentDetails = await this.prisma.connections.upsert({ where: { connectionId: connectionDto?.id diff --git a/apps/connection/src/interfaces/connection.interfaces.ts b/apps/connection/src/interfaces/connection.interfaces.ts index a9afc22c6..2bbedae60 100644 --- a/apps/connection/src/interfaces/connection.interfaces.ts +++ b/apps/connection/src/interfaces/connection.interfaces.ts @@ -72,12 +72,6 @@ export class ConnectionPayload { export class IFetchConnectionInterface { connectionSearchCriteria: IConnectionSearchCriteria; user: IUserRequest; - // outOfBandId: string; - // alias: string; - // state: string; - // myDid: string; - // theirDid: string; - // theirLabel: string; orgId: string; } diff --git a/apps/issuance/interfaces/issuance.interfaces.ts b/apps/issuance/interfaces/issuance.interfaces.ts index 1eba6fb3d..088bb841c 100644 --- a/apps/issuance/interfaces/issuance.interfaces.ts +++ b/apps/issuance/interfaces/issuance.interfaces.ts @@ -19,10 +19,7 @@ export interface IIssuance { export interface IIssueCredentials { issuedCredentialsSearchCriteria: IIssuedCredentialsSearchCriteria; user: IUserRequest; - // connectionId: string; - // threadId: string; orgId: string; - // state: string; } export interface IIssueCredentialsDefinitions { diff --git a/apps/verification/src/interfaces/verification.interface.ts b/apps/verification/src/interfaces/verification.interface.ts index fe4ce1645..38648d477 100644 --- a/apps/verification/src/interfaces/verification.interface.ts +++ b/apps/verification/src/interfaces/verification.interface.ts @@ -135,6 +135,5 @@ export interface IProofRequestsSearchCriteria { sorting: string; sortByValue: string; searchByText: string; - // user?: IUserRequestInterface; } From 2e583013d2fc5e18d729387c0af38fdca8fff026 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Wed, 13 Dec 2023 17:07:52 +0530 Subject: [PATCH 34/51] resolved sonarlint checks Signed-off-by: bhavanakarwade --- .../src/connection/dtos/get-all-connections.dto.ts | 6 +++--- .../issuance/dtos/get-all-issued-credentials.dto.ts | 6 +++--- apps/api-gateway/src/issuance/issuance.controller.ts | 6 +++--- .../verification/dto/get-all-proof-requests.dto.ts | 4 ++-- .../src/verification/verification.controller.ts | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/api-gateway/src/connection/dtos/get-all-connections.dto.ts b/apps/api-gateway/src/connection/dtos/get-all-connections.dto.ts index 2e15c095f..5f02fc395 100644 --- a/apps/api-gateway/src/connection/dtos/get-all-connections.dto.ts +++ b/apps/api-gateway/src/connection/dtos/get-all-connections.dto.ts @@ -6,12 +6,12 @@ import { SortValue } from "../../enum"; export class GetAllConnectionsDto { @ApiProperty({ required: false }) @IsOptional() - pageNumber: number = 1; + @Type(() => String) + searchByText: string = ''; @ApiProperty({ required: false }) @IsOptional() - @Type(() => String) - searchByText: string = ''; + pageNumber: number = 1; @ApiProperty({ required: false }) @IsOptional() diff --git a/apps/api-gateway/src/issuance/dtos/get-all-issued-credentials.dto.ts b/apps/api-gateway/src/issuance/dtos/get-all-issued-credentials.dto.ts index 57305e80c..1112de27a 100644 --- a/apps/api-gateway/src/issuance/dtos/get-all-issued-credentials.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/get-all-issued-credentials.dto.ts @@ -10,12 +10,12 @@ export class GetAllIssuedCredentialsDto { @ApiProperty({ required: false }) @IsOptional() - @Type(() => String) - searchByText: string = ''; + pageSize: number = 10; @ApiProperty({ required: false }) @IsOptional() - pageSize: number = 10; + @Type(() => String) + searchByText: string = ''; @ApiProperty({ required: false }) @IsOptional() diff --git a/apps/api-gateway/src/issuance/issuance.controller.ts b/apps/api-gateway/src/issuance/issuance.controller.ts index 71019f5f4..77e71d9dd 100644 --- a/apps/api-gateway/src/issuance/issuance.controller.ts +++ b/apps/api-gateway/src/issuance/issuance.controller.ts @@ -118,16 +118,16 @@ export class IssuanceController { required: false }) @ApiQuery({ - name: 'sorting', + name: 'sortByValue', type: String, required: false }) @ApiQuery({ - name: 'sortByValue', + name: 'sorting', type: String, required: false }) - + @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) @ApiBearerAuth() @UseGuards(AuthGuard('jwt'), OrgRolesGuard) diff --git a/apps/api-gateway/src/verification/dto/get-all-proof-requests.dto.ts b/apps/api-gateway/src/verification/dto/get-all-proof-requests.dto.ts index aaadfe80d..5ed8cc376 100644 --- a/apps/api-gateway/src/verification/dto/get-all-proof-requests.dto.ts +++ b/apps/api-gateway/src/verification/dto/get-all-proof-requests.dto.ts @@ -19,9 +19,9 @@ export class GetAllProofRequestsDto { @ApiProperty({ required: false }) @IsOptional() - sorting: string = 'id'; + sortByValue: string = SortValue.DESC; @ApiProperty({ required: false }) @IsOptional() - sortByValue: string = SortValue.DESC; + sorting: string = 'id'; } diff --git a/apps/api-gateway/src/verification/verification.controller.ts b/apps/api-gateway/src/verification/verification.controller.ts index d5b02bef6..a1ed8a64f 100644 --- a/apps/api-gateway/src/verification/verification.controller.ts +++ b/apps/api-gateway/src/verification/verification.controller.ts @@ -135,15 +135,15 @@ export class VerificationController { required: false }) @ApiQuery({ - name: 'searchByText', - type: String, - required: false + name: 'pageSize', + type: Number, + required: false }) @ApiQuery({ - name: 'pageSize', - type: Number, + name: 'searchByText', + type: String, required: false - }) + }) @ApiQuery({ name: 'sorting', type: String, From 7d28e9fc3262462fc425270cb8cc802d812989bb Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Wed, 13 Dec 2023 17:13:28 +0530 Subject: [PATCH 35/51] removed unnecessary code Signed-off-by: bhavanakarwade --- apps/api-gateway/src/connection/connection.controller.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/api-gateway/src/connection/connection.controller.ts b/apps/api-gateway/src/connection/connection.controller.ts index 967eea60d..850355101 100644 --- a/apps/api-gateway/src/connection/connection.controller.ts +++ b/apps/api-gateway/src/connection/connection.controller.ts @@ -11,7 +11,6 @@ import { ConnectionService } from './connection.service'; import { ConnectionDto, CreateConnectionDto } from './dtos/connection.dto'; import { IUserRequestInterface } from './interfaces'; import { Response } from 'express'; -// import { Connections } from './enums/connections.enum'; import { IUserRequest } from '@credebl/user-request/user-request.interface'; import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler'; import { OrgRoles } from 'libs/org-roles/enums'; From c3234389ceaa773dd2bc0f2ad5ef6561d0e48153 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Wed, 13 Dec 2023 17:50:58 +0530 Subject: [PATCH 36/51] refactor:api response Signed-off-by: pranalidhanavade --- apps/user/interfaces/user.interface.ts | 125 +++++++++++----------- apps/user/repositories/user.repository.ts | 45 ++++---- apps/user/src/user.controller.ts | 2 +- apps/user/src/user.service.ts | 5 +- libs/user-activity/interface/index.ts | 9 ++ libs/user-activity/repositories/index.ts | 4 +- 6 files changed, 102 insertions(+), 88 deletions(-) create mode 100644 libs/user-activity/interface/index.ts diff --git a/apps/user/interfaces/user.interface.ts b/apps/user/interfaces/user.interface.ts index a4f1d9cb3..cbbf20c75 100644 --- a/apps/user/interfaces/user.interface.ts +++ b/apps/user/interfaces/user.interface.ts @@ -1,75 +1,72 @@ export interface UserI { - id?: string, - username?: string, - email?: string, - firstName?: string, - lastName?: string, - isEmailVerified?: boolean, - clientId?: string, - clientSecret?: string, - supabaseUserId?: string, - userOrgRoles?: object -} - -export interface InvitationsI { - id: string, - userId: string, - orgId?: string, - organisation?: object - orgRoleId?: string, - status: string, - email?: string - orgRoles: string[] -} - -export interface UserEmailVerificationDto{ - email:string - username?:string -} - -export interface userInfo{ - email: string, - password: string, - firstName: string, - lastName: string, - isPasskey: boolean -} - -export interface AddPasskeyDetails{ - password: string, -} - -export interface UserWhereUniqueInput{ - id?: string -} - -export interface UserWhereInput{ - email?: string -} -export interface UpdateUserProfile { - id: string, + id?: string; + username?: string; + email?: string; + firstName?: string; + lastName?: string; + supabaseUserId?: string; + userOrgRoles?: object; + } + + export interface InvitationsI { + id: string; + userId: string; + orgId?: string; + organisation?: object; + orgRoleId?: string; + status: string; + email?: string; + orgRoles: string[]; + } + + export interface UserEmailVerificationDto { + email: string; + username?: string; + } + + export interface userInfo { + email: string; + password: string; + firstName: string; + lastName: string; + isPasskey: boolean; + } + + export interface AddPasskeyDetails { + password: string; + } + + export interface UserWhereUniqueInput { + id?: string; + } + + export interface UserWhereInput { + email?: string; + } + export interface UpdateUserProfile { + id: string; profileImg?: string; - firstName: string, - lastName: string, - isPublic: boolean, -} -export interface PlatformSettingsI { - externalIp: string, - lastInternalId: string, + firstName: string; + lastName: string; + isPublic: boolean; + } + export interface PlatformSettingsI { + externalIp: string; + lastInternalId: string; sgApiKey: string; - emailFrom: string, + emailFrom: string; apiEndPoint: string; enableEcosystem: boolean; multiEcosystemSupport: boolean; -} - -export interface ShareUserCertificateI { + } + + export interface ShareUserCertificateI { schemaId: string; credentialId: string; attributes: Attribute[]; -} - -export interface Attribute { + } + + export interface Attribute { [key: string]: string; - label: string + label: string; } \ No newline at end of file diff --git a/apps/user/repositories/user.repository.ts b/apps/user/repositories/user.repository.ts index faa8cf0a6..821f2b70f 100644 --- a/apps/user/repositories/user.repository.ts +++ b/apps/user/repositories/user.repository.ts @@ -7,7 +7,7 @@ import { UpdateUserProfile, UserEmailVerificationDto, UserI, - userInfo + userInfo } from '../interfaces/user.interface'; import { InternalServerErrorException } from '@nestjs/common'; @@ -221,25 +221,32 @@ export class UserRepository { lastName: true, profileImg: true, publicProfile: true, - isEmailVerified: true, - clientId: true, - clientSecret: true, supabaseUserId: true, userOrgRoles: { - include: { - orgRole: true, + select:{ + id: true, + userId:true, + orgRoleId:true, + orgId:true, + orgRole: { + select:{ + id: true, + name: true, + description: true + } + }, organisation: { - include: { - // eslint-disable-next-line camelcase - org_agents: { - include: { - // eslint-disable-next-line camelcase - agents_type: true - } - } + select: { + id: true, + name: true, + description: true, + orgSlug:true, + logoUrl: true, + website: true, + publicProfile: true } - } } + } } } }); @@ -358,18 +365,18 @@ export class UserRepository { }, select: { id: true, - username: true, +username: true, email: true, firstName: true, lastName: true, - isEmailVerified: true, +isEmailVerified: true, clientId: true, clientSecret: true, supabaseUserId: true, userOrgRoles: { - where: { + where: { ...filterOptions - // Additional filtering conditions if needed +// Additional filtering conditions if needed }, include: { orgRole: true, diff --git a/apps/user/src/user.controller.ts b/apps/user/src/user.controller.ts index 9d6b101f6..e0e89bae7 100644 --- a/apps/user/src/user.controller.ts +++ b/apps/user/src/user.controller.ts @@ -37,7 +37,7 @@ export class UserController { } @MessagePattern({ cmd: 'get-user-profile' }) - async getProfile(payload: { id }): Promise { + async getProfile(payload: { id }): Promise { return this.userService.getProfile(payload); } diff --git a/apps/user/src/user.service.ts b/apps/user/src/user.service.ts index 9ae0ec698..3d8127395 100644 --- a/apps/user/src/user.service.ts +++ b/apps/user/src/user.service.ts @@ -35,7 +35,7 @@ import { UpdateUserProfile, UserEmailVerificationDto, UserI, - userInfo + userInfo } from '../interfaces/user.interface'; import { AcceptRejectInvitationDto } from '../dtos/accept-reject-invitation.dto'; import { UserActivityService } from '@credebl/user-activity'; @@ -363,7 +363,7 @@ export class UserService { } } - async getProfile(payload: { id }): Promise { + async getProfile(payload: { id }): Promise { try { const userData = await this.userRepository.getUserById(payload.id); const ecosystemSettingsList = await this.prisma.ecosystem_config.findMany({ @@ -677,6 +677,7 @@ export class UserService { */ async getOrgUsers(orgId: string, pageNumber: number, pageSize: number, search: string): Promise { try { + const query = { userOrgRoles: { some: { orgId } diff --git a/libs/user-activity/interface/index.ts b/libs/user-activity/interface/index.ts new file mode 100644 index 000000000..764ee9a2d --- /dev/null +++ b/libs/user-activity/interface/index.ts @@ -0,0 +1,9 @@ +export interface user_Activity { + id: string, + orgId: string, + userId: string, + details: string, + action: string, + lastChangedDateTime: Date, + createDateTime: Date, +} \ No newline at end of file diff --git a/libs/user-activity/repositories/index.ts b/libs/user-activity/repositories/index.ts index c0a3d730e..5330eabe6 100644 --- a/libs/user-activity/repositories/index.ts +++ b/libs/user-activity/repositories/index.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ import { Injectable, Logger } from '@nestjs/common'; - +import { user_Activity } from '../interface'; import { PrismaService } from '@credebl/prisma-service'; import { user_activity } from '@prisma/client'; @@ -23,7 +23,7 @@ export class UserActivityRepository { } - async getRecentActivities(userId: string, limit: number): Promise { + async getRecentActivities(userId: string, limit: number): Promise { return this.prisma.user_activity.findMany({ where: { userId From fbda26d30a0b1bfa59143b0fccdfde68015d8370 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Thu, 14 Dec 2023 00:44:42 +0530 Subject: [PATCH 37/51] fix: schema validations bugs Signed-off-by: bhavanakarwade --- apps/ledger/src/schema/schema.service.ts | 65 +++++++++++++--------- libs/common/src/response-messages/index.ts | 3 +- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/apps/ledger/src/schema/schema.service.ts b/apps/ledger/src/schema/schema.service.ts index be924e17f..0086fde1a 100644 --- a/apps/ledger/src/schema/schema.service.ts +++ b/apps/ledger/src/schema/schema.service.ts @@ -35,19 +35,20 @@ export class SchemaService extends BaseService { const apiKey = ''; const { userId } = user.selectedOrg; try { + const schemaExists = await this.schemaRepository.schemaExists( schema.schemaName, schema.schemaVersion - ); - - if (0 !== schemaExists.length) { - this.logger.error(ResponseMessages.schema.error.exists); - throw new ConflictException(ResponseMessages.schema.error.exists); - } - - if (null !== schema || schema !== undefined) { - const schemaVersionIndexOf = -1; - if ( + ); + + if (0 !== schemaExists.length) { + this.logger.error(ResponseMessages.schema.error.exists); + throw new ConflictException(ResponseMessages.schema.error.exists); + } + + if (null !== schema || schema !== undefined) { + const schemaVersionIndexOf = -1; + if ( isNaN(parseFloat(schema.schemaVersion)) || schema.schemaVersion.toString().indexOf('.') === schemaVersionIndexOf @@ -61,22 +62,32 @@ export class SchemaService extends BaseService { if (schema.attributes.length === schemaAttributeLength) { throw new NotAcceptableException( ResponseMessages.schema.error.insufficientAttributes - ); - } else if (schema.attributes.length > schemaAttributeLength) { - - const trimmedAttributes = schema.attributes.map(attribute => ({ - attributeName: attribute.attributeName.trim(), - schemaDataType: attribute.schemaDataType, - displayName: attribute.displayName - })); - - const findDuplicates: boolean = - new Set(trimmedAttributes).size !== trimmedAttributes.length; - if (true === findDuplicates) { - throw new NotAcceptableException( - ResponseMessages.schema.error.invalidAttributes ); - } + } else if (schema.attributes.length > schemaAttributeLength) { + + const trimmedAttributes = schema.attributes.map(attribute => ({ + attributeName: attribute.attributeName.trim(), + schemaDataType: attribute.schemaDataType, + displayName: attribute.displayName.trim() + })); + + + const attributeNamesLowerCase = trimmedAttributes.map(attribute => attribute.attributeName.toLowerCase()); + const duplicateAttributeNames = attributeNamesLowerCase + .filter((value, index, element) => element.indexOf(value) !== index); + + if (0 < duplicateAttributeNames.length) { + throw new ConflictException(ResponseMessages.schema.error.uniqueAttributesnames); + } + + const attributeDisplayNamesLowerCase = trimmedAttributes.map(attribute => attribute.displayName.toLocaleLowerCase()); + const duplicateAttributeDisplayNames = attributeDisplayNamesLowerCase + .filter((value, index, element) => element.indexOf(value) !== index); + + if (0 < duplicateAttributeDisplayNames.length) { + throw new ConflictException(ResponseMessages.schema.error.uniqueAttributesDisplaynames); + } + schema.schemaName = schema.schemaName.trim(); const { agentEndPoint, orgDid } = await this.schemaRepository.getAgentDetailsByOrgId(orgId); const getAgentDetails = await this.schemaRepository.getAgentType(orgId); @@ -134,7 +145,7 @@ export class SchemaService extends BaseService { if ('finished' === responseObj.schema.state) { schemaDetails.schema.schemaName = responseObj.schema.schema.name; - schemaDetails.schema.attributes = schema.attributes; + schemaDetails.schema.attributes = trimmedAttributes; schemaDetails.schema.schemaVersion = responseObj.schema.schema.version; schemaDetails.createdBy = userId; schemaDetails.schema.id = responseObj.schema.schemaId; @@ -151,7 +162,7 @@ export class SchemaService extends BaseService { } else if ('finished' === responseObj.state) { schemaDetails.schema.schemaName = responseObj.schema.name; - schemaDetails.schema.attributes = schema.attributes; + schemaDetails.schema.attributes = trimmedAttributes; schemaDetails.schema.schemaVersion = responseObj.schema.version; schemaDetails.createdBy = userId; schemaDetails.schema.id = responseObj.schemaId; diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 0a4e655fd..3c93cc89c 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -107,7 +107,8 @@ export const ResponseMessages = { versionNotEmpty: 'Schema version is required', invalidVersion: 'Invalid schema version provided.', insufficientAttributes: 'Please provide at least one attribute.', - invalidAttributes: 'Please provide unique attributes', + uniqueAttributesnames: 'Please provide unique attribute names', + uniqueAttributesDisplaynames: 'Please provide unique display names for attributes', emptyData: 'Please provide data for creating schema.', exists: 'Schema already exists', notCreated: 'Schema not created', From 1bce65edafe707c16a9bbd82502cd14030bacc02 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Thu, 14 Dec 2023 12:14:00 +0530 Subject: [PATCH 38/51] refactor:api response Signed-off-by: pranalidhanavade --- libs/user-activity/interface/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/user-activity/interface/index.ts b/libs/user-activity/interface/index.ts index 764ee9a2d..faa3905a2 100644 --- a/libs/user-activity/interface/index.ts +++ b/libs/user-activity/interface/index.ts @@ -1,4 +1,4 @@ -export interface user_Activity { +export interface User_Activity { id: string, orgId: string, userId: string, From f341285563905370e9bd5285806313597c151d11 Mon Sep 17 00:00:00 2001 From: Nishad Date: Thu, 14 Dec 2023 12:17:05 +0530 Subject: [PATCH 39/51] worked on the ecosystem invitation reject Signed-off-by: Nishad --- apps/ecosystem/src/ecosystem.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index d48fe8b46..de134bf3c 100644 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -120,7 +120,7 @@ export class EcosystemService { if (tags) { updateData.tags = tags; } - if (logo) { updateData.logo = tags; } + if (logo) { updateData.logo = logo; } if ('' !== autoEndorsement.toString()) { updateData.autoEndorsement = autoEndorsement; } @@ -350,7 +350,7 @@ export class EcosystemService { } } - if (!isLedgerFound) { + if (!isLedgerFound && status !== Invitation.REJECTED) { throw new NotFoundException(ResponseMessages.ecosystem.error.ledgerNotMatch); } From f8e5ecd637c7dd36770b8971a2e19a3043c2e7e5 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Thu, 14 Dec 2023 12:18:06 +0530 Subject: [PATCH 40/51] refactor:api response Signed-off-by: pranalidhanavade --- libs/user-activity/repositories/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/user-activity/repositories/index.ts b/libs/user-activity/repositories/index.ts index 5330eabe6..ec6cca168 100644 --- a/libs/user-activity/repositories/index.ts +++ b/libs/user-activity/repositories/index.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ import { Injectable, Logger } from '@nestjs/common'; -import { user_Activity } from '../interface'; +import { User_Activity} from '../interface'; import { PrismaService } from '@credebl/prisma-service'; import { user_activity } from '@prisma/client'; @@ -23,7 +23,7 @@ export class UserActivityRepository { } - async getRecentActivities(userId: string, limit: number): Promise { + async getRecentActivities(userId: string, limit: number): Promise { return this.prisma.user_activity.findMany({ where: { userId From 60b9a23fd9f7668e9065af287a09468086591edc Mon Sep 17 00:00:00 2001 From: Nishad Date: Thu, 14 Dec 2023 15:22:32 +0530 Subject: [PATCH 41/51] worked on the ledger details match function Signed-off-by: Nishad --- apps/ecosystem/src/ecosystem.service.ts | 32 +++++++++++++++---------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index de134bf3c..15b81142a 100644 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -301,6 +301,24 @@ export class EcosystemService { } } + async checkLedgerMatches(orgDetails: OrganizationData, ecosystemId: string): Promise { + const orgLedgers = orgDetails.org_agents.map((agent) => agent.ledgers.id); + + const ecosystemDetails = await this.ecosystemRepository.getEcosystemDetails(ecosystemId); + + let isLedgerFound = false; + + for (const ledger of orgLedgers) { + // Check if the ledger is present in the ecosystem + if (Array.isArray(ecosystemDetails.ledgers) && ecosystemDetails.ledgers.includes(ledger)) { + // If a ledger is found, return true + isLedgerFound = true; + } + } + + return isLedgerFound; + } + /** * * @param acceptRejectEcosystemInvitation @@ -336,19 +354,7 @@ export class EcosystemService { throw new NotFoundException(ResponseMessages.ecosystem.error.orgDidNotExist); } - const orgLedgers = orgDetails.org_agents.map((agent) => agent.ledgers.id); - - const ecosystemDetails = await this.ecosystemRepository.getEcosystemDetails(invitation.ecosystemId); - - let isLedgerFound = false; - - for (const ledger of orgLedgers) { - // Check if the ledger is present in the ecosystem - if (Array.isArray(ecosystemDetails.ledgers) && ecosystemDetails.ledgers.includes(ledger)) { - // If a ledger is found, return true - isLedgerFound = true; - } - } + const isLedgerFound = await this.checkLedgerMatches(orgDetails, invitation.ecosystemId); if (!isLedgerFound && status !== Invitation.REJECTED) { throw new NotFoundException(ResponseMessages.ecosystem.error.ledgerNotMatch); From 425cd9aa35fa19cfff4b4f57f1637d26e70d222c Mon Sep 17 00:00:00 2001 From: Nishad Date: Thu, 14 Dec 2023 15:38:37 +0530 Subject: [PATCH 42/51] cosmetic changes Signed-off-by: Nishad --- apps/ecosystem/src/ecosystem.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 15b81142a..099a45aef 100644 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -356,7 +356,7 @@ export class EcosystemService { const isLedgerFound = await this.checkLedgerMatches(orgDetails, invitation.ecosystemId); - if (!isLedgerFound && status !== Invitation.REJECTED) { + if (!isLedgerFound && Invitation.REJECTED !== status) { throw new NotFoundException(ResponseMessages.ecosystem.error.ledgerNotMatch); } From 3568fd3881051dcd653af6cb8dc4c6dd79887ea0 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Thu, 14 Dec 2023 17:59:26 +0530 Subject: [PATCH 43/51] fix: resolved pagination values Signed-off-by: bhavanakarwade --- .../src/issuance/dtos/issuance.dto.ts | 2 +- apps/connection/src/connection.repository.ts | 50 ++++++++++--------- apps/connection/src/connection.service.ts | 3 ++ apps/issuance/src/issuance.repository.ts | 16 +++--- apps/issuance/src/issuance.service.ts | 5 +- .../repositories/verification.repository.ts | 19 ++++--- apps/verification/src/verification.service.ts | 3 ++ libs/common/src/response-messages/index.ts | 4 +- 8 files changed, 59 insertions(+), 43 deletions(-) diff --git a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts index 65afd95e7..16b3d7c56 100644 --- a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts @@ -136,7 +136,7 @@ export class CredentialAttributes { export class OutOfBandCredentialDto { - @ApiProperty({ example: [{ 'emailId': 'abc@example.com', 'attribute': [{ 'value': 'string', 'name': 'string' }] }] }) + @ApiProperty({ example: [{ 'emailId': 'abc@example.com', 'attributes': [{ 'value': 'string', 'name': 'string' }] }] }) @IsNotEmpty({ message: 'Please provide valid attributes' }) @IsArray({ message: 'attributes should be array'}) @ArrayMaxSize(Number(process.env.OOB_BATCH_SIZE), { message: `Limit reached (${process.env.OOB_BATCH_SIZE} credentials max). Easily handle larger batches via seamless CSV file uploads`}) diff --git a/apps/connection/src/connection.repository.ts b/apps/connection/src/connection.repository.ts index 74a715955..46b7e139e 100644 --- a/apps/connection/src/connection.repository.ts +++ b/apps/connection/src/connection.repository.ts @@ -107,7 +107,7 @@ export class ConnectionRepository { } const walletLabelName = connectionDto?.theirLabel; - let maskedTheirLabel: string; + let maskedTheirLabel: string; let firstLetters: string; let maskedMiddleLetters: string; let lastLetters: string; @@ -117,34 +117,34 @@ export class ConnectionRepository { firstLetters = walletLabelName.slice(0, 1); maskedMiddleLetters = walletLabelName.slice(1).replace(/./g, '*'); maskedTheirLabel = firstLetters + maskedMiddleLetters; - break; - + break; + case 3 < walletLabelName.length && 6 > walletLabelName.length: firstLetters = walletLabelName.slice(0, 1); lastLetters = walletLabelName.slice(-1); maskedMiddleLetters = walletLabelName.slice(1, -1).replace(/./g, '*'); maskedTheirLabel = firstLetters + lastLetters + maskedMiddleLetters; - break; - + break; + case 6 <= walletLabelName.length && 8 >= walletLabelName.length: firstLetters = walletLabelName.slice(0, 2); lastLetters = walletLabelName.slice(-2); maskedMiddleLetters = walletLabelName.slice(2, -2).replace(/./g, '*'); maskedTheirLabel = firstLetters + lastLetters + maskedMiddleLetters; - break; - + break; + case 8 < walletLabelName.length: firstLetters = walletLabelName.slice(0, 3); lastLetters = walletLabelName.slice(-3); maskedMiddleLetters = walletLabelName.slice(3, -3).replace(/./g, '*'); maskedTheirLabel = firstLetters + lastLetters + maskedMiddleLetters; - break; - - default: - maskedTheirLabel = walletLabelName; - break; - } - + break; + + default: + maskedTheirLabel = walletLabelName; + break; + } + const agentDetails = await this.prisma.connections.upsert({ where: { connectionId: connectionDto?.id @@ -171,7 +171,7 @@ export class ConnectionRepository { throw error; } } - + /** * Description: Save ShorteningUrl details * @param referenceId @@ -274,23 +274,25 @@ export class ConnectionRepository { connectionId: true }, orderBy: { - [connectionSearchCriteria.sorting]: - 'DESC' === connectionSearchCriteria.sortByValue + [connectionSearchCriteria?.sorting || 'createDateTime']: + 'DESC' === connectionSearchCriteria?.sortByValue ? 'desc' - : 'ASC' === connectionSearchCriteria.sortByValue + : 'ASC' === connectionSearchCriteria?.sortByValue ? 'asc' - : 'desc' + : 'asc' }, take: Number(connectionSearchCriteria.pageSize), skip: (connectionSearchCriteria.pageNumber - 1) * connectionSearchCriteria.pageSize }); const connectionCount = await this.prisma.connections.count({ - where: { - organisation: { - id: orgId + where: { + orgId, + OR: [ + { theirLabel: { contains: connectionSearchCriteria.searchByText, mode: 'insensitive' } }, + { connectionId: { contains: connectionSearchCriteria.searchByText, mode: 'insensitive' } } + ] } - } - }); + }); return { connectionCount, connectionsList }; } catch (error) { diff --git a/apps/connection/src/connection.service.ts b/apps/connection/src/connection.service.ts index 14d5a5f30..c613768e3 100644 --- a/apps/connection/src/connection.service.ts +++ b/apps/connection/src/connection.service.ts @@ -242,6 +242,9 @@ export class ConnectionService { throw new NotFoundException(ResponseMessages.connection.error.connectionNotFound); } } catch (error) { +; if (404 === error.status) { + throw new NotFoundException(error.response.message); + } throw new RpcException( `[getConnections] [NATS call]- error in fetch connections details : ${JSON.stringify(error)}` ); diff --git a/apps/issuance/src/issuance.repository.ts b/apps/issuance/src/issuance.repository.ts index 6e24ce1d6..a5af84065 100644 --- a/apps/issuance/src/issuance.repository.ts +++ b/apps/issuance/src/issuance.repository.ts @@ -100,21 +100,23 @@ export class IssuanceRepository { connectionId: true }, orderBy: { - [issuedCredentialsSearchCriteria.sorting]: - 'DESC' === issuedCredentialsSearchCriteria.sortByValue + [issuedCredentialsSearchCriteria?.sorting || 'createDateTime']: + 'DESC' === issuedCredentialsSearchCriteria?.sortByValue ? 'desc' - : 'ASC' === issuedCredentialsSearchCriteria.sortByValue + : 'ASC' === issuedCredentialsSearchCriteria?.sortByValue ? 'asc' - : 'desc' + : 'asc' }, take: Number(issuedCredentialsSearchCriteria.pageSize), skip: (issuedCredentialsSearchCriteria.pageNumber - 1) * issuedCredentialsSearchCriteria.pageSize }); const issuedCredentialsCount = await this.prisma.credentials.count({ where: { - organisation: { - id: orgId - } + orgId, + OR: [ + { schemaId: { contains: issuedCredentialsSearchCriteria.searchByText, mode: 'insensitive' } }, + { connectionId: { contains: issuedCredentialsSearchCriteria.searchByText, mode: 'insensitive' } } + ] } }); diff --git a/apps/issuance/src/issuance.service.ts b/apps/issuance/src/issuance.service.ts index e7cf33135..03d462b0c 100644 --- a/apps/issuance/src/issuance.service.ts +++ b/apps/issuance/src/issuance.service.ts @@ -230,9 +230,12 @@ export class IssuanceService { if (0 !== getIssuedCredentialsList.issuedCredentialsCount) { return issuedCredentialsResponse; } else { - throw new NotFoundException(ResponseMessages.connection.error.connectionNotFound); + throw new NotFoundException(ResponseMessages.issuance.error.credentialsNotFound); } } catch (error) { + if (404 === error.status) { + throw new NotFoundException(error.response.message); + } throw new RpcException( `[getConnections] [NATS call]- error in fetch connections details : ${JSON.stringify(error)}` ); diff --git a/apps/verification/src/repositories/verification.repository.ts b/apps/verification/src/repositories/verification.repository.ts index be8fee631..cb32494ba 100644 --- a/apps/verification/src/repositories/verification.repository.ts +++ b/apps/verification/src/repositories/verification.repository.ts @@ -81,24 +81,27 @@ export class VerificationRepository { createdBy: true, orgId: true, state: true, - connectionId: true + connectionId: true, + id: true }, orderBy: { - [proofRequestsSearchCriteria.sorting]: - 'DESC' === proofRequestsSearchCriteria.sortByValue + [proofRequestsSearchCriteria?.sorting || 'createDateTime']: + 'DESC' === proofRequestsSearchCriteria?.sortByValue ? 'desc' - : 'ASC' === proofRequestsSearchCriteria.sortByValue + : 'ASC' === proofRequestsSearchCriteria?.sortByValue ? 'asc' - : 'desc' + : 'asc' }, take: Number(proofRequestsSearchCriteria.pageSize), skip: (proofRequestsSearchCriteria.pageNumber - 1) * proofRequestsSearchCriteria.pageSize }); const proofRequestsCount = await this.prisma.presentations.count({ where: { - organisation: { - id: orgId - } + orgId, + OR: [ + { connectionId: { contains: proofRequestsSearchCriteria.searchByText, mode: 'insensitive' } }, + { state: { contains: proofRequestsSearchCriteria.searchByText, mode: 'insensitive' } } + ] } }); diff --git a/apps/verification/src/verification.service.ts b/apps/verification/src/verification.service.ts index 5348ef169..476f9a582 100644 --- a/apps/verification/src/verification.service.ts +++ b/apps/verification/src/verification.service.ts @@ -91,6 +91,9 @@ export class VerificationService { throw new NotFoundException(ResponseMessages.verification.error.proofPresentationNotFound); } } catch (error) { + if (404 === error.status) { + throw new NotFoundException(error.response.message); + } throw new RpcException( `[getConnections] [NATS call]- error in fetch proof requests details : ${JSON.stringify(error)}` ); diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 3c93cc89c..51b27e1f2 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -162,7 +162,7 @@ export const ResponseMessages = { }, error: { exists: 'Connection is already exist', - connectionNotFound: 'ConnectionNotFound not found', + connectionNotFound: 'Connection not found', agentEndPointNotFound: 'agentEndPoint Not Found', agentUrlNotFound: 'agent url not found' } @@ -211,7 +211,7 @@ export const ResponseMessages = { agentUrlNotFound: 'agent url not found', schemaIdNotFound: 'Schema Id is required', predicatesValueNotNumber: 'The attribuite value is not a number', - proofPresentationNotFound: 'Proof presentation not found', + proofPresentationNotFound: 'Proof presentations not found', invitationNotFound: 'Invitation not found', platformConfigNotFound: 'Platform config not found', emailSend: 'Unable to send email to the user' From 8e2a68b08cd6c10c37ecb4cfcd9c7152b89e5bd6 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Thu, 14 Dec 2023 18:05:00 +0530 Subject: [PATCH 44/51] fix: aaded request id Signed-off-by: bhavanakarwade --- apps/verification/src/repositories/verification.repository.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/verification/src/repositories/verification.repository.ts b/apps/verification/src/repositories/verification.repository.ts index be8fee631..27bc6bd7c 100644 --- a/apps/verification/src/repositories/verification.repository.ts +++ b/apps/verification/src/repositories/verification.repository.ts @@ -81,7 +81,8 @@ export class VerificationRepository { createdBy: true, orgId: true, state: true, - connectionId: true + connectionId: true, + id: true }, orderBy: { [proofRequestsSearchCriteria.sorting]: From e96f776921b98c070f3a7d873d6b49146303550c Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Thu, 14 Dec 2023 18:06:41 +0530 Subject: [PATCH 45/51] refactor:api response Signed-off-by: pranalidhanavade --- .../user/dto/accept-reject-invitation.dto.ts | 4 +-- apps/user/interfaces/user.interface.ts | 26 +++++++++++++++++++ apps/user/src/user.service.ts | 6 +++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/apps/api-gateway/src/user/dto/accept-reject-invitation.dto.ts b/apps/api-gateway/src/user/dto/accept-reject-invitation.dto.ts index ca3432402..ab04eb078 100644 --- a/apps/api-gateway/src/user/dto/accept-reject-invitation.dto.ts +++ b/apps/api-gateway/src/user/dto/accept-reject-invitation.dto.ts @@ -1,4 +1,4 @@ -import { IsEnum, IsNotEmpty } from 'class-validator'; +import { IsEnum, IsNotEmpty, IsString } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { Invitation } from '@credebl/enum/enum'; @@ -10,7 +10,7 @@ export class AcceptRejectInvitationDto { @ApiProperty({ example: 1 }) @IsNotEmpty({ message: 'Please provide valid orgId' }) - + @IsString() orgId: string; @ApiProperty({ diff --git a/apps/user/interfaces/user.interface.ts b/apps/user/interfaces/user.interface.ts index cbbf20c75..39f70c7bf 100644 --- a/apps/user/interfaces/user.interface.ts +++ b/apps/user/interfaces/user.interface.ts @@ -1,3 +1,22 @@ +export interface UInvitation { + orgRoles?: OrgRole[]; + status?: string; + id?: string; + orgId?: string; + organisation?: Organisation; + userId?: string; +} +export interface Organisation { + id: string; + name: string; + logoUrl: string; +} +export interface OrgRole { + id: string; + name: string; + description: string; +} + export interface UserI { id?: string; username?: string; @@ -69,4 +88,11 @@ export interface UserI { export interface Attribute { [key: string]: string; label: string; + } + + export interface CheckUserDetails { + isEmailVerified?: boolean; + isFidoVerified?: boolean; + isSupabase?: boolean; + isExist?: boolean; } \ No newline at end of file diff --git a/apps/user/src/user.service.ts b/apps/user/src/user.service.ts index 3d8127395..a245b1990 100644 --- a/apps/user/src/user.service.ts +++ b/apps/user/src/user.service.ts @@ -29,9 +29,11 @@ import { user } from '@prisma/client'; import { AddPasskeyDetails, Attribute, + CheckUserDetails, InvitationsI, PlatformSettingsI, ShareUserCertificateI, + UInvitation, UpdateUserProfile, UserEmailVerificationDto, UserI, @@ -447,7 +449,7 @@ export class UserService { } } - async invitations(payload: { id; status; pageNumber; pageSize; search }): Promise { + async invitations(payload: { id; status; pageNumber; pageSize; search }): Promise { try { const userData = await this.userRepository.getUserById(payload.id); @@ -722,7 +724,7 @@ export class UserService { } } - async checkUserExist(email: string): Promise { + async checkUserExist(email: string): Promise { try { const userDetails = await this.userRepository.checkUniqueUserExist(email); if (userDetails && !userDetails.isEmailVerified) { From 0610866d72ae24c479c19fb6f7104d7e3362903e Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Thu, 14 Dec 2023 18:06:55 +0530 Subject: [PATCH 46/51] added missing parameter Signed-off-by: bhavanakarwade --- apps/ecosystem/interfaces/ecosystem.interfaces.ts | 1 + apps/ecosystem/src/ecosystem.service.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/ecosystem/interfaces/ecosystem.interfaces.ts b/apps/ecosystem/interfaces/ecosystem.interfaces.ts index 2ba6d3aeb..438091d0f 100644 --- a/apps/ecosystem/interfaces/ecosystem.interfaces.ts +++ b/apps/ecosystem/interfaces/ecosystem.interfaces.ts @@ -181,6 +181,7 @@ export interface CreateEcosystem { name?: string; description?: string; tags?: string; + logoUrl?:string; userId?: string; logo?: string; orgName?: string; diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 099a45aef..435fcbef8 100644 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -120,7 +120,7 @@ export class EcosystemService { if (tags) { updateData.tags = tags; } - if (logo) { updateData.logo = logo; } + if (logo) { updateData.logoUrl = logo; } if ('' !== autoEndorsement.toString()) { updateData.autoEndorsement = autoEndorsement; } From 94a65ef44492eb63af7bdc8e7af4e1363c14949a Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Thu, 14 Dec 2023 20:19:24 +0530 Subject: [PATCH 47/51] refactor:api response refactoring Signed-off-by: pranalidhanavade --- apps/user/interfaces/user.interface.ts | 9 +++++++++ apps/user/repositories/user.repository.ts | 3 ++- apps/user/src/user.controller.ts | 8 ++++---- apps/user/src/user.service.ts | 3 ++- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/apps/user/interfaces/user.interface.ts b/apps/user/interfaces/user.interface.ts index 39f70c7bf..f14f153ae 100644 --- a/apps/user/interfaces/user.interface.ts +++ b/apps/user/interfaces/user.interface.ts @@ -95,4 +95,13 @@ export interface UserI { isFidoVerified?: boolean; isSupabase?: boolean; isExist?: boolean; + } + + export interface UserCredentials { + id: string; + imageUrl?: string; + credentialId?: string; + createDateTime: Date; + lastChangedDateTime: Date; + deletedAt: Date; } \ No newline at end of file diff --git a/apps/user/repositories/user.repository.ts b/apps/user/repositories/user.repository.ts index 821f2b70f..020e5d54a 100644 --- a/apps/user/repositories/user.repository.ts +++ b/apps/user/repositories/user.repository.ts @@ -5,6 +5,7 @@ import { PlatformSettingsI, ShareUserCertificateI, UpdateUserProfile, + UserCredentials, UserEmailVerificationDto, UserI, userInfo @@ -108,7 +109,7 @@ export class UserRepository { * @param id * @returns User profile data */ - async getUserCredentialsById(credentialId: string): Promise { + async getUserCredentialsById(credentialId: string): Promise { return this.prisma.user_credentials.findUnique({ where: { credentialId diff --git a/apps/user/src/user.controller.ts b/apps/user/src/user.controller.ts index e0e89bae7..4f6e6010f 100644 --- a/apps/user/src/user.controller.ts +++ b/apps/user/src/user.controller.ts @@ -1,4 +1,4 @@ -import { AddPasskeyDetails, PlatformSettingsI, ShareUserCertificateI, UpdateUserProfile, UserEmailVerificationDto, UserI, userInfo } from '../interfaces/user.interface'; +import { AddPasskeyDetails, CheckUserDetails, PlatformSettingsI, ShareUserCertificateI, UInvitation, UpdateUserProfile, UserCredentials, UserEmailVerificationDto, UserI, userInfo } from '../interfaces/user.interface'; import { AcceptRejectInvitationDto } from '../dtos/accept-reject-invitation.dto'; import { Controller } from '@nestjs/common'; @@ -63,12 +63,12 @@ export class UserController { @MessagePattern({ cmd: 'get-user-credentials-by-id' }) - async getUserCredentialsById(payload: { credentialId }): Promise { + async getUserCredentialsById(payload: { credentialId }): Promise { return this.userService.getUserCredentialsById(payload); } @MessagePattern({ cmd: 'get-org-invitations' }) - async invitations(payload: { id; status; pageNumber; pageSize; search; }): Promise { + async invitations(payload: { id; status; pageNumber; pageSize; search; }): Promise { return this.userService.invitations(payload); } @@ -119,7 +119,7 @@ export class UserController { } @MessagePattern({ cmd: 'check-user-exist' }) - async checkUserExist(payload: { userEmail: string }): Promise { + async checkUserExist(payload: { userEmail: string }): Promise { return this.userService.checkUserExist(payload.userEmail); } @MessagePattern({ cmd: 'add-user' }) diff --git a/apps/user/src/user.service.ts b/apps/user/src/user.service.ts index a245b1990..d490ee177 100644 --- a/apps/user/src/user.service.ts +++ b/apps/user/src/user.service.ts @@ -35,6 +35,7 @@ import { ShareUserCertificateI, UInvitation, UpdateUserProfile, + UserCredentials, UserEmailVerificationDto, UserI, userInfo @@ -400,7 +401,7 @@ export class UserService { } } - async getUserCredentialsById(payload: { credentialId }): Promise { + async getUserCredentialsById(payload: { credentialId }): Promise { try { const userCredentials = await this.userRepository.getUserCredentialsById(payload.credentialId); if (!userCredentials) { From 875b3d97c00c42fb80365c320d6d183ad19e797e Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Fri, 15 Dec 2023 13:48:51 +0530 Subject: [PATCH 48/51] refactor: refactor pagination and sorting feature Signed-off-by: bhavanakarwade --- .../api-gateway/src/verification/dto/webhook-proof.dto.ts | 4 ++++ .../src/verification/verification.controller.ts | 2 +- apps/connection/src/connection.repository.ts | 8 +++----- apps/issuance/src/issuance.repository.ts | 3 +-- .../verification/src/interfaces/verification.interface.ts | 1 + .../src/repositories/verification.repository.ts | 6 +++--- libs/common/src/response-messages/index.ts | 4 ++-- .../20231214142349_presentation_id_map/migration.sql | 2 ++ libs/prisma-service/prisma/schema.prisma | 1 + 9 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 libs/prisma-service/prisma/migrations/20231214142349_presentation_id_map/migration.sql diff --git a/apps/api-gateway/src/verification/dto/webhook-proof.dto.ts b/apps/api-gateway/src/verification/dto/webhook-proof.dto.ts index b40ad5964..7a871e5eb 100644 --- a/apps/api-gateway/src/verification/dto/webhook-proof.dto.ts +++ b/apps/api-gateway/src/verification/dto/webhook-proof.dto.ts @@ -41,6 +41,10 @@ export class WebhookPresentationProof { @IsOptional() threadId: string; + @ApiProperty() + @IsOptional() + presentationId: string; + @ApiProperty() @IsOptional() autoAcceptProof: string; diff --git a/apps/api-gateway/src/verification/verification.controller.ts b/apps/api-gateway/src/verification/verification.controller.ts index a1ed8a64f..72b5589b7 100644 --- a/apps/api-gateway/src/verification/verification.controller.ts +++ b/apps/api-gateway/src/verification/verification.controller.ts @@ -75,7 +75,7 @@ export class VerificationController { @Param('proofId') id: string, @Param('orgId') orgId: string ): Promise { - const sendProofRequest = await this.verificationService.getProofFormData(id, orgId, user); + const sendProofRequest = await this.verificationService.getProofFormData(id, orgId, user); const finalResponse: IResponseType = { statusCode: HttpStatus.OK, message: ResponseMessages.verification.success.proofFormData, diff --git a/apps/connection/src/connection.repository.ts b/apps/connection/src/connection.repository.ts index 46b7e139e..2465982c6 100644 --- a/apps/connection/src/connection.repository.ts +++ b/apps/connection/src/connection.repository.ts @@ -123,21 +123,21 @@ export class ConnectionRepository { firstLetters = walletLabelName.slice(0, 1); lastLetters = walletLabelName.slice(-1); maskedMiddleLetters = walletLabelName.slice(1, -1).replace(/./g, '*'); - maskedTheirLabel = firstLetters + lastLetters + maskedMiddleLetters; + maskedTheirLabel = firstLetters + maskedMiddleLetters + lastLetters; break; case 6 <= walletLabelName.length && 8 >= walletLabelName.length: firstLetters = walletLabelName.slice(0, 2); lastLetters = walletLabelName.slice(-2); maskedMiddleLetters = walletLabelName.slice(2, -2).replace(/./g, '*'); - maskedTheirLabel = firstLetters + lastLetters + maskedMiddleLetters; + maskedTheirLabel = firstLetters + maskedMiddleLetters + lastLetters; break; case 8 < walletLabelName.length: firstLetters = walletLabelName.slice(0, 3); lastLetters = walletLabelName.slice(-3); maskedMiddleLetters = walletLabelName.slice(3, -3).replace(/./g, '*'); - maskedTheirLabel = firstLetters + lastLetters + maskedMiddleLetters; + maskedTheirLabel = firstLetters + maskedMiddleLetters + lastLetters; break; default: @@ -277,8 +277,6 @@ export class ConnectionRepository { [connectionSearchCriteria?.sorting || 'createDateTime']: 'DESC' === connectionSearchCriteria?.sortByValue ? 'desc' - : 'ASC' === connectionSearchCriteria?.sortByValue - ? 'asc' : 'asc' }, take: Number(connectionSearchCriteria.pageSize), diff --git a/apps/issuance/src/issuance.repository.ts b/apps/issuance/src/issuance.repository.ts index a5af84065..0c4870222 100644 --- a/apps/issuance/src/issuance.repository.ts +++ b/apps/issuance/src/issuance.repository.ts @@ -103,13 +103,12 @@ export class IssuanceRepository { [issuedCredentialsSearchCriteria?.sorting || 'createDateTime']: 'DESC' === issuedCredentialsSearchCriteria?.sortByValue ? 'desc' - : 'ASC' === issuedCredentialsSearchCriteria?.sortByValue - ? 'asc' : 'asc' }, take: Number(issuedCredentialsSearchCriteria.pageSize), skip: (issuedCredentialsSearchCriteria.pageNumber - 1) * issuedCredentialsSearchCriteria.pageSize }); + const issuedCredentialsCount = await this.prisma.credentials.count({ where: { orgId, diff --git a/apps/verification/src/interfaces/verification.interface.ts b/apps/verification/src/interfaces/verification.interface.ts index 38648d477..44a3bfc57 100644 --- a/apps/verification/src/interfaces/verification.interface.ts +++ b/apps/verification/src/interfaces/verification.interface.ts @@ -111,6 +111,7 @@ export interface IWebhookProofPresentation { protocolVersion: string; state: string; connectionId: string; + presentationId: string; threadId: string; autoAcceptProof: string; updatedAt: string; diff --git a/apps/verification/src/repositories/verification.repository.ts b/apps/verification/src/repositories/verification.repository.ts index cb32494ba..5ed4bbd30 100644 --- a/apps/verification/src/repositories/verification.repository.ts +++ b/apps/verification/src/repositories/verification.repository.ts @@ -82,14 +82,13 @@ export class VerificationRepository { orgId: true, state: true, connectionId: true, - id: true + id: true, + presentationId: true }, orderBy: { [proofRequestsSearchCriteria?.sorting || 'createDateTime']: 'DESC' === proofRequestsSearchCriteria?.sortByValue ? 'desc' - : 'ASC' === proofRequestsSearchCriteria?.sortByValue - ? 'asc' : 'asc' }, take: Number(proofRequestsSearchCriteria.pageSize), @@ -141,6 +140,7 @@ export class VerificationRepository { state: proofPresentationPayload.state, threadId: proofPresentationPayload.threadId, isVerified: proofPresentationPayload.isVerified, + presentationId: proofPresentationPayload.id, orgId: organisationId } }); diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 51b27e1f2..c45eb1181 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -170,7 +170,7 @@ export const ResponseMessages = { issuance: { success: { create: 'Credentials offer created successfully', - fetch: 'Credentials offer send successfully', + fetch: 'Issued Credential details fetched successfully', importCSV: 'File imported sucessfully', previewCSV: 'File details fetched sucessfully', bulkIssuance: 'Issuance process started. It will take some time', @@ -201,7 +201,7 @@ export const ResponseMessages = { }, verification: { success: { - fetch: 'Proof presentation received successfully.', + fetch: 'Proof presentations details fetched successfully.', proofFormData: 'Proof presentation form data received successfully.', send: 'Proof request send successfully.', verified: 'Proof presentation verified successfully.' diff --git a/libs/prisma-service/prisma/migrations/20231214142349_presentation_id_map/migration.sql b/libs/prisma-service/prisma/migrations/20231214142349_presentation_id_map/migration.sql new file mode 100644 index 000000000..73ec46d26 --- /dev/null +++ b/libs/prisma-service/prisma/migrations/20231214142349_presentation_id_map/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "presentations" ADD COLUMN "presentationId" TEXT; diff --git a/libs/prisma-service/prisma/schema.prisma b/libs/prisma-service/prisma/schema.prisma index efac0434d..d8885aa6e 100644 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -315,6 +315,7 @@ model presentations { state String? threadId String @unique isVerified Boolean? + presentationId String? orgId String? @db.Uuid organisation organisation? @relation(fields: [orgId], references: [id]) } From c617c907d5ef2d1c170ec9e73ca6f1f33c3e51a6 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Fri, 15 Dec 2023 15:04:11 +0530 Subject: [PATCH 49/51] refactor:api response refactoring of user module Signed-off-by: pranalidhanavade --- apps/user/interfaces/user.interface.ts | 42 +++++++++++------------ apps/user/repositories/user.repository.ts | 20 +++++------ apps/user/src/user.controller.ts | 12 +++---- apps/user/src/user.service.ts | 31 +++++++++-------- libs/user-activity/interface/index.ts | 2 +- libs/user-activity/repositories/index.ts | 4 +-- 6 files changed, 55 insertions(+), 56 deletions(-) diff --git a/apps/user/interfaces/user.interface.ts b/apps/user/interfaces/user.interface.ts index f14f153ae..a7b6af44c 100644 --- a/apps/user/interfaces/user.interface.ts +++ b/apps/user/interfaces/user.interface.ts @@ -1,15 +1,14 @@ -export interface UInvitation { - orgRoles?: OrgRole[]; - status?: string; - id?: string; - orgId?: string; - organisation?: Organisation; - userId?: string; +export interface UserInvitations { + totalPages:number; + userInvitationsData:UserInvitationsData[]; } -export interface Organisation { +export interface UserInvitationsData { + orgRoles: OrgRole[]; + status: string; id: string; - name: string; - logoUrl: string; + orgId: string; + organisation: Organisation; + userId: string; } export interface OrgRole { id: string; @@ -17,7 +16,13 @@ export interface OrgRole { description: string; } -export interface UserI { +export interface Organisation { + id: string; + name: string; + logoUrl: string; +} + +export interface UsersProfile { id?: string; username?: string; email?: string; @@ -27,7 +32,7 @@ export interface UserI { userOrgRoles?: object; } - export interface InvitationsI { + export interface OrgInvitations { id: string; userId: string; orgId?: string; @@ -54,14 +59,7 @@ export interface UserI { export interface AddPasskeyDetails { password: string; } - - export interface UserWhereUniqueInput { - id?: string; - } - - export interface UserWhereInput { - email?: string; - } + export interface UpdateUserProfile { id: string; profileImg?: string; @@ -69,7 +67,7 @@ export interface UserI { lastName: string; isPublic: boolean; } - export interface PlatformSettingsI { + export interface PlatformSettings { externalIp: string; lastInternalId: string; sgApiKey: string; @@ -79,7 +77,7 @@ export interface UserI { multiEcosystemSupport: boolean; } - export interface ShareUserCertificateI { + export interface ShareUserCertificate { schemaId: string; credentialId: string; attributes: Attribute[]; diff --git a/apps/user/repositories/user.repository.ts b/apps/user/repositories/user.repository.ts index 020e5d54a..6964109ba 100644 --- a/apps/user/repositories/user.repository.ts +++ b/apps/user/repositories/user.repository.ts @@ -2,12 +2,12 @@ import { Injectable, Logger, NotFoundException } from '@nestjs/common'; import { - PlatformSettingsI, - ShareUserCertificateI, + PlatformSettings, + ShareUserCertificate, UpdateUserProfile, UserCredentials, UserEmailVerificationDto, - UserI, + UsersProfile, userInfo } from '../interfaces/user.interface'; @@ -26,7 +26,7 @@ interface UserQueryOptions { @Injectable() export class UserRepository { constructor( - private readonly prisma: PrismaService, + private readonly prisma: PrismaService, private readonly logger: Logger ) {} @@ -96,7 +96,7 @@ export class UserRepository { * @param id * @returns User profile data */ - async getUserById(id: string): Promise { + async getUserById(id: string): Promise { const queryOptions: UserQueryOptions = { id }; @@ -122,7 +122,7 @@ export class UserRepository { * @param id * @returns User profile data */ - async getUserPublicProfile(username: string): Promise { + async getUserPublicProfile(username: string): Promise { const queryOptions: UserQueryOptions = { username }; @@ -202,7 +202,7 @@ export class UserRepository { return this.findUser(queryOptions); } - async findUser(queryOptions: UserQueryOptions): Promise { + async findUser(queryOptions: UserQueryOptions): Promise { return this.prisma.user.findFirst({ where: { OR: [ @@ -253,7 +253,7 @@ export class UserRepository { }); } - async findUserForPublicProfile(queryOptions: UserQueryOptions): Promise { + async findUserForPublicProfile(queryOptions: UserQueryOptions): Promise { return this.prisma.user.findFirst({ where: { publicProfile: true, @@ -460,7 +460,7 @@ isEmailVerified: true, return { totalPages, users }; } - async getAttributesBySchemaId(shareUserCertificate: ShareUserCertificateI): Promise { + async getAttributesBySchemaId(shareUserCertificate: ShareUserCertificate): Promise { try { const getAttributes = await this.prisma.schema.findFirst({ where: { @@ -546,7 +546,7 @@ isEmailVerified: true, * @Body updatePlatformSettings * @returns Update platform settings */ - async updatePlatformSettings(updatePlatformSettings: PlatformSettingsI): Promise { + async updatePlatformSettings(updatePlatformSettings: PlatformSettings): Promise { try { const getPlatformDetails = await this.prisma.platform_config.findFirst(); const platformDetails = await this.prisma.platform_config.update({ diff --git a/apps/user/src/user.controller.ts b/apps/user/src/user.controller.ts index 4f6e6010f..c038abaaa 100644 --- a/apps/user/src/user.controller.ts +++ b/apps/user/src/user.controller.ts @@ -1,4 +1,4 @@ -import { AddPasskeyDetails, CheckUserDetails, PlatformSettingsI, ShareUserCertificateI, UInvitation, UpdateUserProfile, UserCredentials, UserEmailVerificationDto, UserI, userInfo } from '../interfaces/user.interface'; +import { AddPasskeyDetails, CheckUserDetails, PlatformSettings, ShareUserCertificate, UserInvitations, UpdateUserProfile, UserCredentials, UserEmailVerificationDto, userInfo, UsersProfile } from '../interfaces/user.interface'; import { AcceptRejectInvitationDto } from '../dtos/accept-reject-invitation.dto'; import { Controller } from '@nestjs/common'; @@ -37,12 +37,12 @@ export class UserController { } @MessagePattern({ cmd: 'get-user-profile' }) - async getProfile(payload: { id }): Promise { + async getProfile(payload: { id }): Promise { return this.userService.getProfile(payload); } @MessagePattern({ cmd: 'get-user-public-profile' }) - async getPublicProfile(payload: { username }): Promise { + async getPublicProfile(payload: { username }): Promise { return this.userService.getPublicProfile(payload); } @MessagePattern({ cmd: 'update-user-profile' }) @@ -68,7 +68,7 @@ export class UserController { } @MessagePattern({ cmd: 'get-org-invitations' }) - async invitations(payload: { id; status; pageNumber; pageSize; search; }): Promise { + async invitations(payload: { id; status; pageNumber; pageSize; search; }): Promise { return this.userService.invitations(payload); } @@ -92,7 +92,7 @@ export class UserController { */ @MessagePattern({ cmd: 'share-user-certificate' }) async shareUserCertificate(payload: { - shareUserCredentials: ShareUserCertificateI; + shareUserCredentials: ShareUserCertificate; }): Promise { return this.userService.shareUserCertificate(payload.shareUserCredentials); } @@ -139,7 +139,7 @@ export class UserController { } @MessagePattern({ cmd: 'update-platform-settings' }) - async updatePlatformSettings(payload: { platformSettings: PlatformSettingsI }): Promise { + async updatePlatformSettings(payload: { platformSettings: PlatformSettings }): Promise { return this.userService.updatePlatformSettings(payload.platformSettings); } diff --git a/apps/user/src/user.service.ts b/apps/user/src/user.service.ts index d490ee177..1ffd35ce0 100644 --- a/apps/user/src/user.service.ts +++ b/apps/user/src/user.service.ts @@ -30,15 +30,15 @@ import { AddPasskeyDetails, Attribute, CheckUserDetails, - InvitationsI, - PlatformSettingsI, - ShareUserCertificateI, - UInvitation, + OrgInvitations, + PlatformSettings, + ShareUserCertificate, + UserInvitations, UpdateUserProfile, UserCredentials, UserEmailVerificationDto, - UserI, - userInfo + userInfo, + UsersProfile } from '../interfaces/user.interface'; import { AcceptRejectInvitationDto } from '../dtos/accept-reject-invitation.dto'; import { UserActivityService } from '@credebl/user-activity'; @@ -366,7 +366,7 @@ export class UserService { } } - async getProfile(payload: { id }): Promise { + async getProfile(payload: { id }): Promise { try { const userData = await this.userRepository.getUserById(payload.id); const ecosystemSettingsList = await this.prisma.ecosystem_config.findMany({ @@ -386,7 +386,7 @@ export class UserService { } } - async getPublicProfile(payload: { username }): Promise { + async getPublicProfile(payload: { username }): Promise { try { const userProfile = await this.userRepository.getUserPublicProfile(payload.username); @@ -450,10 +450,9 @@ export class UserService { } } - async invitations(payload: { id; status; pageNumber; pageSize; search }): Promise { + async invitations(payload: { id; status; pageNumber; pageSize; search }): Promise { try { const userData = await this.userRepository.getUserById(payload.id); - if (!userData) { throw new NotFoundException(ResponseMessages.user.error.notFound); } @@ -466,8 +465,10 @@ export class UserService { payload.search ); - const invitations: InvitationsI[] = await this.updateOrgInvitations(invitationsData['invitations']); + const invitations: OrgInvitations[] = await this.updateOrgInvitations(invitationsData['invitations']); invitationsData['invitations'] = invitations; + // console.log("{-----------------}",invitationsData); + return invitationsData; } catch (error) { this.logger.error(`Error in get invitations: ${JSON.stringify(error)}`); @@ -481,7 +482,7 @@ export class UserService { pageNumber: number, pageSize: number, search = '' - ): Promise { + ): Promise { const pattern = { cmd: 'fetch-user-invitations' }; const payload = { email, @@ -508,7 +509,7 @@ export class UserService { return invitationsData; } - async updateOrgInvitations(invitations: InvitationsI[]): Promise { + async updateOrgInvitations(invitations: OrgInvitations[]): Promise { const updatedInvitations = []; for (const invitation of invitations) { @@ -549,7 +550,7 @@ export class UserService { * * @returns */ - async shareUserCertificate(shareUserCertificate: ShareUserCertificateI): Promise { + async shareUserCertificate(shareUserCertificate: ShareUserCertificate): Promise { const attributeArray = []; let attributeJson = {}; @@ -762,7 +763,7 @@ export class UserService { } // eslint-disable-next-line camelcase - async updatePlatformSettings(platformSettings: PlatformSettingsI): Promise { + async updatePlatformSettings(platformSettings: PlatformSettings): Promise { try { const platformConfigSettings = await this.userRepository.updatePlatformSettings(platformSettings); diff --git a/libs/user-activity/interface/index.ts b/libs/user-activity/interface/index.ts index faa3905a2..d6bc0c120 100644 --- a/libs/user-activity/interface/index.ts +++ b/libs/user-activity/interface/index.ts @@ -1,4 +1,4 @@ -export interface User_Activity { +export interface UsersActivity { id: string, orgId: string, userId: string, diff --git a/libs/user-activity/repositories/index.ts b/libs/user-activity/repositories/index.ts index ec6cca168..3618f188c 100644 --- a/libs/user-activity/repositories/index.ts +++ b/libs/user-activity/repositories/index.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ import { Injectable, Logger } from '@nestjs/common'; -import { User_Activity} from '../interface'; +import { UsersActivity} from '../interface'; import { PrismaService } from '@credebl/prisma-service'; import { user_activity } from '@prisma/client'; @@ -23,7 +23,7 @@ export class UserActivityRepository { } - async getRecentActivities(userId: string, limit: number): Promise { + async getRecentActivities(userId: string, limit: number): Promise { return this.prisma.user_activity.findMany({ where: { userId From 0fafcac53320e16bf4fa8d8036042e7ffee314ac Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Fri, 15 Dec 2023 16:57:17 +0530 Subject: [PATCH 50/51] refactor:api refactoring of user module Signed-off-by: pranalidhanavade --- apps/user/src/user.controller.ts | 8 +++++--- apps/user/src/user.service.ts | 5 +++-- libs/user-activity/src/user-activity.service.ts | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/user/src/user.controller.ts b/apps/user/src/user.controller.ts index c038abaaa..fedfd998e 100644 --- a/apps/user/src/user.controller.ts +++ b/apps/user/src/user.controller.ts @@ -6,6 +6,8 @@ import { LoginUserDto } from '../dtos/login-user.dto'; import { MessagePattern } from '@nestjs/microservices'; import { UserService } from './user.service'; import { VerifyEmailTokenDto } from '../dtos/verify-email.dto'; +import { user } from '@prisma/client'; +import { UsersActivity } from 'libs/user-activity/interface'; @Controller() export class UserController { @@ -46,7 +48,7 @@ export class UserController { return this.userService.getPublicProfile(payload); } @MessagePattern({ cmd: 'update-user-profile' }) - async updateUserProfile(payload: { updateUserProfileDto: UpdateUserProfile }): Promise { + async updateUserProfile(payload: { updateUserProfileDto: UpdateUserProfile }): Promise { return this.userService.updateUserProfile(payload.updateUserProfileDto); } @@ -93,7 +95,7 @@ export class UserController { @MessagePattern({ cmd: 'share-user-certificate' }) async shareUserCertificate(payload: { shareUserCredentials: ShareUserCertificate; - }): Promise { + }): Promise { return this.userService.shareUserCertificate(payload.shareUserCredentials); } @@ -129,7 +131,7 @@ export class UserController { // Fetch Users recent activities @MessagePattern({ cmd: 'get-user-activity' }) - async getUserActivity(payload: { userId: string, limit: number }): Promise { + async getUserActivity(payload: { userId: string, limit: number }): Promise { return this.userService.getUserActivity(payload.userId, payload.limit); } diff --git a/apps/user/src/user.service.ts b/apps/user/src/user.service.ts index 1ffd35ce0..14f3c5358 100644 --- a/apps/user/src/user.service.ts +++ b/apps/user/src/user.service.ts @@ -54,6 +54,7 @@ import { DISALLOWED_EMAIL_DOMAIN } from '@credebl/common/common.constant'; import { AwsService } from '@credebl/aws'; import puppeteer from 'puppeteer'; import { WorldRecordTemplate } from '../templates/world-record-template'; +import { UsersActivity } from 'libs/user-activity/interface'; @Injectable() export class UserService { @@ -550,7 +551,7 @@ export class UserService { * * @returns */ - async shareUserCertificate(shareUserCertificate: ShareUserCertificate): Promise { + async shareUserCertificate(shareUserCertificate: ShareUserCertificate): Promise { const attributeArray = []; let attributeJson = {}; @@ -753,7 +754,7 @@ export class UserService { } - async getUserActivity(userId: string, limit: number): Promise { + async getUserActivity(userId: string, limit: number): Promise { try { return this.userActivityService.getUserActivity(userId, limit); } catch (error) { diff --git a/libs/user-activity/src/user-activity.service.ts b/libs/user-activity/src/user-activity.service.ts index 74f4f193d..a84554d0a 100644 --- a/libs/user-activity/src/user-activity.service.ts +++ b/libs/user-activity/src/user-activity.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import { UserActivityRepository } from '../repositories'; import { user_activity } from '@prisma/client'; +import { UsersActivity } from '../interface'; @Injectable() export class UserActivityService { @@ -15,7 +16,7 @@ export class UserActivityService { return this.userActivityRepository.logActivity(userId, orgId, action, details); } - async getUserActivity(userId: string, limit: number): Promise { + async getUserActivity(userId: string, limit: number): Promise { return this.userActivityRepository.getRecentActivities(userId, limit); } } From 5a46c85394ce44bc1accb1375aa89ba05e4ad8b5 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Wed, 20 Dec 2023 17:24:03 +0530 Subject: [PATCH 51/51] removed unnecessary qr-code function Signed-off-by: bhavanakarwade --- apps/api-gateway/src/issuance/issuance.controller.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/apps/api-gateway/src/issuance/issuance.controller.ts b/apps/api-gateway/src/issuance/issuance.controller.ts index 77e71d9dd..774915802 100644 --- a/apps/api-gateway/src/issuance/issuance.controller.ts +++ b/apps/api-gateway/src/issuance/issuance.controller.ts @@ -78,17 +78,6 @@ export class IssuanceController { private readonly logger = new Logger('IssuanceController'); private readonly PAGE: number = 1; - @Get('/issuance/oob/qr') - @ApiOperation({ summary: 'Out-Of-Band issuance QR', description: 'Out-Of-Band issuance QR' }) - @ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto }) - @ApiExcludeEndpoint() - @ApiQuery({ name: 'base64Image', required: true }) - async getQrCode(@Query('base64Image') base64Image: string, @Res() res: Response): Promise { - const getImageBuffer = await this.imageServiceService.getBase64Image(base64Image); - res.setHeader('Content-Type', 'image/png'); - return res.send(getImageBuffer); - } - /** * Description: Get all issued credentials * @param user