@jini-ai/cms 0.3.11 → 0.4.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.
Files changed (262) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +47 -19
  3. package/dist/content-types/agent-tools.d.ts +3 -56
  4. package/dist/content-types/agent-tools.js +22 -6
  5. package/dist/content-types/cleanup.d.ts +18 -13
  6. package/dist/content-types/cleanup.js +16 -11
  7. package/dist/content-types/errors.d.ts +57 -24
  8. package/dist/content-types/errors.js +56 -39
  9. package/dist/content-types/field-defs.d.ts +8 -4
  10. package/dist/content-types/field-defs.js +19 -14
  11. package/dist/content-types/index-provisioning.d.ts +61 -47
  12. package/dist/content-types/index-provisioning.js +90 -66
  13. package/dist/content-types/index.d.ts +4 -3
  14. package/dist/content-types/lifecycle-dispatch.d.ts +11 -5
  15. package/dist/content-types/lifecycle-dispatch.js +5 -4
  16. package/dist/content-types/lifecycle.d.ts +23 -18
  17. package/dist/content-types/lifecycle.js +71 -64
  18. package/dist/content-types/repo.memory.d.ts +5 -4
  19. package/dist/content-types/repo.memory.js +3 -2
  20. package/dist/content-types/tool-registrations.d.ts +6 -8
  21. package/dist/content-types/tool-registrations.js +24 -28
  22. package/dist/content-types/types.d.ts +17 -13
  23. package/dist/content-types/types.js +11 -5
  24. package/dist/content-types/write-service.d.ts +20 -22
  25. package/dist/content-types/write-service.js +78 -75
  26. package/dist/core/authorization.d.ts +15 -0
  27. package/dist/core/authorization.js +2 -0
  28. package/dist/core/commands/change-set.d.ts +15 -7
  29. package/dist/core/commands/command.d.ts +45 -26
  30. package/dist/core/commands/command.js +73 -63
  31. package/dist/core/entity-liveness.d.ts +11 -7
  32. package/dist/core/entity-liveness.js +5 -4
  33. package/dist/core/index.d.ts +12 -5
  34. package/dist/core/index.js +10 -4
  35. package/dist/core/ports.d.ts +25 -24
  36. package/dist/core/ports.js +1 -0
  37. package/dist/core/tools/args.d.ts +49 -0
  38. package/dist/core/tools/args.js +46 -0
  39. package/dist/core/tools/index.d.ts +3 -0
  40. package/dist/core/tools/index.js +3 -0
  41. package/dist/entries/agent-tools.d.ts +1 -73
  42. package/dist/entries/agent-tools.js +19 -13
  43. package/dist/entries/errors.d.ts +28 -14
  44. package/dist/entries/errors.js +17 -11
  45. package/dist/entries/field-validation.d.ts +5 -3
  46. package/dist/entries/field-validation.js +7 -5
  47. package/dist/entries/index.d.ts +2 -2
  48. package/dist/entries/lifecycle-dispatch.d.ts +5 -2
  49. package/dist/entries/lifecycle-dispatch.js +2 -1
  50. package/dist/entries/list.d.ts +4 -2
  51. package/dist/entries/list.js +4 -3
  52. package/dist/entries/repo.memory.d.ts +12 -10
  53. package/dist/entries/repo.memory.js +11 -10
  54. package/dist/entries/tool-registrations.d.ts +6 -8
  55. package/dist/entries/tool-registrations.js +42 -41
  56. package/dist/entries/types.d.ts +0 -7
  57. package/dist/entries/write-service.d.ts +28 -29
  58. package/dist/entries/write-service.js +114 -105
  59. package/dist/http/settings/cms-adapter.d.ts +20 -0
  60. package/dist/http/settings/cms-adapter.js +124 -0
  61. package/dist/http/settings/contracts.d.ts +135 -0
  62. package/dist/http/settings/contracts.js +2 -0
  63. package/dist/http/settings/http.d.ts +10 -0
  64. package/dist/http/settings/http.js +211 -0
  65. package/dist/http/settings/index.d.ts +5 -0
  66. package/dist/http/settings/index.js +4 -0
  67. package/dist/http/settings/shared.d.ts +68 -0
  68. package/dist/http/settings/shared.js +54 -0
  69. package/dist/http/settings/stream.d.ts +24 -0
  70. package/dist/http/settings/stream.js +147 -0
  71. package/dist/media/agent-tools.d.ts +1 -66
  72. package/dist/media/agent-tools.js +5 -1
  73. package/dist/media/blob-gc-lock.d.ts +6 -2
  74. package/dist/media/blob-gc-lock.js +4 -2
  75. package/dist/media/blob-gc.d.ts +64 -51
  76. package/dist/media/blob-gc.js +62 -52
  77. package/dist/media/blob-key.d.ts +1 -1
  78. package/dist/media/content-type-sniffer.d.ts +3 -1
  79. package/dist/media/content-type-sniffer.js +1 -1
  80. package/dist/media/html-attributes.d.ts +9 -5
  81. package/dist/media/html-attributes.js +8 -6
  82. package/dist/media/image-transformer.js +1 -1
  83. package/dist/media/image-transformer.sharp.d.ts +6 -0
  84. package/dist/media/image-transformer.sharp.js +12 -6
  85. package/dist/media/import/fetch-image.d.ts +24 -0
  86. package/dist/media/import/fetch-image.js +137 -0
  87. package/dist/media/import/index.d.ts +3 -0
  88. package/dist/media/import/index.js +3 -0
  89. package/dist/media/import/ports.d.ts +38 -0
  90. package/dist/media/index.d.ts +7 -1
  91. package/dist/media/index.js +1 -0
  92. package/dist/media/media-service.d.ts +14 -10
  93. package/dist/media/media-service.js +57 -52
  94. package/dist/media/ports.d.ts +3 -2
  95. package/dist/media/rendition-service.d.ts +3 -3
  96. package/dist/media/rendition-service.js +38 -37
  97. package/dist/media/repo.memory.d.ts +18 -7
  98. package/dist/media/repo.memory.js +12 -6
  99. package/dist/media/tool-registrations.d.ts +16 -15
  100. package/dist/media/tool-registrations.js +84 -72
  101. package/dist/media/transform-lock.d.ts +22 -12
  102. package/dist/media/transform-lock.js +14 -13
  103. package/dist/media/transform-registry.d.ts +3 -3
  104. package/dist/media/transform-registry.js +19 -18
  105. package/dist/media/transform-types.d.ts +8 -3
  106. package/dist/media/transform-types.js +10 -5
  107. package/dist/media/types.d.ts +21 -4
  108. package/dist/media/types.js +15 -2
  109. package/dist/navigation/agent-tools.d.ts +1 -80
  110. package/dist/navigation/agent-tools.js +15 -3
  111. package/dist/navigation/contracts.d.ts +1 -1
  112. package/dist/navigation/index.d.ts +2 -2
  113. package/dist/navigation/menu-service.d.ts +57 -40
  114. package/dist/navigation/menu-service.js +80 -69
  115. package/dist/navigation/ports.d.ts +1 -1
  116. package/dist/navigation/read-model.d.ts +3 -1
  117. package/dist/navigation/read-model.js +2 -2
  118. package/dist/navigation/reconcile.d.ts +2 -2
  119. package/dist/navigation/reconcile.js +2 -1
  120. package/dist/navigation/repo.memory.d.ts +7 -3
  121. package/dist/navigation/repo.memory.js +4 -2
  122. package/dist/navigation/resolver.d.ts +4 -1
  123. package/dist/navigation/resolver.js +1 -1
  124. package/dist/navigation/tool-registrations.d.ts +6 -8
  125. package/dist/navigation/tool-registrations.js +44 -42
  126. package/dist/navigation/types.d.ts +1 -1
  127. package/dist/presentation/presentation.d.ts +11 -3
  128. package/dist/presentation/presentation.js +13 -6
  129. package/dist/presentation/repo.memory.d.ts +6 -2
  130. package/dist/presentation/repo.memory.js +3 -2
  131. package/dist/settings/agent-tools.d.ts +2 -75
  132. package/dist/settings/agent-tools.js +49 -45
  133. package/dist/settings/agent-value-write-tools.d.ts +22 -0
  134. package/dist/settings/agent-value-write-tools.js +154 -0
  135. package/dist/settings/agent-writable-preferences.js +8 -20
  136. package/dist/settings/agent-write-denylist.d.ts +19 -0
  137. package/dist/settings/agent-write-denylist.js +15 -0
  138. package/dist/settings/change-feed.d.ts +11 -2
  139. package/dist/settings/change-feed.js +4 -4
  140. package/dist/settings/definitions-dispatch.d.ts +8 -3
  141. package/dist/settings/definitions-dispatch.js +5 -5
  142. package/dist/settings/dictionaries/index.d.ts +5 -2
  143. package/dist/settings/dictionaries/index.js +2 -2
  144. package/dist/settings/dictionaries/settings-dialog.ar.js +0 -1
  145. package/dist/settings/dictionaries/settings-dialog.bn.js +0 -1
  146. package/dist/settings/dictionaries/settings-dialog.de.js +0 -1
  147. package/dist/settings/dictionaries/settings-dialog.es.js +0 -1
  148. package/dist/settings/dictionaries/settings-dialog.fa.js +0 -1
  149. package/dist/settings/dictionaries/settings-dialog.fr.js +0 -1
  150. package/dist/settings/dictionaries/settings-dialog.hi.js +0 -1
  151. package/dist/settings/dictionaries/settings-dialog.hu.js +0 -1
  152. package/dist/settings/dictionaries/settings-dialog.id.js +0 -1
  153. package/dist/settings/dictionaries/settings-dialog.it.js +0 -1
  154. package/dist/settings/dictionaries/settings-dialog.ja.js +0 -1
  155. package/dist/settings/dictionaries/settings-dialog.ko.js +0 -1
  156. package/dist/settings/dictionaries/settings-dialog.pl.js +0 -1
  157. package/dist/settings/dictionaries/settings-dialog.pt-BR.js +0 -1
  158. package/dist/settings/dictionaries/settings-dialog.ru.js +0 -1
  159. package/dist/settings/dictionaries/settings-dialog.th.js +0 -1
  160. package/dist/settings/dictionaries/settings-dialog.tr.js +0 -1
  161. package/dist/settings/dictionaries/settings-dialog.uk.js +0 -1
  162. package/dist/settings/dictionaries/settings-dialog.ur.js +0 -1
  163. package/dist/settings/dictionaries/settings-dialog.zh-CN.js +0 -1
  164. package/dist/settings/dictionaries/settings-dialog.zh-TW.js +0 -1
  165. package/dist/settings/ensure-definitions.d.ts +5 -5
  166. package/dist/settings/errors.d.ts +7 -1
  167. package/dist/settings/errors.js +7 -1
  168. package/dist/settings/index.d.ts +4 -1
  169. package/dist/settings/index.js +1 -0
  170. package/dist/settings/ports.d.ts +6 -5
  171. package/dist/settings/principal-lookup.d.ts +9 -0
  172. package/dist/settings/principal-lookup.js +2 -0
  173. package/dist/settings/purge-service.d.ts +5 -4
  174. package/dist/settings/purge-service.js +3 -2
  175. package/dist/settings/settings.d.ts +22 -7
  176. package/dist/settings/settings.js +47 -26
  177. package/dist/settings/tool-registrations.d.ts +27 -32
  178. package/dist/settings/tool-registrations.js +66 -56
  179. package/dist/settings/types.d.ts +1 -1
  180. package/dist/settings/ui-tab-definitions.d.ts +1 -1
  181. package/dist/settings/write-service.d.ts +32 -26
  182. package/dist/settings/write-service.js +26 -20
  183. package/dist/taxonomy/agent-tools.d.ts +1 -66
  184. package/dist/taxonomy/agent-tools.js +25 -15
  185. package/dist/taxonomy/content-lookup.js +1 -1
  186. package/dist/taxonomy/index.d.ts +2 -2
  187. package/dist/taxonomy/merge-term.d.ts +7 -4
  188. package/dist/taxonomy/merge-term.js +7 -5
  189. package/dist/taxonomy/repo.memory.d.ts +42 -19
  190. package/dist/taxonomy/repo.memory.js +14 -12
  191. package/dist/taxonomy/validation-chain.d.ts +39 -18
  192. package/dist/taxonomy/validation-chain.js +35 -25
  193. package/dist/taxonomy/write-service.d.ts +103 -44
  194. package/dist/taxonomy/write-service.js +221 -179
  195. package/dist/trash/adapters/record-store.d.ts +52 -0
  196. package/dist/trash/adapters/record-store.js +36 -0
  197. package/dist/trash/cursor.d.ts +20 -0
  198. package/dist/trash/cursor.js +36 -0
  199. package/dist/trash/follow-ups.d.ts +76 -0
  200. package/dist/trash/follow-ups.js +46 -0
  201. package/dist/trash/index.d.ts +8 -0
  202. package/dist/trash/index.js +8 -0
  203. package/dist/trash/ports.d.ts +308 -0
  204. package/dist/trash/ports.js +2 -0
  205. package/dist/trash/repo.memory.d.ts +50 -0
  206. package/dist/trash/repo.memory.js +114 -0
  207. package/dist/trash/sweeper.d.ts +77 -0
  208. package/dist/trash/sweeper.js +127 -0
  209. package/dist/trash/write-service.d.ts +100 -0
  210. package/dist/trash/write-service.js +242 -0
  211. package/dist/workspace/agent-tools.d.ts +1 -59
  212. package/dist/workspace/agent-tools.js +27 -12
  213. package/dist/workspace/create.d.ts +31 -6
  214. package/dist/workspace/create.js +18 -5
  215. package/dist/workspace/delete.d.ts +18 -13
  216. package/dist/workspace/delete.js +20 -12
  217. package/dist/workspace/index.d.ts +1 -1
  218. package/dist/workspace/repo.memory.d.ts +19 -4
  219. package/dist/workspace/repo.memory.js +26 -4
  220. package/dist/workspace/tool-registrations.d.ts +2 -2
  221. package/dist/workspace/tool-registrations.js +13 -13
  222. package/dist/workspace/update.d.ts +6 -5
  223. package/dist/workspace/update.js +9 -8
  224. package/package.json +44 -38
  225. package/dist/core/tools/registration-kit.d.ts +0 -346
  226. package/dist/core/tools/registration-kit.js +0 -426
  227. package/dist/identity/admin-crud-service.d.ts +0 -280
  228. package/dist/identity/admin-crud-service.js +0 -468
  229. package/dist/identity/agent-tool-input.d.ts +0 -58
  230. package/dist/identity/agent-tool-input.js +0 -126
  231. package/dist/identity/agent-tools.d.ts +0 -101
  232. package/dist/identity/agent-tools.js +0 -290
  233. package/dist/identity/auth-service.d.ts +0 -118
  234. package/dist/identity/auth-service.js +0 -170
  235. package/dist/identity/authorize.d.ts +0 -90
  236. package/dist/identity/authorize.js +0 -94
  237. package/dist/identity/grant-service.d.ts +0 -198
  238. package/dist/identity/grant-service.js +0 -361
  239. package/dist/identity/hasher.d.ts +0 -39
  240. package/dist/identity/hasher.js +0 -39
  241. package/dist/identity/index.d.ts +0 -62
  242. package/dist/identity/index.js +0 -54
  243. package/dist/identity/password-policy.d.ts +0 -57
  244. package/dist/identity/password-policy.js +0 -66
  245. package/dist/identity/permission-migrations.d.ts +0 -86
  246. package/dist/identity/permission-migrations.js +0 -67
  247. package/dist/identity/permissions.d.ts +0 -35
  248. package/dist/identity/permissions.js +0 -603
  249. package/dist/identity/ports.d.ts +0 -201
  250. package/dist/identity/repo.memory.d.ts +0 -164
  251. package/dist/identity/repo.memory.js +0 -224
  252. package/dist/identity/seed.d.ts +0 -54
  253. package/dist/identity/seed.js +0 -429
  254. package/dist/identity/tool-registrations.d.ts +0 -50
  255. package/dist/identity/tool-registrations.js +0 -419
  256. package/dist/identity/types.d.ts +0 -185
  257. package/dist/identity/types.js +0 -64
  258. package/dist/identity/username.d.ts +0 -12
  259. package/dist/identity/username.js +0 -14
  260. package/dist/server/index.d.ts +0 -28
  261. package/dist/server/index.js +0 -28
  262. /package/dist/{identity → media/import}/ports.js +0 -0
