@stonyx/orm 0.3.2-alpha.92 → 0.3.2-alpha.93
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 +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -328,6 +328,36 @@ export default class GlobalAccess {
|
|
|
328
328
|
}
|
|
329
329
|
```
|
|
330
330
|
|
|
331
|
+
### Upgrading: behaviour changes
|
|
332
|
+
|
|
333
|
+
**Advertised `links.self` / `links.related` now carry the REST mount route.**
|
|
334
|
+
Consumer-visible for any deployment where `orm.restServer.route` is not the
|
|
335
|
+
default `'/'`.
|
|
336
|
+
|
|
337
|
+
Measured on this repo's mounted-route harness at `ORM_REST_ROUTE='/api'`, resource
|
|
338
|
+
`links.self` in the response to `GET /api/animals/1`:
|
|
339
|
+
|
|
340
|
+
| | published `links.self` | fetching that URL |
|
|
341
|
+
|---|---|---|
|
|
342
|
+
| before | `http://host/animals/1` | **404** |
|
|
343
|
+
| after | `http://host/api/animals/1` | **200** |
|
|
344
|
+
|
|
345
|
+
The ORM previously built links from the request origin alone, so at any non-default
|
|
346
|
+
mount every URL it advertised pointed at a route that did not exist
|
|
347
|
+
(abofs/stonyx-orm#254). Links are now built from the path the routes are actually
|
|
348
|
+
mounted at, and are followable verbatim.
|
|
349
|
+
|
|
350
|
+
**⚠️ Breaking if you carry a prepending workaround.** The usual workaround for #254
|
|
351
|
+
was for the client to prepend the mount to every link the ORM published. That now
|
|
352
|
+
double-prefixes: prepending `/api` to the new `http://host/api/animals/1` yields
|
|
353
|
+
`http://host/api/api/animals/1`, measured **404**. Remove the prepending. There is no
|
|
354
|
+
configuration flag that restores the old link shape.
|
|
355
|
+
|
|
356
|
+
**Unaffected.** Deployments on the default `ORM_REST_ROUTE='/'` see byte-identical
|
|
357
|
+
output — the prefix is empty, and this is pinned by a byte-identity test against a
|
|
358
|
+
golden fixture captured *before* the fix. Response structure, field names and the
|
|
359
|
+
public API are unchanged; only the URL value inside `links` changes.
|
|
360
|
+
|
|
331
361
|
### Include Parameter (Sideloading Relationships)
|
|
332
362
|
|
|
333
363
|
The ORM supports JSON API-compliant relationship sideloading via the `include` query parameter. This reduces the need for multiple API requests by embedding related records in a single response.
|