add some TODOs

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-10-27 16:39:20 +01:00
parent 7230788438
commit c9a3858330
No known key found for this signature in database

View file

@ -1050,24 +1050,22 @@ export async function httpRequest(
return result.data; return result.data;
} }
// TODO: DELETE THIS
export function getBinaryPath(binaryDataId: string): string { export function getBinaryPath(binaryDataId: string): string {
throw new Error('Not implemented'); throw new Error('Not implemented');
} }
/** // TODO: DELETE THIS
* Returns binary file metadata
*/
export async function getBinaryMetadata(binaryDataId: string): Promise<BinaryData.Metadata> { export async function getBinaryMetadata(binaryDataId: string): Promise<BinaryData.Metadata> {
throw new Error('Not implemented'); throw new Error('Not implemented');
} }
/** // TODO: DELETE THIS
* Returns binary file stream for piping
*/
export async function getBinaryStream(binaryDataId: string, chunkSize?: number): Promise<Readable> { export async function getBinaryStream(binaryDataId: string, chunkSize?: number): Promise<Readable> {
throw new Error('Not implemented'); throw new Error('Not implemented');
} }
// TODO: Move to BinaryHelpers
export function assertBinaryData( export function assertBinaryData(
inputData: ITaskDataConnections, inputData: ITaskDataConnections,
node: INode, node: INode,
@ -1103,9 +1101,7 @@ export function assertBinaryData(
return binaryPropertyData; return binaryPropertyData;
} }
/** // TODO: Move to BinaryHelpers
* Returns binary data buffer for given item index and property name.
*/
export async function getBinaryDataBuffer( export async function getBinaryDataBuffer(
inputData: ITaskDataConnections, inputData: ITaskDataConnections,
itemIndex: number, itemIndex: number,
@ -1116,14 +1112,7 @@ export async function getBinaryDataBuffer(
return await Container.get(BinaryDataService).getAsBuffer(binaryData); return await Container.get(BinaryDataService).getAsBuffer(binaryData);
} }
/** // TODO: Move to BinaryHelpers
* Store an incoming IBinaryData & related buffer using the configured binary data manager.
*
* @export
* @param {IBinaryData} binaryData
* @param {Buffer | Readable} bufferOrStream
* @returns {Promise<IBinaryData>}
*/
export async function setBinaryDataBuffer( export async function setBinaryDataBuffer(
binaryData: IBinaryData, binaryData: IBinaryData,
bufferOrStream: Buffer | Readable, bufferOrStream: Buffer | Readable,
@ -1133,6 +1122,7 @@ export async function setBinaryDataBuffer(
throw new Error('Not implemented'); throw new Error('Not implemented');
} }
// TODO: Move to BinaryHelpers
export async function copyBinaryFile( export async function copyBinaryFile(
workflowId: string, workflowId: string,
executionId: string, executionId: string,
@ -1192,11 +1182,7 @@ export async function copyBinaryFile(
); );
} }
/** // TODO: Move to BinaryHelpers
* Takes a buffer and converts it into the format n8n uses. It encodes the binary data as
* base64 and adds metadata.
*/
// eslint-disable-next-line complexity
export async function prepareBinaryData( export async function prepareBinaryData(
binaryData: Buffer | Readable, binaryData: Buffer | Readable,
executionId: string, executionId: string,
@ -1295,12 +1281,7 @@ export function applyPaginationRequestData(
return merge({}, requestData, preparedPaginationData); return merge({}, requestData, preparedPaginationData);
} }
/** // TODO: Move to RequestHelpers
* Makes a request using OAuth data for authentication
*
* @param {(IHttpRequestOptions | IRequestOptions)} requestOptions
*
*/
export async function requestOAuth2( export async function requestOAuth2(
context: IAllExecuteFunctions, context: IAllExecuteFunctions,
credentialsType: string, credentialsType: string,
@ -1540,9 +1521,7 @@ export async function requestOAuth2(
}); });
} }
/** // TODO: Move to RequestHelpers
* Makes a request using OAuth1 data for authentication
*/
export async function requestOAuth1( export async function requestOAuth1(
context: IAllExecuteFunctions, context: IAllExecuteFunctions,
credentialsType: string, credentialsType: string,
@ -1615,6 +1594,7 @@ export async function requestOAuth1(
}); });
} }
// TODO: Move to RequestHelpers
export async function httpRequestWithAuthentication( export async function httpRequestWithAuthentication(
context: IAllExecuteFunctions, context: IAllExecuteFunctions,
credentialsType: string, credentialsType: string,
@ -1725,6 +1705,7 @@ export async function httpRequestWithAuthentication(
} }
} }
// TODO: Move to BaseHelpers
export function returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[] { export function returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[] {
const returnData: INodeExecutionData[] = []; const returnData: INodeExecutionData[] = [];
@ -1766,6 +1747,7 @@ export function constructExecutionMetaData(
* *
* @param {INodeExecutionData | INodeExecutionData[]} executionData * @param {INodeExecutionData | INodeExecutionData[]} executionData
*/ */
// TODO: Create a new CodeExecutionContext that extends ExecutionContext, and move there
export function normalizeItems( export function normalizeItems(
executionData: INodeExecutionData | INodeExecutionData[], executionData: INodeExecutionData | INodeExecutionData[],
): INodeExecutionData[] { ): INodeExecutionData[] {
@ -1805,7 +1787,7 @@ export function normalizeItems(
}); });
} }
// TODO: Move up later // TODO: Move to RequestHelpers
export async function requestWithAuthentication( export async function requestWithAuthentication(
context: IAllExecuteFunctions, context: IAllExecuteFunctions,
credentialsType: string, credentialsType: string,
@ -1966,8 +1948,9 @@ export function getAdditionalKeys(
$vars: additionalData.variables, $vars: additionalData.variables,
$secrets: options?.secretsEnabled ? getSecretsProxy(additionalData) : undefined, $secrets: options?.secretsEnabled ? getSecretsProxy(additionalData) : undefined,
// deprecated /** @deprecated */
$executionId: executionId, $executionId: executionId,
/** @deprecated */
$resumeWebhookUrl: resumeUrl, $resumeWebhookUrl: resumeUrl,
}; };
} }
@ -1979,6 +1962,8 @@ export function getAdditionalKeys(
* @param {INode} node Node which request the data * @param {INode} node Node which request the data
* @param {string} type The credential type to return * @param {string} type The credential type to return
*/ */
// TODO: Move to BaseContext
export async function getCredentials<T extends object = ICredentialDataDecryptedObject>( export async function getCredentials<T extends object = ICredentialDataDecryptedObject>(
workflow: Workflow, workflow: Workflow,
node: INode, node: INode,
@ -2115,6 +2100,7 @@ export async function getCredentials<T extends object = ICredentialDataDecrypted
* Clean up parameter data to make sure that only valid data gets returned * Clean up parameter data to make sure that only valid data gets returned
* INFO: Currently only converts Luxon Dates as we know for sure it will not be breaking * INFO: Currently only converts Luxon Dates as we know for sure it will not be breaking
*/ */
// TODO: Move to BaseContext
export function cleanupParameterData(inputData: NodeParameterValueType): void { export function cleanupParameterData(inputData: NodeParameterValueType): void {
if (typeof inputData !== 'object' || inputData === null) { if (typeof inputData !== 'object' || inputData === null) {
return; return;
@ -2140,6 +2126,7 @@ export function cleanupParameterData(inputData: NodeParameterValueType): void {
} }
} }
// TODO: Move to BaseContext
const validateResourceMapperValue = ( const validateResourceMapperValue = (
parameterName: string, parameterName: string,
paramValues: { [key: string]: unknown }, paramValues: { [key: string]: unknown },
@ -2191,6 +2178,7 @@ const validateResourceMapperValue = (
return result; return result;
}; };
// TODO: Move to BaseContext
const validateCollection = ( const validateCollection = (
node: INode, node: INode,
runIndex: number, runIndex: number,
@ -2264,6 +2252,7 @@ const validateCollection = (
return validationResult; return validationResult;
}; };
// TODO: Move to BaseContext
export const validateValueAgainstSchema = ( export const validateValueAgainstSchema = (
node: INode, node: INode,
nodeType: INodeType, nodeType: INodeType,
@ -2335,6 +2324,7 @@ export const validateValueAgainstSchema = (
return validationResult.newValue; return validationResult.newValue;
}; };
// TODO: Move to BaseContext
export function ensureType( export function ensureType(
toType: EnsureTypeOptions, toType: EnsureTypeOptions,
parameterValue: any, parameterValue: any,
@ -2433,6 +2423,7 @@ export function ensureType(
* *
* @param {(IRunExecutionData | null)} runExecutionData * @param {(IRunExecutionData | null)} runExecutionData
*/ */
// TODO: Move to BaseContext
export function getNodeParameter( export function getNodeParameter(
workflow: Workflow, workflow: Workflow,
runExecutionData: IRunExecutionData | null, runExecutionData: IRunExecutionData | null,
@ -2524,6 +2515,7 @@ export function getNodeParameter(
* Returns if execution should be continued even if there was an error. * Returns if execution should be continued even if there was an error.
* *
*/ */
// TODO: Move to BaseContext
export function continueOnFail(node: INode): boolean { export function continueOnFail(node: INode): boolean {
const onError = get(node, 'onError', undefined); const onError = get(node, 'onError', undefined);
@ -2538,6 +2530,7 @@ export function continueOnFail(node: INode): boolean {
* Returns the webhook URL of the webhook with the given name * Returns the webhook URL of the webhook with the given name
* *
*/ */
// TODO: Move to BaseContext
export function getNodeWebhookUrl( export function getNodeWebhookUrl(
name: string, name: string,
workflow: Workflow, workflow: Workflow,
@ -2583,6 +2576,7 @@ export function getNodeWebhookUrl(
* Returns the full webhook description of the webhook with the given name * Returns the full webhook description of the webhook with the given name
* *
*/ */
// TODO: Move to BaseContext
export function getWebhookDescription( export function getWebhookDescription(
name: string, name: string,
workflow: Workflow, workflow: Workflow,
@ -2709,6 +2703,7 @@ const addExecutionDataFunctions = async (
} }
}; };
// TODO: Move to BaseContext
export async function getInputConnectionData( export async function getInputConnectionData(
context: IAllExecuteFunctions, context: IAllExecuteFunctions,
workflow: Workflow, workflow: Workflow,