Skip to content

Commit 5e7dd77

Browse files
Merge pull request #47 from sparrowapp-dev/release/2.35.0
Release/2.35.0 to main.
2 parents c23d147 + 5f5e660 commit 5e7dd77

File tree

5 files changed

+33
-6
lines changed

5 files changed

+33
-6
lines changed

.github/workflows/staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Staging Deployment
22
on:
33
push:
44
branches:
5-
- release/2.34.0
5+
- release/2.35.0
66
workflow_dispatch:
77
jobs:
88
build:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sparrow-proxy",
3-
"version": "2.34.0",
3+
"version": "2.35.0",
44
"description": "",
55
"author": "",
66
"private": true,

src/payloads/testflow.payload.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ export class NodeData {
210210
requestData?: RequestMetaData;
211211
}
212212

213+
export class TestflowDataSetRunDto{
214+
testflowItems:TestflowRunDto[];
215+
}
216+
213217
export class TestflowNodes {
214218
@IsString()
215219
@IsNotEmpty()

src/proxy/testflow/testflow.controller.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '@nestjs/common';
1010
import { Request, Response } from 'express';
1111
import { TestflowService } from './testflow.service';
12-
import { TestflowRunDto } from 'src/payloads/testflow.payload';
12+
import { TestflowDataSetRunDto, TestflowRunDto } from 'src/payloads/testflow.payload';
1313

1414
@Controller('proxy/testflow')
1515
export class TestflowController {
@@ -33,4 +33,21 @@ export class TestflowController {
3333
);
3434
}
3535
}
36+
37+
@Post('/dataset-execute')
38+
async testflowDataSetRun(
39+
@Body() payload: TestflowDataSetRunDto,
40+
@Req() req: Request,
41+
@Res() res: Response,
42+
) {
43+
try {
44+
const result = await this.testflowService.runTestflowDataset(payload);
45+
return res.status(200).send(result);
46+
} catch (error: any) {
47+
throw new HttpException(
48+
error?.message || 'Failed to run testflow',
49+
HttpStatus.BAD_GATEWAY,
50+
);
51+
}
52+
}
3653
}

src/proxy/testflow/testflow.service.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@nestjs/common';
2-
import { TestflowNodes, TestflowRunDto, TestFlowSchedularRunHistory } from 'src/payloads/testflow.payload';
2+
import { TestflowDataSetRunDto, TestflowNodes, TestflowRunDto, TestFlowSchedularRunHistory } from 'src/payloads/testflow.payload';
33
import { Logger } from '@nestjs/common';
44
import { success,error } from 'src/enum/httpResponseFormat';
55
import { DecodeTestflow, RequestData } from 'src/utils/decode-testflow';
@@ -470,8 +470,8 @@ export class TestflowService {
470470
const decodeData = this._decodeRequest.init(
471471
requestData,
472472
environmentVariables.filter(
473-
(env: { key: string; value: string; checked: boolean }) =>
474-
env.key?.trim() && env.value?.trim(),
473+
(env: { key: string; value: string | any; checked: boolean }) =>
474+
env.key?.trim() && env?.value,
475475
),
476476
requestChainResponse,
477477
);
@@ -692,5 +692,11 @@ export class TestflowService {
692692
nodes: executedNodes,
693693
};
694694
}
695+
696+
async runTestflowDataset(payload: TestflowDataSetRunDto) {
697+
const promises = payload.testflowItems.map(item => this.runTestflow(item));
698+
const response = await Promise.all(promises);
699+
return response;
700+
}
695701
}
696702

0 commit comments

Comments
 (0)