ai 5.0.264 → 5.0.265

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,17 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.265
4
+
5
+ ### Patch Changes
6
+
7
+ - bf29419: chore: enable dead code lint rules
8
+ - 0519802: fix(ai): preserve parsed metadata and data values when validating UI messages
9
+ - Updated dependencies [0430ee6]
10
+ - Updated dependencies [bf29419]
11
+ - Updated dependencies [14ecfdc]
12
+ - @ai-sdk/gateway@2.0.157
13
+ - @ai-sdk/provider-utils@3.0.39
14
+
3
15
  ## 5.0.264
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -816,7 +816,7 @@ function detectMediaType({
816
816
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
817
817
 
818
818
  // src/version.ts
819
- var VERSION = true ? "5.0.264" : "0.0.0-test";
819
+ var VERSION = true ? "5.0.265" : "0.0.0-test";
820
820
 
821
821
  // src/util/download/download.ts
822
822
  var download = async ({
@@ -2025,8 +2025,8 @@ var DefaultGeneratedFile = class {
2025
2025
  }
2026
2026
  };
2027
2027
  var DefaultGeneratedFileWithType = class extends DefaultGeneratedFile {
2028
- constructor(options) {
2029
- super(options);
2028
+ constructor() {
2029
+ super(...arguments);
2030
2030
  this.type = "file";
2031
2031
  }
2032
2032
  };
@@ -2994,8 +2994,6 @@ function writeToServerResponse({
2994
2994
  });
2995
2995
  }
2996
2996
  }
2997
- } catch (error) {
2998
- throw error;
2999
2997
  } finally {
3000
2998
  response.end();
3001
2999
  }
@@ -6653,7 +6651,6 @@ async function embedMany({
6653
6651
  }),
6654
6652
  tracer,
6655
6653
  fn: async (span) => {
6656
- var _a16;
6657
6654
  const [
6658
6655
  maxEmbeddingsPerCall,
6659
6656
  maxInputBytesPerCall,
@@ -6686,7 +6683,7 @@ async function embedMany({
6686
6683
  }),
6687
6684
  tracer,
6688
6685
  fn: async (doEmbedSpan) => {
6689
- var _a17;
6686
+ var _a16;
6690
6687
  const modelResponse = await model.doEmbed({
6691
6688
  values,
6692
6689
  abortSignal,
@@ -6694,7 +6691,7 @@ async function embedMany({
6694
6691
  providerOptions
6695
6692
  });
6696
6693
  const embeddings3 = modelResponse.embeddings;
6697
- const usage2 = (_a17 = modelResponse.usage) != null ? _a17 : { tokens: NaN };
6694
+ const usage2 = (_a16 = modelResponse.usage) != null ? _a16 : { tokens: NaN };
6698
6695
  doEmbedSpan.setAttributes(
6699
6696
  selectTelemetryAttributes({
6700
6697
  telemetry,
@@ -6772,7 +6769,7 @@ async function embedMany({
6772
6769
  }),
6773
6770
  tracer,
6774
6771
  fn: async (doEmbedSpan) => {
6775
- var _a17;
6772
+ var _a16;
6776
6773
  const modelResponse = await model.doEmbed({
6777
6774
  values: chunk,
6778
6775
  abortSignal,
@@ -6780,7 +6777,7 @@ async function embedMany({
6780
6777
  providerOptions
6781
6778
  });
6782
6779
  const embeddings2 = modelResponse.embeddings;
6783
- const usage = (_a17 = modelResponse.usage) != null ? _a17 : { tokens: NaN };
6780
+ const usage = (_a16 = modelResponse.usage) != null ? _a16 : { tokens: NaN };
6784
6781
  doEmbedSpan.setAttributes(
6785
6782
  selectTelemetryAttributes({
6786
6783
  telemetry,
@@ -6817,7 +6814,7 @@ async function embedMany({
6817
6814
  result.providerMetadata
6818
6815
  )) {
6819
6816
  providerMetadata[providerName] = {
6820
- ...(_a16 = providerMetadata[providerName]) != null ? _a16 : {},
6817
+ ...providerMetadata[providerName],
6821
6818
  ...metadata
6822
6819
  };
6823
6820
  }
@@ -10439,7 +10436,7 @@ async function safeValidateUIMessages({
10439
10436
  }
10440
10437
  if (metadataSchema) {
10441
10438
  for (const message of validatedMessages) {
10442
- await (0, import_provider_utils33.validateTypes)({
10439
+ message.metadata = await (0, import_provider_utils33.validateTypes)({
10443
10440
  value: message.metadata,
10444
10441
  schema: metadataSchema
10445
10442
  });
@@ -10462,7 +10459,7 @@ async function safeValidateUIMessages({
10462
10459
  })
10463
10460
  };
10464
10461
  }
10465
- await (0, import_provider_utils33.validateTypes)({
10462
+ dataPart.data = await (0, import_provider_utils33.validateTypes)({
10466
10463
  value: dataPart.data,
10467
10464
  schema: dataSchema
10468
10465
  });