@astrale-domains/shell 0.1.0-beta.39 → 0.1.0-beta.40
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 +14 -12
- package/dist/domain.d.ts +6 -2
- package/dist/domain.js +8 -4
- package/dist/functions/application/index.js +1 -1
- package/dist/functions/application/list-entrypoints.js +4 -0
- package/dist/queries/application/index.js +1 -1
- package/dist/queries/application/read-installed-entrypoints.js +44 -0
- package/dist/runtime.d.ts +25 -9
- package/dist/runtime.js +2 -2
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +1 -1
- package/dist/schema/modules/application/functions/index.d.ts +1 -1
- package/dist/schema/modules/application/functions/index.js +1 -1
- package/dist/schema/modules/application/functions/list-entrypoints.d.ts +15 -0
- package/dist/schema/modules/application/functions/list-entrypoints.js +16 -0
- package/dist/schema/modules/application/index.d.ts +2 -2
- package/dist/schema/modules/application/index.js +2 -2
- package/dist/schema/modules/application/types/entrypoint-entry.d.ts +8 -0
- package/dist/schema/modules/application/types/entrypoint-entry.js +7 -0
- package/dist/schema/modules/application/types/index.d.ts +1 -1
- package/dist/schema/modules/application/types/index.js +1 -1
- package/dist/schema/schema.d.ts +18 -6
- package/dist/schema/schema.js +4 -2
- package/package.json +4 -4
- package/dist/functions/application/list-applications.js +0 -19
- package/dist/queries/application/read-installed-domain-origins.js +0 -22
- package/dist/schema/modules/application/functions/list-applications.d.ts +0 -13
- package/dist/schema/modules/application/functions/list-applications.js +0 -16
- package/dist/schema/modules/application/types/application-entry.d.ts +0 -5
- package/dist/schema/modules/application/types/application-entry.js +0 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Shell owns two concrete Identity classes, User and Group, the member_of_group relation,
|
|
4
4
|
the admin/member/applications Core groups, three static methods, one Domain function, and one
|
|
5
|
-
application View. There is no Space, setup function, personal home, or public repair method.
|
|
5
|
+
application View, which is its entrypoint. The Schema names the Domain `Shell`. There is no Space, setup function, personal home, or public repair method.
|
|
6
6
|
|
|
7
7
|
## Contracts
|
|
8
8
|
|
|
@@ -14,17 +14,19 @@ application View. There is no Space, setup function, personal home, or public re
|
|
|
14
14
|
|
|
15
15
|
| Domain function | Input | Output |
|
|
16
16
|
| --- | --- | --- |
|
|
17
|
-
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
| listEntrypoints | `{}` | `{ entrypoints: { origin, name, view }[] }` |
|
|
18
|
+
|
|
19
|
+
listEntrypoints reads, with Shell's own authority, every Kernel `of_domain` locator whose View has
|
|
20
|
+
an outgoing `entrypoint` Edge, and returns one entry per Domain in origin order: its origin, the
|
|
21
|
+
`name` of its Domain Node, and the key of its entrypoint View. A Domain without an entrypoint is
|
|
22
|
+
not listed. Shell requires `read` on Kernel `Domain` and `of_domain`, and `traverse` on `entrypoint`
|
|
23
|
+
and `View`. Its `usesFunction` Policy admits any caller whose composed profile holds `can_use`
|
|
24
|
+
on the Function, so holding the capability is enough.
|
|
25
|
+
|
|
26
|
+
The Core `applications` Group carries `can_use` on listEntrypoints and View.resolve. Administrators
|
|
27
|
+
hold both directly (a Core Edge cannot author Kernel `extends_with`); members do not.
|
|
28
|
+
Share them dynamically with `Group.assignMember({ member: user, group: applications })`, which
|
|
29
|
+
composes the profile through `extends_with`; `unassignMember` withdraws it.
|
|
28
30
|
|
|
29
31
|
User extends Kernel.Identity and owns only optional creationKey correlation.
|
|
30
32
|
Concrete business classes may declare their own displayName/email; Shell never reads or writes them.
|
package/dist/domain.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type DomainDefinition } from '@astrale-os/sdk/domain';
|
|
|
2
2
|
import { ShellSchema } from './schema/index.js';
|
|
3
3
|
import { type ShellRuntime } from './runtime.js';
|
|
4
4
|
declare const frontend: import("@astrale-os/sdk/view").Frontend<import("@astrale-os/sdk/schema").AuthoredSchema<"shell.astrale.ai", readonly ["kernel.astrale.ai", import("@astrale-os/sdk/schema").KernelSchema] | readonly ["shell.astrale.ai", {
|
|
5
|
+
readonly name: 'Shell';
|
|
6
|
+
readonly entrypoint: 'application';
|
|
5
7
|
readonly classes: {
|
|
6
8
|
readonly User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
7
9
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
@@ -61,11 +63,13 @@ declare const frontend: import("@astrale-os/sdk/view").Frontend<import("@astrale
|
|
|
61
63
|
}>;
|
|
62
64
|
};
|
|
63
65
|
readonly functions: {
|
|
64
|
-
readonly
|
|
66
|
+
readonly listEntrypoints: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
65
67
|
readonly mode: 'value';
|
|
66
68
|
readonly value: {
|
|
67
|
-
|
|
69
|
+
entrypoints: {
|
|
68
70
|
origin: string;
|
|
71
|
+
name: string;
|
|
72
|
+
view: string;
|
|
69
73
|
}[];
|
|
70
74
|
};
|
|
71
75
|
}, "authorized", false, false, undefined>>;
|
package/dist/domain.js
CHANGED
|
@@ -6,15 +6,17 @@ const frontend = defineFrontend({
|
|
|
6
6
|
schema: ShellSchema,
|
|
7
7
|
source: vite({ config: './frontend/vite.config.ts' }),
|
|
8
8
|
routes: { application: { path: '/', handshake: 'shell' } },
|
|
9
|
-
entrypoint: 'application',
|
|
10
9
|
});
|
|
11
10
|
const domainRequirements = requirements({
|
|
12
11
|
// Sujet implicite : le principal installé Shell, utilisé par kernel.self.
|
|
13
12
|
functions: KernelRootFunctions,
|
|
14
13
|
classes: [
|
|
15
14
|
{ class: K.classes.extends_with, operations: ['create', 'read', 'traverse', 'delete'] },
|
|
16
|
-
//
|
|
15
|
+
// listEntrypoints reads every entrypoint View locator and its Domain as Shell.
|
|
17
16
|
{ class: K.classes.Domain, operations: ['read'] },
|
|
17
|
+
{ class: K.classes.of_domain, operations: ['read'] },
|
|
18
|
+
{ class: K.classes.entrypoint, operations: ['traverse'] },
|
|
19
|
+
{ class: K.classes.View, operations: ['traverse'] },
|
|
18
20
|
],
|
|
19
21
|
authority: {
|
|
20
22
|
grant: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'revoke'],
|
|
@@ -30,7 +32,7 @@ const domainRequirements = requirements({
|
|
|
30
32
|
S.classes.Group.static.methods.assignMember,
|
|
31
33
|
S.classes.Group.static.methods.unassignMember,
|
|
32
34
|
// Core Edges cannot author Kernel extends_with, so administrators hold it directly.
|
|
33
|
-
S.functions.
|
|
35
|
+
S.functions.listEntrypoints,
|
|
34
36
|
],
|
|
35
37
|
classes: [
|
|
36
38
|
{ class: S.classes.User, operations: ['create', 'read', 'traverse', 'update', 'delete'] },
|
|
@@ -52,6 +54,8 @@ const domainRequirements = requirements({
|
|
|
52
54
|
{
|
|
53
55
|
subject: S.core.nodes.member,
|
|
54
56
|
functions: [
|
|
57
|
+
// Download re-reads the holder Node with the caller's authority: no new data exposure.
|
|
58
|
+
K.functions.download,
|
|
55
59
|
K.functions.introspect,
|
|
56
60
|
K.functions.query,
|
|
57
61
|
K.functions.mutate,
|
|
@@ -61,7 +65,7 @@ const domainRequirements = requirements({
|
|
|
61
65
|
{
|
|
62
66
|
// Shared dynamically: Group.assignMember(user, applications) composes this profile.
|
|
63
67
|
subject: S.core.nodes.applications,
|
|
64
|
-
functions: [S.functions.
|
|
68
|
+
functions: [S.functions.listEntrypoints, K.classes.View.static.methods.resolve],
|
|
65
69
|
},
|
|
66
70
|
],
|
|
67
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { listEntrypoints } from './list-entrypoints.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { defineAction } from '@astrale-os/sdk/action';
|
|
2
|
+
import { readInstalledEntrypoints } from '../../queries/application/index.js';
|
|
3
|
+
/** One graph read: every Domain with an `entrypoint` Edge, its name and its entrypoint View. */
|
|
4
|
+
export const listEntrypoints = defineAction()('listEntrypoints', async ({ query }) => ({ entrypoints: [...(await query(readInstalledEntrypoints, {}))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { readInstalledEntrypoints } from './read-installed-entrypoints.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineQuery, Query, queryResult, } from '@astrale-os/sdk/query';
|
|
2
|
+
const VIEW_MEMBER = /^view\.([A-Za-z][A-Za-z0-9_]*)$/u;
|
|
3
|
+
/**
|
|
4
|
+
* Every installed Domain entrypoint this authority can read, in origin order. The `of_domain`
|
|
5
|
+
* locator of a View that has an outgoing `entrypoint` Edge names that View (`view.<name>`), and its
|
|
6
|
+
* target is the Domain, whose Node carries the origin and the display name.
|
|
7
|
+
*/
|
|
8
|
+
export const readInstalledEntrypoints = defineQuery()((domain) => {
|
|
9
|
+
const kernel = domain.dependencies.kernel.classes;
|
|
10
|
+
return {
|
|
11
|
+
id: 'shell.application.entrypoints',
|
|
12
|
+
page: { size: 200 },
|
|
13
|
+
pagination: { maximumPages: 50 },
|
|
14
|
+
build: () => {
|
|
15
|
+
const located = Query.from({ edges: [kernel.of_domain] });
|
|
16
|
+
return located
|
|
17
|
+
.expand({ from: located.source, via: [kernel.entrypoint], direction: 'outgoing' })
|
|
18
|
+
.select({
|
|
19
|
+
kind: 'edges',
|
|
20
|
+
binding: located.edge,
|
|
21
|
+
projection: { edge: 'value', source: 'reference', target: 'value' },
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
project(pages) {
|
|
25
|
+
const entries = [];
|
|
26
|
+
for (const page of pages) {
|
|
27
|
+
for (const item of queryResult.edgeItems(page, 'Installed entrypoints')) {
|
|
28
|
+
if (item.edge.kind !== 'value' || item.target.kind !== 'value') {
|
|
29
|
+
throw new TypeError('Installed entrypoint is not a complete value.');
|
|
30
|
+
}
|
|
31
|
+
const member = VIEW_MEMBER.exec(String(item.edge.value.props[kernel.of_domain.properties.member.key]));
|
|
32
|
+
const props = item.target.value.props;
|
|
33
|
+
const origin = props[kernel.Domain.properties.origin.key];
|
|
34
|
+
const name = props[kernel.Domain.properties.name.key];
|
|
35
|
+
if (member === null || typeof origin !== 'string' || typeof name !== 'string') {
|
|
36
|
+
throw new TypeError('Installed entrypoint has no View, origin, or name.');
|
|
37
|
+
}
|
|
38
|
+
entries.push({ origin, name, view: `${origin}:view.${member[1]}` });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return entries.sort((left, right) => left.origin.localeCompare(right.origin));
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
});
|
package/dist/runtime.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ declare const initialize: (environment: unknown) => {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
declare const functions: readonly [import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").AuthoredSchema<"shell.astrale.ai", readonly ["kernel.astrale.ai", import("@astrale-os/sdk/schema").KernelSchema] | readonly ["shell.astrale.ai", {
|
|
16
|
+
readonly name: 'Shell';
|
|
17
|
+
readonly entrypoint: 'application';
|
|
16
18
|
readonly classes: {
|
|
17
19
|
readonly User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
18
20
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
@@ -72,11 +74,13 @@ declare const functions: readonly [import("@astrale-os/sdk/workflow").WorkflowDe
|
|
|
72
74
|
}>;
|
|
73
75
|
};
|
|
74
76
|
readonly functions: {
|
|
75
|
-
readonly
|
|
77
|
+
readonly listEntrypoints: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
76
78
|
readonly mode: 'value';
|
|
77
79
|
readonly value: {
|
|
78
|
-
|
|
80
|
+
entrypoints: {
|
|
79
81
|
origin: string;
|
|
82
|
+
name: string;
|
|
83
|
+
view: string;
|
|
80
84
|
}[];
|
|
81
85
|
};
|
|
82
86
|
}, "authorized", false, false, undefined>>;
|
|
@@ -128,6 +132,8 @@ declare const functions: readonly [import("@astrale-os/sdk/workflow").WorkflowDe
|
|
|
128
132
|
}, import("zod/v4/core").$strict>;
|
|
129
133
|
};
|
|
130
134
|
}>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").AuthoredSchema<"shell.astrale.ai", readonly ["kernel.astrale.ai", import("@astrale-os/sdk/schema").KernelSchema] | readonly ["shell.astrale.ai", {
|
|
135
|
+
readonly name: 'Shell';
|
|
136
|
+
readonly entrypoint: 'application';
|
|
131
137
|
readonly classes: {
|
|
132
138
|
readonly User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
133
139
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
@@ -187,11 +193,13 @@ declare const functions: readonly [import("@astrale-os/sdk/workflow").WorkflowDe
|
|
|
187
193
|
}>;
|
|
188
194
|
};
|
|
189
195
|
readonly functions: {
|
|
190
|
-
readonly
|
|
196
|
+
readonly listEntrypoints: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
191
197
|
readonly mode: 'value';
|
|
192
198
|
readonly value: {
|
|
193
|
-
|
|
199
|
+
entrypoints: {
|
|
194
200
|
origin: string;
|
|
201
|
+
name: string;
|
|
202
|
+
view: string;
|
|
195
203
|
}[];
|
|
196
204
|
};
|
|
197
205
|
}, "authorized", false, false, undefined>>;
|
|
@@ -241,6 +249,8 @@ declare const functions: readonly [import("@astrale-os/sdk/workflow").WorkflowDe
|
|
|
241
249
|
}, import("zod/v4/core").$strict>;
|
|
242
250
|
};
|
|
243
251
|
}>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").AuthoredSchema<"shell.astrale.ai", readonly ["kernel.astrale.ai", import("@astrale-os/sdk/schema").KernelSchema] | readonly ["shell.astrale.ai", {
|
|
252
|
+
readonly name: 'Shell';
|
|
253
|
+
readonly entrypoint: 'application';
|
|
244
254
|
readonly classes: {
|
|
245
255
|
readonly User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
246
256
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
@@ -300,11 +310,13 @@ declare const functions: readonly [import("@astrale-os/sdk/workflow").WorkflowDe
|
|
|
300
310
|
}>;
|
|
301
311
|
};
|
|
302
312
|
readonly functions: {
|
|
303
|
-
readonly
|
|
313
|
+
readonly listEntrypoints: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
304
314
|
readonly mode: 'value';
|
|
305
315
|
readonly value: {
|
|
306
|
-
|
|
316
|
+
entrypoints: {
|
|
307
317
|
origin: string;
|
|
318
|
+
name: string;
|
|
319
|
+
view: string;
|
|
308
320
|
}[];
|
|
309
321
|
};
|
|
310
322
|
}, "authorized", false, false, undefined>>;
|
|
@@ -354,6 +366,8 @@ declare const functions: readonly [import("@astrale-os/sdk/workflow").WorkflowDe
|
|
|
354
366
|
}, import("zod/v4/core").$strict>;
|
|
355
367
|
};
|
|
356
368
|
}>, import("@astrale-os/sdk/action").ActionDefinition<import("@astrale-os/sdk/schema").AuthoredSchema<"shell.astrale.ai", readonly ["kernel.astrale.ai", import("@astrale-os/sdk/schema").KernelSchema] | readonly ["shell.astrale.ai", {
|
|
369
|
+
readonly name: 'Shell';
|
|
370
|
+
readonly entrypoint: 'application';
|
|
357
371
|
readonly classes: {
|
|
358
372
|
readonly User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
359
373
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
@@ -413,11 +427,13 @@ declare const functions: readonly [import("@astrale-os/sdk/workflow").WorkflowDe
|
|
|
413
427
|
}>;
|
|
414
428
|
};
|
|
415
429
|
readonly functions: {
|
|
416
|
-
readonly
|
|
430
|
+
readonly listEntrypoints: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
417
431
|
readonly mode: 'value';
|
|
418
432
|
readonly value: {
|
|
419
|
-
|
|
433
|
+
entrypoints: {
|
|
420
434
|
origin: string;
|
|
435
|
+
name: string;
|
|
436
|
+
view: string;
|
|
421
437
|
}[];
|
|
422
438
|
};
|
|
423
439
|
}, "authorized", false, false, undefined>>;
|
|
@@ -440,7 +456,7 @@ declare const functions: readonly [import("@astrale-os/sdk/workflow").WorkflowDe
|
|
|
440
456
|
};
|
|
441
457
|
}, {
|
|
442
458
|
readonly kernel: "kernel.astrale.ai";
|
|
443
|
-
}]>, "
|
|
459
|
+
}]>, "listEntrypoints", Readonly<Record<never, never>>, Readonly<Record<never, never>>>];
|
|
444
460
|
export type ShellRuntime = Runtime<ShellSchema, typeof integrations, typeof initialize, typeof functions>;
|
|
445
461
|
declare const runtime: ShellRuntime;
|
|
446
462
|
export default runtime;
|
package/dist/runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineRuntime } from '@astrale-os/sdk/runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { listEntrypoints } from './functions/application/index.js';
|
|
3
3
|
import { assignMember, unassignMember } from './functions/group/index.js';
|
|
4
4
|
import { invite } from './functions/user/index.js';
|
|
5
5
|
import { integrations } from './integrations/index.js';
|
|
@@ -7,7 +7,7 @@ import { enrollmentProvider } from './providers/admin-enrollment/index.js';
|
|
|
7
7
|
const initialize = (environment) => ({
|
|
8
8
|
providers: { enrollment: enrollmentProvider(environment) },
|
|
9
9
|
});
|
|
10
|
-
const functions = [invite, assignMember, unassignMember,
|
|
10
|
+
const functions = [invite, assignMember, unassignMember, listEntrypoints];
|
|
11
11
|
const runtime = defineRuntime()({
|
|
12
12
|
integrations,
|
|
13
13
|
initialize,
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { ShellSchema, S, type Shell, type ShellClasses, type ShellSchemaInput }
|
|
|
2
2
|
export { User } from './modules/user/index.js';
|
|
3
3
|
export type { InvitationSummary } from './modules/user/index.js';
|
|
4
4
|
export { Group, member_of_group, adminGroup, applicationsGroup, memberGroup, } from './modules/group/index.js';
|
|
5
|
-
export {
|
|
5
|
+
export { listEntrypoints, type EntrypointEntry } from './modules/application/index.js';
|
package/dist/schema/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ShellSchema, S } from './schema.js';
|
|
2
2
|
export { User } from './modules/user/index.js';
|
|
3
3
|
export { Group, member_of_group, adminGroup, applicationsGroup, memberGroup, } from './modules/group/index.js';
|
|
4
|
-
export {
|
|
4
|
+
export { listEntrypoints } from './modules/application/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { listEntrypoints } from './list-entrypoints.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { listEntrypoints } from './list-entrypoints.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Function as SchemaFunction } from '@astrale-os/sdk/schema';
|
|
2
|
+
/**
|
|
3
|
+
* The entrypoint View of every installed Domain that declares one, with its Domain name. Shell
|
|
4
|
+
* reads the Kernel `entrypoint` Edges with its own authority; a Domain without one is not listed.
|
|
5
|
+
*/
|
|
6
|
+
export declare const listEntrypoints: SchemaFunction<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
7
|
+
readonly mode: 'value';
|
|
8
|
+
readonly value: {
|
|
9
|
+
entrypoints: {
|
|
10
|
+
origin: string;
|
|
11
|
+
name: string;
|
|
12
|
+
view: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
}, "authorized", false, false, undefined>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { func } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { usesFunction } from '../../../policies/index.js';
|
|
4
|
+
import { entrypointEntry } from '../types/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* The entrypoint View of every installed Domain that declares one, with its Domain name. Shell
|
|
7
|
+
* reads the Kernel `entrypoint` Edges with its own authority; a Domain without one is not listed.
|
|
8
|
+
*/
|
|
9
|
+
export const listEntrypoints = func({
|
|
10
|
+
description: 'List the entrypoint View and name of every installed Domain that declares one.',
|
|
11
|
+
auth: 'authorized',
|
|
12
|
+
input: z.strictObject({}),
|
|
13
|
+
output: z.object({ entrypoints: z.array(entrypointEntry) }),
|
|
14
|
+
// Holding can_use is enough: membership of the Applications Group shares it dynamically.
|
|
15
|
+
policy: ({ check, ref }) => check(usesFunction, ref(() => listEntrypoints)),
|
|
16
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { listEntrypoints } from './functions/index.js';
|
|
2
|
+
export { entrypointEntry, type EntrypointEntry } from './types/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { listEntrypoints } from './functions/index.js';
|
|
2
|
+
export { entrypointEntry } from './types/index.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** One installed Domain entrypoint: the Domain origin, its display name, and its View key. */
|
|
3
|
+
export declare const entrypointEntry: z.ZodObject<{
|
|
4
|
+
origin: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
view: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type EntrypointEntry = z.infer<typeof entrypointEntry>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { entrypointEntry, type EntrypointEntry } from './entrypoint-entry.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { entrypointEntry } from './entrypoint-entry.js';
|
package/dist/schema/schema.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ declare const classes: {
|
|
|
60
60
|
};
|
|
61
61
|
export type ShellClasses = typeof classes;
|
|
62
62
|
declare const input: {
|
|
63
|
+
readonly name: 'Shell';
|
|
64
|
+
readonly entrypoint: 'application';
|
|
63
65
|
readonly dependencies: {
|
|
64
66
|
readonly kernel: KernelSchema;
|
|
65
67
|
};
|
|
@@ -122,11 +124,13 @@ declare const input: {
|
|
|
122
124
|
}>;
|
|
123
125
|
};
|
|
124
126
|
readonly functions: {
|
|
125
|
-
readonly
|
|
127
|
+
readonly listEntrypoints: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
126
128
|
readonly mode: 'value';
|
|
127
129
|
readonly value: {
|
|
128
|
-
|
|
130
|
+
entrypoints: {
|
|
129
131
|
origin: string;
|
|
132
|
+
name: string;
|
|
133
|
+
view: string;
|
|
130
134
|
}[];
|
|
131
135
|
};
|
|
132
136
|
}, "authorized", false, false, undefined>>;
|
|
@@ -150,6 +154,8 @@ declare const input: {
|
|
|
150
154
|
};
|
|
151
155
|
export type ShellSchemaInput = typeof input;
|
|
152
156
|
export declare const ShellSchema: import("@astrale-os/sdk/schema").AuthoredSchema<"shell.astrale.ai", readonly ["kernel.astrale.ai", KernelSchema] | readonly ["shell.astrale.ai", {
|
|
157
|
+
readonly name: 'Shell';
|
|
158
|
+
readonly entrypoint: 'application';
|
|
153
159
|
readonly classes: {
|
|
154
160
|
readonly User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
155
161
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
@@ -209,11 +215,13 @@ export declare const ShellSchema: import("@astrale-os/sdk/schema").AuthoredSchem
|
|
|
209
215
|
}>;
|
|
210
216
|
};
|
|
211
217
|
readonly functions: {
|
|
212
|
-
readonly
|
|
218
|
+
readonly listEntrypoints: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
213
219
|
readonly mode: 'value';
|
|
214
220
|
readonly value: {
|
|
215
|
-
|
|
221
|
+
entrypoints: {
|
|
216
222
|
origin: string;
|
|
223
|
+
name: string;
|
|
224
|
+
view: string;
|
|
217
225
|
}[];
|
|
218
226
|
};
|
|
219
227
|
}, "authorized", false, false, undefined>>;
|
|
@@ -239,6 +247,8 @@ export declare const ShellSchema: import("@astrale-os/sdk/schema").AuthoredSchem
|
|
|
239
247
|
}]>;
|
|
240
248
|
export type ShellSchema = typeof ShellSchema;
|
|
241
249
|
export declare const S: schema.ResolvedDomainOf<import("@astrale-os/sdk/schema").AuthoredSchema<"shell.astrale.ai", readonly ["kernel.astrale.ai", KernelSchema] | readonly ["shell.astrale.ai", {
|
|
250
|
+
readonly name: 'Shell';
|
|
251
|
+
readonly entrypoint: 'application';
|
|
242
252
|
readonly classes: {
|
|
243
253
|
readonly User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
244
254
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
@@ -298,11 +308,13 @@ export declare const S: schema.ResolvedDomainOf<import("@astrale-os/sdk/schema")
|
|
|
298
308
|
}>;
|
|
299
309
|
};
|
|
300
310
|
readonly functions: {
|
|
301
|
-
readonly
|
|
311
|
+
readonly listEntrypoints: import("@astrale-os/sdk/schema").Function<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
302
312
|
readonly mode: 'value';
|
|
303
313
|
readonly value: {
|
|
304
|
-
|
|
314
|
+
entrypoints: {
|
|
305
315
|
origin: string;
|
|
316
|
+
name: string;
|
|
317
|
+
view: string;
|
|
306
318
|
}[];
|
|
307
319
|
};
|
|
308
320
|
}, "authorized", false, false, undefined>>;
|
package/dist/schema/schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineSchema, KernelSchema, schema } from '@astrale-os/sdk/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { listEntrypoints } from './modules/application/index.js';
|
|
3
3
|
import { Group, member_of_group, adminGroup, applicationsGroup, memberGroup, belongsToGroup, } from './modules/group/index.js';
|
|
4
4
|
import { User } from './modules/user/index.js';
|
|
5
5
|
import { ownsClass, administersShellClass, usesFunction } from './policies/index.js';
|
|
@@ -7,13 +7,15 @@ import { applicationView } from './views/index.js';
|
|
|
7
7
|
export const ORIGIN = 'shell.astrale.ai';
|
|
8
8
|
const dependencies = { kernel: KernelSchema };
|
|
9
9
|
const classes = { User, Group, member_of_group };
|
|
10
|
-
const functions = {
|
|
10
|
+
const functions = { listEntrypoints };
|
|
11
11
|
const policies = { belongsToGroup, ownsClass, administersShellClass, usesFunction };
|
|
12
12
|
const views = { application: applicationView };
|
|
13
13
|
const core = {
|
|
14
14
|
nodes: { admin: adminGroup, applications: applicationsGroup, member: memberGroup },
|
|
15
15
|
};
|
|
16
16
|
const input = {
|
|
17
|
+
name: 'Shell',
|
|
18
|
+
entrypoint: 'application',
|
|
17
19
|
dependencies,
|
|
18
20
|
classes,
|
|
19
21
|
functions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-domains/shell",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.40",
|
|
4
4
|
"description": "Astrale Shell Domain schema and remote product implementation",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@astrale-os/ox": "0.1.4",
|
|
61
|
-
"@astrale-os/sdk": "0.6.0-beta.
|
|
62
|
-
"@astrale-os/shell-react": ">=0.
|
|
61
|
+
"@astrale-os/sdk": "0.6.0-beta.24",
|
|
62
|
+
"@astrale-os/shell-react": ">=0.6.0-beta.0 <1.0.0",
|
|
63
63
|
"@astrale-os/ui": "0.3.0-beta.32",
|
|
64
64
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~2.0.0",
|
|
65
65
|
"@testing-library/dom": "10.4.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vitest": "5.0.1"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@astrale-os/sdk": ">=0.6.0-beta.
|
|
79
|
+
"@astrale-os/sdk": ">=0.6.0-beta.24 <1.0.0"
|
|
80
80
|
},
|
|
81
81
|
"devEngines": {
|
|
82
82
|
"runtime": {
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { defineAction } from '@astrale-os/sdk/action';
|
|
2
|
-
import { Path } from '@astrale-os/sdk/graph/path';
|
|
3
|
-
import { readInstalledDomainOrigins } from '../../queries/application/index.js';
|
|
4
|
-
/** Catalogues resolved together, so a large instance does not flood the Kernel. */
|
|
5
|
-
const RESOLVE_BATCH = 16;
|
|
6
|
-
export const listApplications = defineAction()('listApplications', async ({ query, kernel }) => {
|
|
7
|
-
const origins = await query(readInstalledDomainOrigins, {});
|
|
8
|
-
const applications = [];
|
|
9
|
-
for (let offset = 0; offset < origins.length; offset += RESOLVE_BATCH) {
|
|
10
|
-
const batch = origins.slice(offset, offset + RESOLVE_BATCH);
|
|
11
|
-
// The caller's authority decides which Views it can open.
|
|
12
|
-
const catalogues = await Promise.all(batch.map((origin) => kernel.caller.viewsFor(Path.domain(origin))));
|
|
13
|
-
for (const [index, origin] of batch.entries()) {
|
|
14
|
-
if (catalogues[index].views.length > 0)
|
|
15
|
-
applications.push({ origin });
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return { applications };
|
|
19
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineQuery, Query, queryResult, } from '@astrale-os/sdk/query';
|
|
2
|
-
/** Every installed Domain origin this authority can read, in origin order. */
|
|
3
|
-
export const readInstalledDomainOrigins = defineQuery()((domain) => ({
|
|
4
|
-
id: 'shell.application.domain-origins',
|
|
5
|
-
page: { size: 200 },
|
|
6
|
-
pagination: { maximumPages: 50 },
|
|
7
|
-
build: () => Query.from({ nodes: [domain.dependencies.kernel.classes.Domain] }).select({
|
|
8
|
-
kind: 'nodes',
|
|
9
|
-
projection: { kind: 'value' },
|
|
10
|
-
}),
|
|
11
|
-
project(pages) {
|
|
12
|
-
return queryResult
|
|
13
|
-
.completeNodeValues(pages, 'Installed Domains')
|
|
14
|
-
.map((installed) => {
|
|
15
|
-
const value = installed.props[domain.dependencies.kernel.classes.Domain.properties.origin.key];
|
|
16
|
-
if (typeof value !== 'string')
|
|
17
|
-
throw new TypeError('Installed Domain has no origin.');
|
|
18
|
-
return value;
|
|
19
|
-
})
|
|
20
|
-
.sort((left, right) => left.localeCompare(right));
|
|
21
|
-
},
|
|
22
|
-
}));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type Function as SchemaFunction } from '@astrale-os/sdk/schema';
|
|
2
|
-
/**
|
|
3
|
-
* Installed Domains that expose at least one View to the caller. Shell reads the Domain catalogue
|
|
4
|
-
* with its own authority; each catalogue of Views is resolved with the caller's.
|
|
5
|
-
*/
|
|
6
|
-
export declare const listApplications: SchemaFunction<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
7
|
-
readonly mode: 'value';
|
|
8
|
-
readonly value: {
|
|
9
|
-
applications: {
|
|
10
|
-
origin: string;
|
|
11
|
-
}[];
|
|
12
|
-
};
|
|
13
|
-
}, "authorized", false, false, undefined>>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { func } from '@astrale-os/sdk/schema';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { usesFunction } from '../../../policies/index.js';
|
|
4
|
-
import { applicationEntry } from '../types/index.js';
|
|
5
|
-
/**
|
|
6
|
-
* Installed Domains that expose at least one View to the caller. Shell reads the Domain catalogue
|
|
7
|
-
* with its own authority; each catalogue of Views is resolved with the caller's.
|
|
8
|
-
*/
|
|
9
|
-
export const listApplications = func({
|
|
10
|
-
description: 'List the installed Domains whose Views the caller can open.',
|
|
11
|
-
auth: 'authorized',
|
|
12
|
-
input: z.strictObject({}),
|
|
13
|
-
output: z.object({ applications: z.array(applicationEntry) }),
|
|
14
|
-
// Holding can_use is enough: membership of the Applications Group shares it dynamically.
|
|
15
|
-
policy: ({ check, ref }) => check(usesFunction, ref(() => listApplications)),
|
|
16
|
-
});
|