@flashbacktech/flashbackclient 0.2.51 → 0.2.53
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 +8 -0
- package/dist/api/client.js +20 -0
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +3 -1
- package/dist/api/types/ai/conversation.d.ts +1 -0
- package/dist/api/types/platform/credits.d.ts +98 -0
- package/dist/api/types/platform/credits.js +5 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { AiLlmStatsResponse, CreateAiLlmRequest, CreateAiLlmResponse, DeleteAiLl
|
|
|
21
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
|
+
import { GetCreditsBalanceResponse, GetCreditsTransactionsRequest, GetCreditsTransactionsResponse, GetCreditsConsumptionRequest, GetCreditsConsumptionResponse, BuyCreditsPackRequest, BuyCreditsPackResponse, GetCreditsPacksResponse, GetCreditsRatesResponse } from './types/platform/credits';
|
|
24
25
|
interface ErrorResponse {
|
|
25
26
|
message?: string;
|
|
26
27
|
[key: string]: any;
|
|
@@ -274,5 +275,12 @@ export declare class ApiClient implements IApiClient {
|
|
|
274
275
|
validatePolicies: (data: PolicyValidationRequest) => Promise<PolicyValidationResponse>;
|
|
275
276
|
recommendPolicies: (data: PolicyRecommendationRequest) => Promise<PolicyRecommendationResponse>;
|
|
276
277
|
getAiModels: (data: GetAiModelsRequest) => Promise<GetAiModelsResponse>;
|
|
278
|
+
getCreditsBalance: () => Promise<GetCreditsBalanceResponse>;
|
|
279
|
+
getCreditsTransactions: (query: GetCreditsTransactionsRequest) => Promise<GetCreditsTransactionsResponse>;
|
|
280
|
+
/** Consumption = transactions with direction 'out' (backend uses same endpoint) */
|
|
281
|
+
getCreditsConsumption: (query: GetCreditsConsumptionRequest) => Promise<GetCreditsConsumptionResponse>;
|
|
282
|
+
buyCreditsPack: (body: BuyCreditsPackRequest) => Promise<BuyCreditsPackResponse>;
|
|
283
|
+
getCreditsPacks: () => Promise<GetCreditsPacksResponse>;
|
|
284
|
+
getCreditsRates: () => Promise<GetCreditsRatesResponse>;
|
|
277
285
|
}
|
|
278
286
|
export {};
|
package/dist/api/client.js
CHANGED
|
@@ -826,6 +826,26 @@ class ApiClient {
|
|
|
826
826
|
this.getAiModels = async (data) => {
|
|
827
827
|
return this.makeRequest('ai/models', 'POST', data);
|
|
828
828
|
};
|
|
829
|
+
////// Credits API calls
|
|
830
|
+
this.getCreditsBalance = async () => {
|
|
831
|
+
return this.makeRequest('credits/balance', 'GET', null);
|
|
832
|
+
};
|
|
833
|
+
this.getCreditsTransactions = async (query) => {
|
|
834
|
+
return this.makeRequest('credits/transactions', 'GET', query);
|
|
835
|
+
};
|
|
836
|
+
/** Consumption = transactions with direction 'out' (backend uses same endpoint) */
|
|
837
|
+
this.getCreditsConsumption = async (query) => {
|
|
838
|
+
return this.makeRequest('credits/transactions', 'GET', { ...query, direction: 'out' });
|
|
839
|
+
};
|
|
840
|
+
this.buyCreditsPack = async (body) => {
|
|
841
|
+
return this.makeRequest('credits/packs/buy', 'POST', body);
|
|
842
|
+
};
|
|
843
|
+
this.getCreditsPacks = async () => {
|
|
844
|
+
return this.makeRequest('credits/packs', 'GET', null);
|
|
845
|
+
};
|
|
846
|
+
this.getCreditsRates = async () => {
|
|
847
|
+
return this.makeRequest('credits/rates', 'GET', null);
|
|
848
|
+
};
|
|
829
849
|
this.baseURL = baseURL;
|
|
830
850
|
this.headers = {};
|
|
831
851
|
this.debug = false;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -22,4 +22,5 @@ import * as PolicyTypes from './types/ai/policy';
|
|
|
22
22
|
import * as ConversationTypes from './types/ai/conversation';
|
|
23
23
|
import * as AiStatsTypes from './types/ai/stats';
|
|
24
24
|
import * as LinksTypes from './types/platform/links';
|
|
25
|
-
|
|
25
|
+
import * as CreditsTypes from './types/platform/credits';
|
|
26
|
+
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, CreditsTypes };
|
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.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;
|
|
36
|
+
exports.CreditsTypes = 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; } });
|
|
@@ -83,3 +83,5 @@ const AiStatsTypes = __importStar(require("./types/ai/stats"));
|
|
|
83
83
|
exports.AiStatsTypes = AiStatsTypes;
|
|
84
84
|
const LinksTypes = __importStar(require("./types/platform/links"));
|
|
85
85
|
exports.LinksTypes = LinksTypes;
|
|
86
|
+
const CreditsTypes = __importStar(require("./types/platform/credits"));
|
|
87
|
+
exports.CreditsTypes = CreditsTypes;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credits API request/response DTOs
|
|
3
|
+
*/
|
|
4
|
+
export interface CreditBalanceData {
|
|
5
|
+
creditBalance: number;
|
|
6
|
+
dateBalance: string | null;
|
|
7
|
+
realtimeBalance: number;
|
|
8
|
+
pendingConsumption: number;
|
|
9
|
+
breakdown: {
|
|
10
|
+
storage: number;
|
|
11
|
+
ai: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface GetCreditsBalanceResponse {
|
|
15
|
+
success: boolean;
|
|
16
|
+
data?: CreditBalanceData;
|
|
17
|
+
error_code?: string;
|
|
18
|
+
message?: string;
|
|
19
|
+
}
|
|
20
|
+
export type CreditTransactionType = 'consumption' | 'purchase' | 'grant';
|
|
21
|
+
export interface CreditTransactionItem {
|
|
22
|
+
id: string;
|
|
23
|
+
creditAmount: number;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
description: string | null;
|
|
26
|
+
type: CreditTransactionType;
|
|
27
|
+
rateType?: string;
|
|
28
|
+
rateConcept?: string;
|
|
29
|
+
rateUsed?: number;
|
|
30
|
+
repoId?: string;
|
|
31
|
+
unitId?: string;
|
|
32
|
+
host?: string;
|
|
33
|
+
llmType?: string;
|
|
34
|
+
llmModel?: string;
|
|
35
|
+
subscriptionName?: string;
|
|
36
|
+
packName?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface CreditTransactionsPagination {
|
|
39
|
+
total: number;
|
|
40
|
+
page: number;
|
|
41
|
+
limit: number;
|
|
42
|
+
}
|
|
43
|
+
export interface GetCreditsTransactionsRequest {
|
|
44
|
+
page?: number;
|
|
45
|
+
limit?: number;
|
|
46
|
+
direction?: 'in' | 'out' | 'all';
|
|
47
|
+
startDate?: string;
|
|
48
|
+
endDate?: string;
|
|
49
|
+
repoId?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface GetCreditsTransactionsResponse {
|
|
52
|
+
success: boolean;
|
|
53
|
+
data?: CreditTransactionItem[];
|
|
54
|
+
pagination?: CreditTransactionsPagination;
|
|
55
|
+
error_code?: string;
|
|
56
|
+
message?: string;
|
|
57
|
+
}
|
|
58
|
+
export type GetCreditsConsumptionRequest = GetCreditsTransactionsRequest;
|
|
59
|
+
export type GetCreditsConsumptionResponse = GetCreditsTransactionsResponse;
|
|
60
|
+
export interface BuyCreditsPackRequest {
|
|
61
|
+
packId: string;
|
|
62
|
+
}
|
|
63
|
+
export interface BuyCreditsPackResponse {
|
|
64
|
+
success: boolean;
|
|
65
|
+
checkoutUrl?: string | null;
|
|
66
|
+
sessionId?: string;
|
|
67
|
+
error_code?: string;
|
|
68
|
+
message?: string;
|
|
69
|
+
nextAvailableAt?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface CreditPackItem {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
code: string;
|
|
75
|
+
credits: number;
|
|
76
|
+
price: number;
|
|
77
|
+
}
|
|
78
|
+
export interface GetCreditsPacksResponse {
|
|
79
|
+
success: boolean;
|
|
80
|
+
data?: CreditPackItem[];
|
|
81
|
+
error_code?: string;
|
|
82
|
+
message?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface CreditRateItem {
|
|
85
|
+
id: string;
|
|
86
|
+
type: string;
|
|
87
|
+
typeCode: string;
|
|
88
|
+
concept: string;
|
|
89
|
+
conceptCode: string;
|
|
90
|
+
unit: string | null;
|
|
91
|
+
rate: number;
|
|
92
|
+
}
|
|
93
|
+
export interface GetCreditsRatesResponse {
|
|
94
|
+
success: boolean;
|
|
95
|
+
data?: CreditRateItem[];
|
|
96
|
+
error_code?: string;
|
|
97
|
+
message?: string;
|
|
98
|
+
}
|