@flashbacktech/flashbackclient 0.1.21 → 0.1.23
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/api/client.d.ts +2 -2
- package/dist/api/client.js +9 -4
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { IApiClient, ProviderType } from './interfaces';
|
|
|
3
3
|
import { ActivateResponse, DeactivateResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshTokenErrorResponse, RefreshTokenResponse, RegisterBody, RegisterResponse, ResetPasswordBody } from './types/auth';
|
|
4
4
|
import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams, UnitStatsResponse, RepoStatsResponse, NodeStatsDailyQueryParams } from './types/stats';
|
|
5
5
|
import { NodeInfo } from './types/bridge';
|
|
6
|
-
import { FeedbackEmailBody } from './types/email';
|
|
7
6
|
import { QuotaResponse } from './types/quota';
|
|
8
7
|
interface ErrorResponse {
|
|
9
8
|
message?: string;
|
|
@@ -38,6 +37,7 @@ export declare class ApiClient implements IApiClient {
|
|
|
38
37
|
private authenticateGoogle;
|
|
39
38
|
private authenticateGithub;
|
|
40
39
|
private refreshGoogleToken;
|
|
40
|
+
private refreshGithubToken;
|
|
41
41
|
private exchangeGoogleCode;
|
|
42
42
|
createStorageUnit: (data: CreateUnitRequest) => Promise<CreateUnitResponse>;
|
|
43
43
|
getStorageUnits: () => Promise<GetUnitsResponse>;
|
|
@@ -79,6 +79,6 @@ export declare class ApiClient implements IApiClient {
|
|
|
79
79
|
unitId?: string[];
|
|
80
80
|
}) => Promise<UnitStatsResponse>;
|
|
81
81
|
getNodeInfo: () => Promise<NodeInfo[]>;
|
|
82
|
-
sendFeedbackEmail: (data:
|
|
82
|
+
sendFeedbackEmail: (data: FormData) => Promise<ActionResponse>;
|
|
83
83
|
}
|
|
84
84
|
export {};
|
package/dist/api/client.js
CHANGED
|
@@ -69,8 +69,7 @@ class ApiClient {
|
|
|
69
69
|
case interfaces_1.ProviderType.GOOGLE:
|
|
70
70
|
return this.refreshGoogleToken(refreshToken);
|
|
71
71
|
case interfaces_1.ProviderType.GITHUB:
|
|
72
|
-
|
|
73
|
-
throw new Error('Not implemented');
|
|
72
|
+
return this.refreshGithubToken(refreshToken);
|
|
74
73
|
case interfaces_1.ProviderType.LOCAL:
|
|
75
74
|
return this.userRefresh(refreshToken);
|
|
76
75
|
default:
|
|
@@ -81,12 +80,13 @@ class ApiClient {
|
|
|
81
80
|
throw new Error('Not implemented');
|
|
82
81
|
};
|
|
83
82
|
this.makeRequest = async (path, method, data) => {
|
|
83
|
+
const isFormData = data instanceof FormData;
|
|
84
84
|
const options = {
|
|
85
85
|
method,
|
|
86
86
|
headers: this.headers,
|
|
87
|
-
body: data ? JSON.stringify(data) : null,
|
|
87
|
+
body: data ? (isFormData ? data : JSON.stringify(data)) : null,
|
|
88
88
|
};
|
|
89
|
-
if (data) {
|
|
89
|
+
if (data && !isFormData) {
|
|
90
90
|
options.headers = {
|
|
91
91
|
...options.headers,
|
|
92
92
|
'Content-Type': 'application/json',
|
|
@@ -141,6 +141,11 @@ class ApiClient {
|
|
|
141
141
|
refresh_token: refreshToken,
|
|
142
142
|
});
|
|
143
143
|
};
|
|
144
|
+
this.refreshGithubToken = async (refreshToken) => {
|
|
145
|
+
return this.makeRequest('auth/github/refresh', 'POST', {
|
|
146
|
+
refresh_token: refreshToken,
|
|
147
|
+
});
|
|
148
|
+
};
|
|
144
149
|
this.exchangeGoogleCode = async (code) => {
|
|
145
150
|
return this.makeRequest('auth/google/exchange', 'POST', { code });
|
|
146
151
|
};
|