@flashbacktech/flashbackclient 0.0.34 → 0.0.35

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.
@@ -40,9 +40,11 @@ class ApiClient {
40
40
  headers: this.headers,
41
41
  body: JSON.stringify({ token }),
42
42
  });
43
- if (!response.ok)
43
+ if (!response.ok) {
44
44
  throw new Error(`HTTP error! status: ${response.status}`);
45
- return response.json();
45
+ }
46
+ const ret = await response.json();
47
+ return ret;
46
48
  };
47
49
  this.authenticateGithub = async (code) => {
48
50
  this.setAuthToken(code);
@@ -51,9 +53,11 @@ class ApiClient {
51
53
  headers: this.headers,
52
54
  body: JSON.stringify({ code }),
53
55
  });
54
- if (!response.ok)
56
+ if (!response.ok) {
55
57
  throw new Error(`HTTP error! status: ${response.status}`);
56
- return response.json();
58
+ }
59
+ const ret = await response.json();
60
+ return ret;
57
61
  };
58
62
  this.createStorageUnit = async (data) => {
59
63
  const response = await fetch(`${this.baseURL}/unit`, {
@@ -61,9 +65,11 @@ class ApiClient {
61
65
  headers: this.headers,
62
66
  body: JSON.stringify(data),
63
67
  });
64
- if (!response.ok)
68
+ if (!response.ok) {
65
69
  throw new Error(`HTTP error! status: ${response.status}`);
66
- return response.json();
70
+ }
71
+ const ret = await response.json();
72
+ return ret;
67
73
  };
68
74
  this.getStorageUnits = async () => {
69
75
  const response = await fetch(`${this.baseURL}/unit`, {
@@ -73,7 +79,8 @@ class ApiClient {
73
79
  if (!response.ok) {
74
80
  throw new Error(`HTTP error! status: ${response.status}`);
75
81
  }
76
- return response.json();
82
+ const ret = await response.json();
83
+ return ret;
77
84
  };
78
85
  this.createRepo = async (data) => {
79
86
  const response = await fetch(`${this.baseURL}/repo`, {
@@ -81,18 +88,22 @@ class ApiClient {
81
88
  headers: this.headers,
82
89
  body: JSON.stringify(data),
83
90
  });
84
- if (!response.ok)
91
+ if (!response.ok) {
85
92
  throw new Error(`HTTP error! status: ${response.status}`);
86
- return response.json();
93
+ }
94
+ const ret = await response.json();
95
+ return ret;
87
96
  };
88
97
  this.getRepos = async () => {
89
98
  const response = await fetch(`${this.baseURL}/repo`, {
90
99
  method: 'GET',
91
100
  headers: this.headers,
92
101
  });
93
- if (!response.ok)
102
+ if (!response.ok) {
94
103
  throw new Error(`HTTP error! status: ${response.status}`);
95
- return response.json();
104
+ }
105
+ const ret = await response.json();
106
+ return ret;
96
107
  };
97
108
  this.createRepoKey = async (data) => {
98
109
  const response = await fetch(`${this.baseURL}/repo/${data.repoId}/apikey`, {
@@ -100,18 +111,22 @@ class ApiClient {
100
111
  headers: this.headers,
101
112
  body: JSON.stringify(data),
102
113
  });
103
- if (!response.ok)
114
+ if (!response.ok) {
104
115
  throw new Error(`HTTP error! status: ${response.status}`);
105
- return response.json();
116
+ }
117
+ const ret = await response.json();
118
+ return ret;
106
119
  };
107
120
  this.getRepoKeys = async (repoId) => {
108
121
  const response = await fetch(`${this.baseURL}/repo/${repoId}/apikey`, {
109
122
  method: 'GET',
110
123
  headers: this.headers,
111
124
  });
112
- if (!response.ok)
125
+ if (!response.ok) {
113
126
  throw new Error(`HTTP error! status: ${response.status}`);
114
- return response.json();
127
+ }
128
+ const ret = await response.json();
129
+ return ret;
115
130
  };
116
131
  this.baseURL = baseURL;
117
132
  this.headers = {
@@ -70,7 +70,6 @@ export interface StorageUnit {
70
70
  id: string;
71
71
  name: string;
72
72
  bucket: string;
73
- storageTypeId: string;
74
73
  storageType: StorageType;
75
74
  key: string;
76
75
  secret: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },