n8n-nodes-wix 1.0.4 → 1.0.6

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