@objectstack/plugin-approvals 15.1.1 → 16.0.0-rc.0

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @objectstack/plugin-approvals@15.1.1 build /home/runner/work/framework/framework/packages/plugins/plugin-approvals
2
+ > @objectstack/plugin-approvals@16.0.0-rc.0 build /home/runner/work/framework/framework/packages/plugins/plugin-approvals
3
3
  > tsup --config ../../../tsup.config.ts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -10,13 +10,13 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/index.js 123.99 KB
14
- CJS dist/index.js.map 220.47 KB
15
- CJS ⚡️ Build success in 211ms
16
- ESM dist/index.mjs 122.33 KB
17
- ESM dist/index.mjs.map 219.27 KB
18
- ESM ⚡️ Build success in 257ms
13
+ CJS dist/index.js 157.00 KB
14
+ CJS dist/index.js.map 274.68 KB
15
+ CJS ⚡️ Build success in 322ms
16
+ ESM dist/index.mjs 155.17 KB
17
+ ESM dist/index.mjs.map 273.43 KB
18
+ ESM ⚡️ Build success in 327ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 32099ms
21
- DTS dist/index.d.mts 397.05 KB
22
- DTS dist/index.d.ts 397.05 KB
20
+ DTS ⚡️ Build success in 26515ms
21
+ DTS dist/index.d.mts 417.29 KB
22
+ DTS dist/index.d.ts 417.29 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,110 @@
1
1
  # @objectstack/plugin-approvals
2
2
 
