@cobaltio/cobalt-js 8.4.0 → 8.4.1
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 +30 -15
- package/cobalt.ts +30 -15
- package/package.json +1 -1
package/cobalt.js
CHANGED
|
@@ -37,7 +37,8 @@ class Cobalt {
|
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
39
|
if (res.status >= 400 && res.status < 600) {
|
|
40
|
-
|
|
40
|
+
const error = yield res.json();
|
|
41
|
+
throw error;
|
|
41
42
|
}
|
|
42
43
|
const data = yield res.json();
|
|
43
44
|
return data;
|
|
@@ -59,7 +60,8 @@ class Cobalt {
|
|
|
59
60
|
body: JSON.stringify(Object.assign({}, payload)),
|
|
60
61
|
});
|
|
61
62
|
if (res.status >= 400 && res.status < 600) {
|
|
62
|
-
|
|
63
|
+
const error = yield res.json();
|
|
64
|
+
throw error;
|
|
63
65
|
}
|
|
64
66
|
const data = yield res.json();
|
|
65
67
|
return data;
|
|
@@ -80,7 +82,8 @@ class Cobalt {
|
|
|
80
82
|
},
|
|
81
83
|
});
|
|
82
84
|
if (res.status >= 400 && res.status < 600) {
|
|
83
|
-
|
|
85
|
+
const error = yield res.json();
|
|
86
|
+
throw error;
|
|
84
87
|
}
|
|
85
88
|
const data = yield res.json();
|
|
86
89
|
return data;
|
|
@@ -98,7 +101,8 @@ class Cobalt {
|
|
|
98
101
|
},
|
|
99
102
|
});
|
|
100
103
|
if (res.status >= 400 && res.status < 600) {
|
|
101
|
-
|
|
104
|
+
const error = yield res.json();
|
|
105
|
+
throw error;
|
|
102
106
|
}
|
|
103
107
|
const data = yield res.json();
|
|
104
108
|
return data;
|
|
@@ -120,7 +124,8 @@ class Cobalt {
|
|
|
120
124
|
},
|
|
121
125
|
});
|
|
122
126
|
if (res.status >= 400 && res.status < 600) {
|
|
123
|
-
|
|
127
|
+
const error = yield res.json();
|
|
128
|
+
throw error;
|
|
124
129
|
}
|
|
125
130
|
const data = yield res.json();
|
|
126
131
|
return data.auth_url;
|
|
@@ -200,7 +205,8 @@ class Cobalt {
|
|
|
200
205
|
body: JSON.stringify(Object.assign({}, payload)),
|
|
201
206
|
});
|
|
202
207
|
if (res.status >= 400 && res.status < 600) {
|
|
203
|
-
|
|
208
|
+
const error = yield res.json();
|
|
209
|
+
reject(error);
|
|
204
210
|
}
|
|
205
211
|
const data = yield res.json();
|
|
206
212
|
resolve(data.success);
|
|
@@ -226,7 +232,8 @@ class Cobalt {
|
|
|
226
232
|
},
|
|
227
233
|
});
|
|
228
234
|
if (res.status >= 400 && res.status < 600) {
|
|
229
|
-
|
|
235
|
+
const error = yield res.json();
|
|
236
|
+
throw error;
|
|
230
237
|
}
|
|
231
238
|
});
|
|
232
239
|
}
|
|
@@ -246,7 +253,8 @@ class Cobalt {
|
|
|
246
253
|
body: JSON.stringify(payload),
|
|
247
254
|
});
|
|
248
255
|
if (res.status >= 400 && res.status < 600) {
|
|
249
|
-
|
|
256
|
+
const error = yield res.json();
|
|
257
|
+
throw error;
|
|
250
258
|
}
|
|
251
259
|
return yield res.json();
|
|
252
260
|
});
|
|
@@ -265,7 +273,8 @@ class Cobalt {
|
|
|
265
273
|
},
|
|
266
274
|
});
|
|
267
275
|
if (res.status >= 400 && res.status < 600) {
|
|
268
|
-
|
|
276
|
+
const error = yield res.json();
|
|
277
|
+
throw error;
|
|
269
278
|
}
|
|
270
279
|
return yield res.json();
|
|
271
280
|
});
|
|
@@ -286,7 +295,8 @@ class Cobalt {
|
|
|
286
295
|
body: JSON.stringify(payload),
|
|
287
296
|
});
|
|
288
297
|
if (res.status >= 400 && res.status < 600) {
|
|
289
|
-
|
|
298
|
+
const error = yield res.json();
|
|
299
|
+
throw error;
|
|
290
300
|
}
|
|
291
301
|
return yield res.json();
|
|
292
302
|
});
|
|
@@ -306,7 +316,8 @@ class Cobalt {
|
|
|
306
316
|
},
|
|
307
317
|
});
|
|
308
318
|
if (res.status >= 400 && res.status < 600) {
|
|
309
|
-
|
|
319
|
+
const error = yield res.json();
|
|
320
|
+
throw error;
|
|
310
321
|
}
|
|
311
322
|
return yield res.json();
|
|
312
323
|
});
|
|
@@ -327,7 +338,8 @@ class Cobalt {
|
|
|
327
338
|
body: JSON.stringify(payload),
|
|
328
339
|
});
|
|
329
340
|
if (res.status >= 400 && res.status < 600) {
|
|
330
|
-
|
|
341
|
+
const error = yield res.json();
|
|
342
|
+
throw error;
|
|
331
343
|
}
|
|
332
344
|
return yield res.json();
|
|
333
345
|
});
|
|
@@ -348,7 +360,8 @@ class Cobalt {
|
|
|
348
360
|
},
|
|
349
361
|
});
|
|
350
362
|
if (res.status >= 400 && res.status < 600) {
|
|
351
|
-
|
|
363
|
+
const error = yield res.json();
|
|
364
|
+
throw error;
|
|
352
365
|
}
|
|
353
366
|
return yield res.json();
|
|
354
367
|
});
|
|
@@ -373,7 +386,8 @@ class Cobalt {
|
|
|
373
386
|
body: JSON.stringify({ value }),
|
|
374
387
|
});
|
|
375
388
|
if (res.status >= 400 && res.status < 600) {
|
|
376
|
-
|
|
389
|
+
const error = yield res.json();
|
|
390
|
+
throw error;
|
|
377
391
|
}
|
|
378
392
|
return yield res.json();
|
|
379
393
|
});
|
|
@@ -395,7 +409,8 @@ class Cobalt {
|
|
|
395
409
|
},
|
|
396
410
|
});
|
|
397
411
|
if (res.status >= 400 && res.status < 600) {
|
|
398
|
-
|
|
412
|
+
const error = yield res.json();
|
|
413
|
+
throw error;
|
|
399
414
|
}
|
|
400
415
|
return yield res.json();
|
|
401
416
|
});
|
package/cobalt.ts
CHANGED
|
@@ -131,7 +131,8 @@ class Cobalt {
|
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
if (res.status >= 400 && res.status < 600) {
|
|
134
|
-
|
|
134
|
+
const error = await res.json();
|
|
135
|
+
throw error;
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
const data = await res.json();
|
|
@@ -156,7 +157,8 @@ class Cobalt {
|
|
|
156
157
|
});
|
|
157
158
|
|
|
158
159
|
if (res.status >= 400 && res.status < 600) {
|
|
159
|
-
|
|
160
|
+
const error = await res.json();
|
|
161
|
+
throw error;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
const data = await res.json();
|
|
@@ -190,7 +192,8 @@ class Cobalt {
|
|
|
190
192
|
});
|
|
191
193
|
|
|
192
194
|
if (res.status >= 400 && res.status < 600) {
|
|
193
|
-
|
|
195
|
+
const error = await res.json();
|
|
196
|
+
throw error;
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
const data = await res.json();
|
|
@@ -209,7 +212,8 @@ class Cobalt {
|
|
|
209
212
|
});
|
|
210
213
|
|
|
211
214
|
if (res.status >= 400 && res.status < 600) {
|
|
212
|
-
|
|
215
|
+
const error = await res.json();
|
|
216
|
+
throw error;
|
|
213
217
|
}
|
|
214
218
|
|
|
215
219
|
const data = await res.json();
|
|
@@ -232,7 +236,8 @@ class Cobalt {
|
|
|
232
236
|
});
|
|
233
237
|
|
|
234
238
|
if (res.status >= 400 && res.status < 600) {
|
|
235
|
-
|
|
239
|
+
const error = await res.json();
|
|
240
|
+
throw error;
|
|
236
241
|
}
|
|
237
242
|
|
|
238
243
|
const data = await res.json();
|
|
@@ -314,7 +319,8 @@ class Cobalt {
|
|
|
314
319
|
});
|
|
315
320
|
|
|
316
321
|
if (res.status >= 400 && res.status < 600) {
|
|
317
|
-
|
|
322
|
+
const error = await res.json();
|
|
323
|
+
reject(error);
|
|
318
324
|
}
|
|
319
325
|
|
|
320
326
|
const data = await res.json();
|
|
@@ -340,7 +346,8 @@ class Cobalt {
|
|
|
340
346
|
});
|
|
341
347
|
|
|
342
348
|
if (res.status >= 400 && res.status < 600) {
|
|
343
|
-
|
|
349
|
+
const error = await res.json();
|
|
350
|
+
throw error;
|
|
344
351
|
}
|
|
345
352
|
}
|
|
346
353
|
|
|
@@ -360,7 +367,8 @@ class Cobalt {
|
|
|
360
367
|
});
|
|
361
368
|
|
|
362
369
|
if (res.status >= 400 && res.status < 600) {
|
|
363
|
-
|
|
370
|
+
const error = await res.json();
|
|
371
|
+
throw error;
|
|
364
372
|
}
|
|
365
373
|
|
|
366
374
|
return await res.json();
|
|
@@ -380,7 +388,8 @@ class Cobalt {
|
|
|
380
388
|
});
|
|
381
389
|
|
|
382
390
|
if (res.status >= 400 && res.status < 600) {
|
|
383
|
-
|
|
391
|
+
const error = await res.json();
|
|
392
|
+
throw error;
|
|
384
393
|
}
|
|
385
394
|
|
|
386
395
|
return await res.json();
|
|
@@ -402,7 +411,8 @@ class Cobalt {
|
|
|
402
411
|
});
|
|
403
412
|
|
|
404
413
|
if (res.status >= 400 && res.status < 600) {
|
|
405
|
-
|
|
414
|
+
const error = await res.json();
|
|
415
|
+
throw error;
|
|
406
416
|
}
|
|
407
417
|
|
|
408
418
|
return await res.json();
|
|
@@ -423,7 +433,8 @@ class Cobalt {
|
|
|
423
433
|
});
|
|
424
434
|
|
|
425
435
|
if (res.status >= 400 && res.status < 600) {
|
|
426
|
-
|
|
436
|
+
const error = await res.json();
|
|
437
|
+
throw error;
|
|
427
438
|
}
|
|
428
439
|
|
|
429
440
|
return await res.json();
|
|
@@ -445,7 +456,8 @@ class Cobalt {
|
|
|
445
456
|
});
|
|
446
457
|
|
|
447
458
|
if (res.status >= 400 && res.status < 600) {
|
|
448
|
-
|
|
459
|
+
const error = await res.json();
|
|
460
|
+
throw error;
|
|
449
461
|
}
|
|
450
462
|
|
|
451
463
|
return await res.json();
|
|
@@ -467,7 +479,8 @@ class Cobalt {
|
|
|
467
479
|
});
|
|
468
480
|
|
|
469
481
|
if (res.status >= 400 && res.status < 600) {
|
|
470
|
-
|
|
482
|
+
const error = await res.json();
|
|
483
|
+
throw error;
|
|
471
484
|
}
|
|
472
485
|
|
|
473
486
|
return await res.json();
|
|
@@ -493,7 +506,8 @@ class Cobalt {
|
|
|
493
506
|
});
|
|
494
507
|
|
|
495
508
|
if (res.status >= 400 && res.status < 600) {
|
|
496
|
-
|
|
509
|
+
const error = await res.json();
|
|
510
|
+
throw error;
|
|
497
511
|
}
|
|
498
512
|
|
|
499
513
|
return await res.json();
|
|
@@ -516,7 +530,8 @@ class Cobalt {
|
|
|
516
530
|
});
|
|
517
531
|
|
|
518
532
|
if (res.status >= 400 && res.status < 600) {
|
|
519
|
-
|
|
533
|
+
const error = await res.json();
|
|
534
|
+
throw error;
|
|
520
535
|
}
|
|
521
536
|
|
|
522
537
|
return await res.json();
|