integrate-sdk 0.7.24 → 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.
Files changed (37) hide show
  1. package/dist/adapters/auto-routes.d.ts +51 -0
  2. package/dist/adapters/auto-routes.d.ts.map +1 -0
  3. package/dist/adapters/auto-routes.js +2 -2
  4. package/dist/adapters/base-handler.d.ts +182 -0
  5. package/dist/adapters/base-handler.d.ts.map +1 -0
  6. package/dist/adapters/base-handler.js +1 -1
  7. package/dist/adapters/index.d.ts +12 -0
  8. package/dist/adapters/index.d.ts.map +1 -0
  9. package/dist/adapters/index.js +2048 -0
  10. package/dist/adapters/nextjs-oauth-redirect.d.ts +41 -0
  11. package/dist/adapters/nextjs-oauth-redirect.d.ts.map +1 -0
  12. package/dist/adapters/nextjs-oauth-redirect.js +2 -2
  13. package/dist/adapters/nextjs.d.ts +358 -0
  14. package/dist/adapters/nextjs.d.ts.map +1 -0
  15. package/dist/adapters/nextjs.js +3 -3
  16. package/dist/adapters/node.d.ts +48 -0
  17. package/dist/adapters/node.d.ts.map +1 -0
  18. package/dist/adapters/node.js +2 -2
  19. package/dist/adapters/solid-start.d.ts +8 -0
  20. package/dist/adapters/solid-start.d.ts.map +1 -0
  21. package/dist/adapters/solid-start.js +12 -12
  22. package/dist/adapters/svelte-kit.d.ts +83 -0
  23. package/dist/adapters/svelte-kit.d.ts.map +1 -0
  24. package/dist/adapters/svelte-kit.js +13 -13
  25. package/dist/adapters/tanstack-start.d.ts +53 -0
  26. package/dist/adapters/tanstack-start.d.ts.map +1 -0
  27. package/dist/adapters/tanstack-start.js +1 -1
  28. package/dist/index.js +0 -4202
  29. package/dist/server.d.ts +12 -0
  30. package/dist/server.d.ts.map +1 -1
  31. package/dist/server.js +4708 -0
  32. package/dist/src/adapters/index.d.ts +12 -0
  33. package/dist/src/adapters/index.d.ts.map +1 -0
  34. package/dist/src/index.d.ts +0 -2
  35. package/dist/src/index.d.ts.map +1 -1
  36. package/package.json +3 -63
  37. package/server.ts +12 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Next.js OAuth Redirect Handler
3
+ * Handles OAuth callback redirects and forwards parameters to the client
4
+ */
5
+ type NextRequest = any;
6
+ type NextResponse = any;
7
+ export interface OAuthRedirectConfig {
8
+ /** URL to redirect to after OAuth callback (default: '/') */
9
+ redirectUrl?: string;
10
+ /** URL to redirect to on OAuth error (default: '/auth-error') */
11
+ errorRedirectUrl?: string;
12
+ }
13
+ /**
14
+ * Create OAuth redirect handler for Next.js
15
+ *
16
+ * This handler processes OAuth callbacks from providers and redirects
17
+ * to your application with the OAuth parameters encoded in the URL.
18
+ *
19
+ * The handler automatically extracts the return URL from the state parameter
20
+ * (if provided during authorization), with fallbacks to referrer or configured URL.
21
+ *
22
+ * @param config - Redirect configuration
23
+ * @returns Next.js route handler
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * // app/oauth/callback/route.ts
28
+ * import { createOAuthRedirectHandler } from 'integrate-sdk';
29
+ *
30
+ * // Simple usage with fallback URL
31
+ * export const GET = createOAuthRedirectHandler({
32
+ * redirectUrl: '/', // Fallback if no return URL in state
33
+ * });
34
+ *
35
+ * // Dynamic return URLs work automatically when using client.authorize()
36
+ * // await client.authorize('github', { returnUrl: '/marketplace/github' });
37
+ * ```
38
+ */
39
+ export declare function createOAuthRedirectHandler(config?: OAuthRedirectConfig): (req: NextRequest) => Promise<NextResponse>;
40
+ export {};
41
+ //# sourceMappingURL=nextjs-oauth-redirect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextjs-oauth-redirect.d.ts","sourceRoot":"","sources":["../../../src/adapters/nextjs-oauth-redirect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,KAAK,WAAW,GAAG,GAAG,CAAC;AACvB,KAAK,YAAY,GAAG,GAAG,CAAC;AAExB,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,CAAC,EAAE,mBAAmB,IAI3C,KAAK,WAAW,KAAG,OAAO,CAAC,YAAY,CAAC,CA8DnE"}
@@ -10,7 +10,7 @@ var __export = (target, all) => {
10
10
  };
