@hotmeshio/hotmesh
Version:
Serverless Workflow
34 lines (33 loc) • 1.05 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConnectionService = void 0;
/**
* The Connection service is used to declare the class
* and connection options but does not connect quite yet. Connection
* happens at a later lifecycle stage when a workflow
* is started by the MeshFlow Client module (`(new MeshFlow.Client())).start()`).
*
* The config options optionall support a multi-connection setup
* where the `store` connection explicitly defined along with `stream`, `sub`, etc.
* For example, Postgres can be used for stream and store while
* Redis is used for sub.
*/
class ConnectionService {
/**
* @private
*/
constructor() { }
/**
* Instance initializer
*/
static async connect(config) {
return 'store' in config
? config
: {
class: config.class,
options: { ...config.options },
provider: config.provider,
};
}
}
exports.ConnectionService = ConnectionService;
;