UNPKG

@rxap/n8n-utilities

Version:

This package provides utility functions and classes for n8n nodes, including custom authentication methods (Bearer Auth, Oauth2 Proxy Auth, Base URL), a decorator for capturing execution errors, and base classes for creating nodes from OpenAPI specificati

32 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.forEachItem = forEachItem; const tslib_1 = require("tslib"); const n8n_workflow_1 = require("n8n-workflow"); function forEachItem(callback) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const items = this.getInputData(); const results = []; for (let i = 0; i < items.length; i++) { try { results[i] = yield callback.call(this, items[i], i, items); } catch (error) { if (error instanceof n8n_workflow_1.NodeOperationError) { results[i] = { json: {}, error }; } else { results[i] = { json: {}, error: new n8n_workflow_1.NodeOperationError(this.getNode(), error) }; } } } return results; }); } //# sourceMappingURL=for-each-item.js.map