@astrale-domains/shell 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -173
- package/dist/domain.d.ts +477 -31
- package/dist/domain.js +87 -78
- package/dist/functions/application/index.js +2 -1
- package/dist/functions/application/legacy/index.js +1 -0
- package/dist/functions/application/legacy/list-entrypoints.js +8 -0
- package/dist/functions/authority/capabilities.js +1 -0
- package/dist/functions/authority/composition.js +47 -0
- package/dist/functions/authority/index.js +2 -0
- package/dist/functions/authority/roles.js +98 -0
- package/dist/functions/directory/disconnect-directory.js +35 -0
- package/dist/functions/directory/index.js +1 -0
- package/dist/functions/group/change-group-membership.js +43 -9
- package/dist/functions/group/create-group.js +23 -0
- package/dist/functions/group/delete-group.js +33 -0
- package/dist/functions/group/deprovision-group.js +27 -0
- package/dist/functions/group/group-errors.js +43 -0
- package/dist/functions/group/group-membership-errors.js +2 -0
- package/dist/functions/group/group.js +51 -0
- package/dist/functions/group/index.js +8 -2
- package/dist/functions/group/legacy/index.js +1 -0
- package/dist/functions/group/legacy/membership.js +60 -0
- package/dist/functions/group/membership-laws.js +40 -0
- package/dist/functions/group/provision-group.js +33 -0
- package/dist/functions/group/update-group.js +55 -0
- package/dist/functions/invitation/index.js +2 -0
- package/dist/functions/invitation/invitation-errors.js +13 -0
- package/dist/functions/invitation/invitation-methods.js +41 -0
- package/dist/functions/invitation/send-invitation.js +81 -0
- package/dist/functions/user/account.js +35 -0
- package/dist/functions/user/create-user.js +45 -0
- package/dist/functions/user/deactivate-user.js +19 -0
- package/dist/functions/user/delete-user.js +34 -0
- package/dist/functions/user/deprovision-user.js +21 -0
- package/dist/functions/user/index.js +15 -1
- package/dist/functions/user/invite-errors.js +18 -0
- package/dist/functions/user/invite-user.js +42 -34
- package/dist/functions/user/legacy/claimed-account.js +11 -0
- package/dist/functions/user/legacy/index.js +4 -0
- package/dist/functions/user/legacy/invite.js +20 -0
- package/dist/functions/user/legacy/migrate-accounts.js +98 -0
- package/dist/functions/user/legacy/record-profile.js +19 -0
- package/dist/functions/user/protect-administrators.js +16 -0
- package/dist/functions/user/provision-user.js +70 -0
- package/dist/functions/user/reactivate-user.js +19 -0
- package/dist/functions/user/read-account.js +12 -0
- package/dist/functions/user/request-invitation.js +17 -0
- package/dist/functions/user/update-profile.js +22 -0
- package/dist/functions/user/update-user.js +68 -0
- package/dist/functions/user/user-errors.js +69 -0
- package/dist/functions/user/write-account.js +57 -0
- package/dist/functions/view-access/index.js +2 -1
- package/dist/functions/view-access/{assign-views.js → legacy/assign-views.js} +11 -7
- package/dist/functions/view-access/legacy/index.js +1 -0
- package/dist/functions/view-access/{view-access-errors.js → legacy/view-access-errors.js} +5 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/integrations/user-invitation/invite-user-request.d.ts +6 -0
- package/dist/legacy/index.js +1 -0
- package/dist/legacy/release.js +33 -0
- package/dist/mutations/composition/grant-role.js +13 -0
- package/dist/mutations/composition/index.js +1 -0
- package/dist/mutations/group/legacy/index.js +1 -0
- package/dist/mutations/group/legacy/membership-class.js +7 -0
- package/dist/mutations/group/set-group-membership.js +23 -14
- package/dist/mutations/identity/create-profile.js +37 -0
- package/dist/mutations/identity/delete-identity.js +28 -0
- package/dist/mutations/identity/index.js +4 -0
- package/dist/mutations/identity/write-account.js +109 -0
- package/dist/mutations/identity/write-group.js +72 -0
- package/dist/mutations/invitation/index.js +1 -0
- package/dist/mutations/invitation/write-invitation.js +62 -0
- package/dist/mutations/user/legacy/index.js +1 -0
- package/dist/mutations/user/{record-user-profile.js → legacy/record-user-profile.js} +5 -2
- package/dist/providers/admin-enrollment/create-admin-enrollment-provider.js +6 -3
- package/dist/providers/admin-enrollment/legacy/index.js +1 -0
- package/dist/providers/admin-enrollment/legacy/send-without-profile.js +16 -0
- package/dist/queries/application/legacy/index.js +1 -0
- package/dist/queries/application/legacy/read-installed-entrypoints.js +47 -0
- package/dist/queries/composition/index.js +2 -0
- package/dist/queries/composition/read-extensions.js +34 -0
- package/dist/queries/composition/read-role-nodes.js +41 -0
- package/dist/queries/group/index.js +1 -1
- package/dist/queries/group/legacy/index.js +2 -0
- package/dist/queries/group/legacy/read-core-groups.js +46 -0
- package/dist/queries/group/legacy/read-member-of-group.js +24 -0
- package/dist/queries/group/read-group-membership-endpoints.js +11 -0
- package/dist/queries/group/read-group-membership.js +6 -21
- package/dist/queries/identity/index.js +1 -0
- package/dist/queries/identity/read-identities.js +29 -0
- package/dist/queries/invitation/index.js +1 -0
- package/dist/queries/invitation/read-invitation.js +25 -0
- package/dist/queries/profile/index.js +1 -0
- package/dist/queries/profile/read-profile.js +15 -0
- package/dist/queries/role/index.js +1 -0
- package/dist/queries/role/read-role-node.js +13 -0
- package/dist/queries/user/legacy/index.js +1 -0
- package/dist/queries/user/legacy/read-user-profile.js +27 -0
- package/dist/runtime.d.ts +18203 -630
- package/dist/runtime.js +32 -7
- package/dist/schema/index.d.ts +7 -4
- package/dist/schema/index.js +8 -4
- package/dist/schema/legacy/index.js +1 -0
- package/dist/schema/legacy/schema.js +32 -0
- package/dist/schema/modules/application/legacy/entrypoint-entry.js +11 -0
- package/dist/schema/modules/application/legacy/functions/index.js +1 -0
- package/dist/schema/modules/application/legacy/functions/list-entrypoints.js +21 -0
- package/dist/schema/modules/application/legacy/index.js +2 -0
- package/dist/schema/modules/directory/functions/disconnect-directory.d.ts +13 -0
- package/dist/schema/modules/directory/functions/disconnect-directory.js +15 -0
- package/dist/schema/modules/directory/functions/index.d.ts +1 -0
- package/dist/schema/modules/directory/functions/index.js +1 -0
- package/dist/schema/modules/directory/index.d.ts +1 -0
- package/dist/schema/modules/directory/index.js +1 -0
- package/dist/schema/modules/group/classes/group-profile-link.d.ts +34 -0
- package/dist/schema/modules/group/classes/group-profile-link.js +21 -0
- package/dist/schema/modules/group/classes/group-profile.d.ts +15 -0
- package/dist/schema/modules/group/classes/group-profile.js +20 -0
- package/dist/schema/modules/group/classes/group.d.ts +73 -1
- package/dist/schema/modules/group/classes/group.js +28 -7
- package/dist/schema/modules/group/classes/index.d.ts +2 -1
- package/dist/schema/modules/group/classes/index.js +3 -1
- package/dist/schema/modules/group/functions/assign-member.js +17 -0
- package/dist/schema/modules/group/functions/create-group.js +20 -0
- package/dist/schema/modules/group/functions/delete-group.js +12 -0
- package/dist/schema/modules/group/functions/deprovision-group.js +14 -0
- package/dist/schema/modules/group/functions/index.js +7 -2
- package/dist/schema/modules/group/functions/provision-group.js +14 -0
- package/dist/schema/modules/group/functions/unassign-member.js +17 -0
- package/dist/schema/modules/group/functions/update-group.js +20 -0
- package/dist/schema/modules/group/index.d.ts +3 -3
- package/dist/schema/modules/group/index.js +4 -3
- package/dist/schema/modules/group/legacy/admission.d.ts +9 -0
- package/dist/schema/modules/group/legacy/admission.js +9 -0
- package/dist/schema/modules/group/legacy/classes/index.d.ts +1 -0
- package/dist/schema/modules/group/legacy/classes/index.js +1 -0
- package/dist/schema/modules/group/{classes → legacy/classes}/member-of-group.d.ts +10 -1
- package/dist/schema/modules/group/legacy/classes/member-of-group.js +32 -0
- package/dist/schema/modules/group/legacy/core-groups.d.ts +22 -0
- package/dist/schema/modules/group/legacy/core-groups.js +28 -0
- package/dist/schema/modules/group/legacy/index.d.ts +5 -0
- package/dist/schema/modules/group/legacy/index.js +6 -0
- package/dist/schema/modules/group/legacy/policies/belongs-to-group.d.ts +5 -0
- package/dist/schema/modules/group/legacy/policies/belongs-to-group.js +9 -0
- package/dist/schema/modules/group/legacy/policies/index.d.ts +2 -0
- package/dist/schema/modules/group/legacy/policies/index.js +2 -0
- package/dist/schema/modules/group/legacy/policies/owns-membership-group.d.ts +6 -0
- package/dist/schema/modules/group/legacy/policies/owns-membership-group.js +12 -0
- package/dist/schema/modules/group/legacy/relaxations.d.ts +21 -0
- package/dist/schema/modules/group/legacy/relaxations.js +27 -0
- package/dist/schema/modules/group/policies/describes-group-of-subject.d.ts +2 -0
- package/dist/schema/modules/group/policies/describes-group-of-subject.js +7 -0
- package/dist/schema/modules/group/policies/index.d.ts +2 -1
- package/dist/schema/modules/group/policies/index.js +2 -1
- package/dist/schema/modules/group/policies/is-group-profile-source.d.ts +2 -0
- package/dist/schema/modules/group/policies/is-group-profile-source.js +6 -0
- package/dist/schema/modules/group/types/group.js +10 -0
- package/dist/schema/modules/group/types/index.js +1 -0
- package/dist/schema/modules/invitation/classes/index.js +2 -0
- package/dist/schema/modules/invitation/classes/invitation-user.js +17 -0
- package/dist/schema/modules/invitation/classes/invitation.js +30 -0
- package/dist/schema/modules/invitation/functions/accept.js +16 -0
- package/dist/schema/modules/invitation/functions/cancel.js +12 -0
- package/dist/schema/modules/invitation/functions/index.js +4 -0
- package/dist/schema/modules/invitation/functions/resend.js +12 -0
- package/dist/schema/modules/invitation/functions/send.js +20 -0
- package/dist/schema/modules/invitation/index.js +2 -0
- package/dist/schema/modules/invitation/types/index.js +1 -0
- package/dist/schema/modules/invitation/types/invitation-status.js +5 -0
- package/dist/schema/modules/namespace/classes/alias.d.ts +2 -1
- package/dist/schema/modules/namespace/classes/alias.js +11 -2
- package/dist/schema/modules/namespace/functions/link.js +3 -2
- package/dist/schema/modules/namespace/functions/rename.js +3 -2
- package/dist/schema/modules/namespace/functions/unlink.js +3 -2
- package/dist/schema/modules/role/classes/index.d.ts +1 -0
- package/dist/schema/modules/role/classes/index.js +1 -0
- package/dist/schema/modules/role/classes/role.d.ts +16 -0
- package/dist/schema/modules/role/classes/role.js +19 -0
- package/dist/schema/modules/role/core/index.d.ts +1 -0
- package/dist/schema/modules/role/core/index.js +1 -0
- package/dist/schema/modules/role/core/roles.d.ts +37 -0
- package/dist/schema/modules/role/core/roles.js +30 -0
- package/dist/schema/modules/role/index.d.ts +2 -0
- package/dist/schema/modules/role/index.js +2 -0
- package/dist/schema/modules/user/classes/index.d.ts +2 -0
- package/dist/schema/modules/user/classes/index.js +3 -0
- package/dist/schema/modules/user/classes/user-profile-link.d.ts +35 -0
- package/dist/schema/modules/user/classes/user-profile-link.js +22 -0
- package/dist/schema/modules/user/classes/user-profile.d.ts +41 -0
- package/dist/schema/modules/user/classes/user-profile.js +30 -0
- package/dist/schema/modules/user/classes/user.d.ts +133 -8
- package/dist/schema/modules/user/classes/user.js +46 -15
- package/dist/schema/modules/user/functions/create-user.js +21 -0
- package/dist/schema/modules/user/functions/deactivate-user.js +12 -0
- package/dist/schema/modules/user/functions/delete-user.js +12 -0
- package/dist/schema/modules/user/functions/deprovision-user.js +14 -0
- package/dist/schema/modules/user/functions/index.js +8 -1
- package/dist/schema/modules/user/functions/invite-user.js +23 -4
- package/dist/schema/modules/user/functions/provision-user.js +25 -0
- package/dist/schema/modules/user/functions/reactivate-user.js +12 -0
- package/dist/schema/modules/user/functions/update-profile.js +16 -0
- package/dist/schema/modules/user/functions/update-user.js +22 -0
- package/dist/schema/modules/user/index.d.ts +2 -1
- package/dist/schema/modules/user/index.js +2 -1
- package/dist/schema/modules/user/legacy/account-properties.js +24 -0
- package/dist/schema/modules/user/legacy/functions/index.js +2 -0
- package/dist/schema/modules/user/legacy/functions/migrate-accounts.js +23 -0
- package/dist/schema/modules/user/legacy/functions/record-profile.js +18 -0
- package/dist/schema/modules/user/legacy/index.js +5 -0
- package/dist/schema/modules/user/legacy/invite.js +15 -0
- package/dist/schema/modules/user/legacy/relaxations.js +37 -0
- package/dist/schema/modules/user/policies/describes-subject.d.ts +2 -0
- package/dist/schema/modules/user/policies/describes-subject.js +7 -0
- package/dist/schema/modules/user/policies/index.d.ts +2 -0
- package/dist/schema/modules/user/policies/index.js +2 -0
- package/dist/schema/modules/user/policies/is-profile-source.d.ts +2 -0
- package/dist/schema/modules/user/policies/is-profile-source.js +6 -0
- package/dist/schema/modules/user/types/account.d.ts +12 -0
- package/dist/schema/modules/user/types/account.js +12 -0
- package/dist/schema/modules/user/types/index.d.ts +1 -1
- package/dist/schema/modules/user/types/index.js +1 -1
- package/dist/schema/modules/view-access/classes/view-access.d.ts +7 -11
- package/dist/schema/modules/view-access/classes/view-access.js +17 -12
- package/dist/schema/modules/view-access/index.d.ts +1 -2
- package/dist/schema/modules/view-access/index.js +1 -2
- package/dist/schema/modules/view-access/legacy/functions/assign-views.js +22 -0
- package/dist/schema/modules/view-access/legacy/functions/index.js +1 -0
- package/dist/schema/modules/view-access/legacy/index.js +2 -0
- package/dist/schema/modules/view-access/legacy/view-assignment.js +24 -0
- package/dist/schema/modules/view-access/policies/holds-view-access.d.ts +2 -0
- package/dist/schema/modules/view-access/policies/holds-view-access.js +5 -0
- package/dist/schema/modules/view-access/policies/index.d.ts +1 -0
- package/dist/schema/modules/view-access/policies/index.js +1 -0
- package/dist/schema/policies/has-role.d.ts +6 -0
- package/dist/schema/policies/has-role.js +9 -0
- package/dist/schema/policies/index.d.ts +1 -0
- package/dist/schema/policies/index.js +1 -4
- package/dist/schema/policies/legacy/administers-shell-class.js +21 -0
- package/dist/schema/policies/legacy/index.js +4 -0
- package/dist/schema/policies/legacy/is-self.js +9 -0
- package/dist/schema/policies/legacy/owns-class.js +12 -0
- package/dist/schema/policies/legacy/uses-function.js +9 -0
- package/dist/schema/schema.d.ts +1849 -118
- package/dist/schema/schema.js +35 -15
- package/dist/schema/types/attributes.js +15 -0
- package/dist/schema/types/index.js +1 -0
- package/dist/utils/attributes/attributes.js +12 -0
- package/dist/utils/attributes/index.js +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/same-json/index.js +1 -0
- package/dist/utils/same-json/same-json.js +9 -0
- package/package.json +3 -3
- package/dist/functions/application/list-entrypoints.js +0 -6
- package/dist/functions/user/record-profile.js +0 -18
- package/dist/mutations/user/index.js +0 -1
- package/dist/queries/application/index.js +0 -1
- package/dist/queries/application/read-installed-entrypoints.js +0 -28
- package/dist/queries/user/index.js +0 -1
- package/dist/queries/user/read-user-profile.js +0 -9
- package/dist/schema/modules/application/functions/index.d.ts +0 -1
- package/dist/schema/modules/application/functions/index.js +0 -1
- package/dist/schema/modules/application/functions/list-entrypoints.d.ts +0 -15
- package/dist/schema/modules/application/functions/list-entrypoints.js +0 -16
- package/dist/schema/modules/application/index.d.ts +0 -2
- package/dist/schema/modules/application/index.js +0 -2
- package/dist/schema/modules/application/types/entrypoint-entry.d.ts +0 -8
- package/dist/schema/modules/application/types/entrypoint-entry.js +0 -7
- package/dist/schema/modules/application/types/index.d.ts +0 -1
- package/dist/schema/modules/application/types/index.js +0 -1
- package/dist/schema/modules/group/classes/member-of-group.js +0 -12
- package/dist/schema/modules/group/core/administrators-group.d.ts +0 -1
- package/dist/schema/modules/group/core/administrators-group.js +0 -6
- package/dist/schema/modules/group/core/applications-group.d.ts +0 -1
- package/dist/schema/modules/group/core/applications-group.js +0 -6
- package/dist/schema/modules/group/core/index.d.ts +0 -3
- package/dist/schema/modules/group/core/index.js +0 -3
- package/dist/schema/modules/group/core/members-group.d.ts +0 -1
- package/dist/schema/modules/group/core/members-group.js +0 -6
- package/dist/schema/modules/group/functions/assign-member-to-group.js +0 -11
- package/dist/schema/modules/group/functions/unassign-member-from-group.js +0 -11
- package/dist/schema/modules/group/policies/belongs-to-group.d.ts +0 -1
- package/dist/schema/modules/group/policies/belongs-to-group.js +0 -5
- package/dist/schema/modules/user/functions/record-profile.js +0 -14
- package/dist/schema/modules/user/types/user-profile.d.ts +0 -7
- package/dist/schema/modules/user/types/user-profile.js +0 -7
- package/dist/schema/modules/view-access/core/index.d.ts +0 -1
- package/dist/schema/modules/view-access/core/index.js +0 -1
- package/dist/schema/modules/view-access/core/view-only-group.d.ts +0 -5
- package/dist/schema/modules/view-access/core/view-only-group.js +0 -10
- package/dist/schema/modules/view-access/functions/assign-views.d.ts +0 -16
- package/dist/schema/modules/view-access/functions/assign-views.js +0 -17
- package/dist/schema/modules/view-access/functions/index.d.ts +0 -1
- package/dist/schema/modules/view-access/functions/index.js +0 -1
- package/dist/schema/modules/view-access/types/index.js +0 -1
- package/dist/schema/modules/view-access/types/view-assignment.js +0 -16
- package/dist/schema/policies/administers-shell-class.js +0 -11
- package/dist/schema/policies/is-self.js +0 -5
- package/dist/schema/policies/owns-class.js +0 -7
- package/dist/schema/policies/uses-function.js +0 -5
- /package/dist/functions/group/{assign-member-to-group.js → assign-member.js} +0 -0
- /package/dist/functions/group/{unassign-member-from-group.js → unassign-member.js} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Correlation key of an Admin-reserved account, `email` and `name` of a self-recorded
|
|
4
|
+
* profile (L-SHELL-4). Replaced by `email` (unique) and `name`, which `legacyMigrateAccounts` copies.
|
|
5
|
+
* Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
6
|
+
*/
|
|
7
|
+
export const legacyAccountProperties = {
|
|
8
|
+
// Correlation for Admin-owned creation; never an authentication credential.
|
|
9
|
+
creationKey: z.string().min(1).max(512).optional(),
|
|
10
|
+
// Named apart from any profile a Domain extending User declares (`email`, `displayName`…).
|
|
11
|
+
claimedEmail: z.string().min(3).max(320).optional(),
|
|
12
|
+
claimedName: z.string().min(1).max(200).optional(),
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated The account state before `frozen` was written directly (U2): `suspended` (local
|
|
16
|
+
* deactivation) and `directoryActive` (the directory's state). Shell no longer writes or reads them;
|
|
17
|
+
* they stay declared, optional, so stored accounts that hold them remain valid (L-SHELL-17).
|
|
18
|
+
* Replaced by `frozen` alone, which U2 already wrote beside them. Removal: Shell major (delivery
|
|
19
|
+
* step 5), in the Kernel repair session that erases them from stored accounts.
|
|
20
|
+
*/
|
|
21
|
+
export const legacyAccountStateProperties = {
|
|
22
|
+
suspended: z.boolean().optional(),
|
|
23
|
+
directoryActive: z.boolean().optional(),
|
|
24
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { func } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { profileRoles } from '../../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../../policies/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Copy each account's `claimedEmail` to `email` and `claimedName` to `name`, so the
|
|
7
|
+
* Shell major can require them, and give every account and group its profile; running it again
|
|
8
|
+
* changes nothing
|
|
9
|
+
* (L-SHELL-14). Replaced by nothing: accounts are born with them. Removal: Shell major (delivery
|
|
10
|
+
* step 5) after 1Pact step 4, once every instance has run it.
|
|
11
|
+
*/
|
|
12
|
+
export const legacyMigrateAccounts = func({
|
|
13
|
+
description: 'Write email, name and profiles on accounts and groups created before them.',
|
|
14
|
+
auth: 'authorized',
|
|
15
|
+
input: z.strictObject({}),
|
|
16
|
+
output: z.object({
|
|
17
|
+
migrated: z.number().int().min(0),
|
|
18
|
+
conflicts: z.array(z.object({ user: z.string(), email: z.string() })),
|
|
19
|
+
/** The profiles created for accounts and groups stored before profiles. */
|
|
20
|
+
profiles: z.number().int().min(0),
|
|
21
|
+
}),
|
|
22
|
+
policy: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
23
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { legacyIsSelf } from '../../../../policies/legacy/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated The email and display name an account records about itself at each sign-in
|
|
6
|
+
* (L-SHELL-5). Replaced by `User.updateProfile`, called by the holder from its profile. Removal:
|
|
7
|
+
* Shell major (delivery step 5) after 1Pact step 4.
|
|
8
|
+
*/
|
|
9
|
+
export const legacyRecordProfile = method({
|
|
10
|
+
description: 'Record the email and display name this account signs in with; only the account itself may.',
|
|
11
|
+
auth: 'authorized',
|
|
12
|
+
input: z.strictObject({
|
|
13
|
+
email: z.string().min(3).max(320).optional(),
|
|
14
|
+
displayName: z.string().min(1).max(200).optional(),
|
|
15
|
+
}),
|
|
16
|
+
output: z.object({}),
|
|
17
|
+
policy: ({ check, self }) => check(legacyIsSelf, self),
|
|
18
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Relaxations first: User reads them while the rest of this folder may still be loading.
|
|
2
|
+
export { LEGACY_ACCOUNT_PROPERTIES_OPTIONAL, LEGACY_USER_EXTENDS, LEGACY_USER_INHERITANCE, LEGACY_USER_READ, legacyUserName, } from './relaxations.js';
|
|
3
|
+
export { legacyAccountProperties, legacyAccountStateProperties } from './account-properties.js';
|
|
4
|
+
export { legacyInviteFields, legacyInviteOwnerAdmission } from './invite.js';
|
|
5
|
+
export { legacyMigrateAccounts, legacyRecordProfile } from './functions/index.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { legacyOwnsClass } from '../../../policies/legacy/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated The `{ user, email }` invitation of callers older than profiles: the email is the
|
|
5
|
+
* caller's, and no profile is granted (L-SHELL-6). Replaced by `User.invite({ user, profile })`,
|
|
6
|
+
* which reads the account's email. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
7
|
+
*/
|
|
8
|
+
export const legacyInviteFields = { email: z.string().min(3).max(320).optional() };
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated The owner of a User subclass invites its accounts (L-SHELL-9). Replaced by
|
|
11
|
+
* `user.writer` in the Domain's release. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
12
|
+
*/
|
|
13
|
+
export function legacyInviteOwnerAdmission(context, user) {
|
|
14
|
+
return context.check(legacyOwnsClass, user);
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { K, property } from '@astrale-os/sdk/schema';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Domains still extend User (L-SHELL-1). Replaced by `'final'`. Removal: Shell major
|
|
4
|
+
* (delivery step 5) after 1Pact step 4.
|
|
5
|
+
*/
|
|
6
|
+
export const LEGACY_USER_INHERITANCE = 'open';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated User omits Kernel Named and Timestamped while stored accounts lack their required
|
|
9
|
+
* `name`, `createdAt` and `updatedAt`, which the Kernel refuses to add over existing data
|
|
10
|
+
* (DATA_MIGRATION_REQUIRED) (L-SHELL-2). Replaced by
|
|
11
|
+
* `[K.classes.Identity, K.classes.Named, K.classes.Iconable, K.classes.Timestamped]`. Removal: Shell
|
|
12
|
+
* major (delivery step 5) after 1Pact step 4, in the Kernel repair session that writes those values.
|
|
13
|
+
*/
|
|
14
|
+
export const LEGACY_USER_EXTENDS = [K.classes.Identity, K.classes.Iconable];
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated The account's name as a User Property, optional, until User extends Kernel Named
|
|
17
|
+
* (L-SHELL-2). Replaced by `K.classes.Named.properties.name`. Removal: Shell major (delivery step 5)
|
|
18
|
+
* after 1Pact step 4.
|
|
19
|
+
*/
|
|
20
|
+
export const legacyUserName = property({ type: 'string', minLength: 1, maxLength: 100 }, { required: false });
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Properties the target requires stay optional until `legacyMigrateAccounts` has
|
|
23
|
+
* written them on every stored account (L-SHELL-3). Replaced by `{ required: true }`. Removal: Shell
|
|
24
|
+
* major (delivery step 5) after 1Pact step 4.
|
|
25
|
+
*/
|
|
26
|
+
export const LEGACY_ACCOUNT_PROPERTIES_OPTIONAL = { required: false };
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated User keeps the read rule and the absence of unique constraints of the Shell that
|
|
29
|
+
* released Domains embed (L-SHELL-19): the Kernel binds a Domain built against that Shell only
|
|
30
|
+
* while `/policies/read` and `/unique` of the Classes it extends stay as they were
|
|
31
|
+
* (SCHEMA_DEPENDENCY_INCOMPATIBLE otherwise). Every identity reads accounts; members read the same
|
|
32
|
+
* names and emails on profiles anyway. An email stays unique through `UserProfile.email` and the
|
|
33
|
+
* lookups of `User.create`, `User.update` and `User.provision`. Replaced by `read: anyOf(user.reader,
|
|
34
|
+
* self)` and `unique: [['email'], ['directory', 'externalId']]`. Removal: Shell major (delivery
|
|
35
|
+
* step 5), once immogrc, 1Pact and organization are rebuilt against this Shell.
|
|
36
|
+
*/
|
|
37
|
+
export const LEGACY_USER_READ = true;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { user_profile } from '../classes/user-profile-link.js';
|
|
3
|
+
/** The subject is the account this profile describes. */
|
|
4
|
+
export const describesSubject = policy({
|
|
5
|
+
description: 'The caller is the account this profile describes.',
|
|
6
|
+
match: ({ edge, object, subject }) => edge({ source: subject, class: user_profile, target: object }),
|
|
7
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
/** The subject is the account at the source of this Edge: a person finds its own profile. */
|
|
3
|
+
export const isProfileSource = policy({
|
|
4
|
+
description: 'The caller is the account this Edge leaves.',
|
|
5
|
+
match: ({ sameNode, subject, source }) => sameNode(subject, source),
|
|
6
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** An email as a caller writes it; the method trims it, lower-cases it and checks its shape. */
|
|
3
|
+
export declare const accountEmailInput: z.ZodString;
|
|
4
|
+
/** A displayed name, a given name or a family name. */
|
|
5
|
+
export declare const personName: z.ZodString;
|
|
6
|
+
/** A Kernel Iconable icon; `null` removes it. */
|
|
7
|
+
export declare const accountIcon: z.ZodNullable<z.ZodString>;
|
|
8
|
+
/** The WorkOS id of a directory and the id of an account or a group in it. */
|
|
9
|
+
export declare const directoryId: z.ZodString;
|
|
10
|
+
export declare const externalId: z.ZodString;
|
|
11
|
+
/** A Node as a method returns it: its canonical `@<NodeId>` path. */
|
|
12
|
+
export declare const nodeReference: z.ZodString;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** An email as a caller writes it; the method trims it, lower-cases it and checks its shape. */
|
|
3
|
+
export const accountEmailInput = z.string().min(3).max(320);
|
|
4
|
+
/** A displayed name, a given name or a family name. */
|
|
5
|
+
export const personName = z.string().min(1).max(100);
|
|
6
|
+
/** A Kernel Iconable icon; `null` removes it. */
|
|
7
|
+
export const accountIcon = z.string().min(1).max(8_000).nullable();
|
|
8
|
+
/** The WorkOS id of a directory and the id of an account or a group in it. */
|
|
9
|
+
export const directoryId = z.string().min(1).max(200);
|
|
10
|
+
export const externalId = z.string().min(1).max(200);
|
|
11
|
+
/** A Node as a method returns it: its canonical `@<NodeId>` path. */
|
|
12
|
+
export const nodeReference = z.string().min(2).max(512);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { invitationSummary, type InvitationSummary } from './invitation-summary.js';
|
|
2
|
-
export {
|
|
2
|
+
export { accountEmailInput, accountIcon, directoryId, externalId, nodeReference, personName, } from './account.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { invitationSummary } from './invitation-summary.js';
|
|
2
|
-
export {
|
|
2
|
+
export { accountEmailInput, accountIcon, directoryId, externalId, nodeReference, personName, } from './account.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* A View an Identity lands on without `member`: an account, a group or a Role, and each of their
|
|
3
|
+
* members. It decides navigation, never data: the View's own Domain still guards everything it
|
|
4
|
+
* shows (V1). Only an admin writes it; an admin or its holders read it. Each end detaches with its
|
|
5
|
+
* Node.
|
|
6
6
|
*/
|
|
7
7
|
export declare const view_access: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
|
|
8
8
|
readonly depth: 0;
|
|
@@ -10,13 +10,9 @@ export declare const view_access: import("@astrale-os/sdk/schema").DirectedEdgeC
|
|
|
10
10
|
readonly extends: readonly [];
|
|
11
11
|
readonly properties: never;
|
|
12
12
|
readonly source: {
|
|
13
|
-
readonly as: "
|
|
14
|
-
readonly accepts: readonly (()
|
|
15
|
-
readonly
|
|
16
|
-
readonly abstract: never;
|
|
17
|
-
readonly depth: never;
|
|
18
|
-
readonly properties: never;
|
|
19
|
-
readonly methods: never;
|
|
13
|
+
readonly as: "audience";
|
|
14
|
+
readonly accepts: readonly (import("@astrale-os/sdk/schema").ClassRef<"Identity"> & {
|
|
15
|
+
readonly origin: "kernel.astrale.ai";
|
|
20
16
|
})[];
|
|
21
17
|
readonly outgoing: "0..*";
|
|
22
18
|
};
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { K, edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { profileRoles } from '../../role/index.js';
|
|
3
|
+
import { hasRole } from '../../../policies/index.js';
|
|
4
|
+
import { holdsViewAccess } from '../policies/index.js';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* A View an Identity lands on without `member`: an account, a group or a Role, and each of their
|
|
7
|
+
* members. It decides navigation, never data: the View's own Domain still guards everything it
|
|
8
|
+
* shows (V1). Only an admin writes it; an admin or its holders read it. Each end detaches with its
|
|
9
|
+
* Node.
|
|
9
10
|
*/
|
|
10
11
|
export const view_access = edgeClass.directed({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
inheritance: 'final',
|
|
13
|
+
abstract: false,
|
|
14
|
+
description: 'A View this Identity lands on without member.',
|
|
15
|
+
source: { as: 'audience', accepts: [K.classes.Identity], outgoing: '0..*', onDelete: 'detach' },
|
|
16
|
+
target: { as: 'view', accepts: [K.classes.View], incoming: '0..*', onDelete: 'detach' },
|
|
17
|
+
policies: {
|
|
18
|
+
read: ({ anyOf, check, ref, self }) => anyOf(check(hasRole, ref(profileRoles['workspace.admin'])), check(holdsViewAccess, self)),
|
|
19
|
+
traverse: true,
|
|
20
|
+
create: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
21
|
+
delete: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
16
22
|
},
|
|
17
|
-
target: { as: 'view', accepts: [K.classes.View], incoming: '0..*' },
|
|
18
23
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { func } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { profileRoles } from '../../../role/index.js';
|
|
4
|
+
import { hasRole } from '../../../../policies/index.js';
|
|
5
|
+
import { LEGACY_MAX_ASSIGNMENTS, legacyViewAssignment } from '../view-assignment.js';
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Give and withdraw Views for each identity, in one write (L-SHELL-12). Replaced by a
|
|
8
|
+
* Mutation on `view_access`, which only `workspace.admin` holders may write. Removal: Shell major
|
|
9
|
+
* (delivery step 5) after 1Pact step 4.
|
|
10
|
+
*
|
|
11
|
+
* Its legacy `can_use` holders, the Administrators group, hold `workspace.admin` through the release
|
|
12
|
+
* (AM5), which now admits them.
|
|
13
|
+
*/
|
|
14
|
+
export const legacyAssignViews = func({
|
|
15
|
+
description: 'Give and withdraw Views for each identity, in one write.',
|
|
16
|
+
auth: 'authorized',
|
|
17
|
+
input: z.strictObject({
|
|
18
|
+
assignments: z.array(legacyViewAssignment).min(1).max(LEGACY_MAX_ASSIGNMENTS),
|
|
19
|
+
}),
|
|
20
|
+
output: z.object({}),
|
|
21
|
+
policy: ({ check, ref }) => check(hasRole, ref(profileRoles['workspace.admin'])),
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { legacyAssignViews } from './assign-views.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Bounds of one `assignViews` call within the Kernel's Mutation limits (L-SHELL-12).
|
|
4
|
+
* Replaced by a Mutation on `view_access`. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
5
|
+
*/
|
|
6
|
+
export const LEGACY_MAX_ASSIGNED_VIEWS = 20;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated At most 40 identities in one `assignViews` call (L-SHELL-12). Replaced by a Mutation
|
|
9
|
+
* on `view_access`. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
10
|
+
*/
|
|
11
|
+
export const LEGACY_MAX_ASSIGNMENTS = 40;
|
|
12
|
+
// A Path inside a list is not a callable Path input: each is an exact @NodeId the Action checks.
|
|
13
|
+
const nodeId = z.string().min(2).max(512);
|
|
14
|
+
const views = z.array(nodeId).max(LEGACY_MAX_ASSIGNED_VIEWS);
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated The Views given to one identity (`set`) and withdrawn from it (`unset`), by @NodeId
|
|
17
|
+
* (L-SHELL-12). Replaced by a Mutation on `view_access`. Removal: Shell major (delivery step 5)
|
|
18
|
+
* after 1Pact step 4.
|
|
19
|
+
*/
|
|
20
|
+
export const legacyViewAssignment = z.strictObject({
|
|
21
|
+
identity: nodeId,
|
|
22
|
+
set: views.optional(),
|
|
23
|
+
unset: views.optional(),
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { holdsViewAccess } from './holds-view-access.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { holdsViewAccess } from './holds-view-access.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The subject holds the object Role: it is that Role, or extends it through its live composition,
|
|
3
|
+
* at any depth. This is the Kernel `hasRole` meaning; a Domain checks only Policies it declares, so
|
|
4
|
+
* each Domain declares its own and tests a Role with `check(hasRole, ref(role))` (AM2).
|
|
5
|
+
*/
|
|
6
|
+
export declare const hasRole: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
/**
|
|
3
|
+
* The subject holds the object Role: it is that Role, or extends it through its live composition,
|
|
4
|
+
* at any depth. This is the Kernel `hasRole` meaning; a Domain checks only Policies it declares, so
|
|
5
|
+
* each Domain declares its own and tests a Role with `check(hasRole, ref(role))` (AM2).
|
|
6
|
+
*/
|
|
7
|
+
export const hasRole = policy({
|
|
8
|
+
match: ({ sameNode, subject, object }) => sameNode(subject, object),
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { hasRole } from './has-role.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { K, policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Group } from '../../modules/group/index.js';
|
|
3
|
+
import { legacyAdministratorsGroup } from '../../modules/group/legacy/index.js';
|
|
4
|
+
import { legacyMemberOfGroup } from '../../modules/group/legacy/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Membership of the legacy Administrators group on a Shell-owned concrete Class
|
|
7
|
+
* (L-SHELL-10). Replaced by `check(hasRole, ref(S.core.nodes['workspace.admin']))`. Removal: Shell
|
|
8
|
+
* major (delivery step 5) after 1Pact step 4.
|
|
9
|
+
*/
|
|
10
|
+
export const legacyAdministersShellClass = policy({
|
|
11
|
+
match: ({ exists, subject, object, ref, edge, allOf }) => exists(({ node }) => {
|
|
12
|
+
const concrete = node();
|
|
13
|
+
const owner = node(); // of_domain restricts this witness to a protected Domain endpoint.
|
|
14
|
+
const group = ref(() => Group);
|
|
15
|
+
return allOf(edge({
|
|
16
|
+
source: subject,
|
|
17
|
+
class: () => legacyMemberOfGroup,
|
|
18
|
+
target: ref(legacyAdministratorsGroup),
|
|
19
|
+
}), { source: ref(legacyAdministratorsGroup), class: K.classes.instance_of.ref, target: group }, { source: group, class: K.classes.of_domain.ref, target: owner }, { source: concrete, class: K.classes.of_domain.ref, target: owner }, { source: object, class: K.classes.instance_of.ref, target: concrete });
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated The subject is the object itself, the admission of `User.recordProfile`
|
|
4
|
+
* (L-SHELL-10). Replaced by `check(hasRole, self)`, which reads the same. Removal: Shell major
|
|
5
|
+
* (delivery step 5) after 1Pact step 4.
|
|
6
|
+
*/
|
|
7
|
+
export const legacyIsSelf = policy({
|
|
8
|
+
match: ({ sameNode, subject, object }) => sameNode(subject, object),
|
|
9
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { K, policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Ownership of the object's concrete Class, the admission of a Domain that extends
|
|
4
|
+
* Shell's User or Group (L-SHELL-10). Replaced by `hasRole` on the Shell Roles: User and Group become
|
|
5
|
+
* final. Removal: Shell major (delivery step 5) after 1Pact step 4.
|
|
6
|
+
*/
|
|
7
|
+
export const legacyOwnsClass = policy({
|
|
8
|
+
match: ({ exists, subject, object, allOf }) => exists(({ node }) => {
|
|
9
|
+
const concrete = node(); // Bounded by the two protected Kernel Edges.
|
|
10
|
+
return allOf({ source: object, class: K.classes.instance_of.ref, target: concrete }, { source: concrete, class: K.classes.of_domain.ref, target: subject });
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { K, policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated The subject holds the legacy `can_use` capability on the object Function
|
|
4
|
+
* (L-SHELL-10). Replaced by `hasRole` on a Shell Role. Removal: Shell major (delivery step 5) after
|
|
5
|
+
* 1Pact step 4.
|
|
6
|
+
*/
|
|
7
|
+
export const legacyUsesFunction = policy({
|
|
8
|
+
match: ({ edge, subject, object }) => edge({ source: subject, class: () => K.classes.can_use, target: object }),
|
|
9
|
+
});
|