import { config } from "#/config"; import { c } from "#/di"; import { Client, Connection} from '@temporalio/client'; 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 }, });