@bluecopa/react 0.1.3 → 0.1.5

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.
Files changed (36) hide show
  1. package/README.md +540 -125
  2. package/dist/{COOQDZLH-Ddkg5gQi.js → COOQDZLH-DwCXFB0t.js} +2 -2
  3. package/dist/{MU7WGUJF-Cztn6X5s.js → MU7WGUJF-Cd0WQIX3.js} +2 -2
  4. package/dist/{VREWMQAW-MNJLwgkh.js → VREWMQAW-2qEg3fOl.js} +1 -1
  5. package/dist/hooks/useDataset.d.ts +4 -0
  6. package/dist/hooks/useDataset.d.ts.map +1 -1
  7. package/dist/hooks/useGetFileUrlByFileId.d.ts +12 -0
  8. package/dist/hooks/useGetFileUrlByFileId.d.ts.map +1 -0
  9. package/dist/hooks/useGetPublishedWorkbookById.d.ts +11 -0
  10. package/dist/hooks/useGetPublishedWorkbookById.d.ts.map +1 -0
  11. package/dist/hooks/useGetTableById.d.ts +10 -0
  12. package/dist/hooks/useGetTableById.d.ts.map +1 -0
  13. package/dist/hooks/useGetWorkbooksByType.d.ts +10 -0
  14. package/dist/hooks/useGetWorkbooksByType.d.ts.map +1 -0
  15. package/dist/hooks/useGetWorkflowInstanceStatusById.d.ts +11 -0
  16. package/dist/hooks/useGetWorkflowInstanceStatusById.d.ts.map +1 -0
  17. package/dist/hooks/useGetWorksheets.d.ts +10 -0
  18. package/dist/hooks/useGetWorksheets.d.ts.map +1 -0
  19. package/dist/hooks/useGetWorksheetsByType.d.ts +10 -0
  20. package/dist/hooks/useGetWorksheetsByType.d.ts.map +1 -0
  21. package/dist/hooks/useInputTable.d.ts +4 -0
  22. package/dist/hooks/useInputTable.d.ts.map +1 -1
  23. package/dist/hooks/useTriggerHttpWorkflow.d.ts +11 -0
  24. package/dist/hooks/useTriggerHttpWorkflow.d.ts.map +1 -0
  25. package/dist/hooks/useTriggerWorkflow.d.ts +11 -0
  26. package/dist/hooks/useTriggerWorkflow.d.ts.map +1 -0
  27. package/dist/hooks/useWorkbook.d.ts +8 -0
  28. package/dist/hooks/useWorkbook.d.ts.map +1 -0
  29. package/dist/hooks/useWorkflow.d.ts +7 -0
  30. package/dist/hooks/useWorkflow.d.ts.map +1 -0
  31. package/dist/hooks/useWorksheet.d.ts +8 -0
  32. package/dist/hooks/useWorksheet.d.ts.map +1 -0
  33. package/dist/index-Bh4ct-gK.js +12350 -0
  34. package/dist/index.es.js +9 -7
  35. package/package.json +3 -3
  36. package/dist/index-4pvStUsJ.js +0 -12224
