From 2c4c59c8dc27d8d4c27b8c53a8bfa4ac0a06efa3 Mon Sep 17 00:00:00 2001 From: nael Date: Thu, 20 Jun 2024 00:52:03 +0200 Subject: [PATCH 1/2] :bug: Fix typo --- packages/shared/src/authUrl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/authUrl.ts b/packages/shared/src/authUrl.ts index fc8f237e7..395b9f369 100644 --- a/packages/shared/src/authUrl.ts +++ b/packages/shared/src/authUrl.ts @@ -98,7 +98,7 @@ const handleOAuth2Url = async (input: HandleOAuth2Url) => { if(typeof baseUrl == "string"){ BASE_URL = baseUrl; }else{ - BASE_URL = (baseUrl as DynamicAuthorization)(data.SUBDOMAIN); + BASE_URL = (baseUrl as DynamicAuthorization)(data.SUBDOMAIN as string); } }else if (needsEndUserSubdomain(providerName, vertical)){ if(typeof baseUrl == "string"){ From d1c271f0155169ba0dd88a1f55cc7e52830ab6b1 Mon Sep 17 00:00:00 2001 From: nael Date: Thu, 20 Jun 2024 01:01:13 +0200 Subject: [PATCH 2/2] :green_heart: Lint & build --- .../management/services/registry.service.ts | 5 +--- .../api/src/@core/events/events.controller.ts | 5 +++- .../handler/mw-handler.controller.ts | 3 +-- packages/api/src/app.module.ts | 2 +- packages/shared/src/authUrl.ts | 23 ++++++++++--------- packages/shared/src/connectors/metadata.ts | 2 +- packages/shared/src/envConfig.ts | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/api/src/@core/connections/management/services/registry.service.ts b/packages/api/src/@core/connections/management/services/registry.service.ts index c4e3c27e4..85f6ebb81 100644 --- a/packages/api/src/@core/connections/management/services/registry.service.ts +++ b/packages/api/src/@core/connections/management/services/registry.service.ts @@ -9,10 +9,7 @@ export class ServiceRegistry { this.serviceMap = new Map(); } - registerService( - serviceKey: string, - service: IManagementConnectionService, - ) { + registerService(serviceKey: string, service: IManagementConnectionService) { this.serviceMap.set(serviceKey, service); } diff --git a/packages/api/src/@core/events/events.controller.ts b/packages/api/src/@core/events/events.controller.ts index fd72a62ce..ac51f9a96 100644 --- a/packages/api/src/@core/events/events.controller.ts +++ b/packages/api/src/@core/events/events.controller.ts @@ -23,7 +23,10 @@ export class EventsController { this.logger.setContext(EventsController.name); } - @ApiOperation({ operationId: 'getPanoraCoreEvents', summary: 'Retrieve Events' }) + @ApiOperation({ + operationId: 'getPanoraCoreEvents', + summary: 'Retrieve Events', + }) @ApiResponse({ status: 200 }) @UsePipes( new ValidationPipe({ diff --git a/packages/api/src/@core/managed-webhooks/handler/mw-handler.controller.ts b/packages/api/src/@core/managed-webhooks/handler/mw-handler.controller.ts index ab1680c9f..da40b18b3 100644 --- a/packages/api/src/@core/managed-webhooks/handler/mw-handler.controller.ts +++ b/packages/api/src/@core/managed-webhooks/handler/mw-handler.controller.ts @@ -23,12 +23,11 @@ export class MWHandlerController { async handleThirdPartyWebhook( @Body() data: any, @Headers() headers: any, - @Param('endpoint_uuid') uuid: string, // Changed 'uuid' to 'endpoint_uuid' + @Param('endpoint_uuid') uuid: string, // Changed 'uuid' to 'endpoint_uuid' ) { this.loggerService.log( 'Realtime Webhook Received with Payload ---- ' + JSON.stringify(data), ); await this.queue.add({ uuid, data, headers }); } - } diff --git a/packages/api/src/app.module.ts b/packages/api/src/app.module.ts index cb2a76947..a45d3aae5 100644 --- a/packages/api/src/app.module.ts +++ b/packages/api/src/app.module.ts @@ -55,7 +55,7 @@ import { PrismaModule } from '@@core/prisma/prisma.module'; context: 'HTTP', env: process.env.ENV, distribution: process.env.DISTRIBUTION, - commit_id: process.env.GIT_COMMIT_ID, + commit_id: process.env.GIT_COMMIT_ID, }), transport: process.env.AXIOM_AGENT_STATUS === 'ENABLED' diff --git a/packages/shared/src/authUrl.ts b/packages/shared/src/authUrl.ts index 395b9f369..e06310180 100644 --- a/packages/shared/src/authUrl.ts +++ b/packages/shared/src/authUrl.ts @@ -94,20 +94,21 @@ const handleOAuth2Url = async (input: HandleOAuth2Url) => { let BASE_URL: string; // construct the baseAuthUrl based on the fact that client may use custom subdomain - if(needsSubdomain(providerName, vertical)){ - if(typeof baseUrl == "string"){ + + if( needsSubdomain(providerName, vertical) ) { + if(typeof baseUrl === 'string') { BASE_URL = baseUrl; - }else{ + } else { BASE_URL = (baseUrl as DynamicAuthorization)(data.SUBDOMAIN as string); } - }else if (needsEndUserSubdomain(providerName, vertical)){ - if(typeof baseUrl == "string"){ + } else if (needsEndUserSubdomain(providerName, vertical)) { + if(typeof baseUrl === 'string') { BASE_URL = baseUrl; - }else{ - BASE_URL = (baseUrl as DynamicAuthorization)("END_USER_SUBDOMAIN"); // TODO: get the END-USER domain from the hook (data coming from webapp client) + } else { + BASE_URL = (baseUrl as DynamicAuthorization)('END_USER_SUBDOMAIN'); // TODO: get the END-USER domain from the hook (data coming from webapp client) // TODO: add the end user subdomain as query param on the redirect uri ? } - }else{ + } else { BASE_URL = baseUrl as StringAuthorization; } @@ -120,9 +121,9 @@ const handleOAuth2Url = async (input: HandleOAuth2Url) => { let params = `response_type=code&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodedRedirectUrl}&state=${state}`; if (scopes) { - if(providerName == "slack"){ + if(providerName === 'slack') { params += `&scope=&user_scope=${encodeURIComponent(scopes)}`; - }else{ + } else { params += `&scope=${encodeURIComponent(scopes)}`; } } @@ -164,7 +165,7 @@ const handleOAuth2Url = async (input: HandleOAuth2Url) => { } const finalAuthUrl = `${BASE_URL}?${params}`; - console.log('Final Authentication : ', finalAuthUrl); + // console.log('Final Authentication : ', finalAuthUrl); return finalAuthUrl; } diff --git a/packages/shared/src/connectors/metadata.ts b/packages/shared/src/connectors/metadata.ts index ade45f9db..63f1597c1 100644 --- a/packages/shared/src/connectors/metadata.ts +++ b/packages/shared/src/connectors/metadata.ts @@ -1462,7 +1462,7 @@ export const CONNECTORS_METADATA: ProvidersConfig = { 'workday': { urls: { docsUrl: 'https://apidocs.workdayspend.com/services/legacy/v3.html#tag/support', - apiUrl: "https://api.us.workdayspend.com/services" // todo other locations + apiUrl: 'https://api.us.workdayspend.com/services' // todo other locations }, logoPath: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSZTX2h9yFQ0u4ziDqvfQ224wW4N1s5JvJ5nA&s', description: 'Sync & Create contacts, deals, companies, notes, engagements, stages, tasks and users', diff --git a/packages/shared/src/envConfig.ts b/packages/shared/src/envConfig.ts index f1b92b684..cd9db5b71 100644 --- a/packages/shared/src/envConfig.ts +++ b/packages/shared/src/envConfig.ts @@ -91,7 +91,7 @@ export function needsSubdomain(provider: string, vertical: string): boolean { // Extract the provider's config const providerConfig = CONNECTORS_METADATA[vertical][provider]; - if(providerConfig.options && providerConfig.options.company_subdomain){ + if(providerConfig.options && providerConfig.options.company_subdomain) { return providerConfig.options.company_subdomain; } return false; @@ -112,7 +112,7 @@ export function needsEndUserSubdomain(provider: string, vertical: string): boole // Extract the provider's config const providerConfig = CONNECTORS_METADATA[vertical][provider]; - if(providerConfig.options && providerConfig.options.end_user_domain){ + if(providerConfig.options && providerConfig.options.end_user_domain) { return providerConfig.options.end_user_domain; } return false;