@uniweb/api 0.2.11 → 0.2.12
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/package.json +2 -2
- package/src/client.js +16 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "The client for a Uniweb site's own backend — session, records, entities — imported by a foundation the way it imports @uniweb/kit.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"node": ">=20.19"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@uniweb/core": "^0.24.
|
|
37
|
+
"@uniweb/core": "^0.24.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^19.0.0"
|
package/src/client.js
CHANGED
|
@@ -363,7 +363,22 @@ export class ApiClient {
|
|
|
363
363
|
* @returns {string}
|
|
364
364
|
*/
|
|
365
365
|
cacheKey(spec) {
|
|
366
|
-
|
|
366
|
+
// ⛔ core's `deriveCacheKey` hashes a FIXED field set, and that set has
|
|
367
|
+
// drifted twice under this call: `schema` was renamed to `as` (2026-09-02),
|
|
368
|
+
// and `endpoint` was dropped by core 0.24 — so spreading the spec meant the
|
|
369
|
+
// qualifiers (`schema`, `scope`, `limit`, `offset`, `all`, `via`) fell out
|
|
370
|
+
// of the hash and every list a viewer read collided on `/entities`; under a
|
|
371
|
+
// 0.24 core EVERY key of this package degenerated to '{}'.
|
|
372
|
+
// ⇒ Compose the WHOLE identity into `url` — hashed by every core version —
|
|
373
|
+
// so this package's keys cannot drift with core's field selection again.
|
|
374
|
+
// Keys change once; the store is in-memory and repopulates.
|
|
375
|
+
const { endpoint = '', ...qualifiers } = spec ?? {}
|
|
376
|
+
const suffix = Object.keys(qualifiers)
|
|
377
|
+
.filter((k) => qualifiers[k] !== undefined)
|
|
378
|
+
.sort()
|
|
379
|
+
.map((k) => `${k}=${qualifiers[k]}`)
|
|
380
|
+
.join('&')
|
|
381
|
+
return deriveCacheKey({ url: `api:${this.viewerId}:${endpoint}${suffix ? `?${suffix}` : ''}` })
|
|
367
382
|
}
|
|
368
383
|
|
|
369
384
|
/**
|