@vaiftechnologies/vaif-client 0.1.0 → 0.1.1
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/index.d.mts +374 -3
- package/dist/index.d.ts +374 -3
- package/dist/index.js +282 -12
- package/dist/index.mjs +279 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,11 +5,23 @@ interface VaifClientOptions {
|
|
|
5
5
|
/**
|
|
6
6
|
* Your VAIF Studio project ID
|
|
7
7
|
*/
|
|
8
|
-
projectId
|
|
8
|
+
projectId?: string;
|
|
9
9
|
/**
|
|
10
10
|
* API key for authentication (use anon key for client-side)
|
|
11
11
|
*/
|
|
12
|
-
apiKey
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Base URL for API requests (alternative to apiUrl for admin clients)
|
|
15
|
+
*/
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Pre-set access token for authenticated requests
|
|
19
|
+
*/
|
|
20
|
+
accessToken?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Custom header name for API key (default: apikey)
|
|
23
|
+
*/
|
|
24
|
+
apiKeyHeader?: string;
|
|
13
25
|
/**
|
|
14
26
|
* Custom API endpoint (defaults to https://api.vaif.studio)
|
|
15
27
|
*/
|
|
@@ -49,6 +61,7 @@ interface VaifClientOptions {
|
|
|
49
61
|
interface VaifConfig {
|
|
50
62
|
projectId: string;
|
|
51
63
|
apiKey: string;
|
|
64
|
+
apiKeyHeader: string;
|
|
52
65
|
apiUrl: string;
|
|
53
66
|
realtimeUrl: string;
|
|
54
67
|
timeout: number;
|
|
@@ -2418,6 +2431,360 @@ declare class VaifTypeGen {
|
|
|
2418
2431
|
*/
|
|
2419
2432
|
declare function createTypeGen(client: VaifClient): VaifTypeGen;
|
|
2420
2433
|
|
|
2434
|
+
/**
|
|
2435
|
+
* VAIF Admin Client
|
|
2436
|
+
*
|
|
2437
|
+
* Admin-only API endpoints for platform management
|
|
2438
|
+
*/
|
|
2439
|
+
|
|
2440
|
+
interface AdminOverview {
|
|
2441
|
+
users: {
|
|
2442
|
+
total: number;
|
|
2443
|
+
active: number;
|
|
2444
|
+
new24h: number;
|
|
2445
|
+
};
|
|
2446
|
+
orgs: {
|
|
2447
|
+
total: number;
|
|
2448
|
+
active: number;
|
|
2449
|
+
};
|
|
2450
|
+
projects: {
|
|
2451
|
+
total: number;
|
|
2452
|
+
active: number;
|
|
2453
|
+
};
|
|
2454
|
+
requests: {
|
|
2455
|
+
total24h: number;
|
|
2456
|
+
errors24h: number;
|
|
2457
|
+
};
|
|
2458
|
+
revenue: {
|
|
2459
|
+
mrr: number;
|
|
2460
|
+
arr: number;
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
interface AdminUser {
|
|
2464
|
+
id: string;
|
|
2465
|
+
email: string;
|
|
2466
|
+
name: string | null;
|
|
2467
|
+
avatarUrl: string | null;
|
|
2468
|
+
role: string;
|
|
2469
|
+
status: string;
|
|
2470
|
+
createdAt: string;
|
|
2471
|
+
}
|
|
2472
|
+
interface AdminOrg {
|
|
2473
|
+
id: string;
|
|
2474
|
+
name: string;
|
|
2475
|
+
slug: string;
|
|
2476
|
+
plan: string;
|
|
2477
|
+
memberCount: number;
|
|
2478
|
+
projectCount: number;
|
|
2479
|
+
createdAt: string;
|
|
2480
|
+
}
|
|
2481
|
+
interface AdminProject {
|
|
2482
|
+
id: string;
|
|
2483
|
+
name: string;
|
|
2484
|
+
orgId: string;
|
|
2485
|
+
orgName: string;
|
|
2486
|
+
region: string;
|
|
2487
|
+
status: string;
|
|
2488
|
+
createdAt: string;
|
|
2489
|
+
}
|
|
2490
|
+
interface AdminIncident {
|
|
2491
|
+
id: string;
|
|
2492
|
+
title: string;
|
|
2493
|
+
description: string;
|
|
2494
|
+
severity: string;
|
|
2495
|
+
status: string;
|
|
2496
|
+
category: string;
|
|
2497
|
+
createdAt: string;
|
|
2498
|
+
acknowledgedAt: string | null;
|
|
2499
|
+
resolvedAt: string | null;
|
|
2500
|
+
}
|
|
2501
|
+
interface HealthComponent {
|
|
2502
|
+
id: string;
|
|
2503
|
+
name: string;
|
|
2504
|
+
status: string;
|
|
2505
|
+
message: string | null;
|
|
2506
|
+
updatedAt: string;
|
|
2507
|
+
}
|
|
2508
|
+
interface QueueInfo {
|
|
2509
|
+
name: string;
|
|
2510
|
+
waiting: number;
|
|
2511
|
+
active: number;
|
|
2512
|
+
completed: number;
|
|
2513
|
+
failed: number;
|
|
2514
|
+
delayed: number;
|
|
2515
|
+
}
|
|
2516
|
+
interface FeatureFlag {
|
|
2517
|
+
key: string;
|
|
2518
|
+
enabled: boolean;
|
|
2519
|
+
description: string | null;
|
|
2520
|
+
updatedAt: string;
|
|
2521
|
+
}
|
|
2522
|
+
interface Region {
|
|
2523
|
+
key: string;
|
|
2524
|
+
name: string;
|
|
2525
|
+
provider: string;
|
|
2526
|
+
enabled: boolean;
|
|
2527
|
+
}
|
|
2528
|
+
interface AdminAdmin {
|
|
2529
|
+
id: string;
|
|
2530
|
+
userId: string;
|
|
2531
|
+
email: string;
|
|
2532
|
+
name: string | null;
|
|
2533
|
+
role: string;
|
|
2534
|
+
notes: string | null;
|
|
2535
|
+
createdAt: string;
|
|
2536
|
+
}
|
|
2537
|
+
interface AIModel {
|
|
2538
|
+
id: string;
|
|
2539
|
+
modelId: string;
|
|
2540
|
+
provider: string;
|
|
2541
|
+
displayName: string;
|
|
2542
|
+
tier: string;
|
|
2543
|
+
enabled: boolean;
|
|
2544
|
+
inputPrice: number;
|
|
2545
|
+
outputPrice: number;
|
|
2546
|
+
maxTokens: number;
|
|
2547
|
+
contextWindow: number;
|
|
2548
|
+
capabilities: string[];
|
|
2549
|
+
createdAt: string;
|
|
2550
|
+
}
|
|
2551
|
+
interface PromptTemplate {
|
|
2552
|
+
id: string;
|
|
2553
|
+
name: string;
|
|
2554
|
+
category: string;
|
|
2555
|
+
template: string;
|
|
2556
|
+
variables: string[];
|
|
2557
|
+
description: string | null;
|
|
2558
|
+
createdAt: string;
|
|
2559
|
+
}
|
|
2560
|
+
interface AISession {
|
|
2561
|
+
id: string;
|
|
2562
|
+
userId: string;
|
|
2563
|
+
projectId: string;
|
|
2564
|
+
modelId: string;
|
|
2565
|
+
status: string;
|
|
2566
|
+
messageCount: number;
|
|
2567
|
+
totalTokens: number;
|
|
2568
|
+
createdAt: string;
|
|
2569
|
+
}
|
|
2570
|
+
interface GeneratedBackend {
|
|
2571
|
+
id: string;
|
|
2572
|
+
userId: string;
|
|
2573
|
+
projectId: string | null;
|
|
2574
|
+
name: string;
|
|
2575
|
+
description: string | null;
|
|
2576
|
+
status: string;
|
|
2577
|
+
framework: string | null;
|
|
2578
|
+
language: string | null;
|
|
2579
|
+
fileCount: number | null;
|
|
2580
|
+
files: Record<string, string> | null;
|
|
2581
|
+
createdAt: string;
|
|
2582
|
+
}
|
|
2583
|
+
interface ContextSnapshot {
|
|
2584
|
+
id: string;
|
|
2585
|
+
projectId: string;
|
|
2586
|
+
contextType: string;
|
|
2587
|
+
validUntil: string;
|
|
2588
|
+
createdAt: string;
|
|
2589
|
+
}
|
|
2590
|
+
interface CopilotSession {
|
|
2591
|
+
id: string;
|
|
2592
|
+
projectId: string;
|
|
2593
|
+
userId: string;
|
|
2594
|
+
title: string | null;
|
|
2595
|
+
status: string;
|
|
2596
|
+
messageCount: number;
|
|
2597
|
+
totalTokens: number;
|
|
2598
|
+
createdAt: string;
|
|
2599
|
+
}
|
|
2600
|
+
interface CopilotOverview {
|
|
2601
|
+
overview: {
|
|
2602
|
+
totalSessions: number;
|
|
2603
|
+
sessions24h: number;
|
|
2604
|
+
totalMessages: number;
|
|
2605
|
+
messages24h: number;
|
|
2606
|
+
totalCreditsUsed: number;
|
|
2607
|
+
sessionsByStatus: Record<string, number>;
|
|
2608
|
+
};
|
|
2609
|
+
classification: {
|
|
2610
|
+
stats: Array<{
|
|
2611
|
+
method: string;
|
|
2612
|
+
total: number;
|
|
2613
|
+
correct: number;
|
|
2614
|
+
accuracy: string;
|
|
2615
|
+
}>;
|
|
2616
|
+
intentDistribution: Array<{
|
|
2617
|
+
intent: string;
|
|
2618
|
+
count: number;
|
|
2619
|
+
}>;
|
|
2620
|
+
};
|
|
2621
|
+
execution: {
|
|
2622
|
+
total: number;
|
|
2623
|
+
completed: number;
|
|
2624
|
+
failed: number;
|
|
2625
|
+
rolledBack: number;
|
|
2626
|
+
successRate: string;
|
|
2627
|
+
} | null;
|
|
2628
|
+
trends: {
|
|
2629
|
+
dailySessions: Array<{
|
|
2630
|
+
date: string;
|
|
2631
|
+
count: number;
|
|
2632
|
+
}>;
|
|
2633
|
+
};
|
|
2634
|
+
}
|
|
2635
|
+
interface DlqMessage {
|
|
2636
|
+
id: string;
|
|
2637
|
+
queueName: string;
|
|
2638
|
+
data: unknown;
|
|
2639
|
+
error: string;
|
|
2640
|
+
failedAt: string;
|
|
2641
|
+
retryCount: number;
|
|
2642
|
+
}
|
|
2643
|
+
/**
|
|
2644
|
+
* Admin API Client
|
|
2645
|
+
*/
|
|
2646
|
+
declare class VaifAdmin {
|
|
2647
|
+
private client;
|
|
2648
|
+
constructor(client: VaifClient);
|
|
2649
|
+
private request;
|
|
2650
|
+
getOverview(): Promise<AdminOverview>;
|
|
2651
|
+
getSettings(): Promise<{
|
|
2652
|
+
settings: Record<string, unknown>;
|
|
2653
|
+
}>;
|
|
2654
|
+
listUsers(params?: {
|
|
2655
|
+
limit?: number;
|
|
2656
|
+
offset?: number;
|
|
2657
|
+
}): Promise<{
|
|
2658
|
+
users: AdminUser[];
|
|
2659
|
+
total: number;
|
|
2660
|
+
}>;
|
|
2661
|
+
listOrganizations(params?: {
|
|
2662
|
+
limit?: number;
|
|
2663
|
+
offset?: number;
|
|
2664
|
+
}): Promise<{
|
|
2665
|
+
orgs: AdminOrg[];
|
|
2666
|
+
total: number;
|
|
2667
|
+
}>;
|
|
2668
|
+
listProjects(params?: {
|
|
2669
|
+
limit?: number;
|
|
2670
|
+
offset?: number;
|
|
2671
|
+
}): Promise<{
|
|
2672
|
+
projects: AdminProject[];
|
|
2673
|
+
total: number;
|
|
2674
|
+
}>;
|
|
2675
|
+
listIncidents(status?: string): Promise<AdminIncident[]>;
|
|
2676
|
+
createIncident(data: {
|
|
2677
|
+
title: string;
|
|
2678
|
+
description: string;
|
|
2679
|
+
severity: string;
|
|
2680
|
+
category: string;
|
|
2681
|
+
}): Promise<AdminIncident>;
|
|
2682
|
+
acknowledgeIncident(incidentId: string): Promise<void>;
|
|
2683
|
+
resolveIncident(incidentId: string): Promise<void>;
|
|
2684
|
+
getHealthComponents(): Promise<{
|
|
2685
|
+
components: HealthComponent[];
|
|
2686
|
+
}>;
|
|
2687
|
+
updateHealthComponent(name: string, data: {
|
|
2688
|
+
status: string;
|
|
2689
|
+
message?: string;
|
|
2690
|
+
}): Promise<void>;
|
|
2691
|
+
listQueues(): Promise<{
|
|
2692
|
+
queues: QueueInfo[];
|
|
2693
|
+
}>;
|
|
2694
|
+
listFeatureFlags(): Promise<{
|
|
2695
|
+
flags: FeatureFlag[];
|
|
2696
|
+
}>;
|
|
2697
|
+
createFeatureFlag(key: string, enabled: boolean): Promise<FeatureFlag>;
|
|
2698
|
+
updateFeatureFlag(key: string, enabled: boolean): Promise<void>;
|
|
2699
|
+
deleteFeatureFlag(key: string): Promise<void>;
|
|
2700
|
+
listRegions(): Promise<{
|
|
2701
|
+
regions: Region[];
|
|
2702
|
+
}>;
|
|
2703
|
+
updateRegion(key: string, data: {
|
|
2704
|
+
enabled: boolean;
|
|
2705
|
+
}): Promise<void>;
|
|
2706
|
+
listAdmins(): Promise<AdminAdmin[]>;
|
|
2707
|
+
addAdmin(userId: string, role: string, notes?: string): Promise<AdminAdmin>;
|
|
2708
|
+
updateAdmin(adminId: string, data: {
|
|
2709
|
+
role?: string;
|
|
2710
|
+
notes?: string;
|
|
2711
|
+
}): Promise<void>;
|
|
2712
|
+
removeAdmin(adminId: string): Promise<void>;
|
|
2713
|
+
listAIModels(): Promise<{
|
|
2714
|
+
models: AIModel[];
|
|
2715
|
+
}>;
|
|
2716
|
+
createAIModel(data: Partial<AIModel>): Promise<AIModel>;
|
|
2717
|
+
updateAIModel(modelId: string, data: Partial<AIModel>): Promise<void>;
|
|
2718
|
+
toggleAIModel(modelId: string, enabled: boolean, message?: string): Promise<void>;
|
|
2719
|
+
deleteAIModel(modelId: string): Promise<void>;
|
|
2720
|
+
listPromptTemplates(params?: {
|
|
2721
|
+
limit?: number;
|
|
2722
|
+
}): Promise<{
|
|
2723
|
+
templates: PromptTemplate[];
|
|
2724
|
+
}>;
|
|
2725
|
+
createPromptTemplate(data: Partial<PromptTemplate>): Promise<PromptTemplate>;
|
|
2726
|
+
updatePromptTemplate(id: string, data: Partial<PromptTemplate>): Promise<void>;
|
|
2727
|
+
deletePromptTemplate(id: string): Promise<void>;
|
|
2728
|
+
listAISessions(params?: {
|
|
2729
|
+
limit?: number;
|
|
2730
|
+
offset?: number;
|
|
2731
|
+
status?: string;
|
|
2732
|
+
search?: string;
|
|
2733
|
+
}): Promise<{
|
|
2734
|
+
sessions: AISession[];
|
|
2735
|
+
total: number;
|
|
2736
|
+
}>;
|
|
2737
|
+
getAISession(sessionId: string): Promise<{
|
|
2738
|
+
session: AISession;
|
|
2739
|
+
}>;
|
|
2740
|
+
deleteAISession(sessionId: string): Promise<void>;
|
|
2741
|
+
listGeneratedBackends(params?: {
|
|
2742
|
+
limit?: number;
|
|
2743
|
+
offset?: number;
|
|
2744
|
+
search?: string;
|
|
2745
|
+
}): Promise<{
|
|
2746
|
+
backends: GeneratedBackend[];
|
|
2747
|
+
total: number;
|
|
2748
|
+
}>;
|
|
2749
|
+
getGeneratedBackend(backendId: string): Promise<{
|
|
2750
|
+
backend: GeneratedBackend;
|
|
2751
|
+
}>;
|
|
2752
|
+
deleteGeneratedBackend(backendId: string): Promise<void>;
|
|
2753
|
+
listContextSnapshots(params?: {
|
|
2754
|
+
limit?: number;
|
|
2755
|
+
offset?: number;
|
|
2756
|
+
}): Promise<{
|
|
2757
|
+
snapshots: ContextSnapshot[];
|
|
2758
|
+
total: number;
|
|
2759
|
+
}>;
|
|
2760
|
+
invalidateContextSnapshot(snapshotId: string): Promise<void>;
|
|
2761
|
+
deleteContextSnapshot(snapshotId: string): Promise<void>;
|
|
2762
|
+
getCopilotOverview(): Promise<CopilotOverview>;
|
|
2763
|
+
listCopilotSessions(params?: {
|
|
2764
|
+
limit?: number;
|
|
2765
|
+
offset?: number;
|
|
2766
|
+
status?: string;
|
|
2767
|
+
search?: string;
|
|
2768
|
+
}): Promise<{
|
|
2769
|
+
sessions: CopilotSession[];
|
|
2770
|
+
total: number;
|
|
2771
|
+
}>;
|
|
2772
|
+
getCopilotSession(sessionId: string): Promise<{
|
|
2773
|
+
session: CopilotSession;
|
|
2774
|
+
messages: unknown[];
|
|
2775
|
+
plans: unknown[];
|
|
2776
|
+
executions: unknown[];
|
|
2777
|
+
}>;
|
|
2778
|
+
deleteCopilotSession(sessionId: string): Promise<void>;
|
|
2779
|
+
listDlqMessages(params?: {
|
|
2780
|
+
limit?: number;
|
|
2781
|
+
}): Promise<{
|
|
2782
|
+
messages: DlqMessage[];
|
|
2783
|
+
}>;
|
|
2784
|
+
retryDlqMessage(messageId: string): Promise<void>;
|
|
2785
|
+
archiveDlqMessage(messageId: string): Promise<void>;
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2421
2788
|
/**
|
|
2422
2789
|
* VAIF Studio Client
|
|
2423
2790
|
*
|
|
@@ -2478,6 +2845,10 @@ declare class VaifClient {
|
|
|
2478
2845
|
* Type generator for generating TypeScript types from database schema
|
|
2479
2846
|
*/
|
|
2480
2847
|
readonly typegen: VaifTypeGen;
|
|
2848
|
+
/**
|
|
2849
|
+
* Admin client for platform management (admin-only endpoints)
|
|
2850
|
+
*/
|
|
2851
|
+
readonly admin: VaifAdmin;
|
|
2481
2852
|
constructor(options: VaifClientOptions);
|
|
2482
2853
|
/**
|
|
2483
2854
|
* Get current configuration
|
|
@@ -2505,4 +2876,4 @@ declare class VaifClient {
|
|
|
2505
2876
|
debug(...args: unknown[]): void;
|
|
2506
2877
|
}
|
|
2507
2878
|
|
|
2508
|
-
export { type AIGenerateOptions, type ApiError, type ApiResponse, type AuthOptions, type AuthResponse, type Bucket, type ColumnSchema, type DatabaseSchema, type DeleteQuery, type DownloadOptions, type EndpointGenerationResult, type EnumSchema, type FileObject, type FilterOperator, type ForeignKeySchema, type FunctionGenerationResult, type FunctionInvokeOptions, type FunctionResponse, type IndexSchema, type InsertQuery, type OrderDirection, type QueryBuilder$1 as QueryBuilder, RealtimeChannel, type RealtimeEvent, type RealtimeMessage, type RealtimeOptions, type RequestOptions, type SchemaGenerationResult, type SelectQuery, type Session, type SignInCredentials, type SignUpCredentials, type StorageOptions, type SubscriptionCallback, type TableSchema, type TypeGenOptions, type UpdateQuery, type UploadOptions, type User, VaifAI, VaifAuth, VaifClient, type VaifClientOptions, type VaifConfig, VaifDatabase, VaifFunctions, VaifRealtime, VaifStorage, VaifTypeGen, type ViewSchema, createClient, createTypeGen };
|
|
2879
|
+
export { type AIGenerateOptions, type AIModel, type AISession, type AdminAdmin, type AdminIncident, type AdminOrg, type AdminOverview, type AdminProject, type AdminUser, type ApiError, type ApiResponse, type AuthOptions, type AuthResponse, type Bucket, type ColumnSchema, type ContextSnapshot, type CopilotOverview, type CopilotSession, type DatabaseSchema, type DeleteQuery, type DlqMessage, type DownloadOptions, type EndpointGenerationResult, type EnumSchema, type FeatureFlag, type FileObject, type FilterOperator, type ForeignKeySchema, type FunctionGenerationResult, type FunctionInvokeOptions, type FunctionResponse, type GeneratedBackend, type HealthComponent, type IndexSchema, type InsertQuery, type OrderDirection, type PromptTemplate, type QueryBuilder$1 as QueryBuilder, type QueueInfo, RealtimeChannel, type RealtimeEvent, type RealtimeMessage, type RealtimeOptions, type Region, type RequestOptions, type SchemaGenerationResult, type SelectQuery, type Session, type SignInCredentials, type SignUpCredentials, type StorageOptions, type SubscriptionCallback, type TableSchema, type TypeGenOptions, type UpdateQuery, type UploadOptions, type User, VaifAI, VaifAdmin, VaifAuth, VaifClient, type VaifClientOptions, type VaifConfig, VaifDatabase, VaifFunctions, VaifRealtime, VaifStorage, VaifTypeGen, type ViewSchema, createClient, createTypeGen, createClient as createVaifClient };
|