@astrale-domains/shell 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -173
- package/dist/domain.d.ts +499 -31
- package/dist/domain.js +99 -78
- package/dist/functions/application/index.js +2 -1
- package/dist/functions/application/legacy/index.js +1 -0
- package/dist/functions/application/legacy/list-entrypoints.js +8 -0
- package/dist/functions/authority/capabilities.js +1 -0
- package/dist/functions/authority/composition.js +47 -0
- package/dist/functions/authority/index.js +2 -0
- package/dist/functions/authority/roles.js +113 -0
- package/dist/functions/directory/disconnect-directory.js +35 -0
- package/dist/functions/directory/index.js +1 -0
- package/dist/functions/group/assign-member.js +7 -0
- package/dist/functions/group/change-group-membership.js +101 -20
- package/dist/functions/group/create-group.js +23 -0
- package/dist/functions/group/delete-group.js +33 -0
- package/dist/functions/group/deprovision-group.js +27 -0
- package/dist/functions/group/group-errors.js +43 -0
- package/dist/functions/group/group-membership-errors.js +3 -1
- package/dist/functions/group/group.js +51 -0
- package/dist/functions/group/index.js +8 -2
- package/dist/functions/group/legacy/index.js +1 -0
- package/dist/functions/group/legacy/membership.js +64 -0
- package/dist/functions/group/membership-laws.js +37 -0
- package/dist/functions/group/provision-group.js +33 -0
- package/dist/functions/group/unassign-member.js +7 -0
- package/dist/functions/group/update-group.js +55 -0
- package/dist/functions/invitation/index.js +2 -0
- package/dist/functions/invitation/invitation-errors.js +13 -0
- package/dist/functions/invitation/invitation-methods.js +41 -0
- package/dist/functions/invitation/send-invitation.js +131 -0
- package/dist/functions/user/account.js +35 -0
- package/dist/functions/user/create-user.js +45 -0
- package/dist/functions/user/deactivate-user.js +19 -0
- package/dist/functions/user/delete-user.js +34 -0
- package/dist/functions/user/deprovision-user.js +21 -0
- package/dist/functions/user/index.js +15 -1
- package/dist/functions/user/invite-errors.js +18 -0
- package/dist/functions/user/invite-user.js +42 -34
- package/dist/functions/user/legacy/claimed-account.js +11 -0
- package/dist/functions/user/legacy/index.js +4 -0
- package/dist/functions/user/legacy/invite.js +20 -0
- package/dist/functions/user/legacy/migrate-accounts.js +98 -0
- package/dist/functions/user/legacy/record-profile.js +19 -0
- package/dist/functions/user/protect-administrators.js +16 -0
- package/dist/functions/user/provision-user.js +70 -0
- package/dist/functions/user/reactivate-user.js +19 -0
- package/dist/functions/user/read-account.js +12 -0
- package/dist/functions/user/request-invitation.js +17 -0
- package/dist/functions/user/update-profile.js +22 -0
- package/dist/functions/user/update-user.js +68 -0
- package/dist/functions/user/user-errors.js +69 -0
- package/dist/functions/user/write-account.js +57 -0
- package/dist/functions/view-access/index.js +2 -1
- package/dist/functions/view-access/{assign-views.js → legacy/assign-views.js} +11 -7
- package/dist/functions/view-access/legacy/index.js +1 -0
- package/dist/functions/view-access/{view-access-errors.js → legacy/view-access-errors.js} +5 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/integrations/user-invitation/invite-user-request.d.ts +6 -0
- package/dist/legacy/index.js +1 -0
- package/dist/legacy/release.js +33 -0
- package/dist/mutations/composition/grant-role.js +13 -0
- package/dist/mutations/composition/index.js +1 -0
- package/dist/mutations/group/index.js +1 -1
- package/dist/mutations/group/legacy/index.js +1 -0
- package/dist/mutations/group/legacy/membership-class.js +7 -0
- package/dist/mutations/group/set-group-membership.js +60 -19
- package/dist/mutations/identity/create-profile.js +37 -0
- package/dist/mutations/identity/delete-identity.js +28 -0
- package/dist/mutations/identity/index.js +4 -0
- package/dist/mutations/identity/write-account.js +109 -0
- package/dist/mutations/identity/write-group.js +72 -0
- package/dist/mutations/invitation/index.js +1 -0
- package/dist/mutations/invitation/write-invitation.js +79 -0
- package/dist/mutations/user/legacy/index.js +1 -0
- package/dist/mutations/user/{record-user-profile.js → legacy/record-user-profile.js} +5 -2
- package/dist/providers/admin-enrollment/create-admin-enrollment-provider.js +6 -3
- package/dist/providers/admin-enrollment/legacy/index.js +1 -0
- package/dist/providers/admin-enrollment/legacy/send-without-profile.js +16 -0
- package/dist/queries/application/legacy/index.js +1 -0
- package/dist/queries/application/legacy/read-installed-entrypoints.js +47 -0
- package/dist/queries/composition/index.js +2 -0
- package/dist/queries/composition/read-extensions.js +34 -0
- package/dist/queries/composition/read-role-nodes.js +76 -0
- package/dist/queries/group/index.js +2 -1
- package/dist/queries/group/legacy/index.js +3 -0
- package/dist/queries/group/legacy/read-core-groups.js +46 -0
- package/dist/queries/group/legacy/read-member-of-group.js +24 -0
- package/dist/queries/group/legacy/read-members-of-group.js +27 -0
- package/dist/queries/group/read-group-members.js +73 -0
- package/dist/queries/group/read-group-membership-endpoints.js +11 -0
- package/dist/queries/group/read-group-membership.js +6 -21
- package/dist/queries/identity/index.js +1 -0
- package/dist/queries/identity/read-identities.js +29 -0
- package/dist/queries/invitation/index.js +1 -0
- package/dist/queries/invitation/read-invitation.js +50 -0
- package/dist/queries/profile/index.js +1 -0
- package/dist/queries/profile/read-profile.js +15 -0
- package/dist/queries/role/index.js +1 -0
- package/dist/queries/role/read-role-node.js +21 -0
- package/dist/queries/user/legacy/index.js +1 -0
- package/dist/queries/user/legacy/read-user-profile.js +27 -0
- package/dist/runtime.d.ts +20147 -466
- package/dist/runtime.js +34 -7
- package/dist/schema/index.d.ts +7 -4
- package/dist/schema/index.js +8 -4
- package/dist/schema/legacy/index.js +1 -0
- package/dist/schema/legacy/schema.js +32 -0
- package/dist/schema/modules/application/legacy/entrypoint-entry.js +11 -0
- package/dist/schema/modules/application/legacy/functions/index.js +1 -0
- package/dist/schema/modules/application/legacy/functions/list-entrypoints.js +22 -0
- package/dist/schema/modules/application/legacy/index.js +2 -0
- package/dist/schema/modules/directory/functions/disconnect-directory.d.ts +13 -0
- package/dist/schema/modules/directory/functions/disconnect-directory.js +15 -0
- package/dist/schema/modules/directory/functions/index.d.ts +1 -0
- package/dist/schema/modules/directory/functions/index.js +1 -0
- package/dist/schema/modules/directory/index.d.ts +1 -0
- package/dist/schema/modules/directory/index.js +1 -0
- package/dist/schema/modules/group/classes/group-profile-link.d.ts +34 -0
- package/dist/schema/modules/group/classes/group-profile-link.js +21 -0
- package/dist/schema/modules/group/classes/group-profile.d.ts +15 -0
- package/dist/schema/modules/group/classes/group-profile.js +20 -0
- package/dist/schema/modules/group/classes/group.d.ts +87 -1
- package/dist/schema/modules/group/classes/group.js +38 -7
- package/dist/schema/modules/group/classes/index.d.ts +2 -1
- package/dist/schema/modules/group/classes/index.js +3 -1
- package/dist/schema/modules/group/functions/assign-member.js +17 -0
- package/dist/schema/modules/group/functions/assign-members.js +17 -0
- package/dist/schema/modules/group/functions/create-group.js +20 -0
- package/dist/schema/modules/group/functions/delete-group.js +12 -0
- package/dist/schema/modules/group/functions/deprovision-group.js +14 -0
- package/dist/schema/modules/group/functions/index.js +9 -2
- package/dist/schema/modules/group/functions/provision-group.js +14 -0
- package/dist/schema/modules/group/functions/unassign-member.js +17 -0
- package/dist/schema/modules/group/functions/unassign-members.js +17 -0
- package/dist/schema/modules/group/functions/update-group.js +20 -0
- package/dist/schema/modules/group/index.d.ts +3 -3
- package/dist/schema/modules/group/index.js +4 -3
- package/dist/schema/modules/group/legacy/admission.d.ts +9 -0
- package/dist/schema/modules/group/legacy/admission.js +9 -0
- package/dist/schema/modules/group/legacy/classes/index.d.ts +1 -0
- package/dist/schema/modules/group/legacy/classes/index.js +1 -0
- package/dist/schema/modules/group/{classes → legacy/classes}/member-of-group.d.ts +10 -1
- package/dist/schema/modules/group/legacy/classes/member-of-group.js +32 -0
- package/dist/schema/modules/group/legacy/core-groups.d.ts +22 -0
- package/dist/schema/modules/group/legacy/core-groups.js +28 -0
- package/dist/schema/modules/group/legacy/index.d.ts +5 -0
- package/dist/schema/modules/group/legacy/index.js +6 -0
- package/dist/schema/modules/group/legacy/policies/belongs-to-group.d.ts +5 -0
- package/dist/schema/modules/group/legacy/policies/belongs-to-group.js +9 -0
- package/dist/schema/modules/group/legacy/policies/index.d.ts +2 -0
- package/dist/schema/modules/group/legacy/policies/index.js +2 -0
- package/dist/schema/modules/group/legacy/policies/owns-membership-group.d.ts +6 -0
- package/dist/schema/modules/group/legacy/policies/owns-membership-group.js +12 -0
- package/dist/schema/modules/group/legacy/relaxations.d.ts +21 -0
- package/dist/schema/modules/group/legacy/relaxations.js +27 -0
- package/dist/schema/modules/group/policies/describes-group-of-subject.d.ts +2 -0
- package/dist/schema/modules/group/policies/describes-group-of-subject.js +7 -0
- package/dist/schema/modules/group/policies/index.d.ts +2 -1
- package/dist/schema/modules/group/policies/index.js +2 -1
- package/dist/schema/modules/group/policies/is-group-profile-source.d.ts +2 -0
- package/dist/schema/modules/group/policies/is-group-profile-source.js +6 -0
- package/dist/schema/modules/group/types/group-membership-input.js +8 -0
- package/dist/schema/modules/group/types/group.js +10 -0
- package/dist/schema/modules/group/types/index.js +2 -1
- package/dist/schema/modules/invitation/classes/index.js +2 -0
- package/dist/schema/modules/invitation/classes/invitation-user.js +17 -0
- package/dist/schema/modules/invitation/classes/invitation.js +32 -0
- package/dist/schema/modules/invitation/functions/accept.js +16 -0
- package/dist/schema/modules/invitation/functions/cancel.js +12 -0
- package/dist/schema/modules/invitation/functions/index.js +4 -0
- package/dist/schema/modules/invitation/functions/resend.js +12 -0
- package/dist/schema/modules/invitation/functions/send.js +20 -0
- package/dist/schema/modules/invitation/index.js +2 -0
- package/dist/schema/modules/invitation/types/index.js +1 -0
- package/dist/schema/modules/invitation/types/invitation-status.js +5 -0
- package/dist/schema/modules/namespace/classes/alias.d.ts +2 -1
- package/dist/schema/modules/namespace/classes/alias.js +11 -2
- package/dist/schema/modules/namespace/functions/link.js +3 -2
- package/dist/schema/modules/namespace/functions/rename.js +3 -2
- package/dist/schema/modules/namespace/functions/unlink.js +3 -2
- package/dist/schema/modules/role/classes/index.d.ts +1 -0
- package/dist/schema/modules/role/classes/index.js +1 -0
- package/dist/schema/modules/role/classes/role.d.ts +16 -0
- package/dist/schema/modules/role/classes/role.js +19 -0
- package/dist/schema/modules/role/core/index.d.ts +1 -0
- package/dist/schema/modules/role/core/index.js +1 -0
- package/dist/schema/modules/role/core/roles.d.ts +39 -0
- package/dist/schema/modules/role/core/roles.js +31 -0
- package/dist/schema/modules/role/index.d.ts +2 -0
- package/dist/schema/modules/role/index.js +2 -0
- package/dist/schema/modules/user/classes/index.d.ts +2 -0
- package/dist/schema/modules/user/classes/index.js +3 -0
- package/dist/schema/modules/user/classes/user-profile-link.d.ts +35 -0
- package/dist/schema/modules/user/classes/user-profile-link.js +22 -0
- package/dist/schema/modules/user/classes/user-profile.d.ts +41 -0
- package/dist/schema/modules/user/classes/user-profile.js +30 -0
- package/dist/schema/modules/user/classes/user.d.ts +133 -8
- package/dist/schema/modules/user/classes/user.js +46 -15
- package/dist/schema/modules/user/functions/create-user.js +21 -0
- package/dist/schema/modules/user/functions/deactivate-user.js +12 -0
- package/dist/schema/modules/user/functions/delete-user.js +12 -0
- package/dist/schema/modules/user/functions/deprovision-user.js +14 -0
- package/dist/schema/modules/user/functions/index.js +8 -1
- package/dist/schema/modules/user/functions/invite-user.js +23 -4
- package/dist/schema/modules/user/functions/provision-user.js +25 -0
- package/dist/schema/modules/user/functions/reactivate-user.js +12 -0
- package/dist/schema/modules/user/functions/update-profile.js +16 -0
- package/dist/schema/modules/user/functions/update-user.js +22 -0
- package/dist/schema/modules/user/index.d.ts +2 -1
- package/dist/schema/modules/user/index.js +2 -1
- package/dist/schema/modules/user/legacy/account-properties.js +24 -0
- package/dist/schema/modules/user/legacy/functions/index.js +2 -0
- package/dist/schema/modules/user/legacy/functions/migrate-accounts.js +23 -0
- package/dist/schema/modules/user/legacy/functions/record-profile.js +18 -0
- package/dist/schema/modules/user/legacy/index.js +5 -0
- package/dist/schema/modules/user/legacy/invite.js +15 -0
- package/dist/schema/modules/user/legacy/relaxations.js +37 -0
- package/dist/schema/modules/user/policies/describes-subject.d.ts +2 -0
- package/dist/schema/modules/user/policies/describes-subject.js +7 -0
- package/dist/schema/modules/user/policies/index.d.ts +2 -0
- package/dist/schema/modules/user/policies/index.js +2 -0
- package/dist/schema/modules/user/policies/is-profile-source.d.ts +2 -0
- package/dist/schema/modules/user/policies/is-profile-source.js +6 -0
- package/dist/schema/modules/user/types/account.d.ts +12 -0
- package/dist/schema/modules/user/types/account.js +12 -0
- package/dist/schema/modules/user/types/index.d.ts +1 -1
- package/dist/schema/modules/user/types/index.js +1 -1
- package/dist/schema/modules/view-access/classes/view-access.d.ts +7 -11
- package/dist/schema/modules/view-access/classes/view-access.js +17 -12
- package/dist/schema/modules/view-access/index.d.ts +1 -2
- package/dist/schema/modules/view-access/index.js +1 -2
- package/dist/schema/modules/view-access/legacy/functions/assign-views.js +22 -0
- package/dist/schema/modules/view-access/legacy/functions/index.js +1 -0
- package/dist/schema/modules/view-access/legacy/index.js +2 -0
- package/dist/schema/modules/view-access/legacy/view-assignment.js +24 -0
- package/dist/schema/modules/view-access/policies/holds-view-access.d.ts +2 -0
- package/dist/schema/modules/view-access/policies/holds-view-access.js +5 -0
- package/dist/schema/modules/view-access/policies/index.d.ts +1 -0
- package/dist/schema/modules/view-access/policies/index.js +1 -0
- package/dist/schema/policies/has-role.d.ts +6 -0
- package/dist/schema/policies/has-role.js +9 -0
- package/dist/schema/policies/index.d.ts +1 -0
- package/dist/schema/policies/index.js +1 -4
- package/dist/schema/policies/legacy/administers-shell-class.js +21 -0
- package/dist/schema/policies/legacy/index.js +4 -0
- package/dist/schema/policies/legacy/is-self.js +9 -0
- package/dist/schema/policies/legacy/owns-class.js +12 -0
- package/dist/schema/policies/legacy/uses-function.js +9 -0
- package/dist/schema/schema.d.ts +1937 -119
- package/dist/schema/schema.js +35 -15
- package/dist/schema/types/attributes.js +15 -0
- package/dist/schema/types/index.js +1 -0
- package/dist/utils/attributes/attributes.js +12 -0
- package/dist/utils/attributes/index.js +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/same-json/index.js +1 -0
- package/dist/utils/same-json/same-json.js +9 -0
- package/package.json +3 -3
- package/dist/functions/application/list-entrypoints.js +0 -6
- package/dist/functions/group/assign-member-to-group.js +0 -4
- package/dist/functions/group/unassign-member-from-group.js +0 -4
- package/dist/functions/user/record-profile.js +0 -18
- package/dist/mutations/user/index.js +0 -1
- package/dist/queries/application/index.js +0 -1
- package/dist/queries/application/read-installed-entrypoints.js +0 -28
- package/dist/queries/user/index.js +0 -1
- package/dist/queries/user/read-user-profile.js +0 -9
- package/dist/schema/modules/application/functions/index.d.ts +0 -1
- package/dist/schema/modules/application/functions/index.js +0 -1
- package/dist/schema/modules/application/functions/list-entrypoints.d.ts +0 -15
- package/dist/schema/modules/application/functions/list-entrypoints.js +0 -16
- package/dist/schema/modules/application/index.d.ts +0 -2
- package/dist/schema/modules/application/index.js +0 -2
- package/dist/schema/modules/application/types/entrypoint-entry.d.ts +0 -8
- package/dist/schema/modules/application/types/entrypoint-entry.js +0 -7
- package/dist/schema/modules/application/types/index.d.ts +0 -1
- package/dist/schema/modules/application/types/index.js +0 -1
- package/dist/schema/modules/group/classes/member-of-group.js +0 -12
- package/dist/schema/modules/group/core/administrators-group.d.ts +0 -1
- package/dist/schema/modules/group/core/administrators-group.js +0 -6
- package/dist/schema/modules/group/core/applications-group.d.ts +0 -1
- package/dist/schema/modules/group/core/applications-group.js +0 -6
- package/dist/schema/modules/group/core/index.d.ts +0 -3
- package/dist/schema/modules/group/core/index.js +0 -3
- package/dist/schema/modules/group/core/members-group.d.ts +0 -1
- package/dist/schema/modules/group/core/members-group.js +0 -6
- package/dist/schema/modules/group/functions/assign-member-to-group.js +0 -11
- package/dist/schema/modules/group/functions/unassign-member-from-group.js +0 -11
- package/dist/schema/modules/group/policies/belongs-to-group.d.ts +0 -1
- package/dist/schema/modules/group/policies/belongs-to-group.js +0 -5
- package/dist/schema/modules/user/functions/record-profile.js +0 -14
- package/dist/schema/modules/user/types/user-profile.d.ts +0 -7
- package/dist/schema/modules/user/types/user-profile.js +0 -7
- package/dist/schema/modules/view-access/core/index.d.ts +0 -1
- package/dist/schema/modules/view-access/core/index.js +0 -1
- package/dist/schema/modules/view-access/core/view-only-group.d.ts +0 -5
- package/dist/schema/modules/view-access/core/view-only-group.js +0 -10
- package/dist/schema/modules/view-access/functions/assign-views.d.ts +0 -16
- package/dist/schema/modules/view-access/functions/assign-views.js +0 -17
- package/dist/schema/modules/view-access/functions/index.d.ts +0 -1
- package/dist/schema/modules/view-access/functions/index.js +0 -1
- package/dist/schema/modules/view-access/types/index.js +0 -1
- package/dist/schema/modules/view-access/types/view-assignment.js +0 -16
- package/dist/schema/policies/administers-shell-class.js +0 -11
- package/dist/schema/policies/is-self.js +0 -5
- package/dist/schema/policies/owns-class.js +0 -7
- package/dist/schema/policies/uses-function.js +0 -5
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { atomicRoles } from '../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
5
|
+
import { legacyMembershipOwnerAdmission } from '../legacy/index.js';
|
|
6
|
+
import { groupMembersInput } from '../types/index.js';
|
|
7
|
+
/** Withdraw several direct members from a group in one call (G2, G3 checked once). */
|
|
8
|
+
export const unassignMembers = method({
|
|
9
|
+
static: true,
|
|
10
|
+
description: 'Withdraw several accounts or groups from a group.',
|
|
11
|
+
auth: 'authorized',
|
|
12
|
+
input: groupMembersInput,
|
|
13
|
+
output: z.object({}),
|
|
14
|
+
policy: (context) => context.anyOf(context.check(hasRole, context.ref(atomicRoles['group.writer'])), context.check(hasRole, context.ref(atomicRoles['directory.provisioner'])),
|
|
15
|
+
// Seam L-SHELL-9: a Domain that extends Group manages the members of its own groups.
|
|
16
|
+
legacyMembershipOwnerAdmission(context, context.input.group)),
|
|
17
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { atomicRoles } from '../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
5
|
+
import { attributesInput } from '../../../types/index.js';
|
|
6
|
+
import { groupDescription, groupIcon, groupName } from '../types/index.js';
|
|
7
|
+
/** Rename this group, describe it, or change its icon or its attributes (G2, AM11). */
|
|
8
|
+
export const update = method({
|
|
9
|
+
description: 'Rename this group, describe it, or change its icon or its attributes.',
|
|
10
|
+
auth: 'authorized',
|
|
11
|
+
input: z.strictObject({
|
|
12
|
+
name: groupName.optional(),
|
|
13
|
+
description: groupDescription.nullable().optional(),
|
|
14
|
+
icon: groupIcon.optional(),
|
|
15
|
+
// Replaces them all; `null` erases them (AM11).
|
|
16
|
+
attributes: attributesInput.nullable().optional(),
|
|
17
|
+
}),
|
|
18
|
+
output: z.object({}),
|
|
19
|
+
policy: ({ check, ref }) => check(hasRole, ref(atomicRoles['group.writer'])),
|
|
20
|
+
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Group,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { Group, GroupProfile, group_profile } from './classes/index.js';
|
|
2
|
+
export { describesGroupOfSubject, isGroupProfileSource } from './policies/index.js';
|
|
3
|
+
export { legacyAdministratorsGroup, legacyMemberOfGroup, legacyMembersGroup, } from './legacy/index.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { Group,
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
export { Group, GroupProfile, group_profile } from './classes/index.js';
|
|
2
|
+
export { describesGroupOfSubject, isGroupProfileSource } from './policies/index.js';
|
|
3
|
+
// Seam L-SHELL-16: the package root's former names, reached through this module's facade.
|
|
4
|
+
export { legacyAdministratorsGroup, legacyMemberOfGroup, legacyMembersGroup, } from './legacy/index.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CallablePolicyContext } from '@astrale-os/sdk/schema';
|
|
2
|
+
type PolicyObject = CallablePolicyContext['input'][string];
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated The owner of a Group subclass changes the members of its own groups (L-SHELL-9).
|
|
5
|
+
* Replaced by `group.writer`, or by the Domain's own Identity and Roles (P5, P6). Removal: Shell
|
|
6
|
+
* major (delivery step 5) after 1Pact step 4.
|
|
7
|
+
*/
|
|
8
|
+
export declare function legacyMembershipOwnerAdmission(context: CallablePolicyContext, group: PolicyObject): import("@astrale-os/sdk/schema").PolicyCheckExpression<import("@astrale-os/sdk/schema").PolicyRef, import("@astrale-os/sdk/schema").PolicyCheckObject>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { legacyOwnsClass } from '../../../policies/legacy/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated The owner of a Group subclass changes the members of its own groups (L-SHELL-9).
|
|
4
|
+
* Replaced by `group.writer`, or by the Domain's own Identity and Roles (P5, P6). Removal: Shell
|
|
5
|
+
* major (delivery step 5) after 1Pact step 4.
|
|
6
|
+
*/
|
|
7
|
+
export function legacyMembershipOwnerAdmission(context, group) {
|
|
8
|
+
return context.check(legacyOwnsClass, group);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { legacyMemberOfGroup } from './member-of-group.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { legacyMemberOfGroup } from './member-of-group.js';
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated The direct membership fact legacy readers check beside Kernel `extends_with`
|
|
3
|
+
* (L-SHELL-8). Replaced by `extends_with`, the only composition. Removal: Shell major (delivery
|
|
4
|
+
* step 5) after 1Pact step 4.
|
|
5
|
+
*
|
|
6
|
+
* Shell writes it; the owner of a foreign Group subclass writes it too, under its own authority,
|
|
7
|
+
* when Shell acts for it (AM5). Each end detaches with its Node, so deleting an account or a group
|
|
8
|
+
* takes its legacy memberships with it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const legacyMemberOfGroup: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
|
|
2
11
|
readonly depth: 0;
|
|
3
12
|
readonly abstract: false;
|
|
4
13
|
readonly extends: readonly [];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { User } from '../../../user/index.js';
|
|
3
|
+
import { Group } from '../../classes/group.js';
|
|
4
|
+
import { legacyOwnsMembershipGroup } from '../policies/owns-membership-group.js';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated The direct membership fact legacy readers check beside Kernel `extends_with`
|
|
7
|
+
* (L-SHELL-8). Replaced by `extends_with`, the only composition. Removal: Shell major (delivery
|
|
8
|
+
* step 5) after 1Pact step 4.
|
|
9
|
+
*
|
|
10
|
+
* Shell writes it; the owner of a foreign Group subclass writes it too, under its own authority,
|
|
11
|
+
* when Shell acts for it (AM5). Each end detaches with its Node, so deleting an account or a group
|
|
12
|
+
* takes its legacy memberships with it.
|
|
13
|
+
*/
|
|
14
|
+
export const legacyMemberOfGroup = edgeClass.directed({
|
|
15
|
+
policies: {
|
|
16
|
+
read: true,
|
|
17
|
+
create: () => legacyOwnsMembershipGroup,
|
|
18
|
+
delete: () => legacyOwnsMembershipGroup,
|
|
19
|
+
},
|
|
20
|
+
source: {
|
|
21
|
+
as: 'member',
|
|
22
|
+
accepts: [() => User, () => Group],
|
|
23
|
+
outgoing: '0..*',
|
|
24
|
+
onDelete: 'detach',
|
|
25
|
+
},
|
|
26
|
+
target: {
|
|
27
|
+
as: 'group',
|
|
28
|
+
accepts: [() => Group],
|
|
29
|
+
incoming: '0..*',
|
|
30
|
+
onDelete: 'detach',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Core group `admin` "Administrators" (L-SHELL-7); its Core key and properties stay so
|
|
3
|
+
* stored members keep it, and the release makes it a member of `workspace.admin` (AM3). Replaced by
|
|
4
|
+
* `S.core.nodes['workspace.admin']`. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
5
|
+
*/
|
|
6
|
+
export declare const legacyAdministratorsGroup: import("@astrale-os/sdk/schema").CoreNode;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Core group `member` "Members" (L-SHELL-7), member of `workspace.member` (AM3). Replaced
|
|
9
|
+
* by `S.core.nodes['workspace.member']`. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
10
|
+
*/
|
|
11
|
+
export declare const legacyMembersGroup: import("@astrale-os/sdk/schema").CoreNode;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Core group `applications` (L-SHELL-7), member of Kernel `reader` (AM3) and admitted by
|
|
14
|
+
* `listEntrypoints`. Replaced by the Roles each Domain's release grants. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
15
|
+
*/
|
|
16
|
+
export declare const legacyApplicationsGroup: import("@astrale-os/sdk/schema").CoreNode;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Core group `view-only` (L-SHELL-7), member of Kernel `reader` (AM3); its non-admin
|
|
19
|
+
* members keep landing on their Views only. Replaced by Kernel `reader` held directly and
|
|
20
|
+
* `view_access`. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
21
|
+
*/
|
|
22
|
+
export declare const legacyViewOnlyGroup: import("@astrale-os/sdk/schema").CoreNode;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { K, core } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Group } from '../classes/group.js';
|
|
3
|
+
const group = (name, description) => core.node(() => Group, {
|
|
4
|
+
[K.classes.Named.properties.name.key]: name,
|
|
5
|
+
[K.classes.Descriptable.properties.description.key]: description,
|
|
6
|
+
});
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Core group `admin` "Administrators" (L-SHELL-7); its Core key and properties stay so
|
|
9
|
+
* stored members keep it, and the release makes it a member of `workspace.admin` (AM3). Replaced by
|
|
10
|
+
* `S.core.nodes['workspace.admin']`. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
11
|
+
*/
|
|
12
|
+
export const legacyAdministratorsGroup = group('Administrators', 'Instance administrators.');
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Core group `member` "Members" (L-SHELL-7), member of `workspace.member` (AM3). Replaced
|
|
15
|
+
* by `S.core.nodes['workspace.member']`. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
16
|
+
*/
|
|
17
|
+
export const legacyMembersGroup = group('Members', 'Instance members.');
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Core group `applications` (L-SHELL-7), member of Kernel `reader` (AM3) and admitted by
|
|
20
|
+
* `listEntrypoints`. Replaced by the Roles each Domain's release grants. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
21
|
+
*/
|
|
22
|
+
export const legacyApplicationsGroup = group('Applications', 'May list the installed applications they can open.');
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Core group `view-only` (L-SHELL-7), member of Kernel `reader` (AM3); its non-admin
|
|
25
|
+
* members keep landing on their Views only. Replaced by Kernel `reader` held directly and
|
|
26
|
+
* `view_access`. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
27
|
+
*/
|
|
28
|
+
export const legacyViewOnlyGroup = group('View only', 'Open only the Views given to them, never the workspace.');
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { LEGACY_GROUP_EXTENDS, LEGACY_GROUP_INHERITANCE, LEGACY_GROUP_READ } from './relaxations.js';
|
|
2
|
+
export { legacyMembershipOwnerAdmission } from './admission.js';
|
|
3
|
+
export { legacyAdministratorsGroup, legacyApplicationsGroup, legacyMembersGroup, legacyViewOnlyGroup, } from './core-groups.js';
|
|
4
|
+
export { legacyMemberOfGroup } from './classes/index.js';
|
|
5
|
+
export { legacyBelongsToGroup, legacyOwnsMembershipGroup } from './policies/index.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Relaxations first: Group reads them while the rest of this folder may still be loading.
|
|
2
|
+
export { LEGACY_GROUP_EXTENDS, LEGACY_GROUP_INHERITANCE, LEGACY_GROUP_READ } from './relaxations.js';
|
|
3
|
+
export { legacyMembershipOwnerAdmission } from './admission.js';
|
|
4
|
+
export { legacyAdministratorsGroup, legacyApplicationsGroup, legacyMembersGroup, legacyViewOnlyGroup, } from './core-groups.js';
|
|
5
|
+
export { legacyMemberOfGroup } from './classes/index.js';
|
|
6
|
+
export { legacyBelongsToGroup, legacyOwnsMembershipGroup } from './policies/index.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated The subject is a direct legacy member of the object group (L-SHELL-10). Replaced by
|
|
3
|
+
* `check(hasRole, …)` on a Role. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
4
|
+
*/
|
|
5
|
+
export declare const legacyBelongsToGroup: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { legacyMemberOfGroup } from '../classes/member-of-group.js';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated The subject is a direct legacy member of the object group (L-SHELL-10). Replaced by
|
|
5
|
+
* `check(hasRole, …)` on a Role. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
6
|
+
*/
|
|
7
|
+
export const legacyBelongsToGroup = policy({
|
|
8
|
+
match: ({ edge, subject, object }) => edge({ source: subject, class: () => legacyMemberOfGroup, target: object }),
|
|
9
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated The subject owns the concrete Class of a legacy membership's group: the Domain that
|
|
3
|
+
* extends Group writes `member_of_group` into its own groups, under AM5 (L-SHELL-9). Replaced by
|
|
4
|
+
* `extends_with` alone. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
5
|
+
*/
|
|
6
|
+
export declare const legacyOwnsMembershipGroup: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { K, policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated The subject owns the concrete Class of a legacy membership's group: the Domain that
|
|
4
|
+
* extends Group writes `member_of_group` into its own groups, under AM5 (L-SHELL-9). Replaced by
|
|
5
|
+
* `extends_with` alone. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
6
|
+
*/
|
|
7
|
+
export const legacyOwnsMembershipGroup = policy({
|
|
8
|
+
match: ({ exists, subject, target, allOf }) => exists(({ node }) => {
|
|
9
|
+
const concrete = node();
|
|
10
|
+
return allOf({ source: target, class: K.classes.instance_of.ref, target: concrete }, { source: concrete, class: K.classes.of_domain.ref, target: subject });
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Domains still extend Group (L-SHELL-1). Replaced by `'final'`. Removal: Shell major
|
|
3
|
+
* (delivery step 5) after 1Pact step 4.
|
|
4
|
+
*/
|
|
5
|
+
export declare const LEGACY_GROUP_INHERITANCE: 'open';
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Group omits Kernel Timestamped while stored groups lack its required `createdAt` and
|
|
8
|
+
* `updatedAt`, which the Kernel refuses to add over existing data (DATA_MIGRATION_REQUIRED)
|
|
9
|
+
* (L-SHELL-2). Replaced by `[K.classes.Identity, K.classes.Named, K.classes.Descriptable,
|
|
10
|
+
* K.classes.Iconable, K.classes.Timestamped]`. Removal: Shell major (delivery step 5) after 1Pact
|
|
11
|
+
* step 4, in the Kernel repair session that writes those values.
|
|
12
|
+
*/
|
|
13
|
+
export declare const LEGACY_GROUP_EXTENDS: readonly [import("@astrale-os/sdk/schema").KernelClass<"Identity">, import("@astrale-os/sdk/schema").KernelClass<"Named">, import("@astrale-os/sdk/schema").KernelClass<"Descriptable">, import("@astrale-os/sdk/schema").KernelClass<"Iconable">];
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Group keeps the read rule and the absence of unique constraints of the Shell that
|
|
16
|
+
* released Domains embed (L-SHELL-19), as User does. A directory group stays unique through the
|
|
17
|
+
* lookup of `Group.provision`. Replaced by `read: anyOf(group.reader, self)` and
|
|
18
|
+
* `unique: [['directory', 'externalId']]`. Removal: Shell major (delivery step 5), once immogrc,
|
|
19
|
+
* 1Pact and organization are rebuilt against this Shell.
|
|
20
|
+
*/
|
|
21
|
+
export declare const LEGACY_GROUP_READ: true;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { K } from '@astrale-os/sdk/schema';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Domains still extend Group (L-SHELL-1). Replaced by `'final'`. Removal: Shell major
|
|
4
|
+
* (delivery step 5) after 1Pact step 4.
|
|
5
|
+
*/
|
|
6
|
+
export const LEGACY_GROUP_INHERITANCE = 'open';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Group omits Kernel Timestamped while stored groups lack its required `createdAt` and
|
|
9
|
+
* `updatedAt`, which the Kernel refuses to add over existing data (DATA_MIGRATION_REQUIRED)
|
|
10
|
+
* (L-SHELL-2). Replaced by `[K.classes.Identity, K.classes.Named, K.classes.Descriptable,
|
|
11
|
+
* K.classes.Iconable, K.classes.Timestamped]`. Removal: Shell major (delivery step 5) after 1Pact
|
|
12
|
+
* step 4, in the Kernel repair session that writes those values.
|
|
13
|
+
*/
|
|
14
|
+
export const LEGACY_GROUP_EXTENDS = [
|
|
15
|
+
K.classes.Identity,
|
|
16
|
+
K.classes.Named,
|
|
17
|
+
K.classes.Descriptable,
|
|
18
|
+
K.classes.Iconable,
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Group keeps the read rule and the absence of unique constraints of the Shell that
|
|
22
|
+
* released Domains embed (L-SHELL-19), as User does. A directory group stays unique through the
|
|
23
|
+
* lookup of `Group.provision`. Replaced by `read: anyOf(group.reader, self)` and
|
|
24
|
+
* `unique: [['directory', 'externalId']]`. Removal: Shell major (delivery step 5), once immogrc,
|
|
25
|
+
* 1Pact and organization are rebuilt against this Shell.
|
|
26
|
+
*/
|
|
27
|
+
export const LEGACY_GROUP_READ = true;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { group_profile } from '../classes/group-profile-link.js';
|
|
3
|
+
/** The subject is the group this profile describes, or one of its members (its composition). */
|
|
4
|
+
export const describesGroupOfSubject = policy({
|
|
5
|
+
description: 'The caller is the group this profile describes, or a member of it.',
|
|
6
|
+
match: ({ edge, object, subject }) => edge({ source: subject, class: group_profile, target: object }),
|
|
7
|
+
});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { describesGroupOfSubject } from './describes-group-of-subject.js';
|
|
2
|
+
export { isGroupProfileSource } from './is-group-profile-source.js';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { describesGroupOfSubject } from './describes-group-of-subject.js';
|
|
2
|
+
export { isGroupProfileSource } from './is-group-profile-source.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
/** The subject is the group at the source of this Edge, or one of its members. */
|
|
3
|
+
export const isGroupProfileSource = policy({
|
|
4
|
+
description: 'The caller is the group this Edge leaves, or a member of it.',
|
|
5
|
+
match: ({ sameNode, subject, source }) => sameNode(subject, source),
|
|
6
|
+
});
|
|
@@ -6,3 +6,11 @@ export const groupMembershipInput = z.object({
|
|
|
6
6
|
member: path(() => User, () => Group),
|
|
7
7
|
group: path(() => Group),
|
|
8
8
|
});
|
|
9
|
+
/**
|
|
10
|
+
* Several accounts or groups to add to or withdraw from one group, in one call. A Path is not
|
|
11
|
+
* allowed inside a list, so each member is an exact @NodeId the Action checks.
|
|
12
|
+
*/
|
|
13
|
+
export const groupMembersInput = z.object({
|
|
14
|
+
members: z.array(z.string().min(2).max(512)).min(1).max(100),
|
|
15
|
+
group: path(() => Group),
|
|
16
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** A group's name and description, as Kernel Named and Descriptable bound them. */
|
|
3
|
+
export const groupName = z.string().min(1).max(100);
|
|
4
|
+
export const groupDescription = z.string().min(1).max(2_000);
|
|
5
|
+
/** A Kernel Iconable icon; `null` removes it. */
|
|
6
|
+
export const groupIcon = z.string().min(1).max(8_000).nullable();
|
|
7
|
+
export const directoryId = z.string().min(1).max(200);
|
|
8
|
+
export const externalId = z.string().min(1).max(200);
|
|
9
|
+
/** A Node as a method returns it: its canonical `@<NodeId>` path. */
|
|
10
|
+
export const nodeReference = z.string().min(2).max(512);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { groupMembershipInput } from './group-membership-input.js';
|
|
1
|
+
export { groupMembersInput, groupMembershipInput } from './group-membership-input.js';
|
|
2
|
+
export { directoryId, externalId, groupDescription, groupIcon, groupName, nodeReference, } from './group.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { atomicRoles } from '../../role/index.js';
|
|
3
|
+
import { User } from '../../user/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
5
|
+
import { Invitation } from './invitation.js';
|
|
6
|
+
/** The account an invitation is for. */
|
|
7
|
+
export const invitation_user = edgeClass.directed({
|
|
8
|
+
inheritance: 'final',
|
|
9
|
+
abstract: false,
|
|
10
|
+
description: 'The account this invitation is for.',
|
|
11
|
+
source: { as: 'invitation', accepts: [Invitation], outgoing: '0..1', onDelete: 'detach' },
|
|
12
|
+
target: { as: 'user', accepts: [User], incoming: '0..*', onDelete: 'detach' },
|
|
13
|
+
policies: {
|
|
14
|
+
read: ({ check, ref }) => check(hasRole, ref(atomicRoles['user.writer'])),
|
|
15
|
+
traverse: true,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { classIcon, nodeClass, property } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Mail } from '@astrale-os/sdk/schema/icons';
|
|
3
|
+
import { atomicRoles } from '../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
5
|
+
import { accept, cancel, resend, send } from '../functions/index.js';
|
|
6
|
+
import { INVITATION_STATUSES } from '../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* One invitation of an account, kept by the durable run of `Invitation.send` that it names. An
|
|
9
|
+
* account has at most one pending invitation. Only Shell writes it; `user.writer` reads it, so the pending
|
|
10
|
+
* invitations are one Query on `status`.
|
|
11
|
+
*/
|
|
12
|
+
export const Invitation = nodeClass({
|
|
13
|
+
icon: classIcon.lucide(Mail),
|
|
14
|
+
inheritance: 'final',
|
|
15
|
+
abstract: false,
|
|
16
|
+
description: 'One invitation of an account, until it is accepted, cancelled or expired.',
|
|
17
|
+
properties: {
|
|
18
|
+
status: property({ type: 'string', enum: [...INVITATION_STATUSES] }),
|
|
19
|
+
// ISO 8601 instant the invitation expires at.
|
|
20
|
+
expiresAt: property({ type: 'string', minLength: 20, maxLength: 40 }),
|
|
21
|
+
// The durable run that keeps it, and the number of events it has received (resends).
|
|
22
|
+
execution: property({ type: 'string', minLength: 1, maxLength: 200 }),
|
|
23
|
+
round: property({ type: 'integer', minimum: 0 }),
|
|
24
|
+
// The email it was sent to, in lower case: a new invitation to the same email resends this one.
|
|
25
|
+
email: property({ type: 'string', minLength: 3, maxLength: 320 }, { required: false }),
|
|
26
|
+
},
|
|
27
|
+
policies: {
|
|
28
|
+
read: ({ check, ref }) => check(hasRole, ref(atomicRoles['user.writer'])),
|
|
29
|
+
traverse: true,
|
|
30
|
+
},
|
|
31
|
+
methods: { send, resend, cancel, accept },
|
|
32
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { atomicRoles } from '../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* The invited person signed in for the first time, with the email the invitation was sent to: the
|
|
7
|
+
* run binds the account to that sign-in (`iss`, `sub`) and accepts the invitation. Admin calls it
|
|
8
|
+
* once it checked the provider's verified email.
|
|
9
|
+
*/
|
|
10
|
+
export const accept = method({
|
|
11
|
+
description: 'Accept a pending invitation at the first sign-in.',
|
|
12
|
+
auth: 'authorized',
|
|
13
|
+
input: z.strictObject({ iss: z.string().min(1).max(512), sub: z.string().min(1).max(512) }),
|
|
14
|
+
output: z.object({}),
|
|
15
|
+
policy: ({ check, ref }) => check(hasRole, ref(atomicRoles['user.writer'])),
|
|
16
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { atomicRoles } from '../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
5
|
+
/** Cancel a pending invitation. */
|
|
6
|
+
export const cancel = method({
|
|
7
|
+
description: 'Cancel a pending invitation.',
|
|
8
|
+
auth: 'authorized',
|
|
9
|
+
input: z.strictObject({}),
|
|
10
|
+
output: z.object({}),
|
|
11
|
+
policy: ({ check, ref }) => check(hasRole, ref(atomicRoles['user.writer'])),
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { atomicRoles } from '../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
5
|
+
/** Send the email of a pending invitation again: same invitation, same link, same run. */
|
|
6
|
+
export const resend = method({
|
|
7
|
+
description: 'Send the email of a pending invitation again.',
|
|
8
|
+
auth: 'authorized',
|
|
9
|
+
input: z.strictObject({}),
|
|
10
|
+
output: z.object({}),
|
|
11
|
+
policy: ({ check, ref }) => check(hasRole, ref(atomicRoles['user.writer'])),
|
|
12
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { method, path } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { atomicRoles } from '../../role/index.js';
|
|
4
|
+
import { User } from '../../user/index.js';
|
|
5
|
+
import { hasRole } from '../../../policies/index.js';
|
|
6
|
+
import { invitationStatus } from '../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Invite an account: a durable run that records the invitation, has Admin send the email, then
|
|
9
|
+
* waits for the first sign-in, a resend, a cancel or the expiry. It grants nothing. The caller
|
|
10
|
+
* follows the run; the invitation reads at once by its account.
|
|
11
|
+
*/
|
|
12
|
+
export const send = method({
|
|
13
|
+
static: true,
|
|
14
|
+
description: 'Invite an account and follow the invitation until it ends.',
|
|
15
|
+
auth: 'authorized',
|
|
16
|
+
execution: { durable: true },
|
|
17
|
+
input: z.strictObject({ user: path(() => User) }),
|
|
18
|
+
output: z.object({ status: invitationStatus }),
|
|
19
|
+
policy: ({ check, ref }) => check(hasRole, ref(atomicRoles['user.writer'])),
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { INVITATION_STATUSES, invitationStatus } from './invitation-status.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* One name in a Namespace: the Edge slug is the name, the target any Node. The Kernel key keeps a
|
|
3
3
|
* name to one Node for every author; Edge identity keeps a Node to one alias per Namespace. The
|
|
4
|
-
* target accepts a Class Shell does not own, so the alias detaches with its Node.
|
|
4
|
+
* target accepts a Class Shell does not own, so the alias detaches with its Node. An admin names
|
|
5
|
+
* Nodes through the Namespace methods or a Mutation of its own.
|
|
5
6
|
*/
|
|
6
7
|
export declare const alias: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
|
|
7
8
|
readonly depth: 0;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { K, edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { profileRoles } from '../../role/index.js';
|
|
3
|
+
import { hasRole } from '../../../policies/index.js';
|
|
2
4
|
import { Namespace } from './namespace.js';
|
|
3
5
|
/**
|
|
4
6
|
* One name in a Namespace: the Edge slug is the name, the target any Node. The Kernel key keeps a
|
|
5
7
|
* name to one Node for every author; Edge identity keeps a Node to one alias per Namespace. The
|
|
6
|
-
* target accepts a Class Shell does not own, so the alias detaches with its Node.
|
|
8
|
+
* target accepts a Class Shell does not own, so the alias detaches with its Node. An admin names
|
|
9
|
+
* Nodes through the Namespace methods or a Mutation of its own.
|
|
7
10
|
*/
|
|
8
11
|
export const alias = edgeClass.directed({
|
|
9
|
-
policies: {
|
|
12
|
+
policies: {
|
|
13
|
+
read: true,
|
|
14
|
+
traverse: true,
|
|
15
|
+
create: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
16
|
+
update: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
17
|
+
delete: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
18
|
+
},
|
|
10
19
|
source: { as: 'namespace', accepts: [() => Namespace], outgoing: '0..*' },
|
|
11
20
|
target: { as: 'node', accepts: [K.classes.Node], incoming: '0..*' },
|
|
12
21
|
unique: [['source', 'slug']],
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { K, method, path } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { profileRoles } from '../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
4
5
|
import { namespaceName } from '../types/index.js';
|
|
5
6
|
export const link = method({
|
|
6
7
|
description: 'Give one Node an alias in this Namespace.',
|
|
7
8
|
auth: 'authorized',
|
|
8
9
|
input: z.strictObject({ name: namespaceName, target: path(K.classes.Node) }),
|
|
9
10
|
output: z.object({}),
|
|
10
|
-
policy: ({
|
|
11
|
+
policy: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
11
12
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { method } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { profileRoles } from '../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
4
5
|
import { namespaceName } from '../types/index.js';
|
|
5
6
|
export const rename = method({
|
|
6
7
|
description: 'Rename one alias of this Namespace; the Node it names stays the same.',
|
|
7
8
|
auth: 'authorized',
|
|
8
9
|
input: z.strictObject({ name: namespaceName, to: namespaceName }),
|
|
9
10
|
output: z.object({}),
|
|
10
|
-
policy: ({
|
|
11
|
+
policy: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
11
12
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { method } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { profileRoles } from '../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../policies/index.js';
|
|
4
5
|
import { namespaceName } from '../types/index.js';
|
|
5
6
|
export const unlink = method({
|
|
6
7
|
description: 'Remove one alias from this Namespace.',
|
|
7
8
|
auth: 'authorized',
|
|
8
9
|
input: z.strictObject({ name: namespaceName }),
|
|
9
10
|
output: z.object({}),
|
|
10
|
-
policy: ({
|
|
11
|
+
policy: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
11
12
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Role } from './role.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Role } from './role.js';
|