Allow to use execute command with workflows that do not have an ID

This commit is contained in:
Jan Oberhauser
2022-01-16 14:04:42 +01:00
parent ba6822c4ac
commit 7efb73053d
2 changed files with 9 additions and 3 deletions

View File

@@ -2,7 +2,12 @@
/* eslint-disable no-console */
import { promises as fs } from 'fs';
import { Command, flags } from '@oclif/command';
import { BinaryDataManager, IBinaryDataConfig, UserSettings } from 'n8n-core';
import {
BinaryDataManager,
IBinaryDataConfig,
UserSettings,
PLACEHOLDER_EMPTY_WORKFLOW_ID,
} from 'n8n-core';
import { INode, LoggerProxy } from 'n8n-workflow';
import {
@@ -96,8 +101,8 @@ export class Execute extends Command {
console.info(`The file "${flags.file}" does not contain valid workflow data.`);
return;
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
workflowId = workflowData.id!.toString();
workflowId = workflowData.id ? workflowData.id.toString() : PLACEHOLDER_EMPTY_WORKFLOW_ID;
}
// Wait till the database is ready