@atomoz/workflows-nodes 0.1.17 → 0.1.19
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/index.cjs +160 -1
- package/dist/index.js +160 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -492,6 +491,163 @@ var CronTriggerNode = {
|
|
|
492
491
|
]
|
|
493
492
|
};
|
|
494
493
|
|
|
494
|
+
// src/nodes/processors/delay/index.ts
|
|
495
|
+
var DelayNode = {
|
|
496
|
+
label: "Delay",
|
|
497
|
+
type: "DelayNode",
|
|
498
|
+
category: "step",
|
|
499
|
+
icon: "\u23F3",
|
|
500
|
+
description: "Pausa o workflow por um tempo determinado",
|
|
501
|
+
tags: {
|
|
502
|
+
execution: "async",
|
|
503
|
+
group: "Control"
|
|
504
|
+
},
|
|
505
|
+
fields: [
|
|
506
|
+
{
|
|
507
|
+
id: "input",
|
|
508
|
+
label: "Trigger",
|
|
509
|
+
type: "any",
|
|
510
|
+
required: false,
|
|
511
|
+
handle: {
|
|
512
|
+
type: "input",
|
|
513
|
+
label: "Start",
|
|
514
|
+
name: "trigger",
|
|
515
|
+
fieldType: "any"
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
id: "duration",
|
|
520
|
+
label: "Dura\xE7\xE3o",
|
|
521
|
+
type: "number",
|
|
522
|
+
required: true,
|
|
523
|
+
defaultValue: 1
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
id: "unit",
|
|
527
|
+
label: "Unidade",
|
|
528
|
+
type: "select",
|
|
529
|
+
defaultValue: "minutes",
|
|
530
|
+
required: true,
|
|
531
|
+
options: [
|
|
532
|
+
{ label: "Segundos", value: "seconds" },
|
|
533
|
+
{ label: "Minutos", value: "minutes" },
|
|
534
|
+
{ label: "Horas", value: "hours" },
|
|
535
|
+
{ label: "Dias", value: "days" }
|
|
536
|
+
]
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
id: "output",
|
|
540
|
+
label: "Continue",
|
|
541
|
+
type: "any",
|
|
542
|
+
required: false,
|
|
543
|
+
handle: {
|
|
544
|
+
type: "output",
|
|
545
|
+
label: "Continue",
|
|
546
|
+
name: "continue",
|
|
547
|
+
fieldType: "any"
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
]
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
// src/nodes/processors/http-request/index.ts
|
|
554
|
+
var HttpRequestNodeFunction = async (params, input, context) => {
|
|
555
|
+
const { url, method, headers, body } = params;
|
|
556
|
+
console.log(`\u{1F4E1} Making HTTP Request: ${method} ${url}`);
|
|
557
|
+
const headersObj = typeof headers === "string" ? JSON.parse(headers || "{}") : headers || {};
|
|
558
|
+
const bodyObj = typeof body === "string" ? body : JSON.stringify(body);
|
|
559
|
+
const response = await fetch(url, {
|
|
560
|
+
method,
|
|
561
|
+
headers: {
|
|
562
|
+
"Content-Type": "application/json",
|
|
563
|
+
...headersObj
|
|
564
|
+
},
|
|
565
|
+
body: method !== "GET" && method !== "HEAD" ? bodyObj : void 0
|
|
566
|
+
});
|
|
567
|
+
const responseText = await response.text();
|
|
568
|
+
let responseData;
|
|
569
|
+
try {
|
|
570
|
+
responseData = JSON.parse(responseText);
|
|
571
|
+
} catch (e) {
|
|
572
|
+
responseData = responseText;
|
|
573
|
+
}
|
|
574
|
+
return {
|
|
575
|
+
status: response.status,
|
|
576
|
+
statusText: response.statusText,
|
|
577
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
578
|
+
data: responseData
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
var HttpRequestNode = {
|
|
582
|
+
label: "HTTP Request",
|
|
583
|
+
type: "HttpRequestNode",
|
|
584
|
+
category: "step",
|
|
585
|
+
// or 'api'?
|
|
586
|
+
icon: "\u{1F310}",
|
|
587
|
+
description: "Faz uma requisi\xE7\xE3o HTTP externa",
|
|
588
|
+
tags: {
|
|
589
|
+
execution: "async",
|
|
590
|
+
group: "HTTP"
|
|
591
|
+
},
|
|
592
|
+
fields: [
|
|
593
|
+
{
|
|
594
|
+
id: "input",
|
|
595
|
+
label: "Input",
|
|
596
|
+
type: "any",
|
|
597
|
+
handle: {
|
|
598
|
+
type: "input",
|
|
599
|
+
label: "Start",
|
|
600
|
+
name: "input",
|
|
601
|
+
fieldType: "any"
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
id: "url",
|
|
606
|
+
label: "URL",
|
|
607
|
+
type: "string",
|
|
608
|
+
required: true,
|
|
609
|
+
placeholder: "https://api.example.com"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
id: "method",
|
|
613
|
+
label: "Method",
|
|
614
|
+
type: "select",
|
|
615
|
+
required: true,
|
|
616
|
+
defaultValue: "GET",
|
|
617
|
+
options: [
|
|
618
|
+
{ label: "GET", value: "GET" },
|
|
619
|
+
{ label: "POST", value: "POST" },
|
|
620
|
+
{ label: "PUT", value: "PUT" },
|
|
621
|
+
{ label: "DELETE", value: "DELETE" },
|
|
622
|
+
{ label: "PATCH", value: "PATCH" }
|
|
623
|
+
]
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
id: "headers",
|
|
627
|
+
label: "Headers (JSON)",
|
|
628
|
+
type: "json",
|
|
629
|
+
defaultValue: "{}"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
id: "body",
|
|
633
|
+
label: "Body (JSON)",
|
|
634
|
+
type: "json",
|
|
635
|
+
defaultValue: "{}"
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
id: "output",
|
|
639
|
+
label: "Output",
|
|
640
|
+
type: "any",
|
|
641
|
+
handle: {
|
|
642
|
+
type: "output",
|
|
643
|
+
label: "Response",
|
|
644
|
+
name: "output",
|
|
645
|
+
fieldType: "any"
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
]
|
|
649
|
+
};
|
|
650
|
+
|
|
495
651
|
// src/nodes/processors/concat.ts
|
|
496
652
|
var import_zod4 = require("zod");
|
|
497
653
|
var ConcatNodeFunction = (params) => {
|
|
@@ -1821,6 +1977,8 @@ var nodes = [
|
|
|
1821
1977
|
ChatInputNode,
|
|
1822
1978
|
ManualTriggerNode,
|
|
1823
1979
|
CronTriggerNode,
|
|
1980
|
+
DelayNode,
|
|
1981
|
+
HttpRequestNode,
|
|
1824
1982
|
HttpGetInputNode,
|
|
1825
1983
|
// HttpPostInputNode,
|
|
1826
1984
|
// TransformNode,
|
|
@@ -1942,6 +2100,7 @@ var nodeFunctions = {
|
|
|
1942
2100
|
CronTrigger: CronTriggerNodeFunction,
|
|
1943
2101
|
HttpOutput: HttpOutputNodeFunction,
|
|
1944
2102
|
ConcatNode: ConcatNodeFunction,
|
|
2103
|
+
HttpRequestNode: HttpRequestNodeFunction,
|
|
1945
2104
|
IaMessageNode: IaMessageNodeFunction,
|
|
1946
2105
|
IaAgentNode: IaAgentNodeFunction,
|
|
1947
2106
|
AiToolNode: AiToolNodeFunction,
|
package/dist/index.js
CHANGED
|
@@ -401,6 +401,163 @@ var CronTriggerNode = {
|
|
|
401
401
|
]
|
|
402
402
|
};
|
|
403
403
|
|
|
404
|
+
// src/nodes/processors/delay/index.ts
|
|
405
|
+
var DelayNode = {
|
|
406
|
+
label: "Delay",
|
|
407
|
+
type: "DelayNode",
|
|
408
|
+
category: "step",
|
|
409
|
+
icon: "\u23F3",
|
|
410
|
+
description: "Pausa o workflow por um tempo determinado",
|
|
411
|
+
tags: {
|
|
412
|
+
execution: "async",
|
|
413
|
+
group: "Control"
|
|
414
|
+
},
|
|
415
|
+
fields: [
|
|
416
|
+
{
|
|
417
|
+
id: "input",
|
|
418
|
+
label: "Trigger",
|
|
419
|
+
type: "any",
|
|
420
|
+
required: false,
|
|
421
|
+
handle: {
|
|
422
|
+
type: "input",
|
|
423
|
+
label: "Start",
|
|
424
|
+
name: "trigger",
|
|
425
|
+
fieldType: "any"
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
id: "duration",
|
|
430
|
+
label: "Dura\xE7\xE3o",
|
|
431
|
+
type: "number",
|
|
432
|
+
required: true,
|
|
433
|
+
defaultValue: 1
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
id: "unit",
|
|
437
|
+
label: "Unidade",
|
|
438
|
+
type: "select",
|
|
439
|
+
defaultValue: "minutes",
|
|
440
|
+
required: true,
|
|
441
|
+
options: [
|
|
442
|
+
{ label: "Segundos", value: "seconds" },
|
|
443
|
+
{ label: "Minutos", value: "minutes" },
|
|
444
|
+
{ label: "Horas", value: "hours" },
|
|
445
|
+
{ label: "Dias", value: "days" }
|
|
446
|
+
]
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
id: "output",
|
|
450
|
+
label: "Continue",
|
|
451
|
+
type: "any",
|
|
452
|
+
required: false,
|
|
453
|
+
handle: {
|
|
454
|
+
type: "output",
|
|
455
|
+
label: "Continue",
|
|
456
|
+
name: "continue",
|
|
457
|
+
fieldType: "any"
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
]
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
// src/nodes/processors/http-request/index.ts
|
|
464
|
+
var HttpRequestNodeFunction = async (params, input, context) => {
|
|
465
|
+
const { url, method, headers, body } = params;
|
|
466
|
+
console.log(`\u{1F4E1} Making HTTP Request: ${method} ${url}`);
|
|
467
|
+
const headersObj = typeof headers === "string" ? JSON.parse(headers || "{}") : headers || {};
|
|
468
|
+
const bodyObj = typeof body === "string" ? body : JSON.stringify(body);
|
|
469
|
+
const response = await fetch(url, {
|
|
470
|
+
method,
|
|
471
|
+
headers: {
|
|
472
|
+
"Content-Type": "application/json",
|
|
473
|
+
...headersObj
|
|
474
|
+
},
|
|
475
|
+
body: method !== "GET" && method !== "HEAD" ? bodyObj : void 0
|
|
476
|
+
});
|
|
477
|
+
const responseText = await response.text();
|
|
478
|
+
let responseData;
|
|
479
|
+
try {
|
|
480
|
+
responseData = JSON.parse(responseText);
|
|
481
|
+
} catch (e) {
|
|
482
|
+
responseData = responseText;
|
|
483
|
+
}
|
|
484
|
+
return {
|
|
485
|
+
status: response.status,
|
|
486
|
+
statusText: response.statusText,
|
|
487
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
488
|
+
data: responseData
|
|
489
|
+
};
|
|
490
|
+
};
|
|
491
|
+
var HttpRequestNode = {
|
|
492
|
+
label: "HTTP Request",
|
|
493
|
+
type: "HttpRequestNode",
|
|
494
|
+
category: "step",
|
|
495
|
+
// or 'api'?
|
|
496
|
+
icon: "\u{1F310}",
|
|
497
|
+
description: "Faz uma requisi\xE7\xE3o HTTP externa",
|
|
498
|
+
tags: {
|
|
499
|
+
execution: "async",
|
|
500
|
+
group: "HTTP"
|
|
501
|
+
},
|
|
502
|
+
fields: [
|
|
503
|
+
{
|
|
504
|
+
id: "input",
|
|
505
|
+
label: "Input",
|
|
506
|
+
type: "any",
|
|
507
|
+
handle: {
|
|
508
|
+
type: "input",
|
|
509
|
+
label: "Start",
|
|
510
|
+
name: "input",
|
|
511
|
+
fieldType: "any"
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
id: "url",
|
|
516
|
+
label: "URL",
|
|
517
|
+
type: "string",
|
|
518
|
+
required: true,
|
|
519
|
+
placeholder: "https://api.example.com"
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
id: "method",
|
|
523
|
+
label: "Method",
|
|
524
|
+
type: "select",
|
|
525
|
+
required: true,
|
|
526
|
+
defaultValue: "GET",
|
|
527
|
+
options: [
|
|
528
|
+
{ label: "GET", value: "GET" },
|
|
529
|
+
{ label: "POST", value: "POST" },
|
|
530
|
+
{ label: "PUT", value: "PUT" },
|
|
531
|
+
{ label: "DELETE", value: "DELETE" },
|
|
532
|
+
{ label: "PATCH", value: "PATCH" }
|
|
533
|
+
]
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
id: "headers",
|
|
537
|
+
label: "Headers (JSON)",
|
|
538
|
+
type: "json",
|
|
539
|
+
defaultValue: "{}"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
id: "body",
|
|
543
|
+
label: "Body (JSON)",
|
|
544
|
+
type: "json",
|
|
545
|
+
defaultValue: "{}"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
id: "output",
|
|
549
|
+
label: "Output",
|
|
550
|
+
type: "any",
|
|
551
|
+
handle: {
|
|
552
|
+
type: "output",
|
|
553
|
+
label: "Response",
|
|
554
|
+
name: "output",
|
|
555
|
+
fieldType: "any"
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
]
|
|
559
|
+
};
|
|
560
|
+
|
|
404
561
|
// src/nodes/processors/concat.ts
|
|
405
562
|
import { z as z4 } from "zod";
|
|
406
563
|
var ConcatNodeFunction = (params) => {
|
|
@@ -1730,6 +1887,8 @@ var nodes = [
|
|
|
1730
1887
|
ChatInputNode,
|
|
1731
1888
|
ManualTriggerNode,
|
|
1732
1889
|
CronTriggerNode,
|
|
1890
|
+
DelayNode,
|
|
1891
|
+
HttpRequestNode,
|
|
1733
1892
|
HttpGetInputNode,
|
|
1734
1893
|
// HttpPostInputNode,
|
|
1735
1894
|
// TransformNode,
|
|
@@ -1851,6 +2010,7 @@ var nodeFunctions = {
|
|
|
1851
2010
|
CronTrigger: CronTriggerNodeFunction,
|
|
1852
2011
|
HttpOutput: HttpOutputNodeFunction,
|
|
1853
2012
|
ConcatNode: ConcatNodeFunction,
|
|
2013
|
+
HttpRequestNode: HttpRequestNodeFunction,
|
|
1854
2014
|
IaMessageNode: IaMessageNodeFunction,
|
|
1855
2015
|
IaAgentNode: IaAgentNodeFunction,
|
|
1856
2016
|
AiToolNode: AiToolNodeFunction,
|