@qwanyx/stack 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/api/client.d.ts +53 -0
- package/dist/auth/index.d.ts +34 -0
- package/dist/client/GraphClient.d.ts +79 -0
- package/dist/components/AnimatedCardFlip.d.ts +19 -0
- package/dist/components/Card.d.ts +13 -0
- package/dist/components/Detail.d.ts +15 -0
- package/dist/components/Stack.d.ts +38 -0
- package/dist/hooks/useMutation.d.ts +16 -0
- package/dist/hooks/useQuery.d.ts +18 -0
- package/dist/index.d.ts +25 -0
- package/dist/operations/index.d.ts +51 -0
- package/dist/types/index.d.ts +170 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ApiConfig, QueryParams } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Generic API Client
|
|
4
|
+
* Framework-agnostic HTTP client for any API
|
|
5
|
+
*/
|
|
6
|
+
export declare class ApiClient {
|
|
7
|
+
private config;
|
|
8
|
+
constructor(config: ApiConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Build query string from params
|
|
11
|
+
*/
|
|
12
|
+
private buildQueryString;
|
|
13
|
+
/**
|
|
14
|
+
* Make HTTP request
|
|
15
|
+
*/
|
|
16
|
+
private request;
|
|
17
|
+
/**
|
|
18
|
+
* GET request
|
|
19
|
+
*/
|
|
20
|
+
get<T = any>(endpoint: string, params?: QueryParams): Promise<T>;
|
|
21
|
+
/**
|
|
22
|
+
* POST request
|
|
23
|
+
*/
|
|
24
|
+
post<T = any>(endpoint: string, body?: any, params?: QueryParams): Promise<T>;
|
|
25
|
+
/**
|
|
26
|
+
* PUT request
|
|
27
|
+
*/
|
|
28
|
+
put<T = any>(endpoint: string, body?: any, params?: QueryParams): Promise<T>;
|
|
29
|
+
/**
|
|
30
|
+
* PATCH request
|
|
31
|
+
*/
|
|
32
|
+
patch<T = any>(endpoint: string, body?: any, params?: QueryParams): Promise<T>;
|
|
33
|
+
/**
|
|
34
|
+
* DELETE request
|
|
35
|
+
*/
|
|
36
|
+
delete<T = any>(endpoint: string, params?: QueryParams): Promise<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Update base URL
|
|
39
|
+
*/
|
|
40
|
+
setBaseUrl(baseUrl: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Get current base URL
|
|
43
|
+
*/
|
|
44
|
+
getBaseUrl(): string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Initialize the API client
|
|
48
|
+
*/
|
|
49
|
+
export declare function initializeApiClient(config: ApiConfig): ApiClient;
|
|
50
|
+
/**
|
|
51
|
+
* Get the API client instance
|
|
52
|
+
*/
|
|
53
|
+
export declare function getApiClient(): ApiClient;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic authentication manager
|
|
3
|
+
* Handles token storage and retrieval
|
|
4
|
+
*/
|
|
5
|
+
export declare class AuthManager {
|
|
6
|
+
/**
|
|
7
|
+
* Store authentication token
|
|
8
|
+
*/
|
|
9
|
+
static setToken(token: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Get authentication token
|
|
12
|
+
*/
|
|
13
|
+
static getToken(): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Remove authentication token
|
|
16
|
+
*/
|
|
17
|
+
static clearToken(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Store refresh token
|
|
20
|
+
*/
|
|
21
|
+
static setRefreshToken(token: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Get refresh token
|
|
24
|
+
*/
|
|
25
|
+
static getRefreshToken(): string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Check if user is authenticated
|
|
28
|
+
*/
|
|
29
|
+
static isAuthenticated(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Get authorization header
|
|
32
|
+
*/
|
|
33
|
+
static getAuthHeader(): Record<string, string>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphClient - Backend Communication Layer
|
|
3
|
+
*
|
|
4
|
+
* Provides a type-safe interface to the qwanyx-brain SPU backend.
|
|
5
|
+
* All operations communicate through the unified `/spu/invoke` endpoint.
|
|
6
|
+
*/
|
|
7
|
+
import type { GraphNode, GraphEdge, GraphClientConfig } from '../types';
|
|
8
|
+
export declare class GraphClient {
|
|
9
|
+
private config;
|
|
10
|
+
constructor(config: GraphClientConfig);
|
|
11
|
+
/**
|
|
12
|
+
* Call the Graph coprocessor
|
|
13
|
+
*/
|
|
14
|
+
private callGraph;
|
|
15
|
+
/**
|
|
16
|
+
* Get auth token from localStorage (browser) or return empty string
|
|
17
|
+
*/
|
|
18
|
+
private getToken;
|
|
19
|
+
/**
|
|
20
|
+
* Get children nodes
|
|
21
|
+
*/
|
|
22
|
+
getChildren(parentId?: string): Promise<GraphNode[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Get a specific node by ID
|
|
25
|
+
*/
|
|
26
|
+
getNode(nodeId: string): Promise<GraphNode | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Add a new node
|
|
29
|
+
*/
|
|
30
|
+
addNode(node: Partial<GraphNode> & {
|
|
31
|
+
p?: string;
|
|
32
|
+
type: string;
|
|
33
|
+
}): Promise<GraphNode>;
|
|
34
|
+
/**
|
|
35
|
+
* Update an existing node
|
|
36
|
+
*/
|
|
37
|
+
updateNode(nodeId: string, updates: Partial<GraphNode>): Promise<GraphNode>;
|
|
38
|
+
/**
|
|
39
|
+
* Delete a node
|
|
40
|
+
*/
|
|
41
|
+
deleteNode(nodeId: string, cascade?: boolean): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Get children with edges (supports different display modes)
|
|
44
|
+
*/
|
|
45
|
+
getChildrenWithEdges(nodeId?: string, displayMode?: 'children' | 'edges' | 'both', edgeType?: string, nodeType?: string): Promise<GraphNode[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Add an edge between two nodes
|
|
48
|
+
*/
|
|
49
|
+
addEdge(sourceId: string | null, targetId: string, edgeType?: string, data?: Record<string, any>): Promise<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Delete an edge
|
|
54
|
+
*/
|
|
55
|
+
deleteEdge(sourceId: string | null, targetId: string, edgeType?: string): Promise<{
|
|
56
|
+
deleted: boolean;
|
|
57
|
+
count: number;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Get edges from a source node
|
|
61
|
+
*/
|
|
62
|
+
getEdges(sourceId: string | null, edgeType?: string): Promise<GraphEdge[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Get ancestors of a node (path from root to node)
|
|
65
|
+
*/
|
|
66
|
+
getAncestors(nodeId: string): Promise<GraphNode[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Get tree structure starting from a root
|
|
69
|
+
*/
|
|
70
|
+
getTree(rootId?: string, maxDepth?: number): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* Move a node to a new parent
|
|
73
|
+
*/
|
|
74
|
+
moveNode(nodeId: string, newParentId?: string): Promise<GraphNode>;
|
|
75
|
+
/**
|
|
76
|
+
* Search nodes by query
|
|
77
|
+
*/
|
|
78
|
+
searchNodes(query: string, type?: string): Promise<GraphNode[]>;
|
|
79
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface AnimatedCardFlipNode {
|
|
2
|
+
_id: string;
|
|
3
|
+
type: string;
|
|
4
|
+
title: string;
|
|
5
|
+
data: {
|
|
6
|
+
name: string;
|
|
7
|
+
image: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface AnimatedCardFlipProps {
|
|
11
|
+
nodes: AnimatedCardFlipNode[];
|
|
12
|
+
cardCount?: number;
|
|
13
|
+
minInterval?: number;
|
|
14
|
+
maxInterval?: number;
|
|
15
|
+
onCardClick?: (node: AnimatedCardFlipNode) => void;
|
|
16
|
+
cardSize?: 'small' | 'medium' | 'large';
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function AnimatedCardFlip({ nodes, cardCount, minInterval, maxInterval, onCardClick, cardSize, className }: AnimatedCardFlipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Card Component for Stack list items
|
|
3
|
+
* Generic design that works with any data type
|
|
4
|
+
*/
|
|
5
|
+
export interface CardProps<T = any> {
|
|
6
|
+
item: T;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
title?: (item: T) => string;
|
|
9
|
+
subtitle?: (item: T) => string;
|
|
10
|
+
image?: (item: T) => string | undefined;
|
|
11
|
+
badge?: (item: T) => string | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare function Card<T = any>({ item, onClick, title, subtitle, image, badge, }: CardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Detail View Component
|
|
3
|
+
* Generic detail view for any item
|
|
4
|
+
*/
|
|
5
|
+
export interface DetailProps<T = any> {
|
|
6
|
+
item: T | null;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
title?: (item: T) => string;
|
|
9
|
+
image?: (item: T) => string | undefined;
|
|
10
|
+
fields?: Array<{
|
|
11
|
+
label: string;
|
|
12
|
+
value: (item: T) => any;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export declare function Detail<T = any>({ item, onClose, title, image, fields, }: DetailProps<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stack Component
|
|
3
|
+
* Apple/Superhuman inspired clean design
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { QueryParams } from '../types';
|
|
7
|
+
export interface StackProps<T = any> {
|
|
8
|
+
endpoint: string;
|
|
9
|
+
params?: QueryParams;
|
|
10
|
+
layout?: 'list' | 'grid' | 'masonry';
|
|
11
|
+
title?: string;
|
|
12
|
+
emptyMessage?: string;
|
|
13
|
+
renderItem?: (item: T, index: number) => React.ReactNode;
|
|
14
|
+
keyExtractor?: (item: T, index: number) => string;
|
|
15
|
+
searchable?: boolean;
|
|
16
|
+
searchFields?: (keyof T)[];
|
|
17
|
+
searchPlaceholder?: string;
|
|
18
|
+
filters?: Array<{
|
|
19
|
+
field: keyof T;
|
|
20
|
+
label: string;
|
|
21
|
+
options?: Array<{
|
|
22
|
+
value: any;
|
|
23
|
+
label: string;
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
pageSize?: number;
|
|
27
|
+
onItemClick?: (item: T) => void;
|
|
28
|
+
onRefresh?: () => void;
|
|
29
|
+
theme?: {
|
|
30
|
+
background?: string;
|
|
31
|
+
cardBackground?: string;
|
|
32
|
+
text?: string;
|
|
33
|
+
textSecondary?: string;
|
|
34
|
+
border?: string;
|
|
35
|
+
primary?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare function Stack<T = any>({ endpoint, params, layout, title, emptyMessage, renderItem, keyExtractor, searchable, searchFields, searchPlaceholder, filters, pageSize, onItemClick, onRefresh, theme, }: StackProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HttpMethod } from '../types';
|
|
2
|
+
export interface UseMutationOptions<TData, TVariables> {
|
|
3
|
+
onSuccess?: (data: TData, variables: TVariables) => void;
|
|
4
|
+
onError?: (error: Error, variables: TVariables) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface UseMutationResult<TData, TVariables> {
|
|
7
|
+
data: TData | null;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
error: Error | null;
|
|
10
|
+
mutate: (variables: TVariables) => Promise<TData | null>;
|
|
11
|
+
reset: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generic hook for mutations (POST, PUT, PATCH, DELETE)
|
|
15
|
+
*/
|
|
16
|
+
export declare function useMutation<TData = any, TVariables = any>(endpoint: string, method?: HttpMethod, options?: UseMutationOptions<TData, TVariables>): UseMutationResult<TData, TVariables>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { QueryParams } from '../types';
|
|
2
|
+
export interface UseQueryOptions<T> {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
refetchOnMount?: boolean;
|
|
5
|
+
onSuccess?: (data: T) => void;
|
|
6
|
+
onError?: (error: Error) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface UseQueryResult<T> {
|
|
9
|
+
data: T | null;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
error: Error | null;
|
|
12
|
+
refetch: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generic hook for fetching data
|
|
16
|
+
* Similar to React Query but simpler
|
|
17
|
+
*/
|
|
18
|
+
export declare function useQuery<T = any>(endpoint: string, params?: QueryParams, options?: UseQueryOptions<T>): UseQueryResult<T>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @qwanyx/stack
|
|
3
|
+
*
|
|
4
|
+
* All-in-one data management system for React applications
|
|
5
|
+
* Combines Graph API + REST API + UI components
|
|
6
|
+
*
|
|
7
|
+
* Like HyperCard, but with React instead of HyperTalk
|
|
8
|
+
*/
|
|
9
|
+
export { GraphClient } from './client/GraphClient';
|
|
10
|
+
export { ApiClient, initializeApiClient, getApiClient } from './api/client';
|
|
11
|
+
export { AuthManager } from './auth';
|
|
12
|
+
export { useQuery } from './hooks/useQuery';
|
|
13
|
+
export type { UseQueryOptions, UseQueryResult } from './hooks/useQuery';
|
|
14
|
+
export { useMutation } from './hooks/useMutation';
|
|
15
|
+
export type { UseMutationOptions, UseMutationResult } from './hooks/useMutation';
|
|
16
|
+
export type { GraphNode, GraphEdge, GraphClientConfig, StackItem, StackConfig, StackContainerProps, StackContext, ViewContext, CardRenderer, ViewRenderer, Editor, EditorProps, StackTheme, LayoutMode, ApiConfig, ApiResponse, PaginationParams, SortParams, FilterParams, QueryParams, PaginatedResponse, HttpMethod, RequestOptions, APIResponse, } from './types';
|
|
17
|
+
export { Stack } from './components/Stack';
|
|
18
|
+
export type { StackProps } from './components/Stack';
|
|
19
|
+
export { Card } from './components/Card';
|
|
20
|
+
export type { CardProps } from './components/Card';
|
|
21
|
+
export { Detail } from './components/Detail';
|
|
22
|
+
export type { DetailProps } from './components/Detail';
|
|
23
|
+
export { AnimatedCardFlip } from './components/AnimatedCardFlip';
|
|
24
|
+
export type { AnimatedCardFlipProps, AnimatedCardFlipNode } from './components/AnimatedCardFlip';
|
|
25
|
+
export { DataOperations } from './operations';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations Layer
|
|
3
|
+
* Client-side data manipulation utilities
|
|
4
|
+
*/
|
|
5
|
+
export declare class DataOperations {
|
|
6
|
+
/**
|
|
7
|
+
* Filter array by predicate function
|
|
8
|
+
*/
|
|
9
|
+
static filter<T>(items: T[], predicate: (item: T) => boolean): T[];
|
|
10
|
+
/**
|
|
11
|
+
* Filter by field value
|
|
12
|
+
*/
|
|
13
|
+
static filterBy<T>(items: T[], field: keyof T, value: any): T[];
|
|
14
|
+
/**
|
|
15
|
+
* Filter by multiple fields
|
|
16
|
+
*/
|
|
17
|
+
static filterByFields<T>(items: T[], filters: Partial<T>): T[];
|
|
18
|
+
/**
|
|
19
|
+
* Sort array by field
|
|
20
|
+
*/
|
|
21
|
+
static sort<T>(items: T[], field: keyof T, order?: 'asc' | 'desc'): T[];
|
|
22
|
+
/**
|
|
23
|
+
* Search items by query string in specified fields
|
|
24
|
+
*/
|
|
25
|
+
static search<T>(items: T[], query: string, fields: (keyof T)[]): T[];
|
|
26
|
+
/**
|
|
27
|
+
* Paginate array
|
|
28
|
+
*/
|
|
29
|
+
static paginate<T>(items: T[], page: number, limit: number): {
|
|
30
|
+
data: T[];
|
|
31
|
+
total: number;
|
|
32
|
+
page: number;
|
|
33
|
+
totalPages: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Group items by field value
|
|
37
|
+
*/
|
|
38
|
+
static groupBy<T>(items: T[], field: keyof T): Record<string, T[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Get unique values for a field
|
|
41
|
+
*/
|
|
42
|
+
static unique<T>(items: T[], field: keyof T): any[];
|
|
43
|
+
/**
|
|
44
|
+
* Count items by field value
|
|
45
|
+
*/
|
|
46
|
+
static countBy<T>(items: T[], field: keyof T): Record<string, number>;
|
|
47
|
+
/**
|
|
48
|
+
* Apply multiple operations in sequence
|
|
49
|
+
*/
|
|
50
|
+
static pipe<T>(items: T[], operations: Array<(items: T[]) => T[]>): T[];
|
|
51
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for Qwanyx Stack
|
|
3
|
+
*/
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
export interface GraphNode {
|
|
6
|
+
_id: string;
|
|
7
|
+
p?: string | null;
|
|
8
|
+
type: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
editor?: string;
|
|
13
|
+
hidden?: boolean;
|
|
14
|
+
archive?: boolean;
|
|
15
|
+
data?: Record<string, any>;
|
|
16
|
+
created?: string;
|
|
17
|
+
modified?: string;
|
|
18
|
+
creator?: string;
|
|
19
|
+
owner?: string;
|
|
20
|
+
owner_group?: string | null;
|
|
21
|
+
permissions?: number;
|
|
22
|
+
acl?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface GraphEdge {
|
|
25
|
+
source_id: string | null;
|
|
26
|
+
target_id: string;
|
|
27
|
+
edge_type: string;
|
|
28
|
+
data?: Record<string, any>;
|
|
29
|
+
created: number;
|
|
30
|
+
modified?: number;
|
|
31
|
+
}
|
|
32
|
+
export type StackItem = GraphNode;
|
|
33
|
+
export interface StackContext {
|
|
34
|
+
apiUrl?: string;
|
|
35
|
+
systemId?: string;
|
|
36
|
+
onNavigate?: (item: StackItem) => void;
|
|
37
|
+
}
|
|
38
|
+
export interface ViewContext {
|
|
39
|
+
onBack?: () => void;
|
|
40
|
+
onEdit?: () => void;
|
|
41
|
+
onDelete?: () => void;
|
|
42
|
+
onOpenChat?: (nodeId: string) => void;
|
|
43
|
+
apiUrl?: string;
|
|
44
|
+
userId?: string;
|
|
45
|
+
graphClient?: any;
|
|
46
|
+
}
|
|
47
|
+
export type CardRenderer = (item: StackItem, context?: StackContext) => ReactNode;
|
|
48
|
+
export type ViewRenderer = (item: StackItem, context?: ViewContext) => ReactNode;
|
|
49
|
+
export interface EditorProps {
|
|
50
|
+
item?: StackItem;
|
|
51
|
+
graphClient: any;
|
|
52
|
+
onSave: (item: StackItem) => void;
|
|
53
|
+
onCancel: () => void;
|
|
54
|
+
onDelete?: () => void;
|
|
55
|
+
apiUrl?: string;
|
|
56
|
+
systemId?: string;
|
|
57
|
+
}
|
|
58
|
+
export type Editor = React.ComponentType<EditorProps>;
|
|
59
|
+
export interface StackConfig {
|
|
60
|
+
id: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
system_id: string;
|
|
63
|
+
parentId?: string;
|
|
64
|
+
displayMode?: 'children' | 'edges' | 'both';
|
|
65
|
+
maxWidth?: string;
|
|
66
|
+
minWidth?: string;
|
|
67
|
+
cardRenderer?: CardRenderer;
|
|
68
|
+
viewRenderer?: ViewRenderer;
|
|
69
|
+
items?: StackItem[];
|
|
70
|
+
loadItems?: () => Promise<StackItem[]>;
|
|
71
|
+
metadata?: {
|
|
72
|
+
hidden?: boolean;
|
|
73
|
+
archive?: boolean;
|
|
74
|
+
originalNode?: any;
|
|
75
|
+
isSelected?: boolean;
|
|
76
|
+
};
|
|
77
|
+
onNavigate?: (item: StackItem) => void;
|
|
78
|
+
onAdd?: () => void;
|
|
79
|
+
onAddRequest?: (data: any) => Promise<void>;
|
|
80
|
+
systemMessage?: {
|
|
81
|
+
type: 'error' | 'warning' | 'info' | 'success';
|
|
82
|
+
message: string;
|
|
83
|
+
details?: string;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface StackProps {
|
|
87
|
+
config: StackConfig;
|
|
88
|
+
onItemClick?: (item: StackItem) => void;
|
|
89
|
+
onClose?: () => void;
|
|
90
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
91
|
+
style?: React.CSSProperties;
|
|
92
|
+
currentView?: StackItem | null;
|
|
93
|
+
viewNode?: any;
|
|
94
|
+
onCloseView?: () => void;
|
|
95
|
+
onAdd?: () => void;
|
|
96
|
+
theme?: StackTheme;
|
|
97
|
+
apiUrl?: string;
|
|
98
|
+
userId?: string;
|
|
99
|
+
onCreateColumn?: (item: StackItem, direction: 'left' | 'right') => void;
|
|
100
|
+
}
|
|
101
|
+
export interface StackTheme {
|
|
102
|
+
primary?: string;
|
|
103
|
+
surface?: string;
|
|
104
|
+
surfaceHover?: string;
|
|
105
|
+
muted?: string;
|
|
106
|
+
text?: string;
|
|
107
|
+
textMuted?: string;
|
|
108
|
+
success?: string;
|
|
109
|
+
error?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface StackContainerProps {
|
|
112
|
+
stacks: StackConfig[];
|
|
113
|
+
defaultViewMode?: 'side' | 'fullscreen' | 'modal';
|
|
114
|
+
maxStacks?: number;
|
|
115
|
+
stackSpacing?: string;
|
|
116
|
+
containerPadding?: string;
|
|
117
|
+
onStackClose?: (stackId: string) => void;
|
|
118
|
+
onStackOpen?: (config: StackConfig) => void;
|
|
119
|
+
style?: React.CSSProperties;
|
|
120
|
+
}
|
|
121
|
+
export type LayoutMode = 'list' | 'grid' | 'masonry';
|
|
122
|
+
export interface GraphClientConfig {
|
|
123
|
+
baseUrl: string;
|
|
124
|
+
system_id: string;
|
|
125
|
+
}
|
|
126
|
+
export interface APIResponse<T = any> {
|
|
127
|
+
success: boolean;
|
|
128
|
+
data?: T;
|
|
129
|
+
result?: T;
|
|
130
|
+
error?: string;
|
|
131
|
+
}
|
|
132
|
+
export interface ApiConfig {
|
|
133
|
+
baseUrl: string;
|
|
134
|
+
timeout?: number;
|
|
135
|
+
headers?: Record<string, string>;
|
|
136
|
+
}
|
|
137
|
+
export interface ApiResponse<T = any> {
|
|
138
|
+
data: T;
|
|
139
|
+
success: boolean;
|
|
140
|
+
message?: string;
|
|
141
|
+
error?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface PaginationParams {
|
|
144
|
+
page?: number;
|
|
145
|
+
limit?: number;
|
|
146
|
+
offset?: number;
|
|
147
|
+
}
|
|
148
|
+
export interface SortParams {
|
|
149
|
+
sortBy?: string;
|
|
150
|
+
sortOrder?: 'asc' | 'desc';
|
|
151
|
+
}
|
|
152
|
+
export interface FilterParams {
|
|
153
|
+
[key: string]: any;
|
|
154
|
+
}
|
|
155
|
+
export interface QueryParams extends PaginationParams, SortParams, FilterParams {
|
|
156
|
+
}
|
|
157
|
+
export interface PaginatedResponse<T = any> {
|
|
158
|
+
data: T[];
|
|
159
|
+
total: number;
|
|
160
|
+
page: number;
|
|
161
|
+
limit: number;
|
|
162
|
+
totalPages: number;
|
|
163
|
+
}
|
|
164
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
165
|
+
export interface RequestOptions {
|
|
166
|
+
method?: HttpMethod;
|
|
167
|
+
headers?: Record<string, string>;
|
|
168
|
+
body?: any;
|
|
169
|
+
params?: QueryParams;
|
|
170
|
+
}
|
package/package.json
CHANGED