Closed linonetwo closed 4 months ago
Yes, bpmn-server does not require HTTP but requires a database, you can replace mongoDB with in-memory database by implementing your own implementation of IDataStore
interface IDataStore {
dbConfiguration: any;
db: any;
logger: any;
locker: any;
save(instance:any,options:any): Promise<void>;
loadInstance(instanceId: any,options:any): Promise<{
instance: any;
items: any[];
}>;
findItem(query: any): Promise<IItemData>;
findInstance(query: any, options: any): Promise<IInstanceData>;
findInstances(query: any, option: 'summary' | 'full'|any): Promise<IInstanceData[]>;
findItems(query: any): Promise<IItemData[]>;
deleteInstances(query?: any): Promise<void>;
install();
archive(query);
}
I can help you create a custom install, once you have selected a db and completed the db driver to implement the above interface.
I'm working on this today, can you explain or add JSDoc comment to methods, so I can understand what I should do in
and what is difference between instance and item? (maybe it is already in the doc)
And what is the type of query?
I find your mongodb Datastore may return null
on loadInstance, so its return type should contains null.
I tried my best to write one based on current doc https://github.com/tiddly-gittly/workflow/blob/master/src/workflow-engine/data/tw-datastore.ts
But I need more of you help, thanks!
Sure, can you provide instructions on how to install and debug the code.
is invoked on first time package is installed through
npm run setup`instance
is the entire workflow case, while item
is the for each node I managed to make a basic setup. I haven't write UI part, so it is currently only run on server side.
pnpm i
# or npm i will work too
pnpm run dev
# then the server will start, but nothing will write back to fs
# pnpm run dev:wiki will write changes back to fs
An instance is successfully created here https://github.com/tiddly-gittly/workflow/blob/4f0e831a8862f17d554e3ce6da1ceac36b951a81/src/workflow-engine/startup/engine/engine.ts#L30 You can only play with this instance for this moment. For debugging, I only use console.log ...
And it load the example bpmn https://github.com/tiddly-gittly/workflow/blob/master/wiki/tiddlers/log-console.bpmn
using a custom datastore https://github.com/tiddly-gittly/workflow/blob/master/src/workflow-engine/data/twModelDataStore.ts
and save intermediate state using https://github.com/tiddly-gittly/workflow/blob/master/src/workflow-engine/data/twDatastore.ts
My TODO:
log-console
Here is what I am working on for you so far:
bpmn-server
has no dependency on mongodb bpmn-server
has a default JSONDataStore to save to flat filesbpmn-node
is available for testing bpmn-server
without MongoDBWill let you know when all done.
btw, have you considered running MongoDB remotely ?
No, I'm trying to make a local-first workflow app that can run as a single HTML file, this will be very light weight, so more people will get to know and use BPMN.
I'd like to use bpmn server in tiddlywiki, as discussed in https://github.com/bpmnServer/bpmn-server/issues/145#issuecomment-1852365807 some time ago, I hope this package can have a pure bpmn executor, that does not depend on mongodb and http server, so I can run the bpmn file purely in Typescript, and get result in Typescript, no HTTP request, also save the internal state to files or in-memory database, no mongodb requires.
Do you think this is possible?