@ai-sdk/google 3.0.81 → 3.0.82

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/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "3.0.81" : "0.0.0-test";
10
+ var VERSION = true ? "3.0.82" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -1376,11 +1376,25 @@ function parsePath(rawPath) {
1376
1376
  }
1377
1377
  return segments;
1378
1378
  }
1379
+ var hasOwn = Object.prototype.hasOwnProperty;
1380
+ function hasOwnProperty(obj, key) {
1381
+ return hasOwn.call(obj, key);
1382
+ }
1383
+ function defineOwnProperty(obj, key, value) {
1384
+ Object.defineProperty(obj, key, {
1385
+ value,
1386
+ enumerable: true,
1387
+ configurable: true,
1388
+ writable: true
1389
+ });
1390
+ }
1379
1391
  function getNestedValue(obj, segments) {
1380
1392
  let current = obj;
1381
1393
  for (const seg of segments) {
1382
1394
  if (current == null || typeof current !== "object") return void 0;
1383
- current = current[seg];
1395
+ const currentRecord = current;
1396
+ if (!hasOwnProperty(currentRecord, seg)) return void 0;
1397
+ current = currentRecord[seg];
1384
1398
  }
1385
1399
  return current;
1386
1400
  }
@@ -1389,12 +1403,12 @@ function setNestedValue(obj, segments, value) {
1389
1403
  for (let i = 0; i < segments.length - 1; i++) {
1390
1404
  const seg = segments[i];
1391
1405
  const nextSeg = segments[i + 1];
1392
- if (current[seg] == null) {
1393
- current[seg] = typeof nextSeg === "number" ? [] : {};
1406
+ if (!hasOwnProperty(current, seg) || current[seg] == null) {
1407
+ defineOwnProperty(current, seg, typeof nextSeg === "number" ? [] : {});
1394
1408
  }
1395
1409
  current = current[seg];
1396
1410
  }
1397
- current[segments[segments.length - 1]] = value;
1411
+ defineOwnProperty(current, segments[segments.length - 1], value);
1398
1412
  }
1399
1413
  function resolvePartialArgValue(arg) {
1400
1414
  var _a, _b;
@@ -2955,6 +2969,7 @@ import {
2955
2969
  createJsonResponseHandler as createJsonResponseHandler4,
2956
2970
  delay,
2957
2971
  getFromApi,
2972
+ isSameOrigin,
2958
2973
  lazySchema as lazySchema12,
2959
2974
  parseProviderOptions as parseProviderOptions4,
2960
2975
  postJsonToApi as postJsonToApi4,
@@ -3140,7 +3155,7 @@ var GoogleGenerativeAIVideoModel = class {
3140
3155
  const apiKey = resolvedHeaders == null ? void 0 : resolvedHeaders["x-goog-api-key"];
3141
3156
  for (const generatedSample of response.generateVideoResponse.generatedSamples) {
3142
3157
  if ((_h = generatedSample.video) == null ? void 0 : _h.uri) {
3143
- const urlWithAuth = apiKey ? `${generatedSample.video.uri}${generatedSample.video.uri.includes("?") ? "&" : "?"}key=${apiKey}` : generatedSample.video.uri;
3158
+ const urlWithAuth = apiKey && isSameOrigin(generatedSample.video.uri, this.config.baseURL) ? `${generatedSample.video.uri}${generatedSample.video.uri.includes("?") ? "&" : "?"}key=${apiKey}` : generatedSample.video.uri;
3144
3159
  videos.push({
3145
3160
  type: "url",
3146
3161
  url: urlWithAuth,