@marshulll/wecom-dual 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marshulll/wecom-dual",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "OpenClaw WeCom channel plugin (intelligent bot + internal app)",
6
6
  "author": "OpenClaw",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marshulll/wecom-dual",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "OpenClaw WeCom channel plugin (intelligent bot + internal app)",
6
6
  "author": "OpenClaw",
@@ -1,5 +1,17 @@
1
1
  import { z } from "zod";
2
2
 
3
+ type JsonSchemaCapable = {
4
+ toJSONSchema?: () => unknown;
5
+ };
6
+
7
+ function ensureJsonSchema<T extends JsonSchemaCapable>(schema: T): T {
8
+ if (typeof schema.toJSONSchema === "function") return schema;
9
+ return Object.assign(schema, {
10
+ // Fallback for runtimes that expect Zod toJSONSchema.
11
+ toJSONSchema: () => ({ type: "object" }),
12
+ });
13
+ }
14
+
3
15
  const allowFromEntry = z.union([z.string(), z.number()]);
4
16
 
5
17
  const dmSchema = z
@@ -46,7 +58,7 @@ const accountSchema = z.object({
46
58
  botMediaBridge: z.boolean().optional(),
47
59
  });
48
60
 
49
- export const WecomConfigSchema = z.object({
61
+ export const WecomConfigSchema = ensureJsonSchema(z.object({
50
62
  name: z.string().optional(),
51
63
  enabled: z.boolean().optional(),
52
64
  mode: z.enum(["bot", "app", "both"]).optional(),
@@ -81,4 +93,4 @@ export const WecomConfigSchema = z.object({
81
93
 
82
94
  defaultAccount: z.string().optional(),
83
95
  accounts: z.object({}).catchall(accountSchema).optional(),
84
- });
96
+ }));