Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Staging Deployment
on:
push:
branches:
- release/2.34.0
- release/2.35.0
workflow_dispatch:
jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sparrow-proxy",
"version": "2.34.0",
"version": "2.35.0",
"description": "",
"author": "",
"private": true,
Expand Down
4 changes: 4 additions & 0 deletions src/payloads/testflow.payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ export class NodeData {
requestData?: RequestMetaData;
}

export class TestflowDataSetRunDto{
testflowItems:TestflowRunDto[];
}

export class TestflowNodes {
@IsString()
@IsNotEmpty()
Expand Down
19 changes: 18 additions & 1 deletion src/proxy/testflow/testflow.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@nestjs/common';
import { Request, Response } from 'express';
import { TestflowService } from './testflow.service';
import { TestflowRunDto } from 'src/payloads/testflow.payload';
import { TestflowDataSetRunDto, TestflowRunDto } from 'src/payloads/testflow.payload';

@Controller('proxy/testflow')
export class TestflowController {
Expand All @@ -33,4 +33,21 @@ export class TestflowController {
);
}
}

@Post('/dataset-execute')
async testflowDataSetRun(
@Body() payload: TestflowDataSetRunDto,
@Req() req: Request,
@Res() res: Response,
) {
try {
const result = await this.testflowService.runTestflowDataset(payload);
return res.status(200).send(result);
} catch (error: any) {
throw new HttpException(
error?.message || 'Failed to run testflow',
HttpStatus.BAD_GATEWAY,
);
}
}
}
12 changes: 9 additions & 3 deletions src/proxy/testflow/testflow.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@nestjs/common';
import { TestflowNodes, TestflowRunDto, TestFlowSchedularRunHistory } from 'src/payloads/testflow.payload';
import { TestflowDataSetRunDto, TestflowNodes, TestflowRunDto, TestFlowSchedularRunHistory } from 'src/payloads/testflow.payload';
import { Logger } from '@nestjs/common';
import { success,error } from 'src/enum/httpResponseFormat';
import { DecodeTestflow, RequestData } from 'src/utils/decode-testflow';
Expand Down Expand Up @@ -470,8 +470,8 @@ export class TestflowService {
const decodeData = this._decodeRequest.init(
requestData,
environmentVariables.filter(
(env: { key: string; value: string; checked: boolean }) =>
env.key?.trim() && env.value?.trim(),
(env: { key: string; value: string | any; checked: boolean }) =>
env.key?.trim() && env?.value,
),
requestChainResponse,
);
Expand Down Expand Up @@ -692,5 +692,11 @@ export class TestflowService {
nodes: executedNodes,
};
}

async runTestflowDataset(payload: TestflowDataSetRunDto) {
const promises = payload.testflowItems.map(item => this.runTestflow(item));
const response = await Promise.all(promises);
return response;
}
}

Loading