{isLoading && (
diff --git a/frontend/src/hooks/react-query/pipedream/keys.ts b/frontend/src/hooks/react-query/pipedream/keys.ts
index 0db7334e..e958b29e 100644
--- a/frontend/src/hooks/react-query/pipedream/keys.ts
+++ b/frontend/src/hooks/react-query/pipedream/keys.ts
@@ -7,6 +7,7 @@ export const pipedreamKeys = {
workflows: () => [...pipedreamKeys.all, 'workflows'] as const,
workflowRuns: (workflowId: string) => [...pipedreamKeys.all, 'workflow-runs', workflowId] as const,
apps: (page: number, search?: string, category?: string) => [...pipedreamKeys.all, 'apps', page, search || '', category || ''] as const,
+ appsSearch: (query: string, page: number, category?: string) => [...pipedreamKeys.all, 'apps', 'search', query, page, category || ''] as const,
availableTools: () => [...pipedreamKeys.all, 'available-tools'] as const,
mcpDiscovery: (options?: { app_slug?: string; oauth_app_id?: string; custom?: boolean }) =>
[...pipedreamKeys.all, 'mcp-discovery', options?.app_slug, options?.oauth_app_id, options?.custom] as const,
diff --git a/frontend/src/hooks/react-query/pipedream/use-pipedream.ts b/frontend/src/hooks/react-query/pipedream/use-pipedream.ts
index 22b1cf0f..8b22ec8a 100644
--- a/frontend/src/hooks/react-query/pipedream/use-pipedream.ts
+++ b/frontend/src/hooks/react-query/pipedream/use-pipedream.ts
@@ -62,6 +62,18 @@ export const usePipedreamApps = (page: number = 1, search?: string, category?: s
});
};
+export const usePipedreamAppsSearch = (query: string, page: number = 1, category?: string) => {
+ return useQuery({
+ queryKey: ['pipedream', 'apps', 'search', query, page, category],
+ queryFn: async (): Promise
=> {
+ return await pipedreamApi.searchApps(query, page, category);
+ },
+ staleTime: 5 * 60 * 1000,
+ retry: 2,
+ enabled: !!query && query.length > 0,
+ });
+};
+
export const usePipedreamAvailableTools = createQueryHook(
pipedreamKeys.availableTools(),
async (forceRefresh: boolean = false): Promise => {
diff --git a/frontend/src/hooks/react-query/pipedream/utils.ts b/frontend/src/hooks/react-query/pipedream/utils.ts
index a1ce2c19..8dd08cf7 100644
--- a/frontend/src/hooks/react-query/pipedream/utils.ts
+++ b/frontend/src/hooks/react-query/pipedream/utils.ts
@@ -100,8 +100,13 @@ export interface PipedreamAppResponse {
current_page: number;
page_size: number;
has_more: boolean;
+ count?: number;
+ start_cursor?: string;
+ end_cursor?: string;
};
total_count: number;
+ error?: string;
+ search_query?: string;
}
export interface PipedreamTool {
@@ -174,13 +179,14 @@ export const pipedreamApi = {
},
async getApps(page: number = 1, search?: string, category?: string): Promise {
+ if (search) {
+ return await this.searchApps(search, page, category);
+ }
+
const params = new URLSearchParams({
page: page.toString(),
});
- if (search) {
- params.append('search', search);
- }
if (category) {
params.append('category', category);
}
@@ -195,8 +201,41 @@ export const pipedreamApi = {
if (!result.success) {
throw new Error(result.error?.message || 'Failed to get apps');
}
+ const data = result.data!;
+ if (!data.success && data.error) {
+ throw new Error(data.error);
+ }
+ return data;
+ },
- return result.data!;
+ async searchApps(query: string, page: number = 1, category?: string): Promise {
+ const params = new URLSearchParams({
+ q: query,
+ page: page.toString(),
+ });
+
+ if (category) {
+ params.append('category', category);
+ }
+
+ const result = await backendApi.get(
+ `/pipedream/apps/search?${params.toString()}`,
+ {
+ errorContext: { operation: 'search apps', resource: 'Pipedream apps' },
+ }
+ );
+
+ if (!result.success) {
+ throw new Error(result.error?.message || 'Failed to search apps');
+ }
+
+ // Handle both success response and potential error in the data
+ const data = result.data!;
+ if (!data.success && data.error) {
+ throw new Error(data.error);
+ }
+
+ return data;
},
async getAvailableTools(): Promise {