package/README.md CHANGED
@@ -1,183 +1,593 @@
1
- # @bluecopa/reactjs
2
-
3
- A React.js wrapper for TanStack React Query with Bluecopa core integration.
1
+ # @bluecopa/react [![npm version](https://img.shields.io/npm/v/@bluecopa/react)](https://www.npmjs.com/package/@bluecopa/react) [![License](https://img.shields.io/npm/l/@bluecopa/react)](https://github.com/bluecopa/blui/blob/main/packages/react/LICENSE)
2
+
3
+ ## A Comprehensive React Query Integration for Bluecopa
4
+
5
+ A React library providing opinionated custom hooks for TanStack React Query integration with Bluecopa core API. This package enables efficient data fetching, caching, and synchronization with the Bluecopa platform while maintaining type safety and developer experience.
6
+
7
+ ## Table of Contents
8
+
9
+ - [@bluecopa/react ](#bluecopareact--)
10
+ - [A Comprehensive React Query Integration for Bluecopa](#a-comprehensive-react-query-integration-for-bluecopa)
11
+ - [Table of Contents](#table-of-contents)
12
+ - [Features](#features)
13
+ - [Installation](#installation)
14
+ - [Peer Dependencies](#peer-dependencies)
15
+ - [Usage](#usage)
16
+ - [Query Provider Setup](#query-provider-setup)
17
+ - [Boilerplate Integration](#boilerplate-integration)
18
+ - [Hook Examples](#hook-examples)
19
+ - [`useUser` - Fetch authenticated user](#useuser---fetch-authenticated-user)
20
+ - [`useDataset` - Fetch dataset with query controls](#usedataset---fetch-dataset-with-query-controls)
21
+ - [API Documentation](#api-documentation)
22
+ - [`useUser(options?)`](#useuseroptions)
23
+ - [`useDataset(datasetId, options?)`](#usedatasetdatasetid-options)
24
+ - [`useDatasetSample(datasetId, options?)`](#usedatasetsampledatasetid-options)
25
+ - [`useMetric(metricId, options?)`](#usemetricmetricid-options)
26
+ - [`useInputTable(inputTableId, options?)`](#useinputtableinputtableid-options)
27
+ - [`useGetFileUrlByFileId(fileId, options?)`](#usegetfileurlbyfileidfileid-options)
28
+ - [`useGetPublishedWorkbookById(workbookId, options?)`](#usegetpublishedworkbookbyidworkbookid-options)
29
+ - [`useGetTableById(tableId, options?)`](#usegettablebyidtableid-options)
30
+ - [`useGetWorkbooksByType(workbookType, options?)`](#usegetworkbooksbytypeworkbooktype-options)
31
+ - [`useGetWorkflowInstanceStatusById(instanceId, options?)`](#usegetworkflowinstancestatusbyidinstanceid-options)
32
+ - [`useGetWorksheets(options?)`](#usegetworksheetsoptions)
33
+ - [`useGetWorksheetsByType(worksheetType, options?)`](#usegetworksheetsbytypeworksheettype-options)
34
+ - [`useRunDefinition(definitionId, options?)`](#userundefinitiondefinitionid-options)
35
+ - [`useRunPublishedDefinition(publishedDefinitionId, options?)`](#userunpublisheddefinitionpublisheddefinitionid-options)
36
+ - [`useRunSampleDefinition(sampleDefinitionId, options?)`](#userunsampledefinitionsampledefinitionid-options)
37
+ - [`useTriggerHttpWorkflow(workflowId, payload, options?)`](#usetriggerhttpworkflowworkflowid-payload-options)
38
+ - [`useTriggerWorkflow(workflowId, options?)`](#usetriggerworkflowworkflowid-options)
39
+ - [`useWorkbook(workbookId, options?)`](#useworkbookworkbookid-options)
40
+ - [`useWorkflow(workflowId, options?)`](#useworkflowworkflowid-options)
41
+ - [`useWorksheet(worksheetId, options?)`](#useworksheetworksheetid-options)
42
+ - [Configuration](#configuration)
43
+ - [Default Query Configuration](#default-query-configuration)
44
+ - [Customizable Parameters](#customizable-parameters)
45
+ - [Advanced Usage](#advanced-usage)
46
+ - [Error Handling](#error-handling)
47
+ - [Manual Refetching](#manual-refetching)
48
+ - [Re-exports](#re-exports)
49
+ - [TypeScript Support](#typescript-support)
50
+ - [Development](#development)
51
+
52
+ ## Features
53
+
54
+ - ✅ First-class TypeScript support with strict type definitions
55
+ - 🔁 Seamless integration with TanStack React Query (v5+)
56
+ - 🛡 Comprehensive error handling patterns
57
+ - ⚙ Optimized default query configuration
58
+ - 📦 Re-exports of core TanStack React Query utilities
59
+ - 📊 Sample data preview capabilities
60
+ - 🧩 Customizable query parameters (limit, caching, retries)
4
61
 
5
62
  ## Installation
6
63
 
7
64
  ```bash
8
- npm install @bluecopa/reactjs @bluecopa/core @tanstack/react-query
65
+ npm install @bluecopa/react
66
+ # or with pnpm
67
+ pnpm add @bluecopa/react
68
+ ```
69
+
70
+ ### Peer Dependencies
71
+
72
+ This package requires the following in your application:
73
+
74
+ ```bash
75
+ npm install react@^18.0.0 react-dom@^18.0.0
9
76
  ```
10
77
 
11
78
  ## Usage
12
79
 
13
- ### 1. Setup the Provider
80
+ ### Query Provider Setup
14
81
 
15
- Wrap your app with the `BlueCopaQueryProvider`:
82
+ Wrap your application with the React Query provider:
16
83
 
17
84
  ```tsx
18
- import React from 'react';
19
- import { BlueCopaQueryProvider } from '@bluecopa/reactjs';
20
- import { ApiClient } from '@bluecopa/core';
85
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
21
86
 
22
- const apiClient = new ApiClient({
23
- baseURL: 'https://api.example.com',
24
- // other config options
87
+ const queryClient = new QueryClient({
88
+ defaultOptions: {
89
+ queries: {
90
+ staleTime: 60 * 1000, // 1 minute
91
+ refetchOnWindowFocus: false,
92
+ },
93
+ },
25
94
  });
26
95
 
27
96
  function App() {
28
97
  return (
29
- <BlueCopaQueryProvider
30
- config={{
31
- apiClient,
32
- defaultStaleTime: 5 * 60 * 1000, // 5 minutes
33
- defaultCacheTime: 10 * 60 * 1000, // 10 minutes
34
- enableDevtools: true,
35
- }}
36
- >
37
- <YourAppComponents />
38
- </BlueCopaQueryProvider>
98
+ <QueryClientProvider client={queryClient}>
99
+ <YourApp />
100
+ <ReactQueryDevtools initialIsOpen={false} />
101
+ </QueryClientProvider>
39
102
  );
40
103
  }
41
104
  ```
42
105
 
43
- ### 2. Using Queries
106
+ ### Boilerplate Integration
107
+
108
+ For projects using the Bluecopa React boilerplate, use the pre-configured `QueryProvider` component that handles API configuration automatically:
44
109
 
45
110
  ```tsx
46
- import React from 'react';
47
- import { useQuery } from '@bluecopa/reactjs';
48
-
49
- function UserProfile({ userId }: { userId: string }) {
50
- const { data, isLoading, error } = useQuery({
51
- queryKey: {
52
- scope: 'users',
53
- endpoint: `/users/${userId}`,
111
+ // src/providers/query-provider.tsx
112
+ import { ReactQueryDevtools, reactQuery, copaSetConfig } from "@bluecopa/react";
113
+ import { useEffect, useState } from "react";
114
+
115
+ const { QueryClient, QueryClientProvider } = reactQuery;
116
+
117
+ export default function QueryProvider({ children }: { children: React.ReactNode }) {
118
+ const [queryClient] = useState(() => new QueryClient({
119
+ defaultOptions: {
120
+ queries: {
121
+ staleTime: 60 * 1000, // 1 minute
122
+ refetchOnWindowFocus: false,
123
+ },
54
124
  },
55
- staleTime: 5 * 60 * 1000,
56
- });
125
+ }));
126
+
127
+ useEffect(() => {
128
+ let copaUser: any = {};
129
+ try {
130
+ const copaToken = import.meta.env.VITE_BLUECOPA_API_TOKEN
131
+ ? atob(import.meta.env.VITE_BLUECOPA_API_TOKEN)
132
+ : "{}";
133
+
134
+ copaUser = JSON.parse(copaToken);
135
+ } catch (error) {
136
+ console.warn("Failed to parse VITE_BLUECOPA_API_TOKEN:", error);
137
+ }
138
+
139
+ copaSetConfig({
140
+ apiBaseUrl: import.meta.env.VITE_BLUECOPA_API_URL || "https://develop.bluecopa.com/api/v1",
141
+ workspaceId: import.meta.env.VITE_BLUECOPA_WORKSPACE_ID || "",
142
+ accessToken: copaUser?.accessToken || "",
143
+ });
144
+ }, []);
57
145
 
58
- if (isLoading) return <div>Loading...</div>;
59
- if (error) return <div>Error: {error.message}</div>;
60
-
61
- return <div>User: {data?.name}</div>;
146
+ return (
147
+ <QueryClientProvider client={queryClient}>
148
+ {children}
149
+ <ReactQueryDevtools initialIsOpen={false} />
150
+ </QueryClientProvider>
151
+ );
62
152
  }
63
153
  ```
64
154
 
65
- ### 3. Using Mutations
155
+ **Required Environment Variables:**
66
156
 
67
- ```tsx
68
- import React from 'react';
69
- import { usePost, usePut } from '@bluecopa/reactjs';
157
+ | Variable | Description | Example |
158
+ |----------|-------------|---------|
159
+ | `VITE_BLUECOPA_API_URL` | Base URL for Bluecopa API | `https://develop.bluecopa.com` |
160
+ | `VITE_BLUECOPA_WORKSPACE_ID` | Your workspace identifier | `my-workspace-123` |
161
+ | `VITE_BLUECOPA_API_TOKEN` | Base64-encoded JSON string containing `accessToken` | `eyJhY2Nlc3NUb2tlbiI6IjEyMzQ1In0=` |
70
162
 
71
- function CreateUser() {
72
- const createUser = usePost('/users', {
73
- onSuccess: (data) => {
74
- console.log('User created:', data);
75
- },
76
- onError: (error) => {
77
- console.error('Failed to create user:', error);
78
- },
79
- });
163
+ **Example `.env` file:**
164
+ ```
165
+ VITE_BLUECOPA_API_URL=https://develop.bluecopa.com
166
+ VITE_BLUECOPA_WORKSPACE_ID=your-workspace-id
167
+ VITE_BLUECOPA_API_TOKEN=base64-encoded-json-here
168
+ ```
80
169
 
81
- const handleSubmit = (userData: any) => {
82
- createUser.mutate(userData);
83
- };
170
+ Then wrap your application with this provider:
84
171
 
172
+ ```tsx
173
+ import QueryProvider from './providers/query-provider';
174
+
175
+ function App() {
85
176
  return (
86
- <form onSubmit={handleSubmit}>
87
- {/* form fields */}
88
- <button
89
- type="submit"
90
- disabled={createUser.isPending}
91
- >
92
- {createUser.isPending ? 'Creating...' : 'Create User'}
93
- </button>
94
- </form>
177
+ <QueryProvider>
178
+ <YourApp />
179
+ </QueryProvider>
95
180
  );
96
181
  }
97
182
  ```
98
183
 
99
- ### 4. Using Infinite Queries
184
+ This setup automatically configures the API client with your environment-specific settings and applies optimal caching defaults.
185
+
186
+ ### Hook Examples
187
+
188
+ #### `useUser` - Fetch authenticated user
100
189
 
101
190
  ```tsx
102
- import React from 'react';
103
- import { useInfiniteQuery } from '@bluecopa/reactjs';
104
-
105
- function UserList() {
106
- const {
107
- data,
108
- fetchNextPage,
109
- hasNextPage,
110
- isFetchingNextPage,
111
- isLoading,
112
- } = useInfiniteQuery({
113
- queryKey: {
114
- scope: 'users',
115
- endpoint: '/users',
116
- params: { limit: 10 },
117
- },
118
- getNextPageParam: (lastPage) => lastPage.nextPage,
119
- });
191
+ import { useUser } from '@bluecopa/react';
120
192
 
193
+ function UserProfile() {
194
+ const { data, isLoading, error } = useUser({
195
+ staleTime: 5 * 60 * 1000, // 5 minutes
196
+ retry: 2
197
+ });
198
+
121
199
  if (isLoading) return <div>Loading...</div>;
200
+ if (error) return <div>Error: {error.message}</div>;
201
+
202
+ return <div>Welcome, {data?.name}!</div>;
203
+ }
204
+ ```
122
205
 
123
- return (
124
- <div>
125
- {data?.pages.map((page, i) => (
126
- <div key={i}>
127
- {page.data.map((user: any) => (
128
- <div key={user.id}>{user.name}</div>
129
- ))}
130
- </div>
131
- ))}
132
- {hasNextPage && (
133
- <button
134
- onClick={() => fetchNextPage()}
135
- disabled={isFetchingNextPage}
136
- >
137
- {isFetchingNextPage ? 'Loading more...' : 'Load More'}
138
- </button>
139
- )}
140
- </div>
141
- );
206
+ #### `useDataset` - Fetch dataset with query controls
207
+
208
+ ```tsx
209
+ import { useDataset } from '@bluecopa/react';
210
+
211
+ function DatasetViewer({ datasetId }) {
212
+ const { data, isLoading } = useDataset(datasetId, {
213
+ limit: 500,
214
+ staleTime: 10 * 60 * 1000 // 10 minutes
215
+ });
216
+
217
+ if (isLoading) return <div>Loading dataset...</div>;
218
+ return <div>{data?.name} ({data?.records?.length} records)</div>;
142
219
  }
143
220
  ```
144
221
 
145
- ## API Reference
222
+ ## API Documentation
223
+
224
+ ### `useUser(options?)`
225
+
226
+ Fetches authenticated user details with query controls.
227
+
228
+ **Parameters:**
229
+ - `options` (optional): Query options extending TanStack React Query's `UseQueryOptions`
230
+
231
+ **Returns:**
232
+ - `data`: User object or `undefined`
233
+ - `isLoading`: Boolean indicating loading state
234
+ - `error`: Error object if request failed
235
+ - `refetch`: Function to manually trigger refetch
236
+
237
+ ### `useDataset(datasetId, options?)`
238
+
239
+ Fetches dataset data by ID with configurable parameters.
240
+
241
+ **Parameters:**
242
+ - `datasetId`: ID of the dataset to fetch
243
+ - `options` (optional): Query options with:
244
+ - `limit`: Maximum records to fetch
245
+ - `staleTime`: Duration (ms) before data is considered stale
246
+
247
+ **Returns:**
248
+ - `data`: Dataset object containing name and records
249
+ - `isLoading`: Boolean indicating loading state
250
+ - `error`: Error object if request failed
251
+ - `refetch`: Function to manually trigger refetch
252
+
253
+ ### `useDatasetSample(datasetId, options?)`
254
+
255
+ Fetches a representative sample of dataset data.
256
+
257
+ **Parameters:**
258
+ - `datasetId`: ID of the dataset
259
+ - `options` (optional): Query options with `enabled` flag
260
+
261
+ **Returns:**
262
+ - `data`: Object containing sample data
263
+ - `isLoading`: Boolean indicating loading state
264
+ - `refetch`: Function to manually trigger refetch
265
+
266
+ ### `useMetric(metricId, options?)`
267
+
268
+ Fetches metric data by ID.
269
+
270
+ **Parameters:**
271
+ - `metricId`: ID of the metric
272
+ - `options` (optional): Query options
273
+
274
+ **Returns:**
275
+ - `data`: Metric object with name and value
276
+ - `isLoading`: Boolean indicating loading state
277
+ - `error`: Error object if request failed
278
+ - `refetch`: Function to manually trigger refetch
279
+
280
+ ### `useInputTable(inputTableId, options?)`
281
+
282
+ Fetches input table data with limit parameters.
283
+
284
+ **Parameters:**
285
+ - `inputTableId`: ID of the input table
286
+ - `options` (optional): Query options with `limitParams`:
287
+ - `limit`: Maximum rows to fetch
288
+ - `limitFrom`: Direction to apply limit from ('top' or 'bottom')
289
+
290
+ **Returns:**
291
+ - `data`: Input table object with rows
292
+ - `isLoading`: Boolean indicating loading state
293
+ - `error`: Error object if request failed
294
+ - `refetch`: Function to manually trigger refetch
295
+
296
+ ### `useGetFileUrlByFileId(fileId, options?)`
297
+
298
+ Fetches the URL for a file by its ID.
299
+
300
+ **Parameters:**
301
+ - `fileId`: ID of the file to fetch URL for
302
+ - `options` (optional): Query options extending TanStack React Query's `UseQueryOptions`
303
+
304
+ **Returns:**
305
+ - `data`: Object containing file URL
306
+ - `isLoading`: Boolean indicating loading state
307
+ - `error`: Error object if request failed
308
+ - `refetch`: Function to manually trigger refetch
309
+
310
+ ### `useGetPublishedWorkbookById(workbookId, options?)`
311
+
312
+ Fetches published workbook details by ID.
313
+
314
+ **Parameters:**
315
+ - `workbookId`: ID of the published workbook
316
+ - `options` (optional): Query options
317
+
318
+ **Returns:**
319
+ - `data`: Published workbook object
320
+ - `isLoading`: Boolean indicating loading state
321
+ - `error`: Error object if request failed
322
+ - `refetch`: Function to manually trigger refetch
323
+
324
+ ### `useGetTableById(tableId, options?)`
325
+
326
+ Fetches table metadata by ID.
327
+
328
+ **Parameters:**
329
+ - `tableId`: ID of the table
330
+ - `options` (optional): Query options
331
+
332
+ **Returns:**
333
+ - `data`: Table metadata object
334
+ - `isLoading`: Boolean indicating loading state
335
+ - `error`: Error object if request failed
336
+ - `refetch`: Function to manually trigger refetch
337
+
338
+ ### `useGetWorkbooksByType(workbookType, options?)`
339
+
340
+ Fetches workbooks filtered by type.
341
+
342
+ **Parameters:**
343
+ - `workbookType`: Type of workbooks to fetch
344
+ - `options` (optional): Query options
345
+
346
+ **Returns:**
347
+ - `data`: Array of workbook objects
348
+ - `isLoading`: Boolean indicating loading state
349
+ - `error`: Error object if request failed
350
+ - `refetch`: Function to manually trigger refetch
351
+
352
+ ### `useGetWorkflowInstanceStatusById(instanceId, options?)`
353
+
354
+ Fetches workflow instance status by ID.
355
+
356
+ **Parameters:**
357
+ - `instanceId`: ID of the workflow instance
358
+ - `options` (optional): Query options
359
+
360
+ **Returns:**
361
+ - `data`: Workflow status object
362
+ - `isLoading`: Boolean indicating loading state
363
+ - `error`: Error object if request failed
364
+ - `refetch`: Function to manually trigger refetch
365
+
366
+ ### `useGetWorksheets(options?)`
367
+
368
+ Fetches all available worksheets.
369
+
370
+ **Parameters:**
371
+ - `options` (optional): Query options
372
+
373
+ **Returns:**
374
+ - `data`: Array of worksheet objects
375
+ - `isLoading`: Boolean indicating loading state
376
+ - `error`: Error object if request failed
377
+ - `refetch`: Function to manually trigger refetch
378
+
379
+ ### `useGetWorksheetsByType(worksheetType, options?)`
380
+
381
+ Fetches worksheets filtered by type.
382
+
383
+ **Parameters:**
384
+ - `worksheetType`: Type of worksheets to fetch
385
+ - `options` (optional): Query options
386
+
387
+ **Returns:**
388
+ - `data`: Array of worksheet objects
389
+ - `isLoading`: Boolean indicating loading state
390
+ - `error`: Error object if request failed
391
+ - `refetch`: Function to manually trigger refetch
392
+
393
+ ### `useRunDefinition(definitionId, options?)`
394
+
395
+ Executes a run definition.
396
+
397
+ **Parameters:**
398
+ - `definitionId`: ID of the run definition
399
+ - `options` (optional): Query options
400
+
401
+ **Returns:**
402
+ - `data`: Execution result
403
+ - `isLoading`: Boolean indicating loading state
404
+ - `error`: Error object if request failed
405
+ - `refetch`: Function to manually trigger refetch
406
+
407
+ ### `useRunPublishedDefinition(publishedDefinitionId, options?)`
408
+
409
+ Executes a published run definition.
410
+
411
+ **Parameters:**
412
+ - `publishedDefinitionId`: ID of the published definition
413
+ - `options` (optional): Query options
414
+
415
+ **Returns:**
416
+ - `data`: Execution result
417
+ - `isLoading`: Boolean indicating loading state
418
+ - `error`: Error object if request failed
419
+ - `refetch`: Function to manually trigger refetch
420
+
421
+ ### `useRunSampleDefinition(sampleDefinitionId, options?)`
422
+
423
+ Executes a sample run definition.
424
+
425
+ **Parameters:**
426
+ - `sampleDefinitionId`: ID of the sample definition
427
+ - `options` (optional): Query options
428
+
429
+ **Returns:**
430
+ - `data`: Sample execution result
431
+ - `isLoading`: Boolean indicating loading state
432
+ - `error`: Error object if request failed
433
+ - `refetch`: Function to manually trigger refetch
434
+
435
+ ### `useTriggerHttpWorkflow(workflowId, payload, options?)`
436
+
437
+ Triggers an HTTP workflow execution.
438
+
439
+ **Parameters:**
440
+ - `workflowId`: ID of the workflow
441
+ - `payload`: Request payload
442
+ - `options` (optional): Query options
443
+
444
+ **Returns:**
445
+ - `data`: Workflow execution response
446
+ - `isLoading`: Boolean indicating loading state
447
+ - `error`: Error object if request failed
448
+ - `refetch`: Function to manually trigger refetch
449
+
450
+ ### `useTriggerWorkflow(workflowId, options?)`
451
+
452
+ Triggers a workflow execution.
453
+
454
+ **Parameters:**
455
+ - `workflowId`: ID of the workflow
456
+ - `options` (optional): Query options
457
+
458
+ **Returns:**
459
+ - `data`: Workflow execution response
460
+ - `isLoading`: Boolean indicating loading state
461
+ - `error`: Error object if request failed
462
+ - `refetch`: Function to manually trigger refetch
463
+
464
+ ### `useWorkbook(workbookId, options?)`
465
+
466
+ Fetches workbook details by ID.
467
+
468
+ **Parameters:**
469
+ - `workbookId`: ID of the workbook
470
+ - `options` (optional): Query options
471
+
472
+ **Returns:**
473
+ - `data`: Workbook object
474
+ - `isLoading`: Boolean indicating loading state
475
+ - `error`: Error object if request failed
476
+ - `refetch`: Function to manually trigger refetch
477
+
478
+ ### `useWorkflow(workflowId, options?)`
479
+
480
+ Fetches workflow configuration by ID.
481
+
482
+ **Parameters:**
483
+ - `workflowId`: ID of the workflow
484
+ - `options` (optional): Query options
485
+
486
+ **Returns:**
487
+ - `data`: Workflow configuration object
488
+ - `isLoading`: Boolean indicating loading state
489
+ - `error`: Error object if request failed
490
+ - `refetch`: Function to manually trigger refetch
491
+
492
+ ### `useWorksheet(worksheetId, options?)`
493
+
494
+ Fetches worksheet details by ID.
495
+
496
+ **Parameters:**
497
+ - `worksheetId`: ID of the worksheet
498
+ - `options` (optional): Query options
499
+
500
+ **Returns:**
501
+ - `data`: Worksheet object
502
+ - `isLoading`: Boolean indicating loading state
503
+ - `error`: Error object if request failed
504
+ - `refetch`: Function to manually trigger refetch
505
+
506
+
507
+ ## Configuration
508
+
509
+ ### Default Query Configuration
510
+
511
+ ```tsx
512
+ const queryClient = new QueryClient({
513
+ defaultOptions: {
514
+ queries: {
515
+ retry: 3,
516
+ staleTime: 1000 * 60 * 5, // 5 minutes
517
+ gcTime: 1000 * 60 * 10, // 10 minutes
518
+ },
519
+ },
520
+ });
521
+ ```
522
+
523
+ ### Customizable Parameters
146
524
 
147
- ### BlueCopaQueryProvider
525
+ All hooks accept standard TanStack React Query options:
148
526
 
149
- The main provider component that sets up React Query with Bluecopa core integration.
527
+ ```ts
528
+ interface QueryOptions {
529
+ enabled?: boolean; // Enable/disable query
530
+ staleTime?: number; // Duration (ms) before data is stale
531
+ gcTime?: number; // Duration (ms) to keep data in cache
532
+ retry?: number | boolean; // Number of retries or disable retries
533
+ onSuccess?: (data: any) => void; // Success callback
534
+ onError?: (error: Error) => void; // Error callback
535
+ }
536
+ ```
150
537
 
151
- #### Props
538
+ ## Advanced Usage
152
539
 
153
- - `config?: BlueCopaQueryConfig` - Configuration options
540
+ ### Error Handling
154
541
 
155
- #### BlueCopaQueryConfig
542
+ ```tsx
543
+ useUser({
544
+ onError: (error) => {
545
+ console.error('User fetch failed:', error.message);
546
+ // Custom error recovery logic
547
+ }
548
+ });
549
+ ```
550
+
551
+ ### Manual Refetching
156
552
 
157
- ```typescript
158
- interface BlueCopaQueryConfig {
159
- apiClient?: ApiClient;
160
- queryClient?: QueryClient;
161
- defaultStaleTime?: number;
162
- defaultCacheTime?: number;
163
- defaultRetry?: number | boolean;
164
- enableDevtools?: boolean;
553
+ ```tsx
554
+ function ManualRefetch() {
555
+ const { data, refetch } = useUser();
556
+
557
+ return (
558
+ <div>
559
+ <button onClick={() => refetch()}>Refresh</button>
560
+ </div>
561
+ );
165
562
  }
166
563
  ```
167
564
 
168
- ### Hooks
565
+ ## Re-exports
169
566
 
170
- #### useQuery
567
+ This package re-exports core TanStack React Query utilities:
171
568
 
172
- Enhanced version of TanStack's useQuery with Bluecopa integration.
569
+ ```ts
570
+ import {
571
+ useQuery,
572
+ useMutation,
573
+ QueryClient,
574
+ QueryClientProvider,
575
+ ReactQueryDevtools
576
+ } from '@bluecopa/react';
577
+ ```
173
578
 
174
- #### useMutation, usePost, usePut, usePatch, useDelete
579
+ ## TypeScript Support
175
580
 
176
- Enhanced mutation hooks with built-in HTTP method support.
581
+ Fully typed with TypeScript. All hooks provide proper type inference and IntelliSense support. Extend types for custom use cases:
177
582
 
178
- #### useInfiniteQuery
583
+ ```ts
584
+ import { User } from '@bluecopa/react';
179
585
 
180
- Enhanced infinite query hook for pagination.
586
+ interface CustomUser extends User {
587
+ role: string;
588
+ permissions: string[];
589
+ }
590
+ ```
181
591
 
182
592
  ## Development
183
593
 
@@ -188,13 +598,18 @@ pnpm install
188
598
  # Build the package
189
599
  pnpm build
190
600
 
191
- # Run in development mode (watch)
601
+ # Run development server
192
602
  pnpm dev
193
603
 
194
604
  # Run tests
195
605
  pnpm test
196
- ```
197
606
 
198
- ## License
607
+ # Run tests in watch mode
608
+ pnpm test:watch
199
609
 
200
- MIT
610
+ # Lint code
611
+ pnpm lint
612
+
613
+ # Format code
614
+ pnpm format
615
+ ```