n8n-nodes-byteplus 0.1.0

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.
Files changed (40) hide show
  1. package/README.md +201 -0
  2. package/dist/credentials/BytePlusApi.credentials.d.ts +9 -0
  3. package/dist/credentials/BytePlusApi.credentials.js +70 -0
  4. package/dist/credentials/BytePlusApi.credentials.js.map +1 -0
  5. package/dist/credentials/TikTokOAuth2Api.credentials.d.ts +8 -0
  6. package/dist/credentials/TikTokOAuth2Api.credentials.js +78 -0
  7. package/dist/credentials/TikTokOAuth2Api.credentials.js.map +1 -0
  8. package/dist/nodes/BytePlus/BytePlus.node.d.ts +5 -0
  9. package/dist/nodes/BytePlus/BytePlus.node.js +137 -0
  10. package/dist/nodes/BytePlus/BytePlus.node.js.map +1 -0
  11. package/dist/nodes/BytePlus/actions/Image/generateImage.operation.d.ts +3 -0
  12. package/dist/nodes/BytePlus/actions/Image/generateImage.operation.js +208 -0
  13. package/dist/nodes/BytePlus/actions/Image/generateImage.operation.js.map +1 -0
  14. package/dist/nodes/BytePlus/actions/Image/index.d.ts +5 -0
  15. package/dist/nodes/BytePlus/actions/Image/index.js +69 -0
  16. package/dist/nodes/BytePlus/actions/Image/index.js.map +1 -0
  17. package/dist/nodes/BytePlus/actions/Text/answerQuestion.operation.d.ts +3 -0
  18. package/dist/nodes/BytePlus/actions/Text/answerQuestion.operation.js +146 -0
  19. package/dist/nodes/BytePlus/actions/Text/answerQuestion.operation.js.map +1 -0
  20. package/dist/nodes/BytePlus/actions/Text/index.d.ts +5 -0
  21. package/dist/nodes/BytePlus/actions/Text/index.js +69 -0
  22. package/dist/nodes/BytePlus/actions/Text/index.js.map +1 -0
  23. package/dist/nodes/BytePlus/actions/Video/generateVideo.operation.d.ts +3 -0
  24. package/dist/nodes/BytePlus/actions/Video/generateVideo.operation.js +349 -0
  25. package/dist/nodes/BytePlus/actions/Video/generateVideo.operation.js.map +1 -0
  26. package/dist/nodes/BytePlus/actions/Video/index.d.ts +5 -0
  27. package/dist/nodes/BytePlus/actions/Video/index.js +69 -0
  28. package/dist/nodes/BytePlus/actions/Video/index.js.map +1 -0
  29. package/dist/nodes/BytePlus/byteplus.svg +1 -0
  30. package/dist/nodes/TikTok/TikTok.node.d.ts +5 -0
  31. package/dist/nodes/TikTok/TikTok.node.js +113 -0
  32. package/dist/nodes/TikTok/TikTok.node.js.map +1 -0
  33. package/dist/nodes/TikTok/actions/Video/index.d.ts +5 -0
  34. package/dist/nodes/TikTok/actions/Video/index.js +69 -0
  35. package/dist/nodes/TikTok/actions/Video/index.js.map +1 -0
  36. package/dist/nodes/TikTok/actions/Video/uploadVideo.operation.d.ts +3 -0
  37. package/dist/nodes/TikTok/actions/Video/uploadVideo.operation.js +321 -0
  38. package/dist/nodes/TikTok/actions/Video/uploadVideo.operation.js.map +1 -0
  39. package/dist/nodes/TikTok/tiktok.svg +5 -0
  40. package/package.json +68 -0
