feat(MySQL Node): Overhaul

This commit is contained in:
Michael Kret
2023-04-12 17:24:17 +03:00
committed by GitHub
parent 29959be688
commit 0a53c957c4
27 changed files with 3729 additions and 402 deletions

View File

@@ -1,11 +1,13 @@
import { readFileSync, readdirSync, mkdtempSync } from 'fs';
import { BinaryDataManager, Credentials } from 'n8n-core';
import { BinaryDataManager, Credentials, constructExecutionMetaData } from 'n8n-core';
import {
ICredentialDataDecryptedObject,
ICredentialsHelper,
IDataObject,
IDeferredPromise,
IExecuteFunctions,
IExecuteWorkflowInfo,
IGetNodeParameterOptions,
IHttpRequestHelper,
IHttpRequestOptions,
ILogger,
@@ -29,6 +31,7 @@ import { WorkflowTestData } from './types';
import path from 'path';
import { tmpdir } from 'os';
import { isEmpty } from 'lodash';
import { get } from 'lodash';
import { FAKE_CREDENTIALS_DATA } from './FakeCredentialsMap';
@@ -328,3 +331,31 @@ export const getWorkflowFilenames = (dirname: string) => {
return workflows;
};
export const createMockExecuteFunction = (
nodeParameters: IDataObject,
nodeMock: INode,
continueBool = false,
) => {
const fakeExecuteFunction = {
getNodeParameter(
parameterName: string,
_itemIndex: number,
fallbackValue?: IDataObject | undefined,
options?: IGetNodeParameterOptions | undefined,
) {
const parameter = options?.extractValue ? `${parameterName}.value` : parameterName;
return get(nodeParameters, parameter, fallbackValue);
},
getNode() {
return nodeMock;
},
continueOnFail() {
return continueBool;
},
helpers: {
constructExecutionMetaData,
},
} as unknown as IExecuteFunctions;
return fakeExecuteFunction;
};