integrate-sdk 0.6.7 → 0.6.9
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/adapters/auto-routes.js +1 -0
- package/dist/adapters/base-handler.js +1 -0
- package/dist/adapters/nextjs-oauth-redirect.js +1 -0
- package/dist/adapters/nextjs.js +1 -0
- package/dist/adapters/node.js +1 -0
- package/dist/adapters/solid-start.js +1750 -3
- package/dist/adapters/svelte-kit.js +1762 -6
- package/dist/adapters/tanstack-start.js +1 -0
- package/dist/index.js +336 -50
- package/dist/server.js +197 -11
- package/dist/src/adapters/node.d.ts +1 -1
- package/dist/src/adapters/solid-start.d.ts +2 -48
- package/dist/src/adapters/solid-start.d.ts.map +1 -1
- package/dist/src/adapters/svelte-kit.d.ts +9 -8
- package/dist/src/adapters/svelte-kit.d.ts.map +1 -1
- package/dist/src/adapters/tanstack-start.d.ts +2 -2
- package/dist/src/plugins/generic.d.ts.map +1 -1
- package/dist/src/plugins/github.d.ts.map +1 -1
- package/dist/src/plugins/gmail.d.ts.map +1 -1
- package/dist/src/server.d.ts +165 -0
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/utils/env.d.ts +18 -0
- package/dist/src/utils/env.d.ts.map +1 -0
- package/package.json +2 -3
|
@@ -35,7 +35,7 @@ export declare function fromNodeHeaders(nodeHeaders: IncomingHttpHeaders): Heade
|
|
|
35
35
|
* });
|
|
36
36
|
*
|
|
37
37
|
* createServer(async (req, res) => {
|
|
38
|
-
* if (req.url?.startsWith('/api/
|
|
38
|
+
* if (req.url?.startsWith('/api/integrate/')) {
|
|
39
39
|
* await handler(req, res);
|
|
40
40
|
* } else {
|
|
41
41
|
* res.statusCode = 404;
|
|
@@ -1,54 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SolidStart OAuth Route Adapter
|
|
3
3
|
* Provides OAuth route handlers for SolidStart
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Create SolidStart OAuth route handlers
|
|
7
|
-
*
|
|
8
|
-
* Use this to create secure OAuth API routes in your SolidStart application
|
|
9
|
-
* that handle authorization with server-side secrets.
|
|
10
|
-
*
|
|
11
|
-
* @param baseHandler - Handler function from createMCPServer
|
|
12
|
-
* @returns Object with GET, POST, PATCH, PUT, DELETE handlers
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* // lib/integrate-server.ts
|
|
17
|
-
* import { createMCPServer, githubPlugin } from 'integrate-sdk/server';
|
|
18
|
-
*
|
|
19
|
-
* export const { client: serverClient, handler } = createMCPServer({
|
|
20
|
-
* plugins: [
|
|
21
|
-
* githubPlugin({
|
|
22
|
-
* clientId: process.env.GITHUB_CLIENT_ID!,
|
|
23
|
-
* clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
24
|
-
* }),
|
|
25
|
-
* ],
|
|
26
|
-
* });
|
|
27
|
-
*
|
|
28
|
-
* // src/routes/api/auth/[...all].ts
|
|
29
|
-
* import { toSolidStartHandler } from 'integrate-sdk/adapters/solid-start';
|
|
30
|
-
* import { handler } from '@/lib/integrate-server';
|
|
31
|
-
*
|
|
32
|
-
* const handlers = toSolidStartHandler(handler);
|
|
33
4
|
*
|
|
34
|
-
*
|
|
35
|
-
* ```
|
|
5
|
+
* Re-exports from server.ts for convenience
|
|
36
6
|
*/
|
|
37
|
-
export
|
|
38
|
-
GET: (event: {
|
|
39
|
-
request: Request;
|
|
40
|
-
}) => Promise<Response>;
|
|
41
|
-
POST: (event: {
|
|
42
|
-
request: Request;
|
|
43
|
-
}) => Promise<Response>;
|
|
44
|
-
PATCH: (event: {
|
|
45
|
-
request: Request;
|
|
46
|
-
}) => Promise<Response>;
|
|
47
|
-
PUT: (event: {
|
|
48
|
-
request: Request;
|
|
49
|
-
}) => Promise<Response>;
|
|
50
|
-
DELETE: (event: {
|
|
51
|
-
request: Request;
|
|
52
|
-
}) => Promise<Response>;
|
|
53
|
-
};
|
|
7
|
+
export { toSolidStartHandler } from '../server.js';
|
|
54
8
|
//# sourceMappingURL=solid-start.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solid-start.d.ts","sourceRoot":"","sources":["../../../src/adapters/solid-start.ts"],"names":[],"mappings":"AAAA
|
|
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"}
|
|
@@ -12,7 +12,7 @@ type ResolveFunction = any;
|
|
|
12
12
|
* @param authConfig - Handler function from createMCPServer
|
|
13
13
|
* @param event - SvelteKit RequestEvent
|
|
14
14
|
* @param resolve - SvelteKit resolve function
|
|
15
|
-
* @param basePath - Base path for OAuth routes (default: '/api/
|
|
15
|
+
* @param basePath - Base path for OAuth routes (default: '/api/integrate')
|
|
16
16
|
* @returns Response from OAuth handler or resolved request
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
@@ -50,8 +50,7 @@ export declare function svelteKitHandler({ authConfig, event, resolve, basePath,
|
|
|
50
50
|
* Use this to create secure OAuth API routes in your SvelteKit application
|
|
51
51
|
* that handle authorization with server-side secrets.
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
* @returns Handler function for SvelteKit routes
|
|
53
|
+
* Re-exports from server.ts for convenience
|
|
55
54
|
*
|
|
56
55
|
* @example
|
|
57
56
|
* ```typescript
|
|
@@ -67,16 +66,18 @@ export declare function svelteKitHandler({ authConfig, event, resolve, basePath,
|
|
|
67
66
|
* ],
|
|
68
67
|
* });
|
|
69
68
|
*
|
|
70
|
-
* // routes/api/
|
|
71
|
-
* import { toSvelteKitHandler } from 'integrate-sdk/
|
|
69
|
+
* // routes/api/integrate/[...all]/+server.ts
|
|
70
|
+
* import { toSvelteKitHandler } from 'integrate-sdk/server';
|
|
72
71
|
* import { handler } from '$lib/integrate-server';
|
|
73
72
|
*
|
|
74
|
-
* const svelteKitRoute = toSvelteKitHandler(handler
|
|
73
|
+
* const svelteKitRoute = toSvelteKitHandler(handler, {
|
|
74
|
+
* redirectUrl: '/dashboard',
|
|
75
|
+
* errorRedirectUrl: '/auth-error',
|
|
76
|
+
* });
|
|
75
77
|
*
|
|
76
78
|
* export const POST = svelteKitRoute;
|
|
77
79
|
* export const GET = svelteKitRoute;
|
|
78
80
|
* ```
|
|
79
81
|
*/
|
|
80
|
-
export
|
|
81
|
-
export {};
|
|
82
|
+
export { toSvelteKitHandler } from '../server.js';
|
|
82
83
|
//# sourceMappingURL=svelte-kit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svelte-kit.d.ts","sourceRoot":"","sources":["../../../src/adapters/svelte-kit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,KAAK,YAAY,GAAG,GAAG,CAAC;AACxB,KAAK,eAAe,GAAG,GAAG,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,gBAAgB,CAAC,EACnC,UAAU,EACV,KAAK,EACL,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"svelte-kit.d.ts","sourceRoot":"","sources":["../../../src/adapters/svelte-kit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,KAAK,YAAY,GAAG,GAAG,CAAC;AACxB,KAAK,eAAe,GAAG,GAAG,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,gBAAgB,CAAC,EACnC,UAAU,EACV,KAAK,EACL,OAAO,EACP,QAA2B,GAC9B,EAAE;IACC,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpD,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAWpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
* ],
|
|
26
26
|
* });
|
|
27
27
|
*
|
|
28
|
-
* // app/routes/api/
|
|
28
|
+
* // app/routes/api/integrate/$.ts
|
|
29
29
|
* import { toTanStackStartHandler } from 'integrate-sdk/adapters/tanstack-start';
|
|
30
30
|
* import { handler } from '@/lib/integrate-server';
|
|
31
31
|
*
|
|
32
32
|
* const handlers = toTanStackStartHandler(handler);
|
|
33
33
|
*
|
|
34
|
-
* export const Route = createFileRoute('/api/
|
|
34
|
+
* export const Route = createFileRoute('/api/integrate/$')({
|
|
35
35
|
* server: {
|
|
36
36
|
* handlers: {
|
|
37
37
|
* GET: handlers.GET,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../../src/plugins/generic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../../src/plugins/generic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAGzD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,sEAAsE;IACtE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,uCAAuC;IACvC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/C,sCAAsC;IACtC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,mCAAmC;IACnC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,wBAAwB,GAC/B,SAAS,CAqBX;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/C,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACtD,GAAG,SAAS,CAQZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/plugins/github.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/plugins/github.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAGzD;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,QAAA,MAAM,YAAY,kbAmBR,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,YAAY,CAAC,MAAM,GAAE,kBAAuB,GAAG,SAAS,CA0BvE;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAEtD;;GAEG;AACH,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmail.d.ts","sourceRoot":"","sources":["../../../src/plugins/gmail.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"gmail.d.ts","sourceRoot":"","sources":["../../../src/plugins/gmail.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAGzD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,sGAKP,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,WAAW,CAAC,MAAM,GAAE,iBAAsB,GAAG,SAAS,CA4BrE;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAEpD;;GAEG;AACH,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/src/server.d.ts
CHANGED
|
@@ -68,6 +68,13 @@ export declare function createMCPServer<TPlugins extends readonly MCPPlugin[]>(c
|
|
|
68
68
|
action: string;
|
|
69
69
|
}>;
|
|
70
70
|
}) => Promise<any>;
|
|
71
|
+
/** Unified handler function - handles both POST and GET requests */
|
|
72
|
+
handler: (request: Request, context?: {
|
|
73
|
+
params?: {
|
|
74
|
+
action?: string;
|
|
75
|
+
all?: string | string[];
|
|
76
|
+
};
|
|
77
|
+
}) => Promise<Response>;
|
|
71
78
|
};
|
|
72
79
|
export type { MCPPlugin } from './plugins/types.js';
|
|
73
80
|
export type { MCPClientConfig } from './config/types.js';
|
|
@@ -195,4 +202,162 @@ export declare function toNextJsHandler(options: {
|
|
|
195
202
|
}>;
|
|
196
203
|
}) => Promise<any>;
|
|
197
204
|
};
|
|
205
|
+
/**
|
|
206
|
+
* Create Astro handler with configurable redirect URLs
|
|
207
|
+
*
|
|
208
|
+
* Wraps the unified handler with redirect URL configuration
|
|
209
|
+
*
|
|
210
|
+
* @param baseHandler - Handler function from createMCPServer
|
|
211
|
+
* @param options - Redirect URL configuration
|
|
212
|
+
* @returns Wrapped handler function for Astro
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* // lib/integrate-server.ts
|
|
217
|
+
* import { createMCPServer, githubPlugin } from 'integrate-sdk/server';
|
|
218
|
+
*
|
|
219
|
+
* export const { handler } = createMCPServer({
|
|
220
|
+
* plugins: [
|
|
221
|
+
* githubPlugin({
|
|
222
|
+
* clientId: import.meta.env.GITHUB_CLIENT_ID!,
|
|
223
|
+
* clientSecret: import.meta.env.GITHUB_CLIENT_SECRET!,
|
|
224
|
+
* }),
|
|
225
|
+
* ],
|
|
226
|
+
* });
|
|
227
|
+
*
|
|
228
|
+
* // pages/api/integrate/[...all].ts
|
|
229
|
+
* import { toAstroHandler } from 'integrate-sdk/server';
|
|
230
|
+
* import { handler } from '@/lib/integrate-server';
|
|
231
|
+
*
|
|
232
|
+
* export const ALL = toAstroHandler(handler, {
|
|
233
|
+
* redirectUrl: '/dashboard',
|
|
234
|
+
* errorRedirectUrl: '/auth-error',
|
|
235
|
+
* });
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
export declare function toAstroHandler(baseHandler: (request: Request, context?: {
|
|
239
|
+
params?: {
|
|
240
|
+
action?: string;
|
|
241
|
+
all?: string | string[];
|
|
242
|
+
};
|
|
243
|
+
}) => Promise<Response>, options?: {
|
|
244
|
+
/** URL to redirect to after successful OAuth callback (default: '/') */
|
|
245
|
+
redirectUrl?: string;
|
|
246
|
+
/** URL to redirect to on OAuth error (default: '/auth-error') */
|
|
247
|
+
errorRedirectUrl?: string;
|
|
248
|
+
}): (ctx: {
|
|
249
|
+
request: Request;
|
|
250
|
+
params: {
|
|
251
|
+
all?: string | string[];
|
|
252
|
+
};
|
|
253
|
+
}) => Promise<Response>;
|
|
254
|
+
/**
|
|
255
|
+
* Create SolidStart handler with configurable redirect URLs
|
|
256
|
+
*
|
|
257
|
+
* Wraps the unified handler with redirect URL configuration
|
|
258
|
+
*
|
|
259
|
+
* @param baseHandler - Handler function from createMCPServer
|
|
260
|
+
* @param options - Redirect URL configuration
|
|
261
|
+
* @returns Object with GET, POST, PATCH, PUT, DELETE handlers
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* // lib/integrate-server.ts
|
|
266
|
+
* import { createMCPServer, githubPlugin } from 'integrate-sdk/server';
|
|
267
|
+
*
|
|
268
|
+
* export const { handler } = createMCPServer({
|
|
269
|
+
* plugins: [
|
|
270
|
+
* githubPlugin({
|
|
271
|
+
* clientId: process.env.GITHUB_CLIENT_ID!,
|
|
272
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
273
|
+
* }),
|
|
274
|
+
* ],
|
|
275
|
+
* });
|
|
276
|
+
*
|
|
277
|
+
* // src/routes/api/integrate/[...all].ts
|
|
278
|
+
* import { toSolidStartHandler } from 'integrate-sdk/server';
|
|
279
|
+
* import { handler } from '@/lib/integrate-server';
|
|
280
|
+
*
|
|
281
|
+
* const handlers = toSolidStartHandler(handler, {
|
|
282
|
+
* redirectUrl: '/dashboard',
|
|
283
|
+
* errorRedirectUrl: '/auth-error',
|
|
284
|
+
* });
|
|
285
|
+
*
|
|
286
|
+
* export const { GET, POST, PATCH, PUT, DELETE } = handlers;
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
export declare function toSolidStartHandler(baseHandler: (request: Request, context?: {
|
|
290
|
+
params?: {
|
|
291
|
+
action?: string;
|
|
292
|
+
all?: string | string[];
|
|
293
|
+
};
|
|
294
|
+
}) => Promise<Response>, options?: {
|
|
295
|
+
/** URL to redirect to after successful OAuth callback (default: '/') */
|
|
296
|
+
redirectUrl?: string;
|
|
297
|
+
/** URL to redirect to on OAuth error (default: '/auth-error') */
|
|
298
|
+
errorRedirectUrl?: string;
|
|
299
|
+
}): {
|
|
300
|
+
GET: (event: {
|
|
301
|
+
request: Request;
|
|
302
|
+
}) => Promise<Response>;
|
|
303
|
+
POST: (event: {
|
|
304
|
+
request: Request;
|
|
305
|
+
}) => Promise<Response>;
|
|
306
|
+
PATCH: (event: {
|
|
307
|
+
request: Request;
|
|
308
|
+
}) => Promise<Response>;
|
|
309
|
+
PUT: (event: {
|
|
310
|
+
request: Request;
|
|
311
|
+
}) => Promise<Response>;
|
|
312
|
+
DELETE: (event: {
|
|
313
|
+
request: Request;
|
|
314
|
+
}) => Promise<Response>;
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* Create SvelteKit handler with configurable redirect URLs
|
|
318
|
+
*
|
|
319
|
+
* Wraps the unified handler with redirect URL configuration
|
|
320
|
+
*
|
|
321
|
+
* @param baseHandler - Handler function from createMCPServer
|
|
322
|
+
* @param options - Redirect URL configuration
|
|
323
|
+
* @returns Handler function for SvelteKit routes
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```typescript
|
|
327
|
+
* // lib/integrate-server.ts
|
|
328
|
+
* import { createMCPServer, githubPlugin } from 'integrate-sdk/server';
|
|
329
|
+
*
|
|
330
|
+
* export const { handler } = createMCPServer({
|
|
331
|
+
* plugins: [
|
|
332
|
+
* githubPlugin({
|
|
333
|
+
* clientId: process.env.GITHUB_CLIENT_ID!,
|
|
334
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
335
|
+
* }),
|
|
336
|
+
* ],
|
|
337
|
+
* });
|
|
338
|
+
*
|
|
339
|
+
* // routes/api/integrate/[...all]/+server.ts
|
|
340
|
+
* import { toSvelteKitHandler } from 'integrate-sdk/server';
|
|
341
|
+
* import { handler } from '$lib/integrate-server';
|
|
342
|
+
*
|
|
343
|
+
* const svelteKitRoute = toSvelteKitHandler(handler, {
|
|
344
|
+
* redirectUrl: '/dashboard',
|
|
345
|
+
* errorRedirectUrl: '/auth-error',
|
|
346
|
+
* });
|
|
347
|
+
*
|
|
348
|
+
* export const POST = svelteKitRoute;
|
|
349
|
+
* export const GET = svelteKitRoute;
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
export declare function toSvelteKitHandler(baseHandler: (request: Request, context?: {
|
|
353
|
+
params?: {
|
|
354
|
+
action?: string;
|
|
355
|
+
all?: string | string[];
|
|
356
|
+
};
|
|
357
|
+
}) => Promise<Response>, options?: {
|
|
358
|
+
/** URL to redirect to after successful OAuth callback (default: '/') */
|
|
359
|
+
redirectUrl?: string;
|
|
360
|
+
/** URL to redirect to on OAuth error (default: '/auth-error') */
|
|
361
|
+
errorRedirectUrl?: string;
|
|
362
|
+
}): (event: any) => Promise<Response>;
|
|
198
363
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/src/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA8CpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,SAAS,SAAS,EAAE,EACnE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC;IAkP/B,2DAA2D;;IAG3D,4DAA4D;;;;;;;;IAG5D,2DAA2D;;;;;;;;IAG3D,oEAAoE;uBA5J3D,OAAO,YACN;QAAE,MAAM,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;SAAE,CAAA;KAAE,KAClE,OAAO,CAAC,QA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EAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;iBAI6B;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAG,OAAO,CAAC,QAAQ,CAAC;kBAAxC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAG,OAAO,CAAC,QAAQ,CAAC;mBAAxC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAG,OAAO,CAAC,QAAQ,CAAC;iBAAxC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAG,OAAO,CAAC,QAAQ,CAAC;oBAAxC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAG,OAAO,CAAC,QAAQ,CAAC;EAWvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;CAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,EACzH,OAAO,CAAC,EAAE;IACR,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,IAIa,OAAO,GAAG,KAAG,OAAO,CAAC,QAAQ,CAAC,CAK7C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variable utility
|
|
3
|
+
* Supports both Node.js (process.env) and Vite (import.meta.env) environments
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get an environment variable from either import.meta.env (Vite) or process.env (Node.js)
|
|
7
|
+
* @param key - Environment variable key
|
|
8
|
+
* @returns Environment variable value or undefined
|
|
9
|
+
*/
|
|
10
|
+
export declare function getEnv(key: string): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Get an environment variable with a fallback value
|
|
13
|
+
* @param key - Environment variable key
|
|
14
|
+
* @param fallback - Fallback value if env var is not set
|
|
15
|
+
* @returns Environment variable value or fallback
|
|
16
|
+
*/
|
|
17
|
+
export declare function getEnvWithFallback(key: string, fallback: string): string;
|
|
18
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/utils/env.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA2BtD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "integrate-sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "Type-safe 3rd party integration SDK for the Integrate MCP server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -98,7 +98,6 @@
|
|
|
98
98
|
],
|
|
99
99
|
"scripts": {
|
|
100
100
|
"prep": "bun run type-check && bun run build",
|
|
101
|
-
"build": "bun build index.ts server.ts oauth.ts react.ts integrations.ts --outdir dist --target node --format esm --external react && bun run build:types",
|
|
102
101
|
"build": "bun build index.ts server.ts oauth.ts react.ts --outdir dist --target node --format esm --external react && bun run build:adapters && bun run build:types",
|
|
103
102
|
"build:adapters": "bun build src/adapters/*.ts --outdir dist/adapters --target node --format esm",
|
|
104
103
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationMap",
|
|
@@ -178,4 +177,4 @@
|
|
|
178
177
|
"simple-git-hooks": {
|
|
179
178
|
"pre-commit": "./scripts/check-version.sh"
|
|
180
179
|
}
|
|
181
|
-
}
|
|
180
|
+
}
|