integrate-sdk 0.7.24 → 0.7.25

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.
@@ -0,0 +1,83 @@
1
+ /**
2
+ * SvelteKit OAuth Route Adapter
3
+ * Provides OAuth route handlers for SvelteKit
4
+ */
5
+ type RequestEvent = any;
6
+ type ResolveFunction = any;
7
+ /**
8
+ * Create SvelteKit OAuth route handler for hooks
9
+ *
10
+ * Use this to integrate OAuth handling into your SvelteKit hooks.server.ts
11
+ *
12
+ * @param authConfig - Handler function from createMCPServer
13
+ * @param event - SvelteKit RequestEvent
14
+ * @param resolve - SvelteKit resolve function
15
+ * @param basePath - Base path for OAuth routes (default: '/api/integrate')
16
+ * @returns Response from OAuth handler or resolved request
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // lib/integrate-server.ts
21
+ * import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
22
+ *
23
+ * export const { client: serverClient, handler } = createMCPServer({
24
+ * integrations: [
25
+ * githubIntegration({
26
+ * clientId: process.env.GITHUB_CLIENT_ID!,
27
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
28
+ * }),
29
+ * ],
30
+ * });
31
+ *
32
+ * // hooks.server.ts
33
+ * import { svelteKitHandler } from 'integrate-sdk/adapters/svelte-kit';
34
+ * import { handler } from '$lib/integrate-server';
35
+ *
36
+ * export async function handle({ event, resolve }) {
37
+ * return svelteKitHandler({ authConfig: handler, event, resolve });
38
+ * }
39
+ * ```
40
+ */
41
+ export declare function svelteKitHandler({ authConfig, event, resolve, basePath, }: {
42
+ authConfig: (request: Request) => Promise<Response>;
43
+ event: RequestEvent;
44
+ resolve: ResolveFunction;
45
+ basePath?: string;
46
+ }): Promise<Response>;
47
+ /**
48
+ * Create SvelteKit OAuth route handler
49
+ *
50
+ * Use this to create secure OAuth API routes in your SvelteKit application
51
+ * that handle authorization with server-side secrets.
52
+ *
53
+ * Re-exports from server.ts for convenience
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * // lib/integrate-server.ts
58
+ * import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
59
+ *
60
+ * export const { client: serverClient, handler } = createMCPServer({
61
+ * integrations: [
62
+ * githubIntegration({
63
+ * clientId: process.env.GITHUB_CLIENT_ID!,
64
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
65
+ * }),
66
+ * ],
67
+ * });
68
+ *
69
+ * // routes/api/integrate/[...all]/+server.ts
70
+ * import { toSvelteKitHandler } from 'integrate-sdk/server';
71
+ * import { handler } from '$lib/integrate-server';
72
+ *
73
+ * const svelteKitRoute = toSvelteKitHandler(handler, {
74
+ * redirectUrl: '/dashboard',
75
+ * errorRedirectUrl: '/auth-error',
76
+ * });
77
+ *
78
+ * export const POST = svelteKitRoute;
79
+ * export const GET = svelteKitRoute;
80
+ * ```
81
+ */
82
+ export { toSvelteKitHandler } from '../server.js';
83
+ //# sourceMappingURL=svelte-kit.d.ts.map
@@ -0,0 +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,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"}
@@ -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;
@@ -1875,7 +1875,7 @@ function toSvelteKitHandler(clientOrHandlerOrOptions, _redirectOptions) {
1875
1875
  };
1876
1876
  }
1877
1877
 