@@ -1,280 +0,0 @@
1
- import type { UUID } from "../core/ports.js";
2
- import type { AuthServiceDeps } from "./auth-service.js";
3
- import { type PolicyPermissionRecord, type PolicyRecord, type PrincipalRecord, type RoleRecord, type UserRecord } from "./types.js";
4
- /**
5
- * @file An amendment that completes the users/roles/policies admin CRUD surface
6
- * (feature.spec.md REQ-11/REQ-15..19).
7
- *
8
- * Purpose:
9
- * Two of these nine transitions (`disablePrincipal`, `writePolicyPermission`) were fully specified
10
- * since v0.5.0/v0.5.3 but never implemented — this file is their first implementation, not a
11
- * re-specification (AC-32). The other seven (`enablePrincipal`, `updateUser`,
12
- * `resetUserPassword`, `updateRole`, `updatePolicy`, `deleteRole`, `deletePolicy`) are new
13
- * transitions this amendment adds. Grouped in one file, separate from `grant-service.ts`'s
14
- * "human grant-writing transitions" (`CREATE_*`/`ASSIGN_ROLE`/`ATTACH_POLICY`) because most of
15
- * these are plain CRUD, not grant-writing — `writePolicyPermission` is the one exception (it IS
16
- * INV-07-clamped) and reuses `grant-service.ts`'s exported `assertGrantClamp` rather than
17
- * duplicating it.
18
- *
19
- * Architectural role:
20
- * Ordinary core functions — same shape as `grant-service.ts`: one exported async
21
- * function per transition, plain `Error` subclasses for control flow, the caller-permission gate
22
- * enforced here (not pushed to the route layer).
23
- */
24
- /**
25
- * `DISABLE_PRINCIPAL` (feature.spec.md REQ-11, state.spec §3, AC-08/AC-21/AC-27). Gated by
26
- * `user.manage`. Refuses the seeded owner unconditionally (REQ-13's CLI/core resolution target —
27
- * disabling it would strand the CLI-only management plane) and refuses any disable that would drop
28
- * the workspace's active owner-`*` count to zero (INV-08) — both checked, and the status update
29
- * performed, inside this one function body with no `await` yielded to another caller in between
30
- * (this codebase's established "atomic by construction" reasoning for a single-connection,
31
- * single-event-loop composition — same as `features/workspace/delete.ts`'s INV-03 guard).
32
- *
33
- * `input.seededOwnerPrincipalId` is the caller's job to resolve (`await deps.ownerPrincipalId` at
34
- * the route layer, mirroring `identityReady`'s existing await-before-use convention) — this
35
- * function takes the already-resolved id so it stays a plain, directly-testable function.
36
- *
37
- * @complexity O(n) in the workspace's principal count (one `list()` call to count active owner-`*`
38
- * holders) — bounded by the same operator-managed-roster assumption `identity/INFO.md` already
39
- * makes for `PrincipalRepoPort.list()`.
40
- * @overallScore 100
41
- */
42
- export declare function disablePrincipal(required: {
43
- deps: AuthServiceDeps;
44
- input: {
45
- workspaceId: UUID;
46
- callerPrincipalId: UUID;
47
- principalId: UUID;
48
- seededOwnerPrincipalId: UUID;
49
- };
50
- }): Promise<{
51
- principal: PrincipalRecord;
52
- }>;
53
- /**
54
- * `ENABLE_PRINCIPAL` (feature.spec.md REQ-15, AC-27, EC-14). Gated by `user.manage`. Target must be
55
- * `kind='user'` — a `system`/`api_key` target is rejected `VALIDATION_ERROR` (mirrors AC-25b's
56
- * human-only scoping; re-activating the disabled legacy `user-local` stub or an api_key principal
57
- * outside `ISSUE_API_KEY`'s own lifecycle is never a valid call). Already-active is idempotent
58
- * (mirrors `disablePrincipal`'s own already-disabled no-op above).
59
- *
60
- * @complexity O(1) — one lookup, one save.
61
- * @overallScore 100
62
- */
63
- export declare function enablePrincipal(required: {
64
- deps: AuthServiceDeps;
65
- input: {
66
- workspaceId: UUID;
67
- callerPrincipalId: UUID;
68
- principalId: UUID;
69
- };
70
- }): Promise<{
71
- principal: PrincipalRecord;
72
- }>;
73
- /**
74
- * `UPDATE_USER` (feature.spec.md REQ-16, AC-28). Gated by `user.manage` **or** `member.manage`
75
- * (mirrors `CREATE_USER`'s admin-onboarding gate) — `email` only; `username`/`password` are not
76
- * this transition's concern (OQ-09 / REQ-17 respectively). An absent or empty-string `email`
77
- * clears the stored value to `undefined` (EC-17 — no distinct "blank but present" state).
78
- *
79
- * @complexity O(1) — one lookup, one save.
80
- * @overallScore 100
81
- */
82
- export declare function updateUser(required: {
83
- deps: AuthServiceDeps;
84
- input: {
85
- workspaceId: UUID;
86
- callerPrincipalId: UUID;
87
- principalId: UUID;
88
- email?: string | undefined;
89
- };
90
- }): Promise<{
91
- user: UserRecord;
92
- }>;
93
- /**
94
- * `RESET_USER_PASSWORD` (feature.spec.md REQ-17, AC-29, EC-16). Gated by **`user.manage`** only
95
- * (stricter than `updateUser` — resetting a credential is at least as sensitive as disabling the
96
- * account, REQ-17's own reasoning). Hashes the new password identically to `CREATE_USER` (argon2id,
97
- * INV-05), then revokes every one of the target's active sessions (idempotent no-op if it has none,
98
- * EC-16) — a reset that left old sessions alive would not actually contain a compromised account.
99
- *
100
- * Refuses a THIRD PARTY resetting the seeded owner's password (REQ-11/REQ-13's reasoning, same
101
- * `OwnerRequiredError` `disablePrincipal` uses): `user.manage` is independently grantable and not
102
- * owner-exclusive (`permissions.ts` — "Create/disable operator users and principals"), so without
103
- * this check a caller holding only that one delegated permission could set a password of their own
104
- * choosing on the seeded owner's account and log in as owner — a full takeover from a routine
105
- * delegation. Checked before the password-policy validation so the refusal doesn't depend on the
106
- * caller supplying a well-formed password first.
107
- *
108
- * Deliberately NOT unconditional the way `disablePrincipal`'s owner check is: the owner resetting
109
- * ITS OWN password (`callerPrincipalId === principalId === seededOwnerPrincipalId`) is refused
110
- * nothing — that self-service path is real, shipped infrastructure
111
- * (`reset-admin-password-self-verified.ts`, driven by both the `TOVU_ADMIN_RESET_PASSWORD`
112
- * boot-time incident-recovery hook and the `backfill-reset-admin-password.ts` CLI script), added
113
- * specifically to let an operator recover a locked-out owner account out-of-band. Disabling has no
114
- * legitimate self-case (an owner disabling itself only ever stands the workspace down), so
115
- * `disablePrincipal` can refuse unconditionally; a credential rotation the owner performs on itself
116
- * is ordinary hygiene and the documented recovery path, so only a MISMATCHED caller — the actual
117
- * escalation shape — is refused here.
118
- *
119
- * Deliberately NOT INV-08-clamped (unlike `disablePrincipal`'s second guard): a reset changes a
120
- * credential, it never changes `status`, so it can never drop the workspace's active owner-`*`
121
- * count — INV-08's headcount guard has nothing to protect here.
122
- *
123
- * `input.seededOwnerPrincipalId` is the caller's job to resolve (`await deps.ownerPrincipalId` at
124
- * the route layer, mirroring `disablePrincipal`'s own contract above) — this function takes the
125
- * already-resolved id so it stays a plain, directly-testable function.
126
- *
127
- * @complexity O(s) in the target's session count, s = active session rows to revoke — bounded by
128
- * the same operator-managed-roster scale assumption every other identity list call here makes.
129
- * @overallScore 100
130
- */
131
- export declare function resetUserPassword(required: {
132
- deps: AuthServiceDeps;
133
- input: {
134
- workspaceId: UUID;
135
- callerPrincipalId: UUID;
136
- principalId: UUID;
137
- password: string;
138
- seededOwnerPrincipalId: UUID;
139
- };
140
- }): Promise<{
141
- user: UserRecord;
142
- }>;
143
- /**
144
- * `UPDATE_ROLE` (feature.spec.md REQ-18, AC-30). Gated by `role.manage`. A built-in target is
145
- * refused `VALIDATION_ERROR` — extends INV-06's existing undeletable/immutable/un-attachable-to
146
- * rule to also cover un-renameable (same escalation shape: relabeling `viewer` to read as trusted
147
- * is a social-engineering variant of what INV-06 already blocks structurally).
148
- *
149
- * @complexity O(1) — one lookup, one save.
150
- * @overallScore 100
151
- */
152
- export declare function updateRole(required: {
153
- deps: AuthServiceDeps;
154
- input: {
155
- workspaceId: UUID;
156
- callerPrincipalId: UUID;
157
- roleId: UUID;
158
- name: string;
159
- };
160
- }): Promise<{
161
- role: RoleRecord;
162
- }>;
163
- /**
164
- * `UPDATE_POLICY` (feature.spec.md REQ-18, AC-30). Gated by `role.manage`. A built-in or
165
- * `is_frozen` target is refused `VALIDATION_ERROR` — the frozen-policy half mirrors
166
- * `WRITE_POLICY_PERMISSION`'s existing refusal (AC-26): an issuance snapshot's identity is as
167
- * immutable as its permission set. At least one of `name`/`description` must be present.
168
- *
169
- * @complexity O(1) — one lookup, one save.
170
- * @overallScore 100
171
- */
172
- export declare function updatePolicy(required: {
173
- deps: AuthServiceDeps;
174
- input: {
175
- workspaceId: UUID;
176
- callerPrincipalId: UUID;
177
- policyId: UUID;
178
- name?: string | undefined;
179
- description?: string | undefined;
180
- };
181
- }): Promise<{
182
- policy: PolicyRecord;
183
- }>;
184
- /**
185
- * `DELETE_ROLE` (feature.spec.md REQ-19/INV-09, AC-31, EC-15). Gated by `role.manage`. A built-in
186
- * target is refused `VALIDATION_ERROR` (checked before the reference count, matching AC-31's
187
- * stated precedence). A still-referenced target (≥1 `principal_roles` row) is refused
188
- * `IdentityConflictError` (409 `RESOURCE_CONFLICT`) — the reference check and the delete happen in
189
- * this one function body with no yielded `await` in between (INV-09's atomicity, same reasoning as
190
- * `disablePrincipal`'s owner-count guard above).
191
- *
192
- * @complexity O(a) in the role's assignment count (`principalRoles.listByRoleId`) — bounded by the
193
- * same operator-managed-roster assumption every other identity list call makes.
194
- * @overallScore 100
195
- */
196
- export declare function deleteRole(required: {
197
- deps: AuthServiceDeps;
198
- input: {
199
- workspaceId: UUID;
200
- callerPrincipalId: UUID;
201
- roleId: UUID;
202
- };
203
- }): Promise<void>;
204
- /**
205
- * `DELETE_POLICY` (feature.spec.md REQ-19/INV-09, AC-31, EC-15). Gated by `role.manage`. A
206
- * built-in or `is_frozen` target is refused `VALIDATION_ERROR` (checked before the reference
207
- * count). A still-referenced target (≥1 `role_policies` or `principal_policies` row) is refused
208
- * `IdentityConflictError`. On success, cascades to the policy's OWN `policy_permissions` rows only
209
- * (never a different policy's) before deleting the policy row itself.
210
- *
211
- * @complexity O(r + p) — role-reference count + principal-reference count, both bounded by the same
212
- * operator-managed-roster assumption every other identity list call makes.
213
- * @overallScore 100
214
- */
215
- export declare function deletePolicy(required: {
216
- deps: AuthServiceDeps;
217
- input: {
218
- workspaceId: UUID;
219
- callerPrincipalId: UUID;
220
- policyId: UUID;
221
- };
222
- }): Promise<void>;
223
- /**
224
- * `WRITE_POLICY_PERMISSION` (feature.spec.md INV-07, state.spec §3, AC-10/AC-24/AC-26). First HTTP
225
- * implementation of a transition specified since v0.5.3 (AC-32 — this is a route, not a
226
- * re-specification). Gated by `role.manage`. Refuses an unregistered permission
227
- * (`PermissionUnknownError`, REQ-03), a built-in or `is_frozen` parent policy (INV-06/AC-26), and
228
- * (via the shared `assertGrantClamp`) a permission the caller does not itself hold unconstrained
229
- * (INV-07, `GrantExceedsIssuerError`).
230
- *
231
- * @complexity O(assertGrantClamp) — see that function's own doc (resolveEffectivePermissions +
232
- * O(1) local filtering, one permission).
233
- * @overallScore 100
234
- */
235
- export declare function writePolicyPermission(required: {
236
- deps: AuthServiceDeps;
237
- input: {
238
- workspaceId: UUID;
239
- callerPrincipalId: UUID;
240
- policyId: UUID;
241
- permission: string;
242
- resourceType?: string | null;
243
- constraintJson?: string | null;
244
- };
245
- }): Promise<{
246
- policyPermission: PolicyPermissionRecord;
247
- }>;
248
- /**
249
- * `REMOVE_POLICY_PERMISSION` (OQ-10) — the inverse of {@link writePolicyPermission}, and the
250
- * transition whose absence made a policy's permission set append-only: the only way to shrink one
251
- * was `deletePolicy` + recreate, which INV-09 blocks outright the moment anything references the
252
- * policy.
253
- *
254
- * Gated by `role.manage`, the same permission `writePolicyPermission` and `deletePolicy` require.
255
- * Deliberately NOT clamped by `assertGrantClamp` (INV-07): the clamp exists to stop a caller
256
- * conferring authority it does not itself hold, and removal confers nothing — it is a strict
257
- * de-escalation. Requiring the clamp here would mean an admin who cannot grant `content.write`
258
- * also cannot take it back, which is the wrong direction for a safety rule. This is strictly less
259
- * powerful than the already-unclamped `deletePolicy`, which drops EVERY permission row the policy
260
- * has.
261
- *
262
- * Refuses a built-in or `is_frozen` parent policy (INV-06/AC-26), checked BEFORE the row lookup so
263
- * a frozen policy reports why it is frozen rather than leaking whether the row exists. A row that
264
- * is absent — or that exists but belongs to a DIFFERENT policy — is one and the same
265
- * `IdentityNotFoundError`: membership is proven from `listByPolicyId`'s result, so a caller can
266
- * never delete across a policy boundary by guessing an id.
267
- *
268
- * @complexity O(n) in the policy's own permission-row count (one `listByPolicyId`) — bounded by the
269
- * same operator-managed-roster assumption every other identity list call makes.
270
- */
271
- export declare function removePolicyPermission(required: {
272
- deps: AuthServiceDeps;
273
- input: {
274
- workspaceId: UUID;
275
- callerPrincipalId: UUID;
276
- policyId: UUID;
277
- policyPermissionId: UUID;
278
- };
279
- }): Promise<void>;
280
- //# sourceMappingURL=admin-crud-service.d.ts.map