@appxdigital/appx-core 0.1.121-beta.10 → 0.1.121-beta.11
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/PRERELEASES.md +9 -0
- package/docs/dtos.md +16 -0
- package/docs/limitations.md +4 -0
- package/package.json +1 -1
package/PRERELEASES.md
CHANGED
|
@@ -31,6 +31,15 @@ Prereleases are excluded from normal semver range resolution, so a project on
|
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
34
|
+
## [0.1.121-beta.11] — unreleased
|
|
35
|
+
|
|
36
|
+
**Docs.** No code change. Documented that nested writes over HTTP CRUD are
|
|
37
|
+
**one level deep** (a nested `create` DTO exposes the related model's scalars +
|
|
38
|
+
`connect`, not its own relations, to avoid circular DTOs). The proxy's
|
|
39
|
+
authorization is recursive; the DTO surface is the cap — deeper nesting `400`s,
|
|
40
|
+
and multi-level nested writes belong in an explicit endpoint. See `docs/dtos.md`
|
|
41
|
+
and `docs/limitations.md`.
|
|
42
|
+
|
|
34
43
|
## [0.1.121-beta.10] — unreleased
|
|
35
44
|
|
|
36
45
|
**Library.** **Nested relation writes on generated CRUD are now an explicit,
|
package/docs/dtos.md
CHANGED
|
@@ -140,6 +140,22 @@ POST /projects
|
|
|
140
140
|
|
|
141
141
|
**Keep `forbidNonWhitelisted: true` on** so a disallowed operator (e.g. `set`) **fails loud** with a `400`. Never run `whitelist` in strip-only mode on writes — it would silently drop the payload.
|
|
142
142
|
|
|
143
|
+
### Nesting depth: one level over HTTP CRUD
|
|
144
|
+
|
|
145
|
+
The generated nested-write DTOs go **one level deep**. A nested `create` DTO contains the related model's **scalar fields only** (plus its `connect`) — it does **not** expose that model's *own* relations. This is deliberate: it keeps the generated DTOs free of circular references.
|
|
146
|
+
|
|
147
|
+
Consequence for CRUD requests:
|
|
148
|
+
|
|
149
|
+
- **One level works:** `project.create` with `tasks: { create: [...] }` or `tags: { connect: [...] }`. ✅
|
|
150
|
+
- **Two+ levels are rejected with `400`:** e.g. `project.create` → `tasks: { create: [{ title, comments: { create: [...] } }] }`. The inner `comments` key is not on the (scalar-only) task nested-create DTO, so `forbidNonWhitelisted` rejects it. This fails **loud**, never silently.
|
|
151
|
+
|
|
152
|
+
Note the two layers behave differently on purpose:
|
|
153
|
+
|
|
154
|
+
- **The proxy enforcement is fully recursive** — it authorizes nested `create`/`connect` at *any* depth (each level checked against that model's `create` / `connect` rule). So deep nesting is safe wherever it can reach the proxy.
|
|
155
|
+
- **The generated DTOs cap the HTTP surface at one level.** Deep nesting simply isn't expressible through generic CRUD.
|
|
156
|
+
|
|
157
|
+
**To do multi-level nested writes, use an explicit controller/service method** that calls `prismaService.model.<x>.create(...)` with the deep payload — the proxy still enforces the `create`/`connect` allowlist recursively there. Do not try to widen the generated DTOs to accept deeper nesting.
|
|
158
|
+
|
|
143
159
|
---
|
|
144
160
|
|
|
145
161
|
## After changing the schema
|
package/docs/limitations.md
CHANGED
|
@@ -38,6 +38,10 @@ Let the generated resolvers serve the data (they go through `PrismaService`); a
|
|
|
38
38
|
|
|
39
39
|
You can `select: { _count: ... }`, but ABAC conditions are **not** applied inside a `_count` sub-selection. Don't rely on `_count` to reflect only rows the caller may see.
|
|
40
40
|
|
|
41
|
+
### Nested writes over HTTP CRUD are one level deep
|
|
42
|
+
|
|
43
|
+
Generated CRUD accepts nested `create`/`connect` **one level deep only** — a `project.create` may nest tasks/tags, but not a task that itself nests comments (the second level `400`s under `forbidNonWhitelisted`). The proxy's authorization is recursive; the *DTO* surface is the cap, kept one level to avoid circular DTOs. For multi-level nested writes use an explicit endpoint that calls `prismaService.model.*.create(...)`. See [dtos.md](./dtos.md#nesting-depth-one-level-over-http-crud).
|
|
44
|
+
|
|
41
45
|
---
|
|
42
46
|
|
|
43
47
|
## Sharp edges to know about
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appxdigital/appx-core",
|
|
3
|
-
"version": "0.1.121-beta.
|
|
3
|
+
"version": "0.1.121-beta.11",
|
|
4
4
|
"description": "Appx Core is a library that provides a set of tools to help you build your application faster.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|