UNPKG

n8n-nodes-hjhcomfyui

Version:

n8n node to integrate with ComfyUI stable diffusion workflows

113 lines 4.51 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Hjhcheckargs = void 0; const n8n_workflow_1 = require("n8n-workflow"); const fs = __importStar(require("fs")); class Hjhcheckargs { constructor() { this.description = { displayName: 'HjhCheckArgs', name: 'hjhcheckargs', icon: 'file:hjhcheckargs.svg', group: ['transform'], version: 1, description: 'Execute HjhCheckArgs workflows', defaults: { name: 'HjhCheckArgs', }, credentials: [], inputs: ['main'], outputs: ['main'], properties: [ { displayName: 'Hjh Key File', name: 'hjhKeyFile', type: 'string', default: '', description: 'The Hjh key file path', }, { displayName: 'Hjh Key', name: 'hjhKey', type: 'string', typeOptions: { rows: 10, }, default: '', description: 'The Hjh key', }, ], }; } async execute() { const hjhKeyFile = this.getNodeParameter('hjhKeyFile', 0); let hjhKey = this.getNodeParameter('hjhKey', 0); try { let localKey = ""; fs.readFile(hjhKeyFile, 'utf-8', (err, data) => { if (err) { throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Failed to read file ' + err.toString() }); } localKey = data.trim(); console.log('[HjhCheckArgs] 读取到的内容为:', localKey); }); if (localKey !== hjhKey) { throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: `check key` }); } let responseData = { code: 200, message: 'ok', description: 'ok', hjhKey: hjhKey, }; return [this.helpers.returnJsonArray(responseData)]; } catch (error) { console.error('[HjhCheckArgsJson] Execution error:', error); this.logger.error('[HjhCheckArgsJson] Execution error:', error); if (!this.continueOnFail()) { throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: `HjhCheckArgsJson API Error: ${error.message} ` + error.toString(), description: `HjhCheckArgsJson API Error: ${error.message} ` + error.toString() }, { message: `HjhCheckArgsJson API Error: ${error.message} ` + error.toString(), description: `HjhCheckArgsJson API Error: ${error.message} ` + error.toString() }); } let errorItems = { code: 200, files: [], promptResult: {}, promptId: "", message: error.message, description: `HjhCheckArgsJson API Error: ${error.message} ${error.toString()} ` + error.stack, }; return [this.helpers.returnJsonArray(errorItems)]; } } } exports.Hjhcheckargs = Hjhcheckargs; //# sourceMappingURL=Hjhcheckargs.node.js.map