@uniweb/api 1.0.1 → 1.1.1
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 +3 -3
- package/src/client.js +7 -5
- package/src/mock/index.js +5 -3
- package/src/mock/store.js +7 -5
- package/src/wire.js +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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": {
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/uniweb/api#readme",
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
34
|
+
"node": ">=22.12"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@uniweb/core": "~1.0
|
|
37
|
+
"@uniweb/core": "~1.1.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^19.0.0"
|
package/src/client.js
CHANGED
|
@@ -762,11 +762,13 @@ export class ApiClient {
|
|
|
762
762
|
* section names; the item route after it takes ids, and ids differ from one
|
|
763
763
|
* backend to the next. So a name is resolved here, from the Model's definition.
|
|
764
764
|
*
|
|
765
|
-
* ⚠️ The definition is readable by any signed-in viewer
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
*
|
|
769
|
-
* `section_id` on a read).
|
|
765
|
+
* ⚠️ The definition is readable by any signed-in viewer, whatever they may create —
|
|
766
|
+
* closing a Model gates creating its entries, never its definition (`SCHEMA` in
|
|
767
|
+
* `wire.js`). Where a backend refuses it anyway — a closed Model, from 2026-10-10
|
|
768
|
+
* until the backend's fix — this cannot resolve a name, and says so: pass the
|
|
769
|
+
* section's numeric id instead (an item's `section_id` on a read). *(This read
|
|
770
|
+
* "Models are open, so every Model is one they may create" until 2026-10-14: true
|
|
771
|
+
* from 2026-09-23, and no reason since closing arrived.)*
|
|
770
772
|
*
|
|
771
773
|
* @param {string} schema
|
|
772
774
|
* @param {string|number} section - a name, a `parent/child` path, or an id
|
package/src/mock/index.js
CHANGED
|
@@ -384,9 +384,11 @@ export function createMockBackend({ seed = DEFAULT_SEED, prefix = '/_api', signe
|
|
|
384
384
|
}
|
|
385
385
|
const model = store.model(q.get(PARAM.model))
|
|
386
386
|
if (!model) return notFound('model', q.get(PARAM.model))
|
|
387
|
-
// ⭐ No creation gate:
|
|
388
|
-
// entries of any Model.
|
|
389
|
-
//
|
|
387
|
+
// ⭐ No creation gate: the mock models no closing, so anyone signed in may create
|
|
388
|
+
// entries of any Model — as on the backend for an open one. A backend can close a
|
|
389
|
+
// Model's creation since 2026-10-10, and then a create is `403` for anyone but its
|
|
390
|
+
// owner, its `use` grantees and the holders of a role over it. Until 2026-09-23
|
|
391
|
+
// `creatable_by: unit_members` answered `403 use_model` here for a member.
|
|
390
392
|
// Any other top-level key is ignored, exactly as the backend ignores it.
|
|
391
393
|
return answer(store.create(model, items.map((i) => ({ ...i, data: i.data ?? {} }))))
|
|
392
394
|
}
|
package/src/mock/store.js
CHANGED
|
@@ -36,7 +36,8 @@ import { checkItemWrite, OUTCOME } from './schema-shape.js'
|
|
|
36
36
|
* drifts and is believed anyway.
|
|
37
37
|
*
|
|
38
38
|
* ⛔ **What it does not model**: entitlements behind `via` (a `via` read is the
|
|
39
|
-
* same read),
|
|
39
|
+
* same read), a Model whose creation is closed, nested sections, second factors,
|
|
40
|
+
* reference fields, password rules,
|
|
40
41
|
* an offer's grants (a count, sharing nothing), what joining an organization
|
|
41
42
|
* gives — accepting an invitation answers, and opens nothing to read — and an
|
|
42
43
|
* organization withdrawing an invitation.
|
|
@@ -463,10 +464,11 @@ export class MockStore {
|
|
|
463
464
|
}
|
|
464
465
|
|
|
465
466
|
/**
|
|
466
|
-
* The definition is readable by anyone signed in
|
|
467
|
-
*
|
|
468
|
-
* entry — `mayEdit`, `mayRead` —
|
|
469
|
-
*
|
|
467
|
+
* The definition is readable by anyone signed in, whatever they may create — as on the
|
|
468
|
+
* backend, where closing a Model gates creating its entries and never its definition
|
|
469
|
+
* (ruled 2026-10-14). What protects content is the entry — `mayEdit`, `mayRead` —
|
|
470
|
+
* never who may create. *(Until 2026-09-23 a Model declaring `creatable_by:
|
|
471
|
+
* unit_members` was the operator's alone, and so was its definition.)*
|
|
470
472
|
*/
|
|
471
473
|
maySeeSchema() {
|
|
472
474
|
return !!this.account
|
package/src/wire.js
CHANGED
|
@@ -545,9 +545,13 @@ export const READ = {
|
|
|
545
545
|
* fields, other_data, constraints }] }` — `kind` is `single` or `multi`;
|
|
546
546
|
* `other_data.append_only` marks an insert-only section.
|
|
547
547
|
*
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
548
|
+
* ⭐ **Readable by every signed-in account, whatever it may create** — closing a
|
|
549
|
+
* Model gates creating its entries, never reading its definition (ruled 2026-10-14;
|
|
550
|
+
* stated by the backend from its code, not yet measured here). Signed out is `401`,
|
|
551
|
+
* an unknown Model `404`. ⛔ *Until 2026-10-14 this said readable only by "the Models
|
|
552
|
+
* the viewer may create, and by the operator" — the rule before 2026-09-23, and in
|
|
553
|
+
* effect for a closed Model from 2026-10-10 until the backend's fix, where a member
|
|
554
|
+
* reads that Model's items but not their section names.*
|
|
551
555
|
*/
|
|
552
556
|
export const SCHEMA = {
|
|
553
557
|
sections: 'sections',
|