@astrale-domains/shell 0.1.0-beta.22 → 0.1.0-beta.24
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/CHANGELOG.md +19 -0
- package/README.md +83 -79
- package/dist/application.d.ts +6 -5
- package/dist/application.js +20 -51
- package/dist/functions/group/assign-user-to-group.d.ts +27 -0
- package/dist/functions/group/assign-user-to-group.js +4 -0
- package/dist/functions/group/change-user-group-membership.d.ts +7 -0
- package/dist/functions/group/change-user-group-membership.js +34 -0
- package/dist/functions/group/group-membership-errors.d.ts +28 -0
- package/dist/functions/group/group-membership-errors.js +23 -0
- package/dist/functions/group/index.d.ts +2 -3
- package/dist/functions/group/index.js +2 -3
- package/dist/functions/group/unassign-user-from-group.d.ts +27 -0
- package/dist/functions/group/unassign-user-from-group.js +4 -0
- package/dist/functions/user/index.d.ts +1 -3
- package/dist/functions/user/index.js +1 -3
- package/dist/functions/user/invite-user.d.ts +30 -0
- package/dist/functions/user/invite-user.js +39 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- 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.d.ts +1 -1
- package/dist/mutations/group/index.js +1 -1
- package/dist/mutations/group/set-user-group-membership.d.ts +26 -0
- package/dist/mutations/group/set-user-group-membership.js +29 -0
- package/dist/providers/admin-enrollment/create-admin-enrollment-provider.d.ts +7 -0
- package/dist/providers/admin-enrollment/create-admin-enrollment-provider.js +78 -0
- package/dist/providers/admin-enrollment/decode-admin-invitation-response.d.ts +7 -0
- package/dist/providers/admin-enrollment/decode-admin-invitation-response.js +20 -0
- package/dist/providers/admin-enrollment/index.d.ts +1 -0
- package/dist/providers/admin-enrollment/index.js +1 -0
- package/dist/providers/admin-enrollment/read-enrollment-response.d.ts +1 -0
- package/dist/providers/admin-enrollment/read-enrollment-response.js +34 -0
- package/dist/queries/group/index.d.ts +2 -0
- package/dist/queries/group/index.js +2 -0
- package/dist/queries/group/read-group-membership-endpoints.d.ts +13 -0
- package/dist/queries/group/read-group-membership-endpoints.js +18 -0
- package/dist/queries/group/read-user-group-membership.d.ts +15 -0
- package/dist/queries/group/read-user-group-membership.js +35 -0
- package/dist/runtime.d.ts +94 -9
- package/dist/runtime.js +9 -5
- package/dist/schema/index.d.ts +4 -4
- package/dist/schema/index.js +3 -4
- package/dist/schema/modules/group/classes/group.d.ts +4 -6
- package/dist/schema/modules/group/classes/group.js +4 -6
- 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.js +2 -3
- package/dist/schema/modules/group/core/administrators-group.js +6 -0
- package/dist/schema/modules/group/core/index.d.ts +2 -0
- package/dist/schema/modules/group/core/index.js +2 -0
- package/dist/schema/modules/group/core/members-group.js +6 -0
- package/dist/schema/modules/group/functions/assign-user-to-group.d.ts +7 -0
- package/dist/schema/modules/group/functions/assign-user-to-group.js +11 -0
- package/dist/schema/modules/group/functions/index.d.ts +2 -0
- package/dist/schema/modules/group/functions/index.js +2 -0
- package/dist/schema/modules/{space/functions/add-user.d.ts → group/functions/unassign-user-from-group.d.ts} +3 -3
- package/dist/schema/modules/group/functions/unassign-user-from-group.js +11 -0
- package/dist/schema/modules/group/index.d.ts +3 -9
- package/dist/schema/modules/group/index.js +3 -9
- 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-user-reference.d.ts +6 -0
- package/dist/schema/modules/group/types/group-user-reference.js +8 -0
- package/dist/schema/modules/group/types/index.d.ts +1 -0
- package/dist/schema/modules/group/types/index.js +1 -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 +5 -8
- package/dist/schema/modules/user/classes/user.js +7 -7
- package/dist/schema/modules/user/functions/index.d.ts +1 -0
- package/dist/schema/modules/user/functions/index.js +1 -0
- package/dist/schema/modules/user/functions/invite-user.d.ts +11 -0
- package/dist/schema/modules/user/functions/invite-user.js +12 -0
- package/dist/schema/modules/user/index.d.ts +2 -6
- package/dist/schema/modules/user/index.js +2 -6
- package/dist/schema/modules/user/types/index.d.ts +1 -0
- package/dist/schema/modules/user/types/index.js +1 -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/policies/administers-shell-class.d.ts +2 -0
- package/dist/schema/policies/administers-shell-class.js +11 -0
- package/dist/schema/policies/index.d.ts +2 -0
- package/dist/schema/policies/index.js +2 -0
- package/dist/schema/policies/owns-class.d.ts +1 -0
- package/dist/schema/policies/owns-class.js +7 -0
- package/dist/schema/schema.d.ts +14 -69
- package/dist/schema/schema.js +10 -27
- package/dist/schema/views/application-view.d.ts +1 -0
- package/dist/schema/views/application-view.js +4 -0
- package/dist/schema/views/index.d.ts +1 -0
- package/dist/schema/views/index.js +1 -0
- package/dist/utils/canonical-node-path/index.d.ts +1 -0
- package/dist/utils/canonical-node-path/index.js +1 -0
- package/dist/utils/canonical-node-path/parse-canonical-node-path.d.ts +2 -0
- package/dist/utils/canonical-node-path/parse-canonical-node-path.js +8 -0
- package/package.json +17 -8
- package/dist/functions/group/assign.d.ts +0 -3
- package/dist/functions/group/assign.js +0 -3
- package/dist/functions/group/change.d.ts +0 -6
- package/dist/functions/group/change.js +0 -41
- package/dist/functions/group/unassign.d.ts +0 -3
- package/dist/functions/group/unassign.js +0 -3
- package/dist/functions/registry/index.d.ts +0 -12
- package/dist/functions/registry/index.js +0 -12
- package/dist/functions/setup/admin.d.ts +0 -3
- package/dist/functions/setup/admin.js +0 -3
- package/dist/functions/setup/index.d.ts +0 -4
- package/dist/functions/setup/index.js +0 -4
- package/dist/functions/setup/member.d.ts +0 -3
- package/dist/functions/setup/member.js +0 -3
- package/dist/functions/setup/provision.d.ts +0 -5
- package/dist/functions/setup/provision.js +0 -70
- package/dist/functions/setup/run.d.ts +0 -7
- package/dist/functions/setup/run.js +0 -82
- package/dist/functions/space/access.d.ts +0 -7
- package/dist/functions/space/access.js +0 -41
- package/dist/functions/space/add.d.ts +0 -3
- package/dist/functions/space/add.js +0 -3
- package/dist/functions/space/default.d.ts +0 -3
- package/dist/functions/space/default.js +0 -37
- package/dist/functions/space/index.d.ts +0 -4
- package/dist/functions/space/index.js +0 -4
- package/dist/functions/space/remove.d.ts +0 -3
- package/dist/functions/space/remove.js +0 -3
- package/dist/functions/user/resolve-home.d.ts +0 -3
- package/dist/functions/user/resolve-home.js +0 -19
- package/dist/mutations/group/membership.d.ts +0 -23
- package/dist/mutations/group/membership.js +0 -32
- package/dist/mutations/space/access.d.ts +0 -25
- package/dist/mutations/space/access.js +0 -23
- package/dist/mutations/space/default.d.ts +0 -19
- package/dist/mutations/space/default.js +0 -23
- package/dist/mutations/space/index.d.ts +0 -2
- package/dist/mutations/space/index.js +0 -2
- package/dist/mutations/user/index.d.ts +0 -1
- package/dist/mutations/user/index.js +0 -1
- package/dist/mutations/user/repair.d.ts +0 -22
- package/dist/mutations/user/repair.js +0 -104
- package/dist/queries/space/access.d.ts +0 -9
- package/dist/queries/space/access.js +0 -12
- package/dist/queries/space/admin.d.ts +0 -9
- package/dist/queries/space/admin.js +0 -20
- package/dist/queries/space/index.d.ts +0 -3
- package/dist/queries/space/index.js +0 -3
- package/dist/queries/space/member.d.ts +0 -9
- package/dist/queries/space/member.js +0 -17
- package/dist/queries/user/groups.d.ts +0 -10
- package/dist/queries/user/groups.js +0 -41
- package/dist/queries/user/home.d.ts +0 -9
- package/dist/queries/user/home.js +0 -21
- package/dist/queries/user/index.d.ts +0 -5
- package/dist/queries/user/index.js +0 -5
- package/dist/queries/user/owned-spaces.d.ts +0 -9
- package/dist/queries/user/owned-spaces.js +0 -17
- package/dist/queries/user/profile.d.ts +0 -4
- package/dist/queries/user/profile.js +0 -16
- package/dist/queries/user/setup.d.ts +0 -13
- package/dist/queries/user/setup.js +0 -16
- package/dist/rules/user/index.d.ts +0 -1
- package/dist/rules/user/index.js +0 -1
- package/dist/rules/user/setup.d.ts +0 -38
- package/dist/rules/user/setup.js +0 -95
- package/dist/schema/modules/group/core/admin-group.js +0 -2
- package/dist/schema/modules/group/core/core.d.ts +0 -8
- package/dist/schema/modules/group/core/core.js +0 -6
- package/dist/schema/modules/group/core/identity.d.ts +0 -1
- package/dist/schema/modules/group/core/identity.js +0 -10
- package/dist/schema/modules/group/core/member-group.js +0 -2
- package/dist/schema/modules/group/functions/assign-user.d.ts +0 -6
- package/dist/schema/modules/group/functions/assign-user.js +0 -2
- package/dist/schema/modules/group/functions/membership.d.ts +0 -7
- package/dist/schema/modules/group/functions/membership.js +0 -16
- package/dist/schema/modules/group/functions/unassign-user.d.ts +0 -6
- package/dist/schema/modules/group/functions/unassign-user.js +0 -2
- package/dist/schema/modules/group/policies/may-setup-users.d.ts +0 -1
- package/dist/schema/modules/group/policies/may-setup-users.js +0 -6
- package/dist/schema/modules/group/views/group.d.ts +0 -1
- package/dist/schema/modules/group/views/group.js +0 -6
- package/dist/schema/modules/space/classes/administers-space.d.ts +0 -16
- package/dist/schema/modules/space/classes/administers-space.js +0 -9
- package/dist/schema/modules/space/classes/default-space.d.ts +0 -16
- package/dist/schema/modules/space/classes/default-space.js +0 -8
- package/dist/schema/modules/space/classes/member-of-space.d.ts +0 -16
- package/dist/schema/modules/space/classes/member-of-space.js +0 -9
- package/dist/schema/modules/space/classes/owns-space.d.ts +0 -16
- package/dist/schema/modules/space/classes/owns-space.js +0 -9
- package/dist/schema/modules/space/classes/space.d.ts +0 -15
- package/dist/schema/modules/space/classes/space.js +0 -15
- package/dist/schema/modules/space/core/core.d.ts +0 -7
- package/dist/schema/modules/space/core/core.js +0 -12
- package/dist/schema/modules/space/core/default-space.d.ts +0 -1
- package/dist/schema/modules/space/core/default-space.js +0 -6
- package/dist/schema/modules/space/functions/access.d.ts +0 -10
- package/dist/schema/modules/space/functions/access.js +0 -9
- package/dist/schema/modules/space/functions/add-user.js +0 -11
- package/dist/schema/modules/space/functions/remove-user.d.ts +0 -6
- package/dist/schema/modules/space/functions/remove-user.js +0 -9
- package/dist/schema/modules/space/functions/set-default.d.ts +0 -4
- package/dist/schema/modules/space/functions/set-default.js +0 -9
- package/dist/schema/modules/space/index.d.ts +0 -14
- package/dist/schema/modules/space/index.js +0 -14
- package/dist/schema/modules/space/policies/belongs-to-space.d.ts +0 -1
- package/dist/schema/modules/space/policies/belongs-to-space.js +0 -9
- package/dist/schema/modules/space/policies/group-space-branch.d.ts +0 -4
- package/dist/schema/modules/space/policies/group-space-branch.js +0 -7
- package/dist/schema/modules/space/policies/may-administer-space.d.ts +0 -1
- package/dist/schema/modules/space/policies/may-administer-space.js +0 -8
- package/dist/schema/modules/space/policies/owns-space.d.ts +0 -1
- package/dist/schema/modules/space/policies/owns-space.js +0 -7
- package/dist/schema/modules/space/views/space.d.ts +0 -1
- package/dist/schema/modules/space/views/space.js +0 -6
- package/dist/schema/modules/user/functions/resolve-home.d.ts +0 -7
- package/dist/schema/modules/user/functions/resolve-home.js +0 -11
- package/dist/schema/modules/user/functions/setup-admin.d.ts +0 -14
- package/dist/schema/modules/user/functions/setup-admin.js +0 -2
- package/dist/schema/modules/user/functions/setup-member.d.ts +0 -14
- package/dist/schema/modules/user/functions/setup-member.js +0 -2
- package/dist/schema/modules/user/functions/setup-user.d.ts +0 -15
- package/dist/schema/modules/user/functions/setup-user.js +0 -20
- package/dist/schema/modules/user/views/home.d.ts +0 -1
- package/dist/schema/modules/user/views/home.js +0 -4
- package/dist/schema/modules/user/views/user.d.ts +0 -1
- package/dist/schema/modules/user/views/user.js +0 -6
- /package/dist/schema/modules/group/core/{admin-group.d.ts → administrators-group.d.ts} +0 -0
- /package/dist/schema/modules/group/core/{member-group.d.ts → members-group.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.0-beta.24](https://github.com/astrale-os/shell/compare/shell-domain-v0.1.0-beta.23...shell-domain-v0.1.0-beta.24) (2026-09-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **runtime:** simplify Shell users, groups and invitations ([#187](https://github.com/astrale-os/shell/issues/187))
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **domain:** migrate Shell to project environments ([#183](https://github.com/astrale-os/shell/issues/183)) ([ec72b5d](https://github.com/astrale-os/shell/commit/ec72b5d11fea5ff3266d1fd0a823c4eff5cc6d3e))
|
|
13
|
+
* **runtime:** simplify Shell users, groups and invitations ([#187](https://github.com/astrale-os/shell/issues/187)) ([7f00279](https://github.com/astrale-os/shell/commit/7f002791edae81944e6e80940834dee49212aa26))
|
|
14
|
+
|
|
15
|
+
## [0.1.0-beta.23](https://github.com/astrale-os/shell/compare/shell-domain-v0.1.0-beta.22...shell-domain-v0.1.0-beta.23) (2026-09-04)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **deps:** align SDK and Kernel release cohort ([#177](https://github.com/astrale-os/shell/issues/177)) ([294ec8f](https://github.com/astrale-os/shell/commit/294ec8f6f7a908afb608a1078e03a84ff2cc09ca))
|
|
21
|
+
|
|
3
22
|
## [0.1.0-beta.22](https://github.com/astrale-os/shell/compare/shell-domain-v0.1.0-beta.21...shell-domain-v0.1.0-beta.22) (2026-09-03)
|
|
4
23
|
|
|
5
24
|
|
package/README.md
CHANGED
|
@@ -1,85 +1,89 @@
|
|
|
1
1
|
# Shell Domain
|
|
2
2
|
|
|
3
|
-
Shell
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
Shell owns two concrete Identity classes, User and Group, the member_of_group relation,
|
|
4
|
+
the admin/member Core groups, three static methods, and one application View. There is
|
|
5
|
+
no Space, setup function, personal home, application catalogue, or public repair method.
|
|
6
|
+
|
|
7
|
+
## Contracts
|
|
8
|
+
|
|
9
|
+
| Static method | Input | Output |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| User.invite | `{ user: UserPath, email: string }` | `{ invitationId, user, state }` |
|
|
12
|
+
| Group.assignUser | `{ user: UserPath, group: GroupPath }` | `{}` |
|
|
13
|
+
| Group.unassignUser | Same | `{}` |
|
|
14
|
+
|
|
15
|
+
User extends Kernel.Identity and owns only optional creationKey correlation.
|
|
16
|
+
Concrete business classes may declare their own displayName/email; Shell never reads or writes them.
|
|
17
|
+
Group extends Kernel.Identity, Named and Descriptable. Authentication remains the
|
|
18
|
+
Kernel-owned, write-once iss/sub binding. Invitation email is explicit input, not a User property.
|
|
19
|
+
|
|
20
|
+
| Operation | Schema Policy alternatives, in addition to Kernel admission |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| invite | Core admin membership AND Shell-owned concrete User class; or ownership of the User's concrete class |
|
|
23
|
+
| assignUser / unassignUser | Core admin membership AND Shell-owned concrete Group class; or ownership of the Group's concrete class |
|
|
24
|
+
|
|
25
|
+
ownsClass follows instance_of → concrete class → of_domain → caller. It does not
|
|
26
|
+
infer ownership from an email, a subclass name, or ownership of an ancestor class.
|
|
27
|
+
A Domain cannot assign its Employee to Core member merely by owning Employee. Admin's invitation
|
|
28
|
+
orchestration retains that responsibility. A Group's owner may manage any admitted User in that Group.
|
|
29
|
+
administersShellClass connects Core admin membership and concrete ownership in one Policy pattern;
|
|
30
|
+
it does not treat inheritance from Shell as ownership. These are callable restrictions, not an
|
|
31
|
+
isolation boundary against Root/Manager or the existing broad administrator Kernel profile.
|
|
32
|
+
With Kernel Host beta94 or newer, an external caller needs callable authority through its own
|
|
33
|
+
identity composition AND a passing callable Policy. Declare exact foreign methods in the calling
|
|
34
|
+
Domain's requirements; can_use no longer bypasses the Policy. Root and exact owner exceptions remain.
|
|
35
|
+
|
|
36
|
+
## Flows
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
Domain creates Employee extending User → unregistered, no group
|
|
40
|
+
Direct credential-evidenced Register → same node authenticates, still no group
|
|
41
|
+
User.invite → provider authentication → Admin ingress → WorkOS/login
|
|
42
|
+
→ Admin Register on that same node → member assignment → completed
|
|
43
|
+
Group.assignUser → member_of_group + Kernel.extends_with in one atomic mutation
|
|
44
|
+
Group.unassignUser → remove both edges in one atomic mutation
|
|
16
45
|
```
|
|
17
46
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
No current responsibility earns a `states/`, `capabilities/`, `integrations/`, `migrations/`,
|
|
59
|
-
`views/`, or `ui/` source layer. DSL View declarations remain in Schema; a future frontend
|
|
60
|
-
projection or UI must establish its own concrete responsibility before adding those layers.
|
|
61
|
-
|
|
62
|
-
Shell never re-declares shared metadata properties. `Group` and `Space` extend `K.Named` and
|
|
63
|
-
`K.Descriptable` because those Kernel Classes own the admitted
|
|
64
|
-
`name` and `description` properties; no timestamps are authored by Shell.
|
|
65
|
-
|
|
66
|
-
## Execution and evidence
|
|
67
|
-
|
|
68
|
-
`application.ts` and `runtime.ts` form the complete remote product implementation. Runtime admission
|
|
69
|
-
is exhaustive: `User.resolveHome` is one Action, and both setup Functions plus all five mutating
|
|
70
|
-
Methods are Workflows. They use the SDK's canonical Auth, Query, Mutation, Result, Workflow, and Step
|
|
71
|
-
contracts. Named Workflow steps describe semantic operations but do not claim process-restart
|
|
72
|
-
durability, exactly-once execution, compensation, or crash recovery.
|
|
73
|
-
|
|
74
|
-
The executable contract lives in Shell's semantic source, public facades, and tests. Product
|
|
75
|
-
decisions, journeys, legacy disposition, dependency gates, and qualification evidence live in
|
|
76
|
-
[`.history/`](.history/). Product Domains intentionally have no `.spec/` tree; Kernel authoring
|
|
77
|
-
values come through semantic `@astrale-os/sdk/*` facades.
|
|
78
|
-
|
|
79
|
-
Domain authors import the schema facade from `@astrale-domains/shell`. Worker deployments import the
|
|
80
|
-
application descriptor from `@astrale-domains/shell/application` and the runtime entrypoint from
|
|
81
|
-
`@astrale-domains/shell/runtime`, so bundling the remote runtime does not traverse the build-only
|
|
82
|
-
schema facade.
|
|
47
|
+
The invitation flow is coordinated by Admin, not by an Employee callback. Shell's Integration
|
|
48
|
+
carries only user/email/requestId/requestedBy. Its Provider mints an invocation-bound Shell
|
|
49
|
+
proof for its configured HTTPS ingress audience; target/sourceProof are not business inputs.
|
|
50
|
+
A returned pending invitation does not prove email delivery or completed registration.
|
|
51
|
+
|
|
52
|
+
Membership methods converge both edges, including an observed partial membership.
|
|
53
|
+
After an uncertain mutation response they re-read the pair; an unconfirmed outcome remains
|
|
54
|
+
explicitly unconfirmed. This is not a global repair scan or an exactly-once guarantee.
|
|
55
|
+
|
|
56
|
+
A Team class extending Group can carry a business permission edge to Project. Membership
|
|
57
|
+
composition lets an Employee's expanded grant include Team; the protected Project Policy is
|
|
58
|
+
still evaluated by Kernel. Removing composition removes that authority path. Installed
|
|
59
|
+
Kernel E2E evidence, not a handler test, qualifies this behavior.
|
|
60
|
+
|
|
61
|
+
## Installation and View
|
|
62
|
+
|
|
63
|
+
The Shell principal requests all Kernel root functions, the required extends_with operations,
|
|
64
|
+
and the declared grant/revoke authority. Core admin receives the full declared Shell profile,
|
|
65
|
+
including invite, assignUser and unassignUser so humans inheriting admin can call those methods.
|
|
66
|
+
Core member receives Introspect, Query, Mutate and View.resolve, not blanket class-read grants.
|
|
67
|
+
Application requirements, including requirements.core, are owned by application.ts and materialized by installation,
|
|
68
|
+
never by invitation handlers.
|
|
69
|
+
|
|
70
|
+
The sole application entrypoint uses the Vite frontend at /. It lists visible User/Group
|
|
71
|
+
families under the caller's session, with loading/empty/error states and independent refresh.
|
|
72
|
+
Users display their concrete class and Node ID, not a guessed foreign profile.
|
|
73
|
+
It does not proxy privileged directory reads or enumerate installed applications.
|
|
74
|
+
|
|
75
|
+
## Source and qualification
|
|
76
|
+
|
|
77
|
+
Each declaration, Query and Mutation has its own semantic file. Layer roots are facades;
|
|
78
|
+
functions own orchestration, integrations/providers own external effects, views/ui own the
|
|
79
|
+
directory surface. Runtime has one default export and binds the three static Workflows.
|
|
80
|
+
The Dataset is referenced lazily by the root astrale.config.ts.
|
|
81
|
+
|
|
82
|
+
Domain authors import Schema from @astrale-domains/shell; platform workers use the explicit
|
|
83
|
+
/application and /runtime exports. Creation/registration, installation authority, invitation
|
|
84
|
+
delivery, runtime replay and browser rendering are separate qualification boundaries.
|
|
85
|
+
The redesigned Admin composition, published Register cohort and real invitation/instance-create
|
|
86
|
+
journeys remain release gates; this source README is not evidence that those gates passed.
|
|
83
87
|
|
|
84
88
|
### Publication boundary
|
|
85
89
|
|
|
@@ -88,7 +92,7 @@ Domain publication product. It publishes the remote Shell application and runtim
|
|
|
88
92
|
Worker deployments through the explicit `./application` and `./runtime` subpaths, while its root remains
|
|
89
93
|
Schema-only. Its build therefore compiles the explicit roots in `tsconfig.package.json` and applies
|
|
90
94
|
Shell-owned normalization and checks to the emitted platform closure. Source-only `#` aliases are
|
|
91
|
-
rewritten to relative declaration references so consumer path mappings cannot capture private Shell
|
|
95
|
+
rewritten to relative JS and declaration references so consumer path mappings cannot capture private Shell
|
|
92
96
|
types. Tarball qualification then verifies the exact exports, isolated subpaths, absence of source
|
|
93
97
|
maps, and an install using only public npm dependencies.
|
|
94
98
|
|
package/dist/application.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type Application
|
|
2
|
-
import runtime from './runtime.js';
|
|
1
|
+
import { type Application } from '@astrale-os/sdk/application';
|
|
3
2
|
import { ShellSchema } from './schema/index.js';
|
|
4
|
-
|
|
5
|
-
declare const
|
|
6
|
-
|
|
3
|
+
import { type ShellRuntime } from './runtime.js';
|
|
4
|
+
declare const frontend: import("@astrale-os/sdk/view").Frontend<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("./schema/index.js").ShellSchemaInput>>>;
|
|
5
|
+
declare const applicationRequirements: import("@astrale-os/sdk/application").Requirements;
|
|
6
|
+
export type ShellApplication = Application<typeof ShellSchema, ShellRuntime, typeof frontend, undefined, typeof applicationRequirements>;
|
|
7
|
+
export declare const application: ShellApplication;
|
|
7
8
|
export default application;
|
package/dist/application.js
CHANGED
|
@@ -1,75 +1,44 @@
|
|
|
1
|
-
import { defineApplication, defineFrontend,
|
|
1
|
+
import { defineApplication, defineFrontend, vite, requirements, } from '@astrale-os/sdk/application';
|
|
2
2
|
import { K, KernelRootFunctions } from '@astrale-os/sdk/schema';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import { ShellSchema, S } from './schema/index.js';
|
|
4
|
+
import runtime, {} from './runtime.js';
|
|
5
5
|
const frontend = defineFrontend({
|
|
6
6
|
schema: ShellSchema,
|
|
7
|
-
source:
|
|
8
|
-
routes: {
|
|
9
|
-
|
|
10
|
-
home: '/',
|
|
11
|
-
space: '/spaces',
|
|
12
|
-
user: '/users',
|
|
13
|
-
},
|
|
14
|
-
entrypoint: 'home',
|
|
7
|
+
source: vite({ config: './frontend/vite.config.ts' }),
|
|
8
|
+
routes: { application: { path: '/', handshake: 'shell' } },
|
|
9
|
+
entrypoint: 'application',
|
|
15
10
|
});
|
|
16
11
|
const applicationRequirements = requirements({
|
|
12
|
+
// Sujet implicite : le principal installé Shell, utilisé par kernel.self.
|
|
17
13
|
functions: KernelRootFunctions,
|
|
18
14
|
classes: [
|
|
19
|
-
{
|
|
20
|
-
class: K.classes.Domain,
|
|
21
|
-
operations: ['read'],
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
class: K.classes.extends_with,
|
|
25
|
-
operations: ['create', 'read', 'traverse', 'delete'],
|
|
26
|
-
},
|
|
15
|
+
{ class: K.classes.extends_with, operations: ['create', 'read', 'traverse', 'delete'] },
|
|
27
16
|
],
|
|
28
17
|
authority: {
|
|
29
18
|
grant: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'revoke'],
|
|
30
19
|
revoke: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'grant'],
|
|
31
20
|
},
|
|
32
|
-
|
|
21
|
+
// Ces profils sont matérialisés par l'installeur, pas par un handler Shell.
|
|
22
|
+
core: [
|
|
33
23
|
{
|
|
34
24
|
subject: S.core.nodes.admin,
|
|
35
|
-
functions:
|
|
25
|
+
functions: [
|
|
26
|
+
...KernelRootFunctions,
|
|
27
|
+
S.classes.User.static.methods.invite,
|
|
28
|
+
S.classes.Group.static.methods.assignUser,
|
|
29
|
+
S.classes.Group.static.methods.unassignUser,
|
|
30
|
+
],
|
|
36
31
|
classes: [
|
|
32
|
+
{ class: S.classes.User, operations: ['create', 'read', 'traverse', 'update', 'delete'] },
|
|
37
33
|
{
|
|
38
34
|
class: S.classes.Group,
|
|
39
35
|
operations: ['create', 'read', 'traverse', 'update', 'delete'],
|
|
40
36
|
},
|
|
41
|
-
{
|
|
42
|
-
class: S.classes.Space,
|
|
43
|
-
operations: ['create', 'read', 'traverse', 'update', 'delete'],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
class: S.classes.User,
|
|
47
|
-
operations: ['create', 'read', 'traverse', 'update', 'delete'],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
class: S.classes.administers_space,
|
|
51
|
-
operations: ['create', 'read', 'traverse', 'update', 'delete'],
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
class: S.classes.default_space,
|
|
55
|
-
operations: ['create', 'read', 'traverse', 'update', 'delete'],
|
|
56
|
-
},
|
|
57
37
|
{
|
|
58
38
|
class: S.classes.member_of_group,
|
|
59
39
|
operations: ['create', 'read', 'traverse', 'update', 'delete'],
|
|
60
40
|
},
|
|
61
|
-
{
|
|
62
|
-
class: S.classes.member_of_space,
|
|
63
|
-
operations: ['create', 'read', 'traverse', 'update', 'delete'],
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
class: S.classes.owns_space,
|
|
67
|
-
operations: ['create', 'read', 'traverse', 'update', 'delete'],
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
class: K.classes.extends_with,
|
|
71
|
-
operations: ['create', 'read', 'traverse', 'delete'],
|
|
72
|
-
},
|
|
41
|
+
{ class: K.classes.extends_with, operations: ['create', 'read', 'traverse', 'delete'] },
|
|
73
42
|
],
|
|
74
43
|
authority: {
|
|
75
44
|
grant: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'revoke'],
|
|
@@ -79,10 +48,10 @@ const applicationRequirements = requirements({
|
|
|
79
48
|
{
|
|
80
49
|
subject: S.core.nodes.member,
|
|
81
50
|
functions: [
|
|
82
|
-
K.classes.View.static.methods.resolve,
|
|
83
51
|
K.functions.introspect,
|
|
84
|
-
K.functions.mutate,
|
|
85
52
|
K.functions.query,
|
|
53
|
+
K.functions.mutate,
|
|
54
|
+
K.classes.View.static.methods.resolve,
|
|
86
55
|
],
|
|
87
56
|
},
|
|
88
57
|
],
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const assignUser: import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("../../schema/index.js").ShellSchemaInput>>, "Group.assignUser", Readonly<Record<never, never>>, {
|
|
2
|
+
readonly GROUP_MEMBERSHIP_ENDPOINTS_UNAVAILABLE: {
|
|
3
|
+
readonly family: 'CONFLICT';
|
|
4
|
+
readonly message: 'Shell must be able to traverse both membership endpoints before confirming membership.';
|
|
5
|
+
readonly details: import("zod").ZodObject<{}, import("zod/v4/core").$strict>;
|
|
6
|
+
};
|
|
7
|
+
readonly INVALID_GROUP_MEMBERSHIP_REFERENCE: {
|
|
8
|
+
readonly family: 'VALIDATION_ERROR';
|
|
9
|
+
readonly message: 'User and group must be exact canonical @NodeId paths.';
|
|
10
|
+
readonly details: import("zod").ZodObject<{}, import("zod/v4/core").$strict>;
|
|
11
|
+
};
|
|
12
|
+
readonly GROUP_MEMBERSHIP_CONFLICT: {
|
|
13
|
+
readonly family: 'CONFLICT';
|
|
14
|
+
readonly message: 'Membership changed concurrently; retry the operation.';
|
|
15
|
+
readonly details: import("zod").ZodObject<{
|
|
16
|
+
cause: import("zod").ZodString;
|
|
17
|
+
}, import("zod/v4/core").$strict>;
|
|
18
|
+
};
|
|
19
|
+
readonly GROUP_MEMBERSHIP_UNCONFIRMED: {
|
|
20
|
+
readonly family: 'CONFLICT';
|
|
21
|
+
readonly message: 'The requested membership could not be confirmed; retry the operation.';
|
|
22
|
+
readonly details: import("zod").ZodObject<{
|
|
23
|
+
cause: import("zod").ZodString;
|
|
24
|
+
outcomeKnown: import("zod").ZodLiteral<false>;
|
|
25
|
+
}, import("zod/v4/core").$strict>;
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { defineWorkflow } from '@astrale-os/sdk/workflow';
|
|
2
|
+
import { changeGroupMembership } from './change-user-group-membership.js';
|
|
3
|
+
import { groupMembershipErrors } from './group-membership-errors.js';
|
|
4
|
+
export const assignUser = defineWorkflow()('Group.assignUser', { errors: groupMembershipErrors }, (context) => changeGroupMembership(context, true));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkflowContext } from '@astrale-os/sdk/workflow';
|
|
2
|
+
import type { S, Shell } from '../../schema/index.js';
|
|
3
|
+
import type { groupMembershipErrors } from './group-membership-errors.js';
|
|
4
|
+
type GroupCallable = typeof S.classes.Group.static.methods.assignUser | typeof S.classes.Group.static.methods.unassignUser;
|
|
5
|
+
type Context = WorkflowContext<GroupCallable, Shell, Readonly<Record<never, never>>, typeof groupMembershipErrors>;
|
|
6
|
+
export declare function changeGroupMembership(context: Context, present: boolean): Promise<{}>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { setGroupMembership } from '../../mutations/group/index.js';
|
|
2
|
+
import { readGroupMembership, readGroupMembershipEndpoints, } from '../../queries/group/index.js';
|
|
3
|
+
import { canonicalNodeId } from '../../utils/canonical-node-path/index.js';
|
|
4
|
+
const matches = (state, present) => state.membership === present && state.authority === present;
|
|
5
|
+
export async function changeGroupMembership(context, present) {
|
|
6
|
+
const invalid = () => context.error('INVALID_GROUP_MEMBERSHIP_REFERENCE', {});
|
|
7
|
+
const membership = {
|
|
8
|
+
user: canonicalNodeId(context.input.user, invalid),
|
|
9
|
+
group: canonicalNodeId(context.input.group, invalid),
|
|
10
|
+
};
|
|
11
|
+
const observe = async () => {
|
|
12
|
+
const endpoints = await context.query(readGroupMembershipEndpoints, membership);
|
|
13
|
+
if (!endpoints.visible)
|
|
14
|
+
throw context.error('GROUP_MEMBERSHIP_ENDPOINTS_UNAVAILABLE', {});
|
|
15
|
+
const current = await context.query(readGroupMembership, membership);
|
|
16
|
+
return { ...current, endpoints: endpoints.guard };
|
|
17
|
+
};
|
|
18
|
+
const current = await context.step.run('observe-membership', observe);
|
|
19
|
+
if (matches(current, present))
|
|
20
|
+
return {};
|
|
21
|
+
const result = await context.step.run('mutate-membership', () => context.mutate(setGroupMembership, { ...membership, current, present }));
|
|
22
|
+
if (result.ok)
|
|
23
|
+
return {};
|
|
24
|
+
if (result.outcomeKnown) {
|
|
25
|
+
throw context.error('GROUP_MEMBERSHIP_CONFLICT', { cause: result.code });
|
|
26
|
+
}
|
|
27
|
+
const recovered = await context.step.run('recover-membership', observe);
|
|
28
|
+
if (matches(recovered, present))
|
|
29
|
+
return {};
|
|
30
|
+
throw context.error('GROUP_MEMBERSHIP_UNCONFIRMED', {
|
|
31
|
+
cause: result.code,
|
|
32
|
+
outcomeKnown: false,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const groupMembershipErrors: {
|
|
3
|
+
readonly GROUP_MEMBERSHIP_ENDPOINTS_UNAVAILABLE: {
|
|
4
|
+
readonly family: 'CONFLICT';
|
|
5
|
+
readonly message: 'Shell must be able to traverse both membership endpoints before confirming membership.';
|
|
6
|
+
readonly details: z.ZodObject<{}, z.core.$strict>;
|
|
7
|
+
};
|
|
8
|
+
readonly INVALID_GROUP_MEMBERSHIP_REFERENCE: {
|
|
9
|
+
readonly family: 'VALIDATION_ERROR';
|
|
10
|
+
readonly message: 'User and group must be exact canonical @NodeId paths.';
|
|
11
|
+
readonly details: z.ZodObject<{}, z.core.$strict>;
|
|
12
|
+
};
|
|
13
|
+
readonly GROUP_MEMBERSHIP_CONFLICT: {
|
|
14
|
+
readonly family: 'CONFLICT';
|
|
15
|
+
readonly message: 'Membership changed concurrently; retry the operation.';
|
|
16
|
+
readonly details: z.ZodObject<{
|
|
17
|
+
cause: z.ZodString;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
};
|
|
20
|
+
readonly GROUP_MEMBERSHIP_UNCONFIRMED: {
|
|
21
|
+
readonly family: 'CONFLICT';
|
|
22
|
+
readonly message: 'The requested membership could not be confirmed; retry the operation.';
|
|
23
|
+
readonly details: z.ZodObject<{
|
|
24
|
+
cause: z.ZodString;
|
|
25
|
+
outcomeKnown: z.ZodLiteral<false>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const groupMembershipErrors = {
|
|
3
|
+
GROUP_MEMBERSHIP_ENDPOINTS_UNAVAILABLE: {
|
|
4
|
+
family: 'CONFLICT',
|
|
5
|
+
message: 'Shell must be able to traverse both membership endpoints before confirming membership.',
|
|
6
|
+
details: z.strictObject({}),
|
|
7
|
+
},
|
|
8
|
+
INVALID_GROUP_MEMBERSHIP_REFERENCE: {
|
|
9
|
+
family: 'VALIDATION_ERROR',
|
|
10
|
+
message: 'User and group must be exact canonical @NodeId paths.',
|
|
11
|
+
details: z.strictObject({}),
|
|
12
|
+
},
|
|
13
|
+
GROUP_MEMBERSHIP_CONFLICT: {
|
|
14
|
+
family: 'CONFLICT',
|
|
15
|
+
message: 'Membership changed concurrently; retry the operation.',
|
|
16
|
+
details: z.strictObject({ cause: z.string() }),
|
|
17
|
+
},
|
|
18
|
+
GROUP_MEMBERSHIP_UNCONFIRMED: {
|
|
19
|
+
family: 'CONFLICT',
|
|
20
|
+
message: 'The requested membership could not be confirmed; retry the operation.',
|
|
21
|
+
details: z.strictObject({ cause: z.string(), outcomeKnown: z.literal(false) }),
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { unassignGroupUserWorkflow } from './unassign.js';
|
|
1
|
+
export { assignUser } from './assign-user-to-group.js';
|
|
2
|
+
export { unassignUser } from './unassign-user-from-group.js';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { unassignGroupUserWorkflow } from './unassign.js';
|
|
1
|
+
export { assignUser } from './assign-user-to-group.js';
|
|
2
|
+
export { unassignUser } from './unassign-user-from-group.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const unassignUser: import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("../../schema/index.js").ShellSchemaInput>>, "Group.unassignUser", Readonly<Record<never, never>>, {
|
|
2
|
+
readonly GROUP_MEMBERSHIP_ENDPOINTS_UNAVAILABLE: {
|
|
3
|
+
readonly family: 'CONFLICT';
|
|
4
|
+
readonly message: 'Shell must be able to traverse both membership endpoints before confirming membership.';
|
|
5
|
+
readonly details: import("zod").ZodObject<{}, import("zod/v4/core").$strict>;
|
|
6
|
+
};
|
|
7
|
+
readonly INVALID_GROUP_MEMBERSHIP_REFERENCE: {
|
|
8
|
+
readonly family: 'VALIDATION_ERROR';
|
|
9
|
+
readonly message: 'User and group must be exact canonical @NodeId paths.';
|
|
10
|
+
readonly details: import("zod").ZodObject<{}, import("zod/v4/core").$strict>;
|
|
11
|
+
};
|
|
12
|
+
readonly GROUP_MEMBERSHIP_CONFLICT: {
|
|
13
|
+
readonly family: 'CONFLICT';
|
|
14
|
+
readonly message: 'Membership changed concurrently; retry the operation.';
|
|
15
|
+
readonly details: import("zod").ZodObject<{
|
|
16
|
+
cause: import("zod").ZodString;
|
|
17
|
+
}, import("zod/v4/core").$strict>;
|
|
18
|
+
};
|
|
19
|
+
readonly GROUP_MEMBERSHIP_UNCONFIRMED: {
|
|
20
|
+
readonly family: 'CONFLICT';
|
|
21
|
+
readonly message: 'The requested membership could not be confirmed; retry the operation.';
|
|
22
|
+
readonly details: import("zod").ZodObject<{
|
|
23
|
+
cause: import("zod").ZodString;
|
|
24
|
+
outcomeKnown: import("zod").ZodLiteral<false>;
|
|
25
|
+
}, import("zod/v4/core").$strict>;
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { defineWorkflow } from '@astrale-os/sdk/workflow';
|
|
2
|
+
import { changeGroupMembership } from './change-user-group-membership.js';
|
|
3
|
+
import { groupMembershipErrors } from './group-membership-errors.js';
|
|
4
|
+
export const unassignUser = defineWorkflow()('Group.unassignUser', { errors: groupMembershipErrors }, (context) => changeGroupMembership(context, false));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const invite: import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("../../schema/index.js").ShellSchemaInput>>, "User.invite", {
|
|
3
|
+
enrollment: import("@astrale-os/sdk/integration").IntegrationDefinition<"shell.enrollment", {
|
|
4
|
+
invite: import("@astrale-os/sdk/integration").IntegrationOperation<import("../../integrations/user-invitation/index.js").InviteRequest, {
|
|
5
|
+
invitationId: string;
|
|
6
|
+
user: string;
|
|
7
|
+
state: "accepted" | "cancelled" | "completed" | "expired" | "failed" | "pending" | "registered" | "registering";
|
|
8
|
+
}>;
|
|
9
|
+
}>;
|
|
10
|
+
}, {
|
|
11
|
+
readonly INVALID_INVITATION_REFERENCE: {
|
|
12
|
+
readonly family: "VALIDATION_ERROR";
|
|
13
|
+
readonly message: "User must be an exact canonical @NodeId path.";
|
|
14
|
+
readonly details: z.ZodObject<{}, z.core.$strict>;
|
|
15
|
+
};
|
|
16
|
+
readonly INVITATION_CONFLICT: {
|
|
17
|
+
readonly family: "CONFLICT";
|
|
18
|
+
readonly message: "The invitation conflicts with an existing request.";
|
|
19
|
+
readonly details: z.ZodObject<{
|
|
20
|
+
requestId: z.ZodString;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
};
|
|
23
|
+
readonly INVITATION_REJECTED: {
|
|
24
|
+
readonly family: "VALIDATION_ERROR";
|
|
25
|
+
readonly message: "Admin rejected the invitation request.";
|
|
26
|
+
readonly details: z.ZodObject<{
|
|
27
|
+
requestId: z.ZodString;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineWorkflow } from '@astrale-os/sdk/workflow';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { InvitationRequestFailure } from '../../integrations/user-invitation/index.js';
|
|
4
|
+
import { canonicalNodeId } from '../../utils/canonical-node-path/index.js';
|
|
5
|
+
export const invite = defineWorkflow()('User.invite', {
|
|
6
|
+
errors: {
|
|
7
|
+
INVALID_INVITATION_REFERENCE: {
|
|
8
|
+
family: 'VALIDATION_ERROR',
|
|
9
|
+
message: 'User must be an exact canonical @NodeId path.',
|
|
10
|
+
details: z.strictObject({}),
|
|
11
|
+
},
|
|
12
|
+
INVITATION_CONFLICT: {
|
|
13
|
+
family: 'CONFLICT',
|
|
14
|
+
message: 'The invitation conflicts with an existing request.',
|
|
15
|
+
details: z.strictObject({ requestId: z.string() }),
|
|
16
|
+
},
|
|
17
|
+
INVITATION_REJECTED: {
|
|
18
|
+
family: 'VALIDATION_ERROR',
|
|
19
|
+
message: 'Admin rejected the invitation request.',
|
|
20
|
+
details: z.strictObject({ requestId: z.string() }),
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
}, async (context) => {
|
|
24
|
+
const user = canonicalNodeId(context.input.user, () => context.error('INVALID_INVITATION_REFERENCE', {}));
|
|
25
|
+
const requestId = context.execution.idempotencyKey ?? crypto.randomUUID();
|
|
26
|
+
try {
|
|
27
|
+
return await context.step.run('request-invitation', () => context.integrations.enrollment.invite({
|
|
28
|
+
user,
|
|
29
|
+
email: context.input.email,
|
|
30
|
+
requestId,
|
|
31
|
+
requestedBy: context.caller.principal,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
catch (cause) {
|
|
35
|
+
if (cause instanceof InvitationRequestFailure)
|
|
36
|
+
throw context.error(cause.code, { requestId });
|
|
37
|
+
throw cause;
|
|
38
|
+
}
|
|
39
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ShellSchema, S, type Shell, type ShellClasses, type ShellSchemaInput, type InvitationSummary, User, Group, member_of_group, adminGroup, memberGroup, } from './schema/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ShellSchema, S, User, Group, member_of_group, adminGroup, memberGroup, } from './schema/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { integrations } from './integrations.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { integrations } from './integrations.js';
|