n8n-nodes-digitalsac 0.1.3 → 0.1.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/icons/digitalsac.svg +3 -0
- package/dist/icons/n8n-nodes-digitalsac/dist/nodes/digitalsac/digitalsac.svg +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/nodes/Digitalsac/digitalsac.svg +3 -0
- package/dist/nodes/digitalsac.svg +3 -0
- package/package.json +42 -14
- package/index.ts +0 -5
- package/nodes/Digitalsac/Digitalsac.credentials.ts +0 -25
- package/nodes/Digitalsac/Digitalsac.node.ts +0 -150
- /package/dist/{nodes/Digitalsac/Digitalsac.credentials.d.ts → credentials/DigitalsacApi.credentials.d.ts} +0 -0
- /package/dist/{nodes/Digitalsac/Digitalsac.credentials.js → credentials/DigitalsacApi.credentials.js} +0 -0
- /package/{nodes/Digitalsac → dist}/digitalsac.svg +0 -0
package/package.json
CHANGED
|
@@ -1,27 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-digitalsac",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Izing Pro Digitalsac",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "tsc",
|
|
8
|
-
"dev": "tsc --watch"
|
|
9
|
-
},
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Izing Pro Digitalsac N8N Nodes",
|
|
10
5
|
"keywords": [
|
|
11
6
|
"n8n",
|
|
12
7
|
"n8n-community-node-package"
|
|
13
8
|
],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"homepage": "https://github.com/digitalsac/n8n-nodes-digitalsac",
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Digitalsac.io",
|
|
13
|
+
"email": "contato@digitalsac.io"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/digitalsac/n8n-nodes-digitalsac.git"
|
|
18
|
+
},
|
|
19
|
+
"main": "dist/index.js",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc && gulp build:icons",
|
|
22
|
+
"dev": "tsc --watch",
|
|
23
|
+
"format": "prettier nodes credentials package.json --write",
|
|
24
|
+
"lint": "eslint nodes credentials package.json",
|
|
25
|
+
"lintfix": "eslint nodes credentials package.json --fix",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
27
|
+
},
|
|
14
28
|
"files": [
|
|
15
|
-
|
|
16
|
-
"index.ts",
|
|
17
|
-
"nodes"
|
|
29
|
+
"dist"
|
|
18
30
|
],
|
|
19
|
-
"
|
|
20
|
-
|
|
31
|
+
"n8n": {
|
|
32
|
+
"n8nNodesApiVersion": 1,
|
|
33
|
+
"credentials": [
|
|
34
|
+
"dist/credentials/DigitalsacApi.credentials.js"
|
|
35
|
+
],
|
|
36
|
+
"nodes": [
|
|
37
|
+
"dist/nodes/Digitalsac/Digitalsac.node.js"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
21
40
|
"devDependencies": {
|
|
41
|
+
"@types/express": "^4.17.21",
|
|
22
42
|
"@types/node": "^18.0.0",
|
|
23
|
-
"
|
|
43
|
+
"@types/request-promise-native": "~1.0.15",
|
|
44
|
+
"@typescript-eslint/parser": "~5.45",
|
|
45
|
+
"eslint-plugin-n8n-nodes-base": "^1.16.3",
|
|
46
|
+
"gulp": "^4.0.2",
|
|
24
47
|
"n8n-core": "^1.0.0",
|
|
48
|
+
"n8n-workflow": "^1.0.0",
|
|
49
|
+
"prettier": "^2.8.8",
|
|
25
50
|
"typescript": "^5.0.0"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"axios": "^1.9.0"
|
|
26
54
|
}
|
|
27
|
-
}
|
|
55
|
+
}
|
package/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ICredentialType,
|
|
3
|
-
NodePropertyTypes,
|
|
4
|
-
} from 'n8n-workflow';
|
|
5
|
-
|
|
6
|
-
export class DigitalsacApi implements ICredentialType {
|
|
7
|
-
name = 'digitalsacApi';
|
|
8
|
-
displayName = 'Izing Pro Digitalsac API';
|
|
9
|
-
documentationUrl = '';
|
|
10
|
-
properties = [
|
|
11
|
-
{
|
|
12
|
-
displayName: 'API Base URL',
|
|
13
|
-
name: 'baseUrl',
|
|
14
|
-
type: 'string' as NodePropertyTypes,
|
|
15
|
-
default: 'https://example.digitalsac.io',
|
|
16
|
-
description: 'Ex: https://seudominio.digitalsac.com.br',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
displayName: 'Bearer Token',
|
|
20
|
-
name: 'token',
|
|
21
|
-
type: 'string' as NodePropertyTypes,
|
|
22
|
-
default: '',
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IExecuteFunctions,
|
|
3
|
-
INodeExecutionData,
|
|
4
|
-
INodeType,
|
|
5
|
-
INodeTypeDescription,
|
|
6
|
-
NodeConnectionType,
|
|
7
|
-
} from 'n8n-workflow';
|
|
8
|
-
|
|
9
|
-
export class Digitalsac implements INodeType {
|
|
10
|
-
description: INodeTypeDescription = {
|
|
11
|
-
displayName: 'Digitalsac Izing Pro',
|
|
12
|
-
name: 'digitalsac',
|
|
13
|
-
icon: 'file:digitalsac.svg',
|
|
14
|
-
group: ['transform'],
|
|
15
|
-
version: 1,
|
|
16
|
-
description: 'Interage com a API do Digitalsac',
|
|
17
|
-
defaults: {
|
|
18
|
-
name: 'Digitalsac',
|
|
19
|
-
},
|
|
20
|
-
inputs: <NodeConnectionType[]>['main'],
|
|
21
|
-
outputs: <NodeConnectionType[]>['main'],
|
|
22
|
-
|
|
23
|
-
credentials: [
|
|
24
|
-
{
|
|
25
|
-
name: 'digitalsacApi',
|
|
26
|
-
required: true,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
properties: [
|
|
30
|
-
{
|
|
31
|
-
displayName: 'Operação',
|
|
32
|
-
name: 'operation',
|
|
33
|
-
type: 'options',
|
|
34
|
-
options: [
|
|
35
|
-
{ name: 'Validar WhatsApp', value: 'validateWhatsapp' },
|
|
36
|
-
{ name: 'Validar CPF', value: 'validateCpf' },
|
|
37
|
-
{ name: 'Validar Data', value: 'validateDate' },
|
|
38
|
-
{ name: 'Listar Filas', value: 'listQueues' },
|
|
39
|
-
{ name: 'Listar Atendentes', value: 'listAgents' },
|
|
40
|
-
{ name: 'Transferir para Fila', value: 'transferQueue' },
|
|
41
|
-
{ name: 'Transferir para Atendente', value: 'transferAgent' },
|
|
42
|
-
{ name: 'Fechar Ticket', value: 'closeTicket' },
|
|
43
|
-
{ name: 'Enviar Mensagem', value: 'sendMessage' },
|
|
44
|
-
],
|
|
45
|
-
default: 'validateWhatsapp',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
displayName: 'Parâmetro',
|
|
49
|
-
name: 'param',
|
|
50
|
-
type: 'string',
|
|
51
|
-
default: '',
|
|
52
|
-
displayOptions: {
|
|
53
|
-
show: {
|
|
54
|
-
operation: ['validateWhatsapp', 'validateCpf', 'sendMessage'],
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
description: 'Número, CPF ou UUID da mensagem (conforme operação)',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
displayName: 'Dados (JSON)',
|
|
61
|
-
name: 'bodyData',
|
|
62
|
-
type: 'json',
|
|
63
|
-
default: '',
|
|
64
|
-
displayOptions: {
|
|
65
|
-
show: {
|
|
66
|
-
operation: ['validateDate', 'transferQueue', 'transferAgent', 'closeTicket', 'sendMessage'],
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
74
|
-
const items = this.getInputData();
|
|
75
|
-
const returnData: INodeExecutionData[] = [];
|
|
76
|
-
|
|
77
|
-
const credentials = await this.getCredentials('digitalsacApi');
|
|
78
|
-
const baseUrl = credentials.baseUrl;
|
|
79
|
-
const token = credentials.token;
|
|
80
|
-
|
|
81
|
-
for (let i = 0; i < items.length; i++) {
|
|
82
|
-
const operation = this.getNodeParameter('operation', i) as string;
|
|
83
|
-
let responseData;
|
|
84
|
-
|
|
85
|
-
const headers = {
|
|
86
|
-
Authorization: `Bearer ${token}`,
|
|
87
|
-
'Content-Type': 'application/json',
|
|
88
|
-
Accept: 'application/json',
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
let url = '';
|
|
92
|
-
let method: 'GET' | 'POST' = 'GET';
|
|
93
|
-
let body;
|
|
94
|
-
let param = this.getNodeParameter('param', i, '') as string;
|
|
95
|
-
|
|
96
|
-
switch (operation) {
|
|
97
|
-
case 'validateWhatsapp':
|
|
98
|
-
url = `/typebot/whatsappnumber/${param}`;
|
|
99
|
-
break;
|
|
100
|
-
case 'validateCpf':
|
|
101
|
-
url = `/typebot/validate/cpf/${param}`;
|
|
102
|
-
break;
|
|
103
|
-
case 'validateDate':
|
|
104
|
-
url = '/typebot/validate/data';
|
|
105
|
-
method = 'POST';
|
|
106
|
-
body = this.getNodeParameter('bodyData', i);
|
|
107
|
-
break;
|
|
108
|
-
case 'listQueues':
|
|
109
|
-
url = '/typebot/listar_filas';
|
|
110
|
-
break;
|
|
111
|
-
case 'listAgents':
|
|
112
|
-
url = '/typebot/listar_atendentes';
|
|
113
|
-
break;
|
|
114
|
-
case 'transferQueue':
|
|
115
|
-
url = '/typebot/transferir_para_fila';
|
|
116
|
-
method = 'POST';
|
|
117
|
-
body = this.getNodeParameter('bodyData', i);
|
|
118
|
-
break;
|
|
119
|
-
case 'transferAgent':
|
|
120
|
-
url = '/typebot/transferir_para_atendente';
|
|
121
|
-
method = 'POST';
|
|
122
|
-
body = this.getNodeParameter('bodyData', i);
|
|
123
|
-
break;
|
|
124
|
-
case 'closeTicket':
|
|
125
|
-
url = '/typebot/fechar_ticket';
|
|
126
|
-
method = 'POST';
|
|
127
|
-
body = this.getNodeParameter('bodyData', i);
|
|
128
|
-
break;
|
|
129
|
-
case 'sendMessage':
|
|
130
|
-
url = `/v1/api/external/${param}`;
|
|
131
|
-
method = 'POST';
|
|
132
|
-
body = this.getNodeParameter('bodyData', i);
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const options = {
|
|
137
|
-
method,
|
|
138
|
-
headers,
|
|
139
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
140
|
-
uri: `${baseUrl}${url}`,
|
|
141
|
-
json: true,
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
responseData = await this.helpers.request(options);
|
|
145
|
-
returnData.push({ json: responseData });
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return [returnData];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|