import { Request, Response } from 'express'; import { DataSource } from 'typeorm'; import { ICredentialBody, ICredentialDataDecrypted, INodeDependencies, INodeDirectedGraph, IReactFlowEdge, IReactFlowNode, IComponentNodesPool, WebhookMethod } from '../Interface'; import { ICommonObject, INodeData, INodeExecutionData } from 'outerbridge-components'; import { Credential } from '../entity/Credential'; import { DeployedWorkflowPool } from '../DeployedWorkflowPool'; import { ActiveTestWebhookPool } from '../ActiveTestWebhookPool'; export declare enum ShortIdConstants { WORKFLOW_ID_PREFIX = "W", EXECUTION_ID_PREFIX = "E" } /** * Returns a Short ID * Format : WDDMMMYY-[0-1A-Z]*8 , ie: B10JAN21-2CH9PX8N * Where W=Entity Prefix, DD=DAY, MMM=Month, YY=Year, -=Separator (hyphen character), [0-1A-Z]*8 = random part of length 8 by default. * * @param {string | Date} prefix Identifies the Entity, 'W' for Workflow, 'E' for Execution * @param {Date} date The Date the ShortId was created * @returns {string} shortId */ export declare const shortId: (prefix: 'W' | 'E', date: string | Date) => string; /** * Format a date for use in the short id DDMMMYY with no hyphens * @param {Date} date * @returns {string} the sanitized date as string ie: 10JAN21 */ export declare const formatDateForShortID: (date: Date) => string; export declare const getRandomCharFromDictionary: (dictionary: string) => string; export declare const getRandomSubdomain: () => string; /** * Returns the path of node modules package * @param {string} packageName * @returns {string} */ export declare const getNodeModulesPackagePath: (packageName: string) => string; /** * Returns the path of encryption key * @returns {string} */ export declare const getEncryptionKeyPath: () => string; /** * Generate an encryption key * @returns {string} */ export declare const generateEncryptKey: () => string; /** * Returns the encryption key * @returns {string} */ export declare const getEncryptionKey: () => Promise; /** * Returns the api key path * @returns {string} */ export declare const getAPIKeyPath: () => string; /** * Generate the api key * @returns {string} */ export declare const generateAPIKey: () => string; /** * Generate the secret key * @param {string} apiKey * @returns {string} */ export declare const generateSecretHash: (apiKey: string) => string; /** * Verify valid keys * @param {string} storedKey * @param {string} suppliedKey * @returns {boolean} */ export declare const compareKeys: (storedKey: string, suppliedKey: string) => boolean; /** * Get API keys * @returns {Promise} */ export declare const getAPIKeys: () => Promise; /** * Add new API key * @param {string} keyName * @returns {Promise} */ export declare const addAPIKey: (keyName: string) => Promise; /** * Update existing API key * @param {string} keyIdToUpdate * @param {string} newKeyName * @returns {Promise} */ export declare const updateAPIKey: (keyIdToUpdate: string, newKeyName: string) => Promise; /** * Delete API key * @param {string} keyIdToDelete * @returns {Promise} */ export declare const deleteAPIKey: (keyIdToDelete: string) => Promise; /** * Encrypt credential data * @param {ICredentialDataDecrypted} data * @param {string} encryptionKey * @returns {string} */ export declare const encryptCredentialData: (data: ICredentialDataDecrypted, encryptionKey: string) => string; /** * Decrypt credential data * @param {string} data * @param {string} encryptionKey * @returns {ICredentialDataDecrypted} */ export declare const decryptCredentialData: (data: string, encryptionKey: string) => ICredentialDataDecrypted; /** * Transform ICredentialBody from req to Credential entity * @param {ICredentialBody} data * @returns {Credential} */ export declare const transformToCredentialEntity: (body: ICredentialBody) => Promise; /** * Returns the path of oauth2 html * @returns {string} */ export declare const getOAuth2HTMLPath: () => string; /** * Construct directed graph and node dependencies score * @param {IReactFlowNode[]} reactFlowNodes * @param {IReactFlowEdge[]} reactFlowEdges */ export declare const constructGraphs: (reactFlowNodes: IReactFlowNode[], reactFlowEdges: IReactFlowEdge[]) => { graph: INodeDirectedGraph; nodeDependencies: INodeDependencies; }; /** * Get starting node and check if flow is valid * @param {INodeDependencies} nodeDependencies * @param {IReactFlowNode[]} reactFlowNodes */ export declare const getStartingNode: (nodeDependencies: INodeDependencies, reactFlowNodes: IReactFlowNode[]) => { faultyNodeLabels: string[]; startingNodeIds: string[]; }; /** * Function to get both graphs and starting nodes * @param {Response} res * @param {IReactFlowNode[]} reactFlowNodes * @param {IReactFlowEdge[]} reactFlowEdges */ export declare const constructGraphsAndGetStartingNodes: (res: Response, reactFlowNodes: IReactFlowNode[], reactFlowEdges: IReactFlowEdge[]) => { graph: INodeDirectedGraph; startingNodeIds: string[]; } | undefined; /** * Get variable value from outputResponses.output * @param {string} paramValue * @param {IReactFlowNode[]} reactFlowNodes * @param {string} key * @param {number} loopIndex * @returns {string} */ export declare const getVariableValue: (paramValue: string, reactFlowNodes: IReactFlowNode[], key: string, loopIndex: number) => string; /** * Get minimum variable array length from outputResponses.output * @param {string} paramValue * @param {IReactFlowNode[]} reactFlowNodes * @returns {number} */ export declare const getVariableLength: (paramValue: string, reactFlowNodes: IReactFlowNode[]) => number; /** * Loop through each inputs and resolve variable if neccessary * @param {INodeData} reactFlowNodeData * @param {IReactFlowNode[]} reactFlowNodes * @returns {INodeData} */ export declare const resolveVariables: (reactFlowNodeData: INodeData, reactFlowNodes: IReactFlowNode[]) => INodeData[]; /** * Decrypt encrypted credentials with encryption key * @param {INodeData} nodeData */ export declare const decryptCredentials: (nodeData: INodeData, appDataSource?: DataSource) => Promise; /** * Decrypt encrypted wallet credentials with encryption key * @param {INodeData} nodeData */ export declare const decryptWalletCredentials: (nodeData: INodeData) => Promise; /** * Process webhook * @param {Response} res * @param {Request} req * @param {DataSource} AppDataSource * @param {string} webhookEndpoint * @param {WebhookMethod} httpMethod * @param {IComponentNodesPool} componentNodes * @param {any} io */ export declare const processWebhook: (res: Response, req: Request, AppDataSource: DataSource, webhookEndpoint: string, httpMethod: WebhookMethod, componentNodes: IComponentNodesPool, io: any, deployedWorkflowsPool: DeployedWorkflowPool, activeTestWebhooksPool: ActiveTestWebhookPool) => Promise> | undefined>; /** * Check if oAuth2 token refreshed * @param {INodeExecutionData[] | null} result * @param {INodeData} nodeData * @param {DataSource} appDataSource */ export declare const checkOAuth2TokenRefreshed: (result: INodeExecutionData[] | null, nodeData: INodeData, appDataSource?: DataSource) => void; /** * Test Workflow from starting node to end * @param {string} startingNodeId * @param {IReactFlowNode[]} reactFlowNodes * @param {IReactFlowEdge[]} reactFlowEdges * @param {INodeDirectedGraph} graph * @param {IComponentNodesPool} componentNodes * @param {string} clientId * @param {any} io */ export declare const testWorkflow: (startingNodeId: string, reactFlowNodes: IReactFlowNode[], reactFlowEdges: IReactFlowEdge[], graph: INodeDirectedGraph, componentNodes: IComponentNodesPool, clientId: string, io: any, returnLastExecutedResult?: boolean) => Promise;