nuxt-auto-crud 2.1.2 → 2.1.4
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 +9 -8
- package/dist/module.d.mts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,13 +56,14 @@ export const users = sqliteTable('users', {
|
|
|
56
56
|
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
###
|
|
59
|
+
### Generate Migrations and Start Dev Server
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
nuxt db generate
|
|
63
|
+
nuxt dev
|
|
64
64
|
|
|
65
65
|
```
|
|
66
|
+
> If you encounter `Error: Cannot find module 'typescript'`, run `bun add -D typescript`.
|
|
66
67
|
|
|
67
68
|
---
|
|
68
69
|
|
|
@@ -72,7 +73,7 @@ Nb: Endpoints follow the pattern `/api/_nac/:model`.
|
|
|
72
73
|
|
|
73
74
|
| Method | Endpoint | Action |
|
|
74
75
|
| --- | --- | --- |
|
|
75
|
-
| **GET** | `/:model` | List records
|
|
76
|
+
| **GET** | `/:model` | List records |
|
|
76
77
|
| **POST** | `/:model` | Create record with Zod validation |
|
|
77
78
|
| **GET** | `/:model/:id` | Fetch single record |
|
|
78
79
|
| **PATCH** | `/:model/:id` | Partial update with validation |
|
|
@@ -82,7 +83,7 @@ Nb: Endpoints follow the pattern `/api/_nac/:model`.
|
|
|
82
83
|
|
|
83
84
|
| Action | HTTP Method | Endpoint | Example Result |
|
|
84
85
|
| --- | --- | --- | --- |
|
|
85
|
-
| **Fetch All** | `GET` | `/api/_nac/users` | List of all users
|
|
86
|
+
| **Fetch All** | `GET` | `/api/_nac/users` | List of all users |
|
|
86
87
|
| **Create** | `POST` | `/api/_nac/users` | New user record added |
|
|
87
88
|
| **Fetch One** | `GET` | `/api/_nac/users/1` | Details of user with `id: 1` |
|
|
88
89
|
| **Update** | `PATCH` | `/api/_nac/users/1` | Partial update to user `1` |
|
|
@@ -156,7 +157,7 @@ Enabling `authentication` in the `autoCrud` config protects all **nac** routes (
|
|
|
156
157
|
| `realtime` | `false` | Enables/disables real-time capabilities. |
|
|
157
158
|
| `auth.authentication` | `true` | Requires a valid session for all NAC routes. |
|
|
158
159
|
| `auth.authorization` | `true` | Enables role/owner-based access checks. |
|
|
159
|
-
| `auth.ownerKey` | `'
|
|
160
|
+
| `auth.ownerKey` | `'createdBy'` | The column name used to identify the record creator. |
|
|
160
161
|
| `publicResources` | `{}` | Defines tables and specific columns accessible without auth. |
|
|
161
162
|
| `nacEndpointPrefix` | `'/api/_nac'` | The base path for NAC routes. Access via `useRuntimeConfig().public.autoCrud`. |
|
|
162
163
|
| `schemaPath` | `'server/db/schema'` | Location of your Drizzle schema files. |
|
|
@@ -169,7 +170,7 @@ autoCrud: {
|
|
|
169
170
|
auth: {
|
|
170
171
|
authentication: true,
|
|
171
172
|
authorization: true,
|
|
172
|
-
ownerKey: '
|
|
173
|
+
ownerKey: 'createdBy',
|
|
173
174
|
},
|
|
174
175
|
publicResources: {
|
|
175
176
|
users: ['id', 'name', 'email'],
|
|
@@ -194,7 +195,7 @@ To align with standard application behavior, **nac** automatically filters recor
|
|
|
194
195
|
|
|
195
196
|
### Ownership & Permissions
|
|
196
197
|
|
|
197
|
-
While the implementing app handles the authentication layer, **nac** provides a standardized way to enforce record ownership and granular access.
|
|
198
|
+
While the implementing app handles the authentication & authorization layer, **nac** provides a standardized way to enforce record ownership and granular access.
|
|
198
199
|
|
|
199
200
|
If your middleware populates `event.context.nac` with `resourcePermissions`, **nac** automatically injects the necessary SQL filters.
|
|
200
201
|
|
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED