import { Client, Connection } from '@temporalio/client' import { config } from '#/config' import { c } from '#/di' c.bind({ provide: Client, async: true, useFactory: async () => { const connection = await Connection.connect({ address: config.TEMPORAL_HOSTPORT, }) const client = new Client({ connection, namespace: config.TEMPORAL_NAMESPACE, dataConverter: { payloadConverterPath: require.resolve('../../payload_converter'), }, }) process.on('exit', () => { console.log('closing temporal client') client.connection.close() }) return client }, })