@pipefy/pipefy-process-coder 0.1.0 → 0.1.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.
Files changed (162) hide show
  1. package/.agents/skills/ppc-pipefy-flow-authoring/SKILL.md +262 -262
  2. package/.agents/skills/ppc-pipefy-flow-authoring/examples/01-main-2-danfe-consulta.json +247 -247
  3. package/.agents/skills/ppc-pipefy-flow-authoring/examples/01-main-2-webhook-retorno-consulta.json +589 -589
  4. package/.agents/skills/ppc-pipefy-flow-authoring/examples/01-main-4-recebimento-barramento.json +1391 -1391
  5. package/.agents/skills/ppc-pipefy-flow-authoring/examples/02-subflow-2-danfe-retorno.json +623 -623
  6. package/.agents/skills/ppc-pipefy-flow-authoring/examples/02-subflow-4-criacao-operacao.json +636 -636
  7. package/.agents/skills/ppc-pipefy-flow-authoring/examples/03-subflow-4-criacao-titulo.json +3642 -3642
  8. package/.agents/skills/ppc-pipefy-flow-authoring/examples/04-subflow-4-criacao-cedente.json +863 -863
  9. package/.agents/skills/ppc-pipefy-flow-authoring/examples/04-subflow-4-criacao-sacado.json +799 -799
  10. package/.agents/skills/ppc-pipefy-flow-authoring/examples/README.md +42 -42
  11. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-01-subflow-1-titulo-acompanhamento-cobranca.json +581 -581
  12. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-01-subflow-1-titulo-nfe-monitoramento.json +503 -503
  13. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-01-subflow-1-titulo-retorno-bancario.json +562 -562
  14. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-02-subflow-2-retorno-consulta-cedente.json +557 -557
  15. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-02-subflow-2-retorno-consulta-sacado.json +609 -609
  16. package/.agents/skills/ppc-pipefy-pipe-authoring/SKILL.md +146 -146
  17. package/.agents/skills/ppc-pipefy-process-design/SKILL.md +127 -127
  18. package/.agents/skills/ppc-pipefy-workspace/SKILL.md +91 -91
  19. package/AGENTS.md +476 -456
  20. package/LICENSE +202 -0
  21. package/NOTICE +11 -0
  22. package/README.md +830 -808
  23. package/bin/pipe.js +25 -4
  24. package/dist/apply/adopt.js +128 -0
  25. package/dist/apply/agentops.js +42 -0
  26. package/dist/apply/compile.js +722 -0
  27. package/dist/apply/execute.js +277 -0
  28. package/dist/apply/flowops.js +293 -0
  29. package/dist/apply/idmap.js +233 -0
  30. package/dist/apply/mutations.js +704 -0
  31. package/dist/apply/registry.js +348 -0
  32. package/dist/apply/types.js +18 -0
  33. package/dist/cli/args.js +79 -0
  34. package/dist/cli.js +196 -0
  35. package/dist/codec/flow.js +164 -0
  36. package/dist/codec/pack.js +88 -0
  37. package/dist/codec/roundtrip.js +86 -0
  38. package/dist/codec/unpack.js +181 -0
  39. package/dist/commands/agents.js +145 -0
  40. package/dist/commands/apply.js +982 -0
  41. package/dist/commands/context.js +79 -0
  42. package/dist/commands/create.js +63 -0
  43. package/dist/commands/diff.js +294 -0
  44. package/dist/commands/flows.js +348 -0
  45. package/dist/commands/misc.js +562 -0
  46. package/dist/commands/plan.js +301 -0
  47. package/dist/commands/pull.js +549 -0
  48. package/dist/commands/runs.js +74 -0
  49. package/dist/commands/skills.js +131 -0
  50. package/dist/commands/verify.js +205 -0
  51. package/dist/config.js +125 -0
  52. package/dist/diff/agents.js +80 -0
  53. package/dist/diff/diff.js +983 -0
  54. package/dist/diff/flow.js +258 -0
  55. package/{src/diff/html.ts → dist/diff/html.js} +274 -322
  56. package/dist/diff/render.js +90 -0
  57. package/dist/model/payload.js +84 -0
  58. package/dist/model/tree.js +7 -0
  59. package/dist/model/volatile.js +54 -0
  60. package/dist/pipefy/agents.js +131 -0
  61. package/dist/pipefy/automations.js +155 -0
  62. package/dist/pipefy/capability.js +84 -0
  63. package/dist/pipefy/client.js +204 -0
  64. package/dist/pipefy/discovery.js +148 -0
  65. package/dist/pipefy/internal.js +406 -0
  66. package/dist/pipefy/ipaas.js +269 -0
  67. package/dist/pipefy/reconstruct.js +676 -0
  68. package/dist/pipefy/reference.js +172 -0
  69. package/dist/pipefy/snapshot.js +185 -0
  70. package/dist/pipefy/toolkit.js +174 -0
  71. package/{src → dist}/pipefy/toolkit_bearer.py +60 -14
  72. package/dist/report/integrations.js +165 -0
  73. package/dist/report/run.js +356 -0
  74. package/dist/util/fsx.js +50 -0
  75. package/dist/util/git.js +25 -0
  76. package/dist/util/json.js +56 -0
  77. package/dist/util/log.js +69 -0
  78. package/dist/util/pool.js +42 -0
  79. package/dist/util/slug.js +23 -0
  80. package/dist/util/tui.js +287 -0
  81. package/dist/validate/index.js +86 -0
  82. package/dist/validate/integrity.js +370 -0
  83. package/dist/validate/reference.js +120 -0
  84. package/dist/validate/schema.js +278 -0
  85. package/dist/version.js +18 -0
  86. package/dist/workspace/agents.js +245 -0
  87. package/{src/workspace/docs.ts → dist/workspace/docs.js} +367 -407
  88. package/dist/workspace/flows.js +149 -0
  89. package/dist/workspace/layout.js +146 -0
  90. package/dist/workspace/lock.js +83 -0
  91. package/dist/workspace/read.js +168 -0
  92. package/dist/workspace/reference.js +24 -0
  93. package/dist/workspace/stamp.js +234 -0
  94. package/dist/workspace/write.js +194 -0
  95. package/package.json +38 -35
  96. package/src/apply/adopt.ts +0 -150
  97. package/src/apply/agentops.ts +0 -71
  98. package/src/apply/compile.ts +0 -875
  99. package/src/apply/execute.ts +0 -336
  100. package/src/apply/flowops.ts +0 -399
  101. package/src/apply/idmap.ts +0 -241
  102. package/src/apply/mutations.ts +0 -955
  103. package/src/apply/registry.ts +0 -430
  104. package/src/apply/types.ts +0 -134
  105. package/src/cli/args.ts +0 -88
  106. package/src/cli.ts +0 -211
  107. package/src/codec/flow.ts +0 -199
  108. package/src/codec/pack.ts +0 -103
  109. package/src/codec/roundtrip.ts +0 -94
  110. package/src/codec/unpack.ts +0 -198
  111. package/src/commands/agents.ts +0 -184
  112. package/src/commands/apply.ts +0 -1144
  113. package/src/commands/context.ts +0 -119
  114. package/src/commands/create.ts +0 -79
  115. package/src/commands/diff.ts +0 -314
  116. package/src/commands/flows.ts +0 -414
  117. package/src/commands/misc.ts +0 -644
  118. package/src/commands/plan.ts +0 -331
  119. package/src/commands/pull.ts +0 -567
  120. package/src/commands/runs.ts +0 -83
  121. package/src/commands/skills.ts +0 -137
  122. package/src/commands/verify.ts +0 -253
  123. package/src/config.ts +0 -168
  124. package/src/diff/agents.ts +0 -122
  125. package/src/diff/diff.ts +0 -1130
  126. package/src/diff/flow.ts +0 -318
  127. package/src/diff/render.ts +0 -101
  128. package/src/model/payload.ts +0 -154
  129. package/src/model/tree.ts +0 -99
  130. package/src/model/volatile.ts +0 -55
  131. package/src/pipefy/agents.ts +0 -165
  132. package/src/pipefy/automations.ts +0 -219
  133. package/src/pipefy/capability.ts +0 -119
  134. package/src/pipefy/client.ts +0 -267
  135. package/src/pipefy/discovery.ts +0 -209
  136. package/src/pipefy/internal.ts +0 -380
  137. package/src/pipefy/ipaas.ts +0 -365
  138. package/src/pipefy/reconstruct.ts +0 -775
  139. package/src/pipefy/reference.ts +0 -251
  140. package/src/pipefy/snapshot.ts +0 -245
  141. package/src/pipefy/toolkit.ts +0 -200
  142. package/src/report/integrations.ts +0 -231
  143. package/src/report/run.ts +0 -475
  144. package/src/util/fsx.ts +0 -45
  145. package/src/util/git.ts +0 -32
  146. package/src/util/json.ts +0 -55
  147. package/src/util/log.ts +0 -76
  148. package/src/util/pool.ts +0 -48
  149. package/src/util/slug.ts +0 -26
  150. package/src/util/tui.ts +0 -335
  151. package/src/validate/index.ts +0 -123
  152. package/src/validate/integrity.ts +0 -387
  153. package/src/validate/reference.ts +0 -136
  154. package/src/validate/schema.ts +0 -328
  155. package/src/workspace/agents.ts +0 -290
  156. package/src/workspace/flows.ts +0 -191
  157. package/src/workspace/layout.ts +0 -165
  158. package/src/workspace/lock.ts +0 -148
  159. package/src/workspace/read.ts +0 -165
  160. package/src/workspace/reference.ts +0 -24
  161. package/src/workspace/stamp.ts +0 -301
  162. package/src/workspace/write.ts +0 -225
