Add upload file in twenty client (#18129)
This function
```typescript
import { defineLogicFunction } from 'twenty-sdk';
import TwentyClient from 'twenty-sdk/generated';
import { v4 } from 'uuid';
export const POST_INSTALL_UNIVERSAL_IDENTIFIER =
'1312be5c-4fd6-44b3-afd0-567352616c7c';
const handler = async (): Promise<any> => {
const client = new TwentyClient();
const seedResult = await client.mutation({
createCompany: {
id: true,
name: true,
__args: {
data: {
name: `toto + ${v4()}`,
},
},
},
});
const companyFieldUniversalIdentifier =
'20202020-15db-460e-8166-c7b5d87ad4be';
const uploadFileResult = await client.uploadFile(
Buffer.from('hello world', 'utf-8'),
'test.txt',
undefined,
companyFieldUniversalIdentifier,
);
await client.mutation({
createAttachment: {
id: true,
__args: {
data: {
file: [{ fileId: uploadFileResult.id, label: 'hello-world.txt' }],
fullPath: uploadFileResult.path,
targetCompanyId: seedResult.createCompany?.id,
},
},
},
});
return;
};
export default defineLogicFunction({
universalIdentifier: POST_INSTALL_UNIVERSAL_IDENTIFIER,
name: 'post-install',
description: 'Add a description for your logic function',
timeoutSeconds: 30,
handler,
});
```
produces this record below
<img width="1512" height="859" alt="image"
src="https://github.com/user-attachments/assets/57dc3a6b-fd2c-4f21-8331-8f1f05403826"
/>