Runtime setFlows interface does not match documentation

Hello,

I want to reload the flows programmatically.
Therefore I want to use the setFlows function of the node runtime.
(DefinitelyTyped/index.d.ts at master · DefinitelyTyped/DefinitelyTyped · GitHub)
/**
* Sets the current flow configuration
* @param opts
* @param opts.flows - the flow configuration: {flows: [..], credentials: {}}
* @param opts.deploymentType - the type of deployment - "full", "nodes", "flows", "reload"
* @param opts.req - the request to log (optional)
*/
setFlows: (opts: { flows: { flows: object; credentials: object; req?: object } }) => Promise<{ rev: string }>;

Documentation:
https://nodered.org/docs/api/modules/v/1.3/@node-red_runtime_flows.html#.setFlows
(has an additional user object)

So the docs mention this format {flows:{}, req?:{}, deploymentType: string},
the coding accepts this format: {flows:[{},{}], credentials?:{}, req?:{}}

there is a mismatch of API Input parameters and docs, but my biggest issue is how can I set the deploymentType. I am using typeScript.
Any suggestions?

Thank you
okm

Hi @okm

the typescript definitions in the DefinitelyTyped repo are not maintained by the core Node-RED project - they never have been. You'll have to raise an issue against whoever maintains them.

You set the deployment type using opt.deploymentType just as the docs say.

Hi @knolleary ,

OK got it, I changed my coding to
const opts = {
flows:{
flows:,
credentials:{}
},
deploymentType:'reload'
};
runtime.flows.setFlows(opts);

and it worked.
Thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.