@dexto/core 1.6.26 → 1.7.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/dist/agent/DextoAgent.cjs +75 -90
- package/dist/agent/DextoAgent.d.ts +7 -7
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +76 -91
- package/dist/agent/error-codes.cjs +1 -0
- package/dist/agent/error-codes.d.ts +1 -0
- package/dist/agent/error-codes.d.ts.map +1 -1
- package/dist/agent/error-codes.js +1 -0
- package/dist/agent/errors.cjs +13 -0
- package/dist/agent/errors.d.ts +6 -0
- package/dist/agent/errors.d.ts.map +1 -1
- package/dist/agent/errors.js +13 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/schemas.cjs +5 -5
- package/dist/agent/schemas.d.ts +69 -980
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +5 -5
- package/dist/agent/types.d.ts +11 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/approval/factory.cjs +1 -0
- package/dist/approval/factory.d.ts.map +1 -1
- package/dist/approval/factory.js +1 -0
- package/dist/approval/manager.cjs +19 -6
- package/dist/approval/manager.d.ts +6 -0
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +19 -6
- package/dist/approval/schemas.cjs +16 -6
- package/dist/approval/schemas.d.ts +373 -1044
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +16 -6
- package/dist/approval/session-approval-store.cjs +1 -1
- package/dist/approval/session-approval-store.d.ts +12 -30
- package/dist/approval/session-approval-store.d.ts.map +1 -1
- package/dist/approval/session-approval-store.js +1 -1
- package/dist/events/index.cjs +210 -75
- package/dist/events/index.d.ts +44 -181
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +206 -74
- package/dist/hooks/manager.cjs +5 -2
- package/dist/hooks/manager.d.ts +2 -0
- package/dist/hooks/manager.d.ts.map +1 -1
- package/dist/hooks/manager.js +5 -2
- package/dist/hooks/types.d.ts +3 -0
- package/dist/hooks/types.d.ts.map +1 -1
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/llm/executor/turn-executor.cjs +8 -4
- package/dist/llm/executor/turn-executor.d.ts +3 -1
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +8 -4
- package/dist/llm/providers/local/schemas.d.ts +102 -262
- package/dist/llm/providers/local/schemas.d.ts.map +1 -1
- package/dist/llm/registry/index.d.ts +5 -3
- package/dist/llm/registry/index.d.ts.map +1 -1
- package/dist/llm/resolver.cjs +0 -1
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +0 -1
- package/dist/llm/schemas.d.ts +95 -199
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/services/vercel.cjs +29 -6
- package/dist/llm/services/vercel.d.ts +3 -0
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +27 -5
- package/dist/logger/default-logger-factory.d.ts +28 -256
- package/dist/logger/default-logger-factory.d.ts.map +1 -1
- package/dist/logger/v2/schemas.d.ts +18 -120
- package/dist/logger/v2/schemas.d.ts.map +1 -1
- package/dist/mcp/manager.cjs +7 -2
- package/dist/mcp/manager.d.ts +3 -1
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +7 -2
- package/dist/mcp/mcp-client.cjs +71 -62
- package/dist/mcp/mcp-client.d.ts +3 -2
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +71 -62
- package/dist/mcp/schemas.cjs +4 -4
- package/dist/mcp/schemas.d.ts +77 -270
- package/dist/mcp/schemas.d.ts.map +1 -1
- package/dist/mcp/schemas.js +4 -4
- package/dist/memory/schemas.d.ts +37 -117
- package/dist/memory/schemas.d.ts.map +1 -1
- package/dist/prompts/schemas.d.ts +46 -190
- package/dist/prompts/schemas.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.cjs +22 -3
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.js +22 -3
- package/dist/resources/schemas.d.ts +14 -68
- package/dist/resources/schemas.d.ts.map +1 -1
- package/dist/runtime/host-runtime.cjs +163 -0
- package/dist/runtime/host-runtime.d.ts +19 -0
- package/dist/runtime/host-runtime.d.ts.map +1 -0
- package/dist/runtime/host-runtime.js +133 -0
- package/dist/runtime/index.cjs +42 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +21 -0
- package/dist/runtime/run-context.cjs +53 -0
- package/dist/runtime/run-context.d.ts +13 -0
- package/dist/runtime/run-context.d.ts.map +1 -0
- package/dist/runtime/run-context.js +34 -0
- package/dist/session/chat-session.cjs +30 -32
- package/dist/session/chat-session.d.ts +5 -15
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +31 -33
- package/dist/session/error-codes.cjs +1 -0
- package/dist/session/error-codes.d.ts +2 -1
- package/dist/session/error-codes.d.ts.map +1 -1
- package/dist/session/error-codes.js +1 -0
- package/dist/session/errors.cjs +13 -0
- package/dist/session/errors.d.ts +6 -0
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/errors.js +13 -0
- package/dist/session/schemas.d.ts +1 -7
- package/dist/session/schemas.d.ts.map +1 -1
- package/dist/systemPrompt/schemas.cjs +2 -10
- package/dist/systemPrompt/schemas.d.ts +53 -343
- package/dist/systemPrompt/schemas.d.ts.map +1 -1
- package/dist/systemPrompt/schemas.js +2 -10
- package/dist/telemetry/decorators.cjs +75 -57
- package/dist/telemetry/decorators.d.ts +2 -0
- package/dist/telemetry/decorators.d.ts.map +1 -1
- package/dist/telemetry/decorators.js +75 -57
- package/dist/telemetry/schemas.cjs +1 -1
- package/dist/telemetry/schemas.d.ts +9 -44
- package/dist/telemetry/schemas.d.ts.map +1 -1
- package/dist/telemetry/schemas.js +1 -1
- package/dist/telemetry/utils.cjs +9 -6
- package/dist/telemetry/utils.d.ts +3 -0
- package/dist/telemetry/utils.d.ts.map +1 -1
- package/dist/telemetry/utils.js +9 -6
- package/dist/tools/schemas.cjs +1 -1
- package/dist/tools/schemas.d.ts +19 -62
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +1 -1
- package/dist/tools/session-tool-preferences-store.d.ts +3 -9
- package/dist/tools/session-tool-preferences-store.d.ts.map +1 -1
- package/dist/tools/tool-manager.cjs +92 -36
- package/dist/tools/tool-manager.d.ts +12 -3
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +92 -36
- package/dist/tools/types.d.ts +7 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/result.cjs +11 -8
- package/dist/utils/result.d.ts +6 -6
- package/dist/utils/result.d.ts.map +1 -1
- package/dist/utils/result.js +12 -9
- package/dist/utils/schema.cjs +6 -2
- package/dist/utils/schema.d.ts +2 -7
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +6 -2
- package/dist/utils/zod-schema-converter.cjs +66 -66
- package/dist/utils/zod-schema-converter.d.ts +3 -2
- package/dist/utils/zod-schema-converter.d.ts.map +1 -1
- package/dist/utils/zod-schema-converter.js +66 -66
- package/package.json +4 -5
|
@@ -23,84 +23,84 @@ __export(zod_schema_converter_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(zod_schema_converter_exports);
|
|
25
25
|
var import_zod = require("zod");
|
|
26
|
+
function isJsonSchemaObject(schema) {
|
|
27
|
+
return !!schema && typeof schema === "object" && !Array.isArray(schema);
|
|
28
|
+
}
|
|
29
|
+
function getJsonSchemaTypes(schema) {
|
|
30
|
+
const { type } = schema;
|
|
31
|
+
if (Array.isArray(type)) {
|
|
32
|
+
return type;
|
|
33
|
+
}
|
|
34
|
+
return type ? [type] : [];
|
|
35
|
+
}
|
|
36
|
+
function getJsonSchemaType(schema) {
|
|
37
|
+
const types = getJsonSchemaTypes(schema);
|
|
38
|
+
return types.find((type) => type !== "null") ?? types[0];
|
|
39
|
+
}
|
|
40
|
+
function hasNullableJsonSchemaType(schema) {
|
|
41
|
+
return getJsonSchemaTypes(schema).includes("null");
|
|
42
|
+
}
|
|
43
|
+
function getZodTypeForJsonSchemaType(propSchema, type) {
|
|
44
|
+
switch (type) {
|
|
45
|
+
case "string":
|
|
46
|
+
return import_zod.z.string();
|
|
47
|
+
case "number":
|
|
48
|
+
return import_zod.z.number();
|
|
49
|
+
case "integer":
|
|
50
|
+
return import_zod.z.number().int();
|
|
51
|
+
case "boolean":
|
|
52
|
+
return import_zod.z.boolean();
|
|
53
|
+
case "object":
|
|
54
|
+
return import_zod.z.object(jsonSchemaToZodShape(propSchema));
|
|
55
|
+
case "array": {
|
|
56
|
+
const itemSchema = getPropertySchema(propSchema.items);
|
|
57
|
+
return import_zod.z.array(itemSchema ? getZodTypeFromProperty(itemSchema) : import_zod.z.unknown());
|
|
58
|
+
}
|
|
59
|
+
case "null":
|
|
60
|
+
return import_zod.z.null();
|
|
61
|
+
default:
|
|
62
|
+
return import_zod.z.unknown();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function getPropertySchema(schema) {
|
|
66
|
+
return isJsonSchemaObject(schema) ? schema : null;
|
|
67
|
+
}
|
|
26
68
|
function jsonSchemaToZodShape(jsonSchema) {
|
|
27
|
-
if (!jsonSchema ||
|
|
69
|
+
if (!isJsonSchemaObject(jsonSchema) || getJsonSchemaType(jsonSchema) !== "object") {
|
|
28
70
|
return {};
|
|
29
71
|
}
|
|
30
72
|
const shape = {};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
zodType = import_zod.z.string();
|
|
38
|
-
break;
|
|
39
|
-
case "number":
|
|
40
|
-
zodType = import_zod.z.number();
|
|
41
|
-
break;
|
|
42
|
-
case "integer":
|
|
43
|
-
zodType = import_zod.z.number().int();
|
|
44
|
-
break;
|
|
45
|
-
case "boolean":
|
|
46
|
-
zodType = import_zod.z.boolean();
|
|
47
|
-
break;
|
|
48
|
-
case "array":
|
|
49
|
-
if (propSchema.items) {
|
|
50
|
-
const itemType = getZodTypeFromProperty(propSchema.items);
|
|
51
|
-
zodType = import_zod.z.array(itemType);
|
|
52
|
-
} else {
|
|
53
|
-
zodType = import_zod.z.array(import_zod.z.any());
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
case "object":
|
|
57
|
-
zodType = import_zod.z.object(jsonSchemaToZodShape(propSchema));
|
|
58
|
-
break;
|
|
59
|
-
default:
|
|
60
|
-
zodType = import_zod.z.any();
|
|
61
|
-
}
|
|
62
|
-
if (propSchema.description) {
|
|
63
|
-
zodType._def.description = propSchema.description;
|
|
64
|
-
zodType = zodType.describe(propSchema.description);
|
|
65
|
-
}
|
|
66
|
-
if (!jsonSchema.required || !jsonSchema.required.includes(key)) {
|
|
67
|
-
zodType = zodType.optional();
|
|
68
|
-
}
|
|
69
|
-
shape[key] = zodType;
|
|
73
|
+
const properties = jsonSchema.properties ?? {};
|
|
74
|
+
for (const [key, property] of Object.entries(properties)) {
|
|
75
|
+
const propSchema = getPropertySchema(property);
|
|
76
|
+
let zodType = propSchema ? getZodTypeFromProperty(propSchema) : import_zod.z.unknown();
|
|
77
|
+
if (!Array.isArray(jsonSchema.required) || !jsonSchema.required.includes(key)) {
|
|
78
|
+
zodType = zodType.optional();
|
|
70
79
|
}
|
|
80
|
+
shape[key] = zodType;
|
|
71
81
|
}
|
|
72
82
|
return shape;
|
|
73
83
|
}
|
|
74
84
|
function getZodTypeFromProperty(propSchema) {
|
|
85
|
+
const nonNullTypes = getJsonSchemaTypes(propSchema).filter(
|
|
86
|
+
(type) => type !== "null"
|
|
87
|
+
);
|
|
75
88
|
let zodType;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
zodType = import_zod.z.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
case "object":
|
|
90
|
-
zodType = import_zod.z.object(jsonSchemaToZodShape(propSchema));
|
|
91
|
-
break;
|
|
92
|
-
case "array":
|
|
93
|
-
if (propSchema.items) {
|
|
94
|
-
zodType = import_zod.z.array(getZodTypeFromProperty(propSchema.items));
|
|
95
|
-
} else {
|
|
96
|
-
zodType = import_zod.z.array(import_zod.z.any());
|
|
97
|
-
}
|
|
98
|
-
break;
|
|
99
|
-
default:
|
|
100
|
-
zodType = import_zod.z.any();
|
|
89
|
+
if (nonNullTypes.length === 0) {
|
|
90
|
+
zodType = hasNullableJsonSchemaType(propSchema) ? import_zod.z.null() : import_zod.z.unknown();
|
|
91
|
+
} else {
|
|
92
|
+
const zodTypes = nonNullTypes.map((type) => getZodTypeForJsonSchemaType(propSchema, type));
|
|
93
|
+
const [firstType, secondType, ...restTypes] = zodTypes;
|
|
94
|
+
if (!firstType) {
|
|
95
|
+
zodType = import_zod.z.unknown();
|
|
96
|
+
} else {
|
|
97
|
+
zodType = secondType ? import_zod.z.union([firstType, secondType, ...restTypes]) : firstType;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (hasNullableJsonSchemaType(propSchema) && nonNullTypes.length > 0) {
|
|
101
|
+
zodType = zodType.nullable();
|
|
101
102
|
}
|
|
102
103
|
if (propSchema.description) {
|
|
103
|
-
zodType._def.description = propSchema.description;
|
|
104
104
|
zodType = zodType.describe(propSchema.description);
|
|
105
105
|
}
|
|
106
106
|
return zodType;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
2
3
|
/**
|
|
3
4
|
* Converts a JSON Schema object to a Zod raw shape.
|
|
4
5
|
* This is a simplified converter that handles common MCP tool schemas.
|
|
5
6
|
*/
|
|
6
|
-
export declare function jsonSchemaToZodShape(jsonSchema:
|
|
7
|
+
export declare function jsonSchemaToZodShape(jsonSchema: unknown): z.ZodRawShape;
|
|
7
8
|
/**
|
|
8
9
|
* Helper function to get a Zod type from a property schema
|
|
9
10
|
*/
|
|
10
|
-
export declare function getZodTypeFromProperty(propSchema:
|
|
11
|
+
export declare function getZodTypeFromProperty(propSchema: JSONSchema7): z.ZodType;
|
|
11
12
|
//# sourceMappingURL=zod-schema-converter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-schema-converter.d.ts","sourceRoot":"","sources":["../../src/utils/zod-schema-converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"zod-schema-converter.d.ts","sourceRoot":"","sources":["../../src/utils/zod-schema-converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAA8C,MAAM,aAAa,CAAC;AAuD3F;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,GAAG,CAAC,CAAC,WAAW,CAoBvE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,WAAW,GAAG,CAAC,CAAC,OAAO,CA2BzE"}
|
|
@@ -1,83 +1,83 @@
|
|
|
1
1
|
import "../chunk-PTJYTZNU.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
function isJsonSchemaObject(schema) {
|
|
4
|
+
return !!schema && typeof schema === "object" && !Array.isArray(schema);
|
|
5
|
+
}
|
|
6
|
+
function getJsonSchemaTypes(schema) {
|
|
7
|
+
const { type } = schema;
|
|
8
|
+
if (Array.isArray(type)) {
|
|
9
|
+
return type;
|
|
10
|
+
}
|
|
11
|
+
return type ? [type] : [];
|
|
12
|
+
}
|
|
13
|
+
function getJsonSchemaType(schema) {
|
|
14
|
+
const types = getJsonSchemaTypes(schema);
|
|
15
|
+
return types.find((type) => type !== "null") ?? types[0];
|
|
16
|
+
}
|
|
17
|
+
function hasNullableJsonSchemaType(schema) {
|
|
18
|
+
return getJsonSchemaTypes(schema).includes("null");
|
|
19
|
+
}
|
|
20
|
+
function getZodTypeForJsonSchemaType(propSchema, type) {
|
|
21
|
+
switch (type) {
|
|
22
|
+
case "string":
|
|
23
|
+
return z.string();
|
|
24
|
+
case "number":
|
|
25
|
+
return z.number();
|
|
26
|
+
case "integer":
|
|
27
|
+
return z.number().int();
|
|
28
|
+
case "boolean":
|
|
29
|
+
return z.boolean();
|
|
30
|
+
case "object":
|
|
31
|
+
return z.object(jsonSchemaToZodShape(propSchema));
|
|
32
|
+
case "array": {
|
|
33
|
+
const itemSchema = getPropertySchema(propSchema.items);
|
|
34
|
+
return z.array(itemSchema ? getZodTypeFromProperty(itemSchema) : z.unknown());
|
|
35
|
+
}
|
|
36
|
+
case "null":
|
|
37
|
+
return z.null();
|
|
38
|
+
default:
|
|
39
|
+
return z.unknown();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function getPropertySchema(schema) {
|
|
43
|
+
return isJsonSchemaObject(schema) ? schema : null;
|
|
44
|
+
}
|
|
3
45
|
function jsonSchemaToZodShape(jsonSchema) {
|
|
4
|
-
if (!jsonSchema ||
|
|
46
|
+
if (!isJsonSchemaObject(jsonSchema) || getJsonSchemaType(jsonSchema) !== "object") {
|
|
5
47
|
return {};
|
|
6
48
|
}
|
|
7
49
|
const shape = {};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
zodType = z.string();
|
|
15
|
-
break;
|
|
16
|
-
case "number":
|
|
17
|
-
zodType = z.number();
|
|
18
|
-
break;
|
|
19
|
-
case "integer":
|
|
20
|
-
zodType = z.number().int();
|
|
21
|
-
break;
|
|
22
|
-
case "boolean":
|
|
23
|
-
zodType = z.boolean();
|
|
24
|
-
break;
|
|
25
|
-
case "array":
|
|
26
|
-
if (propSchema.items) {
|
|
27
|
-
const itemType = getZodTypeFromProperty(propSchema.items);
|
|
28
|
-
zodType = z.array(itemType);
|
|
29
|
-
} else {
|
|
30
|
-
zodType = z.array(z.any());
|
|
31
|
-
}
|
|
32
|
-
break;
|
|
33
|
-
case "object":
|
|
34
|
-
zodType = z.object(jsonSchemaToZodShape(propSchema));
|
|
35
|
-
break;
|
|
36
|
-
default:
|
|
37
|
-
zodType = z.any();
|
|
38
|
-
}
|
|
39
|
-
if (propSchema.description) {
|
|
40
|
-
zodType._def.description = propSchema.description;
|
|
41
|
-
zodType = zodType.describe(propSchema.description);
|
|
42
|
-
}
|
|
43
|
-
if (!jsonSchema.required || !jsonSchema.required.includes(key)) {
|
|
44
|
-
zodType = zodType.optional();
|
|
45
|
-
}
|
|
46
|
-
shape[key] = zodType;
|
|
50
|
+
const properties = jsonSchema.properties ?? {};
|
|
51
|
+
for (const [key, property] of Object.entries(properties)) {
|
|
52
|
+
const propSchema = getPropertySchema(property);
|
|
53
|
+
let zodType = propSchema ? getZodTypeFromProperty(propSchema) : z.unknown();
|
|
54
|
+
if (!Array.isArray(jsonSchema.required) || !jsonSchema.required.includes(key)) {
|
|
55
|
+
zodType = zodType.optional();
|
|
47
56
|
}
|
|
57
|
+
shape[key] = zodType;
|
|
48
58
|
}
|
|
49
59
|
return shape;
|
|
50
60
|
}
|
|
51
61
|
function getZodTypeFromProperty(propSchema) {
|
|
62
|
+
const nonNullTypes = getJsonSchemaTypes(propSchema).filter(
|
|
63
|
+
(type) => type !== "null"
|
|
64
|
+
);
|
|
52
65
|
let zodType;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
zodType = z.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
case "object":
|
|
67
|
-
zodType = z.object(jsonSchemaToZodShape(propSchema));
|
|
68
|
-
break;
|
|
69
|
-
case "array":
|
|
70
|
-
if (propSchema.items) {
|
|
71
|
-
zodType = z.array(getZodTypeFromProperty(propSchema.items));
|
|
72
|
-
} else {
|
|
73
|
-
zodType = z.array(z.any());
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
default:
|
|
77
|
-
zodType = z.any();
|
|
66
|
+
if (nonNullTypes.length === 0) {
|
|
67
|
+
zodType = hasNullableJsonSchemaType(propSchema) ? z.null() : z.unknown();
|
|
68
|
+
} else {
|
|
69
|
+
const zodTypes = nonNullTypes.map((type) => getZodTypeForJsonSchemaType(propSchema, type));
|
|
70
|
+
const [firstType, secondType, ...restTypes] = zodTypes;
|
|
71
|
+
if (!firstType) {
|
|
72
|
+
zodType = z.unknown();
|
|
73
|
+
} else {
|
|
74
|
+
zodType = secondType ? z.union([firstType, secondType, ...restTypes]) : firstType;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (hasNullableJsonSchemaType(propSchema) && nonNullTypes.length > 0) {
|
|
78
|
+
zodType = zodType.nullable();
|
|
78
79
|
}
|
|
79
80
|
if (propSchema.description) {
|
|
80
|
-
zodType._def.description = propSchema.description;
|
|
81
81
|
zodType = zodType.describe(propSchema.description);
|
|
82
82
|
}
|
|
83
83
|
return zodType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -46,8 +46,7 @@
|
|
|
46
46
|
"glob": "^12.0.0",
|
|
47
47
|
"nanoid": "^5.1.6",
|
|
48
48
|
"winston": "^3.17.0",
|
|
49
|
-
"yaml": "^2.8.3"
|
|
50
|
-
"zod-to-json-schema": "^3.24.6"
|
|
49
|
+
"yaml": "^2.8.3"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
53
52
|
"@opentelemetry/instrumentation-http": "^0.210.0",
|
|
@@ -58,7 +57,7 @@
|
|
|
58
57
|
"@opentelemetry/semantic-conventions": "^1.28.0",
|
|
59
58
|
"@types/diff": "^8.0.0",
|
|
60
59
|
"@types/json-schema": "^7.0.15",
|
|
61
|
-
"zod": "^3.
|
|
60
|
+
"zod": "^4.3.6"
|
|
62
61
|
},
|
|
63
62
|
"peerDependencies": {
|
|
64
63
|
"@opentelemetry/core": "^1.28.0",
|
|
@@ -74,7 +73,7 @@
|
|
|
74
73
|
"ioredis": "^5.7.0",
|
|
75
74
|
"pg": "^8.15.4",
|
|
76
75
|
"tsx": "^4.19.2",
|
|
77
|
-
"zod": "^3.
|
|
76
|
+
"zod": "^4.3.6"
|
|
78
77
|
},
|
|
79
78
|
"peerDependenciesMeta": {
|
|
80
79
|
"@opentelemetry/core": {
|