1878
- // src/adapters/svelte-kit.ts
1878
+ // svelte-kit.ts
1879
1879
  async function svelteKitHandler({
1880
1880
  authConfig,
1881
1881
  event,
@@ -0,0 +1,53 @@
1
+ /**
2
+ * TanStack Start OAuth Route Adapter
3
+ * Provides OAuth route handlers for TanStack Start
4
+ */
5
+ /**
6
+ * Create TanStack Start OAuth route handlers
7
+ *
8
+ * Use this to create secure OAuth API routes in your TanStack Start application
9
+ * that handle authorization with server-side secrets.
10
+ *
11
+ * @param handler - Handler function from createMCPServer
12
+ * @returns Object with GET and POST handlers for catch-all routes
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // lib/integrate-server.ts
17
+ * import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
18
+ *
19
+ * export const { client: serverClient, handler } = createMCPServer({
20
+ * integrations: [
21
+ * githubIntegration({
22
+ * clientId: process.env.GITHUB_CLIENT_ID!,
23
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
24
+ * }),
25
+ * ],
26
+ * });
27
+ *
28
+ * // app/routes/api/integrate/$.ts
29
+ * import { toTanStackStartHandler } from 'integrate-sdk/adapters/tanstack-start';
30
+ * import { handler } from '@/lib/integrate-server';
31
+ *
32
+ * const handlers = toTanStackStartHandler(handler);
33
+ *
34
+ * export const Route = createFileRoute('/api/integrate/$')({
35
+ * server: {
36
+ * handlers: {
37
+ * GET: handlers.GET,
38
+ * POST: handlers.POST,
39
+ * },
40
+ * },
41
+ * });
42
+ * ```
43
+ */
44
+ export declare function toTanStackStartHandler(handler: (request: Request) => Promise<Response>): {
45
+ GET: ({ request }: {
46
+ request: Request;
47
+ }) => Promise<Response>;
48
+ POST: ({ request }: {
49
+ request: Request;
50
+ }) => Promise<Response>;
51
+ };
52
+ export declare const createTanStackOAuthHandler: typeof toTanStackStartHandler;
53
+ //# sourceMappingURL=tanstack-start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack-start.d.ts","sourceRoot":"","sources":["../../../src/adapters/tanstack-start.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC;uBAC7C;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAG,OAAO,CAAC,QAAQ,CAAC;wBAAxC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAG,OAAO,CAAC,QAAQ,CAAC;EAQjF;AAGD,eAAO,MAAM,0BAA0B,+BAAyB,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/tanstack-start.ts
13
+ // tanstack-start.ts
14
14
  function toTanStackStartHandler(handler) {
15
15
  const baseHandler = async ({ request }) => {
16
16
  return handler(request);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Adapters for various frameworks
3
+ *
4
+ * Re-exports all adapter modules for convenient access
5
+ */
6
+ export * from "./nextjs.js";
7
+ export * from "./node.js";
8
+ export * from "./solid-start.js";
9
+ export * from "./svelte-kit.js";
10
+ export * from "./tanstack-start.js";
11
+ export * from "./base-handler.js";
12
+ export * from "./auto-routes.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integrate-sdk",
3
- "version": "0.7.24",
3
+ "version": "0.7.25",
4
4
  "description": "Type-safe 3rd party integration SDK for the Integrate MCP server",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,61 +35,9 @@
35
35
  "types": "./dist/ai/index.d.ts",
36
36
  "import": "./dist/ai/index.js"
37
37
  },
38
- "./ai/vercel-ai": {
39
- "types": "./dist/ai/vercel-ai.d.ts",
40
- "import": "./dist/ai/vercel-ai.js"
41
- },
42
- "./ai/openai": {
43
- "types": "./dist/ai/openai.d.ts",
44
- "import": "./dist/ai/openai.js"
45
- },
46
- "./ai/openai-agents": {
47
- "types": "./dist/ai/openai-agents.d.ts",
48
- "import": "./dist/ai/openai-agents.js"
49
- },
50
- "./ai/anthropic": {
51
- "types": "./dist/ai/anthropic.d.ts",
52
- "import": "./dist/ai/anthropic.js"
53
- },
54
- "./ai/google": {
55
- "types": "./dist/ai/google.d.ts",
56
- "import": "./dist/ai/google.js"
57
- },
58
- "./ai/cloudflare": {
59
- "types": "./dist/ai/cloudflare.d.ts",
60
- "import": "./dist/ai/cloudflare.js"
61
- },
62
- "./ai/langchain": {
63
- "types": "./dist/ai/langchain.d.ts",
64
- "import": "./dist/ai/langchain.js"
65
- },
66
- "./ai/llamaindex": {
67
- "types": "./dist/ai/llamaindex.d.ts",
68
- "import": "./dist/ai/llamaindex.js"
69
- },
70
- "./ai/mastra": {
71
- "types": "./dist/ai/mastra.d.ts",
72
- "import": "./dist/ai/mastra.js"
73
- },
74
- "./adapters/nextjs": {
75
- "types": "./dist/adapters/nextjs.d.ts",
76
- "import": "./dist/adapters/nextjs.js"
77
- },
78
- "./adapters/node": {
79
- "types": "./dist/adapters/node.d.ts",
80
- "import": "./dist/adapters/node.js"
81
- },
82
- "./adapters/solid-start": {
83
- "types": "./dist/adapters/solid-start.d.ts",
84
- "import": "./dist/adapters/solid-start.js"
85
- },
86
- "./adapters/svelte-kit": {
87
- "types": "./dist/adapters/svelte-kit.d.ts",
88
- "import": "./dist/adapters/svelte-kit.js"
89
- },
90
- "./adapters/tanstack-start": {
91
- "types": "./dist/adapters/tanstack-start.d.ts",
92
- "import": "./dist/adapters/tanstack-start.js"
38
+ "./adapters": {
39
+ "types": "./dist/adapters/index.d.ts",
40
+ "import": "./dist/adapters/index.js"
93
41
  }
94
42
  },
95
43
  "files": [
@@ -103,10 +51,10 @@
103
51
  "scripts": {
104
52
  "prep": "bun run type-check && bun run build",
105
53
  "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:ai && bun run build:types && bun run build:copy-types",
106
- "build:adapters": "bun build src/adapters/*.ts --outdir dist/adapters --target node --format esm",
54
+ "build:adapters": "cd src/adapters && bun build *.ts --outdir ../../dist/adapters --target node --format esm && cd ../..",
107
55
  "build:ai": "cd src/ai && bun build *.ts --outdir ../../dist/ai --target node --format esm && cd ../..",
108
56
  "build:types": "tsc --emitDeclarationOnly --declaration --declarationMap",
109
- "build:copy-types": "cp dist/src/ai/*.d.ts dist/ai/ && cp dist/src/ai/*.d.ts.map dist/ai/",
57
+ "build:copy-types": "cp dist/src/ai/*.d.ts dist/ai/ && cp dist/src/ai/*.d.ts.map dist/ai/ && cp dist/src/adapters/*.d.ts dist/adapters/ && cp dist/src/adapters/*.d.ts.map dist/adapters/",
110
58
  "dev": "bun --watch src/index.ts",
111
59
  "type-check": "tsc --noEmit",
112
60
  "test": "bun test tests/",