@ai-sdk/react
Advanced tools
Comparing version 0.0.41 to 0.0.42
# @ai-sdk/react | ||
## 0.0.42 | ||
### Patch Changes | ||
- e9c891d: feat (ai/react): useObject supports non-Zod schemas | ||
- Updated dependencies [e9c891d] | ||
- Updated dependencies [4bd27a9] | ||
- Updated dependencies [845754b] | ||
- @ai-sdk/ui-utils@0.0.30 | ||
- @ai-sdk/provider-utils@1.0.10 | ||
## 0.0.41 | ||
@@ -4,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Message, CreateMessage, AssistantStatus, UseAssistantOptions, ChatRequestOptions, JSONValue, UseChatOptions, RequestOptions, UseCompletionOptions, DeepPartial, FetchFunction } from '@ai-sdk/ui-utils'; | ||
import { Message, CreateMessage, AssistantStatus, UseAssistantOptions, ChatRequestOptions, JSONValue, UseChatOptions, RequestOptions, UseCompletionOptions, Schema, DeepPartial, FetchFunction } from '@ai-sdk/ui-utils'; | ||
export { CreateMessage, Message, UseChatOptions, UseCompletionOptions } from '@ai-sdk/ui-utils'; | ||
@@ -219,3 +219,3 @@ import z from 'zod'; | ||
*/ | ||
schema: z.Schema<RESULT, z.ZodTypeDef, any>; | ||
schema: z.Schema<RESULT, z.ZodTypeDef, any> | Schema<RESULT>; | ||
/** | ||
@@ -222,0 +222,0 @@ * An unique identifier. If not provided, a random one will be |
@@ -873,5 +873,8 @@ "use strict"; | ||
if (onFinish != null) { | ||
const validationResult = schema.safeParse(latestObject); | ||
const validationResult = (0, import_provider_utils2.safeValidateTypes)({ | ||
value: latestObject, | ||
schema: (0, import_ui_utils4.asSchema)(schema) | ||
}); | ||
onFinish( | ||
validationResult.success ? { object: validationResult.data, error: void 0 } : { object: void 0, error: validationResult.error } | ||
validationResult.success ? { object: validationResult.value, error: void 0 } : { object: void 0, error: validationResult.error } | ||
); | ||
@@ -878,0 +881,0 @@ } |
{ | ||
"name": "@ai-sdk/react", | ||
"version": "0.0.41", | ||
"version": "0.0.42", | ||
"license": "Apache-2.0", | ||
@@ -18,4 +18,4 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@ai-sdk/provider-utils": "1.0.9", | ||
"@ai-sdk/ui-utils": "0.0.29", | ||
"@ai-sdk/provider-utils": "1.0.10", | ||
"@ai-sdk/ui-utils": "0.0.30", | ||
"swr": "2.2.5" | ||
@@ -22,0 +22,0 @@ }, |
@@ -1,3 +0,4 @@ | ||
import { isAbortError } from '@ai-sdk/provider-utils'; | ||
import { isAbortError, safeValidateTypes } from '@ai-sdk/provider-utils'; | ||
import { | ||
asSchema, | ||
DeepPartial, | ||
@@ -7,2 +8,3 @@ FetchFunction, | ||
parsePartialJson, | ||
Schema, | ||
} from '@ai-sdk/ui-utils'; | ||
@@ -25,3 +27,3 @@ import { useCallback, useId, useRef, useState } from 'react'; | ||
*/ | ||
schema: z.Schema<RESULT, z.ZodTypeDef, any>; | ||
schema: z.Schema<RESULT, z.ZodTypeDef, any> | Schema<RESULT>; | ||
@@ -190,6 +192,10 @@ /** | ||
if (onFinish != null) { | ||
const validationResult = schema.safeParse(latestObject); | ||
const validationResult = safeValidateTypes({ | ||
value: latestObject, | ||
schema: asSchema(schema), | ||
}); | ||
onFinish( | ||
validationResult.success | ||
? { object: validationResult.data, error: undefined } | ||
? { object: validationResult.value, error: undefined } | ||
: { object: undefined, error: validationResult.error }, | ||
@@ -196,0 +202,0 @@ ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302480
5295
+ Added@ai-sdk/provider@0.0.18(transitive)
+ Added@ai-sdk/provider-utils@1.0.10(transitive)
+ Added@ai-sdk/ui-utils@0.0.30(transitive)
+ Addedzod-to-json-schema@3.22.5(transitive)
- Removed@ai-sdk/provider@0.0.17(transitive)
- Removed@ai-sdk/provider-utils@1.0.9(transitive)
- Removed@ai-sdk/ui-utils@0.0.29(transitive)
Updated@ai-sdk/ui-utils@0.0.30