@astrale-domains/shell 0.1.0-beta.9 → 0.1.2

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 (244) hide show
  1. package/README.md +264 -64
  2. package/dist/domain.d.ts +225 -0
  3. package/dist/domain.js +99 -0
  4. package/dist/functions/application/index.js +1 -0
  5. package/dist/functions/application/list-entrypoints.js +6 -0
  6. package/dist/functions/group/assign-member-to-group.js +4 -0
  7. package/dist/functions/group/change-group-membership.js +34 -0
  8. package/dist/functions/group/group-membership-errors.js +23 -0
  9. package/dist/functions/group/index.js +2 -0
  10. package/dist/functions/group/unassign-member-from-group.js +4 -0
  11. package/dist/functions/namespace/index.js +3 -0
  12. package/dist/functions/namespace/link.js +30 -0
  13. package/dist/functions/namespace/namespace-errors.js +28 -0
  14. package/dist/functions/namespace/namespace-name.js +13 -0
  15. package/dist/functions/namespace/rename.js +31 -0
  16. package/dist/functions/namespace/unlink.js +21 -0
  17. package/dist/functions/user/index.js +2 -0
  18. package/dist/functions/user/invite-user.js +39 -0
  19. package/dist/functions/user/record-profile.js +18 -0
  20. package/dist/functions/view-access/assign-views.js +86 -0
  21. package/dist/functions/view-access/index.js +1 -0
  22. package/dist/functions/view-access/view-access-errors.js +28 -0
  23. package/dist/index.d.ts +1 -3
  24. package/dist/index.js +1 -3
  25. package/dist/integrations/index.d.ts +1 -0
  26. package/dist/integrations/index.js +1 -0
  27. package/dist/integrations/integrations.d.ts +9 -0
  28. package/dist/integrations/integrations.js +2 -0
  29. package/dist/integrations/user-invitation/index.d.ts +4 -0
  30. package/dist/integrations/user-invitation/index.js +3 -0
  31. package/dist/integrations/user-invitation/invitation-request-failure.d.ts +5 -0
  32. package/dist/integrations/user-invitation/invitation-request-failure.js +9 -0
  33. package/dist/integrations/user-invitation/invite-user-request.d.ts +6 -0
  34. package/dist/integrations/user-invitation/invite-user-request.js +1 -0
  35. package/dist/integrations/user-invitation/request-user-invitation.d.ts +8 -0
  36. package/dist/integrations/user-invitation/request-user-invitation.js +9 -0
  37. package/dist/mutations/group/index.js +1 -1
  38. package/dist/mutations/group/set-group-membership.js +29 -0
  39. package/dist/mutations/namespace/alias-write.js +22 -0
  40. package/dist/mutations/namespace/index.js +3 -0
  41. package/dist/mutations/namespace/link-alias.js +15 -0
  42. package/dist/mutations/namespace/rename-alias.js +13 -0
  43. package/dist/mutations/namespace/unlink-alias.js +13 -0
  44. package/dist/mutations/user/index.js +1 -1
  45. package/dist/mutations/user/record-user-profile.js +13 -0
  46. package/dist/mutations/view-access/index.js +1 -0
  47. package/dist/mutations/view-access/set-view-access.js +29 -0
  48. package/dist/providers/admin-enrollment/create-admin-enrollment-provider.js +78 -0
  49. package/dist/providers/admin-enrollment/decode-admin-invitation-response.js +20 -0
  50. package/dist/providers/admin-enrollment/index.js +1 -0
  51. package/dist/providers/admin-enrollment/read-enrollment-response.js +34 -0
  52. package/dist/queries/application/index.js +1 -0
  53. package/dist/queries/application/read-installed-entrypoints.js +28 -0
  54. package/dist/queries/group/index.js +2 -0
  55. package/dist/queries/group/read-group-membership-endpoints.js +18 -0
  56. package/dist/queries/group/read-group-membership.js +35 -0
  57. package/dist/queries/namespace/index.js +2 -0
  58. package/dist/queries/namespace/read-designated-node.js +12 -0
  59. package/dist/queries/namespace/read-view-aliases.js +46 -0
  60. package/dist/queries/user/index.js +1 -5
  61. package/dist/queries/user/read-user-profile.js +9 -0
  62. package/dist/queries/view-access/index.js +1 -0
  63. package/dist/queries/view-access/read-view-access.js +35 -0
  64. package/dist/runtime.d.ts +1603 -6784
  65. package/dist/runtime.js +24 -14
  66. package/dist/schema/index.d.ts +7 -6
  67. package/dist/schema/index.js +6 -6
  68. package/dist/schema/modules/application/functions/index.d.ts +1 -0
  69. package/dist/schema/modules/application/functions/index.js +1 -0
  70. package/dist/schema/modules/application/functions/list-entrypoints.d.ts +15 -0
  71. package/dist/schema/modules/application/functions/list-entrypoints.js +16 -0
  72. package/dist/schema/modules/application/index.d.ts +2 -0
  73. package/dist/schema/modules/application/index.js +2 -0
  74. package/dist/schema/modules/application/types/entrypoint-entry.d.ts +8 -0
  75. package/dist/schema/modules/application/types/entrypoint-entry.js +7 -0
  76. package/dist/schema/modules/application/types/index.d.ts +1 -0
  77. package/dist/schema/modules/application/types/index.js +1 -0
  78. package/dist/schema/modules/group/classes/group.d.ts +24 -0
  79. package/dist/schema/modules/group/classes/group.js +11 -0
  80. package/dist/schema/modules/group/classes/index.d.ts +2 -0
  81. package/dist/schema/modules/group/classes/index.js +2 -0
  82. package/dist/schema/modules/group/classes/member-of-group.d.ts +30 -0
  83. package/dist/schema/modules/group/classes/member-of-group.js +12 -0
  84. package/dist/schema/modules/group/core/administrators-group.d.ts +1 -0
  85. package/dist/schema/modules/group/core/administrators-group.js +6 -0
  86. package/dist/schema/modules/group/core/applications-group.d.ts +1 -0
  87. package/dist/schema/modules/group/core/applications-group.js +6 -0
  88. package/dist/schema/modules/group/core/index.d.ts +3 -0
  89. package/dist/schema/modules/group/core/index.js +3 -0
  90. package/dist/schema/modules/group/core/members-group.d.ts +1 -0
  91. package/dist/schema/modules/group/core/members-group.js +6 -0
  92. package/dist/schema/modules/group/functions/assign-member-to-group.js +11 -0
  93. package/dist/schema/modules/group/functions/index.js +2 -0
  94. package/dist/schema/modules/group/functions/unassign-member-from-group.js +11 -0
  95. package/dist/schema/modules/group/index.d.ts +3 -0
  96. package/dist/schema/modules/group/index.js +3 -0
  97. package/dist/schema/modules/group/policies/belongs-to-group.d.ts +1 -0
  98. package/dist/schema/modules/group/policies/belongs-to-group.js +5 -0
  99. package/dist/schema/modules/group/policies/index.d.ts +1 -0
  100. package/dist/schema/modules/group/policies/index.js +1 -0
  101. package/dist/schema/modules/group/types/group-membership-input.js +8 -0
  102. package/dist/schema/modules/group/types/index.js +1 -0
  103. package/dist/schema/modules/namespace/classes/alias.d.ts +31 -0
  104. package/dist/schema/modules/namespace/classes/alias.js +13 -0
  105. package/dist/schema/modules/namespace/classes/index.d.ts +2 -0
  106. package/dist/schema/modules/namespace/classes/index.js +2 -0
  107. package/dist/schema/modules/namespace/classes/namespace.d.ts +31 -0
  108. package/dist/schema/modules/namespace/classes/namespace.js +10 -0
  109. package/dist/schema/modules/namespace/core/index.d.ts +1 -0
  110. package/dist/schema/modules/namespace/core/index.js +1 -0
  111. package/dist/schema/modules/namespace/core/views-namespace.d.ts +2 -0
  112. package/dist/schema/modules/namespace/core/views-namespace.js +7 -0
  113. package/dist/schema/modules/namespace/functions/index.js +3 -0
  114. package/dist/schema/modules/namespace/functions/link.js +11 -0
  115. package/dist/schema/modules/namespace/functions/rename.js +11 -0
  116. package/dist/schema/modules/namespace/functions/unlink.js +11 -0
  117. package/dist/schema/modules/namespace/index.d.ts +2 -0
  118. package/dist/schema/modules/namespace/index.js +2 -0
  119. package/dist/schema/modules/namespace/types/index.js +1 -0
  120. package/dist/schema/modules/namespace/types/namespace-name.js +7 -0
  121. package/dist/schema/modules/user/classes/index.d.ts +1 -0
  122. package/dist/schema/modules/user/classes/index.js +1 -0
  123. package/dist/schema/modules/user/classes/user.d.ts +34 -0
  124. package/dist/schema/modules/user/classes/user.js +21 -0
  125. package/dist/schema/modules/user/functions/index.js +2 -0
  126. package/dist/schema/modules/user/functions/invite-user.js +12 -0
  127. package/dist/schema/modules/user/functions/record-profile.js +14 -0
  128. package/dist/schema/modules/user/index.d.ts +2 -0
  129. package/dist/schema/modules/user/index.js +2 -0
  130. package/dist/schema/modules/user/types/index.d.ts +2 -0
  131. package/dist/schema/modules/user/types/index.js +2 -0
  132. package/dist/schema/modules/user/types/invitation-summary.d.ts +16 -0
  133. package/dist/schema/modules/user/types/invitation-summary.js +15 -0
  134. package/dist/schema/modules/user/types/user-profile.d.ts +7 -0
  135. package/dist/schema/modules/user/types/user-profile.js +7 -0
  136. package/dist/schema/modules/view-access/classes/index.d.ts +1 -0
  137. package/dist/schema/modules/view-access/classes/index.js +1 -0
  138. package/dist/schema/modules/view-access/classes/view-access.d.ts +32 -0
  139. package/dist/schema/modules/view-access/classes/view-access.js +18 -0
  140. package/dist/schema/modules/view-access/core/index.d.ts +1 -0
  141. package/dist/schema/modules/view-access/core/index.js +1 -0
  142. package/dist/schema/modules/view-access/core/view-only-group.d.ts +5 -0
  143. package/dist/schema/modules/view-access/core/view-only-group.js +10 -0
  144. package/dist/schema/modules/view-access/functions/assign-views.d.ts +16 -0
  145. package/dist/schema/modules/view-access/functions/assign-views.js +17 -0
  146. package/dist/schema/modules/view-access/functions/index.d.ts +1 -0
  147. package/dist/schema/modules/view-access/functions/index.js +1 -0
  148. package/dist/schema/modules/view-access/index.d.ts +3 -0
  149. package/dist/schema/modules/view-access/index.js +3 -0
  150. package/dist/schema/modules/view-access/types/index.js +1 -0
  151. package/dist/schema/modules/view-access/types/view-assignment.js +16 -0
  152. package/dist/schema/policies/administers-shell-class.js +11 -0
  153. package/dist/schema/policies/index.js +4 -0
  154. package/dist/schema/policies/is-self.js +5 -0
  155. package/dist/schema/policies/owns-class.js +7 -0
  156. package/dist/schema/policies/uses-function.js +5 -0
  157. package/dist/schema/schema.d.ts +833 -0
  158. package/dist/schema/schema.js +35 -0
  159. package/dist/schema/views/application-view.js +4 -0
  160. package/dist/schema/views/index.js +1 -0
  161. package/dist/utils/canonical-node-path/index.js +1 -0
  162. package/dist/utils/canonical-node-path/parse-canonical-node-path.js +8 -0
  163. package/package.json +49 -9
  164. package/dist/actions/index.js +0 -1
  165. package/dist/actions/user/index.js +0 -1
  166. package/dist/actions/user/resolve-home.js +0 -19
  167. package/dist/application.d.ts +0 -9809
  168. package/dist/application.js +0 -29
  169. package/dist/mutations/group/membership.js +0 -19
  170. package/dist/mutations/space/access.js +0 -23
  171. package/dist/mutations/space/default.js +0 -23
  172. package/dist/mutations/space/index.js +0 -2
  173. package/dist/mutations/user/repair.js +0 -83
  174. package/dist/queries/space/access.js +0 -12
  175. package/dist/queries/space/admin.js +0 -20
  176. package/dist/queries/space/index.js +0 -3
  177. package/dist/queries/space/member.js +0 -17
  178. package/dist/queries/user/groups.js +0 -17
  179. package/dist/queries/user/home.js +0 -21
  180. package/dist/queries/user/owned-spaces.js +0 -17
  181. package/dist/queries/user/profile.js +0 -14
  182. package/dist/queries/user/setup.js +0 -16
  183. package/dist/schema/domain/index.d.ts +0 -1665
  184. package/dist/schema/domain/index.js +0 -39
  185. package/dist/schema/group/class.d.ts +0 -323
  186. package/dist/schema/group/class.js +0 -7
  187. package/dist/schema/group/core.d.ts +0 -10
  188. package/dist/schema/group/core.js +0 -14
  189. package/dist/schema/group/index.d.ts +0 -6
  190. package/dist/schema/group/index.js +0 -6
  191. package/dist/schema/group/methods.d.ts +0 -13
  192. package/dist/schema/group/methods.js +0 -22
  193. package/dist/schema/group/policies.d.ts +0 -1
  194. package/dist/schema/group/policies.js +0 -6
  195. package/dist/schema/group/relationships.d.ts +0 -16
  196. package/dist/schema/group/relationships.js +0 -8
  197. package/dist/schema/group/view.d.ts +0 -1
  198. package/dist/schema/group/view.js +0 -6
  199. package/dist/schema/home/index.d.ts +0 -1
  200. package/dist/schema/home/index.js +0 -1
  201. package/dist/schema/home/view.d.ts +0 -1
  202. package/dist/schema/home/view.js +0 -4
  203. package/dist/schema/setup/functions.d.ts +0 -28
  204. package/dist/schema/setup/functions.js +0 -27
  205. package/dist/schema/setup/index.d.ts +0 -1
  206. package/dist/schema/setup/index.js +0 -1
  207. package/dist/schema/space/class.d.ts +0 -80
  208. package/dist/schema/space/class.js +0 -11
  209. package/dist/schema/space/core.d.ts +0 -8
  210. package/dist/schema/space/core.js +0 -15
  211. package/dist/schema/space/index.d.ts +0 -6
  212. package/dist/schema/space/index.js +0 -6
  213. package/dist/schema/space/methods.d.ts +0 -18
  214. package/dist/schema/space/methods.js +0 -32
  215. package/dist/schema/space/policies.d.ts +0 -4
  216. package/dist/schema/space/policies.js +0 -21
  217. package/dist/schema/space/relationships.d.ts +0 -64
  218. package/dist/schema/space/relationships.js +0 -24
  219. package/dist/schema/space/view.d.ts +0 -1
  220. package/dist/schema/space/view.js +0 -6
  221. package/dist/schema/user/class.d.ts +0 -278
  222. package/dist/schema/user/class.js +0 -11
  223. package/dist/schema/user/index.d.ts +0 -3
  224. package/dist/schema/user/index.js +0 -3
  225. package/dist/schema/user/methods.d.ts +0 -7
  226. package/dist/schema/user/methods.js +0 -11
  227. package/dist/schema/user/view.d.ts +0 -1
  228. package/dist/schema/user/view.js +0 -6
  229. package/dist/workflows/group/assign.js +0 -3
  230. package/dist/workflows/group/change.js +0 -31
  231. package/dist/workflows/group/index.js +0 -3
  232. package/dist/workflows/group/unassign.js +0 -3
  233. package/dist/workflows/index.js +0 -3
  234. package/dist/workflows/setup/admin.js +0 -3
  235. package/dist/workflows/setup/index.js +0 -5
  236. package/dist/workflows/setup/member.js +0 -3
  237. package/dist/workflows/setup/plan.js +0 -88
  238. package/dist/workflows/setup/provision.js +0 -57
  239. package/dist/workflows/setup/run.js +0 -74
  240. package/dist/workflows/space/access.js +0 -41
  241. package/dist/workflows/space/add.js +0 -3
  242. package/dist/workflows/space/default.js +0 -37
  243. package/dist/workflows/space/index.js +0 -4
  244. package/dist/workflows/space/remove.js +0 -3
