@ai-sdk/provider-utils 3.0.23 → 3.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 3.0.25
4
+
5
+ ### Patch Changes
6
+
7
+ - 783fa6c: chore: ensure consistent import handling and avoid import duplicates or cycles
8
+ - Updated dependencies [783fa6c]
9
+ - @ai-sdk/provider@2.0.3
10
+
11
+ ## 3.0.24
12
+
13
+ ### Patch Changes
14
+
15
+ - 0a00b9b: trigger release for all packages after provenance setup
16
+ - Updated dependencies [0a00b9b]
17
+ - @ai-sdk/provider@2.0.2
18
+
3
19
  ## 3.0.23
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -447,7 +447,6 @@ type InferSchema<SCHEMA> = SCHEMA extends z3.Schema ? z3.infer<SCHEMA> : SCHEMA
447
447
  declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | (() => JSONSchema7), { validate, }?: {
448
448
  validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
449
449
  }): Schema<OBJECT>;
450
- declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
451
450
 
452
451
  /**
453
452
  Additional provider-specific options.
@@ -868,6 +867,8 @@ type Resolvable<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
868
867
  */
869
868
  declare function resolve<T>(value: Resolvable<T>): Promise<T>;
870
869
 
870
+ declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
871
+
871
872
  declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
872
873
  declare function convertUint8ArrayToBase64(array: Uint8Array): string;
873
874
  declare function convertToBase64(value: string | Uint8Array): string;
package/dist/index.d.ts CHANGED
@@ -447,7 +447,6 @@ type InferSchema<SCHEMA> = SCHEMA extends z3.Schema ? z3.infer<SCHEMA> : SCHEMA
447
447
  declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | (() => JSONSchema7), { validate, }?: {
448
448
  validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
449
449
  }): Schema<OBJECT>;
450
- declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
451
450
 
452
451
  /**
453
452
  Additional provider-specific options.
@@ -868,6 +867,8 @@ type Resolvable<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
868
867
  */
869
868
  declare function resolve<T>(value: Resolvable<T>): Promise<T>;
870
869
 
870
+ declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
871
+
871
872
  declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
872
873
  declare function convertUint8ArrayToBase64(array: Uint8Array): string;
873
874
  declare function convertToBase64(value: string | Uint8Array): string;
package/dist/index.js CHANGED
@@ -440,7 +440,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
440
440
  }
441
441
 
442
442
  // src/version.ts
443
- var VERSION = true ? "3.0.23" : "0.0.0-test";
443
+ var VERSION = true ? "3.0.25" : "0.0.0-test";
444
444
 
445
445
  // src/get-from-api.ts
446
446
  var getOriginalFetch = () => globalThis.fetch;
@@ -1241,6 +1241,35 @@ var createStatusCodeErrorResponseHandler = () => async ({ response, url, request
1241
1241
  };
1242
1242
  };
1243
1243
 
1244
+ // src/schema.ts
1245
+ var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
1246
+ function lazySchema(createSchema) {
1247
+ let schema;
1248
+ return () => {
1249
+ if (schema == null) {
1250
+ schema = createSchema();
1251
+ }
1252
+ return schema;
1253
+ };
1254
+ }
1255
+ function jsonSchema(jsonSchema2, {
1256
+ validate
1257
+ } = {}) {
1258
+ return {
1259
+ [schemaSymbol]: true,
1260
+ _type: void 0,
1261
+ // should never be used directly
1262
+ [validatorSymbol]: true,
1263
+ get jsonSchema() {
1264
+ if (typeof jsonSchema2 === "function") {
1265
+ jsonSchema2 = jsonSchema2();
1266
+ }
1267
+ return jsonSchema2;
1268
+ },
1269
+ validate
1270
+ };
1271
+ }
1272
+
1244
1273
  // src/zod-schema.ts
1245
1274
  var z4 = __toESM(require("zod/v4"));
1246
1275
 
@@ -1271,15 +1300,6 @@ function addAdditionalPropertiesToJsonSchema(jsonSchema2) {
1271
1300
  return jsonSchema2;
1272
1301
  }
1273
1302
 
1274
- // src/zod-to-json-schema/get-relative-path.ts
1275
- var getRelativePath = (pathA, pathB) => {
1276
- let i = 0;
1277
- for (; i < pathA.length && i < pathB.length; i++) {
1278
- if (pathA[i] !== pathB[i]) break;
1279
- }
1280
- return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
1281
- };
1282
-
1283
1303
  // src/zod-to-json-schema/options.ts
1284
1304
  var ignoreOverride = /* @__PURE__ */ Symbol(
1285
1305
  "Let zodToJsonSchema decide on which parser to use"
@@ -2311,6 +2331,15 @@ var selectParser = (def, typeName, refs) => {
2311
2331
  }
2312
2332
  };
2313
2333
 
2334
+ // src/zod-to-json-schema/get-relative-path.ts
2335
+ var getRelativePath = (pathA, pathB) => {
2336
+ let i = 0;
2337
+ for (; i < pathA.length && i < pathB.length; i++) {
2338
+ if (pathA[i] !== pathB[i]) break;
2339
+ }
2340
+ return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
2341
+ };
2342
+
2314
2343
  // src/zod-to-json-schema/parse-def.ts
2315
2344
  function parseDef(def, refs, forceResolution = false) {
2316
2345
  var _a2;
@@ -2500,34 +2529,7 @@ function zodSchema(zodSchema2, options) {
2500
2529
  }
2501
2530
  }
2502
2531
 
2503
- // src/schema.ts
2504
- var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
2505
- function lazySchema(createSchema) {
2506
- let schema;
2507
- return () => {
2508
- if (schema == null) {
2509
- schema = createSchema();
2510
- }
2511
- return schema;
2512
- };
2513
- }
2514
- function jsonSchema(jsonSchema2, {
2515
- validate
2516
- } = {}) {
2517
- return {
2518
- [schemaSymbol]: true,
2519
- _type: void 0,
2520
- // should never be used directly
2521
- [validatorSymbol]: true,
2522
- get jsonSchema() {
2523
- if (typeof jsonSchema2 === "function") {
2524
- jsonSchema2 = jsonSchema2();
2525
- }
2526
- return jsonSchema2;
2527
- },
2528
- validate
2529
- };
2530
- }
2532
+ // src/as-schema.ts
2531
2533
  function isSchema(value) {
2532
2534
  return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
2533
2535
  }