11
11
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
12
12
 
13
- // src/oauth/pkce.ts
13
+ // ../oauth/pkce.ts
14
14
  var exports_pkce = {};
15
15
  __export(exports_pkce, {
16
16
  parseState: () => parseState,
@@ -106,7 +106,7 @@ function base64UrlDecode(str) {
106
106
  }
107
107
  }
108
108
 
109
- // src/adapters/nextjs-oauth-redirect.ts
109
+ // nextjs-oauth-redirect.ts
110
110
  function createOAuthRedirectHandler(config) {
111
111
  const defaultRedirectUrl = config?.redirectUrl || "/";
112
112
  const errorRedirectUrl = config?.errorRedirectUrl || "/auth-error";
@@ -0,0 +1,358 @@
1
+ /**
2
+ * Next.js OAuth Route Adapter
3
+ * Provides OAuth route handlers for Next.js App Router
4
+ *
5
+ * Note: This file uses type imports only to avoid requiring Next.js at build time.
6
+ * The actual Next.js types are used at runtime when available.
7
+ */
8
+ import { type OAuthHandlerConfig } from './base-handler.js';
9
+ type NextRequest = any;
10
+ type NextResponse = any;
11
+ /**
12
+ * Create Next.js OAuth route handlers
13
+ *
14
+ * Use this to create secure OAuth API routes in your Next.js application
15
+ * that handle authorization with server-side secrets.
16
+ *
17
+ * @param config - OAuth handler configuration with provider credentials
18
+ * @returns Object with authorize, callback, status, and disconnect route handlers, plus a unified handler
19
+ *
20
+ * @example
21
+ * **Simple Setup (Recommended)** - One route file handles everything:
22
+ *
23
+ * ```typescript
24
+ * // app/api/integrate/oauth/[action]/route.ts
25
+ * import { createNextOAuthHandler } from 'integrate-sdk';
26
+ *
27
+ * const handler = createNextOAuthHandler({
28
+ * providers: {
29
+ * github: {
30
+ * clientId: process.env.GITHUB_CLIENT_ID!,
31
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
32
+ * },
33
+ * },
34
+ * });
35
+ *
36
+ * export const { POST, GET } = handler.createRoutes();
37
+ * ```
38
+ *
39
+ * @example
40
+ * **Advanced Setup** - Separate routes for each action:
41
+ *
42
+ * ```typescript
43
+ * // app/api/integrate/oauth/authorize/route.ts
44
+ * export const POST = handler.authorize;
45
+ *
46
+ * // app/api/integrate/oauth/callback/route.ts
47
+ * export const POST = handler.callback;
48
+ *
49
+ * // app/api/integrate/oauth/status/route.ts
50
+ * export const GET = handler.status;
51
+ *
52
+ * // app/api/integrate/oauth/disconnect/route.ts
53
+ * export const POST = handler.disconnect;
54
+ * ```
55
+ */
56
+ export declare function createNextOAuthHandler(config: OAuthHandlerConfig): {
57
+ /**
58
+ * POST /api/integrate/oauth/authorize
59
+ *
60
+ * Request authorization URL from MCP server with server-side OAuth credentials
61
+ *
62
+ * Request body:
63
+ * ```json
64
+ * {
65
+ * "provider": "github",
66
+ * "scopes": ["repo", "user"],
67
+ * "state": "random-state-string",
68
+ * "codeChallenge": "pkce-code-challenge",
69
+ * "codeChallengeMethod": "S256",
70
+ * "redirectUri": "https://yourapp.com/oauth/callback"
71
+ * }
72
+ * ```
73
+ *
74
+ * Response:
75
+ * ```json
76
+ * {
77
+ * "authorizationUrl": "https://github.com/login/oauth/authorize?..."
78
+ * }
79
+ * ```
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * // app/api/integrate/oauth/authorize/route.ts
84
+ * import { createNextOAuthHandler } from 'integrate-sdk';
85
+ *
86
+ * const handler = createNextOAuthHandler({
87
+ * * providers: {
88
+ * github: {
89
+ * clientId: process.env.GITHUB_CLIENT_ID!,
90
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
91
+ * },
92
+ * },
93
+ * });
94
+ *
95
+ * export const POST = handler.authorize;
96
+ * ```
97
+ */
98
+ authorize(req: NextRequest): Promise<NextResponse>;
99
+ /**
100
+ * POST /api/integrate/oauth/callback
101
+ *
102
+ * Exchange authorization code for session token
103
+ *
104
+ * Request body:
105
+ * ```json
106
+ * {
107
+ * "provider": "github",
108
+ * "code": "authorization-code",
109
+ * "codeVerifier": "pkce-code-verifier",
110
+ * "state": "state-from-authorize"
111
+ * }
112
+ * ```
113
+ *
114
+ * Response:
115
+ * ```json
116
+ * {
117
+ * "sessionToken": "session-token-123",
118
+ * "provider": "github",
119
+ * "scopes": ["repo", "user"],
120
+ * "expiresAt": 1234567890
121
+ * }
122
+ * ```
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * // app/api/integrate/oauth/callback/route.ts
127
+ * import { createNextOAuthHandler } from 'integrate-sdk';
128
+ *
129
+ * const handler = createNextOAuthHandler({
130
+ * * providers: {
131
+ * github: {
132
+ * clientId: process.env.GITHUB_CLIENT_ID!,
133
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
134
+ * },
135
+ * },
136
+ * });
137
+ *
138
+ * export const POST = handler.callback;
139
+ * ```
140
+ */
141
+ callback(req: NextRequest): Promise<NextResponse>;
142
+ /**
143
+ * GET /api/integrate/oauth/status?provider=github
144
+ *
145
+ * Check if a provider is currently authorized
146
+ *
147
+ * Query parameters:
148
+ * - provider: Provider to check (e.g., "github")
149
+ *
150
+ * Headers:
151
+ * - Authorization: Bearer <access_token>
152
+ *
153
+ * Response:
154
+ * ```json
155
+ * {
156
+ * "authorized": true,
157
+ * "scopes": ["repo", "user"],
158
+ * "expiresAt": "2025-11-06T00:32:08Z"
159
+ * }
160
+ * ```
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * // app/api/integrate/oauth/status/route.ts
165
+ * import { createNextOAuthHandler } from 'integrate-sdk';
166
+ *
167
+ * const handler = createNextOAuthHandler({
168
+ * * providers: {
169
+ * github: {
170
+ * clientId: process.env.GITHUB_CLIENT_ID!,
171
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
172
+ * },
173
+ * },
174
+ * });
175
+ *
176
+ * export const GET = handler.status;
177
+ * ```
178
+ */
179
+ status(req: NextRequest): Promise<NextResponse>;
180
+ /**
181
+ * POST /api/integrate/oauth/disconnect
182
+ *
183
+ * Revoke authorization for a specific provider
184
+ *
185
+ * Request headers:
186
+ * - Authorization: Bearer <access_token>
187
+ *
188
+ * Request body:
189
+ * ```json
190
+ * {
191
+ * "provider": "github"
192
+ * }
193
+ * ```
194
+ *
195
+ * Response:
196
+ * ```json
197
+ * {
198
+ * "success": true,
199
+ * "provider": "github"
200
+ * }
201
+ * ```
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * // app/api/integrate/oauth/disconnect/route.ts
206
+ * import { createNextOAuthHandler } from 'integrate-sdk';
207
+ *
208
+ * const handler = createNextOAuthHandler({
209
+ * providers: {
210
+ * github: {
211
+ * clientId: process.env.GITHUB_CLIENT_ID!,
212
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
213
+ * },
214
+ * },
215
+ * });
216
+ *
217
+ * export const POST = handler.disconnect;
218
+ * ```
219
+ */
220
+ disconnect(req: NextRequest): Promise<NextResponse>;
221
+ /**
222
+ * Create unified route handlers for catch-all route
223
+ *
224
+ * This is the simplest way to set up OAuth routes - create a single catch-all
225
+ * route file that handles all OAuth actions.
226
+ *
227
+ * @returns Object with POST and GET handlers for Next.js dynamic routes
228
+ *
229
+ * @example
230
+ * ```typescript
231
+ * // app/api/integrate/oauth/[action]/route.ts
232
+ * import { createNextOAuthHandler } from 'integrate-sdk';
233
+ *
234
+ * const handler = createNextOAuthHandler({
235
+ * providers: {
236
+ * github: {
237
+ * clientId: process.env.GITHUB_CLIENT_ID!,
238
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
239
+ * },
240
+ * },
241
+ * });
242
+ *
243
+ * export const { POST, GET } = handler.createRoutes();
244
+ * ```
245
+ */
246
+ createRoutes(): {
247
+ /**
248
+ * POST handler for authorize, callback, and disconnect actions
249
+ */
250
+ POST(req: NextRequest, context: {
251
+ params: {
252
+ action: string;
253
+ } | Promise<{
254
+ action: string;
255
+ }>;
256
+ }): Promise<NextResponse>;
257
+ /**
258
+ * GET handler for status action
259
+ */
260
+ GET(req: NextRequest, context: {
261
+ params: {
262
+ action: string;
263
+ } | Promise<{
264
+ action: string;
265
+ }>;
266
+ }): Promise<NextResponse>;
267
+ };
268
+ /**
269
+ * POST /api/integrate/mcp
270
+ *
271
+ * Handle MCP tool call requests from client
272
+ *
273
+ * Request body:
274
+ * ```json
275
+ * {
276
+ * "name": "github_list_own_repos",
277
+ * "arguments": {}
278
+ * }
279
+ * ```
280
+ *
281
+ * Headers:
282
+ * - Authorization: Bearer <provider_access_token>
283
+ *
284
+ * Response:
285
+ * ```json
286
+ * {
287
+ * "content": [{"type": "text", "text": "..."}],
288
+ * "isError": false
289
+ * }
290
+ * ```
291
+ */
292
+ mcp(req: NextRequest): Promise<NextResponse>;
293
+ /**
294
+ * Create unified catch-all route handler
295
+ *
296
+ * This is the simplest way to set up OAuth routes - create a single catch-all
297
+ * route file that handles ALL OAuth actions including provider redirects.
298
+ *
299
+ * @param redirectConfig - Configuration for OAuth redirect behavior
300
+ * @returns Object with POST and GET handlers for Next.js catch-all routes
301
+ *
302
+ * @example
303
+ * ```typescript
304
+ * // app/api/integrate/[...all]/route.ts
305
+ * import { createNextOAuthHandler } from 'integrate-sdk';
306
+ *
307
+ * const handler = createNextOAuthHandler({
308
+ * providers: {
309
+ * github: {
310
+ * clientId: process.env.GITHUB_CLIENT_ID!,
311
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
312
+ * },
313
+ * },
314
+ * });
315
+ *
316
+ * export const { POST, GET } = handler.toNextJsHandler({
317
+ * redirectUrl: '/',
318
+ * });
319
+ * ```
320
+ *
321
+ * This single route file handles:
322
+ * - POST /api/integrate/oauth/authorize - Get authorization URL
323
+ * - POST /api/integrate/oauth/callback - Exchange code for token
324
+ * - GET /api/integrate/oauth/callback - Provider OAuth redirect
325
+ * - GET /api/integrate/oauth/status - Check authorization status
326
+ * - POST /api/integrate/oauth/disconnect - Disconnect provider
327
+ * - POST /api/integrate/mcp - Execute MCP tool calls
328
+ */
329
+ toNextJsHandler(redirectConfig?: {
330
+ /** URL to redirect to after OAuth callback (default: '/') */
331
+ redirectUrl?: string;
332
+ /** URL to redirect to on OAuth error (default: '/auth-error') */
333
+ errorRedirectUrl?: string;
334
+ }): {
335
+ /**
336
+ * POST handler for authorize, callback, and disconnect actions
337
+ */
338
+ POST(req: NextRequest, context: {
339
+ params: {
340
+ all: string[];
341
+ } | Promise<{
342
+ all: string[];
343
+ }>;
344
+ }): Promise<NextResponse>;
345
+ /**
346
+ * GET handler for status action and OAuth provider redirects
347
+ */
348
+ GET(req: NextRequest, context: {
349
+ params: {
350
+ all: string[];
351
+ } | Promise<{
352
+ all: string[];
353
+ }>;
354
+ }): Promise<NextResponse>;
355
+ };
356
+ };
357
+ export {};
358
+ //# sourceMappingURL=nextjs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../../../src/adapters/nextjs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,KAAK,WAAW,GAAG,GAAG,CAAC;AACvB,KAAK,YAAY,GAAG,GAAG,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB;IAI7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;mBACkB,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAcxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;kBACiB,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAcvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;gBACe,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IA+BrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;oBACmB,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAiCzD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;;QAGC;;WAEG;kBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,GAAG,OAAO,CAAC;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,GACpE,OAAO,CAAC,YAAY,CAAC;QA2BxB;;WAEG;iBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,GAAG,OAAO,CAAC;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,GACpE,OAAO,CAAC,YAAY,CAAC;;IAiB5B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;aACY,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAelD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;qCAC8B;QAC/B,6DAA6D;QAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,iEAAiE;QACjE,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B;QAKG;;WAEG;kBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,GAAG,EAAE,MAAM,EAAE,CAAA;aAAE,GAAG,OAAO,CAAC;gBAAE,GAAG,EAAE,MAAM,EAAE,CAAA;aAAE,CAAC,CAAA;SAAE,GAClE,OAAO,CAAC,YAAY,CAAC;QAsCxB;;WAEG;iBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,GAAG,EAAE,MAAM,EAAE,CAAA;aAAE,GAAG,OAAO,CAAC;gBAAE,GAAG,EAAE,MAAM,EAAE,CAAA;aAAE,CAAC,CAAA;SAAE,GAClE,OAAO,CAAC,YAAY,CAAC;;EA+F/B"}
@@ -10,7 +10,7 @@ var __export = (target, all) => {
10
10
  };
11
11
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
12
12
 
13
- // src/adapters/base-handler.ts
13
+ // base-handler.ts
14
14
  class OAuthHandler {
15
15
  config;
16
16
  serverUrl;
@@ -175,7 +175,7 @@ class OAuthHandler {
175
175
  }
176
176
  var MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp";
177
177
 
178
- // src/oauth/pkce.ts
178
+ // ../oauth/pkce.ts
179
179
  var exports_pkce = {};
180
180
  __export(exports_pkce, {
181
181
  parseState: () => parseState,
@@ -271,7 +271,7 @@ function base64UrlDecode(str) {
271
271
  }
272
272
  }
273
273
 
274
- // src/adapters/nextjs.ts
274
+ // nextjs.ts
275
275
  function createNextOAuthHandler(config) {
276
276
  const handler = new OAuthHandler(config);
277
277
  const handlers = {
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Node.js OAuth Route Adapter
3
+ * Provides OAuth route handlers for Node.js HTTP servers
4
+ */
5
+ import { type OAuthHandlerConfig } from './base-handler.js';
6
+ import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'http';
7
+ /**
8
+ * Convert Node.js IncomingHttpHeaders to Web Headers
9
+ *
10
+ * @param nodeHeaders - Node.js request headers
11
+ * @returns Web API Headers object
12
+ */
13
+ export declare function fromNodeHeaders(nodeHeaders: IncomingHttpHeaders): Headers;
14
+ /**
15
+ * Create Node.js OAuth route handler
16
+ *
17
+ * Use this to create secure OAuth API routes in your Node.js HTTP server
18
+ * that handle authorization with server-side secrets.
19
+ *
20
+ * @param config - OAuth handler configuration with provider credentials
21
+ * @returns Request handler function for Node.js
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * import { createServer } from 'http';
26
+ * import { toNodeHandler } from 'integrate-sdk/adapters/node';
27
+ *
28
+ * const handler = toNodeHandler({
29
+ * providers: {
30
+ * github: {
31
+ * clientId: process.env.GITHUB_CLIENT_ID!,
32
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
33
+ * },
34
+ * },
35
+ * });
36
+ *
37
+ * createServer(async (req, res) => {
38
+ * if (req.url?.startsWith('/api/integrate/')) {
39
+ * await handler(req, res);
40
+ * } else {
41
+ * res.statusCode = 404;
42
+ * res.end('Not Found');
43
+ * }
44
+ * }).listen(3000);
45
+ * ```
46
+ */
47
+ export declare function toNodeHandler(config: OAuthHandlerConfig): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
48
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/adapters/node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEjF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO,CAYzE;AAkDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,kBAAkB,IAGxC,KAAK,eAAe,EAAE,KAAK,cAAc,KAAG,OAAO,CAAC,IAAI,CAAC,CAsHxE"}
@@ -10,7 +10,7 @@ var __export = (target, all) => {
10
10
  };
11
11
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
12
12
 
13
- // src/adapters/base-handler.ts
13
+ // base-handler.ts
14
14
  class OAuthHandler {
15
15
  config;
16
16
  serverUrl;
@@ -175,7 +175,7 @@ class OAuthHandler {
175
175
  }
176
176
  var MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp";
177
177
 
178
- // src/adapters/node.ts
178
+ // node.ts
179
179
  function fromNodeHeaders(nodeHeaders) {
180
180
  const webHeaders = new Headers;
181
181
  for (const [key, value] of Object.entries(nodeHeaders)) {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * SolidStart OAuth Route Adapter
3
+ * Provides OAuth route handlers for SolidStart
4
+ *
5
+ * Re-exports from server.ts for convenience
6
+ */
7
+ export { toSolidStartHandler } from '../server.js';
8
+ //# sourceMappingURL=solid-start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid-start.d.ts","sourceRoot":"","sources":["../../../src/adapters/solid-start.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
@@ -10,7 +10,7 @@ var __export = (target, all) => {
10
10
  };
11
11
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
12
12
 
13
- // src/adapters/base-handler.ts
13
+ // base-handler.ts
14
14
  class OAuthHandler {
15
15
  config;
16
16
  serverUrl;
@@ -175,7 +175,7 @@ class OAuthHandler {
175
175
  }
176
176
  var MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp";
177
177
 
178
- // src/oauth/pkce.ts
178
+ // ../oauth/pkce.ts
179
179
  var exports_pkce = {};
180
180
  __export(exports_pkce, {
181
181
  parseState: () => parseState,
@@ -271,7 +271,7 @@ function base64UrlDecode(str) {
271
271
  }
272
272
  }
273
273
 
274
- // src/errors.ts
274
+ // ../errors.ts
275
275
  var exports_errors = {};
276
276
  __export(exports_errors, {
277
277
  parseServerError: () => parseServerError,
@@ -409,7 +409,7 @@ var init_errors = __esm(() => {
409
409
  };
410
410
  });
411
411
 
412
- // src/adapters/nextjs.ts
412
+ // nextjs.ts
413
413
  function createNextOAuthHandler(config) {
414
414
  const handler = new OAuthHandler(config);
415
415
  const handlers = {
@@ -591,7 +591,7 @@ function createNextOAuthHandler(config) {
591
591
  return handlers;
592
592
  }
593
593
 
594
- // src/protocol/jsonrpc.ts
594
+ // ../protocol/jsonrpc.ts
595
595
  function parseMessage(message) {
596
596
  try {
597
597
  return JSON.parse(message);
@@ -600,7 +600,7 @@ function parseMessage(message) {
600
600
  }
601
601
  }
602
602
 
603
- // src/transport/http-session.ts
603
+ // ../transport/http-session.ts
604
604
  class HttpSessionTransport {
605
605
  url;
606
606
  headers;
@@ -789,10 +789,10 @@ class HttpSessionTransport {
789
789
  }
790
790
  }
791
791
 
792
- // src/client.ts
792
+ // ../client.ts
793
793
  init_errors();
794
794
 
795
- // src/utils/naming.ts
795
+ // ../utils/naming.ts
796
796
  function camelToSnake(str) {
797
797
  return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
798
798
  }
@@ -800,7 +800,7 @@ function methodToToolName(methodName, integrationId) {
800
800
  const snakeCaseMethod = camelToSnake(methodName);
801
801
  return `${integrationId}_${snakeCaseMethod}`;
802
802
  }
803
- // src/oauth/window-manager.ts
803
+ // ../oauth/window-manager.ts
804
804
  function isBrowser() {
805
805
  return typeof window !== "undefined" && typeof window.document !== "undefined";
806
806
  }
@@ -971,7 +971,7 @@ class OAuthWindowManager {
971
971
  }
972
972
  }
973
973
 
974
- // src/oauth/manager.ts
974
+ // ../oauth/manager.ts
975
975
  class OAuthManager {
976
976
  pendingAuths = new Map;
977
977
  providerTokens = new Map;
@@ -1278,7 +1278,7 @@ class OAuthManager {
1278
1278
  }
1279
1279
  }
1280
1280
 
1281
- // src/client.ts
1281
+ // ../client.ts
1282
1282
  class SimpleEventEmitter {
1283
1283
  handlers = new Map;
1284
1284
  on(event, handler) {
@@ -1763,7 +1763,7 @@ class MCPClient {
1763
1763
  return success;
1764
1764
  }
1765
1765
  }
1766
- // src/server.ts
1766
+ // ../server.ts
1767
1767
  function toSolidStartHandler(clientOrHandlerOrOptions, _redirectOptions) {
1768
1768
  if (clientOrHandlerOrOptions && clientOrHandlerOrOptions.handler && typeof clientOrHandlerOrOptions.handler === "function") {
1769
1769
  const baseHandler = clientOrHandlerOrOptions.handler;