You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this PR I propose a Plugin & hook system for Flowise
Plugins are packages, that currently live in /plugins - but they should also be installable via npm
It borrows ideas from the WordPress plugin and hook system. One of the most powerful forces why WordPress became such a popular OpenSource framework (despite a lot of not so likable things about WordPress code)
Within a plugin package we use package.json/main to point to the plugins main class which extends the FlowisePlugin class
It automatically loads components and credentials from the plugins directory by specifying nodesPath and credentialsPath
=> Check the components in the UI within a new "Custom" section
Under the hood it's using an event based hook system (based on EventEmitter) that adds the ability to collect and manipulate (filter) data, via emitting and listening to events (we call them hooks)
There is a new plugins directory (can be configured via PLUGINS_PATH in .env
Currently plugins are packages living with the /plugins directory. In a next iteration we could also specify plugins as npm packages via a PLUGINS_PACKAGES setting or plugins.json file - or similar.
As plugins are just packages we create our package as a directory within plugins.
And use package.json to specify the entry point. (and all the compile options, etc ... if we want to use typescript, etc ...)
In the example plugin in the PR - the index.ts lives within the root directory - and not in the /src directory like in packages/components/nodes/**
If we specify a nodesPath the Plugin system will automatically load and initialize all (component) nodes it finds in that directory (using the same mechanism as flowise core) - same goes for credentialsPath, if specified.
constructor() is executed before the (server) app is initialized. initialize() is executed after database and app are initialized - right before the web server is started.
This one is just a plain copy of the existing Cheerio node, slightly modified for demo purpose. It's added to a "Custom" section via this.category = 'Custom'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
See Pull Request #1066
In this PR I propose a Plugin & hook system for Flowise
Plugins are packages, that currently live in /plugins - but they should also be installable via npm
It borrows ideas from the WordPress plugin and hook system. One of the most powerful forces why WordPress became such a popular OpenSource framework (despite a lot of not so likable things about WordPress code)
Within a plugin package we use package.json/main to point to the plugins main class which extends the FlowisePlugin class
It automatically loads components and credentials from the plugins directory by specifying nodesPath and credentialsPath
=> Check the components in the UI within a new "Custom" section
Under the hood it's using an event based hook system (based on EventEmitter) that adds the ability to collect and manipulate (filter) data, via emitting and listening to events (we call them hooks)
There is a new
plugins
directory (can be configured viaPLUGINS_PATH
in.env
Currently plugins are packages living with the
/plugins
directory. In a next iteration we could also specify plugins as npm packages via aPLUGINS_PACKAGES
setting orplugins.json
file - or similar.As plugins are just packages we create our package as a directory within plugins.
And use
package.json
to specify the entry point. (and all the compile options, etc ... if we want to use typescript, etc ...)/plugins/my-plugin/package.json
Note
In the example plugin in the PR - the index.ts lives within the root directory - and not in the /src directory like in packages/components/nodes/**
If we specify a
nodesPath
the Plugin system will automatically load and initialize all (component) nodes it finds in that directory (using the same mechanism as flowise core) - same goes forcredentialsPath
, if specified.constructor()
is executed before the (server) app is initialized.initialize()
is executed after database and app are initialized - right before the web server is started.In the PR you will find an example component node.
It lives in:
This one is just a plain copy of the existing Cheerio node, slightly modified for demo purpose. It's added to a "Custom" section via
this.category = 'Custom'
Beta Was this translation helpful? Give feedback.
All reactions