keryx 0.10.7 → 0.11.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/index.ts +8 -0
- package/initializers/mcp.ts +0 -1
- package/package.json +1 -1
- package/templates/generate/action-middleware.ts.mustache +1 -1
- package/templates/generate/action.ts.mustache +1 -2
- package/templates/scaffold/hello-action.ts.mustache +1 -2
- package/templates/scaffold/keryx.ts.mustache +1 -1
- package/util/glob.ts +2 -20
- package/util/scaffold.ts +2 -2
package/index.ts
CHANGED
|
@@ -18,9 +18,17 @@ import "./initializers/signals";
|
|
|
18
18
|
import "./initializers/swagger";
|
|
19
19
|
|
|
20
20
|
export * from "./api";
|
|
21
|
+
export { HTTP_METHOD } from "./classes/Action";
|
|
21
22
|
export type { ActionMiddleware } from "./classes/Action";
|
|
23
|
+
export { CHANNEL_NAME_PATTERN } from "./classes/Channel";
|
|
24
|
+
export type { ChannelMiddleware } from "./classes/Channel";
|
|
25
|
+
export { LogLevel } from "./classes/Logger";
|
|
22
26
|
export { ErrorStatusCodes, ErrorType, TypedError } from "./classes/TypedError";
|
|
23
27
|
export type { KeryxConfig } from "./config";
|
|
28
|
+
export type { SessionData } from "./initializers/session";
|
|
29
|
+
export { RateLimitMiddleware, checkRateLimit } from "./middleware/rateLimit";
|
|
30
|
+
export type { WebServer } from "./servers/web";
|
|
31
|
+
export { buildProgram } from "./util/cli";
|
|
24
32
|
export { deepMerge, loadFromEnvIfSet } from "./util/config";
|
|
25
33
|
export { globLoader } from "./util/glob";
|
|
26
34
|
export {
|
package/initializers/mcp.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { Action, type ActionParams } from "keryx";
|
|
3
|
-
import { HTTP_METHOD } from "keryx/classes/Action.ts";
|
|
2
|
+
import { Action, type ActionParams, HTTP_METHOD } from "keryx";
|
|
4
3
|
|
|
5
4
|
export class {{className}} implements Action {
|
|
6
5
|
name = "{{name}}";
|
package/util/glob.ts
CHANGED
|
@@ -25,26 +25,8 @@ export async function globLoader<T>(searchDir: string) {
|
|
|
25
25
|
const fullPath = path.join(dir, file);
|
|
26
26
|
const modules = (await import(fullPath)) as Record<string, unknown>;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// per-key access so one TDZ export doesn't block the entire module.
|
|
31
|
-
let entries: [string, unknown][];
|
|
32
|
-
try {
|
|
33
|
-
entries = Object.entries(modules);
|
|
34
|
-
} catch {
|
|
35
|
-
const keys = Object.getOwnPropertyNames(modules);
|
|
36
|
-
entries = [];
|
|
37
|
-
for (const key of keys) {
|
|
38
|
-
try {
|
|
39
|
-
entries.push([key, modules[key]]);
|
|
40
|
-
} catch {
|
|
41
|
-
// Skip TDZ exports — they'll be loaded by their own initializer
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
for (const [name, klass] of entries) {
|
|
47
|
-
// Skip non-class exports (constants, functions, type remnants)
|
|
28
|
+
for (const [name, klass] of Object.entries(modules)) {
|
|
29
|
+
// Skip non-class exports (constants, enums, functions)
|
|
48
30
|
if (typeof klass !== "function" || klass.prototype === undefined) {
|
|
49
31
|
continue;
|
|
50
32
|
}
|
package/util/scaffold.ts
CHANGED
|
@@ -101,7 +101,7 @@ export async function generateConfigFileContents(): Promise<
|
|
|
101
101
|
);
|
|
102
102
|
content = content.replace(
|
|
103
103
|
/from ["']\.\.\/classes\/Logger["']/g,
|
|
104
|
-
'from "keryx
|
|
104
|
+
'from "keryx"',
|
|
105
105
|
);
|
|
106
106
|
|
|
107
107
|
// In index.ts, change `export const config` to `export default`
|
|
@@ -139,7 +139,7 @@ export async function generateBuiltinActionContents(): Promise<
|
|
|
139
139
|
content = content.replace(/from ["']\.\.\/api["']/g, 'from "keryx"');
|
|
140
140
|
content = content.replace(
|
|
141
141
|
/from ["']\.\.\/classes\/Action["']/g,
|
|
142
|
-
'from "keryx
|
|
142
|
+
'from "keryx"',
|
|
143
143
|
);
|
|
144
144
|
content = content.replace(
|
|
145
145
|
/from ["']\.\.\/package\.json["']/g,
|