@astrale-domains/shell 0.1.6 → 0.1.7

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 (301) hide show
  1. package/README.md +73 -173
  2. package/dist/domain.d.ts +477 -31
  3. package/dist/domain.js +87 -78
  4. package/dist/functions/application/index.js +2 -1
  5. package/dist/functions/application/legacy/index.js +1 -0
  6. package/dist/functions/application/legacy/list-entrypoints.js +8 -0
  7. package/dist/functions/authority/capabilities.js +1 -0
  8. package/dist/functions/authority/composition.js +47 -0
  9. package/dist/functions/authority/index.js +2 -0
  10. package/dist/functions/authority/roles.js +98 -0
  11. package/dist/functions/directory/disconnect-directory.js +35 -0
  12. package/dist/functions/directory/index.js +1 -0
  13. package/dist/functions/group/change-group-membership.js +43 -9
  14. package/dist/functions/group/create-group.js +23 -0
  15. package/dist/functions/group/delete-group.js +33 -0
  16. package/dist/functions/group/deprovision-group.js +27 -0
  17. package/dist/functions/group/group-errors.js +43 -0
  18. package/dist/functions/group/group-membership-errors.js +2 -0
  19. package/dist/functions/group/group.js +51 -0
  20. package/dist/functions/group/index.js +8 -2
  21. package/dist/functions/group/legacy/index.js +1 -0
  22. package/dist/functions/group/legacy/membership.js +60 -0
  23. package/dist/functions/group/membership-laws.js +40 -0
  24. package/dist/functions/group/provision-group.js +33 -0
  25. package/dist/functions/group/update-group.js +55 -0
  26. package/dist/functions/invitation/index.js +2 -0
  27. package/dist/functions/invitation/invitation-errors.js +13 -0
  28. package/dist/functions/invitation/invitation-methods.js +41 -0
  29. package/dist/functions/invitation/send-invitation.js +81 -0
  30. package/dist/functions/user/account.js +35 -0
  31. package/dist/functions/user/create-user.js +45 -0
  32. package/dist/functions/user/deactivate-user.js +19 -0
  33. package/dist/functions/user/delete-user.js +34 -0
  34. package/dist/functions/user/deprovision-user.js +21 -0
  35. package/dist/functions/user/index.js +15 -1
  36. package/dist/functions/user/invite-errors.js +18 -0
  37. package/dist/functions/user/invite-user.js +42 -34
  38. package/dist/functions/user/legacy/claimed-account.js +11 -0
  39. package/dist/functions/user/legacy/index.js +4 -0
  40. package/dist/functions/user/legacy/invite.js +20 -0
  41. package/dist/functions/user/legacy/migrate-accounts.js +98 -0
  42. package/dist/functions/user/legacy/record-profile.js +19 -0
  43. package/dist/functions/user/protect-administrators.js +16 -0
  44. package/dist/functions/user/provision-user.js +70 -0
  45. package/dist/functions/user/reactivate-user.js +19 -0
  46. package/dist/functions/user/read-account.js +12 -0
  47. package/dist/functions/user/request-invitation.js +17 -0
  48. package/dist/functions/user/update-profile.js +22 -0
  49. package/dist/functions/user/update-user.js +68 -0
  50. package/dist/functions/user/user-errors.js +69 -0
  51. package/dist/functions/user/write-account.js +57 -0
  52. package/dist/functions/view-access/index.js +2 -1
  53. package/dist/functions/view-access/{assign-views.js → legacy/assign-views.js} +11 -7
  54. package/dist/functions/view-access/legacy/index.js +1 -0
  55. package/dist/functions/view-access/{view-access-errors.js → legacy/view-access-errors.js} +5 -1
  56. package/dist/index.d.ts +1 -1
  57. package/dist/index.js +3 -1
  58. package/dist/integrations/user-invitation/invite-user-request.d.ts +6 -0
  59. package/dist/legacy/index.js +1 -0
  60. package/dist/legacy/release.js +33 -0
  61. package/dist/mutations/composition/grant-role.js +13 -0
  62. package/dist/mutations/composition/index.js +1 -0
  63. package/dist/mutations/group/legacy/index.js +1 -0
  64. package/dist/mutations/group/legacy/membership-class.js +7 -0
  65. package/dist/mutations/group/set-group-membership.js +23 -14
  66. package/dist/mutations/identity/create-profile.js +37 -0
  67. package/dist/mutations/identity/delete-identity.js +28 -0
  68. package/dist/mutations/identity/index.js +4 -0
  69. package/dist/mutations/identity/write-account.js +109 -0
  70. package/dist/mutations/identity/write-group.js +72 -0
  71. package/dist/mutations/invitation/index.js +1 -0
  72. package/dist/mutations/invitation/write-invitation.js +62 -0
  73. package/dist/mutations/user/legacy/index.js +1 -0
  74. package/dist/mutations/user/{record-user-profile.js → legacy/record-user-profile.js} +5 -2
  75. package/dist/providers/admin-enrollment/create-admin-enrollment-provider.js +6 -3
  76. package/dist/providers/admin-enrollment/legacy/index.js +1 -0
  77. package/dist/providers/admin-enrollment/legacy/send-without-profile.js +16 -0
  78. package/dist/queries/application/legacy/index.js +1 -0
  79. package/dist/queries/application/legacy/read-installed-entrypoints.js +47 -0
  80. package/dist/queries/composition/index.js +2 -0
  81. package/dist/queries/composition/read-extensions.js +34 -0
  82. package/dist/queries/composition/read-role-nodes.js +41 -0
  83. package/dist/queries/group/index.js +1 -1
  84. package/dist/queries/group/legacy/index.js +2 -0
  85. package/dist/queries/group/legacy/read-core-groups.js +46 -0
  86. package/dist/queries/group/legacy/read-member-of-group.js +24 -0
  87. package/dist/queries/group/read-group-membership-endpoints.js +11 -0
  88. package/dist/queries/group/read-group-membership.js +6 -21
  89. package/dist/queries/identity/index.js +1 -0
  90. package/dist/queries/identity/read-identities.js +29 -0
  91. package/dist/queries/invitation/index.js +1 -0
  92. package/dist/queries/invitation/read-invitation.js +25 -0
  93. package/dist/queries/profile/index.js +1 -0
  94. package/dist/queries/profile/read-profile.js +15 -0
  95. package/dist/queries/role/index.js +1 -0
  96. package/dist/queries/role/read-role-node.js +13 -0
  97. package/dist/queries/user/legacy/index.js +1 -0
  98. package/dist/queries/user/legacy/read-user-profile.js +27 -0
  99. package/dist/runtime.d.ts +18203 -630
  100. package/dist/runtime.js +32 -7
  101. package/dist/schema/index.d.ts +7 -4
  102. package/dist/schema/index.js +8 -4
  103. package/dist/schema/legacy/index.js +1 -0
  104. package/dist/schema/legacy/schema.js +32 -0
  105. package/dist/schema/modules/application/legacy/entrypoint-entry.js +11 -0
  106. package/dist/schema/modules/application/legacy/functions/index.js +1 -0
  107. package/dist/schema/modules/application/legacy/functions/list-entrypoints.js +21 -0
  108. package/dist/schema/modules/application/legacy/index.js +2 -0
  109. package/dist/schema/modules/directory/functions/disconnect-directory.d.ts +13 -0
  110. package/dist/schema/modules/directory/functions/disconnect-directory.js +15 -0
  111. package/dist/schema/modules/directory/functions/index.d.ts +1 -0
  112. package/dist/schema/modules/directory/functions/index.js +1 -0
  113. package/dist/schema/modules/directory/index.d.ts +1 -0
  114. package/dist/schema/modules/directory/index.js +1 -0
  115. package/dist/schema/modules/group/classes/group-profile-link.d.ts +34 -0
  116. package/dist/schema/modules/group/classes/group-profile-link.js +21 -0
  117. package/dist/schema/modules/group/classes/group-profile.d.ts +15 -0
  118. package/dist/schema/modules/group/classes/group-profile.js +20 -0
  119. package/dist/schema/modules/group/classes/group.d.ts +73 -1
  120. package/dist/schema/modules/group/classes/group.js +28 -7
  121. package/dist/schema/modules/group/classes/index.d.ts +2 -1
  122. package/dist/schema/modules/group/classes/index.js +3 -1
  123. package/dist/schema/modules/group/functions/assign-member.js +17 -0
  124. package/dist/schema/modules/group/functions/create-group.js +20 -0
  125. package/dist/schema/modules/group/functions/delete-group.js +12 -0
  126. package/dist/schema/modules/group/functions/deprovision-group.js +14 -0
  127. package/dist/schema/modules/group/functions/index.js +7 -2
  128. package/dist/schema/modules/group/functions/provision-group.js +14 -0
  129. package/dist/schema/modules/group/functions/unassign-member.js +17 -0
  130. package/dist/schema/modules/group/functions/update-group.js +20 -0
  131. package/dist/schema/modules/group/index.d.ts +3 -3
  132. package/dist/schema/modules/group/index.js +4 -3
  133. package/dist/schema/modules/group/legacy/admission.d.ts +9 -0
  134. package/dist/schema/modules/group/legacy/admission.js +9 -0
  135. package/dist/schema/modules/group/legacy/classes/index.d.ts +1 -0
  136. package/dist/schema/modules/group/legacy/classes/index.js +1 -0
  137. package/dist/schema/modules/group/{classes → legacy/classes}/member-of-group.d.ts +10 -1
  138. package/dist/schema/modules/group/legacy/classes/member-of-group.js +32 -0
  139. package/dist/schema/modules/group/legacy/core-groups.d.ts +22 -0
  140. package/dist/schema/modules/group/legacy/core-groups.js +28 -0
  141. package/dist/schema/modules/group/legacy/index.d.ts +5 -0
  142. package/dist/schema/modules/group/legacy/index.js +6 -0
  143. package/dist/schema/modules/group/legacy/policies/belongs-to-group.d.ts +5 -0
  144. package/dist/schema/modules/group/legacy/policies/belongs-to-group.js +9 -0
  145. package/dist/schema/modules/group/legacy/policies/index.d.ts +2 -0
  146. package/dist/schema/modules/group/legacy/policies/index.js +2 -0
  147. package/dist/schema/modules/group/legacy/policies/owns-membership-group.d.ts +6 -0
  148. package/dist/schema/modules/group/legacy/policies/owns-membership-group.js +12 -0
  149. package/dist/schema/modules/group/legacy/relaxations.d.ts +21 -0
  150. package/dist/schema/modules/group/legacy/relaxations.js +27 -0
  151. package/dist/schema/modules/group/policies/describes-group-of-subject.d.ts +2 -0
  152. package/dist/schema/modules/group/policies/describes-group-of-subject.js +7 -0
  153. package/dist/schema/modules/group/policies/index.d.ts +2 -1
  154. package/dist/schema/modules/group/policies/index.js +2 -1
  155. package/dist/schema/modules/group/policies/is-group-profile-source.d.ts +2 -0
  156. package/dist/schema/modules/group/policies/is-group-profile-source.js +6 -0
  157. package/dist/schema/modules/group/types/group.js +10 -0
  158. package/dist/schema/modules/group/types/index.js +1 -0
  159. package/dist/schema/modules/invitation/classes/index.js +2 -0
  160. package/dist/schema/modules/invitation/classes/invitation-user.js +17 -0
  161. package/dist/schema/modules/invitation/classes/invitation.js +30 -0
  162. package/dist/schema/modules/invitation/functions/accept.js +16 -0
  163. package/dist/schema/modules/invitation/functions/cancel.js +12 -0
  164. package/dist/schema/modules/invitation/functions/index.js +4 -0
  165. package/dist/schema/modules/invitation/functions/resend.js +12 -0
  166. package/dist/schema/modules/invitation/functions/send.js +20 -0
  167. package/dist/schema/modules/invitation/index.js +2 -0
  168. package/dist/schema/modules/invitation/types/index.js +1 -0
  169. package/dist/schema/modules/invitation/types/invitation-status.js +5 -0
  170. package/dist/schema/modules/namespace/classes/alias.d.ts +2 -1
  171. package/dist/schema/modules/namespace/classes/alias.js +11 -2
  172. package/dist/schema/modules/namespace/functions/link.js +3 -2
  173. package/dist/schema/modules/namespace/functions/rename.js +3 -2
  174. package/dist/schema/modules/namespace/functions/unlink.js +3 -2
  175. package/dist/schema/modules/role/classes/index.d.ts +1 -0
  176. package/dist/schema/modules/role/classes/index.js +1 -0
  177. package/dist/schema/modules/role/classes/role.d.ts +16 -0
  178. package/dist/schema/modules/role/classes/role.js +19 -0
  179. package/dist/schema/modules/role/core/index.d.ts +1 -0
  180. package/dist/schema/modules/role/core/index.js +1 -0
  181. package/dist/schema/modules/role/core/roles.d.ts +37 -0
  182. package/dist/schema/modules/role/core/roles.js +30 -0
  183. package/dist/schema/modules/role/index.d.ts +2 -0
  184. package/dist/schema/modules/role/index.js +2 -0
  185. package/dist/schema/modules/user/classes/index.d.ts +2 -0
  186. package/dist/schema/modules/user/classes/index.js +3 -0
  187. package/dist/schema/modules/user/classes/user-profile-link.d.ts +35 -0
  188. package/dist/schema/modules/user/classes/user-profile-link.js +22 -0
  189. package/dist/schema/modules/user/classes/user-profile.d.ts +41 -0
  190. package/dist/schema/modules/user/classes/user-profile.js +30 -0
  191. package/dist/schema/modules/user/classes/user.d.ts +133 -8
  192. package/dist/schema/modules/user/classes/user.js +46 -15
  193. package/dist/schema/modules/user/functions/create-user.js +21 -0
  194. package/dist/schema/modules/user/functions/deactivate-user.js +12 -0
  195. package/dist/schema/modules/user/functions/delete-user.js +12 -0
  196. package/dist/schema/modules/user/functions/deprovision-user.js +14 -0
  197. package/dist/schema/modules/user/functions/index.js +8 -1
  198. package/dist/schema/modules/user/functions/invite-user.js +23 -4
  199. package/dist/schema/modules/user/functions/provision-user.js +25 -0
  200. package/dist/schema/modules/user/functions/reactivate-user.js +12 -0
  201. package/dist/schema/modules/user/functions/update-profile.js +16 -0
  202. package/dist/schema/modules/user/functions/update-user.js +22 -0
  203. package/dist/schema/modules/user/index.d.ts +2 -1
  204. package/dist/schema/modules/user/index.js +2 -1
  205. package/dist/schema/modules/user/legacy/account-properties.js +24 -0
  206. package/dist/schema/modules/user/legacy/functions/index.js +2 -0
  207. package/dist/schema/modules/user/legacy/functions/migrate-accounts.js +23 -0
  208. package/dist/schema/modules/user/legacy/functions/record-profile.js +18 -0
  209. package/dist/schema/modules/user/legacy/index.js +5 -0
  210. package/dist/schema/modules/user/legacy/invite.js +15 -0
  211. package/dist/schema/modules/user/legacy/relaxations.js +37 -0
  212. package/dist/schema/modules/user/policies/describes-subject.d.ts +2 -0
  213. package/dist/schema/modules/user/policies/describes-subject.js +7 -0
  214. package/dist/schema/modules/user/policies/index.d.ts +2 -0
  215. package/dist/schema/modules/user/policies/index.js +2 -0
  216. package/dist/schema/modules/user/policies/is-profile-source.d.ts +2 -0
  217. package/dist/schema/modules/user/policies/is-profile-source.js +6 -0
  218. package/dist/schema/modules/user/types/account.d.ts +12 -0
  219. package/dist/schema/modules/user/types/account.js +12 -0
  220. package/dist/schema/modules/user/types/index.d.ts +1 -1
  221. package/dist/schema/modules/user/types/index.js +1 -1
  222. package/dist/schema/modules/view-access/classes/view-access.d.ts +7 -11
  223. package/dist/schema/modules/view-access/classes/view-access.js +17 -12
  224. package/dist/schema/modules/view-access/index.d.ts +1 -2
  225. package/dist/schema/modules/view-access/index.js +1 -2
  226. package/dist/schema/modules/view-access/legacy/functions/assign-views.js +22 -0
  227. package/dist/schema/modules/view-access/legacy/functions/index.js +1 -0
  228. package/dist/schema/modules/view-access/legacy/index.js +2 -0
  229. package/dist/schema/modules/view-access/legacy/view-assignment.js +24 -0
  230. package/dist/schema/modules/view-access/policies/holds-view-access.d.ts +2 -0
  231. package/dist/schema/modules/view-access/policies/holds-view-access.js +5 -0
  232. package/dist/schema/modules/view-access/policies/index.d.ts +1 -0
  233. package/dist/schema/modules/view-access/policies/index.js +1 -0
  234. package/dist/schema/policies/has-role.d.ts +6 -0
  235. package/dist/schema/policies/has-role.js +9 -0
  236. package/dist/schema/policies/index.d.ts +1 -0
  237. package/dist/schema/policies/index.js +1 -4
  238. package/dist/schema/policies/legacy/administers-shell-class.js +21 -0
  239. package/dist/schema/policies/legacy/index.js +4 -0
  240. package/dist/schema/policies/legacy/is-self.js +9 -0
  241. package/dist/schema/policies/legacy/owns-class.js +12 -0
  242. package/dist/schema/policies/legacy/uses-function.js +9 -0
  243. package/dist/schema/schema.d.ts +1849 -118
  244. package/dist/schema/schema.js +35 -15
  245. package/dist/schema/types/attributes.js +15 -0
  246. package/dist/schema/types/index.js +1 -0
  247. package/dist/utils/attributes/attributes.js +12 -0
  248. package/dist/utils/attributes/index.js +1 -0
  249. package/dist/utils/index.js +3 -0
  250. package/dist/utils/same-json/index.js +1 -0
  251. package/dist/utils/same-json/same-json.js +9 -0
  252. package/package.json +3 -3
  253. package/dist/functions/application/list-entrypoints.js +0 -6
  254. package/dist/functions/user/record-profile.js +0 -18
  255. package/dist/mutations/user/index.js +0 -1
  256. package/dist/queries/application/index.js +0 -1
  257. package/dist/queries/application/read-installed-entrypoints.js +0 -28
  258. package/dist/queries/user/index.js +0 -1
  259. package/dist/queries/user/read-user-profile.js +0 -9
  260. package/dist/schema/modules/application/functions/index.d.ts +0 -1
  261. package/dist/schema/modules/application/functions/index.js +0 -1
  262. package/dist/schema/modules/application/functions/list-entrypoints.d.ts +0 -15
  263. package/dist/schema/modules/application/functions/list-entrypoints.js +0 -16
  264. package/dist/schema/modules/application/index.d.ts +0 -2
  265. package/dist/schema/modules/application/index.js +0 -2
  266. package/dist/schema/modules/application/types/entrypoint-entry.d.ts +0 -8
  267. package/dist/schema/modules/application/types/entrypoint-entry.js +0 -7
  268. package/dist/schema/modules/application/types/index.d.ts +0 -1
  269. package/dist/schema/modules/application/types/index.js +0 -1
  270. package/dist/schema/modules/group/classes/member-of-group.js +0 -12
  271. package/dist/schema/modules/group/core/administrators-group.d.ts +0 -1
  272. package/dist/schema/modules/group/core/administrators-group.js +0 -6
  273. package/dist/schema/modules/group/core/applications-group.d.ts +0 -1
  274. package/dist/schema/modules/group/core/applications-group.js +0 -6
  275. package/dist/schema/modules/group/core/index.d.ts +0 -3
  276. package/dist/schema/modules/group/core/index.js +0 -3
  277. package/dist/schema/modules/group/core/members-group.d.ts +0 -1
  278. package/dist/schema/modules/group/core/members-group.js +0 -6
  279. package/dist/schema/modules/group/functions/assign-member-to-group.js +0 -11
  280. package/dist/schema/modules/group/functions/unassign-member-from-group.js +0 -11
  281. package/dist/schema/modules/group/policies/belongs-to-group.d.ts +0 -1
  282. package/dist/schema/modules/group/policies/belongs-to-group.js +0 -5
  283. package/dist/schema/modules/user/functions/record-profile.js +0 -14
  284. package/dist/schema/modules/user/types/user-profile.d.ts +0 -7
  285. package/dist/schema/modules/user/types/user-profile.js +0 -7
  286. package/dist/schema/modules/view-access/core/index.d.ts +0 -1
  287. package/dist/schema/modules/view-access/core/index.js +0 -1
  288. package/dist/schema/modules/view-access/core/view-only-group.d.ts +0 -5
  289. package/dist/schema/modules/view-access/core/view-only-group.js +0 -10
  290. package/dist/schema/modules/view-access/functions/assign-views.d.ts +0 -16
  291. package/dist/schema/modules/view-access/functions/assign-views.js +0 -17
  292. package/dist/schema/modules/view-access/functions/index.d.ts +0 -1
  293. package/dist/schema/modules/view-access/functions/index.js +0 -1
  294. package/dist/schema/modules/view-access/types/index.js +0 -1
  295. package/dist/schema/modules/view-access/types/view-assignment.js +0 -16
  296. package/dist/schema/policies/administers-shell-class.js +0 -11
  297. package/dist/schema/policies/is-self.js +0 -5
  298. package/dist/schema/policies/owns-class.js +0 -7
  299. package/dist/schema/policies/uses-function.js +0 -5
  300. /package/dist/functions/group/{assign-member-to-group.js → assign-member.js} +0 -0
  301. /package/dist/functions/group/{unassign-member-from-group.js → unassign-member.js} +0 -0
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * @deprecated Correlation key of an Admin-reserved account, `email` and `name` of a self-recorded
4
+ * profile (L-SHELL-4). Replaced by `email` (unique) and `name`, which `legacyMigrateAccounts` copies.
5
+ * Removal: Shell major (delivery step 5) after 1Pact step 4.
6
+ */
7
+ export const legacyAccountProperties = {
8
+ // Correlation for Admin-owned creation; never an authentication credential.
9
+ creationKey: z.string().min(1).max(512).optional(),
10
+ // Named apart from any profile a Domain extending User declares (`email`, `displayName`…).
11
+ claimedEmail: z.string().min(3).max(320).optional(),
12
+ claimedName: z.string().min(1).max(200).optional(),
13
+ };
14
+ /**
15
+ * @deprecated The account state before `frozen` was written directly (U2): `suspended` (local
16
+ * deactivation) and `directoryActive` (the directory's state). Shell no longer writes or reads them;
17
+ * they stay declared, optional, so stored accounts that hold them remain valid (L-SHELL-17).
18
+ * Replaced by `frozen` alone, which U2 already wrote beside them. Removal: Shell major (delivery
19
+ * step 5), in the Kernel repair session that erases them from stored accounts.
20
+ */
21
+ export const legacyAccountStateProperties = {
22
+ suspended: z.boolean().optional(),
23
+ directoryActive: z.boolean().optional(),
24
+ };
@@ -0,0 +1,2 @@
1
+ export { legacyRecordProfile } from './record-profile.js';
2
+ export { legacyMigrateAccounts } from './migrate-accounts.js';
@@ -0,0 +1,23 @@
1
+ import { func } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { profileRoles } from '../../../role/index.js';
4
+ import { hasRole } from '../../../../policies/index.js';
5
+ /**
6
+ * @deprecated Copy each account's `claimedEmail` to `email` and `claimedName` to `name`, so the
7
+ * Shell major can require them, and give every account and group its profile; running it again
8
+ * changes nothing
9
+ * (L-SHELL-14). Replaced by nothing: accounts are born with them. Removal: Shell major (delivery
10
+ * step 5) after 1Pact step 4, once every instance has run it.
11
+ */
12
+ export const legacyMigrateAccounts = func({
13
+ description: 'Write email, name and profiles on accounts and groups created before them.',
14
+ auth: 'authorized',
15
+ input: z.strictObject({}),
16
+ output: z.object({
17
+ migrated: z.number().int().min(0),
18
+ conflicts: z.array(z.object({ user: z.string(), email: z.string() })),
19
+ /** The profiles created for accounts and groups stored before profiles. */
20
+ profiles: z.number().int().min(0),
21
+ }),
22
+ policy: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
23
+ });
@@ -0,0 +1,18 @@
1
+ import { method } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { legacyIsSelf } from '../../../../policies/legacy/index.js';
4
+ /**
5
+ * @deprecated The email and display name an account records about itself at each sign-in
6
+ * (L-SHELL-5). Replaced by `User.updateProfile`, called by the holder from its profile. Removal:
7
+ * Shell major (delivery step 5) after 1Pact step 4.
8
+ */
9
+ export const legacyRecordProfile = method({
10
+ description: 'Record the email and display name this account signs in with; only the account itself may.',
11
+ auth: 'authorized',
12
+ input: z.strictObject({
13
+ email: z.string().min(3).max(320).optional(),
14
+ displayName: z.string().min(1).max(200).optional(),
15
+ }),
16
+ output: z.object({}),
17
+ policy: ({ check, self }) => check(legacyIsSelf, self),
18
+ });
@@ -0,0 +1,5 @@
1
+ // Relaxations first: User reads them while the rest of this folder may still be loading.
2
+ export { LEGACY_ACCOUNT_PROPERTIES_OPTIONAL, LEGACY_USER_EXTENDS, LEGACY_USER_INHERITANCE, LEGACY_USER_READ, legacyUserName, } from './relaxations.js';
3
+ export { legacyAccountProperties, legacyAccountStateProperties } from './account-properties.js';
4
+ export { legacyInviteFields, legacyInviteOwnerAdmission } from './invite.js';
5
+ export { legacyMigrateAccounts, legacyRecordProfile } from './functions/index.js';
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { legacyOwnsClass } from '../../../policies/legacy/index.js';
3
+ /**
4
+ * @deprecated The `{ user, email }` invitation of callers older than profiles: the email is the
5
+ * caller's, and no profile is granted (L-SHELL-6). Replaced by `User.invite({ user, profile })`,
6
+ * which reads the account's email. Removal: Shell major (delivery step 5) after 1Pact step 4.
7
+ */
8
+ export const legacyInviteFields = { email: z.string().min(3).max(320).optional() };
9
+ /**
10
+ * @deprecated The owner of a User subclass invites its accounts (L-SHELL-9). Replaced by
11
+ * `user.writer` in the Domain's release. Removal: Shell major (delivery step 5) after 1Pact step 4.
12
+ */
13
+ export function legacyInviteOwnerAdmission(context, user) {
14
+ return context.check(legacyOwnsClass, user);
15
+ }
@@ -0,0 +1,37 @@
1
+ import { K, property } from '@astrale-os/sdk/schema';
2
+ /**
3
+ * @deprecated Domains still extend User (L-SHELL-1). Replaced by `'final'`. Removal: Shell major
4
+ * (delivery step 5) after 1Pact step 4.
5
+ */
6
+ export const LEGACY_USER_INHERITANCE = 'open';
7
+ /**
8
+ * @deprecated User omits Kernel Named and Timestamped while stored accounts lack their required
9
+ * `name`, `createdAt` and `updatedAt`, which the Kernel refuses to add over existing data
10
+ * (DATA_MIGRATION_REQUIRED) (L-SHELL-2). Replaced by
11
+ * `[K.classes.Identity, K.classes.Named, K.classes.Iconable, K.classes.Timestamped]`. Removal: Shell
12
+ * major (delivery step 5) after 1Pact step 4, in the Kernel repair session that writes those values.
13
+ */
14
+ export const LEGACY_USER_EXTENDS = [K.classes.Identity, K.classes.Iconable];
15
+ /**
16
+ * @deprecated The account's name as a User Property, optional, until User extends Kernel Named
17
+ * (L-SHELL-2). Replaced by `K.classes.Named.properties.name`. Removal: Shell major (delivery step 5)
18
+ * after 1Pact step 4.
19
+ */
20
+ export const legacyUserName = property({ type: 'string', minLength: 1, maxLength: 100 }, { required: false });
21
+ /**
22
+ * @deprecated Properties the target requires stay optional until `legacyMigrateAccounts` has
23
+ * written them on every stored account (L-SHELL-3). Replaced by `{ required: true }`. Removal: Shell
24
+ * major (delivery step 5) after 1Pact step 4.
25
+ */
26
+ export const LEGACY_ACCOUNT_PROPERTIES_OPTIONAL = { required: false };
27
+ /**
28
+ * @deprecated User keeps the read rule and the absence of unique constraints of the Shell that
29
+ * released Domains embed (L-SHELL-19): the Kernel binds a Domain built against that Shell only
30
+ * while `/policies/read` and `/unique` of the Classes it extends stay as they were
31
+ * (SCHEMA_DEPENDENCY_INCOMPATIBLE otherwise). Every identity reads accounts; members read the same
32
+ * names and emails on profiles anyway. An email stays unique through `UserProfile.email` and the
33
+ * lookups of `User.create`, `User.update` and `User.provision`. Replaced by `read: anyOf(user.reader,
34
+ * self)` and `unique: [['email'], ['directory', 'externalId']]`. Removal: Shell major (delivery
35
+ * step 5), once immogrc, 1Pact and organization are rebuilt against this Shell.
36
+ */
37
+ export const LEGACY_USER_READ = true;
@@ -0,0 +1,2 @@
1
+ /** The subject is the account this profile describes. */
2
+ export declare const describesSubject: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,7 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ import { user_profile } from '../classes/user-profile-link.js';
3
+ /** The subject is the account this profile describes. */
4
+ export const describesSubject = policy({
5
+ description: 'The caller is the account this profile describes.',
6
+ match: ({ edge, object, subject }) => edge({ source: subject, class: user_profile, target: object }),
7
+ });
@@ -0,0 +1,2 @@
1
+ export { describesSubject } from './describes-subject.js';
2
+ export { isProfileSource } from './is-profile-source.js';
@@ -0,0 +1,2 @@
1
+ export { describesSubject } from './describes-subject.js';
2
+ export { isProfileSource } from './is-profile-source.js';
@@ -0,0 +1,2 @@
1
+ /** The subject is the account at the source of this Edge: a person finds its own profile. */
2
+ export declare const isProfileSource: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,6 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ /** The subject is the account at the source of this Edge: a person finds its own profile. */
3
+ export const isProfileSource = policy({
4
+ description: 'The caller is the account this Edge leaves.',
5
+ match: ({ sameNode, subject, source }) => sameNode(subject, source),
6
+ });
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ /** An email as a caller writes it; the method trims it, lower-cases it and checks its shape. */
3
+ export declare const accountEmailInput: z.ZodString;
4
+ /** A displayed name, a given name or a family name. */
5
+ export declare const personName: z.ZodString;
6
+ /** A Kernel Iconable icon; `null` removes it. */
7
+ export declare const accountIcon: z.ZodNullable<z.ZodString>;
8
+ /** The WorkOS id of a directory and the id of an account or a group in it. */
9
+ export declare const directoryId: z.ZodString;
10
+ export declare const externalId: z.ZodString;
11
+ /** A Node as a method returns it: its canonical `@<NodeId>` path. */
12
+ export declare const nodeReference: z.ZodString;
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ /** An email as a caller writes it; the method trims it, lower-cases it and checks its shape. */
3
+ export const accountEmailInput = z.string().min(3).max(320);
4
+ /** A displayed name, a given name or a family name. */
5
+ export const personName = z.string().min(1).max(100);
6
+ /** A Kernel Iconable icon; `null` removes it. */
7
+ export const accountIcon = z.string().min(1).max(8_000).nullable();
8
+ /** The WorkOS id of a directory and the id of an account or a group in it. */
9
+ export const directoryId = z.string().min(1).max(200);
10
+ export const externalId = z.string().min(1).max(200);
11
+ /** A Node as a method returns it: its canonical `@<NodeId>` path. */
12
+ export const nodeReference = z.string().min(2).max(512);
@@ -1,2 +1,2 @@
1
1
  export { invitationSummary, type InvitationSummary } from './invitation-summary.js';
