@astrale-domains/shell 0.1.0-beta.9 → 0.1.1
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 +264 -64
- package/dist/domain.d.ts +225 -0
- package/dist/domain.js +96 -0
- package/dist/functions/application/index.js +1 -0
- package/dist/functions/application/list-entrypoints.js +6 -0
- package/dist/functions/group/assign-member-to-group.js +4 -0
- package/dist/functions/group/change-group-membership.js +34 -0
- package/dist/functions/group/group-membership-errors.js +23 -0
- package/dist/functions/group/index.js +2 -0
- package/dist/functions/group/unassign-member-from-group.js +4 -0
- package/dist/functions/namespace/index.js +3 -0
- package/dist/functions/namespace/link.js +30 -0
- package/dist/functions/namespace/namespace-errors.js +28 -0
- package/dist/functions/namespace/namespace-name.js +13 -0
- package/dist/functions/namespace/rename.js +31 -0
- package/dist/functions/namespace/unlink.js +21 -0
- package/dist/functions/user/index.js +2 -0
- package/dist/functions/user/invite-user.js +39 -0
- package/dist/functions/user/record-profile.js +18 -0
- package/dist/functions/view-access/assign-views.js +86 -0
- package/dist/functions/view-access/index.js +1 -0
- package/dist/functions/view-access/view-access-errors.js +28 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/integrations/index.d.ts +1 -0
- package/dist/integrations/index.js +1 -0
- package/dist/integrations/integrations.d.ts +9 -0
- package/dist/integrations/integrations.js +2 -0
- package/dist/integrations/user-invitation/index.d.ts +4 -0
- package/dist/integrations/user-invitation/index.js +3 -0
- package/dist/integrations/user-invitation/invitation-request-failure.d.ts +5 -0
- package/dist/integrations/user-invitation/invitation-request-failure.js +9 -0
- package/dist/integrations/user-invitation/invite-user-request.d.ts +6 -0
- package/dist/integrations/user-invitation/invite-user-request.js +1 -0
- package/dist/integrations/user-invitation/request-user-invitation.d.ts +8 -0
- package/dist/integrations/user-invitation/request-user-invitation.js +9 -0
- package/dist/mutations/group/index.js +1 -1
- package/dist/mutations/group/set-group-membership.js +29 -0
- package/dist/mutations/namespace/alias-write.js +22 -0
- package/dist/mutations/namespace/index.js +3 -0
- package/dist/mutations/namespace/link-alias.js +15 -0
- package/dist/mutations/namespace/rename-alias.js +13 -0
- package/dist/mutations/namespace/unlink-alias.js +13 -0
- package/dist/mutations/user/index.js +1 -1
- package/dist/mutations/user/record-user-profile.js +13 -0
- package/dist/mutations/view-access/index.js +1 -0
- package/dist/mutations/view-access/set-view-access.js +29 -0
- package/dist/providers/admin-enrollment/create-admin-enrollment-provider.js +78 -0
- package/dist/providers/admin-enrollment/decode-admin-invitation-response.js +20 -0
- package/dist/providers/admin-enrollment/index.js +1 -0
- package/dist/providers/admin-enrollment/read-enrollment-response.js +34 -0
- package/dist/queries/application/index.js +1 -0
- package/dist/queries/application/read-installed-entrypoints.js +28 -0
- package/dist/queries/group/index.js +2 -0
- package/dist/queries/group/read-group-membership-endpoints.js +18 -0
- package/dist/queries/group/read-group-membership.js +35 -0
- package/dist/queries/namespace/index.js +2 -0
- package/dist/queries/namespace/read-designated-node.js +12 -0
- package/dist/queries/namespace/read-view-aliases.js +46 -0
- package/dist/queries/user/index.js +1 -5
- package/dist/queries/user/read-user-profile.js +9 -0
- package/dist/queries/view-access/index.js +1 -0
- package/dist/queries/view-access/read-view-access.js +35 -0
- package/dist/runtime.d.ts +1603 -6784
- package/dist/runtime.js +24 -14
- package/dist/schema/index.d.ts +7 -6
- package/dist/schema/index.js +6 -6
- package/dist/schema/modules/application/functions/index.d.ts +1 -0
- package/dist/schema/modules/application/functions/index.js +1 -0
- 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 -0
- package/dist/schema/modules/application/index.js +2 -0
- 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 -0
- package/dist/schema/modules/application/types/index.js +1 -0
- package/dist/schema/modules/group/classes/group.d.ts +24 -0
- package/dist/schema/modules/group/classes/group.js +11 -0
- package/dist/schema/modules/group/classes/index.d.ts +2 -0
- package/dist/schema/modules/group/classes/index.js +2 -0
- package/dist/schema/modules/group/classes/member-of-group.d.ts +30 -0
- package/dist/schema/modules/group/classes/member-of-group.js +12 -0
- package/dist/schema/modules/group/core/administrators-group.d.ts +1 -0
- package/dist/schema/modules/group/core/administrators-group.js +6 -0
- package/dist/schema/modules/group/core/applications-group.d.ts +1 -0
- package/dist/schema/modules/group/core/applications-group.js +6 -0
- package/dist/schema/modules/group/core/index.d.ts +3 -0
- package/dist/schema/modules/group/core/index.js +3 -0
- package/dist/schema/modules/group/core/members-group.d.ts +1 -0
- package/dist/schema/modules/group/core/members-group.js +6 -0
- package/dist/schema/modules/group/functions/assign-member-to-group.js +11 -0
- package/dist/schema/modules/group/functions/index.js +2 -0
- package/dist/schema/modules/group/functions/unassign-member-from-group.js +11 -0
- package/dist/schema/modules/group/index.d.ts +3 -0
- package/dist/schema/modules/group/index.js +3 -0
- package/dist/schema/modules/group/policies/belongs-to-group.d.ts +1 -0
- package/dist/schema/modules/group/policies/belongs-to-group.js +5 -0
- package/dist/schema/modules/group/policies/index.d.ts +1 -0
- package/dist/schema/modules/group/policies/index.js +1 -0
- package/dist/schema/modules/group/types/group-membership-input.js +8 -0
- package/dist/schema/modules/group/types/index.js +1 -0
- package/dist/schema/modules/namespace/classes/alias.d.ts +31 -0
- package/dist/schema/modules/namespace/classes/alias.js +13 -0
- package/dist/schema/modules/namespace/classes/index.d.ts +2 -0
- package/dist/schema/modules/namespace/classes/index.js +2 -0
- package/dist/schema/modules/namespace/classes/namespace.d.ts +31 -0
- package/dist/schema/modules/namespace/classes/namespace.js +10 -0
- package/dist/schema/modules/namespace/core/index.d.ts +1 -0
- package/dist/schema/modules/namespace/core/index.js +1 -0
- package/dist/schema/modules/namespace/core/views-namespace.d.ts +2 -0
- package/dist/schema/modules/namespace/core/views-namespace.js +7 -0
- package/dist/schema/modules/namespace/functions/index.js +3 -0
- package/dist/schema/modules/namespace/functions/link.js +11 -0
- package/dist/schema/modules/namespace/functions/rename.js +11 -0
- package/dist/schema/modules/namespace/functions/unlink.js +11 -0
- package/dist/schema/modules/namespace/index.d.ts +2 -0
- package/dist/schema/modules/namespace/index.js +2 -0
- package/dist/schema/modules/namespace/types/index.js +1 -0
- package/dist/schema/modules/namespace/types/namespace-name.js +7 -0
- package/dist/schema/modules/user/classes/index.d.ts +1 -0
- package/dist/schema/modules/user/classes/index.js +1 -0
- package/dist/schema/modules/user/classes/user.d.ts +34 -0
- package/dist/schema/modules/user/classes/user.js +21 -0
- package/dist/schema/modules/user/functions/index.js +2 -0
- package/dist/schema/modules/user/functions/invite-user.js +12 -0
- package/dist/schema/modules/user/functions/record-profile.js +14 -0
- package/dist/schema/modules/user/index.d.ts +2 -0
- package/dist/schema/modules/user/index.js +2 -0
- package/dist/schema/modules/user/types/index.d.ts +2 -0
- package/dist/schema/modules/user/types/index.js +2 -0
- package/dist/schema/modules/user/types/invitation-summary.d.ts +16 -0
- package/dist/schema/modules/user/types/invitation-summary.js +15 -0
- package/dist/schema/modules/user/types/user-profile.d.ts +7 -0
- package/dist/schema/modules/user/types/user-profile.js +7 -0
- package/dist/schema/modules/view-access/classes/index.d.ts +1 -0
- package/dist/schema/modules/view-access/classes/index.js +1 -0
- package/dist/schema/modules/view-access/classes/view-access.d.ts +32 -0
- package/dist/schema/modules/view-access/classes/view-access.js +18 -0
- package/dist/schema/modules/view-access/core/index.d.ts +1 -0
- package/dist/schema/modules/view-access/core/index.js +1 -0
- package/dist/schema/modules/view-access/core/view-only-group.d.ts +5 -0
- package/dist/schema/modules/view-access/core/view-only-group.js +10 -0
- package/dist/schema/modules/view-access/functions/assign-views.d.ts +16 -0
- package/dist/schema/modules/view-access/functions/assign-views.js +17 -0
- package/dist/schema/modules/view-access/functions/index.d.ts +1 -0
- package/dist/schema/modules/view-access/functions/index.js +1 -0
- package/dist/schema/modules/view-access/index.d.ts +3 -0
- package/dist/schema/modules/view-access/index.js +3 -0
- package/dist/schema/modules/view-access/types/index.js +1 -0
- package/dist/schema/modules/view-access/types/view-assignment.js +16 -0
- package/dist/schema/policies/administers-shell-class.js +11 -0
- package/dist/schema/policies/index.js +4 -0
- package/dist/schema/policies/is-self.js +5 -0
- package/dist/schema/policies/owns-class.js +7 -0
- package/dist/schema/policies/uses-function.js +5 -0
- package/dist/schema/schema.d.ts +833 -0
- package/dist/schema/schema.js +35 -0
- package/dist/schema/views/application-view.js +4 -0
- package/dist/schema/views/index.js +1 -0
- package/dist/utils/canonical-node-path/index.js +1 -0
- package/dist/utils/canonical-node-path/parse-canonical-node-path.js +8 -0
- package/package.json +50 -10
- package/dist/actions/index.js +0 -1
- package/dist/actions/user/index.js +0 -1
- package/dist/actions/user/resolve-home.js +0 -19
- package/dist/application.d.ts +0 -9809
- package/dist/application.js +0 -29
- package/dist/mutations/group/membership.js +0 -19
- package/dist/mutations/space/access.js +0 -23
- package/dist/mutations/space/default.js +0 -23
- package/dist/mutations/space/index.js +0 -2
- package/dist/mutations/user/repair.js +0 -83
- package/dist/queries/space/access.js +0 -12
- package/dist/queries/space/admin.js +0 -20
- package/dist/queries/space/index.js +0 -3
- package/dist/queries/space/member.js +0 -17
- package/dist/queries/user/groups.js +0 -17
- package/dist/queries/user/home.js +0 -21
- package/dist/queries/user/owned-spaces.js +0 -17
- package/dist/queries/user/profile.js +0 -14
- package/dist/queries/user/setup.js +0 -16
- package/dist/schema/domain/index.d.ts +0 -1665
- package/dist/schema/domain/index.js +0 -39
- package/dist/schema/group/class.d.ts +0 -323
- package/dist/schema/group/class.js +0 -7
- package/dist/schema/group/core.d.ts +0 -10
- package/dist/schema/group/core.js +0 -14
- package/dist/schema/group/index.d.ts +0 -6
- package/dist/schema/group/index.js +0 -6
- package/dist/schema/group/methods.d.ts +0 -13
- package/dist/schema/group/methods.js +0 -22
- package/dist/schema/group/policies.d.ts +0 -1
- package/dist/schema/group/policies.js +0 -6
- package/dist/schema/group/relationships.d.ts +0 -16
- package/dist/schema/group/relationships.js +0 -8
- package/dist/schema/group/view.d.ts +0 -1
- package/dist/schema/group/view.js +0 -6
- package/dist/schema/home/index.d.ts +0 -1
- package/dist/schema/home/index.js +0 -1
- package/dist/schema/home/view.d.ts +0 -1
- package/dist/schema/home/view.js +0 -4
- package/dist/schema/setup/functions.d.ts +0 -28
- package/dist/schema/setup/functions.js +0 -27
- package/dist/schema/setup/index.d.ts +0 -1
- package/dist/schema/setup/index.js +0 -1
- package/dist/schema/space/class.d.ts +0 -80
- package/dist/schema/space/class.js +0 -11
- package/dist/schema/space/core.d.ts +0 -8
- package/dist/schema/space/core.js +0 -15
- package/dist/schema/space/index.d.ts +0 -6
- package/dist/schema/space/index.js +0 -6
- package/dist/schema/space/methods.d.ts +0 -18
- package/dist/schema/space/methods.js +0 -32
- package/dist/schema/space/policies.d.ts +0 -4
- package/dist/schema/space/policies.js +0 -21
- package/dist/schema/space/relationships.d.ts +0 -64
- package/dist/schema/space/relationships.js +0 -24
- package/dist/schema/space/view.d.ts +0 -1
- package/dist/schema/space/view.js +0 -6
- package/dist/schema/user/class.d.ts +0 -278
- package/dist/schema/user/class.js +0 -11
- package/dist/schema/user/index.d.ts +0 -3
- package/dist/schema/user/index.js +0 -3
- package/dist/schema/user/methods.d.ts +0 -7
- package/dist/schema/user/methods.js +0 -11
- package/dist/schema/user/view.d.ts +0 -1
- package/dist/schema/user/view.js +0 -6
- package/dist/workflows/group/assign.js +0 -3
- package/dist/workflows/group/change.js +0 -31
- package/dist/workflows/group/index.js +0 -3
- package/dist/workflows/group/unassign.js +0 -3
- package/dist/workflows/index.js +0 -3
- package/dist/workflows/setup/admin.js +0 -3
- package/dist/workflows/setup/index.js +0 -5
- package/dist/workflows/setup/member.js +0 -3
- package/dist/workflows/setup/plan.js +0 -88
- package/dist/workflows/setup/provision.js +0 -57
- package/dist/workflows/setup/run.js +0 -74
- package/dist/workflows/space/access.js +0 -41
- package/dist/workflows/space/add.js +0 -3
- package/dist/workflows/space/default.js +0 -37
- package/dist/workflows/space/index.js +0 -4
- package/dist/workflows/space/remove.js +0 -3
package/dist/runtime.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { defineRuntime } from '@astrale-os/sdk/runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { listEntrypoints } from './functions/application/index.js';
|
|
3
|
+
import { assignMember, unassignMember } from './functions/group/index.js';
|
|
4
|
+
import { link, rename, unlink } from './functions/namespace/index.js';
|
|
5
|
+
import { invite, recordProfile } from './functions/user/index.js';
|
|
6
|
+
import { assignViews } from './functions/view-access/index.js';
|
|
7
|
+
import { integrations } from './integrations/index.js';
|
|
8
|
+
import { enrollmentProvider } from './providers/admin-enrollment/index.js';
|
|
9
|
+
const initialize = (environment) => ({
|
|
10
|
+
providers: { enrollment: enrollmentProvider(environment) },
|
|
11
|
+
});
|
|
12
|
+
const functions = [
|
|
13
|
+
invite,
|
|
14
|
+
assignMember,
|
|
15
|
+
unassignMember,
|
|
16
|
+
listEntrypoints,
|
|
17
|
+
link,
|
|
18
|
+
unlink,
|
|
19
|
+
rename,
|
|
20
|
+
assignViews,
|
|
21
|
+
recordProfile,
|
|
22
|
+
];
|
|
4
23
|
const runtime = defineRuntime()({
|
|
5
|
-
integrations
|
|
6
|
-
initialize
|
|
7
|
-
|
|
8
|
-
workflows: [
|
|
9
|
-
setupAdminWorkflow,
|
|
10
|
-
setupMemberWorkflow,
|
|
11
|
-
assignGroupUserWorkflow,
|
|
12
|
-
unassignGroupUserWorkflow,
|
|
13
|
-
addSpaceUserWorkflow,
|
|
14
|
-
removeSpaceUserWorkflow,
|
|
15
|
-
setDefaultSpaceWorkflow,
|
|
16
|
-
],
|
|
24
|
+
integrations,
|
|
25
|
+
initialize,
|
|
26
|
+
functions,
|
|
17
27
|
});
|
|
18
28
|
export default runtime;
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
1
|
+
export { ShellSchema, S, type Shell, type ShellClasses, type ShellSchemaInput } from './schema.js';
|
|
2
|
+
export { User } from './modules/user/index.js';
|
|
3
|
+
export type { InvitationSummary } from './modules/user/index.js';
|
|
4
|
+
export { Group, member_of_group, adminGroup, applicationsGroup, memberGroup, } from './modules/group/index.js';
|
|
5
|
+
export { listEntrypoints, type EntrypointEntry } from './modules/application/index.js';
|
|
6
|
+
export { Namespace, alias, viewsNamespace } from './modules/namespace/index.js';
|
|
7
|
+
export { view_access, viewOnlyGroup, assignViews } from './modules/view-access/index.js';
|
package/dist/schema/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
1
|
+
export { ShellSchema, S } from './schema.js';
|
|
2
|
+
export { User } from './modules/user/index.js';
|
|
3
|
+
export { Group, member_of_group, adminGroup, applicationsGroup, memberGroup, } from './modules/group/index.js';
|
|
4
|
+
export { listEntrypoints } from './modules/application/index.js';
|
|
5
|
+
export { Namespace, alias, viewsNamespace } from './modules/namespace/index.js';
|
|
6
|
+
export { view_access, viewOnlyGroup, assignViews } from './modules/view-access/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { listEntrypoints } from './list-entrypoints.js';
|
|
@@ -0,0 +1 @@
|
|
|
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, 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: Core admin and member hold it; the Applications Group shares it.
|
|
15
|
+
policy: ({ check, ref }) => check(usesFunction, ref(() => listEntrypoints)),
|
|
16
|
+
});
|
|
@@ -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>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { entrypointEntry, type EntrypointEntry } from './entrypoint-entry.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { entrypointEntry } from './entrypoint-entry.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const Group: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
2
|
+
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
3
|
+
readonly inheritance: "open";
|
|
4
|
+
readonly policies: {
|
|
5
|
+
readonly read: true;
|
|
6
|
+
};
|
|
7
|
+
readonly extends: readonly [import("@astrale-os/sdk/schema").KernelClass<"Identity">, import("@astrale-os/sdk/schema").KernelClass<"Named">, import("@astrale-os/sdk/schema").KernelClass<"Descriptable">];
|
|
8
|
+
readonly methods: {
|
|
9
|
+
readonly assignMember: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
10
|
+
member: string;
|
|
11
|
+
group: string;
|
|
12
|
+
}, {
|
|
13
|
+
readonly mode: 'value';
|
|
14
|
+
readonly value: Record<string, never>;
|
|
15
|
+
}, "authorized", true, false, undefined, undefined>>;
|
|
16
|
+
readonly unassignMember: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
17
|
+
member: string;
|
|
18
|
+
group: string;
|
|
19
|
+
}, {
|
|
20
|
+
readonly mode: 'value';
|
|
21
|
+
readonly value: Record<string, never>;
|
|
22
|
+
}, "authorized", true, false, undefined, undefined>>;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { K, classIcon, nodeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { UsersRound } from '@astrale-os/sdk/schema/icons';
|
|
3
|
+
import { assignMember, unassignMember } from '../functions/index.js';
|
|
4
|
+
export const Group = nodeClass({
|
|
5
|
+
icon: classIcon.lucide(UsersRound),
|
|
6
|
+
// Domains that depend on Shell extend it with the groups they own.
|
|
7
|
+
inheritance: 'open',
|
|
8
|
+
policies: { read: true },
|
|
9
|
+
extends: [K.classes.Identity, K.classes.Named, K.classes.Descriptable],
|
|
10
|
+
methods: { assignMember, unassignMember },
|
|
11
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const member_of_group: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
|
|
2
|
+
readonly depth: 0;
|
|
3
|
+
readonly abstract: false;
|
|
4
|
+
readonly extends: readonly [];
|
|
5
|
+
readonly properties: never;
|
|
6
|
+
readonly source: {
|
|
7
|
+
readonly as: "member";
|
|
8
|
+
readonly accepts: readonly (() => {
|
|
9
|
+
readonly kind: 'node';
|
|
10
|
+
readonly abstract: never;
|
|
11
|
+
readonly depth: never;
|
|
12
|
+
readonly properties: never;
|
|
13
|
+
readonly methods: never;
|
|
14
|
+
})[];
|
|
15
|
+
readonly outgoing: "0..*";
|
|
16
|
+
};
|
|
17
|
+
readonly target: {
|
|
18
|
+
readonly as: "group";
|
|
19
|
+
readonly accepts: readonly (() => {
|
|
20
|
+
readonly kind: 'node';
|
|
21
|
+
readonly abstract: never;
|
|
22
|
+
readonly depth: never;
|
|
23
|
+
readonly properties: never;
|
|
24
|
+
readonly methods: never;
|
|
25
|
+
})[];
|
|
26
|
+
readonly incoming: "0..*";
|
|
27
|
+
};
|
|
28
|
+
readonly constraints: Record<never, never>;
|
|
29
|
+
readonly effectiveProperties: never;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { User } from '../../user/index.js';
|
|
3
|
+
import { Group } from './group.js';
|
|
4
|
+
export const member_of_group = edgeClass.directed({
|
|
5
|
+
policies: { read: true },
|
|
6
|
+
source: {
|
|
7
|
+
as: 'member',
|
|
8
|
+
accepts: [() => User, () => Group],
|
|
9
|
+
outgoing: '0..*',
|
|
10
|
+
},
|
|
11
|
+
target: { as: 'group', accepts: [() => Group], incoming: '0..*' },
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const adminGroup: import("@astrale-os/sdk/schema").CoreNode;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { K, core } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Group } from '../classes/group.js';
|
|
3
|
+
export const adminGroup = core.node(() => Group, {
|
|
4
|
+
[K.classes.Named.properties.name.key]: 'Administrators',
|
|
5
|
+
[K.classes.Descriptable.properties.description.key]: 'Instance administrators.',
|
|
6
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const applicationsGroup: import("@astrale-os/sdk/schema").CoreNode;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { K, core } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Group } from '../classes/group.js';
|
|
3
|
+
export const applicationsGroup = core.node(() => Group, {
|
|
4
|
+
[K.classes.Named.properties.name.key]: 'Applications',
|
|
5
|
+
[K.classes.Descriptable.properties.description.key]: 'May list the installed applications they can open.',
|
|
6
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const memberGroup: import("@astrale-os/sdk/schema").CoreNode;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { K, core } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Group } from '../classes/group.js';
|
|
3
|
+
export const memberGroup = core.node(() => Group, {
|
|
4
|
+
[K.classes.Named.properties.name.key]: 'Members',
|
|
5
|
+
[K.classes.Descriptable.properties.description.key]: 'Instance members.',
|
|
6
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ownsClass, administersShellClass } from '../../../policies/index.js';
|
|
4
|
+
import { groupMembershipInput } from '../types/index.js';
|
|
5
|
+
export const assignMember = method({
|
|
6
|
+
static: true,
|
|
7
|
+
auth: 'authorized',
|
|
8
|
+
input: groupMembershipInput,
|
|
9
|
+
output: z.object({}),
|
|
10
|
+
policy: ({ anyOf, check, input }) => anyOf(check(administersShellClass, input.group), check(ownsClass, input.group)),
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ownsClass, administersShellClass } from '../../../policies/index.js';
|
|
4
|
+
import { groupMembershipInput } from '../types/index.js';
|
|
5
|
+
export const unassignMember = method({
|
|
6
|
+
static: true,
|
|
7
|
+
auth: 'authorized',
|
|
8
|
+
input: groupMembershipInput,
|
|
9
|
+
output: z.object({}),
|
|
10
|
+
policy: ({ anyOf, check, input }) => anyOf(check(administersShellClass, input.group), check(ownsClass, input.group)),
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const belongsToGroup: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { member_of_group } from '../classes/member-of-group.js';
|
|
3
|
+
export const belongsToGroup = policy({
|
|
4
|
+
match: ({ edge, subject, object }) => edge({ source: subject, class: () => member_of_group, target: object }),
|
|
5
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { belongsToGroup } from './belongs-to-group.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { belongsToGroup } from './belongs-to-group.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { path } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { User } from '../../user/index.js';
|
|
4
|
+
import { Group } from '../classes/group.js';
|
|
5
|
+
export const groupMembershipInput = z.object({
|
|
6
|
+
member: path(() => User, () => Group),
|
|
7
|
+
group: path(() => Group),
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { groupMembershipInput } from './group-membership-input.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One name in a Namespace: the Edge slug is the name, the target any Node. The Kernel key keeps a
|
|
3
|
+
* name to one Node for every author; Edge identity keeps a Node to one alias per Namespace. The
|
|
4
|
+
* target accepts a Class Shell does not own, so the alias detaches with its Node.
|
|
5
|
+
*/
|
|
6
|
+
export declare const alias: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
|
|
7
|
+
readonly depth: 0;
|
|
8
|
+
readonly abstract: false;
|
|
9
|
+
readonly extends: readonly [];
|
|
10
|
+
readonly properties: never;
|
|
11
|
+
readonly source: {
|
|
12
|
+
readonly as: "namespace";
|
|
13
|
+
readonly accepts: readonly (() => {
|
|
14
|
+
readonly kind: 'node';
|
|
15
|
+
readonly abstract: never;
|
|
16
|
+
readonly depth: never;
|
|
17
|
+
readonly properties: never;
|
|
18
|
+
readonly methods: never;
|
|
19
|
+
})[];
|
|
20
|
+
readonly outgoing: "0..*";
|
|
21
|
+
};
|
|
22
|
+
readonly target: {
|
|
23
|
+
readonly as: "node";
|
|
24
|
+
readonly accepts: readonly (import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
25
|
+
readonly origin: "kernel.astrale.ai";
|
|
26
|
+
})[];
|
|
27
|
+
readonly incoming: "0..*";
|
|
28
|
+
};
|
|
29
|
+
readonly constraints: Record<never, never>;
|
|
30
|
+
readonly effectiveProperties: never;
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { K, edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Namespace } from './namespace.js';
|
|
3
|
+
/**
|
|
4
|
+
* One name in a Namespace: the Edge slug is the name, the target any Node. The Kernel key keeps a
|
|
5
|
+
* name to one Node for every author; Edge identity keeps a Node to one alias per Namespace. The
|
|
6
|
+
* target accepts a Class Shell does not own, so the alias detaches with its Node.
|
|
7
|
+
*/
|
|
8
|
+
export const alias = edgeClass.directed({
|
|
9
|
+
policies: { read: true, traverse: true },
|
|
10
|
+
source: { as: 'namespace', accepts: [() => Namespace], outgoing: '0..*' },
|
|
11
|
+
target: { as: 'node', accepts: [K.classes.Node], incoming: '0..*' },
|
|
12
|
+
unique: [['source', 'slug']],
|
|
13
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** A scope of names chosen by the instance: each `alias` Edge slug names one Node, once. */
|
|
2
|
+
export declare const Namespace: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
3
|
+
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
4
|
+
readonly policies: {
|
|
5
|
+
readonly read: true;
|
|
6
|
+
readonly traverse: true;
|
|
7
|
+
};
|
|
8
|
+
readonly extends: readonly [import("@astrale-os/sdk/schema").KernelClass<"Named">, import("@astrale-os/sdk/schema").KernelClass<"Descriptable">];
|
|
9
|
+
readonly methods: {
|
|
10
|
+
readonly link: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
11
|
+
name: string;
|
|
12
|
+
target: string;
|
|
13
|
+
}, {
|
|
14
|
+
readonly mode: 'value';
|
|
15
|
+
readonly value: Record<string, never>;
|
|
16
|
+
}, "authorized", false, false, undefined, undefined>>;
|
|
17
|
+
readonly unlink: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
18
|
+
name: string;
|
|
19
|
+
}, {
|
|
20
|
+
readonly mode: 'value';
|
|
21
|
+
readonly value: Record<string, never>;
|
|
22
|
+
}, "authorized", false, false, undefined, undefined>>;
|
|
23
|
+
readonly rename: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
24
|
+
name: string;
|
|
25
|
+
to: string;
|
|
26
|
+
}, {
|
|
27
|
+
readonly mode: 'value';
|
|
28
|
+
readonly value: Record<string, never>;
|
|
29
|
+
}, "authorized", false, false, undefined, undefined>>;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { K, classIcon, nodeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Signpost } from '@astrale-os/sdk/schema/icons';
|
|
3
|
+
import { link, rename, unlink } from '../functions/index.js';
|
|
4
|
+
/** A scope of names chosen by the instance: each `alias` Edge slug names one Node, once. */
|
|
5
|
+
export const Namespace = nodeClass({
|
|
6
|
+
icon: classIcon.lucide(Signpost),
|
|
7
|
+
policies: { read: true, traverse: true },
|
|
8
|
+
extends: [K.classes.Named, K.classes.Descriptable],
|
|
9
|
+
methods: { link, unlink, rename },
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { viewsNamespace } from './views-namespace.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { viewsNamespace } from './views-namespace.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { K, core } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Namespace } from '../classes/namespace.js';
|
|
3
|
+
/** `/:shell.astrale.ai:core.views`: the names a visitor opens at `https://<instance>/v/<name>`. */
|
|
4
|
+
export const viewsNamespace = core.node(() => Namespace, {
|
|
5
|
+
[K.classes.Named.properties.name.key]: 'Views',
|
|
6
|
+
[K.classes.Descriptable.properties.description.key]: 'Aliases opened at /v/<name> on this instance.',
|
|
7
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { K, method, path } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ownsClass, administersShellClass } from '../../../policies/index.js';
|
|
4
|
+
import { namespaceName } from '../types/index.js';
|
|
5
|
+
export const link = method({
|
|
6
|
+
description: 'Give one Node an alias in this Namespace.',
|
|
7
|
+
auth: 'authorized',
|
|
8
|
+
input: z.strictObject({ name: namespaceName, target: path(K.classes.Node) }),
|
|
9
|
+
output: z.object({}),
|
|
10
|
+
policy: ({ anyOf, check, self }) => anyOf(check(administersShellClass, self), check(ownsClass, self)),
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ownsClass, administersShellClass } from '../../../policies/index.js';
|
|
4
|
+
import { namespaceName } from '../types/index.js';
|
|
5
|
+
export const rename = method({
|
|
6
|
+
description: 'Rename one alias of this Namespace; the Node it names stays the same.',
|
|
7
|
+
auth: 'authorized',
|
|
8
|
+
input: z.strictObject({ name: namespaceName, to: namespaceName }),
|
|
9
|
+
output: z.object({}),
|
|
10
|
+
policy: ({ anyOf, check, self }) => anyOf(check(administersShellClass, self), check(ownsClass, self)),
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ownsClass, administersShellClass } from '../../../policies/index.js';
|
|
4
|
+
import { namespaceName } from '../types/index.js';
|
|
5
|
+
export const unlink = method({
|
|
6
|
+
description: 'Remove one alias from this Namespace.',
|
|
7
|
+
auth: 'authorized',
|
|
8
|
+
input: z.strictObject({ name: namespaceName }),
|
|
9
|
+
output: z.object({}),
|
|
10
|
+
policy: ({ anyOf, check, self }) => anyOf(check(administersShellClass, self), check(ownsClass, self)),
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { namespaceName } from './namespace-name.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A name as written after `/v/`. Portable value patterns match substrings only, so the exact
|
|
4
|
+
* grammar, a lower-case Edge slug, is the Namespace Actions' rule and its one refusal
|
|
5
|
+
* `INVALID_NAME`.
|
|
6
|
+
*/
|
|
7
|
+
export const namespaceName = z.string();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { User } from './user.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { User } from './user.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
3
|
+
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
4
|
+
readonly inheritance: "open";
|
|
5
|
+
readonly policies: {
|
|
6
|
+
readonly read: true;
|
|
7
|
+
};
|
|
8
|
+
readonly extends: readonly [import("@astrale-os/sdk/schema").KernelClass<"Identity">];
|
|
9
|
+
readonly properties: {
|
|
10
|
+
readonly creationKey: z.ZodOptional<z.ZodString>;
|
|
11
|
+
readonly claimedEmail: z.ZodOptional<z.ZodString>;
|
|
12
|
+
readonly claimedName: z.ZodOptional<z.ZodString>;
|
|
13
|
+
};
|
|
14
|
+
readonly methods: {
|
|
15
|
+
readonly invite: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
16
|
+
user: string;
|
|
17
|
+
email: string;
|
|
18
|
+
}, {
|
|
19
|
+
readonly mode: 'value';
|
|
20
|
+
readonly value: {
|
|
21
|
+
invitationId: string;
|
|
22
|
+
user: string;
|
|
23
|
+
state: "accepted" | "cancelled" | "completed" | "expired" | "failed" | "pending" | "registered" | "registering";
|
|
24
|
+
};
|
|
25
|
+
}, "authorized", true, false, undefined, undefined>>;
|
|
26
|
+
readonly recordProfile: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
27
|
+
email?: string | undefined;
|
|
28
|
+
displayName?: string | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
readonly mode: 'value';
|
|
31
|
+
readonly value: Record<string, never>;
|
|
32
|
+
}, "authorized", false, false, undefined, undefined>>;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { K, classIcon, nodeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { UserRound } from '@astrale-os/sdk/schema/icons';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { invite, recordProfile } from '../functions/index.js';
|
|
5
|
+
import { userDisplayName, userEmail } from '../types/index.js';
|
|
6
|
+
// Correlation for Admin-owned creation; never an authentication credential.
|
|
7
|
+
const creationKey = z.string().min(1).max(512).optional();
|
|
8
|
+
export const User = nodeClass({
|
|
9
|
+
icon: classIcon.lucide(UserRound),
|
|
10
|
+
// Domains that depend on Shell extend it with the accounts they own.
|
|
11
|
+
inheritance: 'open',
|
|
12
|
+
policies: { read: true },
|
|
13
|
+
extends: [K.classes.Identity],
|
|
14
|
+
properties: {
|
|
15
|
+
creationKey,
|
|
16
|
+
// Named apart from any profile a Domain extending User declares (`email`, `displayName`…).
|
|
17
|
+
claimedEmail: userEmail.optional(),
|
|
18
|
+
claimedName: userDisplayName.optional(),
|
|
19
|
+
},
|
|
20
|
+
methods: { invite, recordProfile },
|
|
21
|
+
});
|