-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
702 changed files
with
2,960 additions
and
4,546 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...rc/@core/encryption/encryption.service.ts → ...services/encryption/encryption.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
packages/api/src/@core/@core-services/queues/queue.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { BullModule } from '@nestjs/bull'; | ||
import { BullQueueService } from './shared.service'; | ||
import { Queues } from './types'; | ||
|
||
@Module({ | ||
imports: [ | ||
BullModule.registerQueue( | ||
{ | ||
name: Queues.REMOTE_REAL_TIME_WEBHOOKS_RECEIVER, | ||
}, | ||
{ | ||
name: Queues.PANORA_WEBHOOKS_SENDER, | ||
}, | ||
{ | ||
name: Queues.SYNC_JOBS_WORKER, | ||
}, | ||
), | ||
], | ||
providers: [BullQueueService], | ||
exports: [BullQueueService], | ||
}) | ||
export class BullQueueModule {} |
44 changes: 44 additions & 0 deletions
44
packages/api/src/@core/@core-services/queues/shared.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { InjectQueue } from '@nestjs/bull'; | ||
import { Queue } from 'bull'; | ||
import { Queues } from './types'; | ||
|
||
@Injectable() | ||
export class BullQueueService { | ||
constructor( | ||
@InjectQueue(Queues.REMOTE_REAL_TIME_WEBHOOKS_RECEIVER) | ||
public readonly realTimeWebhookQueue: Queue, | ||
@InjectQueue(Queues.PANORA_WEBHOOKS_SENDER) | ||
public readonly panoraWebhookDeliveryQueue: Queue, | ||
@InjectQueue(Queues.SYNC_JOBS_WORKER) | ||
public readonly syncJobsQueue: Queue, | ||
) {} | ||
|
||
// getters | ||
|
||
getRealtimeWebhookReceiver() { | ||
return this.realTimeWebhookQueue; | ||
} | ||
getPanoraWebhookSender() { | ||
return this.panoraWebhookDeliveryQueue; | ||
} | ||
|
||
// setters | ||
async queueSyncJob(jobName: string, cron: string) { | ||
const jobs = await this.syncJobsQueue.getRepeatableJobs(); | ||
for (const job of jobs) { | ||
if (job.name === jobName) { | ||
await this.syncJobsQueue.removeRepeatableByKey(job.key); | ||
} | ||
} | ||
// Add new job with the job name | ||
await this.syncJobsQueue.add( | ||
jobName, | ||
{}, | ||
{ | ||
repeat: { cron }, | ||
jobId: jobName, // Using jobId to identify repeatable jobs | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export enum Queues { | ||
REMOTE_REAL_TIME_WEBHOOKS_RECEIVER = 'REMOTE_REAL_TIME_WEBHOOKS_RECEIVER', // Queue receives real time webhooks coming from remote 3rd parties | ||
PANORA_WEBHOOKS_SENDER = 'PANORA_WEBHOOKS_SENDER', // Queue sends Panora webhooks to clients listening for important events | ||
SYNC_JOBS_WORKER = 'SYNC_JOBS_WORKER', // Queue which syncs data from remote 3rd parties | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/api/src/@core/@core-services/registries/connections-categories.registry.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { IConnectionCategory } from '@@core/connections/@utils/types'; | ||
|
||
@Injectable() | ||
export class CategoryConnectionRegistry<T = IConnectionCategory> { | ||
private serviceMap: Map<string, T>; | ||
|
||
constructor() { | ||
this.serviceMap = new Map<string, T>(); | ||
} | ||
|
||
registerService(serviceKey: string, service: T) { | ||
this.serviceMap.set(serviceKey, service); | ||
} | ||
|
||
getService(category: string): T { | ||
const service = this.serviceMap.get(category); | ||
if (!service) { | ||
throw new Error(); | ||
} | ||
return service; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...re/utils/registry/unification.registry.ts → ...rvices/registries/unification.registry.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
25 changes: 9 additions & 16 deletions
25
.../src/@core/utils/services/core.service.ts → ...s/unification/core-unification.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 4 additions & 15 deletions
19
...s/api/src/@core/webhook/webhook.module.ts → ...ebhooks/panora-webhooks/webhook.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
...pi/src/@core/webhook/webhook.processor.ts → ...ooks/panora-webhooks/webhook.processor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
...-webhooks/handler/mw-handler.processor.ts → ...-webhooks/handler/mw-handler.processor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
...d-webhooks/managed-webhooks.controller.ts → ...s-webhooks/managed-webhooks.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.