integrate-sdk 0.7.25 → 0.7.26

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.
@@ -9,5 +9,4 @@ export * from "./solid-start.js";
9
9
  export * from "./svelte-kit.js";
10
10
  export * from "./tanstack-start.js";
11
11
  export * from "./base-handler.js";
12
- export * from "./auto-routes.js";
13
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
@@ -409,127 +409,6 @@ var init_errors = __esm(() => {
409
409
  };
410
410
  });
411
411
 
412
- // auto-routes.ts
413
- var globalOAuthConfig = null;
414
- function setGlobalOAuthConfig(config) {
415
- globalOAuthConfig = config;
416
- }
417
- function getGlobalOAuthConfig() {
418
- return globalOAuthConfig;
419
- }
420
- async function POST(req, context) {
421
- if (!globalOAuthConfig) {
422
- throw new Error("OAuth configuration not found. Did you configure oauthProviders in createMCPClient?");
423
- }
424
- const handler = new OAuthHandler(globalOAuthConfig);
425
- const action = context?.params?.action;
426
- if (!action) {
427
- return createErrorResponse("Missing action parameter", 400);
428
- }
429
- try {
430
- if (action === "authorize") {
431
- const body = await parseRequestBody(req);
432
- const result = await handler.handleAuthorize(body);
433
- return createSuccessResponse(result);
434
- }
435
- if (action === "callback") {
436
- const body = await parseRequestBody(req);
437
- const result = await handler.handleCallback(body);
438
- return createSuccessResponse(result);
439
- }
440
- if (action === "disconnect") {
441
- const body = await parseRequestBody(req);
442
- const accessToken = extractAccessToken(req);
443
- if (!accessToken) {
444
- return createErrorResponse("Missing or invalid Authorization header", 400);
445
- }
446
- if (!body.provider) {
447
- return createErrorResponse("Missing provider in request body", 400);
448
- }
449
- const result = await handler.handleDisconnect({ provider: body.provider }, accessToken);
450
- return createSuccessResponse(result);
451
- }
452
- return createErrorResponse(`Unknown action: ${action}`, 404);
453
- } catch (error) {
454
- console.error(`[OAuth ${action}] Error:`, error);
455
- return createErrorResponse(error.message, 500);
456
- }
457
- }
458
- async function GET(req, context) {
459
- if (!globalOAuthConfig) {
460
- throw new Error("OAuth configuration not found. Did you configure oauthProviders in createMCPClient?");
461
- }
462
- const handler = new OAuthHandler(globalOAuthConfig);
463
- const action = context?.params?.action;
464
- if (!action) {
465
- return createErrorResponse("Missing action parameter", 400);
466
- }
467
- try {
468
- if (action === "status") {
469
- const provider = extractProvider(req);
470
- const accessToken = extractAccessToken(req);
471
- if (!provider) {
472
- return createErrorResponse("Missing provider parameter", 400);
473
- }
474
- if (!accessToken) {
475
- return createErrorResponse("Missing or invalid Authorization header", 400);
476
- }
477
- const result = await handler.handleStatus(provider, accessToken);
478
- return createSuccessResponse(result);
479
- }
480
- return createErrorResponse(`Unknown action: ${action}`, 404);
481
- } catch (error) {
482
- console.error(`[OAuth ${action}] Error:`, error);
483
- return createErrorResponse(error.message, 500);
484
- }
485
- }
486
- async function parseRequestBody(req) {
487
- if (typeof req.json === "function") {
488
- return await req.json();
489
- }
490
- throw new Error("Unable to parse request body");
491
- }
492
- function extractAccessToken(req) {
493
- if (req.headers?.get) {
494
- const authHeader = req.headers.get("authorization");
495
- if (authHeader && authHeader.startsWith("Bearer ")) {
496
- return authHeader.substring(7);
497
- }
498
- }
499
- return;
500
- }
501
- function extractProvider(req) {
502
- let url;
503
- if (req.nextUrl) {
504
- url = new URL(req.nextUrl);
505
- } else if (req.url) {
506
- url = new URL(req.url);
507
- } else {
508
- return;
509
- }
510
- return url.searchParams.get("provider") || undefined;
511
- }
512
- function createSuccessResponse(data) {
513
- if (typeof globalThis.NextResponse !== "undefined") {
514
- const NextResponse = globalThis.NextResponse;
515
- return NextResponse.json(data);
516
- }
517
- return new Response(JSON.stringify(data), {
518
- status: 200,
519
- headers: { "Content-Type": "application/json" }
520
- });
521
- }
522
- function createErrorResponse(message, status) {
523
- if (typeof globalThis.NextResponse !== "undefined") {
524
- const NextResponse = globalThis.NextResponse;
525
- return NextResponse.json({ error: message }, { status });
526
- }
527
- return new Response(JSON.stringify({ error: message }), {
528
- status,
529
- headers: { "Content-Type": "application/json" }
530
- });
531
- }
532
-
533
412
  // nextjs.ts
534
413
  function createNextOAuthHandler(config) {
535
414
  const handler = new OAuthHandler(config);
@@ -2162,12 +2041,8 @@ export {
2162
2041
  toSolidStartHandler,
2163
2042
  toNodeHandler,
2164
2043
  svelteKitHandler,
2165
- setGlobalOAuthConfig,
2166
- getGlobalOAuthConfig,
2167
2044
  fromNodeHeaders,
2168
2045
  createTanStackOAuthHandler,
2169
2046
  createNextOAuthHandler,
2170
- POST,
2171
- OAuthHandler,
2172
- GET
2047
+ OAuthHandler
2173
2048
  };