@atomoz/workflows-nodes 0.1.18 → 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 CHANGED
@@ -550,6 +550,104 @@ var DelayNode = {
550
550
  ]
551
551
  };
552
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
+
553
651
  // src/nodes/processors/concat.ts
554
652
  var import_zod4 = require("zod");
555
653
  var ConcatNodeFunction = (params) => {
@@ -1880,6 +1978,7 @@ var nodes = [
1880
1978
  ManualTriggerNode,
1881
1979
  CronTriggerNode,
1882
1980
  DelayNode,
1981
+ HttpRequestNode,
1883
1982
  HttpGetInputNode,
1884
1983
  // HttpPostInputNode,
1885
1984
  // TransformNode,
@@ -2001,6 +2100,7 @@ var nodeFunctions = {
2001
2100
  CronTrigger: CronTriggerNodeFunction,
2002
2101
  HttpOutput: HttpOutputNodeFunction,
2003
2102
  ConcatNode: ConcatNodeFunction,
2103
+ HttpRequestNode: HttpRequestNodeFunction,
2004
2104
  IaMessageNode: IaMessageNodeFunction,
2005
2105
  IaAgentNode: IaAgentNodeFunction,
2006
2106
  AiToolNode: AiToolNodeFunction,
package/dist/index.js CHANGED
@@ -460,6 +460,104 @@ var DelayNode = {
460
460
  ]
461
461
  };
462
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
+
463
561
  // src/nodes/processors/concat.ts
464
562
  import { z as z4 } from "zod";
465
563
  var ConcatNodeFunction = (params) => {
@@ -1790,6 +1888,7 @@ var nodes = [
1790
1888
  ManualTriggerNode,
1791
1889
  CronTriggerNode,
1792
1890
  DelayNode,
1891
+ HttpRequestNode,
1793
1892
  HttpGetInputNode,
1794
1893
  // HttpPostInputNode,
1795
1894
  // TransformNode,
@@ -1911,6 +2010,7 @@ var nodeFunctions = {
1911
2010
  CronTrigger: CronTriggerNodeFunction,
1912
2011
  HttpOutput: HttpOutputNodeFunction,
1913
2012
  ConcatNode: ConcatNodeFunction,
2013
+ HttpRequestNode: HttpRequestNodeFunction,
1914
2014
  IaMessageNode: IaMessageNodeFunction,
1915
2015
  IaAgentNode: IaAgentNodeFunction,
1916
2016
  AiToolNode: AiToolNodeFunction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomoz/workflows-nodes",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Atomoz Workflows - Node Library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",