Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

comfy-workflow

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comfy-workflow - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

dist/cjs/graph-json.js

30

dist/cjs/api.js

@@ -75,5 +75,7 @@ "use strict";

class Workflow {
constructor() {
constructor(workflow) {
this.index = 0;
this.nodes = new Map();
if (workflow)
this.mergeApiFormat(workflow);
}

@@ -110,12 +112,13 @@ genId() {

mergeApiFormat(workflow) {
const w = this;
for (const [nodeId, node] of Object.entries(workflow)) {
const n = new Node(w, nodeId, node.class_type, node._meta);
w.nodes.set(nodeId, n);
const n = new Node(this, nodeId, node.class_type, node._meta);
this.nodes.set(nodeId, n);
}
for (const [nodeId, node] of Object.entries(workflow)) {
const n = w.nodes.get(nodeId);
const n = this.nodes.get(nodeId);
if (!n)
throw new Error('unreachable');
for (const [name, value] of Object.entries(node.inputs)) {
if (APIFormat.isOutput(value)) {
const t = w.nodes.get(value[0]);
const t = this.nodes.get(value[0]);
if (!t)

@@ -130,6 +133,19 @@ throw new Error(`Invalid workflow format: node "${value[0]}" not found`);

}
return w;
return this;
}
mergeInputs(workflow) {
for (const [nodeId, node] of this.nodes) {
const n = workflow[nodeId];
if (!n?.inputs)
continue;
for (const [name, value] of Object.entries(n.inputs)) {
if (APIFormat.isOutput(value)) {
continue;
}
node.setInput(name, value);
}
}
}
}
exports.Workflow = Workflow;
//# sourceMappingURL=api.js.map

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

exports.APIFormat = __importStar(require("./api-format"));
__exportStar(require("./graph"), exports);
//# sourceMappingURL=index.js.map

@@ -47,5 +47,7 @@ import * as APIFormat from './api-format';

export class Workflow {
constructor() {
constructor(workflow) {
this.index = 0;
this.nodes = new Map();
if (workflow)
this.mergeApiFormat(workflow);
}

@@ -82,12 +84,13 @@ genId() {

mergeApiFormat(workflow) {
const w = this;
for (const [nodeId, node] of Object.entries(workflow)) {
const n = new Node(w, nodeId, node.class_type, node._meta);
w.nodes.set(nodeId, n);
const n = new Node(this, nodeId, node.class_type, node._meta);
this.nodes.set(nodeId, n);
}
for (const [nodeId, node] of Object.entries(workflow)) {
const n = w.nodes.get(nodeId);
const n = this.nodes.get(nodeId);
if (!n)
throw new Error('unreachable');
for (const [name, value] of Object.entries(node.inputs)) {
if (APIFormat.isOutput(value)) {
const t = w.nodes.get(value[0]);
const t = this.nodes.get(value[0]);
if (!t)

@@ -102,5 +105,18 @@ throw new Error(`Invalid workflow format: node "${value[0]}" not found`);

}
return w;
return this;
}
mergeInputs(workflow) {
for (const [nodeId, node] of this.nodes) {
const n = workflow[nodeId];
if (!n?.inputs)
continue;
for (const [name, value] of Object.entries(n.inputs)) {
if (APIFormat.isOutput(value)) {
continue;
}
node.setInput(name, value);
}
}
}
}
//# sourceMappingURL=api.js.map
export * from './api';
export * as APIFormat from './api-format';
export * from './graph';
//# sourceMappingURL=index.js.map
{
"name": "comfy-workflow",
"version": "0.1.0",
"version": "0.2.0",
"main": "dist/cjs/index.js",

@@ -18,2 +18,3 @@ "module": "dist/esm/index.js",

"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@types/node": "^20.10.1",

@@ -23,3 +24,6 @@ "typescript": "^5.3.2",

},
"packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
"packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447",
"dependencies": {
"zod": "^3.23.8"
}
}

@@ -7,3 +7,3 @@ export interface Workflow {

class_type: string
_meta?: Record<string, any>
_meta?: Record<string, unknown>
}

@@ -10,0 +10,0 @@ export type InputValue = string | number | boolean | object

@@ -22,3 +22,3 @@ import * as APIFormat from './api-format'

public classType: string,
public meta?: Record<string, any>,
public meta?: Record<string, unknown>,
) {}

@@ -60,3 +60,5 @@

constructor() {}
constructor(workflow?: APIFormat.Workflow) {
if (workflow) this.mergeApiFormat(workflow)
}

@@ -71,3 +73,7 @@ genId() {

node(classType: string, nodeId = this.genId(), meta?: Record<string, any>) {
node(
classType: string,
nodeId = this.genId(),
meta?: Record<string, unknown>,
) {
const node = new Node(this, nodeId, classType, meta)

@@ -99,14 +105,13 @@ this.nodes.set(nodeId, node)

mergeApiFormat(workflow: APIFormat.Workflow) {
const w = this
for (const [nodeId, node] of Object.entries(workflow)) {
const n = new Node(w, nodeId, node.class_type, node._meta)
w.nodes.set(nodeId, n)
const n = new Node(this, nodeId, node.class_type, node._meta)
this.nodes.set(nodeId, n)
}
for (const [nodeId, node] of Object.entries(workflow)) {
const n = w.nodes.get(nodeId)!
const n = this.nodes.get(nodeId)
if (!n) throw new Error('unreachable')
for (const [name, value] of Object.entries(node.inputs)) {
if (APIFormat.isOutput(value)) {
const t = w.nodes.get(value[0])
const t = this.nodes.get(value[0])
if (!t)

@@ -123,4 +128,17 @@ throw new Error(

return w
return this
}
mergeInputs(workflow: APIFormat.Workflow) {
for (const [nodeId, node] of this.nodes) {
const n = workflow[nodeId]
if (!n?.inputs) continue
for (const [name, value] of Object.entries(n.inputs)) {
if (APIFormat.isOutput(value)) {
continue
}
node.setInput(name, value)
}
}
}
}
export * from './api'
export * as APIFormat from './api-format'
export * from './graph'

@@ -7,3 +7,3 @@ export interface Workflow {

class_type: string;
_meta?: Record<string, any>;
_meta?: Record<string, unknown>;
}

@@ -10,0 +10,0 @@ export type InputValue = string | number | boolean | object;

@@ -13,5 +13,5 @@ import * as APIFormat from './api-format';

classType: string;
meta?: Record<string, any> | undefined;
meta?: Record<string, unknown> | undefined;
inputs: Map<string, APIFormat.InputValue | NodeOutput>;
constructor(workflow: Workflow, id: string, classType: string, meta?: Record<string, any> | undefined);
constructor(workflow: Workflow, id: string, classType: string, meta?: Record<string, unknown> | undefined);
output(index: number): NodeOutput;

@@ -25,5 +25,5 @@ setInput(name: string, value: APIFormat.InputValue): this;

protected nodes: Map<string, Node>;
constructor();
constructor(workflow?: APIFormat.Workflow);
genId(): string;
node(classType: string, nodeId?: string, meta?: Record<string, any>): Node;
node(classType: string, nodeId?: string, meta?: Record<string, unknown>): Node;
getNode(id: string): Node | undefined;

@@ -34,2 +34,3 @@ toApiFormat(): APIFormat.Workflow;

mergeApiFormat(workflow: APIFormat.Workflow): this;
mergeInputs(workflow: APIFormat.Workflow): void;
}
export * from './api';
export * as APIFormat from './api-format';
export * from './graph';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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