@astrale-domains/shell 0.1.0-beta.7 → 0.1.0-beta.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/actions/user/resolve-home.js +1 -1
- package/dist/application.d.ts +9807 -3
- package/dist/mutations/group/membership.js +17 -19
- package/dist/mutations/space/access.js +21 -23
- package/dist/mutations/space/default.js +18 -20
- package/dist/mutations/user/repair.js +76 -78
- package/dist/queries/space/access.js +9 -11
- package/dist/queries/space/admin.js +18 -25
- package/dist/queries/space/member.js +15 -22
- package/dist/queries/user/groups.js +15 -22
- package/dist/queries/user/home.js +19 -26
- package/dist/queries/user/owned-spaces.js +15 -22
- package/dist/queries/user/profile.js +3 -6
- package/dist/queries/user/setup.js +11 -13
- package/dist/runtime.d.ts +7355 -2
- package/dist/schema/domain/index.d.ts +1161 -26407
- package/dist/schema/domain/index.js +4 -5
- package/dist/schema/group/class.d.ts +167 -3132
- package/dist/schema/group/core.d.ts +2 -6
- package/dist/schema/group/index.d.ts +1 -1
- package/dist/schema/group/index.js +1 -1
- package/dist/schema/group/methods.d.ts +13 -2059
- package/dist/schema/group/methods.js +2 -1
- package/dist/schema/group/relationships.d.ts +6 -4303
- package/dist/schema/group/view.d.ts +1 -3291
- package/dist/schema/home/view.d.ts +1 -3
- package/dist/schema/index.d.ts +5 -5
- package/dist/schema/index.js +1 -1
- package/dist/schema/setup/functions.d.ts +28 -47
- package/dist/schema/setup/index.d.ts +1 -1
- package/dist/schema/space/class.d.ts +56 -2289
- package/dist/schema/space/core.d.ts +3 -22515
- package/dist/schema/space/index.d.ts +1 -1
- package/dist/schema/space/index.js +1 -1
- package/dist/schema/space/methods.d.ts +18 -2089
- package/dist/schema/space/methods.js +5 -3
- package/dist/schema/space/relationships.d.ts +24 -23173
- package/dist/schema/space/view.d.ts +1 -2316
- package/dist/schema/user/class.d.ts +128 -865
- package/dist/schema/user/index.d.ts +1 -1
- package/dist/schema/user/methods.d.ts +7 -14
- package/dist/schema/user/view.d.ts +1 -1017
- package/dist/workflows/group/change.js +3 -3
- package/dist/workflows/setup/run.js +3 -3
- package/dist/workflows/space/access.js +3 -3
- package/dist/workflows/space/default.js +3 -3
- package/package.json +3 -3
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
2
|
import { defineMutation } from '@astrale-os/sdk/mutation';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}
|
|
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
|
+
}));
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
2
|
import { defineMutation } from '@astrale-os/sdk/mutation';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
}
|
|
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
|
+
}));
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
2
|
import { defineMutation } from '@astrale-os/sdk/mutation';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
mutation.deleteEdge({
|
|
11
|
-
class: domain.classes.default_space,
|
|
12
|
-
source,
|
|
13
|
-
target: Path.id(change.previous),
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
mutation.createEdge({
|
|
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({
|
|
17
10
|
class: domain.classes.default_space,
|
|
18
11
|
source,
|
|
19
|
-
target: Path.id(change.
|
|
12
|
+
target: Path.id(change.previous),
|
|
20
13
|
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
+
}));
|
|
@@ -2,84 +2,82 @@ import { LocalBinding } from '@astrale-os/sdk/graph';
|
|
|
2
2
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
3
3
|
import { defineMutation } from '@astrale-os/sdk/mutation';
|
|
4
4
|
const personalSpace = LocalBinding('personalSpace');
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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({
|
|
13
20
|
node: Path.id(repair.userId),
|
|
14
21
|
class: domain.classes.User,
|
|
15
|
-
props: repair.
|
|
16
|
-
|
|
17
|
-
|
|
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),
|
|
18
70
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
: Path.id(repair.home.id);
|
|
33
|
-
if (repair.home.kind === 'existing' && repair.home.name !== undefined) {
|
|
34
|
-
mutation.expect.node({
|
|
35
|
-
node: Path.id(repair.home.id),
|
|
36
|
-
class: domain.classes.Space,
|
|
37
|
-
props: { equals: { name: repair.home.currentName } },
|
|
38
|
-
});
|
|
39
|
-
mutation.updateNode({
|
|
40
|
-
node: Path.id(repair.home.id),
|
|
41
|
-
class: domain.classes.Space,
|
|
42
|
-
props: { set: { name: repair.home.name } },
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
if (repair.addOwnership) {
|
|
46
|
-
mutation.createEdge({
|
|
47
|
-
class: domain.classes.owns_space,
|
|
48
|
-
source: Path.id(repair.userId),
|
|
49
|
-
target: home,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (repair.addDefault) {
|
|
53
|
-
mutation.createEdge({
|
|
54
|
-
class: domain.classes.default_space,
|
|
55
|
-
source: Path.id(repair.userId),
|
|
56
|
-
target: home,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (repair.addMember) {
|
|
60
|
-
mutation.createEdge({
|
|
61
|
-
class: domain.classes.member_of_group,
|
|
62
|
-
source: Path.id(repair.userId),
|
|
63
|
-
target: Path.project(domain.core.nodes.member.ref),
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (repair.addAdmin) {
|
|
67
|
-
mutation.createEdge({
|
|
68
|
-
class: domain.classes.member_of_group,
|
|
69
|
-
source: Path.id(repair.userId),
|
|
70
|
-
target: Path.project(domain.core.nodes.admin.ref),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
project(result, repair) {
|
|
75
|
-
const personalSpaceId = repair.home.kind === 'existing' ? repair.home.id : result.createdNodes[personalSpace];
|
|
76
|
-
if (personalSpaceId === undefined) {
|
|
77
|
-
throw new TypeError('Shell User repair omitted its created personal Space identity.');
|
|
78
|
-
}
|
|
79
|
-
return Object.freeze({ ok: true, personalSpaceId });
|
|
80
|
-
},
|
|
81
|
-
reject(failure) {
|
|
82
|
-
return Object.freeze({ ok: false, code: failure.code, outcomeKnown: failure.outcomeKnown });
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
}
|
|
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
|
+
}));
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { defineCompositeQuery } from '@astrale-os/sdk/query';
|
|
2
2
|
import { observeAdminSpaces } from './admin.js';
|
|
3
3
|
import { observeMemberSpaces } from './member.js';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
}
|
|
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
|
+
}));
|
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
2
|
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return Object.freeze({
|
|
22
|
-
spaces: queryResult.completeNodeValues(pages, 'direct administered Spaces'),
|
|
23
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
24
|
-
});
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
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
|
+
}));
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
2
|
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return Object.freeze({
|
|
19
|
-
spaces: queryResult.completeNodeValues(pages, 'direct member Spaces'),
|
|
20
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
}
|
|
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
|
+
}));
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
2
|
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return Object.freeze({
|
|
19
|
-
groups: queryResult.completeNodeValues(pages, 'Shell User Groups'),
|
|
20
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
}
|
|
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
|
+
}));
|
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
2
|
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return Object.freeze({
|
|
23
|
-
spaces: queryResult.completeNodeValues(pages, 'Shell User home'),
|
|
24
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
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
|
+
}));
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
2
|
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return Object.freeze({
|
|
19
|
-
spaces: queryResult.completeNodeValues(pages, 'Shell User owned Spaces'),
|
|
20
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
}
|
|
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
|
+
}));
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
2
|
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
const
|
|
3
|
+
export const readUserProfile = defineQuery()(() => ({
|
|
4
|
+
id: 'shell.user.profile',
|
|
4
5
|
build(user) {
|
|
5
6
|
return Query.from({ nodes: [Path.parse(user)] }).select({
|
|
6
7
|
kind: 'nodes',
|
|
7
8
|
projection: { kind: 'value' },
|
|
8
9
|
});
|
|
9
10
|
},
|
|
10
|
-
};
|
|
11
|
-
export const readUserProfile = defineQuery({
|
|
12
|
-
id: 'shell.user.profile',
|
|
13
|
-
...profileQuery,
|
|
14
11
|
project(result) {
|
|
15
12
|
return queryResult.exactlyOneNode(result, 'Shell User profile');
|
|
16
13
|
},
|
|
17
|
-
});
|
|
14
|
+
}));
|
|
@@ -3,16 +3,14 @@ import { observeUserGroups } from './groups.js';
|
|
|
3
3
|
import { observeHome } from './home.js';
|
|
4
4
|
import { observeOwnedSpaces } from './owned-spaces.js';
|
|
5
5
|
import { readUserProfile } from './profile.js';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
}
|
|
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
|
+
}));
|