@astrale-domains/shell 0.1.7 → 0.1.9
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/dist/domain.d.ts +54 -25
- package/dist/domain.js +21 -1
- package/dist/functions/authority/roles.js +58 -35
- package/dist/functions/group/assign-member.js +6 -3
- package/dist/functions/group/change-group-membership.js +92 -39
- package/dist/functions/group/group-membership-errors.js +1 -1
- package/dist/functions/group/index.js +2 -2
- package/dist/functions/group/legacy/index.js +1 -1
- package/dist/functions/group/legacy/membership.js +21 -17
- package/dist/functions/group/membership-laws.js +23 -28
- package/dist/functions/group/unassign-member.js +6 -3
- package/dist/functions/invitation/send-invitation.js +57 -7
- package/dist/functions/view-access/index.js +2 -2
- package/dist/functions/view-access/legacy/index.js +1 -0
- package/dist/functions/view-access/legacy/migrate-view-access.js +29 -0
- package/dist/mutations/group/index.js +1 -1
- package/dist/mutations/group/set-group-membership.js +45 -13
- package/dist/mutations/invitation/write-invitation.js +19 -2
- package/dist/mutations/view-access/legacy/index.js +1 -0
- package/dist/mutations/view-access/legacy/move-view-access.js +26 -0
- package/dist/mutations/view-access/set-view-access.js +1 -1
- package/dist/queries/composition/index.js +1 -1
- package/dist/queries/composition/read-role-nodes.js +48 -13
- package/dist/queries/group/index.js +1 -0
- package/dist/queries/group/legacy/index.js +1 -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/invitation/index.js +1 -1
- package/dist/queries/invitation/read-invitation.js +33 -8
- package/dist/queries/role/index.js +1 -1
- package/dist/queries/role/read-role-node.js +8 -0
- package/dist/queries/view-access/legacy/index.js +1 -0
- package/dist/queries/view-access/legacy/read-view-access-to-move.js +40 -0
- package/dist/queries/view-access/read-view-access.js +1 -1
- package/dist/runtime.d.ts +3930 -924
- package/dist/runtime.js +6 -3
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +2 -1
- package/dist/schema/legacy/schema.js +5 -3
- package/dist/schema/modules/application/legacy/functions/list-entrypoints.js +5 -4
- package/dist/schema/modules/group/classes/group-profile-link.d.ts +1 -1
- package/dist/schema/modules/group/classes/group.d.ts +14 -0
- package/dist/schema/modules/group/classes/group.js +12 -2
- package/dist/schema/modules/group/functions/assign-members.js +17 -0
- package/dist/schema/modules/group/functions/index.js +2 -0
- package/dist/schema/modules/group/functions/unassign-members.js +17 -0
- package/dist/schema/modules/group/types/group-membership-input.js +8 -0
- package/dist/schema/modules/group/types/index.js +1 -1
- package/dist/schema/modules/invitation/classes/invitation.js +4 -2
- package/dist/schema/modules/role/core/roles.d.ts +2 -0
- package/dist/schema/modules/role/core/roles.js +1 -0
- package/dist/schema/modules/view-access/index.d.ts +1 -2
- package/dist/schema/modules/view-access/index.js +2 -2
- package/dist/schema/modules/view-access/legacy/classes/index.d.ts +1 -0
- package/dist/schema/modules/view-access/legacy/classes/index.js +1 -0
- package/dist/schema/modules/view-access/{classes → legacy/classes}/view-access.d.ts +7 -5
- package/dist/schema/modules/view-access/legacy/classes/view-access.js +25 -0
- package/dist/schema/modules/view-access/legacy/functions/assign-views.d.ts +18 -0
- package/dist/schema/modules/view-access/legacy/functions/index.d.ts +2 -0
- package/dist/schema/modules/view-access/legacy/functions/index.js +1 -0
- package/dist/schema/modules/view-access/legacy/functions/migrate-view-access.d.ts +13 -0
- package/dist/schema/modules/view-access/legacy/functions/migrate-view-access.js +22 -0
- package/dist/schema/modules/view-access/legacy/index.d.ts +4 -0
- package/dist/schema/modules/view-access/legacy/index.js +3 -1
- package/dist/schema/modules/view-access/legacy/policies/holds-view-access.d.ts +5 -0
- package/dist/schema/modules/view-access/legacy/policies/holds-view-access.js +8 -0
- package/dist/schema/modules/view-access/legacy/policies/index.d.ts +1 -0
- package/dist/schema/modules/view-access/legacy/policies/index.js +1 -0
- package/dist/schema/modules/view-access/legacy/view-assignment.d.ts +21 -0
- package/dist/schema/schema.d.ts +207 -99
- package/dist/schema/schema.js +1 -4
- package/package.json +2 -2
- package/dist/schema/modules/view-access/classes/index.d.ts +0 -1
- package/dist/schema/modules/view-access/classes/index.js +0 -1
- package/dist/schema/modules/view-access/classes/view-access.js +0 -23
- package/dist/schema/modules/view-access/policies/holds-view-access.d.ts +0 -2
- package/dist/schema/modules/view-access/policies/holds-view-access.js +0 -5
- package/dist/schema/modules/view-access/policies/index.d.ts +0 -1
- package/dist/schema/modules/view-access/policies/index.js +0 -1
package/dist/runtime.js
CHANGED
|
@@ -2,14 +2,14 @@ import { defineRuntime } from '@astrale-os/sdk/runtime';
|
|
|
2
2
|
// L-SHELL-11: the legacy handler of listEntrypoints, through its owner's facade.
|
|
3
3
|
import { legacyListEntrypoints } from './functions/application/index.js';
|
|
4
4
|
import { disconnectDirectory } from './functions/directory/index.js';
|
|
5
|
-
import { assignMember, create as createGroup, deprovision as deprovisionGroup, provision as provisionGroup, remove as deleteGroup, unassignMember, update as updateGroup, } from './functions/group/index.js';
|
|
5
|
+
import { assignMember, assignMembers, create as createGroup, deprovision as deprovisionGroup, provision as provisionGroup, remove as deleteGroup, unassignMember, unassignMembers, update as updateGroup, } from './functions/group/index.js';
|
|
6
6
|
import { accept as acceptInvitation, cancel as cancelInvitation, resend as resendInvitation, send as sendInvitation, } from './functions/invitation/index.js';
|
|
7
7
|
import { link, rename, unlink } from './functions/namespace/index.js';
|
|
8
8
|
import { create as createUser, deactivate, deprovision as deprovisionUser, invite,
|
|
9
9
|
// L-SHELL-5, L-SHELL-14: legacy handlers, through their owner's facade.
|
|
10
10
|
legacyMigrateAccounts, legacyRecordProfile, provision as provisionUser, reactivate, remove as deleteUser, update as updateUser, updateProfile, } from './functions/user/index.js';
|
|
11
|
-
// L-SHELL-12: the legacy
|
|
12
|
-
import { legacyAssignViews } from './functions/view-access/index.js';
|
|
11
|
+
// L-SHELL-12, L-SHELL-20: the legacy handlers of assignViews and the view_access migration.
|
|
12
|
+
import { legacyAssignViews, legacyMigrateViewAccess } from './functions/view-access/index.js';
|
|
13
13
|
import { integrations } from './integrations/index.js';
|
|
14
14
|
import { enrollmentProvider } from './providers/admin-enrollment/index.js';
|
|
15
15
|
const initialize = (environment) => ({
|
|
@@ -30,6 +30,8 @@ const functions = [
|
|
|
30
30
|
deleteGroup,
|
|
31
31
|
assignMember,
|
|
32
32
|
unassignMember,
|
|
33
|
+
assignMembers,
|
|
34
|
+
unassignMembers,
|
|
33
35
|
provisionGroup,
|
|
34
36
|
deprovisionGroup,
|
|
35
37
|
disconnectDirectory,
|
|
@@ -44,6 +46,7 @@ const functions = [
|
|
|
44
46
|
legacyListEntrypoints,
|
|
45
47
|
legacyAssignViews,
|
|
46
48
|
legacyMigrateAccounts,
|
|
49
|
+
legacyMigrateViewAccess,
|
|
47
50
|
];
|
|
48
51
|
const runtime = defineRuntime()({
|
|
49
52
|
integrations,
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export { Role, atomicRoles, profileRoles, shellRoles, PROFILE_NAMES, type Profil
|
|
|
6
6
|
export { hasRole } from './policies/index.js';
|
|
7
7
|
export { disconnectDirectory } from './modules/directory/index.js';
|
|
8
8
|
export { Namespace, alias, viewsNamespace } from './modules/namespace/index.js';
|
|
9
|
-
export { view_access, holdsViewAccess } from './modules/view-access/index.js';
|
|
9
|
+
export { legacyViewAccess as view_access, legacyHoldsViewAccess as holdsViewAccess, } from './modules/view-access/index.js';
|
|
10
10
|
export { legacyMemberOfGroup as member_of_group, legacyAdministratorsGroup as adminGroup, legacyMembersGroup as memberGroup, } from './modules/group/index.js';
|
package/dist/schema/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { Role, atomicRoles, profileRoles, shellRoles, PROFILE_NAMES, } from './m
|
|
|
5
5
|
export { hasRole } from './policies/index.js';
|
|
6
6
|
export { disconnectDirectory } from './modules/directory/index.js';
|
|
7
7
|
export { Namespace, alias, viewsNamespace } from './modules/namespace/index.js';
|
|
8
|
-
|
|
8
|
+
// Seam L-SHELL-20: the package root's former names of the Shell's own view_access.
|
|
9
|
+
export { legacyViewAccess as view_access, legacyHoldsViewAccess as holdsViewAccess, } from './modules/view-access/index.js';
|
|
9
10
|
// Seam L-SHELL-16: the package root's former names of the legacy Edge Class and Core groups.
|
|
10
11
|
export { legacyMemberOfGroup as member_of_group, legacyAdministratorsGroup as adminGroup, legacyMembersGroup as memberGroup, } from './modules/group/index.js';
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { legacyListEntrypoints } from '../modules/application/legacy/index.js';
|
|
2
2
|
import { legacyAdministratorsGroup, legacyApplicationsGroup, legacyBelongsToGroup, legacyMemberOfGroup, legacyMembersGroup, legacyOwnsMembershipGroup, legacyViewOnlyGroup, } from '../modules/group/legacy/index.js';
|
|
3
3
|
import { legacyMigrateAccounts } from '../modules/user/legacy/index.js';
|
|
4
|
-
import { legacyAssignViews } from '../modules/view-access/legacy/index.js';
|
|
4
|
+
import { legacyAssignViews, legacyHoldsViewAccess, legacyMigrateViewAccess, legacyViewAccess, } from '../modules/view-access/legacy/index.js';
|
|
5
5
|
import { legacyAdministersShellClass, legacyIsSelf, legacyOwnsClass, legacyUsesFunction, } from '../policies/legacy/index.js';
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated The declarations the Shell keeps for legacy readers and callers, under their stored
|
|
8
8
|
* names so their keys stay (L-SHELL-7). Each item has its own row: L-SHELL-8, L-SHELL-10,
|
|
9
|
-
* L-SHELL-11, L-SHELL-12, L-SHELL-14. Replaced by the target Schema alone. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
9
|
+
* L-SHELL-11, L-SHELL-12, L-SHELL-14, L-SHELL-20. Replaced by the target Schema alone. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
10
10
|
*/
|
|
11
11
|
export const legacyShellSchema = {
|
|
12
|
-
classes: { member_of_group: legacyMemberOfGroup },
|
|
12
|
+
classes: { member_of_group: legacyMemberOfGroup, view_access: legacyViewAccess },
|
|
13
13
|
functions: {
|
|
14
14
|
listEntrypoints: legacyListEntrypoints,
|
|
15
15
|
assignViews: legacyAssignViews,
|
|
16
16
|
legacyMigrateAccounts,
|
|
17
|
+
legacyMigrateViewAccess,
|
|
17
18
|
},
|
|
18
19
|
policies: {
|
|
19
20
|
belongsToGroup: legacyBelongsToGroup,
|
|
@@ -22,6 +23,7 @@ export const legacyShellSchema = {
|
|
|
22
23
|
usesFunction: legacyUsesFunction,
|
|
23
24
|
isSelf: legacyIsSelf,
|
|
24
25
|
legacyOwnsMembershipGroup,
|
|
26
|
+
holdsViewAccess: legacyHoldsViewAccess,
|
|
25
27
|
},
|
|
26
28
|
core: {
|
|
27
29
|
admin: legacyAdministratorsGroup,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { func } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { legacyApplicationsGroup } from '../../../group/legacy/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { atomicRoles } from '../../../role/index.js';
|
|
5
5
|
import { hasRole } from '../../../../policies/index.js';
|
|
6
6
|
import { legacyEntrypointEntry } from '../entrypoint-entry.js';
|
|
7
7
|
/**
|
|
@@ -9,13 +9,14 @@ import { legacyEntrypointEntry } from '../entrypoint-entry.js';
|
|
|
9
9
|
* Shell's own authority (L-SHELL-11). Replaced by the visitor's own Query (V2). Removal: Shell major
|
|
10
10
|
* (delivery step 5) after 1Pact step 4.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Whoever opens the OS view lists its applications: holders of `os.viewer`, which `workspace.member`
|
|
13
|
+
* holds through the release, so its legacy `can_use` holders keep it (AM5): Administrators and
|
|
14
|
+
* Members through their profiles (AM3), and the Applications group itself.
|
|
14
15
|
*/
|
|
15
16
|
export const legacyListEntrypoints = func({
|
|
16
17
|
description: 'List the entrypoint View and name of every installed Domain that declares one.',
|
|
17
18
|
auth: 'authorized',
|
|
18
19
|
input: z.strictObject({}),
|
|
19
20
|
output: z.object({ entrypoints: z.array(legacyEntrypointEntry) }),
|
|
20
|
-
policy: ({ anyOf, check, ref }) => anyOf(check(hasRole, ref(
|
|
21
|
+
policy: ({ anyOf, check, ref }) => anyOf(check(hasRole, ref(atomicRoles['os.viewer'])), check(hasRole, ref(legacyApplicationsGroup))),
|
|
21
22
|
});
|
|
@@ -14,7 +14,7 @@ export declare const group_profile: import("@astrale-os/sdk/schema").DirectedEdg
|
|
|
14
14
|
readonly abstract: false;
|
|
15
15
|
readonly depth: 1;
|
|
16
16
|
readonly properties: "attributes" | "description" | "directory" | "externalId" | "frozen" | "icon" | "iss" | "name" | "sub";
|
|
17
|
-
readonly methods: "assignMember" | "create" | "delete" | "deprovision" | "provision" | "unassignMember" | "update";
|
|
17
|
+
readonly methods: "assignMember" | "assignMembers" | "create" | "delete" | "deprovision" | "provision" | "unassignMember" | "unassignMembers" | "update";
|
|
18
18
|
}[];
|
|
19
19
|
readonly outgoing: "0..1";
|
|
20
20
|
};
|
|
@@ -74,6 +74,20 @@ export declare const Group: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
|
74
74
|
readonly mode: 'value';
|
|
75
75
|
readonly value: Record<string, never>;
|
|
76
76
|
}, "authorized", true, false, undefined, undefined>>;
|
|
77
|
+
readonly assignMembers: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
78
|
+
members: string[];
|
|
79
|
+
group: string;
|
|
80
|
+
}, {
|
|
81
|
+
readonly mode: 'value';
|
|
82
|
+
readonly value: Record<string, never>;
|
|
83
|
+
}, "authorized", true, false, undefined, undefined>>;
|
|
84
|
+
readonly unassignMembers: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
85
|
+
members: string[];
|
|
86
|
+
group: string;
|
|
87
|
+
}, {
|
|
88
|
+
readonly mode: 'value';
|
|
89
|
+
readonly value: Record<string, never>;
|
|
90
|
+
}, "authorized", true, false, undefined, undefined>>;
|
|
77
91
|
readonly provision: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
78
92
|
directory: string;
|
|
79
93
|
externalId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { classIcon, nodeClass, property } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { UsersRound } from '@astrale-os/sdk/schema/icons';
|
|
3
3
|
import { attributesProperty } from '../../../types/index.js';
|
|
4
|
-
import { assignMember, create, deprovision, provision, remove, unassignMember, update, } from '../functions/index.js';
|
|
4
|
+
import { assignMember, assignMembers, create, deprovision, provision, remove, unassignMember, unassignMembers, update, } from '../functions/index.js';
|
|
5
5
|
// Seams L-SHELL-1, L-SHELL-2: the relaxations existing groups and extending Domains still need.
|
|
6
6
|
import { LEGACY_GROUP_EXTENDS, LEGACY_GROUP_INHERITANCE, LEGACY_GROUP_READ, } from '../legacy/index.js';
|
|
7
7
|
const text = { type: 'string', minLength: 1, maxLength: 200 };
|
|
@@ -28,5 +28,15 @@ export const Group = nodeClass({
|
|
|
28
28
|
read: LEGACY_GROUP_READ,
|
|
29
29
|
traverse: true,
|
|
30
30
|
},
|
|
31
|
-
methods: {
|
|
31
|
+
methods: {
|
|
32
|
+
create,
|
|
33
|
+
update,
|
|
34
|
+
delete: remove,
|
|
35
|
+
assignMember,
|
|
36
|
+
unassignMember,
|
|
37
|
+
assignMembers,
|
|
38
|
+
unassignMembers,
|
|
39
|
+
provision,
|
|
40
|
+
deprovision,
|
|
41
|
+
},
|
|
32
42
|
});
|
|
@@ -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
|
+
/** Make several accounts or groups members of this group in one call (G1-G3 checked once). */
|
|
8
|
+
export const assignMembers = method({
|
|
9
|
+
static: true,
|
|
10
|
+
description: 'Make several accounts or groups members of 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
|
+
});
|
|
@@ -3,5 +3,7 @@ export { update } from './update-group.js';
|
|
|
3
3
|
export { remove } from './delete-group.js';
|
|
4
4
|
export { assignMember } from './assign-member.js';
|
|
5
5
|
export { unassignMember } from './unassign-member.js';
|
|
6
|
+
export { assignMembers } from './assign-members.js';
|
|
7
|
+
export { unassignMembers } from './unassign-members.js';
|
|
6
8
|
export { provision } from './provision-group.js';
|
|
7
9
|
export { deprovision } from './deprovision-group.js';
|
|
@@ -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
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { groupMembershipInput } from './group-membership-input.js';
|
|
1
|
+
export { groupMembersInput, groupMembershipInput } from './group-membership-input.js';
|
|
2
2
|
export { directoryId, externalId, groupDescription, groupIcon, groupName, nodeReference, } from './group.js';
|
|
@@ -5,8 +5,8 @@ import { hasRole } from '../../../policies/index.js';
|
|
|
5
5
|
import { accept, cancel, resend, send } from '../functions/index.js';
|
|
6
6
|
import { INVITATION_STATUSES } from '../types/index.js';
|
|
7
7
|
/**
|
|
8
|
-
* One invitation of an account, kept by the durable run of `Invitation.send` that it names.
|
|
9
|
-
*
|
|
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
10
|
* invitations are one Query on `status`.
|
|
11
11
|
*/
|
|
12
12
|
export const Invitation = nodeClass({
|
|
@@ -21,6 +21,8 @@ export const Invitation = nodeClass({
|
|
|
21
21
|
// The durable run that keeps it, and the number of events it has received (resends).
|
|
22
22
|
execution: property({ type: 'string', minLength: 1, maxLength: 200 }),
|
|
23
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 }),
|
|
24
26
|
},
|
|
25
27
|
policies: {
|
|
26
28
|
read: ({ check, ref }) => check(hasRole, ref(atomicRoles['user.writer'])),
|
|
@@ -19,6 +19,7 @@ export declare const atomicRoles: {
|
|
|
19
19
|
readonly 'user-profile.reader': import("@astrale-os/sdk/schema").CoreNode;
|
|
20
20
|
readonly 'user-profile.self-writer': import("@astrale-os/sdk/schema").CoreNode;
|
|
21
21
|
readonly 'group-profile.reader': import("@astrale-os/sdk/schema").CoreNode;
|
|
22
|
+
readonly 'os.viewer': import("@astrale-os/sdk/schema").CoreNode;
|
|
22
23
|
};
|
|
23
24
|
export declare const shellRoles: {
|
|
24
25
|
readonly 'workspace.member': import("@astrale-os/sdk/schema").CoreNode;
|
|
@@ -31,6 +32,7 @@ export declare const shellRoles: {
|
|
|
31
32
|
readonly 'user-profile.reader': import("@astrale-os/sdk/schema").CoreNode;
|
|
32
33
|
readonly 'user-profile.self-writer': import("@astrale-os/sdk/schema").CoreNode;
|
|
33
34
|
readonly 'group-profile.reader': import("@astrale-os/sdk/schema").CoreNode;
|
|
35
|
+
readonly 'os.viewer': import("@astrale-os/sdk/schema").CoreNode;
|
|
34
36
|
};
|
|
35
37
|
/** The profile a person is given, by its name. */
|
|
36
38
|
export type ProfileName = 'member' | 'admin';
|
|
@@ -25,6 +25,7 @@ export const atomicRoles = {
|
|
|
25
25
|
'user-profile.reader': role('user-profile.reader', 'May read the name, email and image of every person.'),
|
|
26
26
|
'user-profile.self-writer': role('user-profile.self-writer', 'May change its own name and image, never its email.'),
|
|
27
27
|
'group-profile.reader': role('group-profile.reader', 'May read the name, description and image of every group.'),
|
|
28
|
+
'os.viewer': role('os.viewer', 'Opens the OS view and lists its applications.'),
|
|
28
29
|
};
|
|
29
30
|
export const shellRoles = { ...profileRoles, ...atomicRoles };
|
|
30
31
|
export const PROFILE_NAMES = ['member', 'admin'];
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { holdsViewAccess } from './policies/index.js';
|
|
1
|
+
export { legacyHoldsViewAccess, legacyViewAccess } from './legacy/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
// Seam L-SHELL-20: the package root's former names, reached through this module's facade.
|
|
2
|
+
export { legacyHoldsViewAccess, legacyViewAccess } from './legacy/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { legacyViewAccess } from './view-access.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { legacyViewAccess } from './view-access.js';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* @deprecated The Shell's own `view_access` (L-SHELL-20): a View an Identity landed on without
|
|
3
|
+
* `member`. The Kernel enforces only its own `view_access` (kernel-host 1.0.0-beta.45), so nothing
|
|
4
|
+
* writes this one any more; it stays declared so stored Edges remain valid until
|
|
5
|
+
* `legacyMigrateViewAccess` copies them to the Kernel's and deletes them. Replaced by Kernel
|
|
6
|
+
* `view_access`, which `view.manager` writes. Removal: Shell major (delivery step 5), once the
|
|
7
|
+
* migration ran on every instance.
|
|
6
8
|
*/
|
|
7
|
-
export declare const
|
|
9
|
+
export declare const legacyViewAccess: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
|
|
8
10
|
readonly depth: 0;
|
|
9
11
|
readonly abstract: false;
|
|
10
12
|
readonly extends: readonly [];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { K, edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { profileRoles } from '../../../role/index.js';
|
|
3
|
+
import { hasRole } from '../../../../policies/index.js';
|
|
4
|
+
import { legacyHoldsViewAccess } from '../policies/holds-view-access.js';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated The Shell's own `view_access` (L-SHELL-20): a View an Identity landed on without
|
|
7
|
+
* `member`. The Kernel enforces only its own `view_access` (kernel-host 1.0.0-beta.45), so nothing
|
|
8
|
+
* writes this one any more; it stays declared so stored Edges remain valid until
|
|
9
|
+
* `legacyMigrateViewAccess` copies them to the Kernel's and deletes them. Replaced by Kernel
|
|
10
|
+
* `view_access`, which `view.manager` writes. Removal: Shell major (delivery step 5), once the
|
|
11
|
+
* migration ran on every instance.
|
|
12
|
+
*/
|
|
13
|
+
export const legacyViewAccess = edgeClass.directed({
|
|
14
|
+
inheritance: 'final',
|
|
15
|
+
abstract: false,
|
|
16
|
+
description: 'A View this Identity lands on without member.',
|
|
17
|
+
source: { as: 'audience', accepts: [K.classes.Identity], outgoing: '0..*', onDelete: 'detach' },
|
|
18
|
+
target: { as: 'view', accepts: [K.classes.View], incoming: '0..*', onDelete: 'detach' },
|
|
19
|
+
policies: {
|
|
20
|
+
read: ({ anyOf, check, ref, self }) => anyOf(check(hasRole, ref(profileRoles['workspace.admin'])), check(legacyHoldsViewAccess, self)),
|
|
21
|
+
traverse: true,
|
|
22
|
+
create: false,
|
|
23
|
+
delete: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Give and withdraw Views for each identity, in one write (L-SHELL-12). Replaced by a
|
|
3
|
+
* Mutation on `view_access`, which only `workspace.admin` holders may write. Removal: Shell major
|
|
4
|
+
* (delivery step 5) after 1Pact step 4.
|
|
5
|
+
*
|
|
6
|
+
* Its legacy `can_use` holders, the Administrators group, hold `workspace.admin` through the release
|
|
7
|
+
* (AM5), which now admits them.
|
|
8
|
+
*/
|
|
9
|
+
export declare const legacyAssignViews: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
10
|
+
assignments: {
|
|
11
|
+
identity: string;
|
|
12
|
+
set?: string[] | undefined;
|
|
13
|
+
unset?: string[] | undefined;
|
|
14
|
+
}[];
|
|
15
|
+
}, {
|
|
16
|
+
readonly mode: 'value';
|
|
17
|
+
readonly value: Record<string, never>;
|
|
18
|
+
}, "authorized", false, false, undefined, undefined>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Copy every Shell `view_access` Edge to the Kernel's `view_access`, the one the
|
|
3
|
+
* Kernel enforces, and delete the Shell's; running it again changes nothing (L-SHELL-20). Replaced
|
|
4
|
+
* by nothing: Views are given through the Kernel's Edge. Removal: Shell major (delivery step 5),
|
|
5
|
+
* once every instance has run it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const legacyMigrateViewAccess: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
8
|
+
readonly mode: 'value';
|
|
9
|
+
readonly value: {
|
|
10
|
+
copied: number;
|
|
11
|
+
removed: number;
|
|
12
|
+
};
|
|
13
|
+
}, "authorized", false, false, undefined, undefined>>;
|
|
@@ -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
|
+
/**
|
|
6
|
+
* @deprecated Copy every Shell `view_access` Edge to the Kernel's `view_access`, the one the
|
|
7
|
+
* Kernel enforces, and delete the Shell's; running it again changes nothing (L-SHELL-20). Replaced
|
|
8
|
+
* by nothing: Views are given through the Kernel's Edge. Removal: Shell major (delivery step 5),
|
|
9
|
+
* once every instance has run it.
|
|
10
|
+
*/
|
|
11
|
+
export const legacyMigrateViewAccess = func({
|
|
12
|
+
description: "Move the Views given through the Shell's view_access to the Kernel's.",
|
|
13
|
+
auth: 'authorized',
|
|
14
|
+
input: z.strictObject({}),
|
|
15
|
+
output: z.object({
|
|
16
|
+
/** Kernel Edges created: the Shell Edges whose Kernel Edge did not exist yet. */
|
|
17
|
+
copied: z.number().int().min(0),
|
|
18
|
+
/** Shell Edges deleted, all of them once the copy landed. */
|
|
19
|
+
removed: z.number().int().min(0),
|
|
20
|
+
}),
|
|
21
|
+
policy: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
22
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { legacyViewAccess } from './classes/index.js';
|
|
2
|
+
export { legacyHoldsViewAccess } from './policies/index.js';
|
|
3
|
+
export { legacyAssignViews, legacyMigrateViewAccess } from './functions/index.js';
|
|
4
|
+
export { LEGACY_MAX_ASSIGNED_VIEWS, LEGACY_MAX_ASSIGNMENTS, legacyViewAssignment, } from './view-assignment.js';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { legacyViewAccess } from './classes/index.js';
|
|
2
|
+
export { legacyHoldsViewAccess } from './policies/index.js';
|
|
3
|
+
export { legacyAssignViews, legacyMigrateViewAccess } from './functions/index.js';
|
|
2
4
|
export { LEGACY_MAX_ASSIGNED_VIEWS, LEGACY_MAX_ASSIGNMENTS, legacyViewAssignment, } from './view-assignment.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated The subject is the Shell `view_access` Edge's audience, or extends it (L-SHELL-20).
|
|
3
|
+
* Replaced by the Kernel's `holdsViewAccess`. Removal: with `legacyViewAccess`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const legacyHoldsViewAccess: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated The subject is the Shell `view_access` Edge's audience, or extends it (L-SHELL-20).
|
|
4
|
+
* Replaced by the Kernel's `holdsViewAccess`. Removal: with `legacyViewAccess`.
|
|
5
|
+
*/
|
|
6
|
+
export const legacyHoldsViewAccess = policy({
|
|
7
|
+
match: ({ sameNode, subject, source }) => sameNode(subject, source),
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { legacyHoldsViewAccess } from './holds-view-access.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { legacyHoldsViewAccess } from './holds-view-access.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
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 declare 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 declare const LEGACY_MAX_ASSIGNMENTS = 40;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated The Views given to one identity (`set`) and withdrawn from it (`unset`), by @NodeId
|
|
14
|
+
* (L-SHELL-12). Replaced by a Mutation on `view_access`. Removal: Shell major (delivery step 5)
|
|
15
|
+
* after 1Pact step 4.
|
|
16
|
+
*/
|
|
17
|
+
export declare const legacyViewAssignment: z.ZodObject<{
|
|
18
|
+
identity: z.ZodString;
|
|
19
|
+
set: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20
|
+
unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
+
}, z.core.$strict>;
|