2
- export { userEmail, userDisplayName } from './user-profile.js';
2
+ export { accountEmailInput, accountIcon, directoryId, externalId, nodeReference, personName, } from './account.js';
@@ -1,2 +1,2 @@
1
1
  export { invitationSummary } from './invitation-summary.js';
2
- export { userEmail, userDisplayName } from './user-profile.js';
2
+ export { accountEmailInput, accountIcon, directoryId, externalId, nodeReference, personName, } from './account.js';
@@ -1,8 +1,8 @@
1
1
  /**
2
- * One View given to an account or a group: the holder, and each member of a holding group, has this
3
- * View among the ones it opens. It decides navigation, never data: the View's own Domain still
4
- * guards everything it shows. Only instance administrators create or delete it. The target is a
5
- * Class Shell does not own, so the Edge detaches with its View.
2
+ * A View an Identity lands on without `member`: an account, a group or a Role, and each of their
3
+ * members. It decides navigation, never data: the View's own Domain still guards everything it
4
+ * shows (V1). Only an admin writes it; an admin or its holders read it. Each end detaches with its
5
+ * Node.
6
6
  */
7
7
  export declare const view_access: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
8
8
  readonly depth: 0;
@@ -10,13 +10,9 @@ export declare const view_access: import("@astrale-os/sdk/schema").DirectedEdgeC
10
10
  readonly extends: readonly [];
