weifuwu 0.25.2 → 0.27.0
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 +291 -2489
- package/ai/provider.ts +129 -0
- package/ai/stream.ts +63 -0
- package/cli.ts +55 -257
- package/core/cookie.ts +114 -0
- package/core/env.ts +142 -0
- package/core/logger.ts +72 -0
- package/core/router.ts +795 -0
- package/core/serve.ts +294 -0
- package/core/sse.ts +85 -0
- package/core/trace.ts +146 -0
- package/graphql.ts +267 -0
- package/hub.ts +133 -0
- package/index.ts +71 -0
- package/mailer.ts +81 -0
- package/middleware/compress.ts +103 -0
- package/middleware/cors.ts +81 -0
- package/middleware/csrf.ts +112 -0
- package/middleware/flash.ts +144 -0
- package/middleware/health.ts +44 -0
- package/middleware/helmet.ts +98 -0
- package/middleware/i18n.ts +175 -0
- package/middleware/rate-limit.ts +167 -0
- package/middleware/request-id.ts +60 -0
- package/middleware/static.ts +149 -0
- package/middleware/theme.ts +84 -0
- package/middleware/upload.ts +168 -0
- package/middleware/validate.ts +186 -0
- package/package.json +14 -36
- package/postgres/client.ts +132 -0
- package/postgres/index.ts +4 -0
- package/postgres/module.ts +37 -0
- package/postgres/schema/columns.ts +186 -0
- package/postgres/schema/index.ts +36 -0
- package/postgres/schema/sql.ts +39 -0
- package/postgres/schema/table.ts +548 -0
- package/postgres/schema/where.ts +99 -0
- package/postgres/types.ts +48 -0
- package/queue/cron.ts +90 -0
- package/queue/index.ts +654 -0
- package/queue/types.ts +60 -0
- package/redis/client.ts +24 -0
- package/{dist/redis/index.d.ts → redis/index.ts} +2 -2
- package/redis/types.ts +28 -0
- package/types.ts +78 -0
- package/cli/template/app.ts +0 -22
- package/cli/template/index.ts +0 -10
- package/cli/template/locales/en.json +0 -13
- package/cli/template/locales/zh-CN.json +0 -13
- package/cli/template/locales/zh-TW.json +0 -13
- package/cli/template/locales/zh.json +0 -13
- package/cli/template/ui/app/globals.css +0 -2
- package/cli/template/ui/app/layout.tsx +0 -15
- package/cli/template/ui/app/page.tsx +0 -124
- package/cli/template/ui/components/Greeting.tsx +0 -3
- package/dist/agent/client.d.ts +0 -2
- package/dist/agent/index.d.ts +0 -2
- package/dist/agent/rest.d.ts +0 -14
- package/dist/agent/run.d.ts +0 -19
- package/dist/agent/types.d.ts +0 -55
- package/dist/ai/provider.d.ts +0 -45
- package/dist/ai/utils.d.ts +0 -5
- package/dist/ai/workflow.d.ts +0 -17
- package/dist/ai-sdk.d.ts +0 -2
- package/dist/ai.d.ts +0 -13
- package/dist/analytics.d.ts +0 -45
- package/dist/auth.d.ts +0 -22
- package/dist/cache.d.ts +0 -74
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -302
- package/dist/client-locale.d.ts +0 -25
- package/dist/client-pref.d.ts +0 -3
- package/dist/client-router.d.ts +0 -300
- package/dist/client-state.d.ts +0 -22
- package/dist/client-theme.d.ts +0 -36
- package/dist/compile.d.ts +0 -15
- package/dist/compress.d.ts +0 -20
- package/dist/cookie.d.ts +0 -36
- package/dist/cors.d.ts +0 -25
- package/dist/cron-utils.d.ts +0 -73
- package/dist/csrf.d.ts +0 -47
- package/dist/deploy/config.d.ts +0 -2
- package/dist/deploy/gateway.d.ts +0 -2
- package/dist/deploy/index.d.ts +0 -4
- package/dist/deploy/manager.d.ts +0 -16
- package/dist/deploy/process.d.ts +0 -14
- package/dist/deploy/types.d.ts +0 -53
- package/dist/env.d.ts +0 -69
- package/dist/error-boundary.d.ts +0 -2
- package/dist/flash.d.ts +0 -90
- package/dist/fts.d.ts +0 -36
- package/dist/graphql.d.ts +0 -16
- package/dist/head.d.ts +0 -6
- package/dist/health.d.ts +0 -24
- package/dist/helmet.d.ts +0 -33
- package/dist/html-shell.d.ts +0 -1
- package/dist/hub.d.ts +0 -37
- package/dist/i18n.d.ts +0 -39
- package/dist/iii/client.d.ts +0 -2
- package/dist/iii/index.d.ts +0 -4
- package/dist/iii/register-worker.d.ts +0 -9
- package/dist/iii/rest.d.ts +0 -3
- package/dist/iii/stream.d.ts +0 -82
- package/dist/iii/types.d.ts +0 -121
- package/dist/iii/worker.d.ts +0 -2
- package/dist/iii/ws.d.ts +0 -22
- package/dist/index.d.ts +0 -101
- package/dist/index.js +0 -12752
- package/dist/kb/index.d.ts +0 -3
- package/dist/kb/types.d.ts +0 -72
- package/dist/layout.d.ts +0 -2
- package/dist/live.d.ts +0 -7
- package/dist/logdb/client.d.ts +0 -2
- package/dist/logdb/index.d.ts +0 -2
- package/dist/logdb/rest.d.ts +0 -5
- package/dist/logdb/types.d.ts +0 -27
- package/dist/logger.d.ts +0 -16
- package/dist/mailer.d.ts +0 -51
- package/dist/mcp.d.ts +0 -34
- package/dist/messager/agent.d.ts +0 -11
- package/dist/messager/client.d.ts +0 -2
- package/dist/messager/index.d.ts +0 -2
- package/dist/messager/rest.d.ts +0 -15
- package/dist/messager/types.d.ts +0 -57
- package/dist/messager/ws.d.ts +0 -14
- package/dist/module-server.d.ts +0 -9
- package/dist/not-found.d.ts +0 -2
- package/dist/notifier/client.d.ts +0 -2
- package/dist/notifier/index.d.ts +0 -2
- package/dist/notifier/types.d.ts +0 -105
- package/dist/opencode/client.d.ts +0 -2
- package/dist/opencode/index.d.ts +0 -2
- package/dist/opencode/permissions.d.ts +0 -5
- package/dist/opencode/prompt.d.ts +0 -8
- package/dist/opencode/rest.d.ts +0 -16
- package/dist/opencode/run.d.ts +0 -13
- package/dist/opencode/session.d.ts +0 -26
- package/dist/opencode/skills.d.ts +0 -4
- package/dist/opencode/tools/bash.d.ts +0 -6
- package/dist/opencode/tools/edit.d.ts +0 -19
- package/dist/opencode/tools/glob.d.ts +0 -9
- package/dist/opencode/tools/grep.d.ts +0 -17
- package/dist/opencode/tools/index.d.ts +0 -12
- package/dist/opencode/tools/question.d.ts +0 -5
- package/dist/opencode/tools/read.d.ts +0 -16
- package/dist/opencode/tools/skill.d.ts +0 -18
- package/dist/opencode/tools/web.d.ts +0 -18
- package/dist/opencode/tools/write.d.ts +0 -13
- package/dist/opencode/types.d.ts +0 -90
- package/dist/opencode/ws.d.ts +0 -21
- package/dist/permissions.d.ts +0 -51
- package/dist/postgres/client.d.ts +0 -4
- package/dist/postgres/index.d.ts +0 -4
- package/dist/postgres/module.d.ts +0 -17
- package/dist/postgres/schema/columns.d.ts +0 -99
- package/dist/postgres/schema/index.d.ts +0 -6
- package/dist/postgres/schema/sql.d.ts +0 -22
- package/dist/postgres/schema/table.d.ts +0 -141
- package/dist/postgres/schema/where.d.ts +0 -29
- package/dist/postgres/types.d.ts +0 -50
- package/dist/queue/index.d.ts +0 -2
- package/dist/queue/types.d.ts +0 -62
- package/dist/rate-limit.d.ts +0 -45
- package/dist/react.d.ts +0 -14
- package/dist/react.js +0 -751
- package/dist/redis/client.d.ts +0 -2
- package/dist/redis/types.d.ts +0 -18
- package/dist/request-id.d.ts +0 -40
- package/dist/router.d.ts +0 -73
- package/dist/s3.d.ts +0 -68
- package/dist/seo.d.ts +0 -104
- package/dist/serve.d.ts +0 -38
- package/dist/server-registry.d.ts +0 -10
- package/dist/session.d.ts +0 -117
- package/dist/sse.d.ts +0 -47
- package/dist/ssr-entries.d.ts +0 -4
- package/dist/ssr.d.ts +0 -11
- package/dist/static.d.ts +0 -23
- package/dist/stream.d.ts +0 -24
- package/dist/tailwind.d.ts +0 -15
- package/dist/tenant/client.d.ts +0 -2
- package/dist/tenant/graphql.d.ts +0 -3
- package/dist/tenant/index.d.ts +0 -2
- package/dist/tenant/rest.d.ts +0 -3
- package/dist/tenant/schema.d.ts +0 -5
- package/dist/tenant/types.d.ts +0 -48
- package/dist/tenant/utils.d.ts +0 -9
- package/dist/test-utils.d.ts +0 -194
- package/dist/theme.d.ts +0 -31
- package/dist/trace.d.ts +0 -95
- package/dist/tsx-context.d.ts +0 -32
- package/dist/types.d.ts +0 -47
- package/dist/upload.d.ts +0 -55
- package/dist/use-action.d.ts +0 -42
- package/dist/use-agent-stream.d.ts +0 -49
- package/dist/use-flash-message.d.ts +0 -17
- package/dist/use-websocket.d.ts +0 -42
- package/dist/user/client.d.ts +0 -30
- package/dist/user/index.d.ts +0 -2
- package/dist/user/oauth-login.d.ts +0 -21
- package/dist/user/oauth2.d.ts +0 -31
- package/dist/user/types.d.ts +0 -178
- package/dist/validate.d.ts +0 -32
- package/dist/vendor.d.ts +0 -7
- package/dist/webhook.d.ts +0 -79
- package/opencode/ui/app/globals.css +0 -1
- package/opencode/ui/app/layout.tsx +0 -13
- package/opencode/ui/app/page.tsx +0 -523
package/dist/queue/types.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { Redis } from '../vendor.ts';
|
|
2
|
-
import type { Context, Middleware, Closeable } from '../types.ts';
|
|
3
|
-
declare module '../types.ts' {
|
|
4
|
-
interface Context {
|
|
5
|
-
queue: Queue;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export interface QueueJob<T = unknown> {
|
|
9
|
-
id: string;
|
|
10
|
-
type: string;
|
|
11
|
-
payload: T;
|
|
12
|
-
createdAt: number;
|
|
13
|
-
runAt: number;
|
|
14
|
-
schedule?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface QueueOptions {
|
|
17
|
-
/** Backend store. Default: 'memory'. */
|
|
18
|
-
store?: 'memory' | 'pg' | 'redis';
|
|
19
|
-
redis?: Redis;
|
|
20
|
-
url?: string;
|
|
21
|
-
prefix?: string;
|
|
22
|
-
pollInterval?: number;
|
|
23
|
-
/** PostgreSQL client (required when store: 'pg'). */
|
|
24
|
-
pg?: {
|
|
25
|
-
sql: import('../vendor.ts').SqlClient;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export interface QueueInjected {
|
|
29
|
-
queue: Queue;
|
|
30
|
-
}
|
|
31
|
-
export interface QueueJobWithError<T = unknown> extends QueueJob<T> {
|
|
32
|
-
error: string;
|
|
33
|
-
failedAt: number;
|
|
34
|
-
}
|
|
35
|
-
export interface Queue extends Middleware<Context, Context & QueueInjected>, Closeable {
|
|
36
|
-
/** Register a cron job. Uses queue's backend (memory/pg/redis) for execution. */
|
|
37
|
-
cron(pattern: string, handler: () => void | Promise<void>): {
|
|
38
|
-
stop: () => void;
|
|
39
|
-
};
|
|
40
|
-
add<T>(type: string, payload: T, opts?: {
|
|
41
|
-
delay?: number;
|
|
42
|
-
schedule?: string;
|
|
43
|
-
}): Promise<string>;
|
|
44
|
-
process<T>(type: string, handler: (job: QueueJob<T>) => Promise<void>): void;
|
|
45
|
-
run(): Promise<void>;
|
|
46
|
-
stats(): {
|
|
47
|
-
running: boolean;
|
|
48
|
-
inflight: number;
|
|
49
|
-
processed: number;
|
|
50
|
-
failed: number;
|
|
51
|
-
handlers: number;
|
|
52
|
-
maxConcurrent: number;
|
|
53
|
-
};
|
|
54
|
-
jobs(limit?: number): Promise<QueueJob[]>;
|
|
55
|
-
failedJobs(limit?: number): Promise<QueueJobWithError[]>;
|
|
56
|
-
retryFailed(jobId: string): Promise<boolean>;
|
|
57
|
-
retryAllFailed(type?: string): Promise<number>;
|
|
58
|
-
dashboard(): import('../router.ts').Router;
|
|
59
|
-
/** Create the jobs table (PG mode only; safe to call multiple times). */
|
|
60
|
-
migrate?(): Promise<void>;
|
|
61
|
-
close(): Promise<void>;
|
|
62
|
-
}
|
package/dist/rate-limit.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Redis } from './vendor.ts';
|
|
2
|
-
import type { Context, Middleware, Closeable } from './types.ts';
|
|
3
|
-
/** Options for {@link rateLimit}. */
|
|
4
|
-
export interface RateLimitOptions {
|
|
5
|
-
/** Maximum requests within the window (default: 100). */
|
|
6
|
-
max?: number;
|
|
7
|
-
/** Window duration in ms (default: 60000 = 1 minute). */
|
|
8
|
-
window?: number;
|
|
9
|
-
/** Custom key function. Default: IP from `x-forwarded-for` or `x-real-ip` or `cf-connecting-ip`. */
|
|
10
|
-
key?: (req: Request, ctx: Context) => string;
|
|
11
|
-
/** Custom 429 response body." */
|
|
12
|
-
message?: string;
|
|
13
|
-
/** Store backend. `'memory'` (default) or `'redis'`. */
|
|
14
|
-
store?: 'memory' | 'redis';
|
|
15
|
-
/** Redis client (required when `store: 'redis'`). */
|
|
16
|
-
redis?: Redis;
|
|
17
|
-
/** Redis key prefix (default: `'ratelimit:'`). */
|
|
18
|
-
prefix?: string;
|
|
19
|
-
}
|
|
20
|
-
/** Rate limit module — middleware + stats. */
|
|
21
|
-
export interface RateLimitModule extends Middleware<Context, Context>, Closeable {
|
|
22
|
-
stats(): {
|
|
23
|
-
store: string;
|
|
24
|
-
entries?: number;
|
|
25
|
-
maxEntries: number;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Rate limiting middleware (in-memory or Redis-backed).
|
|
30
|
-
*
|
|
31
|
-
* Limits requests per key (default: client IP) within a rolling window.
|
|
32
|
-
* Returns 429 when the limit is exceeded, with `Retry-After` header.
|
|
33
|
-
*
|
|
34
|
-
* ```ts
|
|
35
|
-
* import { rateLimit } from 'weifuwu'
|
|
36
|
-
*
|
|
37
|
-
* // In-memory (single process)
|
|
38
|
-
* app.use(rateLimit({ max: 60, window: 60_000 }))
|
|
39
|
-
*
|
|
40
|
-
* // Redis-backed (multi-process)
|
|
41
|
-
* import { Redis } from 'ioredis'
|
|
42
|
-
* app.use(rateLimit({ store: 'redis', redis: new Redis(), max: 100 }))
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare function rateLimit(options?: RateLimitOptions): RateLimitModule;
|
package/dist/react.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { useWebsocket } from './use-websocket.ts';
|
|
2
|
-
export type { UseWebsocketOptions, UseWebsocketReturn } from './use-websocket.ts';
|
|
3
|
-
export { useAction } from './use-action.ts';
|
|
4
|
-
export type { UseActionOptions, UseActionReturn } from './use-action.ts';
|
|
5
|
-
export { Link, useNavigate, navigate, useNavigating, addInterceptor } from './client-router.ts';
|
|
6
|
-
export { TsxContext, useCtx, setCtx, addCtxRebuilder, useLoaderData } from './tsx-context.ts';
|
|
7
|
-
export { Head } from './head.tsx';
|
|
8
|
-
export { createStore, useFetch, useQueryState } from './client-state.ts';
|
|
9
|
-
export type { StoreApi } from './client-state.ts';
|
|
10
|
-
export { useLocale } from './client-locale.ts';
|
|
11
|
-
export { useTheme, applyTheme } from './client-theme.ts';
|
|
12
|
-
export { useFlashMessage } from './use-flash-message.ts';
|
|
13
|
-
export { useAgentStream } from './use-agent-stream.ts';
|
|
14
|
-
export type { UseAgentStreamOptions, UseAgentStreamReturn, AgentStreamState, } from './use-agent-stream.ts';
|