@astrale-domains/shell 0.1.0-beta.45 → 0.1.0-beta.48

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.
Files changed (50) hide show
  1. package/README.md +57 -5
  2. package/dist/domain.d.ts +53 -4
  3. package/dist/domain.js +12 -1
  4. package/dist/functions/namespace/index.js +3 -0
  5. package/dist/functions/namespace/link.js +30 -0
  6. package/dist/functions/namespace/namespace-errors.js +28 -0
  7. package/dist/functions/namespace/namespace-name.js +13 -0
  8. package/dist/functions/namespace/rename.js +31 -0
  9. package/dist/functions/namespace/unlink.js +21 -0
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/integrations/integrations.d.ts +1 -1
  13. package/dist/integrations/user-invitation/request-user-invitation.d.ts +1 -1
  14. package/dist/mutations/namespace/alias-write.js +22 -0
  15. package/dist/mutations/namespace/index.js +3 -0
  16. package/dist/mutations/namespace/link-alias.js +15 -0
  17. package/dist/mutations/namespace/rename-alias.js +13 -0
  18. package/dist/mutations/namespace/unlink-alias.js +13 -0
  19. package/dist/queries/namespace/index.js +1 -0
  20. package/dist/queries/namespace/read-designated-node.js +12 -0
  21. package/dist/runtime.d.ts +749 -19
  22. package/dist/runtime.js +10 -1
  23. package/dist/schema/index.d.ts +1 -0
  24. package/dist/schema/index.js +1 -0
  25. package/dist/schema/modules/application/functions/list-entrypoints.d.ts +1 -1
  26. package/dist/schema/modules/group/classes/group.d.ts +3 -2
  27. package/dist/schema/modules/group/classes/group.js +2 -0
  28. package/dist/schema/modules/namespace/classes/alias.d.ts +21 -0
  29. package/dist/schema/modules/namespace/classes/alias.js +13 -0
  30. package/dist/schema/modules/namespace/classes/index.d.ts +2 -0
  31. package/dist/schema/modules/namespace/classes/index.js +2 -0
  32. package/dist/schema/modules/namespace/classes/namespace.d.ts +31 -0
  33. package/dist/schema/modules/namespace/classes/namespace.js +10 -0
  34. package/dist/schema/modules/namespace/core/index.d.ts +1 -0
  35. package/dist/schema/modules/namespace/core/index.js +1 -0
  36. package/dist/schema/modules/namespace/core/views-namespace.d.ts +2 -0
  37. package/dist/schema/modules/namespace/core/views-namespace.js +7 -0
  38. package/dist/schema/modules/namespace/functions/index.js +3 -0
  39. package/dist/schema/modules/namespace/functions/link.js +11 -0
  40. package/dist/schema/modules/namespace/functions/rename.js +11 -0
  41. package/dist/schema/modules/namespace/functions/unlink.js +11 -0
  42. package/dist/schema/modules/namespace/index.d.ts +2 -0
  43. package/dist/schema/modules/namespace/index.js +2 -0
  44. package/dist/schema/modules/namespace/types/index.js +1 -0
  45. package/dist/schema/modules/namespace/types/namespace-name.js +7 -0
  46. package/dist/schema/modules/user/classes/user.d.ts +2 -1
  47. package/dist/schema/modules/user/classes/user.js +2 -0
  48. package/dist/schema/schema.d.ts +210 -15
  49. package/dist/schema/schema.js +8 -2
  50. package/package.json +3 -3
package/dist/runtime.js CHANGED
@@ -1,13 +1,22 @@
1
1
  import { defineRuntime } from '@astrale-os/sdk/runtime';
2
2
  import { listEntrypoints } from './functions/application/index.js';
3
3
  import { assignMember, unassignMember } from './functions/group/index.js';
4
+ import { link, rename, unlink } from './functions/namespace/index.js';
4
5
  import { invite } from './functions/user/index.js';
5
6
  import { integrations } from './integrations/index.js';
6
7
  import { enrollmentProvider } from './providers/admin-enrollment/index.js';
7
8
  const initialize = (environment) => ({
8
9
  providers: { enrollment: enrollmentProvider(environment) },
9
10
  });