11
11
  readonly properties: never;
12
12
  readonly source: {
13
- readonly as: "holder";
14
- readonly accepts: readonly (() => {
15
- readonly kind: 'node';
16
- readonly abstract: never;
17
- readonly depth: never;
18
- readonly properties: never;
19
- readonly methods: never;
13
+ readonly as: "audience";
14
+ readonly accepts: readonly (import("@astrale-os/sdk/schema").ClassRef<"Identity"> & {
15
+ readonly origin: "kernel.astrale.ai";
20
16
  })[];
21
17
  readonly outgoing: "0..*";
22
18
  };
@@ -1,18 +1,23 @@
1
1
  import { K, edgeClass } from '@astrale-os/sdk/schema';
2
- import { Group } from '../../group/index.js';
3
- import { User } from '../../user/index.js';
2
+ import { profileRoles } from '../../role/index.js';
3
+ import { hasRole } from '../../../policies/index.js';
4
+ import { holdsViewAccess } from '../policies/index.js';
4
5
  /**
5
- * One View given to an account or a group: the holder, and each member of a holding group, has this
6
- * View among the ones it opens. It decides navigation, never data: the View's own Domain still
7
- * guards everything it shows. Only instance administrators create or delete it. The target is a
8
- * Class Shell does not own, so the Edge detaches with its View.
6
+ * A View an Identity lands on without `member`: an account, a group or a Role, and each of their
7
+ * members. It decides navigation, never data: the View's own Domain still guards everything it
8
+ * shows (V1). Only an admin writes it; an admin or its holders read it. Each end detaches with its
9
+ * Node.
9
10
  */
10
11
  export const view_access = edgeClass.directed({
11
- policies: { read: true, traverse: true },
12
- source: {
13
- as: 'holder',
14
- accepts: [() => User, () => Group],
15
- outgoing: '0..*',
12
+ inheritance: 'final',
13
+ abstract: false,
14
+ description: 'A View this Identity lands on without member.',
15
+ source: { as: 'audience', accepts: [K.classes.Identity], outgoing: '0..*', onDelete: 'detach' },
16
+ target: { as: 'view', accepts: [K.classes.View], incoming: '0..*', onDelete: 'detach' },
17
+ policies: {
18
+ read: ({ anyOf, check, ref, self }) => anyOf(check(hasRole, ref(profileRoles['workspace.admin'])), check(holdsViewAccess, self)),
19
+ traverse: true,
20
+ create: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
21
+ delete: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
16
22
  },
17
- target: { as: 'view', accepts: [K.classes.View], incoming: '0..*' },
18
23
  });
@@ -1,3 +1,2 @@
1
1
  export { view_access } from './classes/index.js';
2
- export { viewOnlyGroup } from './core/index.js';
3
- export { assignViews } from './functions/index.js';
2
+ export { holdsViewAccess } from './policies/index.js';
@@ -1,3 +1,2 @@
1
1
  export { view_access } from './classes/index.js';
2
- export { viewOnlyGroup } from './core/index.js';
3
- export { assignViews } from './functions/index.js';
2
+ export { holdsViewAccess } from './policies/index.js';
@@ -0,0 +1,22 @@
1
+ import { func } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { profileRoles } from '../../../role/index.js';
4
+ import { hasRole } from '../../../../policies/index.js';
5
+ import { LEGACY_MAX_ASSIGNMENTS, legacyViewAssignment } from '../view-assignment.js';
6
+ /**
7
+ * @deprecated Give and withdraw Views for each identity, in one write (L-SHELL-12). Replaced by a
8
+ * Mutation on `view_access`, which only `workspace.admin` holders may write. Removal: Shell major
9
+ * (delivery step 5) after 1Pact step 4.
10
+ *
11
+ * Its legacy `can_use` holders, the Administrators group, hold `workspace.admin` through the release
12
+ * (AM5), which now admits them.
13
+ */
14
+ export const legacyAssignViews = func({
15
+ description: 'Give and withdraw Views for each identity, in one write.',
16
+ auth: 'authorized',
17
+ input: z.strictObject({
18
+ assignments: z.array(legacyViewAssignment).min(1).max(LEGACY_MAX_ASSIGNMENTS),
19
+ }),
20
+ output: z.object({}),
21
+ policy: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
22
+ });
@@ -0,0 +1 @@
1
+ export { legacyAssignViews } from './assign-views.js';
@@ -0,0 +1,2 @@
1
+ export { legacyAssignViews } from './functions/index.js';
2
+ export { LEGACY_MAX_ASSIGNED_VIEWS, LEGACY_MAX_ASSIGNMENTS, legacyViewAssignment, } from './view-assignment.js';
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * @deprecated Bounds of one `assignViews` call within the Kernel's Mutation limits (L-SHELL-12).
4
+ * Replaced by a Mutation on `view_access`. Removal: Shell major (delivery step 5) after 1Pact step 4.
5
+ */
6
+ export const LEGACY_MAX_ASSIGNED_VIEWS = 20;
7
+ /**
8
+ * @deprecated At most 40 identities in one `assignViews` call (L-SHELL-12). Replaced by a Mutation
9
+ * on `view_access`. Removal: Shell major (delivery step 5) after 1Pact step 4.
10
+ */
11
+ export const LEGACY_MAX_ASSIGNMENTS = 40;
12
+ // A Path inside a list is not a callable Path input: each is an exact @NodeId the Action checks.
13
+ const nodeId = z.string().min(2).max(512);
14
+ const views = z.array(nodeId).max(LEGACY_MAX_ASSIGNED_VIEWS);
15
+ /**
16
+ * @deprecated The Views given to one identity (`set`) and withdrawn from it (`unset`), by @NodeId
17
+ * (L-SHELL-12). Replaced by a Mutation on `view_access`. Removal: Shell major (delivery step 5)
18
+ * after 1Pact step 4.
19
+ */
20
+ export const legacyViewAssignment = z.strictObject({
21
+ identity: nodeId,
22
+ set: views.optional(),
23
+ unset: views.optional(),
24
+ });
@@ -0,0 +1,2 @@
1
+ /** The subject is the Edge's audience, or extends it: a group's members hold its Views. */
2
+ export declare const holdsViewAccess: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,5 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ /** The subject is the Edge's audience, or extends it: a group's members hold its Views. */
3
+ export const holdsViewAccess = policy({
4
+ match: ({ sameNode, subject, source }) => sameNode(subject, source),
5
+ });
@@ -0,0 +1 @@
1
+ export { holdsViewAccess } from './holds-view-access.js';
@@ -0,0 +1 @@
1
+ export { holdsViewAccess } from './holds-view-access.js';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The subject holds the object Role: it is that Role, or extends it through its live composition,
3
+ * at any depth. This is the Kernel `hasRole` meaning; a Domain checks only Policies it declares, so
4
+ * each Domain declares its own and tests a Role with `check(hasRole, ref(role))` (AM2).
5
+ */
6
+ export declare const hasRole: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,9 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ /**
3
+ * The subject holds the object Role: it is that Role, or extends it through its live composition,
4
+ * at any depth. This is the Kernel `hasRole` meaning; a Domain checks only Policies it declares, so
5
+ * each Domain declares its own and tests a Role with `check(hasRole, ref(role))` (AM2).
6
+ */
7
+ export const hasRole = policy({
8
+ match: ({ sameNode, subject, object }) => sameNode(subject, object),
9
+ });
@@ -0,0 +1 @@
1
+ export { hasRole } from './has-role.js';
@@ -1,4 +1 @@
1
- export { ownsClass } from './owns-class.js';
2
- export { administersShellClass } from './administers-shell-class.js';
3
- export { usesFunction } from './uses-function.js';
4
- export { isSelf } from './is-self.js';
1
+ export { hasRole } from './has-role.js';
@@ -0,0 +1,21 @@
1
+ import { K, policy } from '@astrale-os/sdk/schema';
2
+ import { Group } from '../../modules/group/index.js';
3
+ import { legacyAdministratorsGroup } from '../../modules/group/legacy/index.js';
4
+ import { legacyMemberOfGroup } from '../../modules/group/legacy/index.js';
5
+ /**
6
+ * @deprecated Membership of the legacy Administrators group on a Shell-owned concrete Class
7
+ * (L-SHELL-10). Replaced by `check(hasRole, ref(S.core.nodes['workspace.admin']))`. Removal: Shell
8
+ * major (delivery step 5) after 1Pact step 4.
9
+ */
10
+ export const legacyAdministersShellClass = policy({
11
+ match: ({ exists, subject, object, ref, edge, allOf }) => exists(({ node }) => {
12
+ const concrete = node();
13
+ const owner = node(); // of_domain restricts this witness to a protected Domain endpoint.
14
+ const group = ref(() => Group);
15
+ return allOf(edge({
16
+ source: subject,
17
+ class: () => legacyMemberOfGroup,
18
+ target: ref(legacyAdministratorsGroup),
19
+ }), { source: ref(legacyAdministratorsGroup), class: K.classes.instance_of.ref, target: group }, { source: group, class: K.classes.of_domain.ref, target: owner }, { source: concrete, class: K.classes.of_domain.ref, target: owner }, { source: object, class: K.classes.instance_of.ref, target: concrete });
20
+ }),
21
+ });
@@ -0,0 +1,4 @@
1
+ export { legacyOwnsClass } from './owns-class.js';
2
+ export { legacyAdministersShellClass } from './administers-shell-class.js';
3
+ export { legacyUsesFunction } from './uses-function.js';
4
+ export { legacyIsSelf } from './is-self.js';
@@ -0,0 +1,9 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ /**
3
+ * @deprecated The subject is the object itself, the admission of `User.recordProfile`
4
+ * (L-SHELL-10). Replaced by `check(hasRole, self)`, which reads the same. Removal: Shell major
5
+ * (delivery step 5) after 1Pact step 4.
6
+ */
7
+ export const legacyIsSelf = policy({
8
+ match: ({ sameNode, subject, object }) => sameNode(subject, object),
9
+ });
@@ -0,0 +1,12 @@
1
+ import { K, policy } from '@astrale-os/sdk/schema';
2
+ /**
3
+ * @deprecated Ownership of the object's concrete Class, the admission of a Domain that extends
4
+ * Shell's User or Group (L-SHELL-10). Replaced by `hasRole` on the Shell Roles: User and Group become
5
+ * final. Removal: Shell major (delivery step 5) after 1Pact step 4.
6
+ */
7
+ export const legacyOwnsClass = policy({
8
+ match: ({ exists, subject, object, allOf }) => exists(({ node }) => {
9
+ const concrete = node(); // Bounded by the two protected Kernel Edges.
10
+ return allOf({ source: object, class: K.classes.instance_of.ref, target: concrete }, { source: concrete, class: K.classes.of_domain.ref, target: subject });
11
+ }),
12
+ });
@@ -0,0 +1,9 @@
1
+ import { K, policy } from '@astrale-os/sdk/schema';
2
+ /**
3
+ * @deprecated The subject holds the legacy `can_use` capability on the object Function
4
+ * (L-SHELL-10). Replaced by `hasRole` on a Shell Role. Removal: Shell major (delivery step 5) after
5
+ * 1Pact step 4.
6
+ */
7
+ export const legacyUsesFunction = policy({
8
+ match: ({ edge, subject, object }) => edge({ source: subject, class: () => K.classes.can_use, target: object }),
9
+ });