@ai-sdk/mcp 1.0.80 → 1.0.81
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 +6 -0
- package/dist/index.js +19 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/tool/oauth.ts +30 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1199,9 +1199,11 @@ async function authInternal(provider, {
|
|
|
1199
1199
|
resourceMetadataUrl,
|
|
1200
1200
|
fetchFn
|
|
1201
1201
|
}) {
|
|
1202
|
-
var _a3, _b3;
|
|
1202
|
+
var _a3, _b3, _c;
|
|
1203
1203
|
let resourceMetadata;
|
|
1204
1204
|
let authorizationServerUrl;
|
|
1205
|
+
let clientInformation;
|
|
1206
|
+
let callbackAuthorizationServerInformation;
|
|
1205
1207
|
assertResourceMetadataUrlSameOrigin(serverUrl, resourceMetadataUrl);
|
|
1206
1208
|
try {
|
|
1207
1209
|
resourceMetadata = await discoverOAuthProtectedResourceMetadata(
|
|
@@ -1214,15 +1216,24 @@ async function authInternal(provider, {
|
|
|
1214
1216
|
}
|
|
1215
1217
|
} catch (e) {
|
|
1216
1218
|
}
|
|
1219
|
+
if (authorizationCode !== void 0) {
|
|
1220
|
+
clientInformation = await Promise.resolve(provider.clientInformation());
|
|
1221
|
+
if (clientInformation) {
|
|
1222
|
+
callbackAuthorizationServerInformation = await getStoredAuthorizationServerInformation({
|
|
1223
|
+
provider,
|
|
1224
|
+
clientInformation
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1217
1228
|
if (!authorizationServerUrl) {
|
|
1218
|
-
authorizationServerUrl = serverUrl;
|
|
1229
|
+
authorizationServerUrl = (_a3 = callbackAuthorizationServerInformation == null ? void 0 : callbackAuthorizationServerInformation.authorizationServerUrl) != null ? _a3 : serverUrl;
|
|
1219
1230
|
}
|
|
1220
1231
|
const resource = await selectResourceURL(
|
|
1221
1232
|
serverUrl,
|
|
1222
1233
|
provider,
|
|
1223
1234
|
resourceMetadata
|
|
1224
1235
|
);
|
|
1225
|
-
await ((
|
|
1236
|
+
await ((_b3 = provider.validateAuthorizationServerURL) == null ? void 0 : _b3.call(
|
|
1226
1237
|
provider,
|
|
1227
1238
|
serverUrl,
|
|
1228
1239
|
authorizationServerUrl
|
|
@@ -1240,7 +1251,9 @@ async function authInternal(provider, {
|
|
|
1240
1251
|
resourceMetadata,
|
|
1241
1252
|
clientMetadata
|
|
1242
1253
|
});
|
|
1243
|
-
|
|
1254
|
+
if (authorizationCode === void 0) {
|
|
1255
|
+
clientInformation = await Promise.resolve(provider.clientInformation());
|
|
1256
|
+
}
|
|
1244
1257
|
if (!clientInformation) {
|
|
1245
1258
|
if (authorizationCode !== void 0) {
|
|
1246
1259
|
throw new Error(
|
|
@@ -1275,7 +1288,7 @@ async function authInternal(provider, {
|
|
|
1275
1288
|
);
|
|
1276
1289
|
}
|
|
1277
1290
|
}
|
|
1278
|
-
const storedAuthorizationServerInformation = await getStoredAuthorizationServerInformation({
|
|
1291
|
+
const storedAuthorizationServerInformation = callbackAuthorizationServerInformation != null ? callbackAuthorizationServerInformation : await getStoredAuthorizationServerInformation({
|
|
1279
1292
|
provider,
|
|
1280
1293
|
clientInformation
|
|
1281
1294
|
});
|
|
@@ -1320,7 +1333,7 @@ async function authInternal(provider, {
|
|
|
1320
1333
|
currentAuthorizationServerInformation
|
|
1321
1334
|
});
|
|
1322
1335
|
} else {
|
|
1323
|
-
await ((
|
|
1336
|
+
await ((_c = provider.invalidateCredentials) == null ? void 0 : _c.call(provider, "tokens"));
|
|
1324
1337
|
}
|
|
1325
1338
|
try {
|
|
1326
1339
|
if (storedAuthorizationServerInformation) {
|