@mastra/schema-compat 0.10.3-alpha.0 → 0.10.3-alpha.1
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +6 -0
- package/dist/_tsup-dts-rollup.d.cts +3 -1
- package/dist/_tsup-dts-rollup.d.ts +3 -1
- package/dist/index.cjs +5 -2
- package/dist/index.js +5 -2
- package/package.json +1 -1
- package/src/provider-compats/openai-reasoning.ts +1 -1
- package/src/schema-compatibility.ts +9 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/schema-compat@0.10.3-alpha.
|
|
2
|
+
> @mastra/schema-compat@0.10.3-alpha.1 build /home/runner/work/mastra/mastra/packages/schema-compat
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.5.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 2208ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/schema-compat/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/schema-compat/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 1941ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m21.59 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 164ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m20.96 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 164ms
|
package/CHANGELOG.md
CHANGED
|
@@ -339,7 +339,9 @@ declare abstract class SchemaCompatLayer {
|
|
|
339
339
|
* @param value - The Zod object to process
|
|
340
340
|
* @returns The processed Zod object
|
|
341
341
|
*/
|
|
342
|
-
defaultZodObjectHandler(value: ZodObject<any, any, any
|
|
342
|
+
defaultZodObjectHandler(value: ZodObject<any, any, any>, options?: {
|
|
343
|
+
passthrough?: boolean;
|
|
344
|
+
}): ZodObject<any, any, any>;
|
|
343
345
|
/**
|
|
344
346
|
* Merges validation constraints into a parameter description.
|
|
345
347
|
*
|
|
@@ -339,7 +339,9 @@ declare abstract class SchemaCompatLayer {
|
|
|
339
339
|
* @param value - The Zod object to process
|
|
340
340
|
* @returns The processed Zod object
|
|
341
341
|
*/
|
|
342
|
-
defaultZodObjectHandler(value: ZodObject<any, any, any
|
|
342
|
+
defaultZodObjectHandler(value: ZodObject<any, any, any>, options?: {
|
|
343
|
+
passthrough?: boolean;
|
|
344
|
+
}): ZodObject<any, any, any>;
|
|
343
345
|
/**
|
|
344
346
|
* Merges validation constraints into a parameter description.
|
|
345
347
|
*
|
package/dist/index.cjs
CHANGED
|
@@ -115,7 +115,7 @@ var SchemaCompatLayer = class {
|
|
|
115
115
|
* @param value - The Zod object to process
|
|
116
116
|
* @returns The processed Zod object
|
|
117
117
|
*/
|
|
118
|
-
defaultZodObjectHandler(value) {
|
|
118
|
+
defaultZodObjectHandler(value, options = { passthrough: true }) {
|
|
119
119
|
const processedShape = Object.entries(value.shape).reduce((acc, [key, propValue]) => {
|
|
120
120
|
acc[key] = this.processZodType(propValue);
|
|
121
121
|
return acc;
|
|
@@ -130,6 +130,9 @@ var SchemaCompatLayer = class {
|
|
|
130
130
|
if (value.description) {
|
|
131
131
|
result = result.describe(value.description);
|
|
132
132
|
}
|
|
133
|
+
if (options.passthrough && value._def.unknownKeys === "passthrough") {
|
|
134
|
+
result = result.passthrough();
|
|
135
|
+
}
|
|
133
136
|
return result;
|
|
134
137
|
}
|
|
135
138
|
/**
|
|
@@ -600,7 +603,7 @@ var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
600
603
|
const innerZodType = this.processZodType(value._def.innerType);
|
|
601
604
|
return innerZodType.nullable();
|
|
602
605
|
} else if (isObj(value)) {
|
|
603
|
-
return this.defaultZodObjectHandler(value);
|
|
606
|
+
return this.defaultZodObjectHandler(value, { passthrough: false });
|
|
604
607
|
} else if (isArr(value)) {
|
|
605
608
|
return this.defaultZodArrayHandler(value);
|
|
606
609
|
} else if (isUnion(value)) {
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ var SchemaCompatLayer = class {
|
|
|
113
113
|
* @param value - The Zod object to process
|
|
114
114
|
* @returns The processed Zod object
|
|
115
115
|
*/
|
|
116
|
-
defaultZodObjectHandler(value) {
|
|
116
|
+
defaultZodObjectHandler(value, options = { passthrough: true }) {
|
|
117
117
|
const processedShape = Object.entries(value.shape).reduce((acc, [key, propValue]) => {
|
|
118
118
|
acc[key] = this.processZodType(propValue);
|
|
119
119
|
return acc;
|
|
@@ -128,6 +128,9 @@ var SchemaCompatLayer = class {
|
|
|
128
128
|
if (value.description) {
|
|
129
129
|
result = result.describe(value.description);
|
|
130
130
|
}
|
|
131
|
+
if (options.passthrough && value._def.unknownKeys === "passthrough") {
|
|
132
|
+
result = result.passthrough();
|
|
133
|
+
}
|
|
131
134
|
return result;
|
|
132
135
|
}
|
|
133
136
|
/**
|
|
@@ -598,7 +601,7 @@ var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
598
601
|
const innerZodType = this.processZodType(value._def.innerType);
|
|
599
602
|
return innerZodType.nullable();
|
|
600
603
|
} else if (isObj(value)) {
|
|
601
|
-
return this.defaultZodObjectHandler(value);
|
|
604
|
+
return this.defaultZodObjectHandler(value, { passthrough: false });
|
|
602
605
|
} else if (isArr(value)) {
|
|
603
606
|
return this.defaultZodArrayHandler(value);
|
|
604
607
|
} else if (isUnion(value)) {
|
package/package.json
CHANGED
|
@@ -45,7 +45,7 @@ export class OpenAIReasoningSchemaCompatLayer extends SchemaCompatLayer {
|
|
|
45
45
|
const innerZodType = this.processZodType(value._def.innerType);
|
|
46
46
|
return innerZodType.nullable();
|
|
47
47
|
} else if (isObj(value)) {
|
|
48
|
-
return this.defaultZodObjectHandler(value);
|
|
48
|
+
return this.defaultZodObjectHandler(value, { passthrough: false });
|
|
49
49
|
} else if (isArr(value)) {
|
|
50
50
|
return this.defaultZodArrayHandler(value);
|
|
51
51
|
} else if (isUnion(value)) {
|
|
@@ -232,7 +232,10 @@ export abstract class SchemaCompatLayer {
|
|
|
232
232
|
* @param value - The Zod object to process
|
|
233
233
|
* @returns The processed Zod object
|
|
234
234
|
*/
|
|
235
|
-
public defaultZodObjectHandler(
|
|
235
|
+
public defaultZodObjectHandler(
|
|
236
|
+
value: ZodObject<any, any, any>,
|
|
237
|
+
options: { passthrough?: boolean } = { passthrough: true },
|
|
238
|
+
): ZodObject<any, any, any> {
|
|
236
239
|
const processedShape = Object.entries(value.shape).reduce<Record<string, ZodTypeAny>>((acc, [key, propValue]) => {
|
|
237
240
|
acc[key] = this.processZodType(propValue as ZodTypeAny);
|
|
238
241
|
return acc;
|
|
@@ -250,6 +253,11 @@ export abstract class SchemaCompatLayer {
|
|
|
250
253
|
if (value.description) {
|
|
251
254
|
result = result.describe(value.description);
|
|
252
255
|
}
|
|
256
|
+
|
|
257
|
+
if (options.passthrough && value._def.unknownKeys === 'passthrough') {
|
|
258
|
+
result = result.passthrough();
|
|
259
|
+
}
|
|
260
|
+
|
|
253
261
|
return result;
|
|
254
262
|
}
|
|
255
263
|
|