n8n-nodes-wix 1.0.3 → 1.0.5
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/{nodes/sites/index.js → WixSiteList.node.js} +6 -22
- package/nodes/{sites/index.ts → WixSiteList.node.ts} +25 -44
- package/package.json +1 -2
- package/tsconfig.json +2 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -6
- package/index.ts +0 -4
- /package/dist/{nodes/sites/index.d.ts → WixSiteList.node.d.ts} +0 -0
|
@@ -11,13 +11,13 @@ class WixSiteList {
|
|
|
11
11
|
this.description = {
|
|
12
12
|
displayName: 'Wix Site List',
|
|
13
13
|
name: 'wixSiteList',
|
|
14
|
-
icon: 'file:wix.png',
|
|
14
|
+
icon: 'file:wix.png',
|
|
15
15
|
group: ['transform'],
|
|
16
16
|
version: 1,
|
|
17
17
|
description: 'Retrieve a list of Wix sites dynamically',
|
|
18
18
|
defaults: {
|
|
19
19
|
name: 'Wix Site List',
|
|
20
|
-
color: '#1A73E8',
|
|
20
|
+
color: '#1A73E8',
|
|
21
21
|
},
|
|
22
22
|
inputs: ['main'],
|
|
23
23
|
outputs: ['main'],
|
|
@@ -28,58 +28,48 @@ class WixSiteList {
|
|
|
28
28
|
type: 'string',
|
|
29
29
|
default: '',
|
|
30
30
|
required: true,
|
|
31
|
-
description: 'Your Wix account-level API key or OAuth token',
|
|
32
31
|
},
|
|
33
32
|
{
|
|
34
33
|
displayName: 'Filter',
|
|
35
34
|
name: 'filter',
|
|
36
35
|
type: 'json',
|
|
37
36
|
default: {},
|
|
38
|
-
description: 'JSON object to filter the sites. Example: {"displayName":"my-site"}',
|
|
39
37
|
},
|
|
40
38
|
{
|
|
41
39
|
displayName: 'Limit',
|
|
42
40
|
name: 'limit',
|
|
43
41
|
type: 'number',
|
|
44
42
|
default: 100,
|
|
45
|
-
description: 'Maximum number of sites to return (max 1000)',
|
|
46
43
|
},
|
|
47
44
|
{
|
|
48
45
|
displayName: 'Cursor',
|
|
49
46
|
name: 'cursor',
|
|
50
47
|
type: 'string',
|
|
51
48
|
default: '',
|
|
52
|
-
description: 'Cursor for paging. Leave empty for the first request',
|
|
53
49
|
},
|
|
54
50
|
{
|
|
55
51
|
displayName: 'Sort',
|
|
56
52
|
name: 'sort',
|
|
57
53
|
type: 'json',
|
|
58
54
|
default: [],
|
|
59
|
-
description: 'JSON array of objects for sorting. Example: [{"fieldName":"displayName","order":"ASC"}]',
|
|
60
55
|
},
|
|
61
56
|
{
|
|
62
57
|
displayName: 'Fields',
|
|
63
58
|
name: 'fields',
|
|
64
59
|
type: 'json',
|
|
65
60
|
default: {},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
]
|
|
61
|
+
},
|
|
62
|
+
],
|
|
69
63
|
};
|
|
70
64
|
}
|
|
71
|
-
// Função principal do node
|
|
72
65
|
async execute() {
|
|
73
|
-
const items = this.getInputData(); // dados recebidos de outros nodes
|
|
74
66
|
const returnData = [];
|
|
75
|
-
// Pegando valores dos parâmetros do node
|
|
76
67
|
const apiKey = this.getNodeParameter('apiKey', 0);
|
|
77
68
|
const filter = this.getNodeParameter('filter', 0);
|
|
78
69
|
const limit = this.getNodeParameter('limit', 0);
|
|
79
70
|
const cursor = this.getNodeParameter('cursor', 0);
|
|
80
71
|
const sort = this.getNodeParameter('sort', 0);
|
|
81
72
|
const fields = this.getNodeParameter('fields', 0);
|
|
82
|
-
// Montando o corpo da requisição
|
|
83
73
|
const body = {
|
|
84
74
|
query: {
|
|
85
75
|
filter,
|
|
@@ -89,9 +79,8 @@ class WixSiteList {
|
|
|
89
79
|
},
|
|
90
80
|
sort,
|
|
91
81
|
fields,
|
|
92
|
-
}
|
|
82
|
+
},
|
|
93
83
|
};
|
|
94
|
-
// Configuração da requisição HTTP
|
|
95
84
|
const config = {
|
|
96
85
|
method: 'POST',
|
|
97
86
|
url: 'https://www.wixapis.com/site-list/v2/sites/query',
|
|
@@ -100,9 +89,7 @@ class WixSiteList {
|
|
|
100
89
|
'Content-Type': 'application/json',
|
|
101
90
|
},
|
|
102
91
|
data: body,
|
|
103
|
-
validateStatus: (status) => status >= 200 && status < 300,
|
|
104
92
|
};
|
|
105
|
-
// Executando a requisição
|
|
106
93
|
let responseData;
|
|
107
94
|
try {
|
|
108
95
|
const response = await (0, axios_1.default)(config);
|
|
@@ -111,12 +98,9 @@ class WixSiteList {
|
|
|
111
98
|
catch (error) {
|
|
112
99
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
|
|
113
100
|
}
|
|
114
|
-
// Retornando os sites como output
|
|
115
101
|
if (responseData.sites && Array.isArray(responseData.sites)) {
|
|
116
102
|
for (const site of responseData.sites) {
|
|
117
|
-
returnData.push({
|
|
118
|
-
json: site
|
|
119
|
-
});
|
|
103
|
+
returnData.push({ json: site });
|
|
120
104
|
}
|
|
121
105
|
}
|
|
122
106
|
return [returnData];
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { INodeType, INodeTypeDescription, IExecuteFunctions, INodeExecutionData, NodeOperationError } from 'n8n-workflow'
|
|
2
|
-
import { IDataObject } from 'n8n-workflow'
|
|
3
|
-
import axios, { AxiosRequestConfig } from 'axios'
|
|
1
|
+
import { INodeType, INodeTypeDescription, IExecuteFunctions, INodeExecutionData, NodeOperationError } from 'n8n-workflow';
|
|
2
|
+
import { IDataObject } from 'n8n-workflow';
|
|
3
|
+
import axios, { AxiosRequestConfig } from 'axios';
|
|
4
4
|
|
|
5
5
|
export class WixSiteList implements INodeType {
|
|
6
6
|
description: INodeTypeDescription = {
|
|
7
7
|
displayName: 'Wix Site List',
|
|
8
8
|
name: 'wixSiteList',
|
|
9
|
-
icon: 'file:wix.png',
|
|
9
|
+
icon: 'file:wix.png',
|
|
10
10
|
group: ['transform'],
|
|
11
11
|
version: 1,
|
|
12
12
|
description: 'Retrieve a list of Wix sites dynamically',
|
|
13
13
|
defaults: {
|
|
14
14
|
name: 'Wix Site List',
|
|
15
|
-
color: '#1A73E8',
|
|
15
|
+
color: '#1A73E8',
|
|
16
16
|
},
|
|
17
17
|
inputs: ['main'],
|
|
18
18
|
outputs: ['main'],
|
|
@@ -23,63 +23,50 @@ export class WixSiteList implements INodeType {
|
|
|
23
23
|
type: 'string',
|
|
24
24
|
default: '',
|
|
25
25
|
required: true,
|
|
26
|
-
description: 'Your Wix account-level API key or OAuth token',
|
|
27
26
|
},
|
|
28
27
|
{
|
|
29
28
|
displayName: 'Filter',
|
|
30
29
|
name: 'filter',
|
|
31
30
|
type: 'json',
|
|
32
31
|
default: {},
|
|
33
|
-
description:
|
|
34
|
-
'JSON object to filter the sites. Example: {"displayName":"my-site"}',
|
|
35
32
|
},
|
|
36
33
|
{
|
|
37
34
|
displayName: 'Limit',
|
|
38
35
|
name: 'limit',
|
|
39
36
|
type: 'number',
|
|
40
37
|
default: 100,
|
|
41
|
-
description: 'Maximum number of sites to return (max 1000)',
|
|
42
38
|
},
|
|
43
39
|
{
|
|
44
40
|
displayName: 'Cursor',
|
|
45
41
|
name: 'cursor',
|
|
46
42
|
type: 'string',
|
|
47
43
|
default: '',
|
|
48
|
-
description: 'Cursor for paging. Leave empty for the first request',
|
|
49
44
|
},
|
|
50
45
|
{
|
|
51
46
|
displayName: 'Sort',
|
|
52
47
|
name: 'sort',
|
|
53
48
|
type: 'json',
|
|
54
49
|
default: [],
|
|
55
|
-
description:
|
|
56
|
-
'JSON array of objects for sorting. Example: [{"fieldName":"displayName","order":"ASC"}]',
|
|
57
50
|
},
|
|
58
51
|
{
|
|
59
52
|
displayName: 'Fields',
|
|
60
53
|
name: 'fields',
|
|
61
54
|
type: 'json',
|
|
62
55
|
default: {},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
]
|
|
67
|
-
}
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
68
59
|
|
|
69
|
-
// Função principal do node
|
|
70
60
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
71
|
-
const
|
|
72
|
-
const returnData: INodeExecutionData[] = []
|
|
61
|
+
const returnData: INodeExecutionData[] = [];
|
|
73
62
|
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const fields = this.getNodeParameter('fields', 0) as IDataObject
|
|
63
|
+
const apiKey = this.getNodeParameter('apiKey', 0) as string;
|
|
64
|
+
const filter = this.getNodeParameter('filter', 0) as IDataObject;
|
|
65
|
+
const limit = this.getNodeParameter('limit', 0) as number;
|
|
66
|
+
const cursor = this.getNodeParameter('cursor', 0) as string;
|
|
67
|
+
const sort = this.getNodeParameter('sort', 0) as IDataObject[];
|
|
68
|
+
const fields = this.getNodeParameter('fields', 0) as IDataObject;
|
|
81
69
|
|
|
82
|
-
// Montando o corpo da requisição
|
|
83
70
|
const body: IDataObject = {
|
|
84
71
|
query: {
|
|
85
72
|
filter,
|
|
@@ -89,11 +76,10 @@ export class WixSiteList implements INodeType {
|
|
|
89
76
|
},
|
|
90
77
|
sort,
|
|
91
78
|
fields,
|
|
92
|
-
}
|
|
93
|
-
}
|
|
79
|
+
},
|
|
80
|
+
};
|
|
94
81
|
|
|
95
|
-
|
|
96
|
-
const config: AxiosRequestConfig = {
|
|
82
|
+
const config: AxiosRequestConfig = {
|
|
97
83
|
method: 'POST',
|
|
98
84
|
url: 'https://www.wixapis.com/site-list/v2/sites/query',
|
|
99
85
|
headers: {
|
|
@@ -101,27 +87,22 @@ export class WixSiteList implements INodeType {
|
|
|
101
87
|
'Content-Type': 'application/json',
|
|
102
88
|
},
|
|
103
89
|
data: body,
|
|
104
|
-
|
|
105
|
-
}
|
|
90
|
+
};
|
|
106
91
|
|
|
107
|
-
|
|
108
|
-
let responseData: IDataObject
|
|
92
|
+
let responseData: IDataObject;
|
|
109
93
|
try {
|
|
110
|
-
|
|
111
|
-
responseData = response.data as IDataObject
|
|
94
|
+
const response = await axios(config);
|
|
95
|
+
responseData = response.data as IDataObject;
|
|
112
96
|
} catch (error) {
|
|
113
|
-
throw new NodeOperationError(this.getNode(), error as Error)
|
|
97
|
+
throw new NodeOperationError(this.getNode(), error as Error);
|
|
114
98
|
}
|
|
115
99
|
|
|
116
|
-
// Retornando os sites como output
|
|
117
100
|
if (responseData.sites && Array.isArray(responseData.sites)) {
|
|
118
101
|
for (const site of responseData.sites) {
|
|
119
|
-
returnData.push({
|
|
120
|
-
json: site as IDataObject
|
|
121
|
-
})
|
|
102
|
+
returnData.push({ json: site as IDataObject });
|
|
122
103
|
}
|
|
123
104
|
}
|
|
124
105
|
|
|
125
|
-
return [returnData]
|
|
106
|
+
return [returnData];
|
|
126
107
|
}
|
|
127
108
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-wix",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Wix sites node for n8n",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wix",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"author": "Snoorky",
|
|
11
11
|
"type": "commonjs",
|
|
12
|
-
"main": "dist/index.js",
|
|
13
12
|
"scripts": {
|
|
14
13
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
15
14
|
},
|
package/tsconfig.json
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
"target": "ES2020",
|
|
4
4
|
"module": "commonjs",
|
|
5
5
|
"declaration": true,
|
|
6
|
-
"outDir": "
|
|
6
|
+
"outDir": "dist",
|
|
7
7
|
"strict": true,
|
|
8
8
|
"esModuleInterop": true,
|
|
9
9
|
"skipLibCheck": true
|
|
10
10
|
},
|
|
11
|
-
"include": ["nodes/**/*.ts"
|
|
11
|
+
"include": ["nodes/**/*.ts"],
|
|
12
12
|
"exclude": ["node_modules"]
|
|
13
13
|
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WixSiteList = void 0;
|
|
4
|
-
const sites_1 = require("./nodes/sites");
|
|
5
|
-
Object.defineProperty(exports, "WixSiteList", { enumerable: true, get: function () { return sites_1.WixSiteList; } });
|
|
6
|
-
module.exports = { WixSiteList: sites_1.WixSiteList };
|
package/index.ts
DELETED
|
File without changes
|