mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
⚡ Add option to get the full execution data from the server. (#1101)
This commit is contained in:
parent
c38a2f4210
commit
7aeafc9f27
|
@ -41,6 +41,7 @@ import {
|
||||||
IExecutionDeleteFilter,
|
IExecutionDeleteFilter,
|
||||||
IExecutionFlatted,
|
IExecutionFlatted,
|
||||||
IExecutionFlattedDb,
|
IExecutionFlattedDb,
|
||||||
|
IExecutionResponse,
|
||||||
IExecutionFlattedResponse,
|
IExecutionFlattedResponse,
|
||||||
IExecutionPushResponse,
|
IExecutionPushResponse,
|
||||||
IExecutionsListResponse,
|
IExecutionsListResponse,
|
||||||
|
@ -1472,16 +1473,23 @@ class App {
|
||||||
|
|
||||||
|
|
||||||
// Returns a specific execution
|
// Returns a specific execution
|
||||||
this.app.get(`/${this.restEndpoint}/executions/:id`, ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<IExecutionFlattedResponse | undefined> => {
|
this.app.get(`/${this.restEndpoint}/executions/:id`, ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<IExecutionResponse | IExecutionFlattedResponse | undefined> => {
|
||||||
const result = await Db.collections.Execution!.findOne(req.params.id);
|
const result = await Db.collections.Execution!.findOne(req.params.id);
|
||||||
|
|
||||||
if (result === undefined) {
|
if (result === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.query.unflattedResponse) {
|
||||||
|
const fullExecutionData = ResponseHelper.unflattenExecutionData(result);
|
||||||
|
return fullExecutionData as IExecutionResponse;
|
||||||
|
} else {
|
||||||
// Convert to response format in which the id is a string
|
// Convert to response format in which the id is a string
|
||||||
(result as IExecutionFlatted as IExecutionFlattedResponse).id = result.id.toString();
|
(result as IExecutionFlatted as IExecutionFlattedResponse).id = result.id.toString();
|
||||||
return result as IExecutionFlatted as IExecutionFlattedResponse;
|
return result as IExecutionFlatted as IExecutionFlattedResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue