n8n-nodes-aib 0.4.1 → 0.4.2

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.
@@ -354,7 +354,21 @@ class AibDigital {
354
354
  async execute() {
355
355
  const items = this.getInputData();
356
356
  const out = [];
357
- const operation = this.getNodeParameter("operation", 0);
357
+ let operation = this.getNodeParameter("operation", 0);
358
+ // Autocorreção: ao atualizar o pacote, o n8n às vezes perde a operação
359
+ // salva e injeta o "__CUSTOM_API_CALL__" da auth genérica. Em vez de
360
+ // falhar, assumimos a operação natural do recurso escolhido.
361
+ if (operation === "__CUSTOM_API_CALL__") {
362
+ const recurso = this.getNodeParameter("recurso", 0, "conversa");
363
+ const padrao = {
364
+ conta: "selecionarConta",
365
+ conversa: "listarConversas",
366
+ mensagem: "enviarMensagem",
367
+ contato: "atualizarContato",
368
+ funil: "criarFunil",
369
+ };
370
+ operation = padrao[recurso] ?? "selecionarConta";
371
+ }
358
372
  for (let i = 0; i < items.length; i++) {
359
373
  const qs = contaQs(this, i);
360
374
  let res;
@@ -448,9 +462,6 @@ class AibDigital {
448
462
  res = { id: "", nome: "— a conta da chave —", escopo: ping?.escopo };
449
463
  }
450
464
  }
451
- else if (operation === "__CUSTOM_API_CALL__") {
452
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Escolha o Recurso e a Operação no nó (o n8n perdeu a seleção ao atualizar o pacote).", { description: "Reabra o nó, selecione Recurso → Operação e salve." });
453
- }
454
465
  else {
455
466
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operação desconhecida: ${operation}`);
456
467
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-aib",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Nós do Sistema AIB Digital para n8n: gatilho de mensagens do WhatsApp (via AIB Inbox) e ações — enviar mensagem, mover card no funil, pausar IA — escolhendo conta e caixa por dropdown.",
5
5
  "license": "MIT",
6
6
  "author": "AIB Digital",