10
- const functions = [invite, assignMember, unassignMember, listEntrypoints];
11
+ const functions = [
12
+ invite,
13
+ assignMember,
14
+ unassignMember,
15
+ listEntrypoints,
16
+ link,
17
+ unlink,
18
+ rename,
19
+ ];
11
20
  const runtime = defineRuntime()({
12
21
  integrations,
13
22
  initialize,
@@ -3,3 +3,4 @@ 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
5
  export { listEntrypoints, type EntrypointEntry } from './modules/application/index.js';
6
+ export { Namespace, alias, viewsNamespace } from './modules/namespace/index.js';
@@ -2,3 +2,4 @@ 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
4
  export { listEntrypoints } from './modules/application/index.js';
5
+ export { Namespace, alias, viewsNamespace } from './modules/namespace/index.js';
@@ -12,4 +12,4 @@ export declare const listEntrypoints: SchemaFunction<import("@astrale-os/sdk/sch
12
12
  view: string;
13
13
  }[];
14
14
  };
15
- }, "authorized", false, false, undefined>>;
15
+ }, "authorized", false, false, undefined, undefined>>;
@@ -1,5 +1,6 @@
1
1
  export declare const Group: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
2
2
  readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
3
+ readonly inheritance: "open";
3
4
  readonly policies: {
4
5
  readonly read: true;
5
6
  };
@@ -11,13 +12,13 @@ export declare const Group: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
11
12
  }, {
12
13
  readonly mode: 'value';
13
14
  readonly value: Record<string, never>;
14
- }, "authorized", true, false, undefined>>;
15
+ }, "authorized", true, false, undefined, undefined>>;
15
16
  readonly unassignMember: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
16
17
  member: string;
17
18
  group: string;
18
19
  }, {
19
20
  readonly mode: 'value';
20
21
  readonly value: Record<string, never>;
21
- }, "authorized", true, false, undefined>>;
22
+ }, "authorized", true, false, undefined, undefined>>;
22
23
  };
23
24
  }>;
@@ -3,6 +3,8 @@ import { UsersRound } from '@astrale-os/sdk/schema/icons';
3
3
  import { assignMember, unassignMember } from '../functions/index.js';
4
4
  export const Group = nodeClass({
5
5
  icon: classIcon.lucide(UsersRound),
6
+ // Domains that depend on Shell extend it with the groups they own.
7
+ inheritance: 'open',
6
8
  policies: { read: true },
7
9
  extends: [K.classes.Identity, K.classes.Named, K.classes.Descriptable],
8
10
  methods: { assignMember, unassignMember },
@@ -0,0 +1,21 @@
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 outgoing: "0..*";
14
+ };
15
+ readonly target: {
16
+ readonly as: "node";
17
+ readonly incoming: "0..*";
18
+ };
19
+ readonly constraints: Record<never, never>;
20
+ readonly effectiveProperties: never;
21
+ }>;
@@ -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,2 @@
1
+ export { Namespace } from './namespace.js';
2
+ export { alias } from './alias.js';
@@ -0,0 +1,2 @@
1
+ export { Namespace } from './namespace.js';
2
+ export { alias } from './alias.js';
@@ -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,2 @@
1
+ /** `/:shell.astrale.ai:core.views`: the names a visitor opens at `https://<instance>/v/<name>`. */
2
+ export declare const viewsNamespace: import("@astrale-os/sdk/schema").CoreNode;
@@ -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,3 @@
1
+ export { link } from './link.js';
2
+ export { unlink } from './unlink.js';
3
+ export { rename } from './rename.js';
@@ -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,2 @@
1
+ export { Namespace, alias } from './classes/index.js';
2
+ export { viewsNamespace } from './core/index.js';
@@ -0,0 +1,2 @@
1
+ export { Namespace, alias } from './classes/index.js';
2
+ export { viewsNamespace } from './core/index.js';
@@ -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();
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export declare const User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
3
3
  readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
4
+ readonly inheritance: "open";
4
5
  readonly policies: {
5
6
  readonly read: true;
6
7
  };
@@ -19,6 +20,6 @@ export declare const User: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
19
20
  user: string;
20
21
  state: "accepted" | "cancelled" | "completed" | "expired" | "failed" | "pending" | "registered" | "registering";
21
22
  };
22
- }, "authorized", true, false, undefined>>;
23
+ }, "authorized", true, false, undefined, undefined>>;
23
24
  };
24
25
  }>;
@@ -6,6 +6,8 @@ import { invite } from '../functions/index.js';
6
6
  const creationKey = z.string().min(1).max(512).optional();
7
7
  export const User = nodeClass({
8
8
  icon: classIcon.lucide(UserRound),
9
+ // Domains that depend on Shell extend it with the accounts they own.
10
+ inheritance: 'open',
9
11
  policies: { read: true },
10
12
  extends: [K.classes.Identity],
11
13
  properties: { creationKey },