n8n-nodes-sendit 1.3.0 → 1.3.2

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.
@@ -189,7 +189,7 @@ class SendItTrigger {
189
189
  name: 'SendIt Trigger',
190
190
  },
191
191
  inputs: [],
192
- outputs: ['main'],
192
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
193
193
  credentials: [
194
194
  {
195
195
  name: 'sendItApi',
@@ -222,6 +222,7 @@ class SendItTrigger {
222
222
  description: 'Optional custom event string that overrides Event if set',
223
223
  },
224
224
  ],
225
+ usableAsTool: true,
225
226
  };
226
227
  this.webhookMethods = {
227
228
  default: {
@@ -9,31 +9,21 @@ exports.PLATFORM_OPTIONS = [
9
9
  { name: 'LinkedIn Page', value: 'linkedin-page' },
10
10
  { name: 'Facebook', value: 'facebook' },
11
11
  { name: 'Instagram', value: 'instagram' },
12
- { name: 'Instagram Standalone', value: 'instagram-standalone' },
13
12
  { name: 'Threads', value: 'threads' },
14
13
  { name: 'Bluesky', value: 'bluesky' },
15
14
  { name: 'Mastodon', value: 'mastodon' },
16
- { name: 'Warpcast', value: 'warpcast' },
17
15
  { name: 'Nostr', value: 'nostr' },
18
- { name: 'VK', value: 'vk' },
19
16
  { name: 'YouTube', value: 'youtube' },
20
17
  { name: 'TikTok', value: 'tiktok' },
21
- { name: 'Reddit', value: 'reddit' },
22
18
  { name: 'Lemmy', value: 'lemmy' },
23
19
  { name: 'Discord', value: 'discord' },
24
20
  { name: 'Slack', value: 'slack' },
25
21
  { name: 'Telegram', value: 'telegram' },
26
22
  { name: 'Pinterest', value: 'pinterest' },
27
23
  { name: 'Dribbble', value: 'dribbble' },
28
- { name: 'Medium', value: 'medium' },
29
24
  { name: 'DEV.to', value: 'devto' },
30
25
  { name: 'Hashnode', value: 'hashnode' },
31
- { name: 'WordPress', value: 'wordpress' },
32
26
  { name: 'Google My Business', value: 'gmb' },
33
- { name: 'Listmonk', value: 'listmonk' },
34
- { name: 'Skool', value: 'skool' },
35
27
  { name: 'Whop', value: 'whop' },
36
- { name: 'Kick', value: 'kick' },
37
- { name: 'Twitch', value: 'twitch' },
38
28
  { name: 'Product Hunt', value: 'producthunt' },
39
29
  ];
@@ -22,7 +22,7 @@ const handleAdvanced = async (context, operation, i, optionalHeaders) => {
22
22
  const parsedQuery = (0, helpers_1.parseJsonInput)(context, queryJson, 'Query JSON');
23
23
  const parsedBody = (0, helpers_1.parseJsonInput)(context, bodyJson, 'Body JSON');
24
24
  const qs = parsedQuery
25
- ? (0, helpers_1.assertObject)(parsedQuery, 'Query JSON must parse to an object')
25
+ ? (0, helpers_1.assertObject)(context, parsedQuery, 'Query JSON must parse to an object')
26
26
  : undefined;
27
27
  const body = parsedBody === undefined ? undefined : parsedBody;
28
28
  return (0, helpers_1.sendRequest)(context, {
@@ -15,7 +15,7 @@ const handleConnect = async (context, operation, i, optionalHeaders) => {
15
15
  const platform = context.getNodeParameter('connectPlatform', i);
16
16
  const credentialsJson = context.getNodeParameter('connectCredentialsJson', i);
17
17
  const parsed = (0, helpers_1.parseJsonInput)(context, credentialsJson, 'Credentials JSON');
18
- const credentials = (0, helpers_1.assertObject)(parsed, 'Credentials JSON must parse to an object');
18
+ const credentials = (0, helpers_1.assertObject)(context, parsed, 'Credentials JSON must parse to an object');
19
19
  return (0, helpers_1.sendRequest)(context, {
20
20
  method: 'POST',
21
21
  url: '/connect/token',
@@ -29,7 +29,7 @@ const handleConnect = async (context, operation, i, optionalHeaders) => {
29
29
  const metadataJson = context.getNodeParameter('connectMetadataJson', i);
30
30
  const parsedMetadata = (0, helpers_1.parseJsonInput)(context, metadataJson, 'Metadata JSON');
31
31
  const metadata = parsedMetadata
32
- ? (0, helpers_1.assertObject)(parsedMetadata, 'Metadata JSON must parse to an object')
32
+ ? (0, helpers_1.assertObject)(context, parsedMetadata, 'Metadata JSON must parse to an object')
33
33
  : undefined;
34
34
  return (0, helpers_1.sendRequest)(context, {
35
35
  method: 'POST',
@@ -1,70 +1,15 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.handleMedia = void 0;
37
4
  const n8n_workflow_1 = require("n8n-workflow");
38
5
  const helpers_1 = require("../helpers");
39
6
  const handleMedia = async (context, operation, i, optionalHeaders) => {
40
7
  if (operation === 'upload') {
41
- const inputMode = context.getNodeParameter('mediaInputMode', i);
42
- if (inputMode === 'binary') {
43
- const binaryPropertyName = context.getNodeParameter('binaryPropertyName', i);
44
- const binaryData = context.helpers.assertBinaryData(i, binaryPropertyName);
45
- const buffer = await context.helpers.getBinaryDataBuffer(i, binaryPropertyName);
46
- const formData = new FormData();
47
- formData.append('file', new Blob([buffer]), binaryData.fileName || 'upload');
48
- return (0, helpers_1.sendRequest)(context, {
49
- method: 'POST',
50
- url: '/media/upload',
51
- body: formData,
52
- }, optionalHeaders);
53
- }
54
- const filePath = context.getNodeParameter('filePath', i);
55
- const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
56
- const path = await Promise.resolve().then(() => __importStar(require('path')));
57
- const resolved = path.resolve(filePath);
58
- try {
59
- await fs.access(resolved);
60
- }
61
- catch {
62
- throw new n8n_workflow_1.NodeOperationError(context.getNode(), `File not found: ${resolved}`);
63
- }
64
- const fileBuffer = await fs.readFile(resolved);
65
- const fileName = path.basename(resolved);
8
+ const binaryPropertyName = context.getNodeParameter('binaryPropertyName', i);
9
+ const binaryData = context.helpers.assertBinaryData(i, binaryPropertyName);
10
+ const buffer = await context.helpers.getBinaryDataBuffer(i, binaryPropertyName);
66
11
  const formData = new FormData();
67
- formData.append('file', new Blob([fileBuffer]), fileName);
12
+ formData.append('file', new Blob([buffer]), binaryData.fileName || 'upload');
68
13
  return (0, helpers_1.sendRequest)(context, {
69
14
  method: 'POST',
70
15
  url: '/media/upload',
@@ -10,7 +10,7 @@ export declare function sendRequest(context: IExecuteFunctions, request: {
10
10
  url: string;
11
11
  [key: string]: unknown;
12
12
  }, optionalHeaders: Record<string, string>, baseURL?: string): Promise<unknown>;
13
- export declare function assertObject(value: unknown, message: string): Record<string, unknown>;
13
+ export declare function assertObject(context: IExecuteFunctions, value: unknown, message: string): Record<string, unknown>;
14
14
  export interface AiOptions {
15
15
  hashtags?: string;
16
16
  tone?: string;
@@ -112,12 +112,12 @@ async function sendRequest(context, request, optionalHeaders, baseURL = constant
112
112
  description: `The API rejected the request to ${request.method} ${request.url}. Check your parameters.`,
113
113
  });
114
114
  }
115
- throw error;
115
+ throw new n8n_workflow_1.NodeApiError(context.getNode(), error);
116
116
  }
117
117
  }
118
- function assertObject(value, message) {
118
+ function assertObject(context, value, message) {
119
119
  if (!value || typeof value !== 'object' || Array.isArray(value)) {
120
- throw new Error(message);
120
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), message);
121
121
  }
122
122
  return value;
123
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-sendit",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "n8n community node for SendIt - Multi-platform social media publishing",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -27,7 +27,7 @@
27
27
  "main": "index.js",
28
28
  "scripts": {
29
29
  "build": "tsc && npm run copy:icons",
30
- "copy:icons": "mkdir -p dist/nodes/SendIt && cp nodes/SendIt/*.svg dist/nodes/SendIt/",
30
+ "copy:icons": "mkdir -p dist/nodes/SendIt dist/credentials && cp nodes/SendIt/*.svg dist/nodes/SendIt/ && cp nodes/SendIt/*.svg dist/credentials/",
31
31
  "dev": "tsc --watch",
32
32
  "format": "prettier nodes credentials --write",
33
33
  "lint": "eslint nodes credentials --fix",
@@ -44,6 +44,7 @@
44
44
  ],
45
45
  "n8n": {
46
46
  "n8nNodesApiVersion": 1,
47
+ "strict": true,
47
48
  "credentials": [
48
49
  "dist/credentials/SendItApi.credentials.js"
49
50
  ],
@@ -53,11 +54,12 @@
53
54
  ]
54
55
  },
55
56
  "devDependencies": {
57
+ "@n8n/node-cli": "^0.29.1",
58
+ "@types/node": "^20.10.0",
56
59
  "@typescript-eslint/eslint-plugin": "^8.19.0",
57
60
  "@typescript-eslint/parser": "^8.19.0",
58
- "@types/node": "^20.10.0",
59
61
  "eslint": "^9.17.0",
60
- "n8n-workflow": "^1.0.0",
62
+ "n8n-workflow": "^2.16.0",
61
63
  "prettier": "^3.1.0",
62
64
  "typescript": "^5.3.0",
63
65
  "vitest": "^2.1.9"