@astrale-domains/shell 0.1.0-beta.8 → 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.
Files changed (244) hide show
  1. package/README.md +264 -64
  2. package/dist/domain.d.ts +225 -0
  3. package/dist/domain.js +96 -0
  4. package/dist/functions/application/index.js +1 -0
  5. package/dist/functions/application/list-entrypoints.js +6 -0
  6. package/dist/functions/group/assign-member-to-group.js +4 -0
  7. package/dist/functions/group/change-group-membership.js +34 -0
  8. package/dist/functions/group/group-membership-errors.js +23 -0
  9. package/dist/functions/group/index.js +2 -0
  10. package/dist/functions/group/unassign-member-from-group.js +4 -0
  11. package/dist/functions/namespace/index.js +3 -0
  12. package/dist/functions/namespace/link.js +30 -0
  13. package/dist/functions/namespace/namespace-errors.js +28 -0
  14. package/dist/functions/namespace/namespace-name.js +13 -0
  15. package/dist/functions/namespace/rename.js +31 -0
  16. package/dist/functions/namespace/unlink.js +21 -0
  17. package/dist/functions/user/index.js +2 -0
  18. package/dist/functions/user/invite-user.js +39 -0
  19. package/dist/functions/user/record-profile.js +18 -0
  20. package/dist/functions/view-access/assign-views.js +86 -0
  21. package/dist/functions/view-access/index.js +1 -0
  22. package/dist/functions/view-access/view-access-errors.js +28 -0
  23. package/dist/index.d.ts +1 -3
  24. package/dist/index.js +1 -3
  25. package/dist/integrations/index.d.ts +1 -0
  26. package/dist/integrations/index.js +1 -0
  27. package/dist/integrations/integrations.d.ts +9 -0
  28. package/dist/integrations/integrations.js +2 -0
  29. package/dist/integrations/user-invitation/index.d.ts +4 -0
  30. package/dist/integrations/user-invitation/index.js +3 -0
  31. package/dist/integrations/user-invitation/invitation-request-failure.d.ts +5 -0
  32. package/dist/integrations/user-invitation/invitation-request-failure.js +9 -0
  33. package/dist/integrations/user-invitation/invite-user-request.d.ts +6 -0
  34. package/dist/integrations/user-invitation/invite-user-request.js +1 -0
  35. package/dist/integrations/user-invitation/request-user-invitation.d.ts +8 -0
  36. package/dist/integrations/user-invitation/request-user-invitation.js +9 -0
  37. package/dist/mutations/group/index.js +1 -1
  38. package/dist/mutations/group/set-group-membership.js +29 -0
  39. package/dist/mutations/namespace/alias-write.js +22 -0
  40. package/dist/mutations/namespace/index.js +3 -0
  41. package/dist/mutations/namespace/link-alias.js +15 -0
  42. package/dist/mutations/namespace/rename-alias.js +13 -0
  43. package/dist/mutations/namespace/unlink-alias.js +13 -0
  44. package/dist/mutations/user/index.js +1 -1
  45. package/dist/mutations/user/record-user-profile.js +13 -0
  46. package/dist/mutations/view-access/index.js +1 -0
  47. package/dist/mutations/view-access/set-view-access.js +29 -0
  48. package/dist/providers/admin-enrollment/create-admin-enrollment-provider.js +78 -0
  49. package/dist/providers/admin-enrollment/decode-admin-invitation-response.js +20 -0
  50. package/dist/providers/admin-enrollment/index.js +1 -0
  51. package/dist/providers/admin-enrollment/read-enrollment-response.js +34 -0
  52. package/dist/queries/application/index.js +1 -0
  53. package/dist/queries/application/read-installed-entrypoints.js +28 -0
  54. package/dist/queries/group/index.js +2 -0
  55. package/dist/queries/group/read-group-membership-endpoints.js +18 -0
  56. package/dist/queries/group/read-group-membership.js +35 -0
  57. package/dist/queries/namespace/index.js +2 -0
  58. package/dist/queries/namespace/read-designated-node.js +12 -0
  59. package/dist/queries/namespace/read-view-aliases.js +46 -0
  60. package/dist/queries/user/index.js +1 -5
  61. package/dist/queries/user/read-user-profile.js +9 -0
  62. package/dist/queries/view-access/index.js +1 -0
  63. package/dist/queries/view-access/read-view-access.js +35 -0
  64. package/dist/runtime.d.ts +2175 -3
  65. package/dist/runtime.js +24 -14
  66. package/dist/schema/index.d.ts +7 -6
  67. package/dist/schema/index.js +6 -6
  68. package/dist/schema/modules/application/functions/index.d.ts +1 -0
  69. package/dist/schema/modules/application/functions/index.js +1 -0
  70. package/dist/schema/modules/application/functions/list-entrypoints.d.ts +15 -0
  71. package/dist/schema/modules/application/functions/list-entrypoints.js +16 -0
  72. package/dist/schema/modules/application/index.d.ts +2 -0
  73. package/dist/schema/modules/application/index.js +2 -0
  74. package/dist/schema/modules/application/types/entrypoint-entry.d.ts +8 -0
  75. package/dist/schema/modules/application/types/entrypoint-entry.js +7 -0
  76. package/dist/schema/modules/application/types/index.d.ts +1 -0
  77. package/dist/schema/modules/application/types/index.js +1 -0
  78. package/dist/schema/modules/group/classes/group.d.ts +24 -0
  79. package/dist/schema/modules/group/classes/group.js +11 -0
  80. package/dist/schema/modules/group/classes/index.d.ts +2 -0
  81. package/dist/schema/modules/group/classes/index.js +2 -0
  82. package/dist/schema/modules/group/classes/member-of-group.d.ts +30 -0
  83. package/dist/schema/modules/group/classes/member-of-group.js +12 -0
  84. package/dist/schema/modules/group/core/administrators-group.d.ts +1 -0
  85. package/dist/schema/modules/group/core/administrators-group.js +6 -0
  86. package/dist/schema/modules/group/core/applications-group.d.ts +1 -0
  87. package/dist/schema/modules/group/core/applications-group.js +6 -0
  88. package/dist/schema/modules/group/core/index.d.ts +3 -0
  89. package/dist/schema/modules/group/core/index.js +3 -0
  90. package/dist/schema/modules/group/core/members-group.d.ts +1 -0
  91. package/dist/schema/modules/group/core/members-group.js +6 -0
  92. package/dist/schema/modules/group/functions/assign-member-to-group.js +11 -0
  93. package/dist/schema/modules/group/functions/index.js +2 -0
  94. package/dist/schema/modules/group/functions/unassign-member-from-group.js +11 -0
  95. package/dist/schema/modules/group/index.d.ts +3 -0
  96. package/dist/schema/modules/group/index.js +3 -0
  97. package/dist/schema/modules/group/policies/belongs-to-group.d.ts +1 -0
  98. package/dist/schema/modules/group/policies/belongs-to-group.js +5 -0
  99. package/dist/schema/modules/group/policies/index.d.ts +1 -0
  100. package/dist/schema/modules/group/policies/index.js +1 -0
  101. package/dist/schema/modules/group/types/group-membership-input.js +8 -0
  102. package/dist/schema/modules/group/types/index.js +1 -0
  103. package/dist/schema/modules/namespace/classes/alias.d.ts +31 -0
  104. package/dist/schema/modules/namespace/classes/alias.js +13 -0
  105. package/dist/schema/modules/namespace/classes/index.d.ts +2 -0
  106. package/dist/schema/modules/namespace/classes/index.js +2 -0
  107. package/dist/schema/modules/namespace/classes/namespace.d.ts +31 -0
  108. package/dist/schema/modules/namespace/classes/namespace.js +10 -0
  109. package/dist/schema/modules/namespace/core/index.d.ts +1 -0
  110. package/dist/schema/modules/namespace/core/index.js +1 -0
  111. package/dist/schema/modules/namespace/core/views-namespace.d.ts +2 -0
  112. package/dist/schema/modules/namespace/core/views-namespace.js +7 -0
  113. package/dist/schema/modules/namespace/functions/index.js +3 -0
  114. package/dist/schema/modules/namespace/functions/link.js +11 -0
  115. package/dist/schema/modules/namespace/functions/rename.js +11 -0
  116. package/dist/schema/modules/namespace/functions/unlink.js +11 -0
  117. package/dist/schema/modules/namespace/index.d.ts +2 -0
  118. package/dist/schema/modules/namespace/index.js +2 -0
  119. package/dist/schema/modules/namespace/types/index.js +1 -0
  120. package/dist/schema/modules/namespace/types/namespace-name.js +7 -0
  121. package/dist/schema/modules/user/classes/index.d.ts +1 -0
  122. package/dist/schema/modules/user/classes/index.js +1 -0
  123. package/dist/schema/modules/user/classes/user.d.ts +34 -0
  124. package/dist/schema/modules/user/classes/user.js +21 -0
  125. package/dist/schema/modules/user/functions/index.js +2 -0
  126. package/dist/schema/modules/user/functions/invite-user.js +12 -0
  127. package/dist/schema/modules/user/functions/record-profile.js +14 -0
  128. package/dist/schema/modules/user/index.d.ts +2 -0
  129. package/dist/schema/modules/user/index.js +2 -0
  130. package/dist/schema/modules/user/types/index.d.ts +2 -0
  131. package/dist/schema/modules/user/types/index.js +2 -0
  132. package/dist/schema/modules/user/types/invitation-summary.d.ts +16 -0
  133. package/dist/schema/modules/user/types/invitation-summary.js +15 -0
  134. package/dist/schema/modules/user/types/user-profile.d.ts +7 -0
  135. package/dist/schema/modules/user/types/user-profile.js +7 -0
  136. package/dist/schema/modules/view-access/classes/index.d.ts +1 -0
  137. package/dist/schema/modules/view-access/classes/index.js +1 -0
  138. package/dist/schema/modules/view-access/classes/view-access.d.ts +32 -0
  139. package/dist/schema/modules/view-access/classes/view-access.js +18 -0
  140. package/dist/schema/modules/view-access/core/index.d.ts +1 -0
  141. package/dist/schema/modules/view-access/core/index.js +1 -0
  142. package/dist/schema/modules/view-access/core/view-only-group.d.ts +5 -0
  143. package/dist/schema/modules/view-access/core/view-only-group.js +10 -0
  144. package/dist/schema/modules/view-access/functions/assign-views.d.ts +16 -0
  145. package/dist/schema/modules/view-access/functions/assign-views.js +17 -0
  146. package/dist/schema/modules/view-access/functions/index.d.ts +1 -0
  147. package/dist/schema/modules/view-access/functions/index.js +1 -0
  148. package/dist/schema/modules/view-access/index.d.ts +3 -0
  149. package/dist/schema/modules/view-access/index.js +3 -0
  150. package/dist/schema/modules/view-access/types/index.js +1 -0
  151. package/dist/schema/modules/view-access/types/view-assignment.js +16 -0
  152. package/dist/schema/policies/administers-shell-class.js +11 -0
  153. package/dist/schema/policies/index.js +4 -0
  154. package/dist/schema/policies/is-self.js +5 -0
  155. package/dist/schema/policies/owns-class.js +7 -0
  156. package/dist/schema/policies/uses-function.js +5 -0
  157. package/dist/schema/schema.d.ts +833 -0
  158. package/dist/schema/schema.js +35 -0
  159. package/dist/schema/views/application-view.js +4 -0
  160. package/dist/schema/views/index.js +1 -0
  161. package/dist/utils/canonical-node-path/index.js +1 -0
  162. package/dist/utils/canonical-node-path/parse-canonical-node-path.js +8 -0
  163. package/package.json +50 -10
  164. package/dist/actions/index.js +0 -1
  165. package/dist/actions/user/index.js +0 -1
  166. package/dist/actions/user/resolve-home.js +0 -19
  167. package/dist/application.d.ts +0 -5
  168. package/dist/application.js +0 -29
  169. package/dist/mutations/group/membership.js +0 -21
  170. package/dist/mutations/space/access.js +0 -25
  171. package/dist/mutations/space/default.js +0 -25
  172. package/dist/mutations/space/index.js +0 -2
  173. package/dist/mutations/user/repair.js +0 -85
  174. package/dist/queries/space/access.js +0 -14
  175. package/dist/queries/space/admin.js +0 -27
  176. package/dist/queries/space/index.js +0 -3
  177. package/dist/queries/space/member.js +0 -24
  178. package/dist/queries/user/groups.js +0 -24
  179. package/dist/queries/user/home.js +0 -28
  180. package/dist/queries/user/owned-spaces.js +0 -24
  181. package/dist/queries/user/profile.js +0 -17
  182. package/dist/queries/user/setup.js +0 -18
  183. package/dist/schema/domain/index.d.ts +0 -26911
  184. package/dist/schema/domain/index.js +0 -40
  185. package/dist/schema/group/class.d.ts +0 -3288
  186. package/dist/schema/group/class.js +0 -7
  187. package/dist/schema/group/core.d.ts +0 -14
  188. package/dist/schema/group/core.js +0 -14
  189. package/dist/schema/group/index.d.ts +0 -6
  190. package/dist/schema/group/index.js +0 -6
  191. package/dist/schema/group/methods.d.ts +0 -2059
  192. package/dist/schema/group/methods.js +0 -21
  193. package/dist/schema/group/policies.d.ts +0 -1
  194. package/dist/schema/group/policies.js +0 -6
  195. package/dist/schema/group/relationships.d.ts +0 -4313
  196. package/dist/schema/group/relationships.js +0 -8
  197. package/dist/schema/group/view.d.ts +0 -3291
  198. package/dist/schema/group/view.js +0 -6
  199. package/dist/schema/home/index.d.ts +0 -1
  200. package/dist/schema/home/index.js +0 -1
  201. package/dist/schema/home/view.d.ts +0 -3
  202. package/dist/schema/home/view.js +0 -4
  203. package/dist/schema/setup/functions.d.ts +0 -47
  204. package/dist/schema/setup/functions.js +0 -27
  205. package/dist/schema/setup/index.d.ts +0 -1
  206. package/dist/schema/setup/index.js +0 -1
  207. package/dist/schema/space/class.d.ts +0 -2313
  208. package/dist/schema/space/class.js +0 -11
  209. package/dist/schema/space/core.d.ts +0 -22520
  210. package/dist/schema/space/core.js +0 -15
  211. package/dist/schema/space/index.d.ts +0 -6
  212. package/dist/schema/space/index.js +0 -6
  213. package/dist/schema/space/methods.d.ts +0 -2089
  214. package/dist/schema/space/methods.js +0 -30
  215. package/dist/schema/space/policies.d.ts +0 -4
  216. package/dist/schema/space/policies.js +0 -21
  217. package/dist/schema/space/relationships.d.ts +0 -23213
  218. package/dist/schema/space/relationships.js +0 -24
  219. package/dist/schema/space/view.d.ts +0 -2316
  220. package/dist/schema/space/view.js +0 -6
  221. package/dist/schema/user/class.d.ts +0 -1015
  222. package/dist/schema/user/class.js +0 -11
  223. package/dist/schema/user/index.d.ts +0 -3
  224. package/dist/schema/user/index.js +0 -3
  225. package/dist/schema/user/methods.d.ts +0 -14
  226. package/dist/schema/user/methods.js +0 -11
  227. package/dist/schema/user/view.d.ts +0 -1017
  228. package/dist/schema/user/view.js +0 -6
  229. package/dist/workflows/group/assign.js +0 -3
  230. package/dist/workflows/group/change.js +0 -31
  231. package/dist/workflows/group/index.js +0 -3
  232. package/dist/workflows/group/unassign.js +0 -3
  233. package/dist/workflows/index.js +0 -3
  234. package/dist/workflows/setup/admin.js +0 -3
  235. package/dist/workflows/setup/index.js +0 -5
  236. package/dist/workflows/setup/member.js +0 -3
  237. package/dist/workflows/setup/plan.js +0 -88
  238. package/dist/workflows/setup/provision.js +0 -57
  239. package/dist/workflows/setup/run.js +0 -74
  240. package/dist/workflows/space/access.js +0 -41
  241. package/dist/workflows/space/add.js +0 -3
  242. package/dist/workflows/space/default.js +0 -37
  243. package/dist/workflows/space/index.js +0 -4
  244. package/dist/workflows/space/remove.js +0 -3
