@flashbacktech/flashbackclient 0.2.46 → 0.2.47
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 +3 -1
- package/dist/api/client.js +47 -0
- package/dist/api/types/ai/policy.d.ts +30 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { SystemEventQueryRequest, SystemEventQueryResponse } from './types/platf
|
|
|
18
18
|
import { PreVerifyEmailResponse, UserUpdateRequest, UserUpdateResponse } from './types/platform/user';
|
|
19
19
|
import { CreateRepoAiApiKeyRequest, CreateRepoAiApiKeyResponse, DeleteRepoAiApiKeyResponse, GetRepoAiApiKeysResponse, UpdateRepoAiApiKeyRequest, UpdateRepoAiApiKeyResponse } from './types/ai/aiapikey';
|
|
20
20
|
import { AiLlmStatsResponse, CreateAiLlmRequest, CreateAiLlmResponse, DeleteAiLlmResponse, GetAiLlmsResponse, UpdateAiLlmRequest, UpdateAiLlmResponse, ValidateAiLlmResponse } from './types/ai/aillm';
|
|
21
|
-
import { CreatePolicyRequest, GetPoliciesQuery, GetPolicyViolationsQuery, GetPolicyViolationsResponse, PolicyDTO, UpdatePolicyRequest, PolicyValidationRequest, PolicyValidationResponse, PolicyRecommendationRequest, PolicyRecommendationResponse } from './types/ai/policy';
|
|
21
|
+
import { CreatePolicyRequest, GetPoliciesQuery, GetPolicyViolationsQuery, GetPolicyViolationsResponse, GetPolicyAlertsQuery, GetPolicyAlertsResponse, PolicyDTO, UpdatePolicyRequest, PolicyValidationRequest, PolicyValidationResponse, PolicyRecommendationRequest, PolicyRecommendationResponse } from './types/ai/policy';
|
|
22
22
|
import { CreateConversationRequest, CreateConversationResponse, SendPromptRequest, SendPromptResponse, GetConversationsRequest, GetConversationsResponse, GetConversationMessagesResponse, GetConversationMessagesRequest, DeleteConversationRequest, DeleteConversationResponse } from './types/ai/conversation';
|
|
23
23
|
import { GetLinksRequest, GetLinksResponse, CreateLinkRequest, CreateLinkResponse, UpdateLinkRequest, UpdateLinkResponse, DeleteLinkResponse, GetLinkByTokenResponse } from './types/platform/links';
|
|
24
24
|
interface ErrorResponse {
|
|
@@ -269,6 +269,8 @@ export declare class ApiClient implements IApiClient {
|
|
|
269
269
|
deletePolicy: (policyId: string) => Promise<ActionResponse>;
|
|
270
270
|
getPolicyViolations: (query: GetPolicyViolationsQuery) => Promise<GetPolicyViolationsResponse>;
|
|
271
271
|
getPolicyViolationsByPolicyId: (policyId: string, query: Omit<GetPolicyViolationsQuery, "policyId">) => Promise<GetPolicyViolationsResponse>;
|
|
272
|
+
getPolicyAlerts: (query: GetPolicyAlertsQuery) => Promise<GetPolicyAlertsResponse>;
|
|
273
|
+
getPolicyAlertsByPolicyId: (policyId: string, query: Omit<GetPolicyAlertsQuery, "policyId">) => Promise<GetPolicyAlertsResponse>;
|
|
272
274
|
validatePolicies: (data: PolicyValidationRequest) => Promise<PolicyValidationResponse>;
|
|
273
275
|
recommendPolicies: (data: PolicyRecommendationRequest) => Promise<PolicyRecommendationResponse>;
|
|
274
276
|
}
|
package/dist/api/client.js
CHANGED
|
@@ -722,6 +722,53 @@ class ApiClient {
|
|
|
722
722
|
}
|
|
723
723
|
return this.makeRequest(`policy/${policyId}/violations${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
|
|
724
724
|
};
|
|
725
|
+
this.getPolicyAlerts = async (query) => {
|
|
726
|
+
const queryParams = new URLSearchParams();
|
|
727
|
+
if (query.workspaceId) {
|
|
728
|
+
queryParams.append('workspaceId', query.workspaceId);
|
|
729
|
+
}
|
|
730
|
+
if (query.repoId) {
|
|
731
|
+
queryParams.append('repoId', query.repoId);
|
|
732
|
+
}
|
|
733
|
+
if (query.policyId) {
|
|
734
|
+
queryParams.append('policyId', query.policyId);
|
|
735
|
+
}
|
|
736
|
+
if (query.from) {
|
|
737
|
+
queryParams.append('from', query.from);
|
|
738
|
+
}
|
|
739
|
+
if (query.to) {
|
|
740
|
+
queryParams.append('to', query.to);
|
|
741
|
+
}
|
|
742
|
+
if (query.take !== undefined) {
|
|
743
|
+
queryParams.append('take', query.take.toString());
|
|
744
|
+
}
|
|
745
|
+
if (query.skip !== undefined) {
|
|
746
|
+
queryParams.append('skip', query.skip.toString());
|
|
747
|
+
}
|
|
748
|
+
return this.makeRequest(`policy/alerts?${queryParams.toString()}`, 'GET', null);
|
|
749
|
+
};
|
|
750
|
+
this.getPolicyAlertsByPolicyId = async (policyId, query) => {
|
|
751
|
+
const queryParams = new URLSearchParams();
|
|
752
|
+
if (query.workspaceId) {
|
|
753
|
+
queryParams.append('workspaceId', query.workspaceId);
|
|
754
|
+
}
|
|
755
|
+
if (query.repoId) {
|
|
756
|
+
queryParams.append('repoId', query.repoId);
|
|
757
|
+
}
|
|
758
|
+
if (query.from) {
|
|
759
|
+
queryParams.append('from', query.from);
|
|
760
|
+
}
|
|
761
|
+
if (query.to) {
|
|
762
|
+
queryParams.append('to', query.to);
|
|
763
|
+
}
|
|
764
|
+
if (query.take !== undefined) {
|
|
765
|
+
queryParams.append('take', query.take.toString());
|
|
766
|
+
}
|
|
767
|
+
if (query.skip !== undefined) {
|
|
768
|
+
queryParams.append('skip', query.skip.toString());
|
|
769
|
+
}
|
|
770
|
+
return this.makeRequest(`policy/${policyId}/alerts${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
|
|
771
|
+
};
|
|
725
772
|
this.validatePolicies = async (data) => {
|
|
726
773
|
return this.makeRequest('policy/validate', 'POST', data);
|
|
727
774
|
};
|
|
@@ -85,6 +85,36 @@ export interface GetPolicyViolationsResponse {
|
|
|
85
85
|
skip: number;
|
|
86
86
|
take: number;
|
|
87
87
|
}
|
|
88
|
+
export interface GetPolicyAlertsQuery {
|
|
89
|
+
workspaceId?: string;
|
|
90
|
+
repoId?: string;
|
|
91
|
+
policyId?: string;
|
|
92
|
+
from?: string;
|
|
93
|
+
to?: string;
|
|
94
|
+
take?: number;
|
|
95
|
+
skip?: number;
|
|
96
|
+
}
|
|
97
|
+
export interface PolicyAlertDTO {
|
|
98
|
+
id: string;
|
|
99
|
+
policyId: string;
|
|
100
|
+
policyName: string;
|
|
101
|
+
timestamp: Date;
|
|
102
|
+
message: string;
|
|
103
|
+
conversationId: string | null;
|
|
104
|
+
repoId: string;
|
|
105
|
+
repoName: string;
|
|
106
|
+
userId: string;
|
|
107
|
+
userName: string;
|
|
108
|
+
repoAiApiKeyId: string;
|
|
109
|
+
repoAiApiKeyName: string;
|
|
110
|
+
}
|
|
111
|
+
export interface GetPolicyAlertsResponse {
|
|
112
|
+
success: boolean;
|
|
113
|
+
alerts: PolicyAlertDTO[];
|
|
114
|
+
total: number;
|
|
115
|
+
skip: number;
|
|
116
|
+
take: number;
|
|
117
|
+
}
|
|
88
118
|
export interface PolicyToValidate {
|
|
89
119
|
policy_uuid: string;
|
|
90
120
|
content: string;
|