You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

n8n-workflow

Package Overview
Dependencies
Maintainers
1
Versions
306
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

n8n-workflow - npm Package Compare versions

Comparing version

to
0.97.0

10

dist/src/Interfaces.d.ts

@@ -966,2 +966,3 @@ /// <reference types="node" />

nodes: INodesGraphNode;
notes: INotesGraphNode;
}

@@ -971,2 +972,11 @@ export interface INodesGraphNode {

}
export interface INotesGraphNode {
[key: string]: INoteGraphItem;
}
export interface INoteGraphItem {
overlapping: boolean;
position: [number, number];
height: number;
width: number;
}
export interface INodeGraphItem {

@@ -973,0 +983,0 @@ type: string;

1

dist/src/TelemetryHelpers.d.ts
import { INode, INodesGraphResult, IWorkflowBase, INodeTypes } from '.';
export declare function getNodeTypeForName(workflow: IWorkflowBase, nodeName: string): INode | undefined;
export declare function isNumber(value: unknown): value is number;
export declare function generateNodesGraph(workflow: IWorkflowBase, nodeTypes: INodeTypes): INodesGraphResult;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateNodesGraph = exports.getNodeTypeForName = void 0;
exports.generateNodesGraph = exports.isNumber = exports.getNodeTypeForName = void 0;
const LoggerProxy_1 = require("./LoggerProxy");
const STICKY_NODE_TYPE = 'n8n-nodes-base.stickyNote';
function getNodeTypeForName(workflow, nodeName) {

@@ -9,2 +10,24 @@ return workflow.nodes.find((node) => node.name === nodeName);

exports.getNodeTypeForName = getNodeTypeForName;
function isNumber(value) {
return typeof value === 'number';
}
exports.isNumber = isNumber;
function getStickyDimensions(note, stickyType) {
const heightProperty = stickyType === null || stickyType === void 0 ? void 0 : stickyType.description.properties.find((property) => property.name === 'height');
const widthProperty = stickyType === null || stickyType === void 0 ? void 0 : stickyType.description.properties.find((property) => property.name === 'width');
const defaultHeight = heightProperty && isNumber(heightProperty === null || heightProperty === void 0 ? void 0 : heightProperty.default) ? heightProperty.default : 0;
const defaultWidth = widthProperty && isNumber(widthProperty === null || widthProperty === void 0 ? void 0 : widthProperty.default) ? widthProperty.default : 0;
const height = isNumber(note.parameters.height) ? note.parameters.height : defaultHeight;
const width = isNumber(note.parameters.width) ? note.parameters.width : defaultWidth;
return {
height,
width,
};
}
function areOverlapping(topLeft, bottomRight, targetPos) {
return (targetPos[0] > topLeft[0] &&
targetPos[1] > topLeft[1] &&
targetPos[0] < bottomRight[0] &&
targetPos[1] < bottomRight[1]);
}
function generateNodesGraph(workflow, nodeTypes) {

@@ -16,6 +39,22 @@ var _a;

nodes: {},
notes: {},
};
const nodeNameAndIndex = {};
try {
workflow.nodes.forEach((node, index) => {
const notes = workflow.nodes.filter((node) => node.type === STICKY_NODE_TYPE);
const otherNodes = workflow.nodes.filter((node) => node.type !== STICKY_NODE_TYPE);
notes.forEach((stickyNote, index) => {
const stickyType = nodeTypes.getByNameAndVersion(STICKY_NODE_TYPE, stickyNote.typeVersion);
const { height, width } = getStickyDimensions(stickyNote, stickyType);
const topLeft = stickyNote.position;
const bottomRight = [topLeft[0] + width, topLeft[1] + height];
const overlapping = Boolean(otherNodes.find((node) => areOverlapping(topLeft, bottomRight, node.position)));
nodesGraph.notes[index] = {
overlapping,
position: topLeft,
height,
width,
};
});
otherNodes.forEach((node, index) => {
var _a, _b, _c, _d, _e, _f;

@@ -22,0 +61,0 @@ nodesGraph.node_types.push(node.type);

2

package.json
{
"name": "n8n-workflow",
"version": "0.96.0",
"version": "0.97.0",
"description": "Workflow base code of n8n",

@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md",

Sorry, the diff of this file is not supported yet