@@ -0,0 +1,12 @@
1
+ import { method, path } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { ownsClass, administersShellClass } from '../../../policies/index.js';
4
+ import { User } from '../classes/index.js';
5
+ import { invitationSummary } from '../types/index.js';
6
+ export const invite = method({
7
+ static: true,
8
+ auth: 'authorized',
9
+ input: z.object({ user: path(() => User), email: z.string().min(3).max(320) }),
10
+ output: invitationSummary,
11
+ policy: ({ anyOf, check, input }) => anyOf(check(administersShellClass, input.user), check(ownsClass, input.user)),
12
+ });
@@ -0,0 +1,14 @@
1
+ import { method } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { isSelf } from '../../../policies/index.js';
4
+ import { userDisplayName, userEmail } from '../types/index.js';
5
+ export const recordProfile = method({
6
+ description: 'Record the email and display name this account signs in with; only the account itself may.',
7
+ auth: 'authorized',
8
+ input: z.strictObject({
9
+ email: userEmail.optional(),
10
+ displayName: userDisplayName.optional(),
11
+ }),
12
+ output: z.object({}),
13
+ policy: ({ check, self }) => check(isSelf, self),
14
+ });
@@ -0,0 +1,2 @@
1
+ export { User } from './classes/index.js';
2
+ export { invitationSummary, type InvitationSummary } from './types/index.js';
@@ -0,0 +1,2 @@
1
+ export { User } from './classes/index.js';
2
+ export { invitationSummary } from './types/index.js';
@@ -0,0 +1,2 @@
1
+ export { invitationSummary, type InvitationSummary } from './invitation-summary.js';
2
+ export { userEmail, userDisplayName } from './user-profile.js';
@@ -0,0 +1,2 @@
1
+ export { invitationSummary } from './invitation-summary.js';
2
+ export { userEmail, userDisplayName } from './user-profile.js';
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ export declare const invitationSummary: z.ZodObject<{
3
+ invitationId: z.ZodString;
4
+ user: z.ZodString;
5
+ state: z.ZodEnum<{
6
+ accepted: "accepted";
7
+ cancelled: "cancelled";
8
+ completed: "completed";
9
+ expired: "expired";
10
+ failed: "failed";
11
+ pending: "pending";
12
+ registered: "registered";
13
+ registering: "registering";
14
+ }>;
15
+ }, z.core.$strip>;
16
+ export type InvitationSummary = z.infer<typeof invitationSummary>;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ export const invitationSummary = z.object({
3
+ invitationId: z.string().min(1),
4
+ user: z.string().min(1),
5
+ state: z.enum([
6
+ 'pending',
7
+ 'accepted',
8
+ 'registering',
9
+ 'registered',
10
+ 'completed',
11
+ 'cancelled',
12
+ 'expired',
13
+ 'failed',
14
+ ]),
15
+ });
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What an account says about itself, to be recognised in the directory: its sign-in email and its
4
+ * name. The account writes them, so they name it for display and decide nothing.
5
+ */
6
+ export declare const userEmail: z.ZodString;
7
+ export declare const userDisplayName: z.ZodString;
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What an account says about itself, to be recognised in the directory: its sign-in email and its
4
+ * name. The account writes them, so they name it for display and decide nothing.
5
+ */
6
+ export const userEmail = z.string().min(3).max(320);
7
+ export const userDisplayName = z.string().min(1).max(200);
@@ -0,0 +1 @@
1
+ export { view_access } from './view-access.js';
@@ -0,0 +1 @@
1
+ export { view_access } from './view-access.js';
@@ -0,0 +1,32 @@
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.
6
+ */
7
+ export declare const view_access: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
8
+ readonly depth: 0;
9
+ readonly abstract: false;
10
+ readonly extends: readonly [];
11
+ readonly properties: never;
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;
20
+ })[];
21
+ readonly outgoing: "0..*";
22
+ };
23
+ readonly target: {
24
+ readonly as: "view";
25
+ readonly accepts: readonly (import("@astrale-os/sdk/schema").ClassRef<"View"> & {
26
+ readonly origin: "kernel.astrale.ai";
27
+ })[];
28
+ readonly incoming: "0..*";
29
+ };
30
+ readonly constraints: Record<never, never>;
31
+ readonly effectiveProperties: never;
32
+ }>;
@@ -0,0 +1,18 @@
1
+ import { K, edgeClass } from '@astrale-os/sdk/schema';
2
+ import { Group } from '../../group/index.js';
3
+ import { User } from '../../user/index.js';
4
+ /**
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.
9
+ */
10
+ export const view_access = edgeClass.directed({
11
+ policies: { read: true, traverse: true },
12
+ source: {
13
+ as: 'holder',
14
+ accepts: [() => User, () => Group],
15
+ outgoing: '0..*',
16
+ },
17
+ target: { as: 'view', accepts: [K.classes.View], incoming: '0..*' },
18
+ });
@@ -0,0 +1 @@
1
+ export { viewOnlyGroup } from './view-only-group.js';
@@ -0,0 +1 @@
1
+ export { viewOnlyGroup } from './view-only-group.js';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Its members open only the Views given to them, never the workspace. Administrators keep the
3
+ * workspace even when they are members.
4
+ */
5
+ export declare const viewOnlyGroup: import("@astrale-os/sdk/schema").CoreNode;
@@ -0,0 +1,10 @@
1
+ import { K, core } from '@astrale-os/sdk/schema';
2
+ import { Group } from '../../group/index.js';
3
+ /**
4
+ * Its members open only the Views given to them, never the workspace. Administrators keep the
5
+ * workspace even when they are members.
6
+ */
7
+ export const viewOnlyGroup = core.node(() => Group, {
8
+ [K.classes.Named.properties.name.key]: 'View only',
9
+ [K.classes.Descriptable.properties.description.key]: 'Open only the Views given to them, never the workspace.',
10
+ });
@@ -0,0 +1,16 @@
1
+ import { type Function as SchemaFunction } from '@astrale-os/sdk/schema';
2
+ /**
3
+ * Give Views to identities and withdraw others, in one write. Each identity is a User or a Group;
4
+ * a View already given, or already withdrawn, stays as it is. Whether an identity opens the
5
+ * workspace is its `view-only` membership, which `Group.assignMember` changes.
6
+ */
7
+ export declare const assignViews: SchemaFunction<import("@astrale-os/sdk/schema").CallableProjection<{
8
+ assignments: {
9
+ identity: string;
10
+ set?: string[] | undefined;
11
+ unset?: string[] | undefined;
12
+ }[];
13
+ }, {
14
+ readonly mode: 'value';
15
+ readonly value: Record<string, never>;
16
+ }, "authorized", false, false, undefined, undefined>>;
@@ -0,0 +1,17 @@
1
+ import { func } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { usesFunction } from '../../../policies/index.js';
4
+ import { MAX_ASSIGNMENTS, viewAssignment } from '../types/index.js';
5
+ /**
6
+ * Give Views to identities and withdraw others, in one write. Each identity is a User or a Group;
7
+ * a View already given, or already withdrawn, stays as it is. Whether an identity opens the
8
+ * workspace is its `view-only` membership, which `Group.assignMember` changes.
9
+ */
10
+ export const assignViews = func({
11
+ description: 'Give and withdraw Views for each identity, in one write.',
12
+ auth: 'authorized',
13
+ input: z.strictObject({ assignments: z.array(viewAssignment).min(1).max(MAX_ASSIGNMENTS) }),
14
+ output: z.object({}),
15
+ // Holding can_use is enough: Core admin holds it, and may share it.
16
+ policy: ({ check, ref }) => check(usesFunction, ref(() => assignViews)),
17
+ });
@@ -0,0 +1 @@
1
+ export { assignViews } from './assign-views.js';
@@ -0,0 +1 @@
1
+ export { assignViews } from './assign-views.js';
@@ -0,0 +1,3 @@
1
+ export { view_access } from './classes/index.js';
2
+ export { viewOnlyGroup } from './core/index.js';
3
+ export { assignViews } from './functions/index.js';
@@ -0,0 +1,3 @@
1
+ export { view_access } from './classes/index.js';
2
+ export { viewOnlyGroup } from './core/index.js';
3
+ export { assignViews } from './functions/index.js';
@@ -0,0 +1 @@
1
+ export { viewAssignment, MAX_ASSIGNED_VIEWS, MAX_ASSIGNMENTS } from './view-assignment.js';
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Bounds that keep one call within the Kernel's Mutation limits: at most 1,600 Edge operations
4
+ * and 1,640 locators, under 2,048 each.
5
+ */
6
+ export const MAX_ASSIGNED_VIEWS = 20;
7
+ export const MAX_ASSIGNMENTS = 40;
8
+ // A Path inside a list is not a callable Path input: each is an exact @NodeId the Action checks.
9
+ const nodeId = z.string().min(2).max(512);
10
+ const views = z.array(nodeId).max(MAX_ASSIGNED_VIEWS);
11
+ /** The Views given to one User or Group (`set`) and withdrawn from it (`unset`), by @NodeId. */
12
+ export const viewAssignment = z.strictObject({
13
+ identity: nodeId,
14
+ set: views.optional(),
15
+ unset: views.optional(),
16
+ });
@@ -0,0 +1,11 @@
1
+ import { K, policy } from '@astrale-os/sdk/schema';
2
+ import { Group, member_of_group, adminGroup } from '../modules/group/index.js';
3
+ /** Instance administration applies to Shell's concrete classes, not foreign descendants. */
4
+ export const administersShellClass = policy({
5
+ match: ({ exists, subject, object, ref, edge, allOf }) => exists(({ node }) => {
6
+ const concrete = node();
7
+ const owner = node(); // of_domain restricts this witness to a protected Domain endpoint.
8
+ const group = ref(() => Group);
9
+ return allOf(edge({ source: subject, class: () => member_of_group, target: ref(adminGroup) }), { source: ref(adminGroup), 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 });
10
+ }),
11
+ });
@@ -0,0 +1,4 @@
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';
@@ -0,0 +1,5 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ /** The subject is the object itself: an account acting on its own Node. */
3
+ export const isSelf = policy({
4
+ match: ({ sameNode, subject, object }) => sameNode(subject, object),
5
+ });
@@ -0,0 +1,7 @@
1
+ import { K, policy } from '@astrale-os/sdk/schema';
2
+ export const ownsClass = policy({
3
+ match: ({ exists, subject, object, allOf }) => exists(({ node }) => {
4
+ const concrete = node(); // Périmètre défini par les deux edges kernel protégés.
5
+ return allOf({ source: object, class: K.classes.instance_of.ref, target: concrete }, { source: concrete, class: K.classes.of_domain.ref, target: subject });
6
+ }),
7
+ });
@@ -0,0 +1,5 @@
1
+ import { K, policy } from '@astrale-os/sdk/schema';
2
+ /** The subject may use the object Function: its own or a composed Identity holds can_use on it. */
3
+ export const usesFunction = policy({
4
+ match: ({ edge, subject, object }) => edge({ source: subject, class: () => K.classes.can_use, target: object }),
5
+ });