@bluecopa/react 0.1.36 → 0.1.38
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/README.md +65 -0
- package/dist/{COOQDZLH-DQnrP0WW.js → COOQDZLH-B_veh7tc.js} +2 -2
- package/dist/{MU7WGUJF-BPpiEtaS.js → MU7WGUJF-BozjR1sa.js} +2 -2
- package/dist/{VREWMQAW-BEXgoAYz.js → VREWMQAW-BnM2Gcps.js} +1 -1
- package/dist/{index-BOHSvoXk.js → index-CTdgL_Gu.js} +1739 -1697
- package/dist/index.es.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ A React library providing opinionated custom hooks for TanStack React Query inte
|
|
|
24
24
|
- [`useDatasetSample(datasetId, options?)`](#usedatasetsampledatasetid-options)
|
|
25
25
|
- [`useMetric(metricId, options?)`](#usemetricmetricid-options)
|
|
26
26
|
- [`useInputTable(inputTableId, options?)`](#useinputtableinputtableid-options)
|
|
27
|
+
- [`useRows(tableId, options?)`](#userowstableid-options)
|
|
27
28
|
- [`useGetFileUrlByFileId(fileId, options?)`](#usegetfileurlbyfileidfileid-options)
|
|
28
29
|
- [`useGetPublishedWorkbookById(workbookId, options?)`](#usegetpublishedworkbookbyidworkbookid-options)
|
|
29
30
|
- [`useGetTableById(tableId, options?)`](#usegettablebyidtableid-options)
|
|
@@ -219,6 +220,33 @@ function DatasetViewer({ datasetId }) {
|
|
|
219
220
|
}
|
|
220
221
|
```
|
|
221
222
|
|
|
223
|
+
#### `useRows` - Fetch input table rows with Supabase-style filtering
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
import { useRows } from '@bluecopa/react';
|
|
227
|
+
|
|
228
|
+
function TableRows({ tableId }) {
|
|
229
|
+
const { data, isLoading, error } = useRows(tableId, {
|
|
230
|
+
status: 'active',
|
|
231
|
+
price: 'gte.100',
|
|
232
|
+
limit: 25,
|
|
233
|
+
offset: 0
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
if (isLoading) return <div>Loading rows...</div>;
|
|
237
|
+
if (error) return <div>Error: {error.message}</div>;
|
|
238
|
+
|
|
239
|
+
return (
|
|
240
|
+
<div>
|
|
241
|
+
<div>Total: {data?.total_count ?? 0}</div>
|
|
242
|
+
{data?.data?.map(row => <div key={row._copa_id}>{JSON.stringify(row)}</div>)}
|
|
243
|
+
</div>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
📖 **For detailed documentation on `useRows` including filtering, pagination, and advanced usage, see [docs/useRows.md](./docs/useRows.md)**
|
|
249
|
+
|
|
222
250
|
## API Documentation
|
|
223
251
|
|
|
224
252
|
### `useUser(options?)`
|
|
@@ -293,6 +321,43 @@ Fetches input table data with limit parameters.
|
|
|
293
321
|
- `error`: Error object if request failed
|
|
294
322
|
- `refetch`: Function to manually trigger refetch
|
|
295
323
|
|
|
324
|
+
### `useRows(tableId, options?)`
|
|
325
|
+
|
|
326
|
+
Fetches rows from an input table with Supabase-style filtering, pagination, and sorting. Supports advanced filtering operators and group expressions.
|
|
327
|
+
|
|
328
|
+
**Parameters:**
|
|
329
|
+
- `tableId`: ID of the input table (string | null | undefined)
|
|
330
|
+
- `options` (optional): Query options extending `GetRowsOptions` and `BaseQueryOptions`:
|
|
331
|
+
- `limit`: Maximum rows to fetch (1-10000)
|
|
332
|
+
- `offset`: Number of rows to skip
|
|
333
|
+
- `order`: Sort order ('asc' or 'desc')
|
|
334
|
+
- `order_by`: Column name to sort by
|
|
335
|
+
- Filter fields: Any column name with Supabase-style operator syntax (e.g., `status: 'active'`, `price: 'gte.100'`, `status: 'in.(active,pending)'`)
|
|
336
|
+
- `or`: Supabase/PostgREST group expression for OR conditions
|
|
337
|
+
- `and`: Supabase/PostgREST group expression for AND conditions
|
|
338
|
+
- React Query options: `enabled`, `staleTime`, `gcTime`, `retry`, `retryDelay`, `onSuccess`, `onError`
|
|
339
|
+
|
|
340
|
+
**Returns:**
|
|
341
|
+
- `data`: `GetRowsResponse` object containing:
|
|
342
|
+
- `data`: Array of row objects
|
|
343
|
+
- `count`: Number of rows in current page
|
|
344
|
+
- `total_count`: Total rows available
|
|
345
|
+
- `isLoading`: Boolean indicating loading state
|
|
346
|
+
- `error`: Error object if request failed
|
|
347
|
+
- `refetch`: Function to manually trigger refetch
|
|
348
|
+
|
|
349
|
+
**Example:**
|
|
350
|
+
```tsx
|
|
351
|
+
const { data, isLoading } = useRows('table-123', {
|
|
352
|
+
status: 'active',
|
|
353
|
+
price: 'gte.100',
|
|
354
|
+
limit: 25,
|
|
355
|
+
offset: 0
|
|
356
|
+
});
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
📖 **For comprehensive documentation including all supported operators, filtering patterns, and advanced usage, see [docs/useRows.md](./docs/useRows.md)**
|
|
360
|
+
|
|
296
361
|
### `useGetFileUrlByFileId(fileId, options?)`
|
|
297
362
|
|
|
298
363
|
Fetches the URL for a file by its ID.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c, T as l, P as m, a as u, D as v, Q as i } from "./VREWMQAW-
|
|
2
|
-
import { g as d, c as f, a as e } from "./index-
|
|
1
|
+
import { c, T as l, P as m, a as u, D as v, Q as i } from "./VREWMQAW-BnM2Gcps.js";
|
|
2
|
+
import { g as d, c as f, a as e } from "./index-CTdgL_Gu.js";
|
|
3
3
|
var p = (a) => {
|
|
4
4
|
const [r, t] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./VREWMQAW-
|
|
2
|
-
import { g as v, c as C, a as e } from "./index-
|
|
1
|
+
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./VREWMQAW-BnM2Gcps.js";
|
|
2
|
+
import { g as v, c as C, a as e } from "./index-CTdgL_Gu.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = s({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var bs = Object.defineProperty;
|
|
2
2
|
var ps = (e, t, n) => t in e ? bs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var _e = (e, t, n) => ps(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { b as xe, d as z, o as Ft, e as N, c as D, a as m, P as qo, S as B, t as _, i as k, f as V, h as F, j as ws, k as rr, u as $e, l as j, s as Vn, m as Gn, n as ut, p as A, q as xs, r as an, v as Ne, w as $s, x as _t, y as zt, z as Cs, A as Ss, B as xn, F as ks, C as Kr, D as Kt, $ as Ro, E as Es, G as Ds, H as W, I as Br, J as Ms, K as As, L as or, M as Fs, N as Ts, O as Rn, Q as Is, R as Ps, T as oe, U as Ls, V as Os } from "./index-
|
|
4
|
+
import { b as xe, d as z, o as Ft, e as N, c as D, a as m, P as qo, S as B, t as _, i as k, f as V, h as F, j as ws, k as rr, u as $e, l as j, s as Vn, m as Gn, n as ut, p as A, q as xs, r as an, v as Ne, w as $s, x as _t, y as zt, z as Cs, A as Ss, B as xn, F as ks, C as Kr, D as Kt, $ as Ro, E as Es, G as Ds, H as W, I as Br, J as Ms, K as As, L as or, M as Fs, N as Ts, O as Rn, Q as Is, R as Ps, T as oe, U as Ls, V as Os } from "./index-CTdgL_Gu.js";
|
|
5
5
|
var _s = (e) => e != null, qs = (e) => e.filter(_s);
|
|
6
6
|
function Rs(e) {
|
|
7
7
|
return (...t) => {
|