@flashbacktech/flashbackclient 0.2.26 → 0.2.28
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
|
@@ -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
|
/**
|
|
@@ -105,6 +105,7 @@ export declare class ApiClient implements IApiClient {
|
|
|
105
105
|
createLink: (data: CreateLinkRequest) => Promise<CreateLinkResponse>;
|
|
106
106
|
updateLink: (linkId: string, data: UpdateLinkRequest) => Promise<UpdateLinkResponse>;
|
|
107
107
|
deleteLink: (linkId: string) => Promise<DeleteLinkResponse>;
|
|
108
|
+
getLink: (linkId: string, token: string) => Promise<GetLinkByTokenResponse>;
|
|
108
109
|
private validateDateRange;
|
|
109
110
|
getDailyStats(params: StatsQueryParams): Promise<StatsResponse>;
|
|
110
111
|
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 () => {
|
|
@@ -272,6 +272,9 @@ class ApiClient {
|
|
|
272
272
|
this.deleteLink = async (linkId) => {
|
|
273
273
|
return this.makeRequest(`links/${linkId}`, 'DELETE', null);
|
|
274
274
|
};
|
|
275
|
+
this.getLink = async (linkId, token) => {
|
|
276
|
+
return this.makeRequest(`links/${linkId}?token=${encodeURIComponent(token)}`, 'GET', null);
|
|
277
|
+
};
|
|
275
278
|
this.getRepoStats = async (params) => {
|
|
276
279
|
const queryParams = new URLSearchParams();
|
|
277
280
|
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;
|
|
@@ -106,11 +108,18 @@ export interface ResetPasswordBody {
|
|
|
106
108
|
export interface LoginDeviceInfo {
|
|
107
109
|
deviceInfo?: DeviceInfo;
|
|
108
110
|
}
|
|
111
|
+
export interface GoogleExchangeCodeRequest {
|
|
112
|
+
code: string;
|
|
113
|
+
activationUid?: string;
|
|
114
|
+
activationToken?: string;
|
|
115
|
+
}
|
|
109
116
|
export interface GoogleLoginRequest extends LoginDeviceInfo {
|
|
110
117
|
token: string;
|
|
111
118
|
}
|
|
112
119
|
export interface GithubLoginRequest extends LoginDeviceInfo {
|
|
113
120
|
code: string;
|
|
121
|
+
activationUid?: string;
|
|
122
|
+
activationToken?: string;
|
|
114
123
|
}
|
|
115
124
|
export interface DemoRequestBody {
|
|
116
125
|
userId: string;
|
|
@@ -11,6 +11,7 @@ export interface ActivationLinkDTO {
|
|
|
11
11
|
activatedAt: Date | string | null;
|
|
12
12
|
createdBy: string;
|
|
13
13
|
creator: CreatorInfo;
|
|
14
|
+
activationLink: string;
|
|
14
15
|
}
|
|
15
16
|
export interface GetLinksRequest {
|
|
16
17
|
from?: string;
|
|
@@ -52,3 +53,14 @@ export interface DeleteLinkResponse {
|
|
|
52
53
|
message: string;
|
|
53
54
|
error_code?: string;
|
|
54
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
|
+
}
|