omni-rest 0.1.0 → 0.2.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/README.md +61 -7
- package/dist/cli.js +1142 -40
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1125 -38
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +87 -3
- package/dist/index.d.ts +87 -3
- package/dist/index.js +305 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +303 -5
- package/dist/index.mjs.map +1 -1
- package/frontend-next/data-table.tsx +1888 -0
- package/frontend-next/form-generator.tsx +1062 -0
- package/package.json +36 -2
package/README.md
CHANGED
|
@@ -328,18 +328,72 @@ Full Configuration: [docs/CONFIGURATION.md](docs/CONFIGURATION.md)
|
|
|
328
328
|
|
|
329
329
|
## CLI
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
### Backend generators
|
|
332
332
|
|
|
333
333
|
```bash
|
|
334
|
-
#
|
|
335
|
-
npx omni-rest
|
|
334
|
+
npx omni-rest generate # Zod schemas + OpenAPI spec
|
|
335
|
+
npx omni-rest generate:zod # src/schemas.generated.ts only
|
|
336
|
+
npx omni-rest generate:openapi # openapi.json only
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Frontend generator
|
|
340
|
+
|
|
341
|
+
Scaffold a complete React data layer from your Prisma schema — TanStack Query hooks, DataTable components, FormGenerator components, and column definitions — all typed against `@prisma/client`.
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# guided (prompts per model)
|
|
345
|
+
npx omni-rest generate:frontend
|
|
346
|
+
|
|
347
|
+
# autopilot (no prompts, all models, sensible defaults)
|
|
348
|
+
npx omni-rest generate:frontend --autopilot
|
|
349
|
+
```
|
|
336
350
|
|
|
337
|
-
|
|
338
|
-
npx omni-rest generate
|
|
351
|
+
Given a `User` model this produces:
|
|
339
352
|
|
|
340
|
-
# Validate configuration
|
|
341
|
-
npx omni-rest validate
|
|
342
353
|
```
|
|
354
|
+
src/
|
|
355
|
+
hooks/
|
|
356
|
+
useUser.ts ← useUsers, useUser, useCreateUser, useUpdateUser, useDeleteUser, useBulkDeleteUsers
|
|
357
|
+
components/
|
|
358
|
+
user/
|
|
359
|
+
UserColumns.tsx ← ColumnDef<User>[] with camelCase → Title Case headers
|
|
360
|
+
UserTable.tsx ← DataTable wired to hooks, bulk delete, export
|
|
361
|
+
UserForm.tsx ← FormGenerator with Zod validation + relational dropdowns
|
|
362
|
+
data-table.tsx ← shared base component (copied once)
|
|
363
|
+
form-generator.tsx ← shared base component (copied once)
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Drop the components into a page:
|
|
367
|
+
|
|
368
|
+
```tsx
|
|
369
|
+
import { UserTable } from '@/src/components/user/UserTable'
|
|
370
|
+
import { UserForm } from '@/src/components/user/UserForm'
|
|
371
|
+
|
|
372
|
+
export default function UsersPage() {
|
|
373
|
+
return (
|
|
374
|
+
<div className="p-6 space-y-6">
|
|
375
|
+
<UserForm />
|
|
376
|
+
<UserTable />
|
|
377
|
+
</div>
|
|
378
|
+
)
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
**Key flags:**
|
|
383
|
+
|
|
384
|
+
| Flag | Default | Description |
|
|
385
|
+
|---|---|---|
|
|
386
|
+
| `--autopilot` | `false` | Skip all prompts |
|
|
387
|
+
| `--models <names>` | all | Comma-separated model names |
|
|
388
|
+
| `--frontend-dir <path>` | auto-scan | Frontend project root |
|
|
389
|
+
| `--out <dir>` | `src/` | Output directory |
|
|
390
|
+
| `--no-bulk` | — | Disable bulk delete |
|
|
391
|
+
| `--no-optimistic` | — | Disable optimistic updates |
|
|
392
|
+
| `--steps auto\|always\|never` | `auto` | Multi-step form control |
|
|
393
|
+
| `--stale-time <ms>` | `30000` | TanStack Query staleTime |
|
|
394
|
+
| `--gc-time <ms>` | `300000` | TanStack Query gcTime |
|
|
395
|
+
|
|
396
|
+
See the [Frontend Generator docs](https://omni-rest.vercel.app/docs/generate-frontend) for the full guide.
|
|
343
397
|
|
|
344
398
|
## How It Works
|
|
345
399
|
|