Skip to content

Commit

Permalink
refactor: Remove cli/src/helpers (no-changelog) (#9368)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov authored May 13, 2024
1 parent 359ade4 commit 4d2115c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
20 changes: 18 additions & 2 deletions packages/cli/src/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import type Bull from 'bull';
import { Service } from 'typedi';
import {
ApplicationError,
BINARY_ENCODING,
type IDataObject,
type ExecutionError,
type IExecuteResponsePromiseData,
} from 'n8n-workflow';
import { ActiveExecutions } from '@/ActiveExecutions';
import { decodeWebhookResponse } from '@/helpers/decodeWebhookResponse';

import {
getRedisClusterClient,
Expand Down Expand Up @@ -68,11 +69,26 @@ export class Queue {
this.jobQueue.on('global:progress', (jobId, progress: WebhookResponse) => {
this.activeExecutions.resolveResponsePromise(
progress.executionId,
decodeWebhookResponse(progress.response),
this.decodeWebhookResponse(progress.response),
);
});
}

decodeWebhookResponse(response: IExecuteResponsePromiseData): IExecuteResponsePromiseData {
if (
typeof response === 'object' &&
typeof response.body === 'object' &&
(response.body as IDataObject)['__@N8nEncodedBuffer@__']
) {
response.body = Buffer.from(
(response.body as IDataObject)['__@N8nEncodedBuffer@__'] as string,
BINARY_ENCODING,
);
}

return response;
}

async add(jobData: JobData, jobOptions: object): Promise<Job> {
return await this.jobQueue.add(jobData, jobOptions);
}
Expand Down
18 changes: 0 additions & 18 deletions packages/cli/src/helpers/decodeWebhookResponse.ts

This file was deleted.

0 comments on commit 4d2115c

Please sign in to comment.