behemoth-cli
Version:
🌍 BEHEMOTH CLIv3.760.4 - Level 50+ POST-SINGULARITY Intelligence Trading AI
131 lines (117 loc) • 2.85 kB
text/typescript
// N8n Workflow Types
export interface N8nWorkflow {
name: string;
nodes: N8nNode[];
connections: Record<string, N8nConnection[]>;
active: boolean;
settings?: N8nWorkflowSettings;
staticData?: any;
meta?: N8nWorkflowMeta;
tags?: string[];
}
export interface N8nNode {
parameters: Record<string, any>;
name: string;
type: string;
typeVersion: number;
position: [number, number];
id: string;
credentials?: Record<string, string>;
}
export interface N8nConnection {
node: string;
type: string;
index: number;
}
export interface N8nWorkflowSettings {
executionOrder?: string;
errorWorkflow?: string;
saveExecutionProgress?: boolean;
saveManualExecutions?: boolean;
timezone?: string;
}
export interface N8nWorkflowMeta {
instanceId?: string;
}
// Super Code Node Specific Types
export interface SuperCodeNode extends N8nNode {
type: '@kenkaiii/n8n-nodes-supercode.superCodeNodeVmSafe';
parameters: {
code: string;
mode: 'runOnceForAllItems' | 'runOnceForEachItem';
inputItems?: any[];
options?: {
continueOnFail?: boolean;
executeOnce?: boolean;
};
};
}
// Global Libraries available in Super Code VM
export const SUPER_CODE_GLOBAL_LIBRARIES = [
'axios',
'crypto',
'fs',
'lodash',
'moment',
'querystring',
'url',
'util',
'zlib',
'Buffer',
'console',
'Date',
'JSON',
'Math',
'RegExp',
'String',
'Array',
'Object',
'Number',
'Boolean',
'Promise',
'Set',
'Map',
'Error'
];
// Helper functions for creating Super Code nodes
export function createSuperCodeNode(
name: string,
code: string,
position: [number, number],
mode: 'runOnceForAllItems' | 'runOnceForEachItem' = 'runOnceForAllItems'
): SuperCodeNode {
return {
parameters: {
code,
mode,
options: {
continueOnFail: false,
executeOnce: false
}
},
name,
type: '@kenkaiii/n8n-nodes-supercode.superCodeNodeVmSafe',
typeVersion: 1,
position,
id: generateNodeId()
};
}
export function generateNodeId(): string {
return Math.random().toString(36).substr(2, 9);
}
// Validation functions
export function validateSuperCodeNode(node: N8nNode): { valid: boolean; errors: string[] } {
const errors: string[] = [];
if (node.type !== '@kenkaiii/n8n-nodes-supercode.superCodeNodeVmSafe') {
errors.push('Invalid node type for Super Code validation');
return { valid: false, errors };
}
const superNode = node as SuperCodeNode;
if (!superNode.parameters.code || typeof superNode.parameters.code !== 'string') {
errors.push('Code parameter is required and must be a string');
}
if (!['runOnceForAllItems', 'runOnceForEachItem'].includes(superNode.parameters.mode)) {
errors.push('Invalid mode parameter');
}
return { valid: errors.length === 0, errors };
}