@flashbacktech/flashbackclient 0.2.46 → 0.2.48
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 +107 -0
- package/dist/api/types/ai/policy.d.ts +46 -0
- package/dist/api/types/ai/stats.d.ts +5 -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
|
@@ -698,6 +698,21 @@ class ApiClient {
|
|
|
698
698
|
if (query.skip !== undefined) {
|
|
699
699
|
queryParams.append('skip', query.skip.toString());
|
|
700
700
|
}
|
|
701
|
+
if (query.llmType && query.llmType.length > 0) {
|
|
702
|
+
queryParams.append('llmType', query.llmType.join(','));
|
|
703
|
+
}
|
|
704
|
+
if (query.llmModel && query.llmModel.length > 0) {
|
|
705
|
+
queryParams.append('llmModel', query.llmModel.join(','));
|
|
706
|
+
}
|
|
707
|
+
if (query.host && query.host.length > 0) {
|
|
708
|
+
queryParams.append('host', query.host.join(','));
|
|
709
|
+
}
|
|
710
|
+
if (query.severity && query.severity.length > 0) {
|
|
711
|
+
queryParams.append('severity', query.severity.join(','));
|
|
712
|
+
}
|
|
713
|
+
if (query.block !== undefined) {
|
|
714
|
+
queryParams.append('block', query.block.toString());
|
|
715
|
+
}
|
|
701
716
|
return this.makeRequest(`policy/violations?${queryParams.toString()}`, 'GET', null);
|
|
702
717
|
};
|
|
703
718
|
this.getPolicyViolationsByPolicyId = async (policyId, query) => {
|
|
@@ -720,8 +735,88 @@ class ApiClient {
|
|
|
720
735
|
if (query.skip !== undefined) {
|
|
721
736
|
queryParams.append('skip', query.skip.toString());
|
|
722
737
|
}
|
|
738
|
+
if (query.llmType && query.llmType.length > 0) {
|
|
739
|
+
queryParams.append('llmType', query.llmType.join(','));
|
|
740
|
+
}
|
|
741
|
+
if (query.llmModel && query.llmModel.length > 0) {
|
|
742
|
+
queryParams.append('llmModel', query.llmModel.join(','));
|
|
743
|
+
}
|
|
744
|
+
if (query.host && query.host.length > 0) {
|
|
745
|
+
queryParams.append('host', query.host.join(','));
|
|
746
|
+
}
|
|
747
|
+
if (query.severity && query.severity.length > 0) {
|
|
748
|
+
queryParams.append('severity', query.severity.join(','));
|
|
749
|
+
}
|
|
750
|
+
if (query.block !== undefined) {
|
|
751
|
+
queryParams.append('block', query.block.toString());
|
|
752
|
+
}
|
|
723
753
|
return this.makeRequest(`policy/${policyId}/violations${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
|
|
724
754
|
};
|
|
755
|
+
this.getPolicyAlerts = async (query) => {
|
|
756
|
+
const queryParams = new URLSearchParams();
|
|
757
|
+
if (query.workspaceId) {
|
|
758
|
+
queryParams.append('workspaceId', query.workspaceId);
|
|
759
|
+
}
|
|
760
|
+
if (query.repoId) {
|
|
761
|
+
queryParams.append('repoId', query.repoId);
|
|
762
|
+
}
|
|
763
|
+
if (query.policyId) {
|
|
764
|
+
queryParams.append('policyId', query.policyId);
|
|
765
|
+
}
|
|
766
|
+
if (query.from) {
|
|
767
|
+
queryParams.append('from', query.from);
|
|
768
|
+
}
|
|
769
|
+
if (query.to) {
|
|
770
|
+
queryParams.append('to', query.to);
|
|
771
|
+
}
|
|
772
|
+
if (query.take !== undefined) {
|
|
773
|
+
queryParams.append('take', query.take.toString());
|
|
774
|
+
}
|
|
775
|
+
if (query.skip !== undefined) {
|
|
776
|
+
queryParams.append('skip', query.skip.toString());
|
|
777
|
+
}
|
|
778
|
+
if (query.llmType && query.llmType.length > 0) {
|
|
779
|
+
queryParams.append('llmType', query.llmType.join(','));
|
|
780
|
+
}
|
|
781
|
+
if (query.llmModel && query.llmModel.length > 0) {
|
|
782
|
+
queryParams.append('llmModel', query.llmModel.join(','));
|
|
783
|
+
}
|
|
784
|
+
if (query.host && query.host.length > 0) {
|
|
785
|
+
queryParams.append('host', query.host.join(','));
|
|
786
|
+
}
|
|
787
|
+
return this.makeRequest(`policy/alerts?${queryParams.toString()}`, 'GET', null);
|
|
788
|
+
};
|
|
789
|
+
this.getPolicyAlertsByPolicyId = async (policyId, query) => {
|
|
790
|
+
const queryParams = new URLSearchParams();
|
|
791
|
+
if (query.workspaceId) {
|
|
792
|
+
queryParams.append('workspaceId', query.workspaceId);
|
|
793
|
+
}
|
|
794
|
+
if (query.repoId) {
|
|
795
|
+
queryParams.append('repoId', query.repoId);
|
|
796
|
+
}
|
|
797
|
+
if (query.from) {
|
|
798
|
+
queryParams.append('from', query.from);
|
|
799
|
+
}
|
|
800
|
+
if (query.to) {
|
|
801
|
+
queryParams.append('to', query.to);
|
|
802
|
+
}
|
|
803
|
+
if (query.take !== undefined) {
|
|
804
|
+
queryParams.append('take', query.take.toString());
|
|
805
|
+
}
|
|
806
|
+
if (query.skip !== undefined) {
|
|
807
|
+
queryParams.append('skip', query.skip.toString());
|
|
808
|
+
}
|
|
809
|
+
if (query.llmType && query.llmType.length > 0) {
|
|
810
|
+
queryParams.append('llmType', query.llmType.join(','));
|
|
811
|
+
}
|
|
812
|
+
if (query.llmModel && query.llmModel.length > 0) {
|
|
813
|
+
queryParams.append('llmModel', query.llmModel.join(','));
|
|
814
|
+
}
|
|
815
|
+
if (query.host && query.host.length > 0) {
|
|
816
|
+
queryParams.append('host', query.host.join(','));
|
|
817
|
+
}
|
|
818
|
+
return this.makeRequest(`policy/${policyId}/alerts${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
|
|
819
|
+
};
|
|
725
820
|
this.validatePolicies = async (data) => {
|
|
726
821
|
return this.makeRequest('policy/validate', 'POST', data);
|
|
727
822
|
};
|
|
@@ -819,6 +914,12 @@ class ApiClient {
|
|
|
819
914
|
if (params.hosts && params.hosts.length > 0) {
|
|
820
915
|
queryParams.append('hosts', params.hosts.join(','));
|
|
821
916
|
}
|
|
917
|
+
if (params.llmType && params.llmType.length > 0) {
|
|
918
|
+
queryParams.append('llmType', params.llmType.join(','));
|
|
919
|
+
}
|
|
920
|
+
if (params.llmModel && params.llmModel.length > 0) {
|
|
921
|
+
queryParams.append('llmModel', params.llmModel.join(','));
|
|
922
|
+
}
|
|
822
923
|
return this.makeRequest(`aistats/daily?${queryParams.toString()}`, 'GET', null);
|
|
823
924
|
}
|
|
824
925
|
async getAiStatsMinute(params) {
|
|
@@ -841,6 +942,12 @@ class ApiClient {
|
|
|
841
942
|
if (params.hosts && params.hosts.length > 0) {
|
|
842
943
|
queryParams.append('hosts', params.hosts.join(','));
|
|
843
944
|
}
|
|
945
|
+
if (params.llmType && params.llmType.length > 0) {
|
|
946
|
+
queryParams.append('llmType', params.llmType.join(','));
|
|
947
|
+
}
|
|
948
|
+
if (params.llmModel && params.llmModel.length > 0) {
|
|
949
|
+
queryParams.append('llmModel', params.llmModel.join(','));
|
|
950
|
+
}
|
|
844
951
|
return this.makeRequest(`aistats/minute?${queryParams.toString()}`, 'GET', null);
|
|
845
952
|
}
|
|
846
953
|
async getNodeStatsMinute(params) {
|
|
@@ -63,6 +63,11 @@ export interface GetPolicyViolationsQuery {
|
|
|
63
63
|
to?: string;
|
|
64
64
|
take?: number;
|
|
65
65
|
skip?: number;
|
|
66
|
+
llmType?: string[];
|
|
67
|
+
llmModel?: string[];
|
|
68
|
+
host?: string[];
|
|
69
|
+
severity?: RiskType[];
|
|
70
|
+
block?: boolean;
|
|
66
71
|
}
|
|
67
72
|
export interface PolicyViolationDTO {
|
|
68
73
|
id: string;
|
|
@@ -77,6 +82,11 @@ export interface PolicyViolationDTO {
|
|
|
77
82
|
userName: string;
|
|
78
83
|
repoAiApiKeyId: string;
|
|
79
84
|
repoAiApiKeyName: string;
|
|
85
|
+
severity: RiskType | null;
|
|
86
|
+
block: boolean;
|
|
87
|
+
llmType: string;
|
|
88
|
+
llmModel: string;
|
|
89
|
+
host: string;
|
|
80
90
|
}
|
|
81
91
|
export interface GetPolicyViolationsResponse {
|
|
82
92
|
success: boolean;
|
|
@@ -85,6 +95,42 @@ export interface GetPolicyViolationsResponse {
|
|
|
85
95
|
skip: number;
|
|
86
96
|
take: number;
|
|
87
97
|
}
|
|
98
|
+
export interface GetPolicyAlertsQuery {
|
|
99
|
+
workspaceId?: string;
|
|
100
|
+
repoId?: string;
|
|
101
|
+
policyId?: string;
|
|
102
|
+
from?: string;
|
|
103
|
+
to?: string;
|
|
104
|
+
take?: number;
|
|
105
|
+
skip?: number;
|
|
106
|
+
llmType?: string[];
|
|
107
|
+
llmModel?: string[];
|
|
108
|
+
host?: string[];
|
|
109
|
+
}
|
|
110
|
+
export interface PolicyAlertDTO {
|
|
111
|
+
id: string;
|
|
112
|
+
policyId: string;
|
|
113
|
+
policyName: string;
|
|
114
|
+
timestamp: Date;
|
|
115
|
+
message: string;
|
|
116
|
+
conversationId: string | null;
|
|
117
|
+
repoId: string;
|
|
118
|
+
repoName: string;
|
|
119
|
+
userId: string;
|
|
120
|
+
userName: string;
|
|
121
|
+
repoAiApiKeyId: string;
|
|
122
|
+
repoAiApiKeyName: string;
|
|
123
|
+
llmType: string;
|
|
124
|
+
llmModel: string;
|
|
125
|
+
host: string;
|
|
126
|
+
}
|
|
127
|
+
export interface GetPolicyAlertsResponse {
|
|
128
|
+
success: boolean;
|
|
129
|
+
alerts: PolicyAlertDTO[];
|
|
130
|
+
total: number;
|
|
131
|
+
skip: number;
|
|
132
|
+
take: number;
|
|
133
|
+
}
|
|
88
134
|
export interface PolicyToValidate {
|
|
89
135
|
policy_uuid: string;
|
|
90
136
|
content: string;
|
|
@@ -5,6 +5,8 @@ export interface AiStatsQueryParams {
|
|
|
5
5
|
aiLlmId?: string[];
|
|
6
6
|
repoAiApiKeyId?: string[];
|
|
7
7
|
hosts?: string[];
|
|
8
|
+
llmType?: string[];
|
|
9
|
+
llmModel?: string[];
|
|
8
10
|
}
|
|
9
11
|
export interface AiStatsResponse {
|
|
10
12
|
success: boolean;
|
|
@@ -25,6 +27,9 @@ export interface AiStatsData {
|
|
|
25
27
|
policyViolations: number;
|
|
26
28
|
numAlerts: number;
|
|
27
29
|
numBlocks: number;
|
|
30
|
+
numSeverityLow: number;
|
|
31
|
+
numSeverityMedium: number;
|
|
32
|
+
numSeverityHigh: number;
|
|
28
33
|
latency_ms: number;
|
|
29
34
|
llmType: string;
|
|
30
35
|
llmModel: string;
|