n8n-nodes-binary-to-url 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/drivers/index.js
CHANGED
|
@@ -6,50 +6,27 @@ const S3Storage_1 = require("./S3Storage");
|
|
|
6
6
|
var S3Storage_2 = require("./S3Storage");
|
|
7
7
|
Object.defineProperty(exports, "S3Storage", { enumerable: true, get: function () { return S3Storage_2.S3Storage; } });
|
|
8
8
|
async function createStorageDriver(context, bucket) {
|
|
9
|
-
|
|
10
|
-
let credentials = null;
|
|
11
|
-
let isAwsS3 = false;
|
|
12
|
-
try {
|
|
13
|
-
credentials = await context.getCredentials('awsS3');
|
|
14
|
-
if (credentials) {
|
|
15
|
-
isAwsS3 = false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
// S3 Compatible credentials not found, try AWS S3
|
|
20
|
-
}
|
|
21
|
-
// If S3 Compatible credentials not found, try AWS S3 API credentials
|
|
22
|
-
if (!credentials) {
|
|
23
|
-
try {
|
|
24
|
-
credentials = await context.getCredentials('awsS3Api');
|
|
25
|
-
if (credentials) {
|
|
26
|
-
isAwsS3 = true;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
// AWS S3 credentials not found
|
|
31
|
-
}
|
|
32
|
-
}
|
|
9
|
+
const credentials = await context.getCredentials('awsS3');
|
|
33
10
|
if (!credentials) {
|
|
34
|
-
throw new Error('No S3 credentials found. Please configure
|
|
11
|
+
throw new Error('No S3 credentials found. Please configure S3 credentials.');
|
|
35
12
|
}
|
|
36
13
|
const region = context.getNodeParameter('region', 0);
|
|
37
14
|
const endpoint = context.getNodeParameter('endpoint', 0);
|
|
38
15
|
const forcePathStyle = context.getNodeParameter('forcePathStyle', 0);
|
|
39
|
-
// Extract credentials -
|
|
40
|
-
const
|
|
41
|
-
|
|
16
|
+
// Extract credentials - handle both direct access and data wrapper
|
|
17
|
+
const creds = (credentials.data || credentials);
|
|
18
|
+
// Support multiple field naming conventions
|
|
19
|
+
const accessKeyId = creds.accessKeyId || creds.access_key_id;
|
|
20
|
+
const secretAccessKey = creds.secretAccessKey || creds.secret_access_key;
|
|
42
21
|
if (!accessKeyId || !secretAccessKey) {
|
|
43
22
|
throw new Error('Invalid credentials. Missing access key or secret key.');
|
|
44
23
|
}
|
|
45
24
|
// Auto-determine if path style should be forced
|
|
46
25
|
let shouldForcePathStyle = forcePathStyle;
|
|
47
|
-
//
|
|
26
|
+
// Force path style by default if custom endpoint is provided
|
|
48
27
|
// This is needed for MinIO, Wasabi, DigitalOcean Spaces, Alibaba OSS, Tencent COS, etc.
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
shouldForcePathStyle = true;
|
|
52
|
-
}
|
|
28
|
+
if (endpoint && endpoint !== '') {
|
|
29
|
+
shouldForcePathStyle = true;
|
|
53
30
|
}
|
|
54
31
|
const config = {
|
|
55
32
|
accessKeyId: accessKeyId,
|
|
@@ -36,27 +36,21 @@ const ALLOWED_MIME_TYPES = [
|
|
|
36
36
|
class BinaryBridge {
|
|
37
37
|
constructor() {
|
|
38
38
|
this.description = {
|
|
39
|
-
displayName: 'Binary
|
|
40
|
-
name: '
|
|
39
|
+
displayName: 'Binary to URL',
|
|
40
|
+
name: 'binaryToUrl',
|
|
41
41
|
icon: 'file:BinaryBridge.svg',
|
|
42
42
|
group: ['transform'],
|
|
43
43
|
version: 1,
|
|
44
44
|
subtitle: '={{$parameter["operation"]}}',
|
|
45
45
|
description: 'Upload binary files to S3 storage and proxy them via public URL',
|
|
46
46
|
defaults: {
|
|
47
|
-
name: 'Binary
|
|
47
|
+
name: 'Binary to URL',
|
|
48
48
|
},
|
|
49
49
|
inputs: ['main'],
|
|
50
50
|
outputs: ['main'],
|
|
51
51
|
credentials: [
|
|
52
52
|
{
|
|
53
53
|
name: 'awsS3',
|
|
54
|
-
displayName: 'S3 Compatible',
|
|
55
|
-
required: true,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'awsS3Api',
|
|
59
|
-
displayName: 'AWS S3',
|
|
60
54
|
required: true,
|
|
61
55
|
},
|
|
62
56
|
],
|
|
@@ -42,27 +42,21 @@ const ALLOWED_MIME_TYPES = [
|
|
|
42
42
|
|
|
43
43
|
export class BinaryBridge implements INodeType {
|
|
44
44
|
description: INodeTypeDescription = {
|
|
45
|
-
displayName: 'Binary
|
|
46
|
-
name: '
|
|
45
|
+
displayName: 'Binary to URL',
|
|
46
|
+
name: 'binaryToUrl',
|
|
47
47
|
icon: 'file:BinaryBridge.svg',
|
|
48
48
|
group: ['transform'],
|
|
49
49
|
version: 1,
|
|
50
50
|
subtitle: '={{$parameter["operation"]}}',
|
|
51
51
|
description: 'Upload binary files to S3 storage and proxy them via public URL',
|
|
52
52
|
defaults: {
|
|
53
|
-
name: 'Binary
|
|
53
|
+
name: 'Binary to URL',
|
|
54
54
|
},
|
|
55
55
|
inputs: ['main'],
|
|
56
56
|
outputs: ['main'],
|
|
57
57
|
credentials: [
|
|
58
58
|
{
|
|
59
59
|
name: 'awsS3',
|
|
60
|
-
displayName: 'S3 Compatible',
|
|
61
|
-
required: true,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: 'awsS3Api',
|
|
65
|
-
displayName: 'AWS S3',
|
|
66
60
|
required: true,
|
|
67
61
|
},
|
|
68
62
|
],
|
|
@@ -42,27 +42,21 @@ const ALLOWED_MIME_TYPES = [
|
|
|
42
42
|
|
|
43
43
|
export class BinaryBridge implements INodeType {
|
|
44
44
|
description: INodeTypeDescription = {
|
|
45
|
-
displayName: 'Binary
|
|
46
|
-
name: '
|
|
45
|
+
displayName: 'Binary to URL',
|
|
46
|
+
name: 'binaryToUrl',
|
|
47
47
|
icon: 'file:BinaryBridge.svg',
|
|
48
48
|
group: ['transform'],
|
|
49
49
|
version: 1,
|
|
50
50
|
subtitle: '={{$parameter["operation"]}}',
|
|
51
51
|
description: 'Upload binary files to S3 storage and proxy them via public URL',
|
|
52
52
|
defaults: {
|
|
53
|
-
name: 'Binary
|
|
53
|
+
name: 'Binary to URL',
|
|
54
54
|
},
|
|
55
55
|
inputs: ['main'],
|
|
56
56
|
outputs: ['main'],
|
|
57
57
|
credentials: [
|
|
58
58
|
{
|
|
59
59
|
name: 'awsS3',
|
|
60
|
-
displayName: 'S3 Compatible',
|
|
61
|
-
required: true,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: 'awsS3Api',
|
|
65
|
-
displayName: 'AWS S3',
|
|
66
60
|
required: true,
|
|
67
61
|
},
|
|
68
62
|
],
|