@cobaltio/cobalt-js 0.0.2 → 0.0.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/README.md CHANGED
@@ -1,10 +1,45 @@
1
1
  # cobalt.js
2
2
  Cobalt frontend SDK.
3
3
 
4
- # Install
4
+ ## Install
5
+
6
+ #### npm
5
7
  ```bash
8
+ npm install @cobaltio/cobalt-js
6
9
  ```
7
10
 
8
- # Usage
11
+ #### yarn
9
12
  ```bash
13
+ yarn add @cobaltio/cobalt-js
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ### Include
19
+
20
+ #### Browser
21
+ ```js
22
+ <script src="https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js@0"></script>
23
+ ```
24
+
25
+ #### Node
26
+ ```js
27
+ // CommonJS
28
+ const Cobalt = require("@cobaltio/cobalt-js");
29
+ // ESM
30
+ import Cobalt from "@cobaltio/cobalt-js";
31
+ ```
32
+
33
+ ### Initialize
34
+ ```js
35
+ // initialize with token
36
+ const cobalt = new Cobalt({
37
+ // the token you generate for linked accounts using the cobalt backend SDK
38
+ token: "COBALT_SESSION_TOKEN",
39
+ });
40
+
41
+ // initialize without token
42
+ const cobalt = new Cobalt();
43
+ // the token you generate for linked accounts using the cobalt backend SDK
44
+ cobalt.token = "COBALT_SESSION_TOKEN";
10
45
  ```
package/cobalt.js CHANGED
@@ -5,25 +5,26 @@ class Cobalt {
5
5
  /**
6
6
  * Cobalt Frontend SDK
7
7
  * @param {object} options The options to configure the Cobalt SDK.
8
+ * @param {string} [options.token] The session token.
8
9
  * @param {string} [options.baseUrl=https://api.gocobalt.io] The base URL of your Cobalt API.
9
10
  */
10
11
  constructor(options) {
11
12
  this.apiBaseUrl = options?.baseUrl || "https://api.gocobalt.io";
12
- this.template = {};
13
+ this.token = options?.token;
13
14
  }
14
15
 
15
16
  /**
16
- * @returns {string} The token to install a template.
17
+ * @returns {string} The session token.
17
18
  */
18
19
  get token() {
19
- return this.templateToken;
20
+ return this.sessionToken;
20
21
  };
21
22
 
22
23
  /**
23
- * @returns {string} The token to install a template.
24
+ * @returns {string} The session token.
24
25
  */
25
26
  set token(token) {
26
- return this.templateToken = typeof token === "string" ? token : "";
27
+ return this.sessionToken = typeof token === "string" ? token : "";
27
28
  };
28
29
 
29
30
  /**
@@ -55,27 +56,66 @@ class Cobalt {
55
56
  * @property {Node[]} configure The configuration data for the workflow.
56
57
  */
57
58
 
59
+ /**
60
+ * @typedef {object} AppAuthStatus The auth status of the user for an application.
61
+ * @property {boolean} status Whether the user has authenticated with this application.
62
+ */
63
+
58
64
  /**
59
65
  * Install the given template.
66
+ * @property {string} templateId The ID of the template you want to install.
60
67
  * @returns {Promise<Workflow>}
61
68
  */
62
- async installTemplate() {
63
- const res = await fetch(`${this.baseUrl}/api/v1/template/install`, {
69
+ async installTemplate(templateId) {
70
+ const res = await fetch(`${this.baseUrl}/api/v1/template/install/${templateId}`, {
64
71
  method: "POST",
65
72
  headers: {
66
73
  authorization: `Bearer ${this.token}`,
67
74
  },
68
75
  });
69
- this.template = await res.json();
70
- return this.template;
76
+ return await res.json();
71
77
  }
72
78
 
73
79
  /**
74
- * Install the given template.
80
+ * Returns the auth status of the user for the specified application.
81
+ * @property {string} application The application type.
82
+ * @returns {Promise<boolean>} The auth status of the user.
83
+ */
84
+ async getAppAuthStatus(application) {
85
+ const res = await fetch(`${this.baseUrl}/api/v1/linked-acc/integration/auth?integration_type=${application}`, {
86
+ headers: {
87
+ authorization: `Bearer ${this.token}`,
88
+ },
89
+ });
90
+ const data = await res.json();
91
+ return !!data?.status;
92
+ }
93
+
94
+ /**
95
+ * Returns the auth URL that users can use to authenticate themselves to the
96
+ * specified application.
97
+ * @property {string} application The application type.
98
+ * @returns {Promise<string>} The auth URL where users can authenticate themselves.
99
+ */
100
+ async getAppAuthUrl(application) {
101
+ const res = await fetch(`${this.baseUrl}/api/v1/google/integrate?type=${application}`, {
102
+ headers: {
103
+ authorization: `Bearer ${this.token}`,
104
+ },
105
+ });
106
+ const data = await res.json();
107
+ return data?.auth_url;
108
+ }
109
+
110
+ /**
111
+ * Save the input data for the specified node.
112
+ * @property {string} workflowId The ID of the workflow.
113
+ * @property {string} nodeId The ID of the node.
114
+ * @property {object} inputData The input data for the node.
75
115
  * @returns {Promise<Workflow>}
76
116
  */
77
- async saveNode(nodeId, inputData = {}) {
78
- const res = await fetch(`${this.baseUrl}/api/v2/workflow/${this.template?.workflow_id}/node/${nodeId}`, {
117
+ async saveNode(workflowId, nodeId, inputData = {}) {
118
+ const res = await fetch(`${this.baseUrl}/api/v2/workflow/${workflowId}/node/${nodeId}`, {
79
119
  method: "PUT",
80
120
  headers: {
81
121
  authorization: `Bearer ${this.token}`,
package/cobalt.min.js CHANGED
@@ -1 +1 @@
1
- class Cobalt{constructor(options){this.apiBaseUrl=options?.baseUrl||"https://api.gocobalt.io";this.template={}}get token(){return this.templateToken}set token(token){return this.templateToken=typeof token==="string"?token:""}get baseUrl(){return this.apiBaseUrl}async installTemplate(){const res=await fetch(`${this.baseUrl}/api/v1/template/install`,{method:"POST",headers:{authorization:`Bearer ${this.token}`}});this.template=await res.json();return this.template}async saveNode(nodeId,inputData={}){const res=await fetch(`${this.baseUrl}/api/v2/workflow/${this.template?.workflow_id}/node/${nodeId}`,{method:"PUT",headers:{authorization:`Bearer ${this.token}`},body:JSON.stringify({input_data:inputData})});return await res.json()}}module.exports=Cobalt;
1
+ class Cobalt{constructor(options){this.apiBaseUrl=options?.baseUrl||"https://api.gocobalt.io";this.token=options?.token}get token(){return this.sessionToken}set token(token){return this.sessionToken=typeof token==="string"?token:""}get baseUrl(){return this.apiBaseUrl}async installTemplate(templateId){const res=await fetch(`${this.baseUrl}/api/v1/template/install/${templateId}`,{method:"POST",headers:{authorization:`Bearer ${this.token}`}});return await res.json()}async getAppAuthStatus(application){const res=await fetch(`${this.baseUrl}/api/v1/linked-acc/integration/auth?integration_type=${application}`,{headers:{authorization:`Bearer ${this.token}`}});const data=await res.json();return!!data?.status}async getAppAuthUrl(application){const res=await fetch(`${this.baseUrl}/api/v1/google/integrate?type=${application}`,{headers:{authorization:`Bearer ${this.token}`}});const data=await res.json();return data?.auth_url}async saveNode(workflowId,nodeId,inputData={}){const res=await fetch(`${this.baseUrl}/api/v2/workflow/${workflowId}/node/${nodeId}`,{method:"PUT",headers:{authorization:`Bearer ${this.token}`},body:JSON.stringify({input_data:inputData})});return await res.json()}}module.exports=Cobalt;
package/docs/Cobalt.html CHANGED
@@ -133,6 +133,43 @@
133
133
  <tbody>
134
134
 
135
135
 
136
+ <tr>
137
+
138
+ <td class="name"><code>token</code></td>
139
+
140
+
141
+ <td class="type">
142
+
143
+
144
+ <span class="param-type">string</span>
145
+
146
+
147
+
148
+ </td>
149
+
150
+
151
+ <td class="attributes">
152
+
153
+ &lt;optional><br>
154
+
155
+
156
+
157
+
158
+
159
+ </td>
160
+
161
+
162
+
163
+ <td class="default">
164
+
165
+ </td>
166
+
167
+
168
+ <td class="description last">The session token.</td>
169
+ </tr>
170
+
171
+
172
+
136
173
  <tr>
137
174
 
138
175
  <td class="name"><code>baseUrl</code></td>
@@ -305,7 +342,7 @@
305
342
 
306
343
  <dt class="tag-source">Source:</dt>
307
344
  <dd class="tag-source"><ul class="dummy"><li>
308
- <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line32">line 32</a>
345
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line33">line 33</a>
309
346
  </li></ul></dd>
310
347
 
311
348
 
@@ -363,7 +400,7 @@
363
400
 
364
401
  <dt class="tag-source">Source:</dt>
365
402
  <dd class="tag-source"><ul class="dummy"><li>
366
- <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line18">line 18</a>
403
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line19">line 19</a>
367
404
  </li></ul></dd>
368
405
 
369
406
 
@@ -421,7 +458,7 @@
421
458
 
422
459
  <dt class="tag-source">Source:</dt>
423
460
  <dd class="tag-source"><ul class="dummy"><li>
424
- <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line25">line 25</a>
461
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line26">line 26</a>
425
462
  </li></ul></dd>
426
463
 
427
464
 
@@ -449,6 +486,331 @@
449
486
 
450
487
 
451
488
 
489
+ <h4 class="name" id="getAppAuthStatus"><span class="type-signature">(async) </span>getAppAuthStatus<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;boolean>}</span></h4>
490
+
491
+
492
+
493
+
494
+
495
+
496
+ <div class="description">
497
+ Returns the auth status of the user for the specified application.
498
+ </div>
499
+
500
+
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+
512
+ <h5 class="subsection-title">Properties:</h5>
513
+
514
+
515
+
516
+ <table class="props">
517
+ <thead>
518
+ <tr>
519
+
520
+ <th>Name</th>
521
+
522
+
523
+ <th>Type</th>
524
+
525
+
526
+
527
+
528
+
529
+ <th class="last">Description</th>
530
+ </tr>
531
+ </thead>
532
+
533
+ <tbody>
534
+
535
+
536
+ <tr>
537
+
538
+ <td class="name"><code>application</code></td>
539
+
540
+
541
+ <td class="type">
542
+
543
+
544
+ <span class="param-type">string</span>
545
+
546
+
547
+
548
+ </td>
549
+
550
+
551
+
552
+
553
+
554
+ <td class="description last">The application type.</td>
555
+ </tr>
556
+
557
+
558
+ </tbody>
559
+ </table>
560
+
561
+
562
+
563
+
564
+ <dl class="details">
565
+
566
+
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+
582
+
583
+
584
+
585
+
586
+
587
+
588
+
589
+
590
+
591
+ <dt class="tag-source">Source:</dt>
592
+ <dd class="tag-source"><ul class="dummy"><li>
593
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line84">line 84</a>
594
+ </li></ul></dd>
595
+
596
+
597
+
598
+
599
+
600
+
601
+
602
+ </dl>
603
+
604
+
605
+
606
+
607
+
608
+
609
+
610
+
611
+
612
+
613
+
614
+
615
+
616
+
617
+
618
+ <h5>Returns:</h5>
619
+
620
+
621
+ <div class="param-desc">
622
+ The auth status of the user.
623
+ </div>
624
+
625
+
626
+
627
+ <dl>
628
+ <dt>
629
+ Type
630
+ </dt>
631
+ <dd>
632
+
633
+ <span class="param-type">Promise.&lt;boolean></span>
634
+
635
+
636
+ </dd>
637
+ </dl>
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+
646
+
647
+
648
+
649
+
650
+
651
+ <h4 class="name" id="getAppAuthUrl"><span class="type-signature">(async) </span>getAppAuthUrl<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;string>}</span></h4>
652
+
653
+
654
+
655
+
656
+
657
+
658
+ <div class="description">
659
+ Returns the auth URL that users can use to authenticate themselves to the
660
+ specified application.
661
+ </div>
662
+
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
671
+
672
+
673
+
674
+
675
+ <h5 class="subsection-title">Properties:</h5>
676
+
677
+
678
+
679
+ <table class="props">
680
+ <thead>
681
+ <tr>
682
+
683
+ <th>Name</th>
684
+
685
+
686
+ <th>Type</th>
687
+
688
+
689
+
690
+
691
+
692
+ <th class="last">Description</th>
693
+ </tr>
694
+ </thead>
695
+
696
+ <tbody>
697
+
698
+
699
+ <tr>
700
+
701
+ <td class="name"><code>application</code></td>
702
+
703
+
704
+ <td class="type">
705
+
706
+
707
+ <span class="param-type">string</span>
708
+
709
+
710
+
711
+ </td>
712
+
713
+
714
+
715
+
716
+
717
+ <td class="description last">The application type.</td>
718
+ </tr>
719
+
720
+
721
+ </tbody>
722
+ </table>
723
+
724
+
725
+
726
+
727
+ <dl class="details">
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+ <dt class="tag-source">Source:</dt>
755
+ <dd class="tag-source"><ul class="dummy"><li>
756
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line100">line 100</a>
757
+ </li></ul></dd>
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+ </dl>
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+ <h5>Returns:</h5>
782
+
783
+
784
+ <div class="param-desc">
785
+ The auth URL where users can authenticate themselves.
786
+ </div>
787
+
788
+
789
+
790
+ <dl>
791
+ <dt>
792
+ Type
793
+ </dt>
794
+ <dd>
795
+
796
+ <span class="param-type">Promise.&lt;string></span>
797
+
798
+
799
+ </dd>
800
+ </dl>
801
+
802
+
803
+
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+
812
+
813
+
452
814
  <h4 class="name" id="installTemplate"><span class="type-signature">(async) </span>installTemplate<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="global.html#Workflow">Workflow</a>>}</span></h4>
453
815
 
454
816
 
@@ -472,6 +834,58 @@
472
834
 
473
835
 
474
836
 
837
+ <h5 class="subsection-title">Properties:</h5>
838
+
839
+
840
+
841
+ <table class="props">
842
+ <thead>
843
+ <tr>
844
+
845
+ <th>Name</th>
846
+
847
+
848
+ <th>Type</th>
849
+
850
+
851
+
852
+
853
+
854
+ <th class="last">Description</th>
855
+ </tr>
856
+ </thead>
857
+
858
+ <tbody>
859
+
860
+
861
+ <tr>
862
+
863
+ <td class="name"><code>templateId</code></td>
864
+
865
+
866
+ <td class="type">
867
+
868
+
869
+ <span class="param-type">string</span>
870
+
871
+
872
+
873
+ </td>
874
+
875
+
876
+
877
+
878
+
879
+ <td class="description last">The ID of the template you want to install.</td>
880
+ </tr>
881
+
882
+
883
+ </tbody>
884
+ </table>
885
+
886
+
887
+
888
+
475
889
  <dl class="details">
476
890
 
477
891
 
@@ -501,7 +915,7 @@
501
915
 
502
916
  <dt class="tag-source">Source:</dt>
503
917
  <dd class="tag-source"><ul class="dummy"><li>
504
- <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line62">line 62</a>
918
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line69">line 69</a>
505
919
  </li></ul></dd>
506
920
 
507
921
 
@@ -563,7 +977,7 @@
563
977
 
564
978
 
565
979
  <div class="description">
566
- Install the given template.
980
+ Save the input data for the specified node.
567
981
  </div>
568
982
 
569
983
 
@@ -578,6 +992,104 @@
578
992
 
579
993
 
580
994
 
995
+ <h5 class="subsection-title">Properties:</h5>
996
+
997
+
998
+
999
+ <table class="props">
1000
+ <thead>
1001
+ <tr>
1002
+
1003
+ <th>Name</th>
1004
+
1005
+
1006
+ <th>Type</th>
1007
+
1008
+
1009
+
1010
+
1011
+
1012
+ <th class="last">Description</th>
1013
+ </tr>
1014
+ </thead>
1015
+
1016
+ <tbody>
1017
+
1018
+
1019
+ <tr>
1020
+
1021
+ <td class="name"><code>workflowId</code></td>
1022
+
1023
+
1024
+ <td class="type">
1025
+
1026
+
1027
+ <span class="param-type">string</span>
1028
+
1029
+
1030
+
1031
+ </td>
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+ <td class="description last">The ID of the workflow.</td>
1038
+ </tr>
1039
+
1040
+
1041
+
1042
+ <tr>
1043
+
1044
+ <td class="name"><code>nodeId</code></td>
1045
+
1046
+
1047
+ <td class="type">
1048
+
1049
+
1050
+ <span class="param-type">string</span>
1051
+
1052
+
1053
+
1054
+ </td>
1055
+
1056
+
1057
+
1058
+
1059
+
1060
+ <td class="description last">The ID of the node.</td>
1061
+ </tr>
1062
+
1063
+
1064
+
1065
+ <tr>
1066
+
1067
+ <td class="name"><code>inputData</code></td>
1068
+
1069
+
1070
+ <td class="type">
1071
+
1072
+
1073
+ <span class="param-type">object</span>
1074
+
1075
+
1076
+
1077
+ </td>
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+ <td class="description last">The input data for the node.</td>
1084
+ </tr>
1085
+
1086
+
1087
+ </tbody>
1088
+ </table>
1089
+
1090
+
1091
+
1092
+
581
1093
  <dl class="details">
582
1094
 
583
1095
 
@@ -607,7 +1119,7 @@
607
1119
 
608
1120
  <dt class="tag-source">Source:</dt>
609
1121
  <dd class="tag-source"><ul class="dummy"><li>
610
- <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line77">line 77</a>
1122
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line117">line 117</a>
611
1123
  </li></ul></dd>
612
1124
 
613
1125
 
@@ -677,7 +1189,7 @@
677
1189
  <br class="clear">
678
1190
 
679
1191
  <footer>
680
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Sep 05 2022 15:43:26 GMT+0530 (India Standard Time)
1192
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Fri Sep 09 2022 11:59:06 GMT+0530 (India Standard Time)
681
1193
  </footer>
682
1194
 
683
1195
  <script> prettyPrint(); </script>
@@ -33,25 +33,26 @@ class Cobalt {
33
33
  /**
34
34
  * Cobalt Frontend SDK
35
35
  * @param {object} options The options to configure the Cobalt SDK.
36
+ * @param {string} [options.token] The session token.
36
37
  * @param {string} [options.baseUrl=https://api.gocobalt.io] The base URL of your Cobalt API.
37
38
  */
38
39
  constructor(options) {
39
40
  this.apiBaseUrl = options?.baseUrl || "https://api.gocobalt.io";
40
- this.template = {};
41
+ this.token = options?.token;
41
42
  }
42
43
 
43
44
  /**
44
- * @returns {string} The token to install a template.
45
+ * @returns {string} The session token.
45
46
  */
46
47
  get token() {
47
- return this.templateToken;
48
+ return this.sessionToken;
48
49
  };
49
50
 
50
51
  /**
51
- * @returns {string} The token to install a template.
52
+ * @returns {string} The session token.
52
53
  */
53
54
  set token(token) {
54
- return this.templateToken = typeof token === "string" ? token : "";
55
+ return this.sessionToken = typeof token === "string" ? token : "";
55
56
  };
56
57
 
57
58
  /**
@@ -83,27 +84,66 @@ class Cobalt {
83
84
  * @property {Node[]} configure The configuration data for the workflow.
84
85
  */
85
86
 
87
+ /**
88
+ * @typedef {object} AppAuthStatus The auth status of the user for an application.
89
+ * @property {boolean} status Whether the user has authenticated with this application.
90
+ */
91
+
86
92
  /**
87
93
  * Install the given template.
94
+ * @property {string} templateId The ID of the template you want to install.
88
95
  * @returns {Promise&lt;Workflow>}
89
96
  */
90
- async installTemplate() {
91
- const res = await fetch(`${this.baseUrl}/api/v1/template/install`, {
97
+ async installTemplate(templateId) {
98
+ const res = await fetch(`${this.baseUrl}/api/v1/template/install/${templateId}`, {
92
99
  method: "POST",
93
100
  headers: {
94
101
  authorization: `Bearer ${this.token}`,
95
102
  },
96
103
  });
97
- this.template = await res.json();
98
- return this.template;
104
+ return await res.json();
99
105
  }
100
106
 
101
107
  /**
102
- * Install the given template.
108
+ * Returns the auth status of the user for the specified application.
109
+ * @property {string} application The application type.
110
+ * @returns {Promise&lt;boolean>} The auth status of the user.
111
+ */
112
+ async getAppAuthStatus(application) {
113
+ const res = await fetch(`${this.baseUrl}/api/v1/linked-acc/integration/auth?integration_type=${application}`, {
114
+ headers: {
115
+ authorization: `Bearer ${this.token}`,
116
+ },
117
+ });
118
+ const data = await res.json();
119
+ return !!data?.status;
120
+ }
121
+
122
+ /**
123
+ * Returns the auth URL that users can use to authenticate themselves to the
124
+ * specified application.
125
+ * @property {string} application The application type.
126
+ * @returns {Promise&lt;string>} The auth URL where users can authenticate themselves.
127
+ */
128
+ async getAppAuthUrl(application) {
129
+ const res = await fetch(`${this.baseUrl}/api/v1/google/integrate?type=${application}`, {
130
+ headers: {
131
+ authorization: `Bearer ${this.token}`,
132
+ },
133
+ });
134
+ const data = await res.json();
135
+ return data?.auth_url;
136
+ }
137
+
138
+ /**
139
+ * Save the input data for the specified node.
140
+ * @property {string} workflowId The ID of the workflow.
141
+ * @property {string} nodeId The ID of the node.
142
+ * @property {object} inputData The input data for the node.
103
143
  * @returns {Promise&lt;Workflow>}
104
144
  */
105
- async saveNode(nodeId, inputData = {}) {
106
- const res = await fetch(`${this.baseUrl}/api/v2/workflow/${this.template?.workflow_id}/node/${nodeId}`, {
145
+ async saveNode(workflowId, nodeId, inputData = {}) {
146
+ const res = await fetch(`${this.baseUrl}/api/v2/workflow/${workflowId}/node/${nodeId}`, {
107
147
  method: "PUT",
108
148
  headers: {
109
149
  authorization: `Bearer ${this.token}`,
@@ -116,7 +156,7 @@ class Cobalt {
116
156
  }
117
157
  }
118
158
 
119
- export default Cobalt;
159
+ module.exports = Cobalt;
120
160
  </code></pre>
121
161
  </article>
122
162
  </section>
@@ -133,7 +173,7 @@ export default Cobalt;
133
173
  <br class="clear">
134
174
 
135
175
  <footer>
136
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Sep 05 2022 15:43:26 GMT+0530 (India Standard Time)
176
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Fri Sep 09 2022 11:59:06 GMT+0530 (India Standard Time)
137
177
  </footer>
138
178
 
139
179
  <script> prettyPrint(); </script>
package/docs/global.html CHANGED
@@ -102,6 +102,130 @@
102
102
 
103
103
 
104
104
 
105
+ <h4 class="name" id="AppAuthStatus">AppAuthStatus</h4>
106
+
107
+
108
+
109
+
110
+ <div class="description">
111
+ The auth status of the user for an application.
112
+ </div>
113
+
114
+
115
+
116
+ <h5>Type:</h5>
117
+ <ul>
118
+ <li>
119
+
120
+ <span class="param-type">object</span>
121
+
122
+
123
+ </li>
124
+ </ul>
125
+
126
+
127
+
128
+
129
+
130
+ <h5 class="subsection-title">Properties:</h5>
131
+
132
+
133
+
134
+ <table class="props">
135
+ <thead>
136
+ <tr>
137
+
138
+ <th>Name</th>
139
+
140
+
141
+ <th>Type</th>
142
+
143
+
144
+
145
+
146
+
147
+ <th class="last">Description</th>
148
+ </tr>
149
+ </thead>
150
+
151
+ <tbody>
152
+
153
+
154
+ <tr>
155
+
156
+ <td class="name"><code>status</code></td>
157
+
158
+
159
+ <td class="type">
160
+
161
+
162
+ <span class="param-type">boolean</span>
163
+
164
+
165
+
166
+ </td>
167
+
168
+
169
+
170
+
171
+
172
+ <td class="description last">Whether the user has authenticated with this application.</td>
173
+ </tr>
174
+
175
+
176
+ </tbody>
177
+ </table>
178
+
179
+
180
+
181
+
182
+ <dl class="details">
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ <dt class="tag-source">Source:</dt>
210
+ <dd class="tag-source"><ul class="dummy"><li>
211
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line59">line 59</a>
212
+ </li></ul></dd>
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+ </dl>
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
105
229
  <h4 class="name" id="Field">Field</h4>
106
230
 
107
231
 
@@ -277,7 +401,7 @@
277
401
 
278
402
  <dt class="tag-source">Source:</dt>
279
403
  <dd class="tag-source"><ul class="dummy"><li>
280
- <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line36">line 36</a>
404
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line37">line 37</a>
281
405
  </li></ul></dd>
282
406
 
283
407
 
@@ -447,7 +571,7 @@
447
571
 
448
572
  <dt class="tag-source">Source:</dt>
449
573
  <dd class="tag-source"><ul class="dummy"><li>
450
- <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line44">line 44</a>
574
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line45">line 45</a>
451
575
  </li></ul></dd>
452
576
 
453
577
 
@@ -617,7 +741,7 @@
617
741
 
618
742
  <dt class="tag-source">Source:</dt>
619
743
  <dd class="tag-source"><ul class="dummy"><li>
620
- <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line51">line 51</a>
744
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line52">line 52</a>
621
745
  </li></ul></dd>
622
746
 
623
747
 
@@ -653,7 +777,7 @@
653
777
  <br class="clear">
654
778
 
655
779
  <footer>
656
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Sep 05 2022 15:43:26 GMT+0530 (India Standard Time)
780
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Fri Sep 09 2022 11:59:06 GMT+0530 (India Standard Time)
657
781
  </footer>
658
782
 
659
783
  <script> prettyPrint(); </script>
package/docs/index.html CHANGED
@@ -45,10 +45,36 @@
45
45
  <section>
46
46
  <article><h1>cobalt.js</h1>
47
47
  <p>Cobalt frontend SDK.</p>
48
- <h1>Install</h1>
49
- <pre class="prettyprint source lang-bash"><code></code></pre>
50
- <h1>Usage</h1>
51
- <pre class="prettyprint source lang-bash"><code></code></pre></article>
48
+ <h2>Install</h2>
49
+ <h4>npm</h4>
50
+ <pre class="prettyprint source lang-bash"><code>npm install @cobaltio/cobalt-js
51
+ </code></pre>
52
+ <h4>yarn</h4>
53
+ <pre class="prettyprint source lang-bash"><code>yarn add @cobaltio/cobalt-js
54
+ </code></pre>
55
+ <h2>Usage</h2>
56
+ <h3>Include</h3>
57
+ <h4>Browser</h4>
58
+ <pre class="prettyprint source lang-js"><code>&lt;script src=&quot;https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js@0&quot;>&lt;/script>
59
+ </code></pre>
60
+ <h4>Node</h4>
61
+ <pre class="prettyprint source lang-js"><code>// CommonJS
62
+ const Cobalt = require(&quot;@cobaltio/cobalt-js&quot;);
63
+ // ESM
64
+ import Cobalt from &quot;@cobaltio/cobalt-js&quot;;
65
+ </code></pre>
66
+ <h3>Initialize</h3>
67
+ <pre class="prettyprint source lang-js"><code>// initialize with token
68
+ const cobalt = new Cobalt({
69
+ // the token you generate for linked accounts using the cobalt backend SDK
70
+ token: &quot;COBALT_SESSION_TOKEN&quot;,
71
+ });
72
+
73
+ // initialize without token
74
+ const cobalt = new Cobalt();
75
+ // the token you generate for linked accounts using the cobalt backend SDK
76
+ cobalt.token = &quot;COBALT_SESSION_TOKEN&quot;;
77
+ </code></pre></article>
52
78
  </section>
53
79
 
54
80
 
@@ -65,7 +91,7 @@
65
91
  <br class="clear">
66
92
 
67
93
  <footer>
68
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Sep 05 2022 15:43:26 GMT+0530 (India Standard Time)
94
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Fri Sep 09 2022 11:59:06 GMT+0530 (India Standard Time)
69
95
  </footer>
70
96
 
71
97
  <script> prettyPrint(); </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobaltio/cobalt-js",
3
- "version": "0.0.2",
3
+ "version": "0.0.5",
4
4
  "description": "Cobalt frontend SDK",
5
5
  "main": "./cobalt.js",
6
6
  "scripts": {