@astrale-domains/shell 0.1.0-beta.10
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 +71 -0
- package/dist/actions/index.js +1 -0
- package/dist/actions/user/index.js +1 -0
- package/dist/actions/user/resolve-home.js +19 -0
- package/dist/application.d.ts +9809 -0
- package/dist/application.js +29 -0
- package/dist/entrypoints/application.d.ts +1 -0
- package/dist/entrypoints/application.js +1 -0
- package/dist/entrypoints/runtime.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mutations/group/index.js +1 -0
- package/dist/mutations/group/membership.js +19 -0
- package/dist/mutations/space/access.js +23 -0
- package/dist/mutations/space/default.js +23 -0
- package/dist/mutations/space/index.js +2 -0
- package/dist/mutations/user/index.js +1 -0
- package/dist/mutations/user/repair.js +83 -0
- package/dist/queries/space/access.js +12 -0
- package/dist/queries/space/admin.js +20 -0
- package/dist/queries/space/index.js +3 -0
- package/dist/queries/space/member.js +17 -0
- package/dist/queries/user/groups.js +17 -0
- package/dist/queries/user/home.js +21 -0
- package/dist/queries/user/index.js +5 -0
- package/dist/queries/user/owned-spaces.js +17 -0
- package/dist/queries/user/profile.js +14 -0
- package/dist/queries/user/setup.js +16 -0
- package/dist/runtime.d.ts +4 -0
- package/dist/runtime.js +18 -0
- package/dist/schema/domain/index.d.ts +1665 -0
- package/dist/schema/domain/index.js +39 -0
- package/dist/schema/group/class.d.ts +323 -0
- package/dist/schema/group/class.js +7 -0
- package/dist/schema/group/core.d.ts +10 -0
- package/dist/schema/group/core.js +14 -0
- package/dist/schema/group/index.d.ts +6 -0
- package/dist/schema/group/index.js +6 -0
- package/dist/schema/group/methods.d.ts +13 -0
- package/dist/schema/group/methods.js +22 -0
- package/dist/schema/group/policies.d.ts +1 -0
- package/dist/schema/group/policies.js +6 -0
- package/dist/schema/group/relationships.d.ts +16 -0
- package/dist/schema/group/relationships.js +8 -0
- package/dist/schema/group/view.d.ts +1 -0
- package/dist/schema/group/view.js +6 -0
- package/dist/schema/home/index.d.ts +1 -0
- package/dist/schema/home/index.js +1 -0
- package/dist/schema/home/view.d.ts +1 -0
- package/dist/schema/home/view.js +4 -0
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.js +6 -0
- package/dist/schema/setup/functions.d.ts +28 -0
- package/dist/schema/setup/functions.js +27 -0
- package/dist/schema/setup/index.d.ts +1 -0
- package/dist/schema/setup/index.js +1 -0
- package/dist/schema/space/class.d.ts +80 -0
- package/dist/schema/space/class.js +11 -0
- package/dist/schema/space/core.d.ts +8 -0
- package/dist/schema/space/core.js +15 -0
- package/dist/schema/space/index.d.ts +6 -0
- package/dist/schema/space/index.js +6 -0
- package/dist/schema/space/methods.d.ts +18 -0
- package/dist/schema/space/methods.js +32 -0
- package/dist/schema/space/policies.d.ts +4 -0
- package/dist/schema/space/policies.js +21 -0
- package/dist/schema/space/relationships.d.ts +64 -0
- package/dist/schema/space/relationships.js +24 -0
- package/dist/schema/space/view.d.ts +1 -0
- package/dist/schema/space/view.js +6 -0
- package/dist/schema/user/class.d.ts +278 -0
- package/dist/schema/user/class.js +11 -0
- package/dist/schema/user/index.d.ts +3 -0
- package/dist/schema/user/index.js +3 -0
- package/dist/schema/user/methods.d.ts +7 -0
- package/dist/schema/user/methods.js +11 -0
- package/dist/schema/user/view.d.ts +1 -0
- package/dist/schema/user/view.js +6 -0
- package/dist/workflows/group/assign.js +3 -0
- package/dist/workflows/group/change.js +31 -0
- package/dist/workflows/group/index.js +3 -0
- package/dist/workflows/group/unassign.js +3 -0
- package/dist/workflows/index.js +3 -0
- package/dist/workflows/setup/admin.js +3 -0
- package/dist/workflows/setup/index.js +5 -0
- package/dist/workflows/setup/member.js +3 -0
- package/dist/workflows/setup/plan.js +88 -0
- package/dist/workflows/setup/provision.js +57 -0
- package/dist/workflows/setup/run.js +74 -0
- package/dist/workflows/space/access.js +41 -0
- package/dist/workflows/space/add.js +3 -0
- package/dist/workflows/space/default.js +37 -0
- package/dist/workflows/space/index.js +4 -0
- package/dist/workflows/space/remove.js +3 -0
- package/package.json +69 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineApplication, defineFrontend, external, requirements, } from '@astrale-os/sdk/application';
|
|
2
|
+
import { K } from '@astrale-os/sdk/schema';
|
|
3
|
+
import runtime from './runtime.js';
|
|
4
|
+
import { ShellSchema } from './schema/index.js';
|
|
5
|
+
export const frontend = defineFrontend({
|
|
6
|
+
schema: ShellSchema,
|
|
7
|
+
source: external('https://app.astrale.ai'),
|
|
8
|
+
routes: {
|
|
9
|
+
group: '/groups',
|
|
10
|
+
home: '/',
|
|
11
|
+
space: '/spaces',
|
|
12
|
+
user: '/users',
|
|
13
|
+
},
|
|
14
|
+
entrypoint: 'home',
|
|
15
|
+
});
|
|
16
|
+
export const application = defineApplication({
|
|
17
|
+
schema: ShellSchema,
|
|
18
|
+
runtime,
|
|
19
|
+
frontend,
|
|
20
|
+
requirements: requirements({
|
|
21
|
+
callables: [
|
|
22
|
+
K.classes.Identity.static.methods.whois,
|
|
23
|
+
K.functions.provision,
|
|
24
|
+
K.functions.query,
|
|
25
|
+
K.functions.mutate,
|
|
26
|
+
],
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
export default application;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { application, default } from '../application.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { application, default } from '../application.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../runtime.js';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Group, ORIGIN, S, ShellCore, ShellSchema, Space, User, adminGroup, administers_space, belongsToSpace, default_space, defaultSpace, groupAssignUser, groupCore, groupUnassignUser, groupView, homeView, mayAdministerSpace, maySetupUsers, memberGroup, member_of_group, member_of_space, owns_space, ownsSpace, resolveHome, setupAdmin, setupMember, spaceAddUser, spaceCore, spaceRemoveUser, spaceSetDefault, spaceView, userView, type GroupMembershipInput, type GroupMembershipResult, type ResolveHomeResult, type SetDefaultSpaceInput, type SetDefaultSpaceResult, type SetupUserInput, type SetupUserResult, type Shell, type SpaceUserAccess, type SpaceUserAccessInput, type SpaceUserAccessResult, type SpaceUserInput, type SpaceUserResult, } from '#schema';
|
|
2
|
+
export { application } from './application.js';
|
|
3
|
+
export { default as runtime } from './runtime.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Group, ORIGIN, S, ShellCore, ShellSchema, Space, User, adminGroup, administers_space, belongsToSpace, default_space, defaultSpace, groupAssignUser, groupCore, groupUnassignUser, groupView, homeView, mayAdministerSpace, maySetupUsers, memberGroup, member_of_group, member_of_space, owns_space, ownsSpace, resolveHome, setupAdmin, setupMember, spaceAddUser, spaceCore, spaceRemoveUser, spaceSetDefault, spaceView, userView, } from '#schema';
|
|
2
|
+
export { application } from './application.js';
|
|
3
|
+
export { default as runtime } from './runtime.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { changeGroupMembership, } from './membership.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { defineMutation } from '@astrale-os/sdk/mutation';
|
|
3
|
+
export const changeGroupMembership = defineMutation()((domain) => ({
|
|
4
|
+
id: 'shell.group.membership',
|
|
5
|
+
build(change, mutation) {
|
|
6
|
+
mutation.expect.query(change.guard);
|
|
7
|
+
const edge = {
|
|
8
|
+
class: domain.classes.member_of_group,
|
|
9
|
+
source: Path.parse(change.user),
|
|
10
|
+
target: Path.id(change.group),
|
|
11
|
+
};
|
|
12
|
+
if (change.present)
|
|
13
|
+
mutation.createEdge(edge);
|
|
14
|
+
else
|
|
15
|
+
mutation.deleteEdge(edge);
|
|
16
|
+
},
|
|
17
|
+
project: () => Object.freeze({ ok: true }),
|
|
18
|
+
reject: (failure) => Object.freeze({ ok: false, code: failure.code, outcomeKnown: failure.outcomeKnown }),
|
|
19
|
+
}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { defineMutation } from '@astrale-os/sdk/mutation';
|
|
3
|
+
export const changeSpaceAccess = defineMutation()((domain) => ({
|
|
4
|
+
id: 'shell.space.access',
|
|
5
|
+
build(change, mutation) {
|
|
6
|
+
mutation.expect.query(change.guards.member);
|
|
7
|
+
mutation.expect.query(change.guards.admin);
|
|
8
|
+
const source = Path.parse(change.user);
|
|
9
|
+
const target = Path.id(change.space);
|
|
10
|
+
const member = { class: domain.classes.member_of_space, source, target };
|
|
11
|
+
const admin = { class: domain.classes.administers_space, source, target };
|
|
12
|
+
if (change.removeMember)
|
|
13
|
+
mutation.deleteEdge(member);
|
|
14
|
+
if (change.removeAdmin)
|
|
15
|
+
mutation.deleteEdge(admin);
|
|
16
|
+
if (change.addMember)
|
|
17
|
+
mutation.createEdge(member);
|
|
18
|
+
if (change.addAdmin)
|
|
19
|
+
mutation.createEdge(admin);
|
|
20
|
+
},
|
|
21
|
+
project: () => Object.freeze({ ok: true }),
|
|
22
|
+
reject: (failure) => Object.freeze({ ok: false, code: failure.code, outcomeKnown: failure.outcomeKnown }),
|
|
23
|
+
}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { defineMutation } from '@astrale-os/sdk/mutation';
|
|
3
|
+
export const changeDefaultSpace = defineMutation()((domain) => ({
|
|
4
|
+
id: 'shell.space.default',
|
|
5
|
+
build(change, mutation) {
|
|
6
|
+
mutation.expect.query(change.guard);
|
|
7
|
+
const source = Path.id(change.user);
|
|
8
|
+
if (change.previous !== undefined) {
|
|
9
|
+
mutation.deleteEdge({
|
|
10
|
+
class: domain.classes.default_space,
|
|
11
|
+
source,
|
|
12
|
+
target: Path.id(change.previous),
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
mutation.createEdge({
|
|
16
|
+
class: domain.classes.default_space,
|
|
17
|
+
source,
|
|
18
|
+
target: Path.id(change.next),
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
project: () => Object.freeze({ ok: true }),
|
|
22
|
+
reject: (failure) => Object.freeze({ ok: false, code: failure.code, outcomeKnown: failure.outcomeKnown }),
|
|
23
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { repairUser } from './repair.js';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { LocalBinding } from '@astrale-os/sdk/graph';
|
|
2
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
3
|
+
import { defineMutation } from '@astrale-os/sdk/mutation';
|
|
4
|
+
const personalSpace = LocalBinding('personalSpace');
|
|
5
|
+
export const repairUser = defineMutation()((domain) => ({
|
|
6
|
+
id: 'shell.user.repair',
|
|
7
|
+
build(repair, mutation) {
|
|
8
|
+
mutation.expect.query(repair.guards.home);
|
|
9
|
+
mutation.expect.query(repair.guards.ownedSpaces);
|
|
10
|
+
mutation.expect.query(repair.guards.groups);
|
|
11
|
+
mutation.expect.node({
|
|
12
|
+
node: Path.id(repair.userId),
|
|
13
|
+
class: domain.classes.User,
|
|
14
|
+
props: repair.currentDisplayName === undefined
|
|
15
|
+
? { absent: ['displayName'] }
|
|
16
|
+
: { equals: { displayName: repair.currentDisplayName } },
|
|
17
|
+
});
|
|
18
|
+
if (repair.displayName !== undefined) {
|
|
19
|
+
mutation.updateNode({
|
|
20
|
+
node: Path.id(repair.userId),
|
|
21
|
+
class: domain.classes.User,
|
|
22
|
+
props: { set: { displayName: repair.displayName } },
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const home = repair.home.kind === 'create'
|
|
26
|
+
? mutation.createNode({
|
|
27
|
+
as: personalSpace,
|
|
28
|
+
class: domain.classes.Space,
|
|
29
|
+
props: { name: repair.home.name },
|
|
30
|
+
})
|
|
31
|
+
: Path.id(repair.home.id);
|
|
32
|
+
if (repair.home.kind === 'existing' && repair.home.name !== undefined) {
|
|
33
|
+
mutation.expect.node({
|
|
34
|
+
node: Path.id(repair.home.id),
|
|
35
|
+
class: domain.classes.Space,
|
|
36
|
+
props: { equals: { name: repair.home.currentName } },
|
|
37
|
+
});
|
|
38
|
+
mutation.updateNode({
|
|
39
|
+
node: Path.id(repair.home.id),
|
|
40
|
+
class: domain.classes.Space,
|
|
41
|
+
props: { set: { name: repair.home.name } },
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (repair.addOwnership) {
|
|
45
|
+
mutation.createEdge({
|
|
46
|
+
class: domain.classes.owns_space,
|
|
47
|
+
source: Path.id(repair.userId),
|
|
48
|
+
target: home,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (repair.addDefault) {
|
|
52
|
+
mutation.createEdge({
|
|
53
|
+
class: domain.classes.default_space,
|
|
54
|
+
source: Path.id(repair.userId),
|
|
55
|
+
target: home,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (repair.addMember) {
|
|
59
|
+
mutation.createEdge({
|
|
60
|
+
class: domain.classes.member_of_group,
|
|
61
|
+
source: Path.id(repair.userId),
|
|
62
|
+
target: Path.project(domain.core.nodes.member.ref),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (repair.addAdmin) {
|
|
66
|
+
mutation.createEdge({
|
|
67
|
+
class: domain.classes.member_of_group,
|
|
68
|
+
source: Path.id(repair.userId),
|
|
69
|
+
target: Path.project(domain.core.nodes.admin.ref),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
project(result, repair) {
|
|
74
|
+
const personalSpaceId = repair.home.kind === 'existing' ? repair.home.id : result.createdNodes[personalSpace];
|
|
75
|
+
if (personalSpaceId === undefined) {
|
|
76
|
+
throw new TypeError('Shell User repair omitted its created personal Space identity.');
|
|
77
|
+
}
|
|
78
|
+
return Object.freeze({ ok: true, personalSpaceId });
|
|
79
|
+
},
|
|
80
|
+
reject(failure) {
|
|
81
|
+
return Object.freeze({ ok: false, code: failure.code, outcomeKnown: failure.outcomeKnown });
|
|
82
|
+
},
|
|
83
|
+
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineCompositeQuery } from '@astrale-os/sdk/query';
|
|
2
|
+
import { observeAdminSpaces } from './admin.js';
|
|
3
|
+
import { observeMemberSpaces } from './member.js';
|
|
4
|
+
export const observeDirectSpaceAccess = defineCompositeQuery()(() => ({
|
|
5
|
+
id: 'shell.space.direct-access',
|
|
6
|
+
compose({ combine, query }, user) {
|
|
7
|
+
return combine({
|
|
8
|
+
admin: query('admin', observeAdminSpaces, user),
|
|
9
|
+
member: query('member', observeMemberSpaces, user),
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
+
export const observeAdminSpaces = defineQuery()((domain) => ({
|
|
4
|
+
id: 'shell.space.admin-access',
|
|
5
|
+
build(user) {
|
|
6
|
+
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
+
const spaces = source.expand({
|
|
8
|
+
via: [domain.classes.administers_space],
|
|
9
|
+
direction: 'outgoing',
|
|
10
|
+
});
|
|
11
|
+
return spaces.select({ kind: 'nodes', binding: spaces.node, projection: { kind: 'value' } });
|
|
12
|
+
},
|
|
13
|
+
pagination: { maximumPages: 64 },
|
|
14
|
+
project(pages, _user, { ast, complete }) {
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
spaces: queryResult.completeNodeValues(pages, 'direct administered Spaces'),
|
|
17
|
+
guard: Object.freeze({ query: ast, equals: complete }),
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
+
export const observeMemberSpaces = defineQuery()((domain) => ({
|
|
4
|
+
id: 'shell.space.member-access',
|
|
5
|
+
build(user) {
|
|
6
|
+
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
+
const spaces = source.expand({ via: [domain.classes.member_of_space], direction: 'outgoing' });
|
|
8
|
+
return spaces.select({ kind: 'nodes', binding: spaces.node, projection: { kind: 'value' } });
|
|
9
|
+
},
|
|
10
|
+
pagination: { maximumPages: 64 },
|
|
11
|
+
project(pages, _user, { ast, complete }) {
|
|
12
|
+
return Object.freeze({
|
|
13
|
+
spaces: queryResult.completeNodeValues(pages, 'direct member Spaces'),
|
|
14
|
+
guard: Object.freeze({ query: ast, equals: complete }),
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
+
export const observeUserGroups = defineQuery()((domain) => ({
|
|
4
|
+
id: 'shell.user.groups',
|
|
5
|
+
build(user) {
|
|
6
|
+
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
+
const groups = source.expand({ via: [domain.classes.member_of_group], direction: 'outgoing' });
|
|
8
|
+
return groups.select({ kind: 'nodes', binding: groups.node, projection: { kind: 'value' } });
|
|
9
|
+
},
|
|
10
|
+
pagination: { maximumPages: 64 },
|
|
11
|
+
project(pages, _user, { ast, complete }) {
|
|
12
|
+
return Object.freeze({
|
|
13
|
+
groups: queryResult.completeNodeValues(pages, 'Shell User Groups'),
|
|
14
|
+
guard: Object.freeze({ query: ast, equals: complete }),
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
+
export const observeHome = defineQuery()((domain) => ({
|
|
4
|
+
id: 'shell.user.home',
|
|
5
|
+
build(user) {
|
|
6
|
+
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
+
const spaces = source.expand({
|
|
8
|
+
via: [domain.classes.default_space],
|
|
9
|
+
direction: 'outgoing',
|
|
10
|
+
});
|
|
11
|
+
return spaces.select({ kind: 'nodes', binding: spaces.node, projection: { kind: 'value' } });
|
|
12
|
+
},
|
|
13
|
+
page: { size: 2 },
|
|
14
|
+
pagination: { maximumPages: 2 },
|
|
15
|
+
project(pages, _user, { ast, complete }) {
|
|
16
|
+
return Object.freeze({
|
|
17
|
+
spaces: queryResult.completeNodeValues(pages, 'Shell User home'),
|
|
18
|
+
guard: Object.freeze({ query: ast, equals: complete }),
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
+
export const observeOwnedSpaces = defineQuery()((domain) => ({
|
|
4
|
+
id: 'shell.user.owned-spaces',
|
|
5
|
+
build(user) {
|
|
6
|
+
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
+
const spaces = source.expand({ via: [domain.classes.owns_space], direction: 'outgoing' });
|
|
8
|
+
return spaces.select({ kind: 'nodes', binding: spaces.node, projection: { kind: 'value' } });
|
|
9
|
+
},
|
|
10
|
+
pagination: { maximumPages: 64 },
|
|
11
|
+
project(pages, _user, { ast, complete }) {
|
|
12
|
+
return Object.freeze({
|
|
13
|
+
spaces: queryResult.completeNodeValues(pages, 'Shell User owned Spaces'),
|
|
14
|
+
guard: Object.freeze({ query: ast, equals: complete }),
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
+
export const readUserProfile = defineQuery()(() => ({
|
|
4
|
+
id: 'shell.user.profile',
|
|
5
|
+
build(user) {
|
|
6
|
+
return Query.from({ nodes: [Path.parse(user)] }).select({
|
|
7
|
+
kind: 'nodes',
|
|
8
|
+
projection: { kind: 'value' },
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
project(result) {
|
|
12
|
+
return queryResult.exactlyOneNode(result, 'Shell User profile');
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineCompositeQuery } from '@astrale-os/sdk/query';
|
|
2
|
+
import { observeUserGroups } from './groups.js';
|
|
3
|
+
import { observeHome } from './home.js';
|
|
4
|
+
import { observeOwnedSpaces } from './owned-spaces.js';
|
|
5
|
+
import { readUserProfile } from './profile.js';
|
|
6
|
+
export const observeUserSetup = defineCompositeQuery()(() => ({
|
|
7
|
+
id: 'shell.user.setup',
|
|
8
|
+
compose({ combine, query }, userId) {
|
|
9
|
+
return combine({
|
|
10
|
+
profile: query('profile', readUserProfile, userId),
|
|
11
|
+
home: query('home', observeHome, userId),
|
|
12
|
+
ownedSpaces: query('owned-spaces', observeOwnedSpaces, userId),
|
|
13
|
+
groups: query('groups', observeUserGroups, userId),
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
}));
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineRuntime } from '@astrale-os/sdk/runtime';
|
|
2
|
+
import { resolveHomeAction } from './actions/index.js';
|
|
3
|
+
import { addSpaceUserWorkflow, assignGroupUserWorkflow, removeSpaceUserWorkflow, setDefaultSpaceWorkflow, setupAdminWorkflow, setupMemberWorkflow, unassignGroupUserWorkflow, } from './workflows/index.js';
|
|
4
|
+
const runtime = defineRuntime()({
|
|
5
|
+
integrations: {},
|
|
6
|
+
initialize: () => ({ providers: {} }),
|
|
7
|
+
actions: [resolveHomeAction],
|
|
8
|
+
workflows: [
|
|
9
|
+
setupAdminWorkflow,
|
|
10
|
+
setupMemberWorkflow,
|
|
11
|
+
assignGroupUserWorkflow,
|
|
12
|
+
unassignGroupUserWorkflow,
|
|
13
|
+
addSpaceUserWorkflow,
|
|
14
|
+
removeSpaceUserWorkflow,
|
|
15
|
+
setDefaultSpaceWorkflow,
|
|
16
|
+
],
|
|
17
|
+
});
|
|
18
|
+
export default runtime;
|