package/README.md ADDED
@@ -0,0 +1,201 @@
1
+ # n8n-nodes-byteplus
2
+
3
+ **n8n community node for BytePlus AI services** - Image Generation, Video Generation, Text Generation, and TikTok Publishing.
4
+
5
+ ## Features
6
+
7
+ | Service | Capabilities |
8
+ |---------|-------------|
9
+ | **Image Generation** | Generate images using Seedream models (2K, 1080p, 720p, 1024x1024) |
10
+ | **Video Generation** | Create videos from text + reference images using Seedance |
11
+ | **Text Generation** | Generate text responses using Seed LLM |
12
+ | **TikTok Publishing** | Publish videos to TikTok (placeholder implementation) |
13
+
14
+ ## Installation
15
+
16
+ ### Option 1: Community Node (Recommended)
17
+
18
+ 1. In your n8n instance, go to **Settings > Community Nodes**
19
+ 2. Click **Install**
20
+ 3. Enter `n8n-nodes-byteplus`
21
+ 4. Agree to the risks and click **Install**
22
+
23
+ ### Option 2: Manual Installation
24
+
25
+ ```bash
26
+ npm install n8n-nodes-byteplus
27
+ ```
28
+
29
+ ## Setup
30
+
31
+ ### 1. Get BytePlus API Credentials
32
+
33
+ 1. Sign up at [BytePlus](https://www.byteplus.com/)
34
+ 2. Navigate to the ARK console
35
+ 3. Generate an API key
36
+
37
+ ### 2. Configure Credentials in n8n
38
+
39
+ 1. In n8n, go to **Credentials**
40
+ 2. Click **New Credential**
41
+ 3. Search for **BytePlus API**
42
+ 4. Enter your API key and configure endpoints if needed
43
+
44
+ ## Usage
45
+
46
+ ### Image Generation
47
+
48
+ Generate images from text prompts using Seedream models.
49
+
50
+ **Parameters:**
51
+ - **Prompt** (required): Text description of the image
52
+ - **Model**: Seedream 4.0 (default), Seedream 3.0, or Custom
53
+ - **Size**: 2K, 1080p, 720p, or 1024x1024
54
+ - **Watermark**: Add watermark (default: true)
55
+
56
+ **Output:** Images are displayed directly in n8n output panel with download URLs.
57
+
58
+ ### Video Generation
59
+
60
+ Create videos from text descriptions and reference images using Seedance.
61
+
62
+ **Parameters:**
63
+ - **Prompt** (required): Text description of the video
64
+ - **Reference Image URL** (required): Public https:// URL of reference image
65
+ - **Model**: Seedance 1.0 Lite I2V (default) or Custom
66
+ - **Max Wait Time**: Polling timeout in seconds (default: 300)
67
+
68
+ ### Text Generation
69
+
70
+ Generate text responses using Seed LLM.
71
+
72
+ **Parameters:**
73
+ - **Prompt** (required): Question or prompt text
74
+ - **Model**: Model ID for specific Seed LLM models
75
+
76
+ ### TikTok Publishing
77
+
78
+ Publish videos to TikTok (placeholder implementation).
79
+
80
+ **Parameters:**
81
+ - **Video URL** (required): URL of video to publish
82
+ - **Caption**: Caption text for the post
83
+ - **Hashtags**: Comma-separated hashtags
84
+ - **Privacy Level**: public, friends, or private
85
+
86
+ ## Local Development
87
+
88
+ ### Prerequisites
89
+
90
+ - Node.js >=18.0.0
91
+ - Docker and Docker Compose
92
+
93
+ ### Quick Start
94
+
95
+ 1. **Clone and install dependencies:**
96
+ ```bash
97
+ git clone <your-repo-url>
98
+ cd n8n-nodes-byteplus
99
+ npm install
100
+ ```
101
+
102
+ 2. **Build the node:**
103
+ ```bash
104
+ npm run build
105
+ ```
106
+
107
+ 3. **Start n8n with the custom node:**
108
+ ```bash
109
+ docker-compose up
110
+ ```
111
+
112
+ 4. **Access n8n:**
113
+ - Open http://localhost:5679
114
+ - Create your workflow
115
+ - Add BytePlus node from the nodes panel
116
+ - Configure your BytePlus API credentials
117
+
118
+ ### Development Commands
119
+
120
+ ```bash
121
+ # Build the node
122
+ npm run build
123
+
124
+ # Watch mode for development
125
+ npm run dev
126
+
127
+ # Lint code
128
+ npm run lint
129
+
130
+ # Fix linting issues
131
+ npm run lintfix
132
+
133
+ # Format code
134
+ npm run format
135
+
136
+ # Type checking
137
+ npm run typecheck
138
+ ```
139
+
140
+ ### Project Structure
141
+
142
+ ```
143
+ n8n-nodes-byteplus/
144
+ ├── credentials/
145
+ │ └── BytePlusApi.credentials.ts # API credential configuration
146
+ ├── nodes/
147
+ │ └── BytePlus/
148
+ │ ├── BytePlus.node.ts # Main node definition
149
+ │ ├── byteplus.svg # Node icon
150
+ │ └── actions/
151
+ │ ├── Image/ # Image generation operations
152
+ │ ├── Video/ # Video generation operations
153
+ │ ├── Text/ # Text generation operations
154
+ │ └── Sharing/ # TikTok publishing operations
155
+ ├── dist/ # Built files (auto-generated)
156
+ ├── package.json # Dependencies and scripts
157
+ ├── tsconfig.json # TypeScript configuration
158
+ └── docker-compose.yml # Development environment
159
+ ```
160
+
161
+ ## Security
162
+
163
+ - **No credentials are hardcoded in this repo** (only field definitions)
164
+ - **Secure your n8n instance before exposing it** (auth + access controls), especially if using tunnels for OAuth redirects
165
+ - **Keep TLS verification enabled** (avoid `NODE_TLS_REJECT_UNAUTHORIZED=0` unless you fully understand the MITM risk)
166
+
167
+ ## API Reference
168
+
169
+ | Operation | Endpoint |
170
+ |-----------|----------|
171
+ | Image Generation | `/api/v3/images/generations` |
172
+ | Video Generation | `/api/v3/contents/generations/tasks` |
173
+ | Text Generation | `/api/v3/chat/completions` |
174
+
175
+ ## Troubleshooting
176
+
177
+ ### Common Issues
178
+
179
+ **Node not appearing in n8n:**
180
+ - Ensure you built the project (`npm run build`)
181
+ - Check docker-compose volumes are mounted correctly
182
+ - Restart the n8n container
183
+
184
+ **API authentication errors:**
185
+ - Verify your BytePlus API key is correct
186
+ - Check the base URL is set properly
187
+ - Ensure your BytePlus account has necessary permissions
188
+
189
+ **Build errors:**
190
+ - Run `npm install` to ensure all dependencies are installed
191
+ - Check Node.js version (>=18.0.0 required)
192
+
193
+ ## License
194
+
195
+ MIT
196
+
197
+ ## Links
198
+
199
+ - [BytePlus Documentation](https://www.byteplus.com/en/docs)
200
+ - [BytePlus ARK Console](https://console.byteplus.com/ark)
201
+ - [n8n Community Nodes](https://docs.n8n.io/integrations/community-nodes/)
@@ -0,0 +1,9 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class BytePlusApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BytePlusApi = void 0;
4
+ class BytePlusApi {
5
+ constructor() {
6
+ this.name = 'bytePlusApi';
7
+ this.displayName = 'BytePlus API';
8
+ this.documentationUrl = 'https://docs.byteplus.com/en/docs';
9
+ this.properties = [
10
+ {
11
+ displayName: 'API Key',
12
+ name: 'apiKey',
13
+ type: 'string',
14
+ typeOptions: {
15
+ password: true,
16
+ },
17
+ default: '',
18
+ required: true,
19
+ description: 'Your BytePlus ModelArk API Key',
20
+ },
21
+ {
22
+ displayName: 'Base URL',
23
+ name: 'baseUrl',
24
+ type: 'string',
25
+ default: 'https://ark.ap-southeast.bytepluses.com',
26
+ required: true,
27
+ description: 'BytePlus API Base URL',
28
+ },
29
+ {
30
+ displayName: 'Image Generation Endpoint',
31
+ name: 'imageEndpoint',
32
+ type: 'string',
33
+ default: '/api/v3/images/generations',
34
+ description: 'Endpoint for Seedream image generation',
35
+ },
36
+ {
37
+ displayName: 'Video Generation Endpoint',
38
+ name: 'videoEndpoint',
39
+ type: 'string',
40
+ default: '/api/v3/contents/generations/tasks',
41
+ description: 'Endpoint for Seedance video generation',
42
+ },
43
+ {
44
+ displayName: 'Chat Completions Endpoint',
45
+ name: 'chatEndpoint',
46
+ type: 'string',
47
+ default: '/api/v3/chat/completions',
48
+ description: 'Endpoint for Seed chat/text completions',
49
+ },
50
+ ];
51
+ this.authenticate = {
52
+ type: 'generic',
53
+ properties: {
54
+ headers: {
55
+ Authorization: '={{"Bearer " + $credentials.apiKey}}',
56
+ 'Content-Type': 'application/json',
57
+ },
58
+ },
59
+ };
60
+ this.test = {
61
+ request: {
62
+ baseURL: '={{$credentials.baseUrl}}',
63
+ url: '/api/v3/models',
64
+ method: 'GET',
65
+ },
66
+ };
67
+ }
68
+ }
69
+ exports.BytePlusApi = BytePlusApi;
70
+ //# sourceMappingURL=BytePlusApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BytePlusApi.credentials.js","sourceRoot":"","sources":["../../credentials/BytePlusApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GAAG,mCAAmC,CAAC;QACvD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,gCAAgC;aAC7C;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,yCAAyC;gBAClD,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,uBAAuB;aACpC;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,4BAA4B;gBACrC,WAAW,EAAE,wCAAwC;aACrD;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,oCAAoC;gBAC7C,WAAW,EAAE,wCAAwC;aACrD;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,0BAA0B;gBACnC,WAAW,EAAE,yCAAyC;aACtD;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,sCAAsC;oBACrD,cAAc,EAAE,kBAAkB;iBAClC;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,gBAAgB;gBACrB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAhED,kCAgEC"}
@@ -0,0 +1,8 @@
1
+ import type { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class TikTokOAuth2Api implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TikTokOAuth2Api = void 0;
4
+ class TikTokOAuth2Api {
5
+ constructor() {
6
+ this.name = 'tiktokOAuth2Api';
7
+ this.displayName = 'TikTok API';
8
+ this.documentationUrl = 'https://developers.tiktok.com/doc/login-kit-web';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Client Key',
12
+ name: 'clientKey',
13
+ type: 'string',
14
+ typeOptions: {
15
+ password: true,
16
+ },
17
+ default: '',
18
+ required: true,
19
+ description: 'Your TikTok app Client Key',
20
+ },
21
+ {
22
+ displayName: 'Client Secret',
23
+ name: 'clientSecret',
24
+ type: 'string',
25
+ typeOptions: {
26
+ password: true,
27
+ },
28
+ default: '',
29
+ required: true,
30
+ description: 'Your TikTok app Client Secret',
31
+ },
32
+ {
33
+ displayName: 'Access Token',
34
+ name: 'accessToken',
35
+ type: 'string',
36
+ typeOptions: {
37
+ password: true,
38
+ },
39
+ default: '',
40
+ required: true,
41
+ description: 'Get this from the get-tiktok-token.sh script',
42
+ },
43
+ {
44
+ displayName: 'Refresh Token',
45
+ name: 'refreshToken',
46
+ type: 'string',
47
+ typeOptions: {
48
+ password: true,
49
+ },
50
+ default: '',
51
+ required: true,
52
+ description: 'Used to automatically refresh access token',
53
+ },
54
+ {
55
+ displayName: 'Open ID',
56
+ name: 'openId',
57
+ type: 'string',
58
+ typeOptions: {
59
+ password: true,
60
+ },
61
+ default: '',
62
+ required: true,
63
+ description: 'Your TikTok Open ID (returned from OAuth)',
64
+ },
65
+ ];
66
+ this.authenticate = {
67
+ type: 'generic',
68
+ properties: {
69
+ headers: {
70
+ Authorization: '=Bearer {{$credentials.accessToken}}',
71
+ 'Content-Type': 'application/json',
72
+ },
73
+ },
74
+ };
75
+ }
76
+ }
77
+ exports.TikTokOAuth2Api = TikTokOAuth2Api;
78
+ //# sourceMappingURL=TikTokOAuth2Api.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TikTokOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/TikTokOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAMA,MAAa,eAAe;IAA5B;QACC,SAAI,GAAG,iBAAiB,CAAC;QACzB,gBAAW,GAAG,YAAY,CAAC;QAC3B,qBAAgB,GAAG,iDAAiD,CAAC;QACrE,eAAU,GAAsB;YAC/B;gBACC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,CAAC;CAAA;AAvED,0CAuEC"}
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class BytePlus implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,137 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BytePlus = void 0;
37
+ const image = __importStar(require("./actions/Image"));
38
+ const video = __importStar(require("./actions/Video"));
39
+ const text = __importStar(require("./actions/Text"));
40
+ class BytePlus {
41
+ constructor() {
42
+ this.description = {
43
+ displayName: 'BytePlus',
44
+ name: 'bytePlus',
45
+ icon: 'file:byteplus.svg',
46
+ group: ['transform'],
47
+ version: 1,
48
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
49
+ description: 'BytePlus AI Services - Image Generation, Video Generation, and Text Generation',
50
+ defaults: {
51
+ name: 'BytePlus',
52
+ },
53
+ inputs: ['main'],
54
+ outputs: ['main'],
55
+ credentials: [
56
+ {
57
+ name: 'bytePlusApi',
58
+ required: true,
59
+ },
60
+ ],
61
+ properties: [
62
+ {
63
+ displayName: 'Resource',
64
+ name: 'resource',
65
+ type: 'options',
66
+ noDataExpression: true,
67
+ options: [
68
+ {
69
+ name: 'Image',
70
+ value: 'image',
71
+ description: 'Generate an image',
72
+ },
73
+ {
74
+ name: 'Video',
75
+ value: 'video',
76
+ description: 'Generate a video',
77
+ },
78
+ {
79
+ name: 'Text',
80
+ value: 'text',
81
+ description: 'Message a model',
82
+ },
83
+ ],
84
+ default: 'text',
85
+ },
86
+ // Image operations
87
+ ...image.description,
88
+ // Text operations
89
+ ...text.description,
90
+ // Video operations
91
+ ...video.description,
92
+ ],
93
+ };
94
+ }
95
+ async execute() {
96
+ const items = this.getInputData();
97
+ const returnData = [];
98
+ const resource = this.getNodeParameter('resource', 0);
99
+ const operation = this.getNodeParameter('operation', 0);
100
+ for (let i = 0; i < items.length; i++) {
101
+ try {
102
+ let responseData;
103
+ if (resource === 'image') {
104
+ responseData = await image.execute.call(this, i, operation);
105
+ }
106
+ else if (resource === 'text') {
107
+ responseData = await text.execute.call(this, i, operation);
108
+ }
109
+ else if (resource === 'video') {
110
+ responseData = await video.execute.call(this, i, operation);
111
+ }
112
+ if (responseData) {
113
+ if (Array.isArray(responseData)) {
114
+ returnData.push(...responseData);
115
+ }
116
+ else if (responseData.json !== undefined) {
117
+ // Already formatted as INodeExecutionData (has json/binary properties)
118
+ returnData.push(responseData);
119
+ }
120
+ else {
121
+ returnData.push({ json: responseData });
122
+ }
123
+ }
124
+ }
125
+ catch (error) {
126
+ if (this.continueOnFail()) {
127
+ returnData.push({ json: { error: error.message } });
128
+ continue;
129
+ }
130
+ throw error;
131
+ }
132
+ }
133
+ return [returnData];
134
+ }
135
+ }
136
+ exports.BytePlus = BytePlus;
137
+ //# sourceMappingURL=BytePlus.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BytePlus.node.js","sourceRoot":"","sources":["../../../nodes/BytePlus/BytePlus.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,uDAAyC;AACzC,uDAAyC;AACzC,qDAAuC;AAGvC,MAAa,QAAQ;IAArB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,gFAAgF;YAC7F,QAAQ,EAAE;gBACT,IAAI,EAAE,UAAU;aAChB;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,OAAO;4BACd,WAAW,EAAE,mBAAmB;yBAChC;wBACD;4BACC,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,OAAO;4BACd,WAAW,EAAE,kBAAkB;yBAC/B;wBACD;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,MAAM;4BACb,WAAW,EAAE,iB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C,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;oBAClC,CAAC;yBAAM,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;wBAC5C,uEAAuE;wBACvE,UAAU,CAAC,IAAI,CAAC,YAAkC,CAAC,CAAC;oBACrD,CAAC;yBAAM,CAAC;wBACP,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;oBACzC,CAAC;gBACF,CAAC;YACF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;oBAC/D,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AA7FD,4BA6FC"}
@@ -0,0 +1,3 @@
1
+ import type { IExecuteFunctions, INodeProperties, INodeExecutionData } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, index: number): Promise<INodeExecutionData>;