@flashbacktech/flashbackclient 0.1.20 → 0.1.22

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.
@@ -1,6 +1,6 @@
1
1
  import { CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse, StorageUnit, CreateRepoKeyRequest, CreateRepoKeyResponse, GetUnitsResponse, GetReposResponse, GetRepoKeysResponse, UpdateUnitRequest, UpdateUnitResponse, ActionResponse, UpdateRepoRequest, UpdateRepoResponse, UpdateRepoKeyRequest, UpdateRepoKeyResponse, ValidateUnitRequest, ValidateUnitResponse, ValidateRepoUnitsRequest, ValidateRepoUnitsResponse, StorageUnitStatusResponse, GetUnitNodeStatsResponse, GetUnitNodeStatsRequest } from './types/storage';
2
2
  import { IApiClient, ProviderType } from './interfaces';
3
- import { ActivateResponse, DeactivateResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshTokenErrorResponse, RefreshTokenResponse, RegisterBody, RegisterResponse } from './types/auth';
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
6
  import { FeedbackEmailBody } from './types/email';
@@ -38,6 +38,7 @@ export declare class ApiClient implements IApiClient {
38
38
  private authenticateGoogle;
39
39
  private authenticateGithub;
40
40
  private refreshGoogleToken;
41
+ private refreshGithubToken;
41
42
  private exchangeGoogleCode;
42
43
  createStorageUnit: (data: CreateUnitRequest) => Promise<CreateUnitResponse>;
43
44
  getStorageUnits: () => Promise<GetUnitsResponse>;
@@ -65,6 +66,8 @@ export declare class ApiClient implements IApiClient {
65
66
  userActivate: () => Promise<ActivateResponse>;
66
67
  userDeactivate: () => Promise<DeactivateResponse>;
67
68
  getUserQuota: () => Promise<QuotaResponse>;
69
+ requestPasswordReset: (email: string) => Promise<ActionResponse>;
70
+ resetPassword: (data: ResetPasswordBody) => Promise<ActionResponse>;
68
71
  private validateDateRange;
69
72
  getDailyStats: (params: StatsQueryParams) => Promise<StatsResponse>;
70
73
  getMinuteStats: (params: StatsQueryParams) => Promise<StatsResponse>;
@@ -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
- // TODO: Implement refresh token for Github
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:
@@ -141,6 +140,11 @@ class ApiClient {
141
140
  refresh_token: refreshToken,
142
141
  });
143
142
  };
143
+ this.refreshGithubToken = async (refreshToken) => {
144
+ return this.makeRequest('auth/github/refresh', 'POST', {
145
+ refresh_token: refreshToken,
146
+ });
147
+ };
144
148
  this.exchangeGoogleCode = async (code) => {
145
149
  return this.makeRequest('auth/google/exchange', 'POST', { code });
146
150
  };
@@ -226,6 +230,12 @@ class ApiClient {
226
230
  this.getUserQuota = async () => {
227
231
  return this.makeRequest('user/quota', 'GET', null);
228
232
  };
233
+ this.requestPasswordReset = async (email) => {
234
+ return this.makeRequest('user/request-reset-password', 'POST', { email });
235
+ };
236
+ this.resetPassword = async (data) => {
237
+ return this.makeRequest('user/reset-password', 'POST', data);
238
+ };
229
239
  this.getDailyStats = async (params) => {
230
240
  this.validateDateRange(params.startDate, params.endDate);
231
241
  const queryParams = new URLSearchParams();
@@ -91,3 +91,7 @@ export interface DeactivateResponse {
91
91
  error_code?: string;
92
92
  message?: string;
93
93
  }
94
+ export interface ResetPasswordBody {
95
+ token: string;
96
+ newPassword: string;
97
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"