@@ -0,0 +1,35 @@
1
+ import { defineSchema, KernelSchema, schema } from '@astrale-os/sdk/schema';
2
+ import { listEntrypoints } from './modules/application/index.js';
3
+ import { Group, member_of_group, adminGroup, applicationsGroup, memberGroup, belongsToGroup, } from './modules/group/index.js';
4
+ import { Namespace, alias, viewsNamespace } from './modules/namespace/index.js';
5
+ import { User } from './modules/user/index.js';
6
+ import { assignViews, view_access, viewOnlyGroup } from './modules/view-access/index.js';
7
+ import { ownsClass, administersShellClass, usesFunction, isSelf } from './policies/index.js';
8
+ import { applicationView } from './views/index.js';
9
+ export const ORIGIN = 'shell.astrale.ai';
10
+ const dependencies = { kernel: KernelSchema };
11
+ const classes = { User, Group, member_of_group, Namespace, alias, view_access };
12
+ const functions = { listEntrypoints, assignViews };
13
+ const policies = { belongsToGroup, ownsClass, administersShellClass, usesFunction, isSelf };
14
+ const views = { application: applicationView };
15
+ const core = {
16
+ nodes: {
17
+ admin: adminGroup,
18
+ applications: applicationsGroup,
19
+ member: memberGroup,
20
+ views: viewsNamespace,
21
+ 'view-only': viewOnlyGroup,
22
+ },
23
+ };
24
+ const input = {
25
+ name: 'Shell',
26
+ entrypoint: 'application',
27
+ dependencies,
28
+ classes,
29
+ functions,
30
+ policies,
31
+ views,
32
+ core,
33
+ };
34
+ export const ShellSchema = defineSchema(ORIGIN, input);
35
+ export const S = schema.resolve(ShellSchema);
@@ -0,0 +1,4 @@
1
+ import { view } from '@astrale-os/sdk/schema';
2
+ export const applicationView = view({
3
+ description: 'Users and groups in this instance.',
4
+ });
@@ -0,0 +1 @@
1
+ export { applicationView } from './application-view.js';
@@ -0,0 +1 @@
1
+ export { canonicalNodeId } from './parse-canonical-node-path.js';
@@ -0,0 +1,8 @@
1
+ import { Path } from '@astrale-os/sdk/graph/path';
2
+ export function canonicalNodeId(value, invalid = () => new TypeError('An exact canonical @NodeId path is required.')) {
3
+ const parsed = Path.parse(value);
4
+ if (parsed.ast.anchor.kind !== 'id' || parsed.ast.steps.length !== 0) {
5
+ throw invalid();
6
+ }
7
+ return parsed.ast.anchor.id;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-domains/shell",
3
- "version": "0.1.0-beta.8",
3
+ "version": "0.1.1",
4
4
  "description": "Astrale Shell Domain schema and remote product implementation",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,20 +15,38 @@
15
15
  "main": "./dist/index.js",
16
16
  "types": "./dist/index.d.ts",
17
17
  "imports": {
18
+ "#functions": "./dist/functions/index.js",
19
+ "#functions/*": "./dist/functions/*/index.js",
18
20
  "#mutations": "./dist/mutations/index.js",
19
21
  "#mutations/*": "./dist/mutations/*/index.js",
20
22
  "#queries": "./dist/queries/index.js",
21
23
  "#queries/*": "./dist/queries/*/index.js",
22
24
  "#schema": "./dist/schema/index.js",
23
25
  "#schema/*": "./dist/schema/*/index.js",
24
- "#workflows": "./dist/workflows/index.js",
25
- "#workflows/*": "./dist/workflows/*/index.js"
26
+ "#integrations": "./dist/integrations/index.js",
27
+ "#integrations/*": "./dist/integrations/*/index.js",
28
+ "#providers": "./dist/providers/index.js",
29
+ "#providers/*": "./dist/providers/*/index.js",
30
+ "#utils": "./dist/utils/index.js",
31
+ "#utils/*": "./dist/utils/*/index.js",
32
+ "#ui": "./dist/ui/index.js",
33
+ "#ui/*": "./dist/ui/*/index.js",
34
+ "#views": "./dist/views/index.js",
35
+ "#views/*": "./dist/views/*/index.js"
26
36
  },
27
37
  "exports": {
28
38
  ".": {
29
39
  "types": "./dist/index.d.ts",
30
40
  "import": "./dist/index.js"
31
41
  },
42
+ "./domain": {
43
+ "types": "./dist/domain.d.ts",
44
+ "import": "./dist/domain.js"
45
+ },
46
+ "./runtime": {
47
+ "types": "./dist/runtime.d.ts",
48
+ "import": "./dist/runtime.js"
49
+ },
32
50
  "./package.json": "./package.json"
33
51
  },
34
52
  "publishConfig": {
@@ -39,22 +57,44 @@
39
57
  "zod": "4.4.3"
40
58
  },
41
59
  "devDependencies": {
42
- "@astrale-os/sdk": "0.5.0-beta.22",
43
- "@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.3",
60
+ "@astrale-os/ox": "0.1.4",
61
+ "@astrale-os/sdk": "0.6.0-beta.45",
62
+ "@astrale-os/shell-react": "0.6.0-beta.10",
63
+ "@astrale-os/ui": "1.0.0-beta.37",
64
+ "@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~2.0.0",
65
+ "@testing-library/dom": "10.4.1",
66
+ "@testing-library/react": "16.3.2",
67
+ "@types/node": "26.2.0",
68
+ "@types/react": "19.2.18",
69
+ "@types/react-dom": "19.2.4",
70
+ "@vitejs/plugin-react": "6.0.5",
71
+ "happy-dom": "20.11.2",
72
+ "oxlint": "1.78.0",
73
+ "react": "19.2.8",
74
+ "react-dom": "19.2.8",
44
75
  "typescript": "7.0.2",
45
- "vitest": "4.1.10"
76
+ "vitest": "5.0.1"
46
77
  },
47
78
  "peerDependencies": {
48
- "@astrale-os/sdk": ">=0.5.0-beta.22 <1.0.0"
79
+ "@astrale-os/sdk": ">=0.6.0-beta.45 <1.0.0"
80
+ },
81
+ "devEngines": {
82
+ "runtime": {
83
+ "name": "node",
84
+ "version": ">=22.12.0",
85
+ "onFail": "error"
86
+ }
49
87
  },
50
88
  "engines": {
51
- "node": ">=24"
89
+ "node": ">=22"
52
90
  },
53
91
  "scripts": {
54
92
  "prebuild": "pnpm clean",
55
- "build": "tsc --paths null && astrale-domain package",
93
+ "build": "tsc --project tsconfig.package.json --paths null && bun ../scripts/package/normalize-domain-declarations.mjs && node ../scripts/package/verify-domain-platform.mjs",
56
94
  "clean": "rm -rf dist",
57
- "typecheck": "tsc --noEmit --paths null",
95
+ "lint": "astrale-domain lint",
96
+ "lint:fix": "astrale-domain lint --fix",
97
+ "typecheck": "tsc --noEmit --paths null && tsc --noEmit -p tsconfig.test.json",
58
98
  "test": "NODE_PATH=$PWD/node_modules vitest run --config vitest.config.ts",
59
99
  "test:file": "NODE_PATH=$PWD/node_modules vitest run --config vitest.config.ts"
60
100
  }
@@ -1 +0,0 @@
1
- export * from './user/index.js';
@@ -1 +0,0 @@
1
- export { resolveHomeAction } from './resolve-home.js';
@@ -1,19 +0,0 @@
1
- import { defineAction } from '@astrale-os/sdk/action';
2
- import { InvocationError } from '@astrale-os/sdk/execution';
3
- import { Path } from '@astrale-os/sdk/graph/path';
4
- import { observeHome } from '#queries/user';
5
- export const resolveHomeAction = defineAction()('User.resolveHome', async ({ domain, query, self }) => {
6
- const observed = await query(observeHome(domain), Path.id(self).raw);
7
- if (observed.spaces.length > 1) {
8
- throw new InvocationError('CONFLICT', 'The Shell User has more than one default Space.', {
9
- reason: { code: 'MULTIPLE_DEFAULT_SPACES', details: {} },
10
- });
11
- }
12
- const home = observed.spaces[0];
13
- if (home !== undefined && home.class !== domain.classes.Space.key) {
14
- throw new InvocationError('CONFLICT', 'The Shell User default target is not a Shell Space.', {
15
- reason: { code: 'DEFAULT_SPACE_CLASS_CONFLICT', details: {} },
16
- });
17
- }
18
- return Object.freeze({ userId: self, personalSpaceId: home?.id ?? null });
19
- });
@@ -1,5 +0,0 @@
1
- export declare const frontend: import("@astrale-os/sdk/view").Frontend<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>>;
2
- export declare const application: import("@astrale-os/sdk/application").Application<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, import("@astrale-os/sdk/runtime").Runtime<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, {}, () => {
3
- providers: {};
4
- }, readonly [import("@astrale-os/sdk/action").ActionDefinition<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "User.resolveHome", Readonly<Record<never, never>>>], readonly [import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "setupAdmin", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "setupMember", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Group.assignUser", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Group.unassignUser", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Space.addUser", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Space.removeUser", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Space.setDefault", Readonly<Record<never, never>>>]>, import("@astrale-os/sdk/view").Frontend<import("@astrale-os/sdk/schema").DomainSchema<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput, import("@astrale-os/sdk/schema").DomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>>, undefined, import("@astrale-os/sdk/application").Requirements>;
5
- export default application;
@@ -1,29 +0,0 @@
1
- import { defineApplication, defineFrontend, external, requirements, } from '@astrale-os/sdk/application';
2
- import { K } from '@astrale-os/sdk/schema';
3
- import runtime from './runtime.js';
4
- import { ShellSchema } from './schema/index.js';
5
- export const frontend = defineFrontend({
6
- schema: ShellSchema,
7
- source: external('https://app.astrale.ai'),
8
- routes: {
9
- group: '/groups',
10
- home: '/',
11
- space: '/spaces',
12
- user: '/users',
13
- },
14
- entrypoint: 'home',
15
- });
16
- export const application = defineApplication({
17
- schema: ShellSchema,
18
- runtime,
19
- frontend,
20
- requirements: requirements({
21
- callables: [
22
- K.classes.Identity.static.methods.whois,
23
- K.functions.provision,
24
- K.functions.query,
25
- K.functions.mutate,
26
- ],
27
- }),
28
- });
29
- export default application;
@@ -1,21 +0,0 @@
1
- import { Path } from '@astrale-os/sdk/graph/path';
2
- import { defineMutation } from '@astrale-os/sdk/mutation';
3
- export function changeGroupMembership(domain) {
4
- return defineMutation({
5
- id: 'shell.group.membership',
6
- change(mutation, change) {
7
- mutation.expect.query(change.guard);
8
- const edge = {
9
- class: domain.classes.member_of_group,
10
- source: Path.parse(change.user),
11
- target: Path.id(change.group),
12
- };
13
- if (change.present)
14
- mutation.createEdge(edge);
15
- else
16
- mutation.deleteEdge(edge);
17
- },
18
- project: () => Object.freeze({ ok: true }),
19
- reject: (failure) => Object.freeze({ ok: false, code: failure.code, outcomeKnown: failure.outcomeKnown }),
20
- });
21
- }
@@ -1,25 +0,0 @@
1
- import { Path } from '@astrale-os/sdk/graph/path';
2
- import { defineMutation } from '@astrale-os/sdk/mutation';
3
- export function changeSpaceAccess(domain) {
4
- return defineMutation({
5
- id: 'shell.space.access',
6
- change(mutation, change) {
7
- mutation.expect.query(change.guards.member);
8
- mutation.expect.query(change.guards.admin);
9
- const source = Path.parse(change.user);
10
- const target = Path.id(change.space);
11
- const member = { class: domain.classes.member_of_space, source, target };
12
- const admin = { class: domain.classes.administers_space, source, target };
13
- if (change.removeMember)
14
- mutation.deleteEdge(member);
15
- if (change.removeAdmin)
16
- mutation.deleteEdge(admin);
17
- if (change.addMember)
18
- mutation.createEdge(member);
19
- if (change.addAdmin)
20
- mutation.createEdge(admin);
21
- },
22
- project: () => Object.freeze({ ok: true }),
23
- reject: (failure) => Object.freeze({ ok: false, code: failure.code, outcomeKnown: failure.outcomeKnown }),
24
- });
25
- }
@@ -1,25 +0,0 @@
1
- import { Path } from '@astrale-os/sdk/graph/path';
2
- import { defineMutation } from '@astrale-os/sdk/mutation';
3
- export function changeDefaultSpace(domain) {
4
- return defineMutation({
5
- id: 'shell.space.default',
6
- change(mutation, change) {
7
- mutation.expect.query(change.guard);
8
- const source = Path.id(change.user);
9
- if (change.previous !== undefined) {
10
- mutation.deleteEdge({
11
- class: domain.classes.default_space,
12
- source,
13
- target: Path.id(change.previous),
14
- });
15
- }
16
- mutation.createEdge({
17
- class: domain.classes.default_space,
18
- source,
19
- target: Path.id(change.next),
20
- });
21
- },
22
- project: () => Object.freeze({ ok: true }),
23
- reject: (failure) => Object.freeze({ ok: false, code: failure.code, outcomeKnown: failure.outcomeKnown }),
24
- });
25
- }
@@ -1,2 +0,0 @@
1
- export { changeSpaceAccess, } from './access.js';
2
- export { changeDefaultSpace, } from './default.js';
@@ -1,85 +0,0 @@
1
- import { LocalBinding } from '@astrale-os/sdk/graph';
2
- import { Path } from '@astrale-os/sdk/graph/path';
3
- import { defineMutation } from '@astrale-os/sdk/mutation';
4
- const personalSpace = LocalBinding('personalSpace');
5
- export function repairUser(domain) {
6
- return defineMutation({
7
- id: 'shell.user.repair',
8
- change(mutation, repair) {
9
- mutation.expect.query(repair.guards.home);
10
- mutation.expect.query(repair.guards.ownedSpaces);
11
- mutation.expect.query(repair.guards.groups);
12
- mutation.expect.node({
13
- node: Path.id(repair.userId),
14
- class: domain.classes.User,
15
- props: repair.currentDisplayName === undefined
16
- ? { absent: ['displayName'] }
17
- : { equals: { displayName: repair.currentDisplayName } },
18
- });
19
- if (repair.displayName !== undefined) {
20
- mutation.updateNode({
21
- node: Path.id(repair.userId),
22
- class: domain.classes.User,
23
- props: { set: { displayName: repair.displayName } },
24
- });
25
- }
26
- const home = repair.home.kind === 'create'
27
- ? mutation.createNode({
28
- as: personalSpace,
29
- class: domain.classes.Space,
30
- props: { name: repair.home.name },
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
- }
@@ -1,14 +0,0 @@
1
- import { defineCompositeQuery } from '@astrale-os/sdk/query';
2
- import { observeAdminSpaces } from './admin.js';
3
- import { observeMemberSpaces } from './member.js';
4
- export function observeDirectSpaceAccess(domain) {
5
- return defineCompositeQuery({
6
- id: 'shell.space.direct-access',
7
- compose({ combine, query }, user) {
8
- return combine({
9
- admin: query('admin', observeAdminSpaces(domain), user),
10
- member: query('member', observeMemberSpaces(domain), user),
11
- });
12
- },
13
- });
14
- }
@@ -1,27 +0,0 @@
1
- import { Path } from '@astrale-os/sdk/graph/path';
2
- import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
3
- function adminSpacesQuery(domain) {
4
- return {
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
- };
14
- }
15
- export function observeAdminSpaces(domain) {
16
- return defineQuery({
17
- id: 'shell.space.admin-access',
18
- ...adminSpacesQuery(domain),
19
- pagination: { maximumPages: 64 },
20
- project(pages, _user, { ast, complete }) {
21
- return Object.freeze({
22
- spaces: queryResult.completeNodeValues(pages, 'direct administered Spaces'),
23
- guard: Object.freeze({ query: ast, equals: complete }),
24
- });
25
- },
26
- });
27
- }
@@ -1,3 +0,0 @@
1
- export { observeAdminSpaces } from './admin.js';
2
- export { observeDirectSpaceAccess } from './access.js';
3
- export { observeMemberSpaces } from './member.js';
@@ -1,24 +0,0 @@
1
- import { Path } from '@astrale-os/sdk/graph/path';
2
- import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
3
- function memberSpacesQuery(domain) {
4
- return {
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
- };
11
- }
12
- export function observeMemberSpaces(domain) {
13
- return defineQuery({
14
- id: 'shell.space.member-access',
15
- ...memberSpacesQuery(domain),
16
- pagination: { maximumPages: 64 },
17
- project(pages, _user, { ast, complete }) {
18
- return Object.freeze({
19
- spaces: queryResult.completeNodeValues(pages, 'direct member Spaces'),
20
- guard: Object.freeze({ query: ast, equals: complete }),
21
- });
22
- },
23
- });
24
- }
@@ -1,24 +0,0 @@
1
- import { Path } from '@astrale-os/sdk/graph/path';
2
- import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
3
- function groupsQuery(domain) {
4
- return {
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
- };
11
- }
12
- export function observeUserGroups(domain) {
13
- return defineQuery({
14
- id: 'shell.user.groups',
15
- ...groupsQuery(domain),
16
- pagination: { maximumPages: 64 },
17
- project(pages, _user, { ast, complete }) {
18
- return Object.freeze({
19
- groups: queryResult.completeNodeValues(pages, 'Shell User Groups'),
20
- guard: Object.freeze({ query: ast, equals: complete }),
21
- });
22
- },
23
- });
24
- }
@@ -1,28 +0,0 @@
1
- import { Path } from '@astrale-os/sdk/graph/path';
2
- import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
3
- function homeQuery(domain) {
4
- return {
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
- };
14
- }
15
- export function observeHome(domain) {
16
- return defineQuery({
17
- id: 'shell.user.home',
18
- ...homeQuery(domain),
19
- page: { size: 2 },
20
- pagination: { maximumPages: 2 },
21
- project(pages, _user, { ast, complete }) {
22
- return Object.freeze({
23
- spaces: queryResult.completeNodeValues(pages, 'Shell User home'),
24
- guard: Object.freeze({ query: ast, equals: complete }),
25
- });
26
- },
27
- });
28
- }
@@ -1,24 +0,0 @@
1
- import { Path } from '@astrale-os/sdk/graph/path';
2
- import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
3
- function ownedSpacesQuery(domain) {
4
- return {
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
- };
11
- }
12
- export function observeOwnedSpaces(domain) {
13
- return defineQuery({
14
- id: 'shell.user.owned-spaces',
15
- ...ownedSpacesQuery(domain),
16
- pagination: { maximumPages: 64 },
17
- project(pages, _user, { ast, complete }) {
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
- }
@@ -1,17 +0,0 @@
1
- import { Path } from '@astrale-os/sdk/graph/path';
2
- import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
3
- const profileQuery = {
4
- build(user) {
5
- return Query.from({ nodes: [Path.parse(user)] }).select({
6
- kind: 'nodes',
7
- projection: { kind: 'value' },
8
- });
9
- },
10
- };
11
- export const readUserProfile = defineQuery({
12
- id: 'shell.user.profile',
13
- ...profileQuery,
14
- project(result) {
15
- return queryResult.exactlyOneNode(result, 'Shell User profile');
16
- },
17
- });
@@ -1,18 +0,0 @@
1
- import { defineCompositeQuery } from '@astrale-os/sdk/query';
2
- import { observeUserGroups } from './groups.js';
3
- import { observeHome } from './home.js';
4
- import { observeOwnedSpaces } from './owned-spaces.js';
5
- import { readUserProfile } from './profile.js';
6
- export function observeUserSetup(domain) {
7
- return defineCompositeQuery({
8
- id: 'shell.user.setup',
9
- compose({ combine, query }, userId) {
10
- return combine({
11
- profile: query('profile', readUserProfile, userId),
12
- home: query('home', observeHome(domain), userId),
13
- ownedSpaces: query('owned-spaces', observeOwnedSpaces(domain), userId),
14
- groups: query('groups', observeUserGroups(domain), userId),
15
- });
16
- },
17
- });
18
- }