From 86c3536af10a57c3e95de38f80052f70eef156e6 Mon Sep 17 00:00:00 2001 From: Rachid Flih Date: Sat, 16 Nov 2024 16:30:23 -0300 Subject: [PATCH] Removed Cybersecurity APIs --- .../app/(Dashboard)/configuration/page.tsx | 2 +- .../Connector/ConnectorLayout.tsx | 2 +- .../Connector/VerticalSelector.tsx | 6 +- docker-compose.dev.yml | 4 - docker-compose.source.yml | 4 - docker-compose.yml | 4 - .../open-source/self_hosting/envVariables.mdx | 4 - .../@core/connections/connections.module.ts | 3 - .../cybersecurity.connection.module.ts | 38 --- .../crowdstrike/crowdstrike.service.ts | 195 -------------- .../cybersecurity.connection.service.ts | 129 ---------- .../microsoftdefender.service.ts | 199 --------------- .../services/qualys/qualys.service.ts | 156 ------------ .../rapid7insightvm/rapid7.service.ts | 145 ----------- .../services/registry.service.ts | 23 -- .../services/semgrep/semgrep.service.ts | 143 ----------- .../sentinelone/sentinelone.service.ts | 149 ----------- .../services/snyk/snyk.service.ts | 241 ------------------ .../services/tenable/tenable.service.ts | 147 ----------- .../api/src/@core/sync/sync.controller.ts | 4 - packages/api/src/@core/utils/errors.ts | 6 - packages/api/swagger/swagger-spec.yaml | 94 +------ packages/shared/src/categories.ts | 3 +- 23 files changed, 16 insertions(+), 1685 deletions(-) delete mode 100644 packages/api/src/@core/connections/cybersecurity/cybersecurity.connection.module.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/crowdstrike/crowdstrike.service.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/cybersecurity.connection.service.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/microsoftdefender/microsoftdefender.service.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/qualys/qualys.service.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/rapid7insightvm/rapid7.service.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/registry.service.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/semgrep/semgrep.service.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/sentinelone/sentinelone.service.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/snyk/snyk.service.ts delete mode 100644 packages/api/src/@core/connections/cybersecurity/services/tenable/tenable.service.ts diff --git a/apps/webapp/src/app/(Dashboard)/configuration/page.tsx b/apps/webapp/src/app/(Dashboard)/configuration/page.tsx index c5b24c01c..106c1d1e6 100644 --- a/apps/webapp/src/app/(Dashboard)/configuration/page.tsx +++ b/apps/webapp/src/app/(Dashboard)/configuration/page.tsx @@ -109,7 +109,7 @@ export default function Page() { data_type: mapping.data_type, })) - const VERTICALS = verticals.filter((vertical) => !["marketingautomation", "cybersecurity", "productivity"].includes(vertical)); + const VERTICALS = verticals.filter((vertical) => !["marketingautomation", "productivity"].includes(vertical)); useEffect(() => { if (pullFrequencies) { diff --git a/apps/webapp/src/components/Configuration/Connector/ConnectorLayout.tsx b/apps/webapp/src/components/Configuration/Connector/ConnectorLayout.tsx index 44553fa35..5fbfaa7dd 100644 --- a/apps/webapp/src/components/Configuration/Connector/ConnectorLayout.tsx +++ b/apps/webapp/src/components/Configuration/Connector/ConnectorLayout.tsx @@ -46,7 +46,7 @@ export function ConnectorLayout({

Connectors

-

By default, all connectors use Panora managed credentials. You are free to edit them by creating your custom developer apps inside your favorite softwares !

+

By default, all connectors use Panora managed credentials. You can edit settings to use your own credentials on this screen.

diff --git a/apps/webapp/src/components/Configuration/Connector/VerticalSelector.tsx b/apps/webapp/src/components/Configuration/Connector/VerticalSelector.tsx index b709fbd59..9cb36b6f1 100644 --- a/apps/webapp/src/components/Configuration/Connector/VerticalSelector.tsx +++ b/apps/webapp/src/components/Configuration/Connector/VerticalSelector.tsx @@ -33,17 +33,17 @@ export function VerticalSelector({ onSelectVertical }: { onSelectVertical: (vert - + No verticals found. { - try { - const { headers } = input; - const config = await this.constructPassthrough(input, connectionId); - - const connection = await this.prisma.connections.findUnique({ - where: { - id_connection: connectionId, - }, - }); - - const access_token = JSON.parse( - this.cryptoService.decrypt(connection.access_token), - ); - config.headers = { - ...config.headers, - ...headers, - Authorization: `Bearer ${access_token}`, - }; - - return await this.retryService.makeRequest( - { - method: config.method, - url: config.url, - data: config.data, - headers: config.headers, - }, - 'cybersecurity.crowdstrike.passthrough', - config.linkedUserId, - ); - } catch (error) { - throw error; - } - } - - async handleCallback(opts: OAuthCallbackParams) { - try { - const { linkedUserId, projectId, code } = opts; - const isNotUnique = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - provider_slug: 'crowdstrike', - vertical: 'cybersecurity', - }, - }); - //reconstruct the redirect URI that was passed in the frontend it must be the same - const REDIRECT_URI = `${ - this.env.getDistributionMode() == 'selfhost' - ? this.env.getTunnelIngress() - : this.env.getPanoraBaseUrl() - }/connections/oauth/callback`; - - const CREDENTIALS = (await this.cService.getCredentials( - projectId, - this.type, - )) as OAuth2AuthData; - - const formData = new URLSearchParams({ - redirect_uri: REDIRECT_URI, - client_id: CREDENTIALS.CLIENT_ID, - client_secret: CREDENTIALS.CLIENT_SECRET, - code: code, - grant_type: 'authorization_code', - }); - const res = await axios.post( - 'https://api.crowdstrike.com/oauth/access_token', - formData.toString(), - { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', - }, - }, - ); - const data: CrowdstrikeOAuthResponse = res.data; - // save tokens for this customer inside our db - let db_res; - const connection_token = uuidv4(); - const BASE_API_URL = CONNECTORS_METADATA['cybersecurity']['crowdstrike'] - .urls.apiUrl as string; - // get the site id for the token - const site = await axios.get('https://api.crowdstrike.com/v2/sites', { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', - Authorization: `Bearer ${data.access_token}`, - }, - }); - const site_id = site.data.sites[0].id; - if (isNotUnique) { - // Update existing connection - db_res = await this.prisma.connections.update({ - where: { - id_connection: isNotUnique.id_connection, - }, - data: { - access_token: this.cryptoService.encrypt(data.access_token), - status: 'valid', - created_at: new Date(), - }, - }); - } else { - // Create new connection - db_res = await this.prisma.connections.create({ - data: { - id_connection: uuidv4(), - connection_token: connection_token, - provider_slug: 'crowdstrike', - vertical: 'cybersecurity', - token_type: 'oauth2', - account_url: `${BASE_API_URL}/sites/${site_id}`, - access_token: this.cryptoService.encrypt(data.access_token), - status: 'valid', - created_at: new Date(), - projects: { - connect: { id_project: projectId }, - }, - linked_users: { - connect: { - id_linked_user: await this.connectionUtils.getLinkedUserId( - projectId, - linkedUserId, - ), - }, - }, - }, - }); - } - this.logger.log('Successfully added tokens inside DB ' + db_res); - return db_res; - } catch (error) { - throw error; - } - } - - async handleTokenRefresh(opts: RefreshParams) { - return; - } -} diff --git a/packages/api/src/@core/connections/cybersecurity/services/cybersecurity.connection.service.ts b/packages/api/src/@core/connections/cybersecurity/services/cybersecurity.connection.service.ts deleted file mode 100644 index 586f81b2e..000000000 --- a/packages/api/src/@core/connections/cybersecurity/services/cybersecurity.connection.service.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { LoggerService } from '@@core/@core-services/logger/logger.service'; -import { PrismaService } from '@@core/@core-services/prisma/prisma.service'; -import { WebhookService } from '@@core/@core-services/webhooks/panora-webhooks/webhook.service'; -import { - CallbackParams, - IConnectionCategory, - PassthroughInput, - RefreshParams, -} from '@@core/connections/@utils/types'; -import { Injectable } from '@nestjs/common'; -import { connections as Connection } from '@prisma/client'; -import { v4 as uuidv4 } from 'uuid'; -import { ServiceRegistry } from './registry.service'; -import { CategoryConnectionRegistry } from '@@core/@core-services/registries/connections-categories.registry'; -import { PassthroughResponse } from '@@core/passthrough/types'; - -@Injectable() -export class CybersecurityConnectionsService implements IConnectionCategory { - constructor( - private serviceRegistry: ServiceRegistry, - private connectionCategoryRegistry: CategoryConnectionRegistry, - private webhook: WebhookService, - private logger: LoggerService, - private prisma: PrismaService, - ) { - this.logger.setContext(CybersecurityConnectionsService.name); - this.connectionCategoryRegistry.registerService('cybersecurity', this); - } - //STEP 1:[FRONTEND STEP] - //create a frontend SDK snippet in which an authorization embedded link is set up so when users click - // on it to grant access => they grant US the access and then when confirmed - /*const authUrl = - 'https://app.hubspot.com/oauth/authorize' + - `?client_id=${encodeURIComponent(CLIENT_ID)}` + - `&scope=${encodeURIComponent(SCOPES)}` + - `&redirect_uri=${encodeURIComponent(REDIRECT_URI)}`;*/ //oauth/callback - - // oauth server calls this redirect callback - // WE WOULD HAVE CREATED A DEV ACCOUNT IN THE 5 CRMs (Panora dev account) - // we catch the tmp token and swap it against oauth2 server for access/refresh tokens - // to perform actions on his behalf - // this call pass 1. integrationID 2. CustomerId 3. Panora Api Key - async handleCallBack( - providerName: string, - callbackOpts: CallbackParams, - type_strategy: 'oauth2' | 'apikey' | 'basic', - ) { - try { - const serviceName = providerName.toLowerCase(); - - const service = this.serviceRegistry.getService(serviceName); - - if (!service) { - throw new ReferenceError(`Unknown provider, found ${providerName}`); - } - const data: Connection = await service.handleCallback(callbackOpts); - const event = await this.prisma.events.create({ - data: { - id_connection: data.id_connection, - id_project: data.id_project, - id_event: uuidv4(), - status: 'success', - type: 'connection.created', - method: 'GET', - url: `/${type_strategy}/callback`, - provider: providerName.toLowerCase(), - direction: '0', - timestamp: new Date(), - id_linked_user: callbackOpts.linkedUserId, - }, - }); - //directly send the webhook - await this.webhook.dispatchWebhook( - data, - 'connection.created', - callbackOpts.projectId, - event.id_event, - ); - } catch (error) { - throw error; - } - } - - async handleTokensRefresh( - connectionId: string, - providerName: string, - refresh_token: string, - id_project: string, - account_url?: string, - ) { - try { - const serviceName = providerName.toLowerCase(); - const service = this.serviceRegistry.getService(serviceName); - if (!service) { - throw new ReferenceError(`Unknown provider, found ${providerName}`); - } - const refreshOpts: RefreshParams = { - connectionId: connectionId, - refreshToken: refresh_token, - account_url: account_url, - projectId: id_project, - }; - await service.handleTokenRefresh(refreshOpts); - } catch (error) { - throw error; - } - } - - async passthrough( - input: PassthroughInput, - connectionId: string, - ): Promise { - try { - const connection = await this.prisma.connections.findUnique({ - where: { - id_connection: connectionId, - }, - }); - const serviceName = connection.provider_slug.toLowerCase(); - const service = this.serviceRegistry.getService(serviceName); - if (!service) { - throw new ReferenceError(`Unknown provider, found ${serviceName}`); - } - return await service.passthrough(input, connectionId); - } catch (error) { - throw error; - } - } -} diff --git a/packages/api/src/@core/connections/cybersecurity/services/microsoftdefender/microsoftdefender.service.ts b/packages/api/src/@core/connections/cybersecurity/services/microsoftdefender/microsoftdefender.service.ts deleted file mode 100644 index c874a92ba..000000000 --- a/packages/api/src/@core/connections/cybersecurity/services/microsoftdefender/microsoftdefender.service.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { EncryptionService } from '@@core/@core-services/encryption/encryption.service'; -import { LoggerService } from '@@core/@core-services/logger/logger.service'; -import { PrismaService } from '@@core/@core-services/prisma/prisma.service'; -import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler'; -import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; -import { ConnectionUtils } from '@@core/connections/@utils'; -import { - AbstractBaseConnectionService, - OAuthCallbackParams, - PassthroughInput, - RefreshParams, -} from '@@core/connections/@utils/types'; -import { PassthroughResponse } from '@@core/passthrough/types'; -import { Injectable } from '@nestjs/common'; -import { - AuthStrategy, - CONNECTORS_METADATA, - OAuth2AuthData, - providerToType, -} from '@panora/shared'; -import { v4 as uuidv4 } from 'uuid'; -import { ServiceRegistry } from '../registry.service'; -import { EnvironmentService } from '@@core/@core-services/environment/environment.service'; -import axios from 'axios'; - -export interface MicrosoftdefenderOAuthResponse { - access_token: string; - token_type: string; - scope: string; -} - -@Injectable() -export class MicrosoftdefenderConnectionService extends AbstractBaseConnectionService { - private readonly type: string; - - constructor( - protected prisma: PrismaService, - private logger: LoggerService, - protected cryptoService: EncryptionService, - private env: EnvironmentService, - private registry: ServiceRegistry, - private connectionUtils: ConnectionUtils, - private cService: ConnectionsStrategiesService, - private retryService: RetryHandler, - ) { - super(prisma, cryptoService); - this.logger.setContext(MicrosoftdefenderConnectionService.name); - this.registry.registerService('microsoftdefender', this); - this.type = providerToType( - 'microsoftdefender', - 'cybersecurity', - AuthStrategy.oauth2, - ); - } - - async passthrough( - input: PassthroughInput, - connectionId: string, - ): Promise { - try { - const { headers } = input; - const config = await this.constructPassthrough(input, connectionId); - - const connection = await this.prisma.connections.findUnique({ - where: { - id_connection: connectionId, - }, - }); - - const access_token = JSON.parse( - this.cryptoService.decrypt(connection.access_token), - ); - config.headers = { - ...config.headers, - ...headers, - Authorization: `Bearer ${access_token}`, - }; - - return await this.retryService.makeRequest( - { - method: config.method, - url: config.url, - data: config.data, - headers: config.headers, - }, - 'cybersecurity.microsoftdefender.passthrough', - config.linkedUserId, - ); - } catch (error) { - throw error; - } - } - - async handleCallback(opts: OAuthCallbackParams) { - try { - const { linkedUserId, projectId, code } = opts; - const isNotUnique = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - provider_slug: 'microsoftdefender', - vertical: 'cybersecurity', - }, - }); - //reconstruct the redirect URI that was passed in the frontend it must be the same - const REDIRECT_URI = `${ - this.env.getDistributionMode() == 'selfhost' - ? this.env.getTunnelIngress() - : this.env.getPanoraBaseUrl() - }/connections/oauth/callback`; - - const CREDENTIALS = (await this.cService.getCredentials( - projectId, - this.type, - )) as OAuth2AuthData; - - const formData = new URLSearchParams({ - redirect_uri: REDIRECT_URI, - client_id: CREDENTIALS.CLIENT_ID, - client_secret: CREDENTIALS.CLIENT_SECRET, - code: code, - grant_type: 'authorization_code', - }); - const res = await axios.post( - 'https://api.microsoftdefender.com/oauth/access_token', - formData.toString(), - { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', - }, - }, - ); - const data: MicrosoftdefenderOAuthResponse = res.data; - // save tokens for this customer inside our db - let db_res; - const connection_token = uuidv4(); - const BASE_API_URL = CONNECTORS_METADATA['cybersecurity'][ - 'microsoftdefender' - ].urls.apiUrl as string; - // get the site id for the token - const site = await axios.get( - 'https://api.microsoftdefender.com/v2/sites', - { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', - Authorization: `Bearer ${data.access_token}`, - }, - }, - ); - const site_id = site.data.sites[0].id; - if (isNotUnique) { - // Update existing connection - db_res = await this.prisma.connections.update({ - where: { - id_connection: isNotUnique.id_connection, - }, - data: { - access_token: this.cryptoService.encrypt(data.access_token), - status: 'valid', - created_at: new Date(), - }, - }); - } else { - // Create new connection - db_res = await this.prisma.connections.create({ - data: { - id_connection: uuidv4(), - connection_token: connection_token, - provider_slug: 'microsoftdefender', - vertical: 'cybersecurity', - token_type: 'oauth2', - account_url: `${BASE_API_URL}/sites/${site_id}`, - access_token: this.cryptoService.encrypt(data.access_token), - status: 'valid', - created_at: new Date(), - projects: { - connect: { id_project: projectId }, - }, - linked_users: { - connect: { - id_linked_user: await this.connectionUtils.getLinkedUserId( - projectId, - linkedUserId, - ), - }, - }, - }, - }); - } - this.logger.log('Successfully added tokens inside DB ' + db_res); - return db_res; - } catch (error) { - throw error; - } - } - - async handleTokenRefresh(opts: RefreshParams) { - return; - } -} diff --git a/packages/api/src/@core/connections/cybersecurity/services/qualys/qualys.service.ts b/packages/api/src/@core/connections/cybersecurity/services/qualys/qualys.service.ts deleted file mode 100644 index 7840147b9..000000000 --- a/packages/api/src/@core/connections/cybersecurity/services/qualys/qualys.service.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { EncryptionService } from '@@core/@core-services/encryption/encryption.service'; -import { LoggerService } from '@@core/@core-services/logger/logger.service'; -import { PrismaService } from '@@core/@core-services/prisma/prisma.service'; -import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler'; -import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; -import { ConnectionUtils } from '@@core/connections/@utils'; -import { - AbstractBaseConnectionService, - OAuthCallbackParams, - PassthroughInput, - RefreshParams, -} from '@@core/connections/@utils/types'; -import { PassthroughResponse } from '@@core/passthrough/types'; -import { Injectable } from '@nestjs/common'; -import { - AuthStrategy, - CONNECTORS_METADATA, - DynamicApiUrl, - providerToType, -} from '@panora/shared'; -import { v4 as uuidv4 } from 'uuid'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class QualysConnectionService extends AbstractBaseConnectionService { - private readonly type: string; - - constructor( - protected prisma: PrismaService, - private logger: LoggerService, - protected cryptoService: EncryptionService, - private registry: ServiceRegistry, - private connectionUtils: ConnectionUtils, - private cService: ConnectionsStrategiesService, - private retryService: RetryHandler, - ) { - super(prisma, cryptoService); - this.logger.setContext(QualysConnectionService.name); - this.registry.registerService('qualys', this); - this.type = providerToType('qualys', 'cybersecurity', AuthStrategy.oauth2); - } - - async passthrough( - input: PassthroughInput, - connectionId: string, - ): Promise { - try { - const { headers } = input; - const config = await this.constructPassthrough(input, connectionId); - - const connection = await this.prisma.connections.findUnique({ - where: { - id_connection: connectionId, - }, - }); - const decryptedData = JSON.parse( - this.cryptoService.decrypt(connection.access_token), - ); - - const { username, password } = decryptedData; - - config.headers = { - ...config.headers, - ...headers, - 'X-Requested-With': 'Curl Sample', - Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString( - 'base64', - )}`, - }; - - return await this.retryService.makeRequest( - { - method: config.method, - url: config.url, - data: config.data, - headers: config.headers, - }, - 'cybersecurity.qualys.passthrough', - config.linkedUserId, - ); - } catch (error) { - throw error; - } - } - - async handleCallback(opts: OAuthCallbackParams) { - try { - const { linkedUserId, projectId, body } = opts; - const { username, password, api_url } = body; - const isNotUnique = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - provider_slug: 'qualys', - vertical: 'cybersecurity', - }, - }); - - let db_res; - const connection_token = uuidv4(); - const BASE_API_URL = ( - CONNECTORS_METADATA['cybersecurity']['qualys'].urls - .apiUrl as DynamicApiUrl - )(api_url); - - if (isNotUnique) { - db_res = await this.prisma.connections.update({ - where: { - id_connection: isNotUnique.id_connection, - }, - data: { - access_token: this.cryptoService.encrypt( - JSON.stringify({ username, password }), - ), - account_url: BASE_API_URL, - status: 'valid', - created_at: new Date(), - }, - }); - } else { - db_res = await this.prisma.connections.create({ - data: { - id_connection: uuidv4(), - connection_token: connection_token, - provider_slug: 'qualys', - vertical: 'cybersecurity', - token_type: 'basic', - account_url: BASE_API_URL, - access_token: this.cryptoService.encrypt( - JSON.stringify({ username, password }), - ), - status: 'valid', - created_at: new Date(), - projects: { - connect: { id_project: projectId }, - }, - linked_users: { - connect: { - id_linked_user: await this.connectionUtils.getLinkedUserId( - projectId, - linkedUserId, - ), - }, - }, - }, - }); - } - return db_res; - } catch (error) { - throw error; - } - } - - handleTokenRefresh?(opts: RefreshParams): Promise { - throw new Error('Method not implemented.'); - } -} diff --git a/packages/api/src/@core/connections/cybersecurity/services/rapid7insightvm/rapid7.service.ts b/packages/api/src/@core/connections/cybersecurity/services/rapid7insightvm/rapid7.service.ts deleted file mode 100644 index 12e5cd767..000000000 --- a/packages/api/src/@core/connections/cybersecurity/services/rapid7insightvm/rapid7.service.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { EncryptionService } from '@@core/@core-services/encryption/encryption.service'; -import { LoggerService } from '@@core/@core-services/logger/logger.service'; -import { PrismaService } from '@@core/@core-services/prisma/prisma.service'; -import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler'; -import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; -import { ConnectionUtils } from '@@core/connections/@utils'; -import { - AbstractBaseConnectionService, - OAuthCallbackParams, - PassthroughInput, - RefreshParams, -} from '@@core/connections/@utils/types'; -import { PassthroughResponse } from '@@core/passthrough/types'; -import { Injectable } from '@nestjs/common'; -import { - AuthStrategy, - CONNECTORS_METADATA, - DynamicApiUrl, - providerToType, -} from '@panora/shared'; -import { v4 as uuidv4 } from 'uuid'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class Rapid7ConnectionService extends AbstractBaseConnectionService { - private readonly type: string; - - constructor( - protected prisma: PrismaService, - private logger: LoggerService, - protected cryptoService: EncryptionService, - private registry: ServiceRegistry, - private connectionUtils: ConnectionUtils, - private cService: ConnectionsStrategiesService, - private retryService: RetryHandler, - ) { - super(prisma, cryptoService); - this.logger.setContext(Rapid7ConnectionService.name); - this.registry.registerService('rapid7', this); - this.type = providerToType('rapid7', 'cybersecurity', AuthStrategy.oauth2); - } - - async passthrough( - input: PassthroughInput, - connectionId: string, - ): Promise { - try { - const { headers } = input; - const config = await this.constructPassthrough(input, connectionId); - - const connection = await this.prisma.connections.findUnique({ - where: { - id_connection: connectionId, - }, - }); - config.headers = { - ...config.headers, - ...headers, - Authorization: `Basic ${Buffer.from( - `:${connection.access_token}`, - ).toString('base64')}`, - }; - - return await this.retryService.makeRequest( - { - method: config.method, - url: config.url, - data: config.data, - headers: config.headers, - }, - 'cybersecurity.rapid7.passthrough', - config.linkedUserId, - ); - } catch (error) { - throw error; - } - } - - async handleCallback(opts: OAuthCallbackParams) { - try { - const { linkedUserId, projectId, body } = opts; - const { api_key, region } = body; - const isNotUnique = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - provider_slug: 'rapid7', - vertical: 'cybersecurity', - }, - }); - - let db_res; - const connection_token = uuidv4(); - const BASE_API_URL = ( - CONNECTORS_METADATA['cybersecurity']['rapid7'].urls - .apiUrl as DynamicApiUrl - )(region); - - if (isNotUnique) { - db_res = await this.prisma.connections.update({ - where: { - id_connection: isNotUnique.id_connection, - }, - data: { - access_token: this.cryptoService.encrypt(api_key), - account_url: BASE_API_URL, - status: 'valid', - created_at: new Date(), - }, - }); - } else { - db_res = await this.prisma.connections.create({ - data: { - id_connection: uuidv4(), - connection_token: connection_token, - provider_slug: 'rapid7', - vertical: 'cybersecurity', - token_type: 'basic', - account_url: BASE_API_URL, - access_token: this.cryptoService.encrypt(api_key), - status: 'valid', - created_at: new Date(), - projects: { - connect: { id_project: projectId }, - }, - linked_users: { - connect: { - id_linked_user: await this.connectionUtils.getLinkedUserId( - projectId, - linkedUserId, - ), - }, - }, - }, - }); - } - return db_res; - } catch (error) { - throw error; - } - } - - handleTokenRefresh?(opts: RefreshParams): Promise { - throw new Error('Method not implemented.'); - } -} diff --git a/packages/api/src/@core/connections/cybersecurity/services/registry.service.ts b/packages/api/src/@core/connections/cybersecurity/services/registry.service.ts deleted file mode 100644 index de82a1fcb..000000000 --- a/packages/api/src/@core/connections/cybersecurity/services/registry.service.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { IConnectionService } from '@@core/connections/@utils/types'; -import { Injectable } from '@nestjs/common'; - -@Injectable() -export class ServiceRegistry { - private serviceMap: Map; - - constructor() { - this.serviceMap = new Map(); - } - - registerService(serviceKey: string, service: IConnectionService) { - this.serviceMap.set(serviceKey, service); - } - - getService(integrationId: string): IConnectionService { - const service = this.serviceMap.get(integrationId); - if (!service) { - return null; - } - return service; - } -} diff --git a/packages/api/src/@core/connections/cybersecurity/services/semgrep/semgrep.service.ts b/packages/api/src/@core/connections/cybersecurity/services/semgrep/semgrep.service.ts deleted file mode 100644 index 7bd36d5d0..000000000 --- a/packages/api/src/@core/connections/cybersecurity/services/semgrep/semgrep.service.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { EncryptionService } from '@@core/@core-services/encryption/encryption.service'; -import { LoggerService } from '@@core/@core-services/logger/logger.service'; -import { PrismaService } from '@@core/@core-services/prisma/prisma.service'; -import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler'; -import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; -import { ConnectionUtils } from '@@core/connections/@utils'; -import { - AbstractBaseConnectionService, - OAuthCallbackParams, - PassthroughInput, - RefreshParams, -} from '@@core/connections/@utils/types'; -import { PassthroughResponse } from '@@core/passthrough/types'; -import { Injectable } from '@nestjs/common'; -import { - AuthStrategy, - CONNECTORS_METADATA, - DynamicApiUrl, - providerToType, -} from '@panora/shared'; -import { v4 as uuidv4 } from 'uuid'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class SemgrepConnectionService extends AbstractBaseConnectionService { - private readonly type: string; - - constructor( - protected prisma: PrismaService, - private logger: LoggerService, - protected cryptoService: EncryptionService, - private registry: ServiceRegistry, - private connectionUtils: ConnectionUtils, - private cService: ConnectionsStrategiesService, - private retryService: RetryHandler, - ) { - super(prisma, cryptoService); - this.logger.setContext(SemgrepConnectionService.name); - this.registry.registerService('semgrep', this); - this.type = providerToType('semgrep', 'cybersecurity', AuthStrategy.oauth2); - } - - async passthrough( - input: PassthroughInput, - connectionId: string, - ): Promise { - try { - const { headers } = input; - const config = await this.constructPassthrough(input, connectionId); - - const connection = await this.prisma.connections.findUnique({ - where: { - id_connection: connectionId, - }, - }); - config.headers = { - ...config.headers, - ...headers, - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }; - - return await this.retryService.makeRequest( - { - method: config.method, - url: config.url, - data: config.data, - headers: config.headers, - }, - 'cybersecurity.semgrep.passthrough', - config.linkedUserId, - ); - } catch (error) { - throw error; - } - } - - async handleCallback(opts: OAuthCallbackParams) { - try { - const { linkedUserId, projectId, body } = opts; - const { api_key } = body; - const isNotUnique = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - provider_slug: 'semgrep', - vertical: 'cybersecurity', - }, - }); - - let db_res; - const connection_token = uuidv4(); - const BASE_API_URL = CONNECTORS_METADATA['cybersecurity']['semgrep'].urls - .apiUrl as string; - - if (isNotUnique) { - db_res = await this.prisma.connections.update({ - where: { - id_connection: isNotUnique.id_connection, - }, - data: { - access_token: this.cryptoService.encrypt(api_key), - account_url: BASE_API_URL, - status: 'valid', - created_at: new Date(), - }, - }); - } else { - db_res = await this.prisma.connections.create({ - data: { - id_connection: uuidv4(), - connection_token: connection_token, - provider_slug: 'semgrep', - vertical: 'cybersecurity', - token_type: 'basic', - account_url: BASE_API_URL, - access_token: this.cryptoService.encrypt(api_key), - status: 'valid', - created_at: new Date(), - projects: { - connect: { id_project: projectId }, - }, - linked_users: { - connect: { - id_linked_user: await this.connectionUtils.getLinkedUserId( - projectId, - linkedUserId, - ), - }, - }, - }, - }); - } - return db_res; - } catch (error) { - throw error; - } - } - - handleTokenRefresh?(opts: RefreshParams): Promise { - throw new Error('Method not implemented.'); - } -} diff --git a/packages/api/src/@core/connections/cybersecurity/services/sentinelone/sentinelone.service.ts b/packages/api/src/@core/connections/cybersecurity/services/sentinelone/sentinelone.service.ts deleted file mode 100644 index 7d6f02fb5..000000000 --- a/packages/api/src/@core/connections/cybersecurity/services/sentinelone/sentinelone.service.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { EncryptionService } from '@@core/@core-services/encryption/encryption.service'; -import { LoggerService } from '@@core/@core-services/logger/logger.service'; -import { PrismaService } from '@@core/@core-services/prisma/prisma.service'; -import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler'; -import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; -import { ConnectionUtils } from '@@core/connections/@utils'; -import { - AbstractBaseConnectionService, - OAuthCallbackParams, - PassthroughInput, - RefreshParams, -} from '@@core/connections/@utils/types'; -import { PassthroughResponse } from '@@core/passthrough/types'; -import { Injectable } from '@nestjs/common'; -import { - AuthStrategy, - CONNECTORS_METADATA, - DynamicApiUrl, - providerToType, -} from '@panora/shared'; -import { v4 as uuidv4 } from 'uuid'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class SentineloneConnectionService extends AbstractBaseConnectionService { - private readonly type: string; - - constructor( - protected prisma: PrismaService, - private logger: LoggerService, - protected cryptoService: EncryptionService, - private registry: ServiceRegistry, - private connectionUtils: ConnectionUtils, - private cService: ConnectionsStrategiesService, - private retryService: RetryHandler, - ) { - super(prisma, cryptoService); - this.logger.setContext(SentineloneConnectionService.name); - this.registry.registerService('sentinelone', this); - this.type = providerToType( - 'sentinelone', - 'cybersecurity', - AuthStrategy.oauth2, - ); - } - - async passthrough( - input: PassthroughInput, - connectionId: string, - ): Promise { - try { - const { headers } = input; - const config = await this.constructPassthrough(input, connectionId); - - const connection = await this.prisma.connections.findUnique({ - where: { - id_connection: connectionId, - }, - }); - config.headers = { - ...config.headers, - ...headers, - Authorization: `APIToken ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }; - - return await this.retryService.makeRequest( - { - method: config.method, - url: config.url, - data: config.data, - headers: config.headers, - }, - 'cybersecurity.sentinelone.passthrough', - config.linkedUserId, - ); - } catch (error) { - throw error; - } - } - - async handleCallback(opts: OAuthCallbackParams) { - try { - const { linkedUserId, projectId, body } = opts; - const { api_key, host } = body; - const isNotUnique = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - provider_slug: 'sentinelone', - vertical: 'cybersecurity', - }, - }); - - let db_res; - const connection_token = uuidv4(); - const BASE_API_URL = ( - CONNECTORS_METADATA['cybersecurity']['sentinelone'].urls - .apiUrl as DynamicApiUrl - )(host); - - if (isNotUnique) { - db_res = await this.prisma.connections.update({ - where: { - id_connection: isNotUnique.id_connection, - }, - data: { - access_token: this.cryptoService.encrypt(api_key), - account_url: BASE_API_URL, - status: 'valid', - created_at: new Date(), - }, - }); - } else { - db_res = await this.prisma.connections.create({ - data: { - id_connection: uuidv4(), - connection_token: connection_token, - provider_slug: 'sentinelone', - vertical: 'cybersecurity', - token_type: 'basic', - account_url: BASE_API_URL, - access_token: this.cryptoService.encrypt(api_key), - status: 'valid', - created_at: new Date(), - projects: { - connect: { id_project: projectId }, - }, - linked_users: { - connect: { - id_linked_user: await this.connectionUtils.getLinkedUserId( - projectId, - linkedUserId, - ), - }, - }, - }, - }); - } - return db_res; - } catch (error) { - throw error; - } - } - - handleTokenRefresh?(opts: RefreshParams): Promise { - throw new Error('Method not implemented.'); - } -} diff --git a/packages/api/src/@core/connections/cybersecurity/services/snyk/snyk.service.ts b/packages/api/src/@core/connections/cybersecurity/services/snyk/snyk.service.ts deleted file mode 100644 index f5cb498c0..000000000 --- a/packages/api/src/@core/connections/cybersecurity/services/snyk/snyk.service.ts +++ /dev/null @@ -1,241 +0,0 @@ -import { EncryptionService } from '@@core/@core-services/encryption/encryption.service'; -import { LoggerService } from '@@core/@core-services/logger/logger.service'; -import { PrismaService } from '@@core/@core-services/prisma/prisma.service'; -import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler'; -import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; -import { ConnectionUtils } from '@@core/connections/@utils'; -import { - AbstractBaseConnectionService, - OAuthCallbackParams, - PassthroughInput, - RefreshParams, -} from '@@core/connections/@utils/types'; -import { PassthroughResponse } from '@@core/passthrough/types'; -import { Injectable } from '@nestjs/common'; -import { - AuthStrategy, - CONNECTORS_METADATA, - OAuth2AuthData, - providerToType, -} from '@panora/shared'; -import { v4 as uuidv4 } from 'uuid'; -import { ServiceRegistry } from '../registry.service'; -import { EnvironmentService } from '@@core/@core-services/environment/environment.service'; -import axios from 'axios'; - -export interface SnykOAuthResponse { - access_token: string; - refresh_token: string; - token_type: string; - scope: string; - expires_in: string; -} - -@Injectable() -export class SnykConnectionService extends AbstractBaseConnectionService { - private readonly type: string; - - constructor( - protected prisma: PrismaService, - private logger: LoggerService, - protected cryptoService: EncryptionService, - private env: EnvironmentService, - private registry: ServiceRegistry, - private connectionUtils: ConnectionUtils, - private cService: ConnectionsStrategiesService, - private retryService: RetryHandler, - ) { - super(prisma, cryptoService); - this.logger.setContext(SnykConnectionService.name); - this.registry.registerService('snyk', this); - this.type = providerToType('snyk', 'cybersecurity', AuthStrategy.oauth2); - } - - async passthrough( - input: PassthroughInput, - connectionId: string, - ): Promise { - try { - const { headers } = input; - const config = await this.constructPassthrough(input, connectionId); - - const connection = await this.prisma.connections.findUnique({ - where: { - id_connection: connectionId, - }, - }); - - const access_token = JSON.parse( - this.cryptoService.decrypt(connection.access_token), - ); - config.headers = { - ...config.headers, - ...headers, - Authorization: `token ${access_token}`, - }; - - return await this.retryService.makeRequest( - { - method: config.method, - url: config.url, - data: config.data, - headers: config.headers, - }, - 'cybersecurity.snyk.passthrough', - config.linkedUserId, - ); - } catch (error) { - throw error; - } - } - - async handleCallback(opts: OAuthCallbackParams) { - try { - const { linkedUserId, projectId, code, code_verifier } = opts; - const isNotUnique = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - provider_slug: 'snyk', - vertical: 'cybersecurity', - }, - }); - //reconstruct the redirect URI that was passed in the frontend it must be the same - const REDIRECT_URI = `${ - this.env.getDistributionMode() == 'selfhost' - ? this.env.getTunnelIngress() - : this.env.getPanoraBaseUrl() - }/connections/oauth/callback`; - - const CREDENTIALS = (await this.cService.getCredentials( - projectId, - this.type, - )) as OAuth2AuthData; - - const formData = new URLSearchParams({ - redirect_uri: REDIRECT_URI, - client_id: CREDENTIALS.CLIENT_ID, - client_secret: CREDENTIALS.CLIENT_SECRET, - code: code, - grant_type: 'authorization_code', - code_verifier: code_verifier, - }); - const res = await axios.post( - 'https://api.snyk.io/oauth2/token', - formData.toString(), - { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', - }, - }, - ); - const data: SnykOAuthResponse = res.data; - console.log('result is ' + JSON.stringify(data)); - // save tokens for this customer inside our db - let db_res; - const connection_token = uuidv4(); - const BASE_API_URL = CONNECTORS_METADATA['cybersecurity']['snyk'].urls - .apiUrl as string; - if (isNotUnique) { - // Update existing connection - db_res = await this.prisma.connections.update({ - where: { - id_connection: isNotUnique.id_connection, - }, - data: { - access_token: this.cryptoService.encrypt(data.access_token), - refresh_token: this.cryptoService.encrypt(data.refresh_token), - expiration_timestamp: new Date( - new Date().getTime() + Number(data.expires_in) * 1000, - ), - status: 'valid', - created_at: new Date(), - }, - }); - } else { - // Create new connection - db_res = await this.prisma.connections.create({ - data: { - id_connection: uuidv4(), - connection_token: connection_token, - provider_slug: 'snyk', - vertical: 'cybersecurity', - token_type: 'oauth2', - account_url: BASE_API_URL, - access_token: this.cryptoService.encrypt(data.access_token), - refresh_token: this.cryptoService.encrypt(data.refresh_token), - expiration_timestamp: new Date( - new Date().getTime() + Number(data.expires_in) * 1000, - ), - status: 'valid', - created_at: new Date(), - projects: { - connect: { id_project: projectId }, - }, - linked_users: { - connect: { - id_linked_user: await this.connectionUtils.getLinkedUserId( - projectId, - linkedUserId, - ), - }, - }, - }, - }); - } - this.logger.log('Successfully added tokens inside DB ' + db_res); - return db_res; - } catch (error) { - throw error; - } - } - - async handleTokenRefresh(opts: RefreshParams) { - try { - const { connectionId, refreshToken, projectId } = opts; - const REDIRECT_URI = `${ - this.env.getDistributionMode() == 'selfhost' - ? this.env.getTunnelIngress() - : this.env.getPanoraBaseUrl() - }/connections/oauth/callback`; - - const CREDENTIALS = (await this.cService.getCredentials( - projectId, - this.type, - )) as OAuth2AuthData; - - const formData = new URLSearchParams({ - grant_type: 'refresh_token', - client_id: CREDENTIALS.CLIENT_ID, - client_secret: CREDENTIALS.CLIENT_SECRET, - refresh_token: this.cryptoService.decrypt(refreshToken), - redirect_uri: REDIRECT_URI, - }); - - const res = await axios.post( - `https://app.deel.com/oauth2/tokens`, - formData.toString(), - { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', - }, - }, - ); - const data: SnykOAuthResponse = res.data; - await this.prisma.connections.update({ - where: { - id_connection: connectionId, - }, - data: { - access_token: this.cryptoService.encrypt(data.access_token), - refresh_token: this.cryptoService.encrypt(data.refresh_token), - expiration_timestamp: new Date( - new Date().getTime() + Number(data.expires_in) * 1000, - ), - }, - }); - this.logger.log('OAuth credentials updated : deel '); - } catch (error) { - throw error; - } - } -} diff --git a/packages/api/src/@core/connections/cybersecurity/services/tenable/tenable.service.ts b/packages/api/src/@core/connections/cybersecurity/services/tenable/tenable.service.ts deleted file mode 100644 index 7c125d3d8..000000000 --- a/packages/api/src/@core/connections/cybersecurity/services/tenable/tenable.service.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { EncryptionService } from '@@core/@core-services/encryption/encryption.service'; -import { LoggerService } from '@@core/@core-services/logger/logger.service'; -import { PrismaService } from '@@core/@core-services/prisma/prisma.service'; -import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler'; -import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; -import { ConnectionUtils } from '@@core/connections/@utils'; -import { - AbstractBaseConnectionService, - OAuthCallbackParams, - PassthroughInput, - RefreshParams, -} from '@@core/connections/@utils/types'; -import { PassthroughResponse } from '@@core/passthrough/types'; -import { Injectable } from '@nestjs/common'; -import { - AuthStrategy, - CONNECTORS_METADATA, - DynamicApiUrl, - providerToType, -} from '@panora/shared'; -import { v4 as uuidv4 } from 'uuid'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class TenableConnectionService extends AbstractBaseConnectionService { - private readonly type: string; - - constructor( - protected prisma: PrismaService, - private logger: LoggerService, - protected cryptoService: EncryptionService, - private registry: ServiceRegistry, - private connectionUtils: ConnectionUtils, - private cService: ConnectionsStrategiesService, - private retryService: RetryHandler, - ) { - super(prisma, cryptoService); - this.logger.setContext(TenableConnectionService.name); - this.registry.registerService('tenable', this); - this.type = providerToType('tenable', 'cybersecurity', AuthStrategy.oauth2); - } - - async passthrough( - input: PassthroughInput, - connectionId: string, - ): Promise { - try { - const { headers } = input; - const config = await this.constructPassthrough(input, connectionId); - - const connection = await this.prisma.connections.findUnique({ - where: { - id_connection: connectionId, - }, - }); - const decryptedData = JSON.parse( - this.cryptoService.decrypt(connection.access_token), - ); - - const { access_key, secret_key } = decryptedData; // todo - - config.headers = { - ...config.headers, - ...headers, - 'X-ApiKeys': `${secret_key}`, - }; - - return await this.retryService.makeRequest( - { - method: config.method, - url: config.url, - data: config.data, - headers: config.headers, - }, - 'cybersecurity.tenable.passthrough', - config.linkedUserId, - ); - } catch (error) { - throw error; - } - } - - async handleCallback(opts: OAuthCallbackParams) { - try { - const { linkedUserId, projectId, body } = opts; - const { access_key, secret_key } = body; - const isNotUnique = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - provider_slug: 'tenable', - vertical: 'cybersecurity', - }, - }); - - let db_res; - const connection_token = uuidv4(); - const BASE_API_URL = CONNECTORS_METADATA['cybersecurity']['tenable'].urls - .apiUrl as string; - - if (isNotUnique) { - db_res = await this.prisma.connections.update({ - where: { - id_connection: isNotUnique.id_connection, - }, - data: { - access_token: this.cryptoService.encrypt(secret_key), - account_url: BASE_API_URL, - status: 'valid', - created_at: new Date(), - }, - }); - } else { - db_res = await this.prisma.connections.create({ - data: { - id_connection: uuidv4(), - connection_token: connection_token, - provider_slug: 'tenable', - vertical: 'cybersecurity', - token_type: 'basic', - account_url: BASE_API_URL, - access_token: this.cryptoService.encrypt(secret_key), - status: 'valid', - created_at: new Date(), - projects: { - connect: { id_project: projectId }, - }, - linked_users: { - connect: { - id_linked_user: await this.connectionUtils.getLinkedUserId( - projectId, - linkedUserId, - ), - }, - }, - }, - }); - } - return db_res; - } catch (error) { - throw error; - } - } - - handleTokenRefresh?(opts: RefreshParams): Promise { - throw new Error('Method not implemented.'); - } -} diff --git a/packages/api/src/@core/sync/sync.controller.ts b/packages/api/src/@core/sync/sync.controller.ts index 72bb9f7dc..7bd20b490 100644 --- a/packages/api/src/@core/sync/sync.controller.ts +++ b/packages/api/src/@core/sync/sync.controller.ts @@ -66,9 +66,7 @@ export class ResyncStatusDto { example: 'ticketing', enum: [ 'ticketing', - 'ats', 'accounting', - 'hris', 'crm', 'filestorage', 'ecommerce', @@ -113,8 +111,6 @@ export class SyncController { 'marketingautomation', 'crm', 'filestorage', - 'ats', - 'hris', 'accounting', 'ecommerce', ], diff --git a/packages/api/src/@core/utils/errors.ts b/packages/api/src/@core/utils/errors.ts index b8b778cf9..d447565ea 100644 --- a/packages/api/src/@core/utils/errors.ts +++ b/packages/api/src/@core/utils/errors.ts @@ -106,15 +106,11 @@ export class ConnectionsError extends ErrorBase< | 'HANDLE_OAUTH_CALLBACK_MARKETINGAUTOMATION' | 'HANDLE_OAUTH_CALLBACK_FILESTORAGE' | 'HANDLE_OAUTH_CALLBACK_ACCOUNTING' - | 'HANDLE_OAUTH_CALLBACK_ATS' - | 'HANDLE_OAUTH_CALLBACK_HRIS' | 'HANDLE_OAUTH_REFRESH_TICKETING' | 'HANDLE_OAUTH_REFRESH_CRM' | 'HANDLE_OAUTH_REFRESH_MARKETINGAUTOMATION' | 'HANDLE_OAUTH_REFRESH_FILESTORAGE' | 'HANDLE_OAUTH_REFRESH_ACCOUNTING' - | 'HANDLE_OAUTH_REFRESH_ATS' - | 'HANDLE_OAUTH_REFRESH_HRIS' > {} export class ManagedWebhooksError extends ErrorBase< @@ -185,8 +181,6 @@ export class CoreSyncError extends ErrorBase< | 'MARKETINGAUTOMATION_INITIAL_SYNC_ERROR' | 'FILESTORAGE_INITIAL_SYNC_ERROR' | 'ACCOUNTING_INITIAL_SYNC_ERROR' - | 'HRIS_INITIAL_SYNC_ERROR' - | 'ATS_INITIAL_SYNC_ERROR' | 'MARKETINGAUTOMATION_INITIAL_SYNC_ERROR' > {} diff --git a/packages/api/swagger/swagger-spec.yaml b/packages/api/swagger/swagger-spec.yaml index 438db1cd2..b8b36b094 100644 --- a/packages/api/swagger/swagger-spec.yaml +++ b/packages/api/swagger/swagger-spec.yaml @@ -77,7 +77,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -260,8 +259,6 @@ paths: schema: type: string responses: - '200': - description: '' '201': description: '' content: @@ -282,8 +279,6 @@ paths: schema: type: string responses: - '200': - description: '' '201': description: '' content: @@ -338,7 +333,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -463,7 +457,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -555,7 +548,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -645,7 +637,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -732,8 +723,6 @@ paths: - marketingautomation - crm - filestorage - - ats - - hris - accounting - ecommerce type: string @@ -771,12 +760,6 @@ paths: responses: '200': description: Pull frequency updated successfully - '201': - description: '' - content: - application/json: - schema: - type: object tags: *ref_6 x-speakeasy-group: sync get: @@ -816,7 +799,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -941,7 +923,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -1066,7 +1047,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -1190,7 +1170,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -1315,7 +1294,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -1440,7 +1418,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -1532,7 +1509,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -1656,7 +1632,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -1748,7 +1723,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -1841,7 +1815,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -1969,7 +1942,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -2061,7 +2033,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -2361,15 +2332,11 @@ paths: required: false in: query schema: - minimum: 1 - default: 1 type: number - name: limit required: false in: query schema: - minimum: 1 - default: 10 type: number responses: '200': @@ -2405,12 +2372,6 @@ paths: application/json: schema: type: object - '201': - description: '' - content: - application/json: - schema: - type: object tags: &ref_22 - passthrough x-speakeasy-group: passthrough @@ -2456,7 +2417,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -2586,7 +2546,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -2718,7 +2677,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -2848,7 +2806,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -2978,7 +2935,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -3073,7 +3029,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -3168,7 +3123,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -3297,7 +3251,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -3392,7 +3345,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -3521,7 +3473,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -3616,7 +3567,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -3741,7 +3691,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -3833,7 +3782,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -3959,7 +3907,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -4052,7 +3999,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -4145,7 +4091,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -4238,7 +4183,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -4363,7 +4307,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -4456,7 +4399,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -4581,7 +4523,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -4674,7 +4615,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -4799,7 +4739,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -4891,7 +4830,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5017,7 +4955,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5142,7 +5079,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5235,7 +5171,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5361,7 +5296,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5453,7 +5387,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5546,7 +5479,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5639,7 +5571,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5732,7 +5663,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5857,7 +5787,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -5949,7 +5878,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -6041,7 +5969,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -6164,7 +6091,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -6287,7 +6213,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -6377,7 +6302,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -6468,7 +6392,6 @@ paths: example: 10 description: Set to get the number of records. schema: - default: 50 type: number - name: cursor required: false @@ -6811,6 +6734,7 @@ components: password_hash: type: string required: + - id_user - email - password_hash Connection: @@ -6898,8 +6822,8 @@ components: description: The unique UUID of the webhook. endpoint_description: type: string - nullable: true example: Webhook to receive connection events + nullable: true description: The description of the webhook. url: type: string @@ -6937,8 +6861,8 @@ components: last_update: format: date-time type: string - nullable: true example: '2024-10-01T12:00:00Z' + nullable: true description: The last update date of the webhook. required: - id_webhook_endpoint @@ -6973,6 +6897,7 @@ components: type: string required: - url + - description - scope SignatureVerificationDto: type: object @@ -7508,9 +7433,7 @@ components: example: ticketing enum: - ticketing - - ats - accounting - - hris - crm - filestorage - ecommerce @@ -8924,6 +8847,8 @@ components: - id_project - name - sync_mode + - pull_frequency + - redirect_url - id_user - id_connector_set CreateProjectDto: @@ -9292,10 +9217,10 @@ components: type: object properties: method: + type: string enum: - GET - POST - type: string path: type: string nullable: true @@ -9314,11 +9239,12 @@ components: type: object additionalProperties: true nullable: true - headers: - type: object required: - method - path + - data + - request_format + - overrideBaseUrl UnifiedMarketingautomationActionOutput: type: object properties: {} diff --git a/packages/shared/src/categories.ts b/packages/shared/src/categories.ts index f9890e959..3987c45e9 100644 --- a/packages/shared/src/categories.ts +++ b/packages/shared/src/categories.ts @@ -5,8 +5,7 @@ export enum ConnectorCategory { MarketingAutomation = 'marketingautomation', FileStorage = 'filestorage', Productivity = 'productivity', - Ecommerce = 'ecommerce', - Cybersecurity = 'cybersecurity' + Ecommerce = 'ecommerce' } export const categoriesVerticals: ConnectorCategory[] = Object.values(ConnectorCategory);