integrate-sdk 0.5.1 → 0.5.3
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/react.js +796 -1763
- package/dist/src/react/hooks.d.ts +11 -11
- package/dist/src/react/hooks.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -39,8 +39,11 @@ export interface UseIntegrateTokensResult {
|
|
|
39
39
|
* Automatically listens for authentication events and updates when tokens change.
|
|
40
40
|
* Returns tokens and formatted headers ready to pass to API requests.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
42
|
+
* **Note:** This hook must be called inside a React component. It will return safe
|
|
43
|
+
* fallback values during SSR or if the client is not ready.
|
|
44
|
+
*
|
|
45
|
+
* @param client - MCP client instance created with createMCPClient() (optional)
|
|
46
|
+
* @returns Object with tokens, headers, loading state, fetch function, and mergeHeaders helper
|
|
44
47
|
*
|
|
45
48
|
* @example
|
|
46
49
|
* ```tsx
|
|
@@ -53,11 +56,11 @@ export interface UseIntegrateTokensResult {
|
|
|
53
56
|
* });
|
|
54
57
|
*
|
|
55
58
|
* function ChatComponent() {
|
|
56
|
-
* const {
|
|
59
|
+
* const { fetch: fetchWithTokens, isLoading } = useIntegrateTokens(client);
|
|
57
60
|
*
|
|
58
61
|
* const chat = useChat({
|
|
59
62
|
* api: '/api/chat',
|
|
60
|
-
*
|
|
63
|
+
* fetch: fetchWithTokens, // Tokens automatically included
|
|
61
64
|
* });
|
|
62
65
|
*
|
|
63
66
|
* return <div>Chat UI here</div>;
|
|
@@ -66,21 +69,18 @@ export interface UseIntegrateTokensResult {
|
|
|
66
69
|
*
|
|
67
70
|
* @example
|
|
68
71
|
* ```tsx
|
|
69
|
-
* //
|
|
72
|
+
* // With mergeHeaders helper
|
|
70
73
|
* import { createMCPClient } from 'integrate-sdk';
|
|
71
74
|
*
|
|
72
75
|
* const client = createMCPClient({ plugins: [...] });
|
|
73
76
|
*
|
|
74
77
|
* function MyComponent() {
|
|
75
|
-
* const {
|
|
78
|
+
* const { mergeHeaders } = useIntegrateTokens(client);
|
|
76
79
|
*
|
|
77
80
|
* const fetchData = async () => {
|
|
78
81
|
* const response = await fetch('/api/data', {
|
|
79
82
|
* method: 'POST',
|
|
80
|
-
* headers: {
|
|
81
|
-
* 'Content-Type': 'application/json',
|
|
82
|
-
* ...headers, // Includes x-integrate-tokens
|
|
83
|
-
* },
|
|
83
|
+
* headers: mergeHeaders({ 'Content-Type': 'application/json' }),
|
|
84
84
|
* body: JSON.stringify({ query: 'example' }),
|
|
85
85
|
* });
|
|
86
86
|
* return response.json();
|
|
@@ -90,5 +90,5 @@ export interface UseIntegrateTokensResult {
|
|
|
90
90
|
* }
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
export declare function useIntegrateTokens(client
|
|
93
|
+
export declare function useIntegrateTokens(client?: MCPClient<any> | null): UseIntegrateTokensResult;
|
|
94
94
|
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/react/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE/B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE3E;;;OAGG;IACH,YAAY,EAAE,CAAC,eAAe,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC;CAC1D;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/react/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE/B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE3E;;;OAGG;IACH,YAAY,EAAE,CAAC,eAAe,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC;CAC1D;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,GAC7B,wBAAwB,CAoH1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "integrate-sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Type-safe TypeScript SDK for MCP Client with plugin-based OAuth provider configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/bun": "latest",
|
|
69
69
|
"@types/react": "^18.3.0",
|
|
70
|
-
"react": "^
|
|
70
|
+
"react": "^19.2.0",
|
|
71
71
|
"simple-git-hooks": "^2.13.1",
|
|
72
72
|
"typescript": "^5.3.3"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"typescript": ">=5.0.0",
|
|
76
|
-
"react": ">=
|
|
76
|
+
"react": ">=19.0.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependenciesMeta": {
|
|
79
79
|
"react": {
|