@flashbacktech/flashbackclient 0.2.45 → 0.2.46

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.
@@ -2,6 +2,7 @@ import { CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepo
2
2
  import { IApiClient, ProviderType } from './interfaces';
3
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
+ import { AiStatsQueryParams, AiStatsResponse } from './types/ai/stats';
5
6
  import { NodeInfoResponse, RegisterRequest } from './types/storage/bridge';
6
7
  import { GetOrganizationKeysResponse } from './types/storage/noderegistration';
7
8
  import { QuotaResponse } from './types/platform/quota';
@@ -114,6 +115,8 @@ export declare class ApiClient implements IApiClient {
114
115
  getDailyStats(params: StatsQueryWithBucketParams): Promise<StatsResponse>;
115
116
  getMinuteStats(params: StatsQueryParams): Promise<StatsResponse>;
116
117
  getMinuteStats(params: StatsQueryWithBucketParams): Promise<StatsResponse>;
118
+ getAiStatsDaily(params: AiStatsQueryParams): Promise<AiStatsResponse>;
119
+ getAiStatsMinute(params: AiStatsQueryParams): Promise<AiStatsResponse>;
117
120
  getNodeStatsMinute(params: NodeStatsQueryParams): Promise<NodeStatsMinuteResponse>;
118
121
  getNodeStatsMinute(params: NodeStatsQueryWithBucketParams): Promise<NodeStatsMinuteResponse>;
119
122
  getNodeStatsDaily(params: NodeStatsDailyQueryParams): Promise<NodeStatsDailyResponse>;
@@ -798,6 +798,51 @@ class ApiClient {
798
798
  }
799
799
  return this.makeRequest(`stats/minute?${queryParams.toString()}`, 'GET', null);
800
800
  }
801
+ // AI Stats methods
802
+ async getAiStatsDaily(params) {
803
+ this.validateDateRange(params.startDate, params.endDate);
804
+ const queryParams = new URLSearchParams();
805
+ if (params.startDate) {
806
+ queryParams.append('startDate', params.startDate.toISOString());
807
+ }
808
+ if (params.endDate) {
809
+ queryParams.append('endDate', params.endDate.toISOString());
810
+ }
811
+ if (params.repoId && params.repoId.length > 0)
812
+ queryParams.append('repoId', params.repoId.join(','));
813
+ if (params.aiLlmId && params.aiLlmId.length > 0) {
814
+ queryParams.append('aiLlmId', params.aiLlmId.join(','));
815
+ }
816
+ if (params.repoAiApiKeyId && params.repoAiApiKeyId.length > 0) {
817
+ queryParams.append('repoAiApiKeyId', params.repoAiApiKeyId.join(','));
818
+ }
819
+ if (params.hosts && params.hosts.length > 0) {
820
+ queryParams.append('hosts', params.hosts.join(','));
821
+ }
822
+ return this.makeRequest(`aistats/daily?${queryParams.toString()}`, 'GET', null);
823
+ }
824
+ async getAiStatsMinute(params) {
825
+ this.validateDateRange(params.startDate, params.endDate);
826
+ const queryParams = new URLSearchParams();
827
+ if (params.startDate) {
828
+ queryParams.append('startDate', params.startDate.toISOString());
829
+ }
830
+ if (params.endDate) {
831
+ queryParams.append('endDate', params.endDate.toISOString());
832
+ }
833
+ if (params.repoId && params.repoId.length > 0)
834
+ queryParams.append('repoId', params.repoId.join(','));
835
+ if (params.aiLlmId && params.aiLlmId.length > 0) {
836
+ queryParams.append('aiLlmId', params.aiLlmId.join(','));
837
+ }
838
+ if (params.repoAiApiKeyId && params.repoAiApiKeyId.length > 0) {
839
+ queryParams.append('repoAiApiKeyId', params.repoAiApiKeyId.join(','));
840
+ }
841
+ if (params.hosts && params.hosts.length > 0) {
842
+ queryParams.append('hosts', params.hosts.join(','));
843
+ }
844
+ return this.makeRequest(`aistats/minute?${queryParams.toString()}`, 'GET', null);
845
+ }
801
846
  async getNodeStatsMinute(params) {
802
847
  const queryParams = new URLSearchParams();
803
848
  // Handle both unitId and bucketId
@@ -20,5 +20,6 @@ import * as AiApiKeyTypes from './types/ai/aiapikey';
20
20
  import * as AiLlmTypes from './types/ai/aillm';
21
21
  import * as PolicyTypes from './types/ai/policy';
22
22
  import * as ConversationTypes from './types/ai/conversation';
23
+ import * as AiStatsTypes from './types/ai/stats';
23
24
  import * as LinksTypes from './types/platform/links';
24
- export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes, NodeRegistrationTypes, SystemEventTypes, UserTypes, AiApiKeyTypes, AiLlmTypes, PolicyTypes, ConversationTypes, LinksTypes };
25
+ export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes, NodeRegistrationTypes, SystemEventTypes, UserTypes, AiApiKeyTypes, AiLlmTypes, PolicyTypes, ConversationTypes, AiStatsTypes, LinksTypes };
package/dist/api/index.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.LinksTypes = exports.ConversationTypes = exports.PolicyTypes = exports.AiLlmTypes = exports.AiApiKeyTypes = exports.UserTypes = exports.SystemEventTypes = exports.NodeRegistrationTypes = exports.OrganizationTypes = exports.WorkspaceTypes = exports.RolesTypes = exports.SettingsTypes = exports.MFATypes = exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
36
+ exports.LinksTypes = exports.AiStatsTypes = exports.ConversationTypes = exports.PolicyTypes = exports.AiLlmTypes = exports.AiApiKeyTypes = exports.UserTypes = exports.SystemEventTypes = exports.NodeRegistrationTypes = exports.OrganizationTypes = exports.WorkspaceTypes = exports.RolesTypes = exports.SettingsTypes = exports.MFATypes = exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
37
37
  const client_1 = require("./client");