3
+ ## 16.0.0-rc.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3a18b60: feat(approvals): rename the `role` approver type to `org_membership_level` (#3133)
8
+
9
+ `ApproverType.role` was the last platform surface projecting the reserved word
10
+ "role" (ADR-0090 D3). It is not covered by D3's better-auth exception: that
11
+ exception protects better-auth's own `sys_member.role` **column**, which we do
12
+ not own — `ApproverType` is our own enum, an authoring surface, and D3 mandates
13
+ that the projection of that concept is spelled `org_membership_level` and
14
+ labelled "organization membership", **never "role"**.
15
+
16
+ The sentence licensing the leak was also false: ADR-0090 D3 claims
17
+ `sys_member.role` is "already relabelled `org_membership_level` in the platform
18
+ projection", but `org_membership_level` existed nowhere in the codebase and
19
+ ADR-0057 D7 lists that relabel under "Deferred (evidence-gated, P4)". The
20
+ projection never landed, so the word reached authors.
21
+
22
+ The name manufactured a real, silent failure — "hotcrm class": every other
23
+ surface renamed to `position` (`sys_role`, `ShareRecipientType.role`,
24
+ `ctx.roles[]`), so `{ type: 'role', value: 'sales_manager' }` reads as the
25
+ legacy spelling of a position. It resolves against the membership tier, finds
26
+ no member row, falls back to an inert `role:sales_manager` literal, and the
27
+ request waits forever on an approver that cannot exist.
28
+
29
+ - **spec**: `ApproverType` gains `org_membership_level`; `role` stays as a
30
+ deprecated alias for one window (a published 15.x flow keeps loading) with
31
+ `DEPRECATED_APPROVER_TYPES` + `canonicalApproverType()` as the single source
32
+ for the mapping. Removed in the next major.
33
+ - **plugin-approvals**: resolves on the canonical type and warns on the
34
+ deprecated spelling. The `type:value` fallback literal keeps the **authored**
35
+ spelling — stored `sys_approval_approver` rows and `pending_approvers` slots
36
+ from 15.x carry `role:<v>`, and rewriting it would orphan them.
37
+ - **lint**: `approval-role-not-membership-tier` → `approval-approver-not-membership-tier`
38
+ (the rule id carried the reserved word too), plus a new
39
+ `approval-approver-type-deprecated`. The two are mutually exclusive: a bad
40
+ _value_ wins, because prescribing `org_membership_level` for a position name
41
+ would be wrong advice — the fix there is `position`.
42
+
43
+ Authoring `type: 'role'` keeps working and now says so out loud. Rewrite it as
44
+ `org_membership_level`; if the value is an org position, the fix is `position`.
45
+
46
+ ### Patch Changes
47
+
48
+ - 22013aa: **Split the overloaded `managedBy: 'system'` bucket into engine-owned vs. admin-writable, and enforce engine-owned writes (ADR-0103, #3220).** The `system` bucket conflated two incompatible write policies: rows a platform service owns end to end (never user-written), and platform-defined schema whose rows are legitimately admin/user-writable. It carried the same all-false affordance row as `better-auth`/`append-only` but, unlike `better-auth`, had no engine enforcement — a wildcard admin could raw-write these rows through the generic data API (ADR-0049 gap).
49
+
50
+ Rather than add a new `managedBy` enum value (which would fall through to fully-editable `platform` defaults on already-deployed Console clients), the write policy is now the **resolved affordance** (`resolveCrudAffordances` = bucket default + `userActions`), and _engine-owned_ is defined as a `system`/`append-only` object that grants no write:
51
+
52
+ - **Writable set declares `userActions`** — the RBAC link tables (`sys_user_position`, `sys_user_permission_set`, `sys_position_permission_set`), `sys_user_preference`, `sys_approval_delegation`, and the messaging config grids (`sys_notification_preference` / `…_subscription` / `…_template`) now declare `userActions: { create, edit, delete: true }`. The affordance is a declaration only — the `DelegatedAdminGate` / RLS / permission sets remain the authz.
53
+ - **Engine-owned objects locked to reads** — `apiMethods: ['get','list']` added where absent (jobs, notifications, approval request/approver/token/action, `sys_record_share`, `sys_automation_run`, mail/settings/secret audit, the messaging delivery pipeline). `sys_secret` is explicitly read-locked (an empty `apiMethods` array fails open).
54
+ - **`sys_import_job`** stays engine-owned: the REST import route now writes its job rows `isSystem`-elevated (attribution preserved via the explicit `created_by` stamp) and the object is locked to `['get','list']`.
55
+ - **New engine write guard** (`assertEngineOwnedWriteAllowed`, plugin-security) fail-closed rejects user-context generic writes to engine-owned `system`/`append-only` objects, keyed off the resolved affordance; `isSystem` and context-less engine/service writes bypass by construction. Wired into the security middleware alongside the other data-layer gates.
56
+ - **`reconcileManagedApiMethods`** (objectql registry) now runs for **every** managed bucket, not just `better-auth`: any advertised write verb an object's resolved affordances forbid is stripped at registration with a warning (the drift backstop, ADR-0049).
57
+ - **`/me/permissions` clamp** (plugin-hono-server) now clamps `system`/`append-only` as well as `better-auth`, so the client hint reflects `permission ∩ guard`.
58
+
59
+ **Potentially breaking:** a downstream/third-party `system` object that advertised generic write verbs relying on today's fail-open behaviour will have those verbs stripped (with a warning) and user-context generic writes to it rejected. Declare `userActions` opening the verbs the object legitimately takes from a user context. `better-auth` keeps plugin-auth's identity write guard unchanged; the row-level `managed_by` provenance vocabulary (ADR-0066) is a different axis and is untouched.
60
+
61
+ - Updated dependencies [f972574]
62
+ - Updated dependencies [22013aa]
63
+ - Updated dependencies [3ad3dd5]
64
+ - Updated dependencies [3a18b60]
65
+ - Updated dependencies [a8aa34c]
66
+ - Updated dependencies [e057f42]
67
+ - Updated dependencies [a3823b2]
68
+ - Updated dependencies [bc65105]
69
+ - Updated dependencies [43a3efb]
70
+ - Updated dependencies [524696a]
71
+ - Updated dependencies [6b51346]
72
+ - Updated dependencies [80273c8]
73
+ - Updated dependencies [5e3301d]
74
+ - Updated dependencies [dd9f223]
75
+ - Updated dependencies [46e876c]
76
+ - Updated dependencies [5f05de2]
77
+ - Updated dependencies [021ba4c]
78
+ - Updated dependencies [158aa14]
79
+ - Updated dependencies [d2723e2]
80
+ - Updated dependencies [fefcd54]
81
+ - Updated dependencies [beaf2de]
82
+ - Updated dependencies [06cb319]
83
+ - Updated dependencies [369eb6e]
84
+ - Updated dependencies [b659111]
85
+ - Updated dependencies [5754a23]
86
+ - Updated dependencies [6c270a6]
87
+ - Updated dependencies [290e2f0]
88
+ - Updated dependencies [668dd17]
89
+ - Updated dependencies [8abf133]
90
+ - Updated dependencies [e0859b1]
91
+ - Updated dependencies [04ecd4e]
92
+ - Updated dependencies [4d5a892]
93
+ - Updated dependencies [16cebeb]
94
+ - Updated dependencies [86d30af]
95
+ - Updated dependencies [8923843]
96
+ - Updated dependencies [ea32ec7]
97
+ - Updated dependencies [a2795f6]
98
+ - Updated dependencies [f16b492]
99
+ - Updated dependencies [4b6fde8]
100
+ - Updated dependencies [2018df9]
101
+ - Updated dependencies [fc5a3a2]
102
+ - @objectstack/spec@16.0.0-rc.0
103
+ - @objectstack/platform-objects@16.0.0-rc.0
104
+ - @objectstack/core@16.0.0-rc.0
105
+ - @objectstack/formula@16.0.0-rc.0
106
+ - @objectstack/metadata-core@16.0.0-rc.0
107
+
3
108
  ## 15.1.1
4
109
 
5
110
  ### Patch Changes