n8n-nodes-binary-to-url 0.0.6 → 0.0.7

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.
@@ -1,5 +1,5 @@
1
1
  import type { Icon, ICredentialType, INodeProperties } from 'n8n-workflow';
2
- export declare class S3StorageApi implements ICredentialType {
2
+ export declare class S3Api implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  icon: Icon;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.S3StorageApi = void 0;
4
- class S3StorageApi {
3
+ exports.S3Api = void 0;
4
+ class S3Api {
5
5
  constructor() {
6
- this.name = 's3StorageApi';
7
- this.displayName = 'S3 Storage API';
6
+ this.name = 's3Api';
7
+ this.displayName = 'S3 API';
8
8
  this.icon = 'file:../icons/BinaryToUrl.svg';
9
9
  this.documentationUrl = 'https://docs.aws.amazon.com/AmazonS3/latest/userguide/AccessCredentials.html';
10
10
  this.properties = [
@@ -22,14 +22,29 @@ class S3StorageApi {
22
22
  typeOptions: { password: true },
23
23
  default: '',
24
24
  },
25
+ {
26
+ displayName: 'Region',
27
+ name: 'region',
28
+ type: 'string',
29
+ default: 'us-east-1',
30
+ description: 'AWS region (e.g., us-east-1, eu-west-1)',
31
+ },
32
+ {
33
+ displayName: 'S3 Endpoint',
34
+ name: 's3Api',
35
+ type: 'string',
36
+ default: '',
37
+ placeholder: 'https://s3.amazonaws.com',
38
+ description: 'S3-compatible service endpoint (required for MinIO, DigitalOcean Spaces, Wasabi, etc.). Leave empty for AWS S3.',
39
+ },
25
40
  ];
26
41
  this.test = {
27
42
  request: {
28
- baseURL: '={{$credentials.endpoint}}',
43
+ baseURL: '={{$credentials.s3Api}}',
29
44
  url: '=/',
30
45
  method: 'GET',
31
46
  },
32
47
  };
33
48
  }
34
49
  }
35
- exports.S3StorageApi = S3StorageApi;
50
+ exports.S3Api = S3Api;
@@ -6,18 +6,23 @@ 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
- const credentials = await context.getCredentials('s3StorageApi');
9
+ const credentials = await context.getCredentials('s3Api');
10
10
  if (!credentials) {
11
11
  throw new Error('No S3 credentials found. Please configure S3 credentials.');
12
12
  }
13
13
  const region = context.getNodeParameter('region', 0);
14
14
  const endpoint = context.getNodeParameter('endpoint', 0);
15
15
  const forcePathStyle = context.getNodeParameter('forcePathStyle', 0);
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;
16
+ // Extract credentials from S3 API credential
17
+ const creds = credentials;
18
+ const accessKeyId = creds.accessKeyId || '';
19
+ const secretAccessKey = creds.secretAccessKey || '';
20
+ const credentialEndpoint = creds.s3Api;
21
+ const credentialRegion = creds.region;
22
+ // Use credential endpoint if node parameter is empty
23
+ const finalEndpoint = endpoint || credentialEndpoint;
24
+ // Use credential region if node parameter is empty
25
+ const finalRegion = region || credentialRegion || 'us-east-1';
21
26
  if (!accessKeyId || !secretAccessKey) {
22
27
  throw new Error('Invalid credentials. Missing access key or secret key.');
23
28
  }
@@ -25,15 +30,15 @@ async function createStorageDriver(context, bucket) {
25
30
  let shouldForcePathStyle = forcePathStyle;
26
31
  // Force path style by default if custom endpoint is provided
27
32
  // This is needed for MinIO, Wasabi, DigitalOcean Spaces, Alibaba OSS, Tencent COS, etc.
28
- if (endpoint && endpoint !== '') {
33
+ if (finalEndpoint && finalEndpoint !== '') {
29
34
  shouldForcePathStyle = true;
30
35
  }
31
36
  const config = {
32
37
  accessKeyId: accessKeyId,
33
38
  secretAccessKey: secretAccessKey,
34
- region: region || 'us-east-1',
39
+ region: finalRegion,
35
40
  bucket,
36
- endpoint: endpoint || undefined,
41
+ endpoint: finalEndpoint || undefined,
37
42
  forcePathStyle: shouldForcePathStyle,
38
43
  };
39
44
  return new S3Storage_1.S3Storage(config);
@@ -50,7 +50,7 @@ class BinaryToUrl {
50
50
  outputs: ['main'],
51
51
  credentials: [
52
52
  {
53
- name: 's3StorageApi',
53
+ name: 's3Api',
54
54
  required: true,
55
55
  },
56
56
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-binary-to-url",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "n8n community node for binary file to public URL bridge with S3 storage",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -40,7 +40,7 @@
40
40
  "n8nNodesApiVersion": 1,
41
41
  "strict": true,
42
42
  "credentials": [
43
- "dist/credentials/S3StorageApi.credentials.js"
43
+ "dist/credentials/S3Api.credentials.js"
44
44
  ],
45
45
  "nodes": [
46
46
  "dist/nodes/BinaryToUrl/BinaryToUrl.node.js"