@dev-fastn-ai/react-core 1.0.0
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/CHANGELOG.md +78 -0
- package/LICENSE +21 -0
- package/README.md +1710 -0
- package/dist/core/src/core/activate-connector.d.ts +42 -0
- package/dist/core/src/core/config.d.ts +3 -0
- package/dist/core/src/core/configuration-form.d.ts +27 -0
- package/dist/core/src/core/configurations.d.ts +2 -0
- package/dist/core/src/core/connectors.d.ts +7 -0
- package/dist/core/src/core/execute-flow.d.ts +9 -0
- package/dist/core/src/core/register-refetch-functions.d.ts +4 -0
- package/dist/core/src/index.d.ts +11 -0
- package/dist/core/src/services/api-hooks.d.ts +35 -0
- package/dist/core/src/services/apollo.d.ts +4 -0
- package/dist/core/src/types/config.d.ts +9 -0
- package/dist/core/src/types/index.d.ts +269 -0
- package/dist/core/src/utils/constants.d.ts +12 -0
- package/dist/core/src/utils/errors.d.ts +22 -0
- package/dist/core/src/utils/google-files-picker.d.ts +13 -0
- package/dist/core/src/utils/misc.d.ts +35 -0
- package/dist/index.cjs.js +18271 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +18259 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/react-core/src/core/provider.d.ts +9 -0
- package/dist/react-core/src/core/use-configuration-form.d.ts +2 -0
- package/dist/react-core/src/core/use-configurations.d.ts +2 -0
- package/dist/react-core/src/core/use-connectors.d.ts +1 -0
- package/dist/react-core/src/core/use-field-options.d.ts +36 -0
- package/dist/react-core/src/index.d.ts +7 -0
- package/package.json +76 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { Fastn } from "../../../core/src/index";
|
|
3
|
+
import type { FastnConfig } from "../../../core/src/types";
|
|
4
|
+
export declare const FastnProvider: ({ children, config, queryClient, }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
config: FastnConfig;
|
|
7
|
+
queryClient?: QueryClient;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const useFastn: () => Fastn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useConnectors: () => import("@tanstack/react-query").UseQueryResult<import("../../../core/src").Connector[], Error>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ConnectorField, SelectOption } from "@dev-fastn-ai/core";
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to manage async select field options with search, pagination, and error handling using React Query.
|
|
4
|
+
*
|
|
5
|
+
* Benefits of React Query caching:
|
|
6
|
+
* - Automatic caching with configurable stale time (5 minutes)
|
|
7
|
+
* - Background refetching when data becomes stale
|
|
8
|
+
* - Deduplication of requests
|
|
9
|
+
* - Optimistic updates
|
|
10
|
+
* - Automatic retry on failure
|
|
11
|
+
* - Cache invalidation and garbage collection
|
|
12
|
+
*
|
|
13
|
+
* @param field ConnectorField - The field definition containing optionsSource
|
|
14
|
+
* @returns { options, loading, loadingMore, hasNext, query, refresh, search, loadMore, error }
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const { options, loading, loadingMore, hasNext, search, loadMore } = useFieldOptions(field);
|
|
19
|
+
*
|
|
20
|
+
* // Options are automatically cached and shared across components
|
|
21
|
+
* // Loading states are handled automatically
|
|
22
|
+
* // Pagination is managed with infinite query
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function useFieldOptions(field: ConnectorField): {
|
|
26
|
+
options: SelectOption[];
|
|
27
|
+
loading: boolean;
|
|
28
|
+
loadingMore: boolean;
|
|
29
|
+
hasNext: boolean;
|
|
30
|
+
query: string;
|
|
31
|
+
refresh: () => Promise<void>;
|
|
32
|
+
search: (query: string) => void;
|
|
33
|
+
loadMore: () => Promise<void>;
|
|
34
|
+
totalLoadedOptions: number;
|
|
35
|
+
error: string | null;
|
|
36
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FastnProvider } from "./core/provider";
|
|
2
|
+
import { useConfigurations } from "./core/use-configurations";
|
|
3
|
+
import { useConfigurationForm } from "./core/use-configuration-form";
|
|
4
|
+
import { useConnectors } from "./core/use-connectors";
|
|
5
|
+
import { useFieldOptions } from "./core/use-field-options";
|
|
6
|
+
export { FastnProvider, useConfigurations, useConfigurationForm, useConnectors, useFieldOptions, };
|
|
7
|
+
export * from "@dev-fastn-ai/core";
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dev-fastn-ai/react-core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React hooks and components for integrating Fastn AI connector marketplace into your applications. Built on top of @fastn-ai/core with React Query for optimal performance.",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.esm.js",
|
|
11
|
+
"require": "./dist/index.cjs.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/",
|
|
17
|
+
"README.md",
|
|
18
|
+
"CHANGELOG.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rollup -c --bundleConfigAsCjs",
|
|
22
|
+
"clean": "rm -rf dist",
|
|
23
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
24
|
+
"type-check": "tsc --noEmit",
|
|
25
|
+
"test": "echo \"No tests specified\" && exit 0"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"fastn",
|
|
29
|
+
"fastn-ai",
|
|
30
|
+
"react",
|
|
31
|
+
"hooks",
|
|
32
|
+
"connectors",
|
|
33
|
+
"integrations",
|
|
34
|
+
"marketplace",
|
|
35
|
+
"react-query",
|
|
36
|
+
"typescript"
|
|
37
|
+
],
|
|
38
|
+
"author": "Fastn AI <support@fastn.ai>",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/fastn-ai/react-core.git"
|
|
43
|
+
},
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/fastn-ai/react-core/issues"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://docs.fastn.ai",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@dev-fastn-ai/core": "^1.0.0",
|
|
50
|
+
"@tanstack/react-query": "^5.0.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@tanstack/react-query": "^5.0.0",
|
|
54
|
+
"react": "^18.0.0",
|
|
55
|
+
"react-dom": "^18.0.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
59
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
60
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
61
|
+
"@types/react": "^18.0.29",
|
|
62
|
+
"@types/react-dom": "^18.0.11",
|
|
63
|
+
"rollup": "^4.0.0",
|
|
64
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
65
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
66
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
67
|
+
"typescript": "^5.2.2"
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">=16.0.0"
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public"
|
|
74
|
+
},
|
|
75
|
+
"sideEffects": false
|
|
76
|
+
}
|