@@ -1,557 +1,557 @@
1
- {
2
- "name": "✅[PRD][HML][2/2 SUBFLOW][RETORNO CONSULTA/UPDATE] Retorno Cedente",
3
- "type": "SHARED",
4
- "summary": "",
5
- "description": "",
6
- "tags": [],
7
- "blogUrl": "",
8
- "metadata": {
9
- "externalId": "exampleFlowId02aaaaaa"
10
- },
11
- "author": "Integrações Ipaas 000000000",
12
- "categories": [],
13
- "pieces": [
14
- "@activepieces/piece-subflows",
15
- "@activepieces/piece-pipefy"
16
- ],
17
- "flows": [
18
- {
19
- "displayName": "✅[PRD][HML][2/2 SUBFLOW][RETORNO CONSULTA/UPDATE] Retorno Cedente",
20
- "trigger": {
21
- "name": "trigger",
22
- "valid": true,
23
- "displayName": "Callable Flow",
24
- "nextAction": {
25
- "name": "step_2",
26
- "type": "PIECE",
27
- "valid": true,
28
- "settings": {
29
- "input": {
30
- "auth": "{{connections['exampleConnectionId3']}}",
31
- "pipeId": "200000004",
32
- "fieldId": "idcedente",
33
- "fieldValue": "{{trigger['output']['data']['cedente']['idCedente']}}",
34
- "organizationId": "100000001"
35
- },
36
- "pieceName": "@activepieces/piece-pipefy",
37
- "actionName": "getCardsByFieldValue",
38
- "sampleData": {},
39
- "pieceVersion": "0.1.7",
40
- "propertySettings": {
41
- "pipeId": {
42
- "type": "MANUAL"
43
- },
44
- "fieldId": {
45
- "type": "MANUAL"
46
- },
47
- "fieldValue": {
48
- "type": "MANUAL"
49
- },
50
- "organizationId": {
51
- "type": "MANUAL"
52
- }
53
- },
54
- "errorHandlingOptions": {
55
- "retryOnFailure": {
56
- "value": false
57
- },
58
- "continueOnFailure": {
59
- "value": false
60
- }
61
- }
62
- },
63
- "nextAction": {
64
- "name": "step_13",
65
- "skip": false,
66
- "type": "CODE",
67
- "valid": true,
68
- "settings": {
69
- "input": {
70
- "cards": "{{step_2['output']['data']['cards']}}",
71
- "empresaCodigo": "{{trigger['output']['data']['cedente']['codigoEmpresa']}}"
72
- },
73
- "sampleData": {},
74
- "sourceCode": {
75
- "code": "export const code = async (inputs) => {\n const alvo = String(inputs.empresaCodigo ?? '').trim();\n\n const card = inputs.cards.find(\n c => String(c.fields?.empresacodigo?.value ?? '').trim() === alvo\n );\n\n return {\n cardId: card?.id ?? null,\n encontrado: !!card\n };\n};",
76
- "packageJson": "{}"
77
- },
78
- "errorHandlingOptions": {
79
- "retryOnFailure": {
80
- "value": false
81
- },
82
- "continueOnFailure": {
83
- "value": false
84
- }
85
- }
86
- },
87
- "nextAction": {
88
- "name": "step_3",
89
- "skip": false,
90
- "type": "ROUTER",
91
- "valid": true,
92
- "children": [
93
- {
94
- "name": "step_6",
95
- "skip": false,
96
- "type": "CODE",
97
- "valid": true,
98
- "settings": {
99
- "input": {
100
- "email": "{{trigger['output']['data']['cedente']['email']}}",
101
- "cnpjOuCpf": "{{trigger['output']['data']['cedente']['cnpjOuCpf']}}",
102
- "telefoneContato ": "{{trigger['output']['data']['cedente']['telefoneContato']}}",
103
- "vinculoGrupoEconomico": "{{trigger['output']['data']['cedente']['vinculoGrupoEconomico']}}"
104
- },
105
- "sampleData": {},
106
- "sourceCode": {
107
- "code": "export const code = async (inputs) => {\n // Normaliza chaves removendo espaços extras\n const normalizedInputs = {};\n for (const key in inputs) {\n normalizedInputs[key.trim()] = inputs[key];\n }\n inputs = normalizedInputs;\n\n // DDDs válidos no Brasil (nenhum começa com 0 ou 1)\n const DDD_VALIDOS = new Set([\n '11','12','13','14','15','16','17','18','19',\n '21','22','24',\n '27','28',\n '31','32','33','34','35','37','38',\n '41','42','43','44','45','46',\n '47','48','49',\n '51','53','54','55',\n '61',\n '62','63','64',\n '65','66',\n '67',\n '68',\n '69',\n '71','73','74','75','77',\n '79',\n '81','82','83','84','87',\n '85','88','86','89',\n '91','92','93','94','97',\n '95',\n '96',\n '98','99',\n ]);\n\n // ===== Normaliza telefone =====\n let telefoneContato = '';\n let telefoneContatoFormatado = '';\n if (inputs.telefoneContato) {\n let numeros = String(inputs.telefoneContato).replace(/\\D/g, '');\n\n // Remove o 55 inicial se já vier com código do país\n if ((numeros.length === 12 || numeros.length === 13) && numeros.startsWith('55')) {\n numeros = numeros.substring(2);\n }\n\n // Corrige prefixo \"0\" indevido antes do DDD (ex: \"084 3064-6035\" -> \"84 3064-6035\")\n // Nenhum DDD começa com 0, então um \"0\" sobrando aqui sempre indica esse erro de digitação/formatação,\n // seja em número fixo (11 dígitos -> 10) ou celular (12 dígitos -> 11)\n if (numeros.startsWith('0') && (numeros.length === 11 || numeros.length === 12)) {\n numeros = numeros.substring(1);\n }\n\n // Sanity check adicional: se o DDD calculado não é válido, tenta reancorar\n // deslocando um dígito (cobre outros casos de dígito extra vazado no começo)\n const dddCandidato = numeros.substring(0, 2);\n if (!DDD_VALIDOS.has(dddCandidato) && (numeros.length === 11 || numeros.length === 12)) {\n const dddAlternativo = numeros.substring(1, 3);\n if (DDD_VALIDOS.has(dddAlternativo)) {\n numeros = numeros.substring(1);\n }\n }\n\n if (numeros.length === 11) {\n // Celular com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 7);\n const parte2 = numeros.substring(7);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else if (numeros.length === 10) {\n // Fixo com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 6);\n const parte2 = numeros.substring(6);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else {\n telefoneContato = numeros;\n telefoneContatoFormatado = numeros;\n }\n }\n\n // ===== Normaliza e-mails =====\n let email = '';\n let emailCheck = true;\n if (inputs.email) {\n const emailStr = String(inputs.email);\n if (!emailStr.includes('@')) {\n email = emailStr;\n emailCheck = false;\n } else {\n const emailRegex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/;\n const validos = emailStr\n .split(/[;,\\s]+/)\n .map((e) => e.trim())\n .filter((e) => e && emailRegex.test(e));\n email = Array.from(new Set(validos)).join(', ');\n }\n }\n\n // ===== Identifica e formata CPF/CNPJ =====\n let cpf = '';\n let cnpj = '';\n let tipo = '';\n if (inputs.cnpjOuCpf) {\n const doc = String(inputs.cnpjOuCpf).replace(/\\D/g, '');\n if (doc.length === 11) {\n cpf = `${doc.substring(0, 3)}.${doc.substring(3, 6)}.${doc.substring(6, 9)}-${doc.substring(9)}`;\n tipo = 'cpf';\n } else if (doc.length === 14) {\n cnpj = `${doc.substring(0, 2)}.${doc.substring(2, 5)}.${doc.substring(5, 8)}/${doc.substring(8, 12)}-${doc.substring(12)}`;\n tipo = 'cnpj';\n }\n }\n\n // ===== Normaliza vínculo a grupo econômico =====\n let vinculoGrupoEconomico = '';\n if (inputs.vinculoGrupoEconomico !== undefined && inputs.vinculoGrupoEconomico !== null) {\n const valor = String(inputs.vinculoGrupoEconomico).trim().toLowerCase();\n if (valor === 'true' || valor === 'sim' || valor === '1') {\n vinculoGrupoEconomico = 'Sim';\n } else if (valor === 'false' || valor === 'não' || valor === 'nao' || valor === '0') {\n vinculoGrupoEconomico = 'Não';\n }\n }\n\n return {\n telefoneContato,\n telefoneContatoFormatado,\n email,\n emailCheck,\n tipo,\n cpf,\n cnpj,\n vinculoGrupoEconomico,\n };\n};",
108
- "packageJson": "{}"
109
- },
110
- "errorHandlingOptions": {
111
- "retryOnFailure": {
112
- "value": false
113
- },
114
- "continueOnFailure": {
115
- "value": false
116
- }
117
- }
118
- },
119
- "nextAction": {
120
- "name": "step_1",
121
- "skip": true,
122
- "type": "CODE",
123
- "valid": true,
124
- "settings": {
125
- "input": {
126
- "email": "{{trigger['output']['data']['cedente']['email']}}",
127
- "cnpjOuCpf": "{{trigger['output']['data']['cedente']['cnpjOuCpf']}}",
128
- "telefoneContato ": "{{trigger['output']['data']['cedente']['telefoneContato']}}",
129
- "vinculoGrupoEconomico": "{{trigger['output']['data']['cedente']['vinculoGrupoEconomico']}}"
130
- },
131
- "sampleData": {},
132
- "sourceCode": {
133
- "code": "export const code = async (inputs) => {\n // Normaliza chaves removendo espaços extras\n const normalizedInputs = {};\n for (const key in inputs) {\n normalizedInputs[key.trim()] = inputs[key];\n }\n inputs = normalizedInputs;\n // ===== Normaliza telefone =====\n let telefoneContato = '';\n let telefoneContatoFormatado = '';\n if (inputs.telefoneContato) {\n let numeros = String(inputs.telefoneContato).replace(/\\D/g, '');\n // Remove o 55 inicial se já vier com código do país\n if ((numeros.length === 12 || numeros.length === 13) && numeros.startsWith('55')) {\n numeros = numeros.substring(2);\n }\n if (numeros.length === 11) {\n // Celular com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 7);\n const parte2 = numeros.substring(7);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else if (numeros.length === 10) {\n // Fixo com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 6);\n const parte2 = numeros.substring(6);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else {\n telefoneContato = numeros;\n telefoneContatoFormatado = numeros;\n }\n }\n // ===== Normaliza e-mails =====\n let email = '';\n let emailCheck = true;\n if (inputs.email) {\n const emailStr = String(inputs.email);\n if (!emailStr.includes('@')) {\n email = emailStr;\n emailCheck = false;\n } else {\n const emailRegex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/;\n const validos = emailStr\n .split(/[;,\\s]+/)\n .map((e) => e.trim())\n .filter((e) => e && emailRegex.test(e));\n email = Array.from(new Set(validos)).join(', ');\n }\n }\n // ===== Identifica e formata CPF/CNPJ =====\n let cpf = '';\n let cnpj = '';\n let tipo = '';\n if (inputs.cnpjOuCpf) {\n const doc = String(inputs.cnpjOuCpf).replace(/\\D/g, '');\n if (doc.length === 11) {\n cpf = `${doc.substring(0, 3)}.${doc.substring(3, 6)}.${doc.substring(6, 9)}-${doc.substring(9)}`;\n tipo = 'cpf';\n } else if (doc.length === 14) {\n cnpj = `${doc.substring(0, 2)}.${doc.substring(2, 5)}.${doc.substring(5, 8)}/${doc.substring(8, 12)}-${doc.substring(12)}`;\n tipo = 'cnpj';\n }\n }\n // ===== Normaliza vínculo a grupo econômico =====\n let vinculoGrupoEconomico = '';\n if (inputs.vinculoGrupoEconomico !== undefined && inputs.vinculoGrupoEconomico !== null) {\n const valor = String(inputs.vinculoGrupoEconomico).trim().toLowerCase();\n if (valor === 'true' || valor === 'sim' || valor === '1') {\n vinculoGrupoEconomico = 'Sim';\n } else if (valor === 'false' || valor === 'não' || valor === 'nao' || valor === '0') {\n vinculoGrupoEconomico = 'Não';\n }\n }\n return {\n telefoneContato,\n telefoneContatoFormatado,\n email,\n emailCheck,\n tipo,\n cpf,\n cnpj,\n vinculoGrupoEconomico,\n };\n};",
134
- "packageJson": "{}"
135
- },
136
- "errorHandlingOptions": {
137
- "retryOnFailure": {
138
- "value": false
139
- },
140
- "continueOnFailure": {
141
- "value": false
142
- }
143
- }
144
- },
145
- "nextAction": {
146
- "name": "step_5",
147
- "skip": false,
148
- "type": "PIECE",
149
- "valid": true,
150
- "settings": {
151
- "input": {
152
- "auth": "{{connections['exampleConnectionId3']}}",
153
- "cardId": "{{step_13['output']['cardId']}}",
154
- "pipeId": "200000004",
155
- "phaseId": "300000003",
156
- "phaseFields": {
157
- "cep": "{{trigger['output']['data']['cedente']['cep']}}",
158
- "cpf": "{{step_6['output']['cpf']}}",
159
- "cnpj": "{{step_6['output']['cnpj']}}",
160
- "nome": "{{trigger['output']['data']['cedente']['nome']}}",
161
- "email": "{{step_6['output']['email']}}",
162
- "cidade": "{{trigger['output']['data']['cedente']['cidade']}}",
163
- "estado": "{{trigger['output']['data']['cedente']['estado']}}",
164
- "endere_o": "{{trigger['output']['data']['cedente']['endereco']}}",
165
- "data_de_cadastro": "{{trigger['output']['data']['cedente']['dataCadastro']}}",
166
- "analista_respons_vel": [],
167
- "id_do_grupo_principal": "{{trigger['output']['data']['cedente']['idGrupoPrincipal']}}",
168
- "v_nculo_com_grupo_econ_mico": "{{step_6['output']['vinculoGrupoEconomico']}}"
169
- },
170
- "organizationId": "100000001"
171
- },
172
- "pieceName": "@activepieces/piece-pipefy",
173
- "actionName": "updateCard",
174
- "sampleData": {},
175
- "pieceVersion": "0.1.7",
176
- "propertySettings": {
177
- "cardId": {
178
- "type": "MANUAL"
179
- },
180
- "pipeId": {
181
- "type": "MANUAL"
182
- },
183
- "phaseId": {
184
- "type": "MANUAL"
185
- },
186
- "phaseFields": {
187
- "type": "MANUAL",
188
- "schema": {
189
- "cep": {
190
- "type": "SHORT_TEXT",
191
- "required": false,
192
- "description": "\"cedente\"\n\"cep\"",
193
- "displayName": "CEP"
194
- },
195
- "cpf": {
196
- "type": "SHORT_TEXT",
197
- "required": false,
198
- "description": "\"cedente\"\n\"cnpjOuCpf\"",
199
- "displayName": "CPF"
200
- },
201
- "cnpj": {
202
- "type": "SHORT_TEXT",
203
- "required": false,
204
- "description": "\"cedente\"\n\"cnpjOuCpf\"",
205
- "displayName": "CNPJ"
206
- },
207
- "nome": {
208
- "type": "SHORT_TEXT",
209
- "required": false,
210
- "description": "\"cedente\"\n\"nome\"",
211
- "displayName": "Nome"
212
- },
213
- "email": {
214
- "type": "LONG_TEXT",
215
- "required": false,
216
- "description": "\"cedente\"\n\"email\"",
217
- "displayName": "E-mail"
218
- },
219
- "cidade": {
220
- "type": "SHORT_TEXT",
221
- "required": false,
222
- "description": "\"cedente\"\n\"cidade\"",
223
- "displayName": "Cidade"
224
- },
225
- "estado": {
226
- "type": "SHORT_TEXT",
227
- "required": false,
228
- "description": "\"cedente\"\n\"estado\"",
229
- "displayName": "Estado"
230
- },
231
- "d_start": {
232
- "type": "SHORT_TEXT",
233
- "required": false,
234
- "description": "⚙️ Quando o card for criado colocar D Start padrão (Automação)",
235
- "displayName": "D Start"
236
- },
237
- "endere_o": {
238
- "type": "LONG_TEXT",
239
- "required": false,
240
- "description": "\"cedente\"\n\"endereco\"",
241
- "displayName": "Endereço"
242
- },
243
- "idcedente": {
244
- "type": "SHORT_TEXT",
245
- "required": false,
246
- "description": "\"cedente\"\n\"idCedente\"",
247
- "displayName": "ID Cedente (Barramento)"
248
- },
249
- "empresacodigo": {
250
- "type": "SHORT_TEXT",
251
- "required": false,
252
- "description": "\"cedente\"\n\"codigoEmpresa\"",
253
- "displayName": "empresaCodigo"
254
- },
255
- "data_de_cadastro": {
256
- "type": "SHORT_TEXT",
257
- "required": false,
258
- "description": "\"cedente\"\n\"dataCadastro\"",
259
- "displayName": "Data de cadastro"
260
- },
261
- "telefone_de_contato": {
262
- "type": "NUMBER",
263
- "required": false,
264
- "description": "\"cedente\"\n\"telefoneContato\"",
265
- "displayName": "Telefone de contato"
266
- },
267
- "analista_respons_vel": {
268
- "type": "STATIC_MULTI_SELECT_DROPDOWN",
269
- "options": {
270
- "options": [],
271
- "disabled": false
272
- },
273
- "required": false,
274
- "description": "⚙️ Quando o campo \"Nome do analista responsável\" for preenchido. Buscar nome na base \"DB - Analista responsável\" e popular o campo com o responsável",
275
- "displayName": "Analista responsável"
276
- },
277
- "id_do_grupo_principal": {
278
- "type": "NUMBER",
279
- "required": false,
280
- "description": "\"cedente\"\n\"idGrupoPrincipal\"\n⚙️ vai ser utilizado para quando alterar o responsável de um cedente do grupo muda de todos os outros cedentes deste mesmo grupo",
281
- "displayName": "ID do grupo principal"
282
- },
283
- "observa_es_da_carteira": {
284
- "type": "LONG_TEXT",
285
- "required": false,
286
- "description": "👤 Preenchido pela operação",
287
- "displayName": "Observações da carteira"
288
- },
289
- "db_analista_respons_vel": {
290
- "type": "SHORT_TEXT",
291
- "required": false,
292
- "description": "⚙️ Quando o campo \"Nome do analista responsável\" for preenchido. Buscar nome na base \"DB - Analista responsável\" e popular o campo com o responsável",
293
- "displayName": "DB - Analista responsável"
294
- },
295
- "v_nculo_com_grupo_econ_mico": {
296
- "type": "STATIC_DROPDOWN",
297
- "options": {
298
- "options": [],
299
- "disabled": false
300
- },
301
- "required": false,
302
- "description": "\"cedente\"\n\"vinculoGrupoEconomico\"",
303
- "displayName": "Vínculo com grupo econômico"
304
- },
305
- "nome_do_analista_respons_vel": {
306
- "type": "SHORT_TEXT",
307
- "required": false,
308
- "description": "\"cedente\"\n\"analistaResponsavel\"",
309
- "displayName": "Nome do analista responsável"
310
- }
311
- }
312
- },
313
- "organizationId": {
314
- "type": "MANUAL"
315
- },
316
- "v_nculo_com_grupo_econ_mico": {
317
- "type": "DYNAMIC"
318
- }
319
- },
320
- "errorHandlingOptions": {
321
- "retryOnFailure": {
322
- "value": false
323
- },
324
- "continueOnFailure": {
325
- "value": false
326
- }
327
- }
328
- },
329
- "nextAction": {
330
- "name": "step_8",
331
- "skip": false,
332
- "type": "PIECE",
333
- "valid": true,
334
- "settings": {
335
- "input": {
336
- "url": {
337
- "url": "https://api.pipefy.com/graphql"
338
- },
339
- "auth": "{{connections['exampleConnectionId3']}}",
340
- "body": {
341
- "data": {
342
- "query": "mutation {\n updateCardField(\n input: {card_id: \"{{step_13['output']['cardId']}}\", field_id:\"telefone_de_contato\",new_value:\"{{step_6['output']['telefoneContatoFormatado']}}\"}\n ) {\n clientMutationId\n }\n}\n",
343
- "variables": null
344
- }
345
- },
346
- "method": "POST",
347
- "headers": {},
348
- "failsafe": false,
349
- "body_type": "json",
350
- "queryParams": {},
351
- "followRedirects": false,
352
- "response_is_binary": false
353
- },
354
- "pieceName": "@activepieces/piece-pipefy",
355
- "actionName": "custom_api_call",
356
- "sampleData": {},
357
- "pieceVersion": "0.1.7",
358
- "propertySettings": {
359
- "url": {
360
- "type": "MANUAL",
361
- "schema": {
362
- "url": {
363
- "type": "SHORT_TEXT",
364
- "required": true,
365
- "description": "You can either use the full URL or the relative path to the base URL\ni.e https://api.pipefy.com/graphql/resource or /resource",
366
- "displayName": "URL",
367
- "defaultValue": "https://api.pipefy.com/graphql"
368
- }
369
- }
370
- },
371
- "body": {
372
- "type": "MANUAL",
373
- "schema": {
374
- "data": {
375
- "type": "JSON",
376
- "required": true,
377
- "displayName": "JSON Body"
378
- }
379
- }
380
- },
381
- "method": {
382
- "type": "MANUAL"
383
- },
384
- "headers": {
385
- "type": "MANUAL"
386
- },
387
- "timeout": {
388
- "type": "MANUAL"
389
- },
390
- "failsafe": {
391
- "type": "MANUAL"
392
- },
393
- "body_type": {
394
- "type": "MANUAL"
395
- },
396
- "queryParams": {
397
- "type": "MANUAL"
398
- },
399
- "followRedirects": {
400
- "type": "MANUAL"
401
- },
402
- "response_is_binary": {
403
- "type": "MANUAL"
404
- }
405
- },
406
- "errorHandlingOptions": {
407
- "retryOnFailure": {
408
- "value": false
409
- },
410
- "continueOnFailure": {
411
- "value": false
412
- }
413
- }
414
- },
415
- "nextAction": {
416
- "name": "step_10",
417
- "skip": false,
418
- "type": "PIECE",
419
- "valid": true,
420
- "settings": {
421
- "input": {
422
- "mode": "simple",
423
- "response": {
424
- "response": {}
425
- }
426
- },
427
- "pieceName": "@activepieces/piece-subflows",
428
- "actionName": "returnResponse",
429
- "sampleData": {},
430
- "pieceVersion": "0.4.12",
431
- "propertySettings": {
432
- "mode": {
433
- "type": "MANUAL"
434
- },
435
- "response": {
436
- "type": "MANUAL",
437
- "schema": {
438
- "response": {
439
- "type": "OBJECT",
440
- "required": true,
441
- "displayName": "Response"
442
- }
443
- }
444
- }
445
- },
446
- "errorHandlingOptions": {
447
- "retryOnFailure": {
448
- "value": false
449
- },
450
- "continueOnFailure": {
451
- "value": false
452
- }
453
- }
454
- },
455
- "displayName": "Retornar",
456
- "lastUpdatedDate": "2026-08-11T14:44:55.374Z"
457
- },
458
- "displayName": "atualização Telefone {\"query\":\"mutation {\\n updateCardField(\\n input: {card_id: \\\"0\\\", field_id:\\\"telefone_de_contato\\\",new_value:\\\"+55 (11) 2222-3333\\\"}\\n ) {\\n clientMutationId\\n }\\n}\\n\",\"variables\":null}",
459
- "lastUpdatedDate": "2026-08-11T14:44:55.373Z"
460
- },
461
- "displayName": "Atualização de campos",
462
- "lastUpdatedDate": "2026-08-11T14:44:55.373Z"
463
- },
464
- "displayName": "Normalização v.1",
465
- "lastUpdatedDate": "2026-08-11T14:44:55.373Z"
466
- },
467
- "displayName": "Normalização",
468
- "lastUpdatedDate": "2026-08-11T14:44:55.372Z"
469
- },
470
- null
471
- ],
472
- "settings": {
473
- "branches": [
474
- {
475
- "branchName": "Existe",
476
- "branchType": "CONDITION",
477
- "conditions": [
478
- [
479
- {
480
- "operator": "BOOLEAN_IS_TRUE",
481
- "firstValue": "{{step_13['output']['encontrado']}}"
482
- }
483
- ]
484
- ]
485
- },
486
- {
487
- "branchName": "Otherwise",
488
- "branchType": "FALLBACK"
489
- }
490
- ],
491
- "sampleData": {},
492
- "executionType": "EXECUTE_FIRST_MATCH"
493
- },
494
- "displayName": "Lista Sacado",
495
- "lastUpdatedDate": "2026-08-11T14:44:55.372Z"
496
- },
497
- "displayName": "Conferência id e codigoEmpresa",
498
- "lastUpdatedDate": "2026-08-11T14:44:55.372Z"
499
- },
500
- "displayName": "Buscar Sacado",
501
- "lastUpdatedDate": "2026-08-11T14:44:55.372Z"
502
- },
503
- "lastUpdatedDate": "2026-08-11T14:44:55.372Z",
504
- "type": "PIECE_TRIGGER",
505
- "settings": {
506
- "sampleData": {},
507
- "propertySettings": {
508
- "mode": {
509
- "type": "MANUAL"
510
- },
511
- "exampleData": {
512
- "type": "MANUAL",
513
- "schema": {
514
- "sampleData": {
515
- "type": "example",
516
- "required": false,
517
- "displayName": "example"
518
- }
519
- }
520
- }
521
- },
522
- "pieceName": "@activepieces/piece-subflows",
523
- "pieceVersion": "0.4.12",
524
- "triggerName": "callableFlow",
525
- "input": {
526
- "mode": "advanced",
527
- "exampleData": {
528
- "sampleData": {
529
- "cedente": {
530
- "cep": "example",
531
- "nome": "example",
532
- "email": "example",
533
- "cidade": "example",
534
- "estado": "example",
535
- "endereco": "example",
536
- "cnpjOuCpf": "example",
537
- "idCedente": 0,
538
- "dataCadastro": "example",
539
- "codigoEmpresa": 0,
540
- "telefoneContato": "example",
541
- "idGrupoPrincipal": 0,
542
- "analistaResponsavel": "example",
543
- "vinculoGrupoEconomico": false
544
- },
545
- "empresaCodigo": 0
546
- }
547
- }
548
- }
549
- }
550
- },
551
- "valid": true,
552
- "schemaVersion": "22",
553
- "notes": []
554
- }
555
- ],
556
- "status": "PUBLISHED"
557
- }
1
+ {
2
+ "name": "✅[PRD][HML][2/2 SUBFLOW][RETORNO CONSULTA/UPDATE] Retorno Cedente",
3
+ "type": "SHARED",
4
+ "summary": "",
5
+ "description": "",
6
+ "tags": [],
7
+ "blogUrl": "",
8
+ "metadata": {
9
+ "externalId": "exampleFlowId02aaaaaa"
10
+ },
11
+ "author": "Integrações Ipaas 000000000",
12
+ "categories": [],
13
+ "pieces": [
14
+ "@activepieces/piece-subflows",
15
+ "@activepieces/piece-pipefy"
16
+ ],
17
+ "flows": [
18
+ {
19
+ "displayName": "✅[PRD][HML][2/2 SUBFLOW][RETORNO CONSULTA/UPDATE] Retorno Cedente",
20
+ "trigger": {
21
+ "name": "trigger",
22
+ "valid": true,
23
+ "displayName": "Callable Flow",
24
+ "nextAction": {
25
+ "name": "step_2",
26
+ "type": "PIECE",
27
+ "valid": true,
28
+ "settings": {
29
+ "input": {
30
+ "auth": "{{connections['exampleConnectionId3']}}",
31
+ "pipeId": "200000004",
32
+ "fieldId": "idcedente",
33
+ "fieldValue": "{{trigger['output']['data']['cedente']['idCedente']}}",
34
+ "organizationId": "100000001"
35
+ },
36
+ "pieceName": "@activepieces/piece-pipefy",
37
+ "actionName": "getCardsByFieldValue",
38
+ "sampleData": {},
39
+ "pieceVersion": "0.1.7",
40
+ "propertySettings": {
41
+ "pipeId": {
42
+ "type": "MANUAL"
43
+ },
44
+ "fieldId": {
45
+ "type": "MANUAL"
46
+ },
47
+ "fieldValue": {
48
+ "type": "MANUAL"
49
+ },
50
+ "organizationId": {
51
+ "type": "MANUAL"
52
+ }
53
+ },
54
+ "errorHandlingOptions": {
55
+ "retryOnFailure": {
56
+ "value": false
57
+ },
58
+ "continueOnFailure": {
59
+ "value": false
60
+ }
61
+ }
62
+ },
63
+ "nextAction": {
64
+ "name": "step_13",
65
+ "skip": false,
66
+ "type": "CODE",
67
+ "valid": true,
68
+ "settings": {
69
+ "input": {
70
+ "cards": "{{step_2['output']['data']['cards']}}",
71
+ "empresaCodigo": "{{trigger['output']['data']['cedente']['codigoEmpresa']}}"
72
+ },
73
+ "sampleData": {},
74
+ "sourceCode": {
75
+ "code": "export const code = async (inputs) => {\n const alvo = String(inputs.empresaCodigo ?? '').trim();\n\n const card = inputs.cards.find(\n c => String(c.fields?.empresacodigo?.value ?? '').trim() === alvo\n );\n\n return {\n cardId: card?.id ?? null,\n encontrado: !!card\n };\n};",
76
+ "packageJson": "{}"
77
+ },
78
+ "errorHandlingOptions": {
79
+ "retryOnFailure": {
80
+ "value": false
81
+ },
82
+ "continueOnFailure": {
83
+ "value": false
84
+ }
85
+ }
86
+ },
87
+ "nextAction": {
88
+ "name": "step_3",
89
+ "skip": false,
90
+ "type": "ROUTER",
91
+ "valid": true,
92
+ "children": [
93
+ {
94
+ "name": "step_6",
95
+ "skip": false,
96
+ "type": "CODE",
97
+ "valid": true,
98
+ "settings": {
99
+ "input": {
100
+ "email": "{{trigger['output']['data']['cedente']['email']}}",
101
+ "cnpjOuCpf": "{{trigger['output']['data']['cedente']['cnpjOuCpf']}}",
102
+ "telefoneContato ": "{{trigger['output']['data']['cedente']['telefoneContato']}}",
103
+ "vinculoGrupoEconomico": "{{trigger['output']['data']['cedente']['vinculoGrupoEconomico']}}"
104
+ },
105
+ "sampleData": {},
106
+ "sourceCode": {
107
+ "code": "export const code = async (inputs) => {\n // Normaliza chaves removendo espaços extras\n const normalizedInputs = {};\n for (const key in inputs) {\n normalizedInputs[key.trim()] = inputs[key];\n }\n inputs = normalizedInputs;\n\n // DDDs válidos no Brasil (nenhum começa com 0 ou 1)\n const DDD_VALIDOS = new Set([\n '11','12','13','14','15','16','17','18','19',\n '21','22','24',\n '27','28',\n '31','32','33','34','35','37','38',\n '41','42','43','44','45','46',\n '47','48','49',\n '51','53','54','55',\n '61',\n '62','63','64',\n '65','66',\n '67',\n '68',\n '69',\n '71','73','74','75','77',\n '79',\n '81','82','83','84','87',\n '85','88','86','89',\n '91','92','93','94','97',\n '95',\n '96',\n '98','99',\n ]);\n\n // ===== Normaliza telefone =====\n let telefoneContato = '';\n let telefoneContatoFormatado = '';\n if (inputs.telefoneContato) {\n let numeros = String(inputs.telefoneContato).replace(/\\D/g, '');\n\n // Remove o 55 inicial se já vier com código do país\n if ((numeros.length === 12 || numeros.length === 13) && numeros.startsWith('55')) {\n numeros = numeros.substring(2);\n }\n\n // Corrige prefixo \"0\" indevido antes do DDD (ex: \"084 3064-6035\" -> \"84 3064-6035\")\n // Nenhum DDD começa com 0, então um \"0\" sobrando aqui sempre indica esse erro de digitação/formatação,\n // seja em número fixo (11 dígitos -> 10) ou celular (12 dígitos -> 11)\n if (numeros.startsWith('0') && (numeros.length === 11 || numeros.length === 12)) {\n numeros = numeros.substring(1);\n }\n\n // Sanity check adicional: se o DDD calculado não é válido, tenta reancorar\n // deslocando um dígito (cobre outros casos de dígito extra vazado no começo)\n const dddCandidato = numeros.substring(0, 2);\n if (!DDD_VALIDOS.has(dddCandidato) && (numeros.length === 11 || numeros.length === 12)) {\n const dddAlternativo = numeros.substring(1, 3);\n if (DDD_VALIDOS.has(dddAlternativo)) {\n numeros = numeros.substring(1);\n }\n }\n\n if (numeros.length === 11) {\n // Celular com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 7);\n const parte2 = numeros.substring(7);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else if (numeros.length === 10) {\n // Fixo com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 6);\n const parte2 = numeros.substring(6);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else {\n telefoneContato = numeros;\n telefoneContatoFormatado = numeros;\n }\n }\n\n // ===== Normaliza e-mails =====\n let email = '';\n let emailCheck = true;\n if (inputs.email) {\n const emailStr = String(inputs.email);\n if (!emailStr.includes('@')) {\n email = emailStr;\n emailCheck = false;\n } else {\n const emailRegex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/;\n const validos = emailStr\n .split(/[;,\\s]+/)\n .map((e) => e.trim())\n .filter((e) => e && emailRegex.test(e));\n email = Array.from(new Set(validos)).join(', ');\n }\n }\n\n // ===== Identifica e formata CPF/CNPJ =====\n let cpf = '';\n let cnpj = '';\n let tipo = '';\n if (inputs.cnpjOuCpf) {\n const doc = String(inputs.cnpjOuCpf).replace(/\\D/g, '');\n if (doc.length === 11) {\n cpf = `${doc.substring(0, 3)}.${doc.substring(3, 6)}.${doc.substring(6, 9)}-${doc.substring(9)}`;\n tipo = 'cpf';\n } else if (doc.length === 14) {\n cnpj = `${doc.substring(0, 2)}.${doc.substring(2, 5)}.${doc.substring(5, 8)}/${doc.substring(8, 12)}-${doc.substring(12)}`;\n tipo = 'cnpj';\n }\n }\n\n // ===== Normaliza vínculo a grupo econômico =====\n let vinculoGrupoEconomico = '';\n if (inputs.vinculoGrupoEconomico !== undefined && inputs.vinculoGrupoEconomico !== null) {\n const valor = String(inputs.vinculoGrupoEconomico).trim().toLowerCase();\n if (valor === 'true' || valor === 'sim' || valor === '1') {\n vinculoGrupoEconomico = 'Sim';\n } else if (valor === 'false' || valor === 'não' || valor === 'nao' || valor === '0') {\n vinculoGrupoEconomico = 'Não';\n }\n }\n\n return {\n telefoneContato,\n telefoneContatoFormatado,\n email,\n emailCheck,\n tipo,\n cpf,\n cnpj,\n vinculoGrupoEconomico,\n };\n};",
108
+ "packageJson": "{}"
109
+ },
110
+ "errorHandlingOptions": {
111
+ "retryOnFailure": {
112
+ "value": false
113
+ },
114
+ "continueOnFailure": {
115
+ "value": false
116
+ }
117
+ }
118
+ },
119
+ "nextAction": {
120
+ "name": "step_1",
121
+ "skip": true,
122
+ "type": "CODE",
123
+ "valid": true,
124
+ "settings": {
125
+ "input": {
126
+ "email": "{{trigger['output']['data']['cedente']['email']}}",
127
+ "cnpjOuCpf": "{{trigger['output']['data']['cedente']['cnpjOuCpf']}}",
128
+ "telefoneContato ": "{{trigger['output']['data']['cedente']['telefoneContato']}}",
129
+ "vinculoGrupoEconomico": "{{trigger['output']['data']['cedente']['vinculoGrupoEconomico']}}"
130
+ },
131
+ "sampleData": {},
132
+ "sourceCode": {
133
+ "code": "export const code = async (inputs) => {\n // Normaliza chaves removendo espaços extras\n const normalizedInputs = {};\n for (const key in inputs) {\n normalizedInputs[key.trim()] = inputs[key];\n }\n inputs = normalizedInputs;\n // ===== Normaliza telefone =====\n let telefoneContato = '';\n let telefoneContatoFormatado = '';\n if (inputs.telefoneContato) {\n let numeros = String(inputs.telefoneContato).replace(/\\D/g, '');\n // Remove o 55 inicial se já vier com código do país\n if ((numeros.length === 12 || numeros.length === 13) && numeros.startsWith('55')) {\n numeros = numeros.substring(2);\n }\n if (numeros.length === 11) {\n // Celular com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 7);\n const parte2 = numeros.substring(7);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else if (numeros.length === 10) {\n // Fixo com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 6);\n const parte2 = numeros.substring(6);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else {\n telefoneContato = numeros;\n telefoneContatoFormatado = numeros;\n }\n }\n // ===== Normaliza e-mails =====\n let email = '';\n let emailCheck = true;\n if (inputs.email) {\n const emailStr = String(inputs.email);\n if (!emailStr.includes('@')) {\n email = emailStr;\n emailCheck = false;\n } else {\n const emailRegex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/;\n const validos = emailStr\n .split(/[;,\\s]+/)\n .map((e) => e.trim())\n .filter((e) => e && emailRegex.test(e));\n email = Array.from(new Set(validos)).join(', ');\n }\n }\n // ===== Identifica e formata CPF/CNPJ =====\n let cpf = '';\n let cnpj = '';\n let tipo = '';\n if (inputs.cnpjOuCpf) {\n const doc = String(inputs.cnpjOuCpf).replace(/\\D/g, '');\n if (doc.length === 11) {\n cpf = `${doc.substring(0, 3)}.${doc.substring(3, 6)}.${doc.substring(6, 9)}-${doc.substring(9)}`;\n tipo = 'cpf';\n } else if (doc.length === 14) {\n cnpj = `${doc.substring(0, 2)}.${doc.substring(2, 5)}.${doc.substring(5, 8)}/${doc.substring(8, 12)}-${doc.substring(12)}`;\n tipo = 'cnpj';\n }\n }\n // ===== Normaliza vínculo a grupo econômico =====\n let vinculoGrupoEconomico = '';\n if (inputs.vinculoGrupoEconomico !== undefined && inputs.vinculoGrupoEconomico !== null) {\n const valor = String(inputs.vinculoGrupoEconomico).trim().toLowerCase();\n if (valor === 'true' || valor === 'sim' || valor === '1') {\n vinculoGrupoEconomico = 'Sim';\n } else if (valor === 'false' || valor === 'não' || valor === 'nao' || valor === '0') {\n vinculoGrupoEconomico = 'Não';\n }\n }\n return {\n telefoneContato,\n telefoneContatoFormatado,\n email,\n emailCheck,\n tipo,\n cpf,\n cnpj,\n vinculoGrupoEconomico,\n };\n};",
134
+ "packageJson": "{}"
135
+ },
136
+ "errorHandlingOptions": {
137
+ "retryOnFailure": {
138
+ "value": false
139
+ },
140
+ "continueOnFailure": {
141
+ "value": false
142
+ }
143
+ }
144
+ },
145
+ "nextAction": {
146
+ "name": "step_5",
147
+ "skip": false,
148
+ "type": "PIECE",
149
+ "valid": true,
150
+ "settings": {
151
+ "input": {
152
+ "auth": "{{connections['exampleConnectionId3']}}",
153
+ "cardId": "{{step_13['output']['cardId']}}",
154
+ "pipeId": "200000004",
155
+ "phaseId": "300000003",
156
+ "phaseFields": {
157
+ "cep": "{{trigger['output']['data']['cedente']['cep']}}",
158
+ "cpf": "{{step_6['output']['cpf']}}",
159
+ "cnpj": "{{step_6['output']['cnpj']}}",
160
+ "nome": "{{trigger['output']['data']['cedente']['nome']}}",
161
+ "email": "{{step_6['output']['email']}}",
162
+ "cidade": "{{trigger['output']['data']['cedente']['cidade']}}",
163
+ "estado": "{{trigger['output']['data']['cedente']['estado']}}",
164
+ "endere_o": "{{trigger['output']['data']['cedente']['endereco']}}",
165
+ "data_de_cadastro": "{{trigger['output']['data']['cedente']['dataCadastro']}}",
166
+ "analista_respons_vel": [],
167
+ "id_do_grupo_principal": "{{trigger['output']['data']['cedente']['idGrupoPrincipal']}}",
168
+ "v_nculo_com_grupo_econ_mico": "{{step_6['output']['vinculoGrupoEconomico']}}"
169
+ },
170
+ "organizationId": "100000001"
171
+ },
172
+ "pieceName": "@activepieces/piece-pipefy",
173
+ "actionName": "updateCard",
174
+ "sampleData": {},
175
+ "pieceVersion": "0.1.7",
176
+ "propertySettings": {
177
+ "cardId": {
178
+ "type": "MANUAL"
179
+ },
180
+ "pipeId": {
181
+ "type": "MANUAL"
182
+ },
183
+ "phaseId": {
184
+ "type": "MANUAL"
185
+ },
186
+ "phaseFields": {
187
+ "type": "MANUAL",
188
+ "schema": {
189
+ "cep": {
190
+ "type": "SHORT_TEXT",
191
+ "required": false,
192
+ "description": "\"cedente\"\n\"cep\"",
193
+ "displayName": "CEP"
194
+ },
195
+ "cpf": {
196
+ "type": "SHORT_TEXT",
197
+ "required": false,
198
+ "description": "\"cedente\"\n\"cnpjOuCpf\"",
199
+ "displayName": "CPF"
200
+ },
201
+ "cnpj": {
202
+ "type": "SHORT_TEXT",
203
+ "required": false,
204
+ "description": "\"cedente\"\n\"cnpjOuCpf\"",
205
+ "displayName": "CNPJ"
206
+ },
207
+ "nome": {
208
+ "type": "SHORT_TEXT",
209
+ "required": false,
210
+ "description": "\"cedente\"\n\"nome\"",
211
+ "displayName": "Nome"
212
+ },
213
+ "email": {
214
+ "type": "LONG_TEXT",
215
+ "required": false,
216
+ "description": "\"cedente\"\n\"email\"",
217
+ "displayName": "E-mail"
218
+ },
219
+ "cidade": {
220
+ "type": "SHORT_TEXT",
221
+ "required": false,
222
+ "description": "\"cedente\"\n\"cidade\"",
223
+ "displayName": "Cidade"
224
+ },
225
+ "estado": {
226
+ "type": "SHORT_TEXT",
227
+ "required": false,
228
+ "description": "\"cedente\"\n\"estado\"",
229
+ "displayName": "Estado"
230
+ },
231
+ "d_start": {
232
+ "type": "SHORT_TEXT",
233
+ "required": false,
234
+ "description": "⚙️ Quando o card for criado colocar D Start padrão (Automação)",
235
+ "displayName": "D Start"
236
+ },
237
+ "endere_o": {
238
+ "type": "LONG_TEXT",
239
+ "required": false,
240
+ "description": "\"cedente\"\n\"endereco\"",
241
+ "displayName": "Endereço"
242
+ },
243
+ "idcedente": {
244
+ "type": "SHORT_TEXT",
245
+ "required": false,
246
+ "description": "\"cedente\"\n\"idCedente\"",
247
+ "displayName": "ID Cedente (Barramento)"
248
+ },
249
+ "empresacodigo": {
250
+ "type": "SHORT_TEXT",
251
+ "required": false,
252
+ "description": "\"cedente\"\n\"codigoEmpresa\"",
253
+ "displayName": "empresaCodigo"
254
+ },
255
+ "data_de_cadastro": {
256
+ "type": "SHORT_TEXT",
257
+ "required": false,
258
+ "description": "\"cedente\"\n\"dataCadastro\"",
259
+ "displayName": "Data de cadastro"
260
+ },
261
+ "telefone_de_contato": {
262
+ "type": "NUMBER",
263
+ "required": false,
264
+ "description": "\"cedente\"\n\"telefoneContato\"",
265
+ "displayName": "Telefone de contato"
266
+ },
267
+ "analista_respons_vel": {
268
+ "type": "STATIC_MULTI_SELECT_DROPDOWN",
269
+ "options": {
270
+ "options": [],
271
+ "disabled": false
272
+ },
273
+ "required": false,
274
+ "description": "⚙️ Quando o campo \"Nome do analista responsável\" for preenchido. Buscar nome na base \"DB - Analista responsável\" e popular o campo com o responsável",
275
+ "displayName": "Analista responsável"
276
+ },
277
+ "id_do_grupo_principal": {
278
+ "type": "NUMBER",
279
+ "required": false,
280
+ "description": "\"cedente\"\n\"idGrupoPrincipal\"\n⚙️ vai ser utilizado para quando alterar o responsável de um cedente do grupo muda de todos os outros cedentes deste mesmo grupo",
281
+ "displayName": "ID do grupo principal"
282
+ },
283
+ "observa_es_da_carteira": {
284
+ "type": "LONG_TEXT",
285
+ "required": false,
286
+ "description": "👤 Preenchido pela operação",
287
+ "displayName": "Observações da carteira"
288
+ },
289
+ "db_analista_respons_vel": {
290
+ "type": "SHORT_TEXT",
291
+ "required": false,
292
+ "description": "⚙️ Quando o campo \"Nome do analista responsável\" for preenchido. Buscar nome na base \"DB - Analista responsável\" e popular o campo com o responsável",
293
+ "displayName": "DB - Analista responsável"
294
+ },
295
+ "v_nculo_com_grupo_econ_mico": {
296
+ "type": "STATIC_DROPDOWN",
297
+ "options": {
298
+ "options": [],
299
+ "disabled": false
300
+ },
301
+ "required": false,
302
+ "description": "\"cedente\"\n\"vinculoGrupoEconomico\"",
303
+ "displayName": "Vínculo com grupo econômico"
304
+ },
305
+ "nome_do_analista_respons_vel": {
306
+ "type": "SHORT_TEXT",
307
+ "required": false,
308
+ "description": "\"cedente\"\n\"analistaResponsavel\"",
309
+ "displayName": "Nome do analista responsável"
310
+ }
311
+ }
312
+ },
313
+ "organizationId": {
314
+ "type": "MANUAL"
315
+ },
316
+ "v_nculo_com_grupo_econ_mico": {
317
+ "type": "DYNAMIC"
318
+ }
319
+ },
320
+ "errorHandlingOptions": {
321
+ "retryOnFailure": {
322
+ "value": false
323
+ },
324
+ "continueOnFailure": {
325
+ "value": false
326
+ }
327
+ }
328
+ },
329
+ "nextAction": {
330
+ "name": "step_8",
331
+ "skip": false,
332
+ "type": "PIECE",
333
+ "valid": true,
334
+ "settings": {
335
+ "input": {
336
+ "url": {
337
+ "url": "https://api.pipefy.com/graphql"
338
+ },
339
+ "auth": "{{connections['exampleConnectionId3']}}",
340
+ "body": {
341
+ "data": {
342
+ "query": "mutation {\n updateCardField(\n input: {card_id: \"{{step_13['output']['cardId']}}\", field_id:\"telefone_de_contato\",new_value:\"{{step_6['output']['telefoneContatoFormatado']}}\"}\n ) {\n clientMutationId\n }\n}\n",
343
+ "variables": null
344
+ }
345
+ },
346
+ "method": "POST",
347
+ "headers": {},
348
+ "failsafe": false,
349
+ "body_type": "json",
350
+ "queryParams": {},
351
+ "followRedirects": false,
352
+ "response_is_binary": false
353
+ },
354
+ "pieceName": "@activepieces/piece-pipefy",
355
+ "actionName": "custom_api_call",
356
+ "sampleData": {},
357
+ "pieceVersion": "0.1.7",
358
+ "propertySettings": {
359
+ "url": {
360
+ "type": "MANUAL",
361
+ "schema": {
362
+ "url": {
363
+ "type": "SHORT_TEXT",
364
+ "required": true,
365
+ "description": "You can either use the full URL or the relative path to the base URL\ni.e https://api.pipefy.com/graphql/resource or /resource",
366
+ "displayName": "URL",
367
+ "defaultValue": "https://api.pipefy.com/graphql"
368
+ }
369
+ }
370
+ },
371
+ "body": {
372
+ "type": "MANUAL",
373
+ "schema": {
374
+ "data": {
375
+ "type": "JSON",
376
+ "required": true,
377
+ "displayName": "JSON Body"
378
+ }
379
+ }
380
+ },
381
+ "method": {
382
+ "type": "MANUAL"
383
+ },
384
+ "headers": {
385
+ "type": "MANUAL"
386
+ },
387
+ "timeout": {
388
+ "type": "MANUAL"
389
+ },
390
+ "failsafe": {
391
+ "type": "MANUAL"
392
+ },
393
+ "body_type": {
394
+ "type": "MANUAL"
395
+ },
396
+ "queryParams": {
397
+ "type": "MANUAL"
398
+ },
399
+ "followRedirects": {
400
+ "type": "MANUAL"
401
+ },
402
+ "response_is_binary": {
403
+ "type": "MANUAL"
404
+ }
405
+ },
406
+ "errorHandlingOptions": {
407
+ "retryOnFailure": {
408
+ "value": false
409
+ },
410
+ "continueOnFailure": {
411
+ "value": false
412
+ }
413
+ }
414
+ },
415
+ "nextAction": {
416
+ "name": "step_10",
417
+ "skip": false,
418
+ "type": "PIECE",
419
+ "valid": true,
420
+ "settings": {
421
+ "input": {
422
+ "mode": "simple",
423
+ "response": {
424
+ "response": {}
425
+ }
426
+ },
427
+ "pieceName": "@activepieces/piece-subflows",
428
+ "actionName": "returnResponse",
429
+ "sampleData": {},
430
+ "pieceVersion": "0.4.12",
431
+ "propertySettings": {
432
+ "mode": {
433
+ "type": "MANUAL"
434
+ },
435
+ "response": {
436
+ "type": "MANUAL",
437
+ "schema": {
438
+ "response": {
439
+ "type": "OBJECT",
440
+ "required": true,
441
+ "displayName": "Response"
442
+ }
443
+ }
444
+ }
445
+ },
446
+ "errorHandlingOptions": {
447
+ "retryOnFailure": {
448
+ "value": false
449
+ },
450
+ "continueOnFailure": {
451
+ "value": false
452
+ }
453
+ }
454
+ },
455
+ "displayName": "Retornar",
456
+ "lastUpdatedDate": "2026-08-11T14:44:55.374Z"
457
+ },
458
+ "displayName": "atualização Telefone {\"query\":\"mutation {\\n updateCardField(\\n input: {card_id: \\\"0\\\", field_id:\\\"telefone_de_contato\\\",new_value:\\\"+55 (11) 2222-3333\\\"}\\n ) {\\n clientMutationId\\n }\\n}\\n\",\"variables\":null}",
459
+ "lastUpdatedDate": "2026-08-11T14:44:55.373Z"
460
+ },
461
+ "displayName": "Atualização de campos",
462
+ "lastUpdatedDate": "2026-08-11T14:44:55.373Z"
463
+ },
464
+ "displayName": "Normalização v.1",
465
+ "lastUpdatedDate": "2026-08-11T14:44:55.373Z"
466
+ },
467
+ "displayName": "Normalização",
468
+ "lastUpdatedDate": "2026-08-11T14:44:55.372Z"
469
+ },
470
+ null
471
+ ],
472
+ "settings": {
473
+ "branches": [
474
+ {
475
+ "branchName": "Existe",
476
+ "branchType": "CONDITION",
477
+ "conditions": [
478
+ [
479
+ {
480
+ "operator": "BOOLEAN_IS_TRUE",
481
+ "firstValue": "{{step_13['output']['encontrado']}}"
482
+ }
483
+ ]
484
+ ]
485
+ },
486
+ {
487
+ "branchName": "Otherwise",
488
+ "branchType": "FALLBACK"
489
+ }
490
+ ],
491
+ "sampleData": {},
492
+ "executionType": "EXECUTE_FIRST_MATCH"
493
+ },
494
+ "displayName": "Lista Sacado",
495
+ "lastUpdatedDate": "2026-08-11T14:44:55.372Z"
496
+ },
497
+ "displayName": "Conferência id e codigoEmpresa",
498
+ "lastUpdatedDate": "2026-08-11T14:44:55.372Z"
499
+ },
500
+ "displayName": "Buscar Sacado",
501
+ "lastUpdatedDate": "2026-08-11T14:44:55.372Z"
502
+ },
503
+ "lastUpdatedDate": "2026-08-11T14:44:55.372Z",
504
+ "type": "PIECE_TRIGGER",
505
+ "settings": {
506
+ "sampleData": {},
507
+ "propertySettings": {
508
+ "mode": {
509
+ "type": "MANUAL"
510
+ },
511
+ "exampleData": {
512
+ "type": "MANUAL",
513
+ "schema": {
514
+ "sampleData": {
515
+ "type": "example",
516
+ "required": false,
517
+ "displayName": "example"
518
+ }
519
+ }
520
+ }
521
+ },
522
+ "pieceName": "@activepieces/piece-subflows",
523
+ "pieceVersion": "0.4.12",
524
+ "triggerName": "callableFlow",
525
+ "input": {
526
+ "mode": "advanced",
527
+ "exampleData": {
528
+ "sampleData": {
529
+ "cedente": {
530
+ "cep": "example",
531
+ "nome": "example",
532
+ "email": "example",
533
+ "cidade": "example",
534
+ "estado": "example",
535
+ "endereco": "example",
536
+ "cnpjOuCpf": "example",
537
+ "idCedente": 0,
538
+ "dataCadastro": "example",
539
+ "codigoEmpresa": 0,
540
+ "telefoneContato": "example",
541
+ "idGrupoPrincipal": 0,
542
+ "analistaResponsavel": "example",
543
+ "vinculoGrupoEconomico": false
544
+ },
545
+ "empresaCodigo": 0
546
+ }
547
+ }
548
+ }
549
+ }
550
+ },
551
+ "valid": true,
552
+ "schemaVersion": "22",
553
+ "notes": []
554
+ }
555
+ ],
556
+ "status": "PUBLISHED"
557
+ }