New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@baklavajs/core

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@baklavajs/core - npm Package Compare versions

Comparing version 2.0.2-beta.1 to 2.0.2-beta.2

dist/cjs/dynamicNode.js

35

dist/cjs/graph.js

@@ -8,2 +8,18 @@ "use strict";

class Graph {
/** List of all nodes in this graph */
get nodes() {
return this._nodes;
}
/** List of all connections in this graph */
get connections() {
return this._connections;
}
/** Whether the graph is currently in the process of loading a saved graph */
get loading() {
return this._loading;
}
/** Whether the graph is currently in the process of destroying itself */
get destroying() {
return this._destroying;
}
constructor(editor, template) {

@@ -13,2 +29,3 @@ this.id = (0, uuid_1.v4)();

this.outputs = [];
this.activeTransactions = 0;
this._nodes = [];

@@ -41,18 +58,2 @@ this._connections = [];

}
/** List of all nodes in this graph */
get nodes() {
return this._nodes;
}
/** List of all connections in this graph */
get connections() {
return this._connections;
}
/** Whether the graph is currently in the process of loading a saved graph */
get loading() {
return this._loading;
}
/** Whether the graph is currently in the process of destroying itself */
get destroying() {
return this._destroying;
}
/**

@@ -74,3 +75,3 @@ * Add a node to the list of nodes.

// Therefore, we need to get the reactive version from the array.
node = this.nodes.find(n => n.id === node.id);
node = this.nodes.find((n) => n.id === node.id);
node.onPlaced();

@@ -77,0 +78,0 @@ this.events.addNode.emit(node);

@@ -10,2 +10,19 @@ "use strict";

class GraphTemplate {
/** Create a new GraphTemplate from the nodes and connections inside the graph instance */
static fromGraph(graph, editor) {
return new GraphTemplate(graph.save(), editor);
}
/** Get the name of the graph template */
get name() {
return this._name;
}
/** Set the name of the graph template */
set name(v) {
this._name = v;
this.events.nameChanged.emit(v);
const nt = this.editor.nodeTypes.get((0, graphNode_1.getGraphNodeTypeString)(this));
if (nt) {
nt.title = v;
}
}
constructor(state, editor) {

@@ -32,19 +49,2 @@ /** Graph template id */

}
/** Create a new GraphTemplate from the nodes and connections inside the graph instance */
static fromGraph(graph, editor) {
return new GraphTemplate(graph.save(), editor);
}
/** Get the name of the graph template */
get name() {
return this._name;
}
/** Set the name of the graph template */
set name(v) {
this._name = v;
this.events.nameChanged.emit(v);
const nt = this.editor.nodeTypes.get((0, graphNode_1.getGraphNodeTypeString)(this));
if (nt) {
nt.title = v;
}
}
/** Update the state of the graph template with the provided state */

@@ -51,0 +51,0 @@ update(state) {

@@ -22,2 +22,3 @@ "use strict";

__exportStar(require("./defineNode"), exports);
__exportStar(require("./dynamicNode"), exports);
__exportStar(require("./editor"), exports);

@@ -24,0 +25,0 @@ __exportStar(require("./eventDataTypes"), exports);

@@ -7,2 +7,19 @@ "use strict";

class NodeInterface {
set connectionCount(v) {
this._connectionCount = v;
this.events.setConnectionCount.emit(v);
}
get connectionCount() {
return this._connectionCount;
}
set value(v) {
if (this.events.beforeSetValue.emit(v).prevented) {
return;
}
this._value = v;
this.events.setValue.emit(v);
}
get value() {
return this._value;
}
constructor(name, value) {

@@ -30,19 +47,2 @@ this.id = (0, uuid_1.v4)();

}
set connectionCount(v) {
this._connectionCount = v;
this.events.setConnectionCount.emit(v);
}
get connectionCount() {
return this._connectionCount;
}
set value(v) {
if (this.events.beforeSetValue.emit(v).prevented) {
return;
}
this._value = v;
this.events.setValue.emit(v);
}
get value() {
return this._value;
}
load(state) {

@@ -49,0 +49,0 @@ this.id = state.id;

import type { NodeInterface } from "./nodeInterface";
import { CalculateFunction, Node } from "./node";
export declare type NodeConstructor<I, O> = new () => Node<I, O>;
export declare type NodeInstanceOf<T> = T extends new () => Node<infer A, infer B> ? Node<A, B> : never;
export declare type NodeInterfaceFactory<T> = () => NodeInterface<T>;
export declare type InterfaceFactory<T> = {
export type NodeConstructor<I, O> = new () => Node<I, O>;
export type NodeInstanceOf<T> = T extends new () => Node<infer A, infer B> ? Node<A, B> : never;
export type NodeInterfaceFactory<T> = () => NodeInterface<T>;
export type InterfaceFactory<T> = {
[K in keyof T]: NodeInterfaceFactory<T[K]>;

@@ -8,0 +8,0 @@ };

@@ -5,2 +5,18 @@ import { v4 as uuidv4 } from "uuid";

export class Graph {
/** List of all nodes in this graph */
get nodes() {
return this._nodes;
}
/** List of all connections in this graph */
get connections() {
return this._connections;
}
/** Whether the graph is currently in the process of loading a saved graph */
get loading() {
return this._loading;
}
/** Whether the graph is currently in the process of destroying itself */
get destroying() {
return this._destroying;
}
constructor(editor, template) {

@@ -10,2 +26,3 @@ this.id = uuidv4();

this.outputs = [];
this.activeTransactions = 0;
this._nodes = [];

@@ -38,18 +55,2 @@ this._connections = [];

}
/** List of all nodes in this graph */
get nodes() {
return this._nodes;
}
/** List of all connections in this graph */
get connections() {
return this._connections;
}
/** Whether the graph is currently in the process of loading a saved graph */
get loading() {
return this._loading;
}
/** Whether the graph is currently in the process of destroying itself */
get destroying() {
return this._destroying;
}
/**

@@ -71,3 +72,3 @@ * Add a node to the list of nodes.

// Therefore, we need to get the reactive version from the array.
node = this.nodes.find(n => n.id === node.id);
node = this.nodes.find((n) => n.id === node.id);
node.onPlaced();

@@ -74,0 +75,0 @@ this.events.addNode.emit(node);

@@ -7,2 +7,19 @@ import { v4 as uuidv4 } from "uuid";

export class GraphTemplate {
/** Create a new GraphTemplate from the nodes and connections inside the graph instance */
static fromGraph(graph, editor) {
return new GraphTemplate(graph.save(), editor);
}
/** Get the name of the graph template */
get name() {
return this._name;
}
/** Set the name of the graph template */
set name(v) {
this._name = v;
this.events.nameChanged.emit(v);
const nt = this.editor.nodeTypes.get(getGraphNodeTypeString(this));
if (nt) {
nt.title = v;
}
}
constructor(state, editor) {

@@ -29,19 +46,2 @@ /** Graph template id */

}
/** Create a new GraphTemplate from the nodes and connections inside the graph instance */
static fromGraph(graph, editor) {
return new GraphTemplate(graph.save(), editor);
}
/** Get the name of the graph template */
get name() {
return this._name;
}
/** Set the name of the graph template */
set name(v) {
this._name = v;
this.events.nameChanged.emit(v);
const nt = this.editor.nodeTypes.get(getGraphNodeTypeString(this));
if (nt) {
nt.title = v;
}
}
/** Update the state of the graph template with the provided state */

@@ -48,0 +48,0 @@ update(state) {

@@ -6,2 +6,3 @@ /**

export * from "./defineNode";
export * from "./dynamicNode";
export * from "./editor";

@@ -8,0 +9,0 @@ export * from "./eventDataTypes";

import { v4 as uuidv4 } from "uuid";
import { SequentialHook, BaklavaEvent, PreventableBaklavaEvent, } from "@baklavajs/events";
export class NodeInterface {
set connectionCount(v) {
this._connectionCount = v;
this.events.setConnectionCount.emit(v);
}
get connectionCount() {
return this._connectionCount;
}
set value(v) {
if (this.events.beforeSetValue.emit(v).prevented) {
return;
}
this._value = v;
this.events.setValue.emit(v);
}
get value() {
return this._value;
}
constructor(name, value) {

@@ -26,19 +43,2 @@ this.id = uuidv4();

}
set connectionCount(v) {
this._connectionCount = v;
this.events.setConnectionCount.emit(v);
}
get connectionCount() {
return this._connectionCount;
}
set value(v) {
if (this.events.beforeSetValue.emit(v).prevented) {
return;
}
this._value = v;
this.events.setValue.emit(v);
}
get value() {
return this._value;
}
load(state) {

@@ -45,0 +45,0 @@ this.id = state.id;

@@ -31,3 +31,3 @@ import { BaklavaEvent, IBaklavaEventEmitter, IBaklavaTapable, PreventableBaklavaEvent, SequentialHook, ParallelHook } from "@baklavajs/events";

}
export declare type CheckConnectionResult = PositiveCheckConnectionResult | NegativeCheckConnectionResult;
export type CheckConnectionResult = PositiveCheckConnectionResult | NegativeCheckConnectionResult;
export declare class Graph implements IBaklavaEventEmitter, IBaklavaTapable {

@@ -39,2 +39,3 @@ id: string;

outputs: IGraphInterface[];
activeTransactions: number;
protected _nodes: AbstractNode[];

@@ -41,0 +42,0 @@ protected _connections: Connection[];

@@ -6,3 +6,3 @@ import { BaklavaEvent, SequentialHook } from "@baklavajs/events";

import type { INodeState } from "./node";
declare type Optional<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
type Optional<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
export interface IGraphTemplateState extends IGraphState {

@@ -9,0 +9,0 @@ name: string;

@@ -6,2 +6,3 @@ /**

export * from "./defineNode";
export * from "./dynamicNode";
export * from "./editor";

@@ -8,0 +9,0 @@ export * from "./eventDataTypes";

@@ -9,4 +9,4 @@ import { PreventableBaklavaEvent, BaklavaEvent, SequentialHook, IBaklavaEventEmitter, IBaklavaTapable } from "@baklavajs/events";

}
export declare type CalculateFunctionReturnType<O> = O | Promise<O> | void;
export declare type CalculateFunction<I, O, C extends CalculationContext = CalculationContext> = (inputs: I, context: C) => CalculateFunctionReturnType<O>;
export type CalculateFunctionReturnType<O> = O | Promise<O> | void;
export type CalculateFunction<I, O, C extends CalculationContext = CalculationContext> = (inputs: I, context: C) => CalculateFunctionReturnType<O>;
export interface INodeState<I, O> {

@@ -21,3 +21,3 @@ type: string;

/** Type of the node */
abstract type: string;
abstract readonly type: string;
/** Customizable display name of the node. */

@@ -115,2 +115,2 @@ abstract title: string;

}
export declare type AbstractNodeConstructor = new () => AbstractNode;
export type AbstractNodeConstructor = new () => AbstractNode;

@@ -7,3 +7,3 @@ import { SequentialHook, BaklavaEvent, PreventableBaklavaEvent, IBaklavaEventEmitter, IBaklavaTapable } from "@baklavajs/events";

}
export declare type NodeInterfaceMiddleware<T, A extends Array<any>> = (intf: NodeInterface<T>, ...args: A) => void;
export type NodeInterfaceMiddleware<T, A extends Array<any>> = (intf: NodeInterface<T>, ...args: A) => void;
export declare class NodeInterface<T = any> implements IBaklavaEventEmitter, IBaklavaTapable {

@@ -52,7 +52,7 @@ id: string;

}
export declare type NodeInterfaceDefinition<T> = {
export type NodeInterfaceDefinition<T> = {
[K in keyof T]: NodeInterface<T[K]>;
};
export declare type NodeInterfaceDefinitionStates<T> = {
export type NodeInterfaceDefinitionStates<T> = {
[K in keyof T]: INodeInterfaceState<T[K]>;
};
{
"name": "@baklavajs/core",
"version": "2.0.2-beta.1",
"description": "Core logic of BaklavaJS, a graph editor / node editor for the web",
"author": "newcat <freddy.wagner@web.de>",
"homepage": "https://newcat.github.io/baklavajs",
"license": "MIT",
"files": [
"dist/*"
],
"main": "dist/cjs/index.js",
"types": "dist/index.d.ts",
"module": "dist/esm/index.js",
"scripts": {
"build:esm": "tsc -p tsconfig.build.json --declaration false --outDir dist/esm --module esnext",
"build:cjs": "tsc -p tsconfig.build.json --declaration false --outDir dist/cjs",
"build:declaration": "tsc -p tsconfig.build.json --emitDeclarationOnly --outDir dist",
"build": "rimraf dist && yarn run build:esm && yarn run build:cjs && yarn run build:declaration",
"test": "jest --coverage --colors"
},
"repository": {
"type": "git",
"url": "git+https://github.com/newcat/baklavajs.git"
},
"bugs": {
"url": "https://github.com/newcat/baklavajs/issues"
},
"dependencies": {
"@baklavajs/events": "^2.0.2-alpha.5",
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/jest": "^28.1.6",
"@types/uuid": "^8.3.4",
"jest": "^28.1.3",
"rimraf": "^3.0.2",
"ts-jest": "^28.0.7",
"ts-node": "^10.9.1",
"typedoc": "^0.23.9",
"typescript": "^4.7.4"
},
"publishConfig": {
"access": "public"
},
"gitHead": "13a469dbb36a4cea8c0fd0e4922c2d825e03d609"
"name": "@baklavajs/core",
"version": "2.0.2-beta.2",
"description": "Core logic of BaklavaJS, a graph editor / node editor for the web",
"author": "newcat <freddy.wagner@web.de>",
"homepage": "https://newcat.github.io/baklavajs",
"license": "MIT",
"files": [
"dist/*"
],
"main": "dist/cjs/index.js",
"types": "dist/index.d.ts",
"module": "dist/esm/index.js",
"scripts": {
"build:esm": "tsc -p tsconfig.build.json --declaration false --outDir dist/esm --module esnext",
"build:cjs": "tsc -p tsconfig.build.json --declaration false --outDir dist/cjs",
"build:declaration": "tsc -p tsconfig.build.json --emitDeclarationOnly --outDir dist",
"build": "rimraf dist && yarn run build:esm && yarn run build:cjs && yarn run build:declaration",
"test": "jest --coverage --colors"
},
"repository": {
"type": "git",
"url": "git+https://github.com/newcat/baklavajs.git"
},
"bugs": {
"url": "https://github.com/newcat/baklavajs/issues"
},
"dependencies": {
"@baklavajs/events": "^2.0.2-alpha.5",
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/jest": "^28.1.6",
"@types/uuid": "^8.3.4",
"jest": "^28.1.3",
"rimraf": "^3.0.2",
"ts-jest": "^28.0.7",
"ts-node": "^10.9.1",
"typedoc": "^0.23.9",
"typescript": "^4.7.4"
},
"publishConfig": {
"access": "public"
},
"gitHead": "995943b4a7d8d7472811363afcb906cd21a29303"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc