@cobaltio/cobalt-js 0.0.5 → 0.0.8

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/cobalt.js CHANGED
@@ -119,6 +119,7 @@ class Cobalt {
119
119
  method: "PUT",
120
120
  headers: {
121
121
  authorization: `Bearer ${this.token}`,
122
+ "content-type": "application/json",
122
123
  },
123
124
  body: JSON.stringify({
124
125
  input_data: inputData,
@@ -126,6 +127,36 @@ class Cobalt {
126
127
  });
127
128
  return await res.json();
128
129
  }
130
+
131
+ /**
132
+ * Toggle the status of the specified workflow.
133
+ * @property {string} workflowId The ID of the workflow.
134
+ * @returns {Promise<Workflow>}
135
+ */
136
+ async toggleWorkflowStatus(workflowId) {
137
+ const res = await fetch(`${this.baseUrl}/api/v2/workflow/${workflowId}/toggle-status`, {
138
+ method: "PUT",
139
+ headers: {
140
+ authorization: `Bearer ${this.token}`,
141
+ },
142
+ });
143
+ return await res.json();
144
+ }
145
+
146
+ /**
147
+ * Delete the specified workflow.
148
+ * @property {string} workflowId The ID of the workflow.
149
+ * @returns {Promise<unknown>}
150
+ */
151
+ async deleteWorkflow(workflowId) {
152
+ const res = await fetch(`${this.baseUrl}/api/v1/workflow/${workflowId}`, {
153
+ method: "DELETE",
154
+ headers: {
155
+ authorization: `Bearer ${this.token}`,
156
+ },
157
+ });
158
+ return await res.json();
159
+ }
129
160
  }
130
161
 
131
162
  module.exports = Cobalt;
package/cobalt.min.js CHANGED
@@ -1 +1 @@
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;
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}`,"content-type":"application/json"},body:JSON.stringify({input_data:inputData})});return await res.json()}async toggleWorkflowStatus(workflowId){const res=await fetch(`${this.baseUrl}/api/v2/workflow/${workflowId}/toggle-status`,{method:"PUT",headers:{authorization:`Bearer ${this.token}`}});return await res.json()}async deleteWorkflow(workflowId){const res=await fetch(`${this.baseUrl}/api/v1/workflow/${workflowId}`,{method:"DELETE",headers:{authorization:`Bearer ${this.token}`}});return await res.json()}}module.exports=Cobalt;
package/docs/Cobalt.html CHANGED
@@ -486,6 +486,164 @@
486
486
 
487
487
 
488
488
 
489
+ <h4 class="name" id="deleteWorkflow"><span class="type-signature">(async) </span>deleteWorkflow<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;unknown>}</span></h4>
490
+
491
+
492
+
493
+
494
+
495
+
496
+ <div class="description">
497
+ Delete the specified workflow.
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>workflowId</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 ID of the workflow.</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#line151">line 151</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
+
622
+
623
+ <dl>
624
+ <dt>
625
+ Type
626
+ </dt>
627
+ <dd>
628
+
629
+ <span class="param-type">Promise.&lt;unknown></span>
630
+
631
+
632
+ </dd>
633
+ </dl>
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+
646
+
489
647
  <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
648
 
491
649
 
@@ -1144,6 +1302,164 @@ specified application.
1144
1302
 
1145
1303
 
1146
1304
 
1305
+ <h5>Returns:</h5>
1306
+
1307
+
1308
+
1309
+
1310
+ <dl>
1311
+ <dt>
1312
+ Type
1313
+ </dt>
1314
+ <dd>
1315
+
1316
+ <span class="param-type">Promise.&lt;<a href="global.html#Workflow">Workflow</a>></span>
1317
+
1318
+
1319
+ </dd>
1320
+ </dl>
1321
+
1322
+
1323
+
1324
+
1325
+
1326
+
1327
+
1328
+
1329
+
1330
+
1331
+
1332
+
1333
+
1334
+ <h4 class="name" id="toggleWorkflowStatus"><span class="type-signature">(async) </span>toggleWorkflowStatus<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="global.html#Workflow">Workflow</a>>}</span></h4>
1335
+
1336
+
1337
+
1338
+
1339
+
1340
+
1341
+ <div class="description">
1342
+ Toggle the status of the specified workflow.
1343
+ </div>
1344
+
1345
+
1346
+
1347
+
1348
+
1349
+
1350
+
1351
+
1352
+
1353
+
1354
+
1355
+
1356
+
1357
+ <h5 class="subsection-title">Properties:</h5>
1358
+
1359
+
1360
+
1361
+ <table class="props">
1362
+ <thead>
1363
+ <tr>
1364
+
1365
+ <th>Name</th>
1366
+
1367
+
1368
+ <th>Type</th>
1369
+
1370
+
1371
+
1372
+
1373
+
1374
+ <th class="last">Description</th>
1375
+ </tr>
1376
+ </thead>
1377
+
1378
+ <tbody>
1379
+
1380
+
1381
+ <tr>
1382
+
1383
+ <td class="name"><code>workflowId</code></td>
1384
+
1385
+
1386
+ <td class="type">
1387
+
1388
+
1389
+ <span class="param-type">string</span>
1390
+
1391
+
1392
+
1393
+ </td>
1394
+
1395
+
1396
+
1397
+
1398
+
1399
+ <td class="description last">The ID of the workflow.</td>
1400
+ </tr>
1401
+
1402
+
1403
+ </tbody>
1404
+ </table>
1405
+
1406
+
1407
+
1408
+
1409
+ <dl class="details">
1410
+
1411
+
1412
+
1413
+
1414
+
1415
+
1416
+
1417
+
1418
+
1419
+
1420
+
1421
+
1422
+
1423
+
1424
+
1425
+
1426
+
1427
+
1428
+
1429
+
1430
+
1431
+
1432
+
1433
+
1434
+
1435
+
1436
+ <dt class="tag-source">Source:</dt>
1437
+ <dd class="tag-source"><ul class="dummy"><li>
1438
+ <a href="cobalt.js.html">cobalt.js</a>, <a href="cobalt.js.html#line136">line 136</a>
1439
+ </li></ul></dd>
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+ </dl>
1448
+
1449
+
1450
+
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+
1457
+
1458
+
1459
+
1460
+
1461
+
1462
+
1147
1463
  <h5>Returns:</h5>
1148
1464
 
1149
1465
 
@@ -1189,7 +1505,7 @@ specified application.
1189
1505
  <br class="clear">
1190
1506
 
1191
1507
  <footer>
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)
1508
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Tue Sep 13 2022 12:02:13 GMT+0530 (India Standard Time)
1193
1509
  </footer>
1194
1510
 
1195
1511
  <script> prettyPrint(); </script>
@@ -147,6 +147,7 @@ class Cobalt {
147
147
  method: "PUT",
148
148
  headers: {
149
149
  authorization: `Bearer ${this.token}`,
150
+ "content-type": "application/json",
150
151
  },
151
152
  body: JSON.stringify({
152
153
  input_data: inputData,
@@ -154,6 +155,36 @@ class Cobalt {
154
155
  });
155
156
  return await res.json();
156
157
  }
158
+
159
+ /**
160
+ * Toggle the status of the specified workflow.
161
+ * @property {string} workflowId The ID of the workflow.
162
+ * @returns {Promise&lt;Workflow>}
163
+ */
164
+ async toggleWorkflowStatus(workflowId) {
165
+ const res = await fetch(`${this.baseUrl}/api/v2/workflow/${workflowId}/toggle-status`, {
166
+ method: "PUT",
167
+ headers: {
168
+ authorization: `Bearer ${this.token}`,
169
+ },
170
+ });
171
+ return await res.json();
172
+ }
173
+
174
+ /**
175
+ * Delete the specified workflow.
176
+ * @property {string} workflowId The ID of the workflow.
177
+ * @returns {Promise&lt;unknown>}
178
+ */
179
+ async deleteWorkflow(workflowId) {
180
+ const res = await fetch(`${this.baseUrl}/api/v1/workflow/${workflowId}`, {
181
+ method: "DELETE",
182
+ headers: {
183
+ authorization: `Bearer ${this.token}`,
184
+ },
185
+ });
186
+ return await res.json();
187
+ }
157
188
  }
158
189
 
159
190
  module.exports = Cobalt;
@@ -173,7 +204,7 @@ module.exports = Cobalt;
173
204
  <br class="clear">
174
205
 
175
206
  <footer>
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)
207
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Tue Sep 13 2022 12:02:13 GMT+0530 (India Standard Time)
177
208
  </footer>
178
209
 
179
210
  <script> prettyPrint(); </script>
package/docs/global.html CHANGED
@@ -777,7 +777,7 @@
777
777
  <br class="clear">
778
778
 
779
779
  <footer>
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)
780
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Tue Sep 13 2022 12:02:13 GMT+0530 (India Standard Time)
781
781
  </footer>
782
782
 
783
783
  <script> prettyPrint(); </script>
package/docs/index.html CHANGED
@@ -91,7 +91,7 @@ cobalt.token = &quot;COBALT_SESSION_TOKEN&quot;;
91
91
  <br class="clear">
92
92
 
93
93
  <footer>
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)
94
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Tue Sep 13 2022 12:02:13 GMT+0530 (India Standard Time)
95
95
  </footer>
96
96
 
97
97
  <script> prettyPrint(); </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobaltio/cobalt-js",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "description": "Cobalt frontend SDK",
5
5
  "main": "./cobalt.js",
6
6
  "scripts": {