@flashbacktech/flashbackclient 0.0.83 → 0.0.84
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 +7 -1
- package/dist/api/client.js +19 -0
- package/dist/api/interfaces.d.ts +7 -0
- package/dist/api/types/auth.d.ts +64 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -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 } from './types/storage';
|
|
2
2
|
import { IApiClient, ProviderType } from './interfaces';
|
|
3
|
-
import { OAuth2ResponseDTO, RefreshTokenResponse } from './types/auth';
|
|
3
|
+
import { ActivateResponse, DeactivateResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshResponse, RefreshTokenResponse, RegisterBody, RegisterResponse } from './types/auth';
|
|
4
4
|
interface ErrorResponse {
|
|
5
5
|
message?: string;
|
|
6
6
|
[key: string]: any;
|
|
@@ -52,5 +52,11 @@ export declare class ApiClient implements IApiClient {
|
|
|
52
52
|
getRepoKeys: (repoId: string) => Promise<GetRepoKeysResponse>;
|
|
53
53
|
updateRepoKey: (repoId: string, keyId: string, data: UpdateRepoKeyRequest) => Promise<UpdateRepoKeyResponse>;
|
|
54
54
|
deleteRepoKey: (repoId: string, keyId: string) => Promise<ActionResponse>;
|
|
55
|
+
userRegister: (data: RegisterBody) => Promise<RegisterResponse>;
|
|
56
|
+
userLogin: (data: LoginBody) => Promise<LoginResponse>;
|
|
57
|
+
userRefresh: (refreshToken: string) => Promise<RefreshResponse>;
|
|
58
|
+
userLogout: (refreshToken: string) => Promise<LogoutResponse>;
|
|
59
|
+
userActivate: () => Promise<ActivateResponse>;
|
|
60
|
+
userDeactivate: () => Promise<DeactivateResponse>;
|
|
55
61
|
}
|
|
56
62
|
export {};
|
package/dist/api/client.js
CHANGED
|
@@ -192,6 +192,25 @@ class ApiClient {
|
|
|
192
192
|
this.deleteRepoKey = async (repoId, keyId) => {
|
|
193
193
|
return this.makeRequest(`repo/${repoId}/apikey/${keyId}`, 'DELETE', null);
|
|
194
194
|
};
|
|
195
|
+
////// User API
|
|
196
|
+
this.userRegister = async (data) => {
|
|
197
|
+
return this.makeRequest('user/register', 'POST', data);
|
|
198
|
+
};
|
|
199
|
+
this.userLogin = async (data) => {
|
|
200
|
+
return this.makeRequest('user/login', 'POST', data);
|
|
201
|
+
};
|
|
202
|
+
this.userRefresh = async (refreshToken) => {
|
|
203
|
+
return this.makeRequest('user/refresh', 'POST', { refresh_token: refreshToken });
|
|
204
|
+
};
|
|
205
|
+
this.userLogout = async (refreshToken) => {
|
|
206
|
+
return this.makeRequest('user/logout', 'POST', { refresh_token: refreshToken });
|
|
207
|
+
};
|
|
208
|
+
this.userActivate = async () => {
|
|
209
|
+
return this.makeRequest('user/activate', 'POST', null);
|
|
210
|
+
};
|
|
211
|
+
this.userDeactivate = async () => {
|
|
212
|
+
return this.makeRequest('user/deactivate', 'POST', null);
|
|
213
|
+
};
|
|
195
214
|
this.baseURL = baseURL;
|
|
196
215
|
this.headers = {};
|
|
197
216
|
this.debug = false;
|
package/dist/api/interfaces.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StorageUnit, CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepoKeyResponse, GetUnitsResponse, GetReposResponse, GetRepoKeysResponse, UpdateUnitRequest, UpdateUnitResponse, ActionResponse, UpdateRepoResponse, UpdateRepoRequest, UpdateRepoKeyRequest, UpdateRepoKeyResponse, ValidateUnitRequest, ValidateUnitResponse, ValidateRepoUnitsRequest, ValidateRepoUnitsResponse } from "./types/storage";
|
|
2
|
+
import { RegisterBody, LoginBody, RegisterResponse, LoginResponse, RefreshResponse, LogoutResponse, ActivateResponse, DeactivateResponse } from "./types/auth";
|
|
2
3
|
export declare enum ProviderType {
|
|
3
4
|
GOOGLE = "GOOGLE",
|
|
4
5
|
GITHUB = "GITHUB",
|
|
@@ -22,4 +23,10 @@ export interface IApiClient {
|
|
|
22
23
|
deleteRepoKey(repoId: string, keyId: string): Promise<ActionResponse>;
|
|
23
24
|
validateNewRepoUnits(data: ValidateRepoUnitsRequest): Promise<ValidateRepoUnitsResponse>;
|
|
24
25
|
validateUpdateRepoUnits(data: ValidateRepoUnitsRequest): Promise<ValidateRepoUnitsResponse>;
|
|
26
|
+
userRegister(registerBody: RegisterBody): Promise<RegisterResponse>;
|
|
27
|
+
userLogin(loginBody: LoginBody): Promise<LoginResponse>;
|
|
28
|
+
userRefresh(refreshToken: string): Promise<RefreshResponse>;
|
|
29
|
+
userLogout(refreshToken: string): Promise<LogoutResponse>;
|
|
30
|
+
userActivate(): Promise<ActivateResponse>;
|
|
31
|
+
userDeactivate(): Promise<DeactivateResponse>;
|
|
25
32
|
}
|
package/dist/api/types/auth.d.ts
CHANGED
|
@@ -22,3 +22,67 @@ export interface RefreshTokenResponse {
|
|
|
22
22
|
refreshToken: string;
|
|
23
23
|
expiresAt: number;
|
|
24
24
|
}
|
|
25
|
+
export interface JwtPayload {
|
|
26
|
+
userId: string;
|
|
27
|
+
email: string;
|
|
28
|
+
orgId?: string;
|
|
29
|
+
type?: string;
|
|
30
|
+
iat?: number;
|
|
31
|
+
exp?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface RegisterBody {
|
|
34
|
+
email: string;
|
|
35
|
+
password: string;
|
|
36
|
+
companyName: string;
|
|
37
|
+
companyDomain: string;
|
|
38
|
+
companyWebsite: string;
|
|
39
|
+
}
|
|
40
|
+
export interface LoginBody {
|
|
41
|
+
email: string;
|
|
42
|
+
password: string;
|
|
43
|
+
}
|
|
44
|
+
export interface LogoutBody {
|
|
45
|
+
refreshToken: string;
|
|
46
|
+
}
|
|
47
|
+
export interface RegisterResponse {
|
|
48
|
+
success: boolean;
|
|
49
|
+
accessToken?: string;
|
|
50
|
+
refreshToken?: string;
|
|
51
|
+
user?: {
|
|
52
|
+
id: string;
|
|
53
|
+
email: string;
|
|
54
|
+
name: string;
|
|
55
|
+
orgId?: string;
|
|
56
|
+
};
|
|
57
|
+
error_code?: string;
|
|
58
|
+
message?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface LoginResponse extends RegisterResponse {
|
|
61
|
+
}
|
|
62
|
+
export interface RefreshResponse {
|
|
63
|
+
success: boolean;
|
|
64
|
+
accessToken?: string;
|
|
65
|
+
user?: {
|
|
66
|
+
id: string;
|
|
67
|
+
email: string;
|
|
68
|
+
name: string;
|
|
69
|
+
orgId?: string;
|
|
70
|
+
};
|
|
71
|
+
error_code?: string;
|
|
72
|
+
message?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface LogoutResponse {
|
|
75
|
+
success: boolean;
|
|
76
|
+
error_code?: string;
|
|
77
|
+
message?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface ActivateResponse {
|
|
80
|
+
success: boolean;
|
|
81
|
+
error_code?: string;
|
|
82
|
+
message?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface DeactivateResponse {
|
|
85
|
+
success: boolean;
|
|
86
|
+
error_code?: string;
|
|
87
|
+
message?: string;
|
|
88
|
+
}
|