@ai-sdk/provider-utils 4.0.24 → 4.0.25
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/CHANGELOG.md +8 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/add-additional-properties-to-json-schema.ts +1 -1
- package/src/convert-image-model-file-to-data-uri.ts +1 -1
- package/src/create-tool-name-mapping.ts +1 -1
- package/src/get-from-api.ts +2 -2
- package/src/inject-json-instruction.ts +1 -1
- package/src/parse-json-event-stream.ts +3 -3
- package/src/parse-json.ts +2 -2
- package/src/parse-provider-options.ts +1 -1
- package/src/post-to-api.ts +2 -2
- package/src/provider-tool-factory.ts +2 -2
- package/src/resolve.ts +1 -1
- package/src/response-handler.ts +2 -2
- package/src/schema.ts +6 -3
- package/src/to-json-schema/zod3-to-json-schema/options.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parse-def.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parse-types.ts +22 -22
- package/src/to-json-schema/zod3-to-json-schema/parsers/array.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/bigint.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/branded.ts +2 -2
- package/src/to-json-schema/zod3-to-json-schema/parsers/catch.ts +2 -2
- package/src/to-json-schema/zod3-to-json-schema/parsers/date.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/default.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/effects.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/enum.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/intersection.ts +4 -4
- package/src/to-json-schema/zod3-to-json-schema/parsers/literal.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/map.ts +4 -4
- package/src/to-json-schema/zod3-to-json-schema/parsers/native-enum.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/never.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/nullable.ts +4 -4
- package/src/to-json-schema/zod3-to-json-schema/parsers/number.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/object.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/optional.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/pipeline.ts +4 -4
- package/src/to-json-schema/zod3-to-json-schema/parsers/promise.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/readonly.ts +2 -2
- package/src/to-json-schema/zod3-to-json-schema/parsers/record.ts +7 -7
- package/src/to-json-schema/zod3-to-json-schema/parsers/set.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/string.ts +2 -2
- package/src/to-json-schema/zod3-to-json-schema/parsers/tuple.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/undefined.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/union.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/parsers/unknown.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/refs.ts +3 -3
- package/src/to-json-schema/zod3-to-json-schema/select-parser.ts +2 -2
- package/src/to-json-schema/zod3-to-json-schema/zod3-to-json-schema.ts +3 -3
- package/src/types/assistant-model-message.ts +3 -3
- package/src/types/content-part.ts +3 -3
- package/src/types/execute-tool.ts +1 -1
- package/src/types/index.ts +2 -1
- package/src/types/model-message.ts +4 -4
- package/src/types/provider-options.ts +1 -1
- package/src/types/system-model-message.ts +1 -1
- package/src/types/tool-model-message.ts +3 -3
- package/src/types/tool.ts +5 -5
- package/src/types/user-model-message.ts +2 -2
- package/src/validate-types.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/provider-utils",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.25",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@standard-schema/spec": "^1.1.0",
|
|
37
37
|
"eventsource-parser": "^3.0.8",
|
|
38
|
-
"@ai-sdk/provider": "3.0.
|
|
38
|
+
"@ai-sdk/provider": "3.0.10"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "20.17.24",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSONSchema7, JSONSchema7Definition } from '@ai-sdk/provider';
|
|
1
|
+
import type { JSONSchema7, JSONSchema7Definition } from '@ai-sdk/provider';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Recursively adds additionalProperties: false to the JSON schema. This is necessary because some providers (e.g. OpenAI) do not support additionalProperties: true.
|
package/src/get-from-api.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { APICallError } from '@ai-sdk/provider';
|
|
2
2
|
import { extractResponseHeaders } from './extract-response-headers';
|
|
3
|
-
import { FetchFunction } from './fetch-function';
|
|
3
|
+
import type { FetchFunction } from './fetch-function';
|
|
4
4
|
import { handleFetchError } from './handle-fetch-error';
|
|
5
5
|
import { isAbortError } from './is-abort-error';
|
|
6
|
-
import { ResponseHandler } from './response-handler';
|
|
6
|
+
import type { ResponseHandler } from './response-handler';
|
|
7
7
|
import { getRuntimeEnvironmentUserAgent } from './get-runtime-environment-user-agent';
|
|
8
8
|
import { withUserAgentSuffix } from './with-user-agent-suffix';
|
|
9
9
|
import { VERSION } from './version';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
EventSourceMessage,
|
|
3
2
|
EventSourceParserStream,
|
|
3
|
+
type EventSourceMessage,
|
|
4
4
|
} from 'eventsource-parser/stream';
|
|
5
|
-
import {
|
|
6
|
-
import { FlexibleSchema } from './schema';
|
|
5
|
+
import { safeParseJSON, type ParseResult } from './parse-json';
|
|
6
|
+
import type { FlexibleSchema } from './schema';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Parses a JSON event stream into a stream of parsed JSON objects.
|
package/src/parse-json.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JSONParseError,
|
|
3
|
-
JSONValue,
|
|
4
3
|
TypeValidationError,
|
|
4
|
+
type JSONValue,
|
|
5
5
|
} from '@ai-sdk/provider';
|
|
6
6
|
import { secureJsonParse } from './secure-json-parse';
|
|
7
7
|
import { safeValidateTypes, validateTypes } from './validate-types';
|
|
8
|
-
import { FlexibleSchema } from './schema';
|
|
8
|
+
import type { FlexibleSchema } from './schema';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Parses a JSON string into an unknown object.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InvalidArgumentError } from '@ai-sdk/provider';
|
|
2
2
|
import { safeValidateTypes } from './validate-types';
|
|
3
|
-
import { FlexibleSchema } from './schema';
|
|
3
|
+
import type { FlexibleSchema } from './schema';
|
|
4
4
|
|
|
5
5
|
export async function parseProviderOptions<OPTIONS>({
|
|
6
6
|
provider,
|
package/src/post-to-api.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { APICallError } from '@ai-sdk/provider';
|
|
2
2
|
import { extractResponseHeaders } from './extract-response-headers';
|
|
3
|
-
import { FetchFunction } from './fetch-function';
|
|
3
|
+
import type { FetchFunction } from './fetch-function';
|
|
4
4
|
import { handleFetchError } from './handle-fetch-error';
|
|
5
5
|
import { isAbortError } from './is-abort-error';
|
|
6
|
-
import { ResponseHandler } from './response-handler';
|
|
6
|
+
import type { ResponseHandler } from './response-handler';
|
|
7
7
|
import { getRuntimeEnvironmentUserAgent } from './get-runtime-environment-user-agent';
|
|
8
8
|
import { withUserAgentSuffix } from './with-user-agent-suffix';
|
|
9
9
|
import { VERSION } from './version';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { tool, Tool, ToolExecuteFunction } from './types/tool';
|
|
2
|
-
import { FlexibleSchema } from './schema';
|
|
1
|
+
import { tool, type Tool, type ToolExecuteFunction } from './types/tool';
|
|
2
|
+
import type { FlexibleSchema } from './schema';
|
|
3
3
|
|
|
4
4
|
export type ProviderToolFactory<INPUT, ARGS extends object> = <OUTPUT>(
|
|
5
5
|
options: ARGS & {
|
package/src/resolve.ts
CHANGED
package/src/response-handler.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { APICallError, EmptyResponseBodyError } from '@ai-sdk/provider';
|
|
2
2
|
import { extractResponseHeaders } from './extract-response-headers';
|
|
3
|
-
import { parseJSON,
|
|
3
|
+
import { parseJSON, safeParseJSON, type ParseResult } from './parse-json';
|
|
4
4
|
import { parseJsonEventStream } from './parse-json-event-stream';
|
|
5
|
-
import { FlexibleSchema } from './schema';
|
|
5
|
+
import type { FlexibleSchema } from './schema';
|
|
6
6
|
|
|
7
7
|
export type ResponseHandler<RETURN_TYPE> = (options: {
|
|
8
8
|
url: string;
|
package/src/schema.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { TypeValidationError, type JSONSchema7 } from '@ai-sdk/provider';
|
|
2
|
+
import type {
|
|
3
|
+
StandardSchemaV1,
|
|
4
|
+
StandardJSONSchemaV1,
|
|
5
|
+
} from '@standard-schema/spec';
|
|
6
|
+
import type * as z3 from 'zod/v3';
|
|
4
7
|
import * as z4 from 'zod/v4';
|
|
5
8
|
import { addAdditionalPropertiesToJsonSchema } from './add-additional-properties-to-json-schema';
|
|
6
9
|
import { zod3ToJsonSchema } from './to-json-schema/zod3-to-json-schema';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ZodSchema, ZodTypeDef } from 'zod/v3';
|
|
2
|
-
import { Refs, Seen } from './refs';
|
|
3
|
-
import { JsonSchema7Type } from './parse-types';
|
|
1
|
+
import type { ZodSchema, ZodTypeDef } from 'zod/v3';
|
|
2
|
+
import type { Refs, Seen } from './refs';
|
|
3
|
+
import type { JsonSchema7Type } from './parse-types';
|
|
4
4
|
|
|
5
5
|
export type DateStrategy =
|
|
6
6
|
| 'format:date-time'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ZodTypeDef } from 'zod/v3';
|
|
2
|
-
import { Refs, Seen } from './refs';
|
|
1
|
+
import type { ZodTypeDef } from 'zod/v3';
|
|
2
|
+
import type { Refs, Seen } from './refs';
|
|
3
3
|
import { ignoreOverride } from './options';
|
|
4
|
-
import { JsonSchema7Type } from './parse-types';
|
|
4
|
+
import type { JsonSchema7Type } from './parse-types';
|
|
5
5
|
import { selectParser } from './select-parser';
|
|
6
6
|
import { getRelativePath } from './get-relative-path';
|
|
7
7
|
import { parseAnyDef } from './parsers/any';
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { JsonSchema7AnyType } from './parsers/any';
|
|
2
|
-
import { JsonSchema7ArrayType } from './parsers/array';
|
|
3
|
-
import { JsonSchema7BigintType } from './parsers/bigint';
|
|
4
|
-
import { JsonSchema7BooleanType } from './parsers/boolean';
|
|
5
|
-
import { JsonSchema7DateType } from './parsers/date';
|
|
6
|
-
import { JsonSchema7EnumType } from './parsers/enum';
|
|
7
|
-
import { JsonSchema7AllOfType } from './parsers/intersection';
|
|
8
|
-
import { JsonSchema7LiteralType } from './parsers/literal';
|
|
9
|
-
import { JsonSchema7MapType } from './parsers/map';
|
|
10
|
-
import { JsonSchema7NativeEnumType } from './parsers/native-enum';
|
|
11
|
-
import { JsonSchema7NeverType } from './parsers/never';
|
|
12
|
-
import { JsonSchema7NullType } from './parsers/null';
|
|
13
|
-
import { JsonSchema7NullableType } from './parsers/nullable';
|
|
14
|
-
import { JsonSchema7NumberType } from './parsers/number';
|
|
15
|
-
import { JsonSchema7ObjectType } from './parsers/object';
|
|
16
|
-
import { JsonSchema7RecordType } from './parsers/record';
|
|
17
|
-
import { JsonSchema7SetType } from './parsers/set';
|
|
18
|
-
import { JsonSchema7StringType } from './parsers/string';
|
|
19
|
-
import { JsonSchema7TupleType } from './parsers/tuple';
|
|
20
|
-
import { JsonSchema7UndefinedType } from './parsers/undefined';
|
|
21
|
-
import { JsonSchema7UnionType } from './parsers/union';
|
|
22
|
-
import { JsonSchema7UnknownType } from './parsers/unknown';
|
|
1
|
+
import type { JsonSchema7AnyType } from './parsers/any';
|
|
2
|
+
import type { JsonSchema7ArrayType } from './parsers/array';
|
|
3
|
+
import type { JsonSchema7BigintType } from './parsers/bigint';
|
|
4
|
+
import type { JsonSchema7BooleanType } from './parsers/boolean';
|
|
5
|
+
import type { JsonSchema7DateType } from './parsers/date';
|
|
6
|
+
import type { JsonSchema7EnumType } from './parsers/enum';
|
|
7
|
+
import type { JsonSchema7AllOfType } from './parsers/intersection';
|
|
8
|
+
import type { JsonSchema7LiteralType } from './parsers/literal';
|
|
9
|
+
import type { JsonSchema7MapType } from './parsers/map';
|
|
10
|
+
import type { JsonSchema7NativeEnumType } from './parsers/native-enum';
|
|
11
|
+
import type { JsonSchema7NeverType } from './parsers/never';
|
|
12
|
+
import type { JsonSchema7NullType } from './parsers/null';
|
|
13
|
+
import type { JsonSchema7NullableType } from './parsers/nullable';
|
|
14
|
+
import type { JsonSchema7NumberType } from './parsers/number';
|
|
15
|
+
import type { JsonSchema7ObjectType } from './parsers/object';
|
|
16
|
+
import type { JsonSchema7RecordType } from './parsers/record';
|
|
17
|
+
import type { JsonSchema7SetType } from './parsers/set';
|
|
18
|
+
import type { JsonSchema7StringType } from './parsers/string';
|
|
19
|
+
import type { JsonSchema7TupleType } from './parsers/tuple';
|
|
20
|
+
import type { JsonSchema7UndefinedType } from './parsers/undefined';
|
|
21
|
+
import type { JsonSchema7UnionType } from './parsers/union';
|
|
22
|
+
import type { JsonSchema7UnknownType } from './parsers/unknown';
|
|
23
23
|
|
|
24
24
|
type JsonSchema7RefType = { $ref: string };
|
|
25
25
|
type JsonSchema7Meta = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ZodFirstPartyTypeKind, type ZodArrayDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
5
|
|
|
6
6
|
export type JsonSchema7ArrayType = {
|
|
7
7
|
type: 'array';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ZodBrandedDef } from 'zod/v3';
|
|
1
|
+
import type { ZodBrandedDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { Refs } from '../refs';
|
|
4
4
|
|
|
5
5
|
export function parseBrandedDef(_def: ZodBrandedDef<any>, refs: Refs) {
|
|
6
6
|
return parseDef(_def.type._def, refs);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ZodCatchDef } from 'zod/v3';
|
|
1
|
+
import type { ZodCatchDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { Refs } from '../refs';
|
|
4
4
|
|
|
5
5
|
export const parseCatchDef = (def: ZodCatchDef<any>, refs: Refs) => {
|
|
6
6
|
return parseDef(def.innerType._def, refs);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ZodDateDef } from 'zod/v3';
|
|
2
|
-
import { Refs } from '../refs';
|
|
3
|
-
import { DateStrategy } from '../options';
|
|
1
|
+
import type { ZodDateDef } from 'zod/v3';
|
|
2
|
+
import type { Refs } from '../refs';
|
|
3
|
+
import type { DateStrategy } from '../options';
|
|
4
4
|
|
|
5
5
|
export type JsonSchema7DateType =
|
|
6
6
|
| {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ZodDefaultDef } from 'zod/v3';
|
|
1
|
+
import type { ZodDefaultDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
5
|
|
|
6
6
|
export function parseDefaultDef(
|
|
7
7
|
_def: ZodDefaultDef,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ZodEffectsDef } from 'zod/v3';
|
|
1
|
+
import type { ZodEffectsDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
5
|
import { parseAnyDef } from './any';
|
|
6
6
|
|
|
7
7
|
export function parseEffectsDef(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ZodIntersectionDef } from 'zod/v3';
|
|
1
|
+
import type { ZodIntersectionDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
5
|
-
import { JsonSchema7StringType } from './string';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
|
+
import type { JsonSchema7StringType } from './string';
|
|
6
6
|
|
|
7
7
|
export type JsonSchema7AllOfType = {
|
|
8
8
|
allOf: JsonSchema7Type[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ZodMapDef } from 'zod/v3';
|
|
1
|
+
import type { ZodMapDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
5
|
import { parseAnyDef } from './any';
|
|
6
|
-
import {
|
|
6
|
+
import { parseRecordDef, type JsonSchema7RecordType } from './record';
|
|
7
7
|
|
|
8
8
|
export type JsonSchema7MapType = {
|
|
9
9
|
type: 'array';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ZodNullableDef } from 'zod/v3';
|
|
1
|
+
import type { ZodNullableDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
5
|
-
import { JsonSchema7NullType } from './null';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
|
+
import type { JsonSchema7NullType } from './null';
|
|
6
6
|
import { primitiveMappings } from './union';
|
|
7
7
|
|
|
8
8
|
export type JsonSchema7NullableType =
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ZodObjectDef, ZodTypeAny } from 'zod/v3';
|
|
1
|
+
import type { ZodObjectDef, ZodTypeAny } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
5
|
|
|
6
6
|
export type JsonSchema7ObjectType = {
|
|
7
7
|
type: 'object';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ZodOptionalDef } from 'zod/v3';
|
|
1
|
+
import type { ZodOptionalDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
5
|
import { parseAnyDef } from './any';
|
|
6
6
|
|
|
7
7
|
export const parseOptionalDef = (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ZodPipelineDef } from 'zod/v3';
|
|
1
|
+
import type { ZodPipelineDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
5
|
-
import { JsonSchema7AllOfType } from './intersection';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
|
+
import type { JsonSchema7AllOfType } from './intersection';
|
|
6
6
|
|
|
7
7
|
export const parsePipelineDef = (
|
|
8
8
|
def: ZodPipelineDef<any, any>,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ZodPromiseDef } from 'zod/v3';
|
|
1
|
+
import type { ZodPromiseDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
5
|
|
|
6
6
|
export function parsePromiseDef(
|
|
7
7
|
def: ZodPromiseDef,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ZodReadonlyDef } from 'zod/v3';
|
|
1
|
+
import type { ZodReadonlyDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { Refs } from '../refs';
|
|
4
4
|
|
|
5
5
|
export const parseReadonlyDef = (def: ZodReadonlyDef<any>, refs: Refs) => {
|
|
6
6
|
return parseDef(def.innerType._def, refs);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ZodFirstPartyTypeKind,
|
|
3
|
-
ZodMapDef,
|
|
4
|
-
ZodRecordDef,
|
|
5
|
-
ZodTypeAny,
|
|
3
|
+
type ZodMapDef,
|
|
4
|
+
type ZodRecordDef,
|
|
5
|
+
type ZodTypeAny,
|
|
6
6
|
} from 'zod/v3';
|
|
7
7
|
import { parseDef } from '../parse-def';
|
|
8
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
9
|
-
import { Refs } from '../refs';
|
|
8
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
9
|
+
import type { Refs } from '../refs';
|
|
10
10
|
import { parseBrandedDef } from './branded';
|
|
11
|
-
import { JsonSchema7EnumType } from './enum';
|
|
12
|
-
import {
|
|
11
|
+
import type { JsonSchema7EnumType } from './enum';
|
|
12
|
+
import { parseStringDef, type JsonSchema7StringType } from './string';
|
|
13
13
|
|
|
14
14
|
type JsonSchema7RecordPropertyNamesType =
|
|
15
15
|
| Omit<JsonSchema7StringType, 'type'>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ZodSetDef } from 'zod/v3';
|
|
1
|
+
import type { ZodSetDef } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
5
|
|
|
6
6
|
export type JsonSchema7SetType = {
|
|
7
7
|
type: 'array';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ZodTupleDef, ZodTupleItems, ZodTypeAny } from 'zod/v3';
|
|
1
|
+
import type { ZodTupleDef, ZodTupleItems, ZodTypeAny } from 'zod/v3';
|
|
2
2
|
import { parseDef } from '../parse-def';
|
|
3
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
4
|
-
import { Refs } from '../refs';
|
|
3
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
4
|
+
import type { Refs } from '../refs';
|
|
5
5
|
|
|
6
6
|
export type JsonSchema7TupleType = {
|
|
7
7
|
type: 'array';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
ZodDiscriminatedUnionDef,
|
|
3
3
|
ZodLiteralDef,
|
|
4
4
|
ZodTypeAny,
|
|
5
5
|
ZodUnionDef,
|
|
6
6
|
} from 'zod/v3';
|
|
7
7
|
import { parseDef } from '../parse-def';
|
|
8
|
-
import { JsonSchema7Type } from '../parse-types';
|
|
9
|
-
import { Refs } from '../refs';
|
|
8
|
+
import type { JsonSchema7Type } from '../parse-types';
|
|
9
|
+
import type { Refs } from '../refs';
|
|
10
10
|
|
|
11
11
|
export const primitiveMappings = {
|
|
12
12
|
ZodString: 'string',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ZodTypeDef } from 'zod/v3';
|
|
2
|
-
import { getDefaultOptions, Options } from './options';
|
|
3
|
-
import { JsonSchema7Type } from './parse-types';
|
|
1
|
+
import type { ZodTypeDef } from 'zod/v3';
|
|
2
|
+
import { getDefaultOptions, type Options } from './options';
|
|
3
|
+
import type { JsonSchema7Type } from './parse-types';
|
|
4
4
|
|
|
5
5
|
export type Refs = {
|
|
6
6
|
seen: Map<ZodTypeDef, Seen>;
|
|
@@ -28,9 +28,9 @@ import { parseTupleDef } from './parsers/tuple';
|
|
|
28
28
|
import { parseUndefinedDef } from './parsers/undefined';
|
|
29
29
|
import { parseUnionDef } from './parsers/union';
|
|
30
30
|
import { parseUnknownDef } from './parsers/unknown';
|
|
31
|
-
import { Refs } from './refs';
|
|
31
|
+
import type { Refs } from './refs';
|
|
32
32
|
import { parseReadonlyDef } from './parsers/readonly';
|
|
33
|
-
import { JsonSchema7Type } from './parse-types';
|
|
33
|
+
import type { JsonSchema7Type } from './parse-types';
|
|
34
34
|
|
|
35
35
|
export type InnerDefGetter = () => any;
|
|
36
36
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ZodSchema } from 'zod/v3';
|
|
2
|
-
import { Options } from './options';
|
|
1
|
+
import type { ZodSchema } from 'zod/v3';
|
|
2
|
+
import type { Options } from './options';
|
|
3
3
|
import { parseDef } from './parse-def';
|
|
4
|
-
import { JsonSchema7Type } from './parse-types';
|
|
4
|
+
import type { JsonSchema7Type } from './parse-types';
|
|
5
5
|
import { getRefs } from './refs';
|
|
6
6
|
import { parseAnyDef } from './parsers/any';
|
|
7
7
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
FilePart,
|
|
3
3
|
ReasoningPart,
|
|
4
4
|
TextPart,
|
|
5
5
|
ToolCallPart,
|
|
6
6
|
ToolResultPart,
|
|
7
7
|
} from './content-part';
|
|
8
|
-
import { ProviderOptions } from './provider-options';
|
|
9
|
-
import { ToolApprovalRequest } from './tool-approval-request';
|
|
8
|
+
import type { ProviderOptions } from './provider-options';
|
|
9
|
+
import type { ToolApprovalRequest } from './tool-approval-request';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { JSONValue } from '@ai-sdk/provider';
|
|
2
|
-
import { DataContent } from './data-content';
|
|
3
|
-
import { ProviderOptions } from './provider-options';
|
|
1
|
+
import type { JSONValue } from '@ai-sdk/provider';
|
|
2
|
+
import type { DataContent } from './data-content';
|
|
3
|
+
import type { ProviderOptions } from './provider-options';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Text content part of a prompt. It contains a string of text.
|
package/src/types/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ToolExecutionOptions } from './tool';
|
|
2
|
+
|
|
1
3
|
export type {
|
|
2
4
|
AssistantContent,
|
|
3
5
|
AssistantModelMessage,
|
|
@@ -32,7 +34,6 @@ export type { ToolCall } from './tool-call';
|
|
|
32
34
|
export type { ToolContent, ToolModelMessage } from './tool-model-message';
|
|
33
35
|
export type { ToolResult } from './tool-result';
|
|
34
36
|
export type { UserContent, UserModelMessage } from './user-model-message';
|
|
35
|
-
import type { ToolExecutionOptions } from './tool';
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* @deprecated Use ToolExecutionOptions instead.
|