refactor(core): Add more overloads for string-type node parameters (no-changelog) (#5101)

* refactor(core): Add more overloads for string-type node parameter (no-changelog)

continued from https://github.com/n8n-io/n8n/pull/4797

* include binaryPropertyOutput
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-01-06 15:09:32 +01:00
committed by GitHub
parent c97f3cad59
commit 1acc7fea89
53 changed files with 98 additions and 131 deletions

View File

@@ -105,7 +105,7 @@ const items = this.getInputData();
for (const i = 0; i < items.length; i++) {
const item = items[i].binary as IBinaryKeyData;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const binaryData = item[binaryPropertyName] as IBinaryData;
// Before 0.135.0:
const binaryDataBuffer = Buffer.from(binaryData.data, BINARY_ENCODING);

View File

@@ -415,7 +415,7 @@ export class AwsRekognition implements INodeType {
const binaryData = this.getNodeParameter('binaryData', 0);
if (binaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', {

View File

@@ -608,10 +608,7 @@ export class AwsS3 implements INodeType {
items[i] = newItem;
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
const data = Buffer.from(response.body as string, 'utf8');
@@ -806,7 +803,7 @@ export class AwsS3 implements INodeType {
const region = responseData.LocationConstraint._;
if (isBinaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', {

View File

@@ -120,7 +120,7 @@ export class AwsTextract implements INodeType {
try {
//https://docs.aws.amazon.com/textract/latest/dg/API_AnalyzeExpense.html
if (operation === 'analyzeExpense') {
const binaryProperty = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryProperty = this.getNodeParameter('binaryPropertyName', i);
const simple = this.getNodeParameter('simple', i) as boolean;
if (items[i].binary === undefined) {

View File

@@ -19,7 +19,7 @@ export async function upload(this: IExecuteFunctions, index: number) {
});
}
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', index) as string;
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', index);
if (items[index]!.binary![propertyNameUpload] === undefined) {
throw new NodeOperationError(

View File

@@ -19,7 +19,7 @@ export async function upload(this: IExecuteFunctions, index: number) {
});
}
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', index) as string;
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', index);
if (items[index]!.binary![propertyNameUpload] === undefined) {
throw new NodeOperationError(

View File

@@ -114,10 +114,7 @@ export class Box implements INodeType {
// https://developer.box.com/reference/get-files-id-content
if (operation === 'download') {
const fileId = this.getNodeParameter('fileId', i) as string;
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
responseData = await boxApiRequest.call(this, 'GET', `/files/${fileId}`);
const fileName = responseData.name;
@@ -280,7 +277,7 @@ export class Box implements INodeType {
}
if (isBinaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', {

View File

@@ -513,7 +513,7 @@ export class CiscoWebex implements INodeType {
// if (operation === 'download') {
// for (let i = 0; i < items.length; i++) {
// const transcriptId = this.getNodeParameter('transcriptId', i) as string;
// const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
// const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
// const meetingId = this.getNodeParameter('meetingId', i) as string;
// const options = this.getNodeParameter('options', i);

View File

@@ -185,7 +185,7 @@ export class Compression implements INodeType {
for (let i = 0; i < length; i++) {
try {
if (operation === 'decompress') {
const binaryPropertyNames = (this.getNodeParameter('binaryPropertyName', 0) as string)
const binaryPropertyNames = this.getNodeParameter('binaryPropertyName', 0)
.split(',')
.map((key) => key.trim());
@@ -256,7 +256,7 @@ export class Compression implements INodeType {
}
if (operation === 'compress') {
const binaryPropertyNames = (this.getNodeParameter('binaryPropertyName', 0) as string)
const binaryPropertyNames = this.getNodeParameter('binaryPropertyName', 0)
.split(',')
.map((key) => key.trim());
@@ -308,7 +308,7 @@ export class Compression implements INodeType {
if (outputFormat === 'zip') {
const fileName = this.getNodeParameter('fileName', 0) as string;
const binaryPropertyOutput = this.getNodeParameter('binaryPropertyOutput', 0) as string;
const binaryPropertyOutput = this.getNodeParameter('binaryPropertyOutput', 0);
const buffer = await zip(zipData);

View File

@@ -201,7 +201,7 @@ export class Cortex implements INodeType {
});
}
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
if (item.binary[binaryPropertyName] === undefined) {
throw new NodeOperationError(

View File

@@ -434,12 +434,12 @@ export class Crypto implements INodeType {
for (let i = 0; i < length; i++) {
try {
item = items[i];
const dataPropertyName = this.getNodeParameter('dataPropertyName', i) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', i);
const value = this.getNodeParameter('value', i, '') as string;
let newValue;
if (action === 'generate') {
const encodingType = this.getNodeParameter('encodingType', i) as string;
const encodingType = this.getNodeParameter('encodingType', i);
if (encodingType === 'uuid') {
newValue = uuid();
} else {

View File

@@ -376,7 +376,7 @@ export class DateTime implements INodeType {
if (action === 'format') {
const currentDate = this.getNodeParameter('value', i) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', i) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', i);
const toFormat = this.getNodeParameter('toFormat', i) as string;
const options = this.getNodeParameter('options', i);
let newDate;
@@ -461,7 +461,7 @@ export class DateTime implements INodeType {
const duration = this.getNodeParameter('duration', i) as number;
const timeUnit = this.getNodeParameter('timeUnit', i) as moment.DurationInputArg2;
const { fromFormat } = this.getNodeParameter('options', i) as { fromFormat?: string };
const dataPropertyName = this.getNodeParameter('dataPropertyName', i) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', i);
const newDate = fromFormat
? parseDateByFormat.call(this, dateValue, fromFormat)

View File

@@ -769,7 +769,7 @@ export class Dropbox implements INodeType {
});
}
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string;
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i);
if (item.binary[propertyNameUpload] === undefined) {
throw new NodeOperationError(
@@ -954,7 +954,7 @@ export class Dropbox implements INodeType {
items[i] = newItem;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
const filePathDownload = this.getNodeParameter('path', i) as string;
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(

View File

@@ -986,7 +986,7 @@ export class EditImage implements INodeType {
item = items[itemIndex];
const operation = this.getNodeParameter('operation', itemIndex);
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex);
const options = this.getNodeParameter('options', itemIndex, {});

View File

@@ -374,10 +374,7 @@ export class FacebookGraphApi implements INodeType {
});
}
const binaryPropertyNameFull = this.getNodeParameter(
'binaryPropertyName',
itemIndex,
) as string;
const binaryPropertyNameFull = this.getNodeParameter('binaryPropertyName', itemIndex);
let propertyName = 'file';
let binaryPropertyName = binaryPropertyNameFull;

View File

@@ -518,10 +518,7 @@ export class Ftp implements INodeType {
responseData = await sftp!.get(path);
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
const filePathDownload = this.getNodeParameter('path', i) as string;
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
@@ -546,7 +543,7 @@ export class Ftp implements INodeType {
});
}
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string;
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i);
if (item.binary[propertyNameUpload] === undefined) {
throw new NodeOperationError(
@@ -619,10 +616,7 @@ export class Ftp implements INodeType {
// @ts-ignore
responseData = Buffer.concat(chunks);
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
const filePathDownload = this.getNodeParameter('path', i) as string;
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
@@ -658,7 +652,7 @@ export class Ftp implements INodeType {
});
}
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string;
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i);
if (item.binary[propertyNameUpload] === undefined) {
throw new NodeOperationError(

View File

@@ -1687,7 +1687,7 @@ export class Github implements INodeType {
requestMethod = 'PUT';
const filePath = this.getNodeParameter('filePath', i) as string;
const filePath = this.getNodeParameter('filePath', i);
const additionalParameters = this.getNodeParameter(
'additionalParameters',
@@ -1731,7 +1731,7 @@ export class Github implements INodeType {
});
}
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
if (item.binary[binaryPropertyName] === undefined) {
throw new NodeOperationError(
@@ -1778,7 +1778,7 @@ export class Github implements INodeType {
body.branch = (additionalParameters.branch as IDataObject).branch;
}
const filePath = this.getNodeParameter('filePath', i) as string;
const filePath = this.getNodeParameter('filePath', i);
body.message = this.getNodeParameter('commitMessage', i) as string;
body.sha = await getFileSha.call(
@@ -1793,7 +1793,7 @@ export class Github implements INodeType {
} else if (operation === 'get') {
requestMethod = 'GET';
const filePath = this.getNodeParameter('filePath', i) as string;
const filePath = this.getNodeParameter('filePath', i);
const additionalParameters = this.getNodeParameter(
'additionalParameters',
i,
@@ -1806,7 +1806,7 @@ export class Github implements INodeType {
endpoint = `/repos/${owner}/${repository}/contents/${encodeURI(filePath)}`;
} else if (operation === 'list') {
requestMethod = 'GET';
const filePath = this.getNodeParameter('filePath', i) as string;
const filePath = this.getNodeParameter('filePath', i);
endpoint = `/repos/${owner}/${repository}/contents/${encodeURI(filePath)}`;
}
} else if (resource === 'issue') {
@@ -2117,7 +2117,7 @@ export class Github implements INodeType {
});
}
// Add the returned data to the item as binary property
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const newItem: INodeExecutionData = {
json: items[i].json,

View File

@@ -243,7 +243,7 @@ export class GoogleChat implements INodeType {
items[i] = newItem;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
items[i].binary![binaryPropertyName] = await this.helpers.prepareBinaryData(
responseData,

View File

@@ -2392,10 +2392,7 @@ export class GoogleDrive implements INodeType {
items[i] = newItem;
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
response.body as unknown as Readable,
@@ -2521,7 +2518,7 @@ export class GoogleDrive implements INodeType {
});
}
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string;
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i);
const binary = item.binary[propertyNameUpload];
if (binary === undefined) {

View File

@@ -426,7 +426,7 @@ export class GraphQL implements INodeType {
response = await this.helpers.request(requestOptions);
}
if (responseFormat === 'string') {
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
returnItems.push({
json: {
[dataPropertyName]: response,

View File

@@ -392,10 +392,7 @@ export class HomeAssistant implements INodeType {
} else if (resource === 'cameraProxy') {
if (operation === 'getScreenshot') {
const cameraEntityId = this.getNodeParameter('cameraEntityId', i) as string;
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
const endpoint = `/camera_proxy/${cameraEntityId}`;
let mimeType: string | undefined;

View File

@@ -214,7 +214,7 @@ export class HtmlExtract implements INodeType {
let item: INodeExecutionData;
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
try {
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex);
const extractionValues = this.getNodeParameter(
'extractionValues',
itemIndex,

View File

@@ -746,10 +746,7 @@ export class HttpRequestV1 implements INodeType {
}
if (options.bodyContentType === 'raw') {
const binaryPropertyName = this.getNodeParameter(
'binaryPropertyName',
itemIndex,
) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex);
if (item.binary[binaryPropertyName] === undefined) {
throw new NodeOperationError(
this.getNode(),
@@ -768,7 +765,7 @@ export class HttpRequestV1 implements INodeType {
const binaryPropertyNameFull = this.getNodeParameter(
'binaryPropertyName',
itemIndex,
) as string;
);
const binaryPropertyNames = binaryPropertyNameFull
.split(',')
.map((key) => key.trim());
@@ -1012,7 +1009,7 @@ export class HttpRequestV1 implements INodeType {
const fullResponse = !!options.fullResponse;
if (responseFormat === 'file') {
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
const newItem: INodeExecutionData = {
json: {},
@@ -1058,7 +1055,7 @@ export class HttpRequestV1 implements INodeType {
returnItems.push(newItem);
} else if (responseFormat === 'string') {
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
if (fullResponse) {
const returnItem: IDataObject = {};

View File

@@ -785,10 +785,7 @@ export class HttpRequestV2 implements INodeType {
}
if (options.bodyContentType === 'raw') {
const binaryPropertyName = this.getNodeParameter(
'binaryPropertyName',
itemIndex,
) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex);
if (item.binary[binaryPropertyName] === undefined) {
throw new NodeOperationError(
this.getNode(),
@@ -807,7 +804,7 @@ export class HttpRequestV2 implements INodeType {
const binaryPropertyNameFull = this.getNodeParameter(
'binaryPropertyName',
itemIndex,
) as string;
);
const binaryPropertyNames = binaryPropertyNameFull
.split(',')
.map((key) => key.trim());
@@ -1065,7 +1062,7 @@ export class HttpRequestV2 implements INodeType {
const fullResponse = !!options.fullResponse;
if (responseFormat === 'file') {
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
const newItem: INodeExecutionData = {
json: {},
@@ -1111,7 +1108,7 @@ export class HttpRequestV2 implements INodeType {
returnItems.push(newItem);
} else if (responseFormat === 'string') {
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
if (fullResponse) {
const returnItem: IDataObject = {};

View File

@@ -70,7 +70,7 @@ export class HumanticAi implements INodeType {
qs.userid = userId;
if (sendResume) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', {
@@ -143,7 +143,7 @@ export class HumanticAi implements INodeType {
qs.userid = userId;
if (sendResume) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', {

View File

@@ -308,7 +308,7 @@ export class ICalendar implements INodeType {
const start = this.getNodeParameter('start', i) as string;
let end = this.getNodeParameter('end', i) as string;
end = allDay ? moment(end).utc().add(1, 'day').format() : end;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const additionalFields = this.getNodeParameter('additionalFields', i);
let fileName = 'event.ics';

View File

@@ -975,7 +975,7 @@ export class Jira implements INodeType {
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post
if (operation === 'add') {
for (let i = 0; i < length; i++) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const issueKey = this.getNodeParameter('issueKey', i) as string;
if (items[i].binary === undefined) {

View File

@@ -827,7 +827,7 @@ export class Keap implements INodeType {
body.contact_id = contactId;
}
if (binaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', {

View File

@@ -400,7 +400,7 @@ export class KoBoToolbox implements INodeType {
];
if (responseData?.[0] && download) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const binaryItem: INodeExecutionData = {
json: responseData[0],
@@ -441,7 +441,7 @@ export class KoBoToolbox implements INodeType {
};
if ('binary' === fileMode) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const item = items[i].binary as IBinaryKeyData;
const binaryData = item[binaryPropertyName];

View File

@@ -146,7 +146,7 @@ export class LinkedIn implements INodeType {
});
}
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string;
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i);
if (item.binary[propertyNameUpload] === undefined) {
throw new NodeOperationError(

View File

@@ -184,7 +184,7 @@ export async function handleMatrixCall(
if (operation === 'upload') {
const roomId = this.getNodeParameter('roomId', index) as string;
const mediaType = this.getNodeParameter('mediaType', index) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', index) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', index);
let body;
const qs: IDataObject = {};

View File

@@ -104,10 +104,7 @@ export class MicrosoftOneDrive implements INodeType {
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_children?view=odsp-graph-online
if (operation === 'download') {
const fileId = this.getNodeParameter('fileId', i) as string;
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
responseData = await microsoftApiRequest.call(this, 'GET', `/drive/items/${fileId}`);
const fileName = responseData.name;
@@ -199,7 +196,7 @@ export class MicrosoftOneDrive implements INodeType {
const fileName = this.getNodeParameter('fileName', i) as string;
if (isBinaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', {

View File

@@ -370,10 +370,7 @@ export class MicrosoftOutlook implements INodeType {
for (let i = 0; i < length; i++) {
try {
const messageId = this.getNodeParameter('messageId', i) as string;
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
const response = await microsoftApiRequest.call(
this,
'GET',
@@ -557,7 +554,7 @@ export class MicrosoftOutlook implements INodeType {
for (let i = 0; i < length; i++) {
try {
const messageId = this.getNodeParameter('messageId', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
const additionalFields = this.getNodeParameter('additionalFields', i);
if (items[i].binary === undefined) {
@@ -667,10 +664,7 @@ export class MicrosoftOutlook implements INodeType {
try {
const messageId = this.getNodeParameter('messageId', i) as string;
const attachmentId = this.getNodeParameter('attachmentId', i) as string;
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
// Get attachment details first
const attachmentDetails = await microsoftApiRequest.call(

View File

@@ -160,7 +160,7 @@ export class Mindee implements INodeType {
try {
if (resource === 'receipt') {
if (operation === 'predict') {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const rawData = this.getNodeParameter('rawData', i);
@@ -231,7 +231,7 @@ export class Mindee implements INodeType {
if (resource === 'invoice') {
if (operation === 'predict') {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const rawData = this.getNodeParameter('rawData', i);

View File

@@ -1050,7 +1050,7 @@ export class Nasa implements INodeType {
}
if (resource === 'earthImagery') {
const binaryProperty = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryProperty = this.getNodeParameter('binaryPropertyName', i);
const data = await nasaApiRequest.call(this, 'GET', endpoint, qs, { encoding: null });
@@ -1072,7 +1072,7 @@ export class Nasa implements INodeType {
download = this.getNodeParameter('download', 0);
if (download) {
const binaryProperty = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryProperty = this.getNodeParameter('binaryPropertyName', i);
const data = await nasaApiRequest.call(
this,

View File

@@ -911,7 +911,7 @@ export class NextCloud implements INodeType {
});
}
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string;
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i);
if (item.binary[propertyNameUpload] === undefined) {
throw new NodeOperationError(
@@ -1144,7 +1144,7 @@ export class NextCloud implements INodeType {
items[i] = newItem;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
items[i].binary![binaryPropertyName] = await this.helpers.prepareBinaryData(
responseData,

View File

@@ -4345,7 +4345,7 @@ export class Pipedrive implements INodeType {
});
}
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
if (item.binary[binaryPropertyName] === undefined) {
throw new NodeOperationError(
@@ -4847,7 +4847,7 @@ export class Pipedrive implements INodeType {
items[i] = newItem;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
items[i].binary![binaryPropertyName] = await this.helpers.prepareBinaryData(
responseData.data,

View File

@@ -407,7 +407,7 @@ export class Pushbullet implements INodeType {
}
if (type === 'file') {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!');

View File

@@ -208,7 +208,7 @@ export class QuickBase implements INodeType {
items[i] = newItem;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
responseData = await quickbaseApiRequest.call(
this,

View File

@@ -61,9 +61,9 @@ export class ReadBinaryFile implements INodeType {
Object.assign(newItem.binary, item.binary);
}
const filePath = this.getNodeParameter('filePath', itemIndex) as string;
const filePath = this.getNodeParameter('filePath', itemIndex);
const stream = await this.helpers.createReadStream(filePath);
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex);
newItem.binary![dataPropertyName] = await this.helpers.prepareBinaryData(stream, filePath);
returnData.push(newItem);
} catch (error) {

View File

@@ -39,7 +39,7 @@ export class ReadBinaryFiles implements INodeType {
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const fileSelector = this.getNodeParameter('fileSelector', 0) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
const files = await glob(fileSelector);

View File

@@ -41,7 +41,7 @@ export class ReadPDF implements INodeType {
for (let itemIndex = 0; itemIndex < length; itemIndex++) {
try {
item = items[itemIndex];
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex);
if (item.binary === undefined) {
item.binary = {};

View File

@@ -626,10 +626,7 @@ export class S3 implements INodeType {
items[i] = newItem;
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
const data = Buffer.from(response.body as string, 'utf8');
@@ -835,7 +832,7 @@ export class S3 implements INodeType {
const region = responseData.LocationConstraint._;
if (isBinaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', {

View File

@@ -1834,7 +1834,7 @@ export class Salesforce implements INodeType {
if (operation === 'upload') {
const title = this.getNodeParameter('title', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i);
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
let data;
const body: { entity_content: { [key: string]: string } } = {
entity_content: {
@@ -2852,7 +2852,7 @@ export class Salesforce implements INodeType {
const name = this.getNodeParameter('name', i) as string;
const parentId = this.getNodeParameter('parentId', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i);
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const body: IAttachment = {
Name: name,
ParentId: parentId,

View File

@@ -242,7 +242,7 @@ export class SecurityScorecard implements INodeType {
items[i] = newItem;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
const fileName = reportUrl.split('/').pop();

View File

@@ -1092,7 +1092,7 @@ export class Slack implements INodeType {
body.title = options.title as string;
}
if (binaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
if (
items[i].binary === undefined ||
//@ts-ignore

View File

@@ -308,7 +308,7 @@ export class SpreadsheetFile implements INodeType {
try {
item = items[i];
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const options = this.getNodeParameter('options', i, {});
if (item.binary === undefined || item.binary[binaryPropertyName] === undefined) {
@@ -413,7 +413,7 @@ export class SpreadsheetFile implements INodeType {
} else if (operation === 'toFile') {
try {
// Write the workflow data to spreadsheet file
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
const fileFormat = this.getNodeParameter('fileFormat', 0) as string;
const options = this.getNodeParameter('options', 0, {});
const sheetToJsonOptions: JSON2SheetOpts = {};

View File

@@ -302,10 +302,7 @@ export class Ssh implements INodeType {
if (resource === 'file') {
if (operation === 'download') {
const dataPropertyNameDownload = this.getNodeParameter(
'binaryPropertyName',
i,
) as string;
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
const parameterPath = this.getNodeParameter('path', i) as string;
const { path } = await file({ prefix: 'n8n-ssh-' });
@@ -350,7 +347,7 @@ export class Ssh implements INodeType {
});
}
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string;
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i);
const binaryData = item.binary[propertyNameUpload];

View File

@@ -1960,7 +1960,7 @@ export class Telegram implements INodeType {
let responseData;
if (binaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
const itemBinaryData = items[i].binary![binaryPropertyName];
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
const propertyName = getPropertyName(operation);

View File

@@ -69,7 +69,7 @@ export class WriteBinaryFile implements INodeType {
for (let itemIndex = 0; itemIndex < length; itemIndex++) {
try {
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex);
const fileName = this.getNodeParameter('fileName', itemIndex) as string;
const options = this.getNodeParameter('options', 0, {});

View File

@@ -220,7 +220,7 @@ export class Xml implements INodeType {
const items = this.getInputData();
const mode = this.getNodeParameter('mode', 0) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0) as string;
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
const options = this.getNodeParameter('options', 0, {});
let item: INodeExecutionData;

View File

@@ -192,7 +192,7 @@ export class Zulip implements INodeType {
//https://zulipchat.com/api/upload-file
if (operation === 'updateFile') {
const credentials = await this.getCredentials('zulipApi');
const binaryProperty = this.getNodeParameter('dataBinaryProperty', i) as string;
const binaryProperty = this.getNodeParameter('dataBinaryProperty', i);
if (items[i].binary === undefined) {
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!');
}

View File

@@ -560,7 +560,16 @@ export interface IGetNodeParameterOptions {
namespace ExecuteFunctions {
namespace StringReturning {
export type NodeParameter = 'binaryProperty' | 'resource' | 'operation';
export type NodeParameter =
| 'binaryProperty'
| 'binaryPropertyName'
| 'binaryPropertyOutput'
| 'dataPropertyName'
| 'dataBinaryProperty'
| 'resource'
| 'operation'
| 'filePath'
| 'encodingType';
}
namespace NumberReturning {