feat(core): Remove storeMetadata and getSize from binary data manager interface (no-changelog) (#7195)

Depends on: #7164 | Story:
[PAY-838](https://linear.app/n8n/issue/PAY-838/introduce-object-store-service-for-binary-data)

This PR removes `storeMetadata` and `getSize` from the binary data
manager interface, as these are specific to filesystem mode. Also this
disambiguates identifiers:

```
binaryDataId
filesystem:289b4aac51e-dac6-4167-b793-6d5c415e2b47 {mode}:{fileId}

fileId - FS
289b4aac51e-dac6-4167-b793-6d5c415e2b47 {executionId}{uuid}

fileId - S3
/workflows/{workflowId}/executions/{executionId}/binary_data/b4aac51e-dac6-4167-b793-6d5c415e2b47
```

Note: The object store changes originally in this PR were extracted out
into the final PR.

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Iván Ovejero
2023-09-25 10:07:06 +02:00
committed by GitHub
parent 6d6e2488c6
commit dcc9cc13ed
7 changed files with 143 additions and 132 deletions

View File

@@ -39,7 +39,6 @@ import pick from 'lodash/pick';
import { extension, lookup } from 'mime-types';
import type {
BinaryHelperFunctions,
BinaryMetadata,
FieldType,
FileSystemHelperFunctions,
FunctionsBase,
@@ -140,6 +139,7 @@ import {
import { getSecretsProxy } from './Secrets';
import { getUserN8nFolderPath } from './UserSettings';
import Container from 'typedi';
import type { BinaryData } from './BinaryData/types';
axios.defaults.timeout = 300000;
// Prevent axios from adding x-form-www-urlencoded headers by default
@@ -947,7 +947,7 @@ export function getBinaryPath(binaryDataId: string): string {
/**
* Returns binary file metadata
*/
export async function getBinaryMetadata(binaryDataId: string): Promise<BinaryMetadata> {
export async function getBinaryMetadata(binaryDataId: string): Promise<BinaryData.Metadata> {
return Container.get(BinaryDataService).getMetadata(binaryDataId);
}
@@ -992,7 +992,7 @@ export async function getBinaryDataBuffer(
inputIndex: number,
): Promise<Buffer> {
const binaryData = inputData.main[inputIndex]![itemIndex]!.binary![propertyName]!;
return Container.get(BinaryDataService).getBinaryDataBuffer(binaryData);
return Container.get(BinaryDataService).getAsBuffer(binaryData);
}
/**