weifuwu 0.16.2 → 0.16.4
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/README.md +659 -1294
- package/cli.ts +103 -5
- package/dist/cli.js +98 -5
- package/dist/client-router.d.ts +296 -0
- package/dist/csrf.d.ts +8 -0
- package/dist/hub.d.ts +12 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +405 -83
- package/dist/messager/types.d.ts +2 -0
- package/dist/messager/ws.d.ts +1 -0
- package/dist/serve.d.ts +1 -0
- package/dist/use-action.d.ts +14 -0
- package/dist/use-websocket.d.ts +17 -0
- package/package.json +1 -1
package/dist/messager/types.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { AgentModule } from '../agent/types.ts';
|
|
2
2
|
import type { PostgresClient } from '../postgres/types.ts';
|
|
3
|
+
import type { Redis } from '../vendor.ts';
|
|
3
4
|
export interface MessagerOptions {
|
|
4
5
|
pg: PostgresClient;
|
|
5
6
|
agents?: AgentModule;
|
|
6
7
|
webhookTimeout?: number;
|
|
8
|
+
redis?: Redis;
|
|
7
9
|
}
|
|
8
10
|
export interface Channel {
|
|
9
11
|
id: number;
|
package/dist/messager/ws.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { AgentModule } from '../agent/types.ts';
|
|
|
3
3
|
interface WSDeps {
|
|
4
4
|
sql: Sql<{}>;
|
|
5
5
|
agents?: AgentModule;
|
|
6
|
+
redis?: import('../vendor.ts').Redis;
|
|
6
7
|
}
|
|
7
8
|
export declare function broadcastToChannel(channelId: number, data: any): void;
|
|
8
9
|
export declare function createWSHandler(deps: WSDeps): any;
|
package/dist/serve.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface UseActionOptions<T = any> {
|
|
2
|
+
method?: string;
|
|
3
|
+
headers?: Record<string, string>;
|
|
4
|
+
onSuccess?: (data: T) => void;
|
|
5
|
+
onError?: (err: Error) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface UseActionReturn<T = any> {
|
|
8
|
+
submit: (body?: any) => Promise<T | undefined>;
|
|
9
|
+
data: T | null;
|
|
10
|
+
error: Error | null;
|
|
11
|
+
pending: boolean;
|
|
12
|
+
reset: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function useAction<T = any>(url: string | URL, options?: UseActionOptions<T>): UseActionReturn<T>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type UseWebsocketOptions = {
|
|
2
|
+
onMessage?: (data: string) => void;
|
|
3
|
+
reconnect?: boolean | {
|
|
4
|
+
maxRetries?: number;
|
|
5
|
+
delay?: number;
|
|
6
|
+
};
|
|
7
|
+
protocols?: string | string[];
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type UseWebsocketReturn = {
|
|
11
|
+
send: (data: string | ArrayBuffer | Blob) => void;
|
|
12
|
+
close: () => void;
|
|
13
|
+
readyState: number;
|
|
14
|
+
lastMessage: string | null;
|
|
15
|
+
reconnect: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function useWebsocket(url: string | URL | (() => string | URL | null), options?: UseWebsocketOptions): UseWebsocketReturn;
|