zod-paginate 1.3.0 → 1.3.1
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 +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ const { queryParamsSchema, validatorSchema, responseSchema } = paginate({
|
|
|
56
56
|
defaultSortBy: [{ property: "createdAt", direction: "DESC" }],
|
|
57
57
|
defaultLimit: 20,
|
|
58
58
|
maxLimit: 100,
|
|
59
|
-
defaultSelect:
|
|
59
|
+
defaultSelect: '*',
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
// Example querystring-like input
|
|
@@ -152,9 +152,9 @@ function createPaginatorUnion(): PaginateResult<typeof ModelSchema, "id" | "stat
|
|
|
152
152
|
| `sortable?` | `string[]` (typed paths) | Allowlist of sortable fields. Enables `sortBy`. |
|
|
153
153
|
| `filterable?` | object | Allowlist of filterable fields and allowed operators + field type. |
|
|
154
154
|
| `defaultSortBy?` | `{ property, direction }[]` | Default sort if `sortBy` missing/empty. |
|
|
155
|
-
| `defaultLimit
|
|
156
|
-
| `maxLimit
|
|
157
|
-
| `defaultSelect
|
|
155
|
+
| `defaultLimit` | `number` | **Required.** Default limit if `limit` missing. |
|
|
156
|
+
| `maxLimit` | `number` | **Required.** Rejects `limit` values above this. |
|
|
157
|
+
| `defaultSelect` | `field[] \| "*"` | **Required.** Default select if `select` missing. `"*"` expands to `selectable`. |
|
|
158
158
|
| `cursorProperty` | (CURSOR only) typed path | The field used for cursor paging. Cursor type is inferred from `dataSchema` at that path and the query input cursor is coerced accordingly. |
|
|
159
159
|
|
|
160
160
|
## Query input shape
|
|
@@ -561,7 +561,7 @@ const { responseSchema } = paginate({
|
|
|
561
561
|
paginationType: "LIMIT_OFFSET",
|
|
562
562
|
dataSchema: ModelSchema,
|
|
563
563
|
selectable: ["id", "status", "createdAt", "meta.score"],
|
|
564
|
-
defaultSelect:
|
|
564
|
+
defaultSelect: '*',
|
|
565
565
|
defaultLimit: 20,
|
|
566
566
|
maxLimit: 100,
|
|
567
567
|
});
|
|
@@ -631,7 +631,7 @@ function createSelector(): SelectResult<typeof ProductSchema, "id" | "name" | "p
|
|
|
631
631
|
|---|---:|---|
|
|
632
632
|
| `dataSchema` | `z.ZodObject` | Zod schema representing one data item. |
|
|
633
633
|
| `selectable` | `string[]` (typed paths) | Allowlist of selectable fields (dot paths supported). |
|
|
634
|
-
| `defaultSelect
|
|
634
|
+
| `defaultSelect` | `field[] \| "*"` | **Required.** Default select if `select` is missing. `"*"` expands to `selectable`. |
|
|
635
635
|
|
|
636
636
|
#### Example
|
|
637
637
|
|