@flashbacktech/flashbackclient 0.2.27 → 0.2.29
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepoKeyResponse, GetReposResponse, GetRepoKeysResponse, ActionResponse, UpdateRepoRequest, UpdateRepoResponse, UpdateRepoKeyRequest, UpdateRepoKeyResponse, ValidateRepoUnitsRequest, ValidateRepoUnitsResponse, CreateBucketRequest, CreateBucketResponse, UpdateBucketRequest, UpdateBucketResponse, ValidateBucketRequest, ValidateBucketResponse, StorageBucket, GetBucketsResponse, StorageBucketStatusResponse, GetBucketNodeStatsRequest, GetBucketNodeStatsResponse, CreateRepoWithBucketsRequest, UpdateRepoWithBucketsRequest, ValidateRepoBucketsRequest, ValidateRepoBucketsResponse } from './types/storage/storage';
|
|
2
2
|
import { IApiClient, ProviderType } from './interfaces';
|
|
3
|
-
import { ActivateUserRequest, ActivateUserResponse, DeactivateResponse, DemoRequestBody, DemoRequestResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshTokenErrorResponse, RefreshTokenResponse, RegisterBody, RegisterResponse, ResetPasswordBody, Web3RegisterBody } from './types/platform/auth';
|
|
3
|
+
import { ActivateUserRequest, ActivateUserResponse, DeactivateResponse, DemoRequestBody, DemoRequestResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshTokenErrorResponse, RefreshTokenResponse, RegisterBody, RegisterResponse, ResendVerificationEmailResponse, ResetPasswordBody, Web3RegisterBody } from './types/platform/auth';
|
|
4
4
|
import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams, UnitStatsResponse, RepoStatsResponse, NodeStatsDailyQueryParams, BucketStatsResponse, StatsQueryWithBucketParams, NodeStatsQueryWithBucketParams, NodeStatsDailyQueryWithBucketParams } from './types/storage/stats';
|
|
5
5
|
import { NodeInfoResponse, RegisterRequest } from './types/storage/bridge';
|
|
6
6
|
import { GetOrganizationKeysResponse } from './types/storage/noderegistration';
|
|
@@ -19,7 +19,7 @@ import { CreateRepoAiApiKeyRequest, CreateRepoAiApiKeyResponse, DeleteRepoAiApiK
|
|
|
19
19
|
import { AiLlmStatsResponse, CreateAiLlmRequest, CreateAiLlmResponse, DeleteAiLlmResponse, GetAiLlmsResponse, UpdateAiLlmRequest, UpdateAiLlmResponse, ValidateAiLlmResponse } from './types/ai/aillm';
|
|
20
20
|
import { CreatePolicyRequest, GetPoliciesQuery, GetPolicyViolationsQuery, GetPolicyViolationsResponse, PolicyDTO, UpdatePolicyRequest, PolicyValidationRequest, PolicyValidationResponse, PolicyRecommendationRequest, PolicyRecommendationResponse } from './types/ai/policy';
|
|
21
21
|
import { CreateConversationRequest, CreateConversationResponse, SendPromptRequest, SendPromptResponse, GetConversationsRequest, GetConversationsResponse, GetConversationMessagesResponse, GetConversationMessagesRequest } from './types/ai/conversation';
|
|
22
|
-
import { GetLinksRequest, GetLinksResponse, CreateLinkRequest, CreateLinkResponse, UpdateLinkRequest, UpdateLinkResponse, DeleteLinkResponse } from './types/platform/links';
|
|
22
|
+
import { GetLinksRequest, GetLinksResponse, CreateLinkRequest, CreateLinkResponse, UpdateLinkRequest, UpdateLinkResponse, DeleteLinkResponse, GetLinkByTokenResponse } from './types/platform/links';
|
|
23
23
|
interface ErrorResponse {
|
|
24
24
|
message?: string;
|
|
25
25
|
[key: string]: any;
|
|
@@ -37,8 +37,8 @@ export declare class ApiClient implements IApiClient {
|
|
|
37
37
|
constructor(baseURL?: string);
|
|
38
38
|
setDebug: (debug: boolean) => void;
|
|
39
39
|
setAuthToken: (token: string | null) => void;
|
|
40
|
-
authenticate: (token: string, provider: ProviderType, deviceInfo?: DeviceInfo) => Promise<any>;
|
|
41
|
-
exchangeCode: (code: string, provider: ProviderType) => Promise<OAuth2ResponseDTO>;
|
|
40
|
+
authenticate: (token: string, provider: ProviderType, deviceInfo?: DeviceInfo, activationUid?: string, activationToken?: string) => Promise<any>;
|
|
41
|
+
exchangeCode: (code: string, provider: ProviderType, activationUid?: string, activationToken?: string) => Promise<OAuth2ResponseDTO>;
|
|
42
42
|
private exchangeGithubCode;
|
|
43
43
|
private exchangeWeb3StellarCode;
|
|
44
44
|
/**
|
|
@@ -91,6 +91,7 @@ export declare class ApiClient implements IApiClient {
|
|
|
91
91
|
deleteRepoKey: (repoId: string, keyId: string) => Promise<ActionResponse>;
|
|
92
92
|
userRegister: (data: RegisterBody) => Promise<RegisterResponse>;
|
|
93
93
|
validateRegistration: (token: string) => Promise<RegisterResponse>;
|
|
94
|
+
resendVerificationEmail: (verificationTokenId: string) => Promise<ResendVerificationEmailResponse>;
|
|
94
95
|
userLogin: (data: LoginBody) => Promise<LoginResponse>;
|
|
95
96
|
userRefresh: (refreshToken: string) => Promise<RefreshTokenResponse | RefreshTokenErrorResponse>;
|
|
96
97
|
userLogout: (refreshToken: string) => Promise<LogoutResponse>;
|
|
@@ -105,6 +106,7 @@ export declare class ApiClient implements IApiClient {
|
|
|
105
106
|
createLink: (data: CreateLinkRequest) => Promise<CreateLinkResponse>;
|
|
106
107
|
updateLink: (linkId: string, data: UpdateLinkRequest) => Promise<UpdateLinkResponse>;
|
|
107
108
|
deleteLink: (linkId: string) => Promise<DeleteLinkResponse>;
|
|
109
|
+
getLink: (linkId: string, token: string) => Promise<GetLinkByTokenResponse>;
|
|
108
110
|
private validateDateRange;
|
|
109
111
|
getDailyStats(params: StatsQueryParams): Promise<StatsResponse>;
|
|
110
112
|
getDailyStats(params: StatsQueryWithBucketParams): Promise<StatsResponse>;
|
package/dist/api/client.js
CHANGED
|
@@ -25,13 +25,13 @@ class ApiClient {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
this.authenticate = async (token, provider, deviceInfo) => {
|
|
28
|
+
this.authenticate = async (token, provider, deviceInfo, activationUid, activationToken) => {
|
|
29
29
|
this.setAuthToken(token);
|
|
30
30
|
switch (provider) {
|
|
31
31
|
case interfaces_1.ProviderType.GOOGLE:
|
|
32
32
|
return this.authenticateGoogle({ token, deviceInfo });
|
|
33
33
|
case interfaces_1.ProviderType.GITHUB:
|
|
34
|
-
return this.authenticateGithub({ code: token, deviceInfo });
|
|
34
|
+
return this.authenticateGithub({ code: token, deviceInfo, activationUid, activationToken });
|
|
35
35
|
case interfaces_1.ProviderType.WEB3_STELLAR:
|
|
36
36
|
throw new Error('Call web3Authenticate for web3 authentication');
|
|
37
37
|
case interfaces_1.ProviderType.LOCAL:
|
|
@@ -40,10 +40,10 @@ class ApiClient {
|
|
|
40
40
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
this.exchangeCode = async (code, provider) => {
|
|
43
|
+
this.exchangeCode = async (code, provider, activationUid, activationToken) => {
|
|
44
44
|
switch (provider) {
|
|
45
45
|
case interfaces_1.ProviderType.GOOGLE:
|
|
46
|
-
return this.exchangeGoogleCode(code);
|
|
46
|
+
return this.exchangeGoogleCode({ code, activationUid, activationToken });
|
|
47
47
|
case interfaces_1.ProviderType.GITHUB:
|
|
48
48
|
return this.exchangeGithubCode(code);
|
|
49
49
|
case interfaces_1.ProviderType.WEB3_STELLAR:
|
|
@@ -152,8 +152,8 @@ class ApiClient {
|
|
|
152
152
|
refresh_token: refreshToken,
|
|
153
153
|
});
|
|
154
154
|
};
|
|
155
|
-
this.exchangeGoogleCode = async (
|
|
156
|
-
return this.makeRequest('auth/google/exchange', 'POST',
|
|
155
|
+
this.exchangeGoogleCode = async (data) => {
|
|
156
|
+
return this.makeRequest('auth/google/exchange', 'POST', data);
|
|
157
157
|
};
|
|
158
158
|
// Token Management
|
|
159
159
|
this.getTokens = async () => {
|
|
@@ -213,6 +213,9 @@ class ApiClient {
|
|
|
213
213
|
this.validateRegistration = async (token) => {
|
|
214
214
|
return this.makeRequest('/user/verify-email', 'POST', { token });
|
|
215
215
|
};
|
|
216
|
+
this.resendVerificationEmail = async (verificationTokenId) => {
|
|
217
|
+
return this.makeRequest(`user/resend-verification/${verificationTokenId}`, 'POST', null);
|
|
218
|
+
};
|
|
216
219
|
this.userLogin = async (data) => {
|
|
217
220
|
return this.makeRequest('user/login', 'POST', data);
|
|
218
221
|
};
|
|
@@ -272,6 +275,9 @@ class ApiClient {
|
|
|
272
275
|
this.deleteLink = async (linkId) => {
|
|
273
276
|
return this.makeRequest(`links/${linkId}`, 'DELETE', null);
|
|
274
277
|
};
|
|
278
|
+
this.getLink = async (linkId, token) => {
|
|
279
|
+
return this.makeRequest(`links/${linkId}?token=${encodeURIComponent(token)}`, 'GET', null);
|
|
280
|
+
};
|
|
275
281
|
this.getRepoStats = async (params) => {
|
|
276
282
|
const queryParams = new URLSearchParams();
|
|
277
283
|
if (params && params.repoId && params.repoId.length > 0) {
|
|
@@ -58,6 +58,8 @@ export interface RegisterBody {
|
|
|
58
58
|
country?: string;
|
|
59
59
|
website?: string;
|
|
60
60
|
isBusiness: boolean;
|
|
61
|
+
activationUid?: string;
|
|
62
|
+
activationToken?: string;
|
|
61
63
|
}
|
|
62
64
|
export interface LoginBody extends LoginDeviceInfo {
|
|
63
65
|
email: string;
|
|
@@ -81,6 +83,7 @@ export interface RegisterResponse {
|
|
|
81
83
|
};
|
|
82
84
|
error_code?: string;
|
|
83
85
|
message?: string;
|
|
86
|
+
verificationTokenId?: string;
|
|
84
87
|
}
|
|
85
88
|
export interface LoginResponse extends RegisterResponse {
|
|
86
89
|
}
|
|
@@ -94,6 +97,11 @@ export interface ActivateResponse {
|
|
|
94
97
|
error_code?: string;
|
|
95
98
|
message?: string;
|
|
96
99
|
}
|
|
100
|
+
export interface ResendVerificationEmailResponse {
|
|
101
|
+
success: boolean;
|
|
102
|
+
error_code?: string;
|
|
103
|
+
message?: string;
|
|
104
|
+
}
|
|
97
105
|
export interface DeactivateResponse {
|
|
98
106
|
success: boolean;
|
|
99
107
|
error_code?: string;
|
|
@@ -106,11 +114,18 @@ export interface ResetPasswordBody {
|
|
|
106
114
|
export interface LoginDeviceInfo {
|
|
107
115
|
deviceInfo?: DeviceInfo;
|
|
108
116
|
}
|
|
117
|
+
export interface GoogleExchangeCodeRequest {
|
|
118
|
+
code: string;
|
|
119
|
+
activationUid?: string;
|
|
120
|
+
activationToken?: string;
|
|
121
|
+
}
|
|
109
122
|
export interface GoogleLoginRequest extends LoginDeviceInfo {
|
|
110
123
|
token: string;
|
|
111
124
|
}
|
|
112
125
|
export interface GithubLoginRequest extends LoginDeviceInfo {
|
|
113
126
|
code: string;
|
|
127
|
+
activationUid?: string;
|
|
128
|
+
activationToken?: string;
|
|
114
129
|
}
|
|
115
130
|
export interface DemoRequestBody {
|
|
116
131
|
userId: string;
|
|
@@ -53,3 +53,14 @@ export interface DeleteLinkResponse {
|
|
|
53
53
|
message: string;
|
|
54
54
|
error_code?: string;
|
|
55
55
|
}
|
|
56
|
+
export interface GetLinkByTokenRequest {
|
|
57
|
+
token: string;
|
|
58
|
+
}
|
|
59
|
+
export interface GetLinkByTokenResponse {
|
|
60
|
+
success: boolean;
|
|
61
|
+
uuid: string;
|
|
62
|
+
email: string;
|
|
63
|
+
activatedAt: Date | string | null;
|
|
64
|
+
error_code?: string;
|
|
65
|
+
message?: string;
|
|
66
|
+
}
|