n8n-nodes-ilovevideoeditor 0.1.2 → 0.1.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.
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IloveVideoEditor = void 0;
|
|
4
|
+
// n8n's `json` parameter type can hand us the raw string instead of a parsed
|
|
5
|
+
// object — normalize before sending so the API always receives an object.
|
|
6
|
+
const parseJsonParam = (value) => {
|
|
7
|
+
if (typeof value === 'string') {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(value || '{}');
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return (value ?? {});
|
|
16
|
+
};
|
|
4
17
|
class IloveVideoEditor {
|
|
5
18
|
description = {
|
|
6
19
|
displayName: 'iLoveVideoEditor',
|
|
@@ -70,7 +83,7 @@ class IloveVideoEditor {
|
|
|
70
83
|
send: {
|
|
71
84
|
preSend: [
|
|
72
85
|
async function (requestOptions) {
|
|
73
|
-
const videoJSON = this.getNodeParameter('videoJSON');
|
|
86
|
+
const videoJSON = parseJsonParam(this.getNodeParameter('videoJSON'));
|
|
74
87
|
const webhookUrl = this.getNodeParameter('webhookUrl', '');
|
|
75
88
|
const body = { videoJSON };
|
|
76
89
|
if (webhookUrl) {
|
|
@@ -96,7 +109,7 @@ class IloveVideoEditor {
|
|
|
96
109
|
send: {
|
|
97
110
|
preSend: [
|
|
98
111
|
async function (requestOptions) {
|
|
99
|
-
const variables = this.getNodeParameter('variables', {});
|
|
112
|
+
const variables = parseJsonParam(this.getNodeParameter('variables', {}));
|
|
100
113
|
const webhookUrl = this.getNodeParameter('webhookUrl', '');
|
|
101
114
|
const body = { variables };
|
|
102
115
|
if (webhookUrl) {
|
|
@@ -277,12 +290,15 @@ class IloveVideoEditor {
|
|
|
277
290
|
async getTemplates() {
|
|
278
291
|
const credentials = await this.getCredentials('iloveVideoEditorApi');
|
|
279
292
|
const baseUrl = String(credentials.baseUrl || 'https://api.ilovevideoeditor.com').replace(/\/+$/, '');
|
|
280
|
-
const
|
|
293
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'iloveVideoEditorApi', {
|
|
281
294
|
method: 'GET',
|
|
282
295
|
baseURL: baseUrl,
|
|
283
296
|
url: '/v1/templates',
|
|
284
297
|
json: true,
|
|
285
|
-
})
|
|
298
|
+
});
|
|
299
|
+
const templates = Array.isArray(response)
|
|
300
|
+
? response
|
|
301
|
+
: (response.templates ?? []);
|
|
286
302
|
return templates.map((template) => ({
|
|
287
303
|
name: template.name,
|
|
288
304
|
value: template.id,
|
|
@@ -112,12 +112,16 @@ class IloveVideoEditorTrigger {
|
|
|
112
112
|
}
|
|
113
113
|
const credentials = await this.getCredentials('iloveVideoEditorApi');
|
|
114
114
|
const baseUrl = String(credentials.baseUrl || 'https://api.ilovevideoeditor.com').replace(/\/+$/, '');
|
|
115
|
-
const
|
|
115
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'iloveVideoEditorApi', {
|
|
116
116
|
method: 'GET',
|
|
117
117
|
baseURL: baseUrl,
|
|
118
118
|
url: '/v1/webhooks',
|
|
119
119
|
json: true,
|
|
120
|
-
})
|
|
120
|
+
});
|
|
121
|
+
const subscriptions = Array.isArray(response)
|
|
122
|
+
? response
|
|
123
|
+
: (response
|
|
124
|
+
.subscriptions ?? []);
|
|
121
125
|
return subscriptions.some((subscription) => subscription.url === webhookUrl);
|
|
122
126
|
},
|
|
123
127
|
async create() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-ilovevideoeditor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "n8n community nodes for the iLoveVideoEditor API — generate videos from templates or VideoJSON and receive render webhooks",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://ilovevideoeditor.com",
|