weifuwu 0.24.0 → 0.24.2
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 +970 -756
- package/cli/template/app.ts +5 -1
- package/cli/template/index.ts +4 -1
- package/cli/template/locales/en.json +6 -1
- package/cli/template/locales/zh-CN.json +6 -1
- package/cli/template/locales/zh-TW.json +6 -1
- package/cli/template/locales/zh.json +6 -1
- package/cli/template/ui/app/globals.css +1 -1
- package/cli/template/ui/app/page.tsx +55 -16
- package/cli.ts +148 -104
- package/dist/agent/rest.d.ts +1 -1
- package/dist/agent/run.d.ts +2 -2
- package/dist/agent/types.d.ts +2 -1
- package/dist/ai/workflow.d.ts +1 -1
- package/dist/ai-sdk.d.ts +1 -1
- package/dist/analytics.d.ts +2 -2
- package/dist/cache.d.ts +4 -4
- package/dist/cli.js +135 -97
- package/dist/cookie.d.ts +24 -0
- package/dist/cors.d.ts +2 -2
- package/dist/deploy/types.d.ts +2 -2
- package/dist/fts.d.ts +5 -5
- package/dist/helmet.d.ts +2 -2
- package/dist/hub.d.ts +2 -1
- package/dist/iii/index.d.ts +1 -1
- package/dist/iii/register-worker.d.ts +1 -1
- package/dist/iii/types.d.ts +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.js +905 -442
- package/dist/kb/types.d.ts +8 -0
- package/dist/live.d.ts +2 -3
- package/dist/logdb/rest.d.ts +1 -1
- package/dist/logdb/types.d.ts +2 -1
- package/dist/mailer.d.ts +3 -2
- package/dist/messager/agent.d.ts +2 -2
- package/dist/messager/rest.d.ts +3 -3
- package/dist/messager/types.d.ts +2 -1
- package/dist/messager/ws.d.ts +3 -3
- package/dist/opencode/index.d.ts +1 -1
- package/dist/opencode/permissions.d.ts +1 -1
- package/dist/opencode/run.d.ts +1 -1
- package/dist/opencode/session.d.ts +9 -9
- package/dist/opencode/tools/web.d.ts +1 -1
- package/dist/opencode/types.d.ts +2 -1
- package/dist/opencode/ws.d.ts +1 -2
- package/dist/permissions.d.ts +4 -4
- package/dist/postgres/module.d.ts +5 -4
- package/dist/postgres/schema/index.d.ts +1 -1
- package/dist/postgres/schema/table.d.ts +22 -20
- package/dist/postgres/types.d.ts +6 -6
- package/dist/queue/types.d.ts +3 -3
- package/dist/rate-limit.d.ts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +141 -96
- package/dist/redis/types.d.ts +2 -2
- package/dist/router.d.ts +10 -10
- package/dist/seo.d.ts +2 -2
- package/dist/serve.d.ts +1 -1
- package/dist/session.d.ts +8 -5
- package/dist/tailwind.d.ts +9 -0
- package/dist/tenant/graphql.d.ts +2 -2
- package/dist/tenant/index.d.ts +1 -1
- package/dist/tenant/rest.d.ts +2 -2
- package/dist/tenant/types.d.ts +3 -3
- package/dist/test-utils.d.ts +3 -3
- package/dist/types.d.ts +8 -0
- package/dist/upload.d.ts +4 -2
- package/dist/user/index.d.ts +1 -1
- package/dist/user/oauth-login.d.ts +2 -2
- package/dist/user/types.d.ts +2 -2
- package/dist/vendor.d.ts +4 -0
- package/opencode/ui/app/globals.css +1 -1
- package/opencode/ui/app/layout.tsx +2 -3
- package/opencode/ui/app/page.tsx +302 -73
- package/package.json +33 -10
- package/cli/template/.weifuwu/ssr/2e3a7e60.js +0 -112
package/dist/cli.js
CHANGED
|
@@ -28,7 +28,12 @@ async function cmdInit(name, opts) {
|
|
|
28
28
|
const targetDir = resolve(process.cwd(), name);
|
|
29
29
|
const pkg = await readPkg();
|
|
30
30
|
const v = pkg.version;
|
|
31
|
-
const
|
|
31
|
+
const typeVersions = {
|
|
32
|
+
"@types/react": "^19",
|
|
33
|
+
"@types/react-dom": "^19",
|
|
34
|
+
"@types/node": "^22"
|
|
35
|
+
};
|
|
36
|
+
const depVer = (depName) => typeVersions[depName] || `^${(pkg.devDependencies?.[depName] || "0.0.0").replace(/^\^/, "")}`;
|
|
32
37
|
await mkdir(targetDir, { recursive: true });
|
|
33
38
|
const templateDir = join(pkgRoot, "cli", "template");
|
|
34
39
|
await cp(templateDir, targetDir, { recursive: true });
|
|
@@ -53,23 +58,29 @@ async function cmdInit(name, opts) {
|
|
|
53
58
|
await rmrf(join(targetDir, "locales"));
|
|
54
59
|
} catch {
|
|
55
60
|
}
|
|
56
|
-
await writeFile(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
await writeFile(
|
|
62
|
+
join(targetDir, "app.ts"),
|
|
63
|
+
[
|
|
64
|
+
`import { Router } from 'weifuwu'`,
|
|
65
|
+
``,
|
|
66
|
+
`export const app = new Router()`,
|
|
67
|
+
``,
|
|
68
|
+
`app.get('/', () => new Response('Hello from ${name}!'))`,
|
|
69
|
+
`app.get('/api/ping', () => Response.json({ pong: true, time: new Date().toISOString() }))`,
|
|
70
|
+
``
|
|
71
|
+
].join("\n")
|
|
72
|
+
);
|
|
73
|
+
await writeFile(
|
|
74
|
+
join(targetDir, "index.ts"),
|
|
75
|
+
[
|
|
76
|
+
`import { serve } from 'weifuwu'`,
|
|
77
|
+
`import { app } from './app.ts'`,
|
|
78
|
+
``,
|
|
79
|
+
`const port = Number(process.env.PORT) || 3000`,
|
|
80
|
+
`serve(app.handler(), { port })`,
|
|
81
|
+
``
|
|
82
|
+
].join("\n")
|
|
83
|
+
);
|
|
73
84
|
}
|
|
74
85
|
const deps = { weifuwu: `^${v}` };
|
|
75
86
|
const devDeps = {};
|
|
@@ -81,55 +92,74 @@ async function cmdInit(name, opts) {
|
|
|
81
92
|
devDeps["@types/react-dom"] = depVer("@types/react-dom");
|
|
82
93
|
}
|
|
83
94
|
devDeps["@types/node"] = depVer("@types/node");
|
|
84
|
-
await writeFile(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
await writeFile(
|
|
96
|
+
join(targetDir, "package.json"),
|
|
97
|
+
JSON.stringify(
|
|
98
|
+
{
|
|
99
|
+
name,
|
|
100
|
+
type: "module",
|
|
101
|
+
scripts: {
|
|
102
|
+
dev: "NODE_ENV=development node --watch index.ts",
|
|
103
|
+
start: "node index.ts"
|
|
104
|
+
},
|
|
105
|
+
dependencies: deps,
|
|
106
|
+
devDependencies: devDeps
|
|
107
|
+
},
|
|
108
|
+
null,
|
|
109
|
+
2
|
|
110
|
+
) + "\n"
|
|
111
|
+
);
|
|
94
112
|
const include = opts.minimal ? ["*.ts"] : ["*.ts", "ui/**/*.ts", "ui/**/*.tsx"];
|
|
95
|
-
await writeFile(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
113
|
+
await writeFile(
|
|
114
|
+
join(targetDir, "tsconfig.json"),
|
|
115
|
+
JSON.stringify(
|
|
116
|
+
{
|
|
117
|
+
compilerOptions: {
|
|
118
|
+
target: "ESNext",
|
|
119
|
+
module: "NodeNext",
|
|
120
|
+
moduleResolution: "NodeNext",
|
|
121
|
+
strict: true,
|
|
122
|
+
jsx: "react-jsx",
|
|
123
|
+
skipLibCheck: true,
|
|
124
|
+
noEmit: true,
|
|
125
|
+
allowImportingTsExtensions: true
|
|
126
|
+
},
|
|
127
|
+
include
|
|
128
|
+
},
|
|
129
|
+
null,
|
|
130
|
+
2
|
|
131
|
+
) + "\n"
|
|
132
|
+
);
|
|
108
133
|
await writeFile(join(targetDir, ".gitignore"), "node_modules\ndist\n.env\n.sessions\n.weifuwu\n");
|
|
109
134
|
await writeFile(join(targetDir, ".env"), "PORT=3000\n");
|
|
110
|
-
await writeFile(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
135
|
+
await writeFile(
|
|
136
|
+
join(targetDir, "AGENTS.md"),
|
|
137
|
+
[
|
|
138
|
+
`# ${name}`,
|
|
139
|
+
"",
|
|
140
|
+
`This is a [weifuwu](https://weifuwu.io) application \u2014 pure Node.js, no build step.`,
|
|
141
|
+
"",
|
|
142
|
+
"## Commands",
|
|
143
|
+
"",
|
|
144
|
+
"- `npm run dev` \u2014 start dev server with hot reload",
|
|
145
|
+
"- `npm start` \u2014 start production server",
|
|
146
|
+
"- `npm install` \u2014 install dependencies",
|
|
147
|
+
"- `npx tsc --noEmit` \u2014 type-check",
|
|
148
|
+
"",
|
|
149
|
+
"## API Reference",
|
|
150
|
+
"",
|
|
151
|
+
"See `node_modules/weifuwu/README.md` for the full documentation.",
|
|
152
|
+
""
|
|
153
|
+
].join("\n")
|
|
154
|
+
);
|
|
127
155
|
if (!opts.skipInstall) {
|
|
128
156
|
console.log("\nInstalling dependencies...");
|
|
129
157
|
execSync("npm install", { cwd: targetDir, stdio: "inherit" });
|
|
130
158
|
}
|
|
131
|
-
console.log(
|
|
132
|
-
|
|
159
|
+
console.log(
|
|
160
|
+
`
|
|
161
|
+
\u2705 Created ${name}/ \u2014 cd ${name} && ${opts.skipInstall ? "npm install && " : ""}npm run dev`
|
|
162
|
+
);
|
|
133
163
|
}
|
|
134
164
|
async function cmdDev() {
|
|
135
165
|
const entry = existsSync("index.ts") ? "index.ts" : existsSync("app.ts") ? "app.ts" : null;
|
|
@@ -152,43 +182,49 @@ async function cmdGenerate(type, name) {
|
|
|
152
182
|
process.exit(1);
|
|
153
183
|
}
|
|
154
184
|
await mkdir(dir, { recursive: true });
|
|
155
|
-
await writeFile(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
185
|
+
await writeFile(
|
|
186
|
+
join(dir, "index.ts"),
|
|
187
|
+
[
|
|
188
|
+
`import type { Middleware } from 'weifuwu'`,
|
|
189
|
+
``,
|
|
190
|
+
`export interface ${capitalize(name)}Options {`,
|
|
191
|
+
` // Add your options here`,
|
|
192
|
+
`}`,
|
|
193
|
+
``,
|
|
194
|
+
`export function ${name}(opts?: ${capitalize(name)}Options): Middleware {`,
|
|
195
|
+
` return async (req, ctx, next) => {`,
|
|
196
|
+
` // Your middleware logic here`,
|
|
197
|
+
` return next(req, ctx)`,
|
|
198
|
+
` }`,
|
|
199
|
+
`}`,
|
|
200
|
+
``
|
|
201
|
+
].join("\n")
|
|
202
|
+
);
|
|
170
203
|
await mkdir(join(dir, "..", "test"), { recursive: true });
|
|
171
|
-
await writeFile(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
204
|
+
await writeFile(
|
|
205
|
+
join(dir, "..", "test", `${name}.test.ts`),
|
|
206
|
+
[
|
|
207
|
+
`import { describe, it } from 'node:test'`,
|
|
208
|
+
`import assert from 'node:assert/strict'`,
|
|
209
|
+
`import { ${name} } from '../${name}/index.ts'`,
|
|
210
|
+
`import { Router } from 'weifuwu'`,
|
|
211
|
+
``,
|
|
212
|
+
`describe('${name}', () => {`,
|
|
213
|
+
` it('works as middleware', async () => {`,
|
|
214
|
+
` const app = new Router()`,
|
|
215
|
+
` app.use(${name}())`,
|
|
216
|
+
` app.get('/', () => new Response('ok'))`,
|
|
217
|
+
``,
|
|
218
|
+
` const res = await app.handler()(`,
|
|
219
|
+
` new Request('http://localhost/'),`,
|
|
220
|
+
` { params: {}, query: {} } as any,`,
|
|
221
|
+
` )`,
|
|
222
|
+
` assert.equal(res.status, 200)`,
|
|
223
|
+
` })`,
|
|
224
|
+
`})`,
|
|
225
|
+
``
|
|
226
|
+
].join("\n")
|
|
227
|
+
);
|
|
192
228
|
console.log(`\u2705 Created module ${name}/ with index.ts and test/${name}.test.ts`);
|
|
193
229
|
}
|
|
194
230
|
function capitalize(s) {
|
|
@@ -242,7 +278,9 @@ if (cmd === "version" || cmd === "-v" || cmd === "--version") {
|
|
|
242
278
|
console.error("Usage: npx weifuwu init <name> [--minimal] [--skip-install]");
|
|
243
279
|
process.exit(1);
|
|
244
280
|
}
|
|
245
|
-
cmdInit(name, { minimal: !!values.minimal, skipInstall: !!values["skip-install"] }).catch(
|
|
281
|
+
cmdInit(name, { minimal: !!values.minimal, skipInstall: !!values["skip-install"] }).catch(
|
|
282
|
+
console.error
|
|
283
|
+
);
|
|
246
284
|
} else if (cmd === "dev") {
|
|
247
285
|
cmdDev();
|
|
248
286
|
} else if (cmd === "generate" || cmd === "g") {
|
package/dist/cookie.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Options for setting a cookie. All fields map to standard Set-Cookie attributes. */
|
|
1
2
|
export interface CookieOptions {
|
|
2
3
|
domain?: string;
|
|
3
4
|
path?: string;
|
|
@@ -7,6 +8,29 @@ export interface CookieOptions {
|
|
|
7
8
|
secure?: boolean;
|
|
8
9
|
sameSite?: 'strict' | 'lax' | 'none';
|
|
9
10
|
}
|
|
11
|
+
/** Parse cookies from a Request's `Cookie` header.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const cookies = getCookies(req)
|
|
16
|
+
* console.log(cookies.session_id) // value or undefined
|
|
17
|
+
* ``` */
|
|
10
18
|
export declare function getCookies(req: Request): Record<string, string>;
|
|
19
|
+
/** Set a cookie on a Response.
|
|
20
|
+
*
|
|
21
|
+
* Appends a `Set-Cookie` header to the existing response headers.
|
|
22
|
+
* Returns a new Response with the added header.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const res = new Response('ok')
|
|
27
|
+
* return setCookie(res, 'session', token, { httpOnly: true, path: '/' })
|
|
28
|
+
* ``` */
|
|
11
29
|
export declare function setCookie(res: Response, name: string, value: string, options?: CookieOptions): Response;
|
|
30
|
+
/** Delete a cookie by setting `Max-Age=0`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* return deleteCookie(res, 'session')
|
|
35
|
+
* ``` */
|
|
12
36
|
export declare function deleteCookie(res: Response, name: string, options?: Omit<CookieOptions, 'maxAge'>): Response;
|
package/dist/cors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Middleware } from './types.ts';
|
|
1
|
+
import type { Middleware, Context } from './types.ts';
|
|
2
2
|
/** Options for {@link cors}. */
|
|
3
3
|
export interface CORSOptions {
|
|
4
4
|
/** Allowed origin(s). Default `'*'`. If `credentials: true`, reflects the request origin. */
|
|
@@ -22,4 +22,4 @@ export interface CORSOptions {
|
|
|
22
22
|
* app.use(cors({ origin: 'https://myapp.com', credentials: true }))
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
export declare function cors(options?: CORSOptions): Middleware
|
|
25
|
+
export declare function cors(options?: CORSOptions): Middleware<Context, Context>;
|
package/dist/deploy/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'node:http';
|
|
2
2
|
import type { Duplex } from 'node:stream';
|
|
3
|
-
import type { Handler } from '../types.ts';
|
|
3
|
+
import type { Handler, Closeable } from '../types.ts';
|
|
4
4
|
export interface DeployConfig {
|
|
5
5
|
domain?: string;
|
|
6
6
|
port?: number;
|
|
@@ -27,7 +27,7 @@ export interface AppStatus {
|
|
|
27
27
|
uptime?: number;
|
|
28
28
|
error?: string;
|
|
29
29
|
}
|
|
30
|
-
export interface DeployServer {
|
|
30
|
+
export interface DeployServer extends Closeable {
|
|
31
31
|
close(): Promise<void>;
|
|
32
32
|
ready: Promise<void>;
|
|
33
33
|
url: string;
|
package/dist/fts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SqlClient } from './vendor.ts';
|
|
2
2
|
import type { BoundTable } from './postgres/schema/index.ts';
|
|
3
3
|
export interface FTSSearchResult {
|
|
4
4
|
/** Primary key value */
|
|
@@ -24,12 +24,12 @@ export interface FTSSearchOptions {
|
|
|
24
24
|
rankColumn?: string;
|
|
25
25
|
minRank?: number;
|
|
26
26
|
}
|
|
27
|
-
export declare function createIndex(sql:
|
|
28
|
-
export declare function dropIndex(sql:
|
|
27
|
+
export declare function createIndex(sql: SqlClient, table: BoundTable<any>, fields: string[], options?: FTSCreateIndexOptions): Promise<void>;
|
|
28
|
+
export declare function dropIndex(sql: SqlClient, table: BoundTable<any>, options?: {
|
|
29
29
|
indexName?: string;
|
|
30
30
|
}): Promise<void>;
|
|
31
|
-
export declare function search<T extends Record<string, unknown>>(sql:
|
|
32
|
-
export declare function suggest(sql:
|
|
31
|
+
export declare function search<T extends Record<string, unknown>>(sql: SqlClient, table: BoundTable<T>, query: string, options?: FTSSearchOptions): Promise<FTSSearchResult[]>;
|
|
32
|
+
export declare function suggest(sql: SqlClient, table: BoundTable<any>, prefix: string, options?: {
|
|
33
33
|
field?: string;
|
|
34
34
|
language?: string;
|
|
35
35
|
limit?: number;
|
package/dist/helmet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Middleware } from './types.ts';
|
|
1
|
+
import type { Middleware, Context } from './types.ts';
|
|
2
2
|
/** Options for {@link helmet}. Set any header to `false` to omit it. */
|
|
3
3
|
export interface HelmetOptions {
|
|
4
4
|
/** `Content-Security-Policy` header value. */
|
|
@@ -30,4 +30,4 @@ export interface HelmetOptions {
|
|
|
30
30
|
/** `Permissions-Policy` header value. */
|
|
31
31
|
permissionsPolicy?: string | false;
|
|
32
32
|
}
|
|
33
|
-
export declare function helmet(options?: HelmetOptions): Middleware
|
|
33
|
+
export declare function helmet(options?: HelmetOptions): Middleware<Context, Context>;
|
package/dist/hub.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Redis, WebSocket } from './vendor.ts';
|
|
2
|
+
import type { Closeable } from './types.ts';
|
|
2
3
|
/** Options for {@link createHub}. */
|
|
3
4
|
export interface HubOptions {
|
|
4
5
|
/** Optional Redis client for cross-process pub/sub broadcast. */
|
|
@@ -10,7 +11,7 @@ export interface HubOptions {
|
|
|
10
11
|
* In-memory (and optionally Redis-backed) pub/sub hub for WebSocket rooms.
|
|
11
12
|
*
|
|
12
13
|
* Used internally by the WebSocket handler to implement `ctx.ws.join()` / `ctx.ws.sendRoom()`. */
|
|
13
|
-
export interface Hub {
|
|
14
|
+
export interface Hub extends Closeable {
|
|
14
15
|
/** Subscribe a WebSocket to a room/group. */
|
|
15
16
|
join(key: string, ws: WebSocket): void;
|
|
16
17
|
/** Unsubscribe a WebSocket from all rooms. */
|
package/dist/iii/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { iii } from './client.ts';
|
|
2
2
|
export { createWorker } from './worker.ts';
|
|
3
3
|
export { registerWorker } from './register-worker.ts';
|
|
4
|
-
export type { IIIModule, IIIOptions, Worker, WorkerInfo, FunctionInfo, TriggerInfo, FunctionHandler, FunctionContext, TriggerInput, RemoteWorker } from './types.ts';
|
|
4
|
+
export type { IIIModule, IIIOptions, Worker, WorkerInfo, FunctionInfo, TriggerInfo, FunctionHandler, FunctionContext, TriggerInput, RemoteWorker, } from './types.ts';
|
package/dist/iii/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Router } from '../router.ts';
|
|
2
|
+
import type { Closeable } from '../types.ts';
|
|
2
3
|
import type { Redis } from '../vendor.ts';
|
|
3
4
|
import type { PostgresClient } from '../postgres/types.ts';
|
|
4
5
|
export type FunctionHandler = (payload: unknown, ctx: FunctionContext) => unknown | Promise<unknown>;
|
|
@@ -30,7 +31,7 @@ export interface TriggerOptions {
|
|
|
30
31
|
action?: 'sync' | 'void';
|
|
31
32
|
timeout_ms?: number;
|
|
32
33
|
}
|
|
33
|
-
export interface IIIModule extends Router {
|
|
34
|
+
export interface IIIModule extends Router, Closeable {
|
|
34
35
|
wsHandler: () => any;
|
|
35
36
|
addWorker: (worker: Worker) => void;
|
|
36
37
|
trigger: (request: TriggerRequest) => Promise<unknown>;
|
|
@@ -39,8 +40,6 @@ export interface IIIModule extends Router {
|
|
|
39
40
|
listFunctions: () => FunctionInfo[];
|
|
40
41
|
listTriggers: () => TriggerInfo[];
|
|
41
42
|
migrate: () => Promise<void>;
|
|
42
|
-
shutdown: () => Promise<void>;
|
|
43
|
-
/** Alias for shutdown(). */
|
|
44
43
|
close: () => Promise<void>;
|
|
45
44
|
}
|
|
46
45
|
export interface WorkerInfo {
|
|
@@ -87,7 +86,8 @@ export interface RemoteWorker {
|
|
|
87
86
|
registerTrigger: (input: TriggerInput) => void;
|
|
88
87
|
unregisterTrigger: (functionId: string) => void;
|
|
89
88
|
trigger: (request: TriggerRequest) => Promise<unknown>;
|
|
90
|
-
|
|
89
|
+
/** Cleanup worker resources. */
|
|
90
|
+
close: () => void;
|
|
91
91
|
}
|
|
92
92
|
export interface FunctionRegistration {
|
|
93
93
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export type { AgentOptions, AgentModule, AgentConfig, RunParams, RunResult, Know
|
|
|
57
57
|
export { messager } from './messager/index.ts';
|
|
58
58
|
export type { MessagerOptions, MessagerModule, Channel, ChannelMember, Message, } from './messager/types.ts';
|
|
59
59
|
export { deploy, defineConfig } from './deploy/index.ts';
|
|
60
|
-
export type { DeployConfig, AppConfig, DeployServer, AppStatus
|
|
60
|
+
export type { DeployConfig, AppConfig, DeployServer, AppStatus } from './deploy/types.ts';
|
|
61
61
|
export { opencode } from './opencode/index.ts';
|
|
62
62
|
export type { OpencodeOptions, OpencodeModule, SkillDef, OpencodePermissions, Session as OpencodeSession, } from './opencode/types.ts';
|
|
63
63
|
export { health } from './health.ts';
|
|
@@ -77,20 +77,20 @@ export type { MailerOptions, MailOptions, Mailer } from './mailer.ts';
|
|
|
77
77
|
export { csrf } from './csrf.ts';
|
|
78
78
|
export type { CsrfOptions, CsrfInjected } from './csrf.ts';
|
|
79
79
|
export { logdb } from './logdb/index.ts';
|
|
80
|
-
export type { LogdbOptions, LogdbModule, LogEntry, LogEntryInput
|
|
80
|
+
export type { LogdbOptions, LogdbModule, LogEntry, LogEntryInput } from './logdb/types.ts';
|
|
81
81
|
export { iii, createWorker, registerWorker } from './iii/index.ts';
|
|
82
82
|
export type { IIIModule, IIIOptions, WorkerInfo, FunctionInfo, TriggerInfo, FunctionHandler, FunctionContext, TriggerInput, RemoteWorker, TriggerRequest, } from './iii/types.ts';
|
|
83
83
|
export { ssr } from './ssr.ts';
|
|
84
84
|
export { session, MemoryStore, RedisStore } from './session.ts';
|
|
85
|
-
export type { Session, SessionOptions, SessionStore, SessionData, SessionInjected } from './session.ts';
|
|
85
|
+
export type { Session, SessionOptions, SessionStore, SessionData, SessionInjected, } from './session.ts';
|
|
86
86
|
export { cache, MemoryCache, RedisCache } from './cache.ts';
|
|
87
87
|
export type { CacheOptions, CacheStore, CacheMiddleware, CachedResponse } from './cache.ts';
|
|
88
88
|
export { webhook } from './webhook.ts';
|
|
89
|
-
export type { WebhookOptions, WebhookModule, WebhookEvent, WebhookHandler, PlatformConfig, CustomVerifierConfig } from './webhook.ts';
|
|
89
|
+
export type { WebhookOptions, WebhookModule, WebhookEvent, WebhookHandler, PlatformConfig, CustomVerifierConfig, } from './webhook.ts';
|
|
90
90
|
export * as fts from './fts.ts';
|
|
91
91
|
export { s3 } from './s3.ts';
|
|
92
92
|
export type { S3Options, S3PutOptions, S3UrlOptions, S3Module, S3Body } from './s3.ts';
|
|
93
93
|
export { knowledgeBase } from './kb/index.ts';
|
|
94
|
-
export type { KBOptions, KBIngestOptions, KBSearchResult, KBSearchOptions, KBListEntry, KBModule } from './kb/types.ts';
|
|
94
|
+
export type { KBOptions, KBIngestOptions, KBSearchResult, KBSearchOptions, KBListEntry, KBModule, } from './kb/types.ts';
|
|
95
95
|
export { permissions } from './permissions.ts';
|
|
96
96
|
export type { PermissionsOptions, PermissionsModule } from './permissions.ts';
|