38
38
  Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return client_1.ApiClient; } });
39
39
  Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return client_1.HttpError; } });
@@ -79,5 +79,7 @@ const PolicyTypes = __importStar(require("./types/ai/policy"));
79
79
  exports.PolicyTypes = PolicyTypes;
80
80
  const ConversationTypes = __importStar(require("./types/ai/conversation"));
81
81
  exports.ConversationTypes = ConversationTypes;
82
+ const AiStatsTypes = __importStar(require("./types/ai/stats"));
83
+ exports.AiStatsTypes = AiStatsTypes;
82
84
  const LinksTypes = __importStar(require("./types/platform/links"));
83
85
  exports.LinksTypes = LinksTypes;
@@ -0,0 +1,32 @@
1
+ export interface AiStatsQueryParams {
2
+ startDate?: Date;
3
+ endDate?: Date;
4
+ repoId?: string[];
5
+ aiLlmId?: string[];
6
+ repoAiApiKeyId?: string[];
7
+ hosts?: string[];
8
+ }
9
+ export interface AiStatsResponse {
10
+ success: boolean;
11
+ data: AiStatsData[];
12
+ message?: string;
13
+ }
14
+ export interface AiStatsData {
15
+ timestamp: number;
16
+ repoId: string;
17
+ aiLlmId: string;
18
+ repoAiApiKeyId: string;
19
+ tokensIn: bigint | string;
20
+ tokensOut: bigint | string;
21
+ llmTokensIn: bigint | string;
22
+ llmTokensOut: bigint | string;
23
+ activeConversations: number;
24
+ apiCalls: number;
25
+ policyViolations: number;
26
+ numAlerts: number;
27
+ numBlocks: number;
28
+ latency_ms: number;
29
+ llmType: string;
30
+ llmModel: string;
31
+ host: string;
32
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -43,6 +43,7 @@ export interface UserProfileResponse {
43
43
  orgRoles: OrgRoles[];
44
44
  validated: boolean;
45
45
  mfaRequired: boolean;
46
+ isBusiness: boolean;
46
47
  };
47
48
  message?: string;
48
49
  error?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.2.45",
3
+ "version": "0.2.46",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"