@grantjs/schema 1.1.7 → 1.2.0

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 (48) hide show
  1. package/package.json +1 -1
  2. package/src/generated/graphql.ts +1617 -126
  3. package/src/generated/resolvers.ts +495 -0
  4. package/src/generated/schema-types.ts +258 -0
  5. package/src/index.ts +2 -0
  6. package/src/operations/groups/getGroupsList.graphql +38 -0
  7. package/src/operations/groups/updateGroup.graphql +6 -0
  8. package/src/operations/me/me.graphql +4 -0
  9. package/src/operations/permissions/getPermissionsList.graphql +45 -0
  10. package/src/operations/permissions/updatePermission.graphql +6 -0
  11. package/src/operations/resources/updateResource.graphql +6 -0
  12. package/src/operations/role-permissions/role-permissions.graphql +39 -0
  13. package/src/operations/roles/getRoles.graphql +12 -0
  14. package/src/operations/roles/getRolesList.graphql +38 -0
  15. package/src/operations/roles/updateRole.graphql +6 -0
  16. package/src/operations/user-permissions/user-permissions.graphql +39 -0
  17. package/src/operations/users/getUsers.graphql +26 -0
  18. package/src/operations/users/getUsersList.graphql +43 -0
  19. package/src/operations/users/updateUser.graphql +6 -0
  20. package/src/schema/auth/inputs/is-authorized.graphql +7 -0
  21. package/src/schema/auth/queries/is-authorized.graphql +3 -0
  22. package/src/schema/groups/types/group.graphql +3 -0
  23. package/src/schema/permissions/types/permission.graphql +2 -0
  24. package/src/schema/project-role-permissions/types/project-role-permission.graphql +27 -0
  25. package/src/schema/project-user-groups/types/project-user-group.graphql +27 -0
  26. package/src/schema/project-user-permissions/types/project-user-permission.graphql +27 -0
  27. package/src/schema/projects/inputs/sync-project-cdm.graphql +17 -0
  28. package/src/schema/role-permissions/inputs/assign-role-permission.graphql +5 -0
  29. package/src/schema/role-permissions/inputs/query-role-permissions.graphql +4 -0
  30. package/src/schema/role-permissions/inputs/revoke-role-permission.graphql +6 -0
  31. package/src/schema/role-permissions/mutations/assign-role-permission.graphql +3 -0
  32. package/src/schema/role-permissions/mutations/revoke-role-permission.graphql +3 -0
  33. package/src/schema/role-permissions/types/role-permission.graphql +10 -0
  34. package/src/schema/roles/inputs/create-role.graphql +1 -0
  35. package/src/schema/roles/types/role.graphql +5 -0
  36. package/src/schema/user-groups/inputs/add-user-group.graphql +4 -0
  37. package/src/schema/user-groups/inputs/query-user-groups.graphql +4 -0
  38. package/src/schema/user-groups/inputs/remove-user-group.graphql +4 -0
  39. package/src/schema/user-groups/types/user-group.graphql +10 -0
  40. package/src/schema/user-permissions/inputs/assign-user-permission.graphql +5 -0
  41. package/src/schema/user-permissions/inputs/query-user-permissions.graphql +4 -0
  42. package/src/schema/user-permissions/inputs/revoke-user-permission.graphql +6 -0
  43. package/src/schema/user-permissions/mutations/assign-user-permission.graphql +3 -0
  44. package/src/schema/user-permissions/mutations/revoke-user-permission.graphql +3 -0
  45. package/src/schema/user-permissions/types/user-permission.graphql +10 -0
  46. package/src/schema/users/inputs/create-user.graphql +2 -0
  47. package/src/schema/users/inputs/update-user.graphql +1 -0
  48. package/src/schema/users/types/user.graphql +7 -0
@@ -33,6 +33,18 @@ query GetRoles(
33
33
  isPrimary
34
34
  }
35
35
  }
36
+ rolePermissions {
37
+ id
38
+ permissionId
39
+ permission(scope: $scope) {
40
+ id
41
+ name
42
+ action
43
+ resource {
44
+ slug
45
+ }
46
+ }
47
+ }
36
48
  tags {
37
49
  id
38
50
  name
@@ -0,0 +1,38 @@
1
+ query GetRolesList(
2
+ $scope: Scope!
3
+ $page: Int
4
+ $limit: Int
5
+ $sort: RoleSortInput
6
+ $search: String
7
+ $ids: [ID!]
8
+ $tagIds: [ID!]
9
+ ) {
10
+ roles(
11
+ scope: $scope
12
+ page: $page
13
+ limit: $limit
14
+ sort: $sort
15
+ search: $search
16
+ ids: $ids
17
+ tagIds: $tagIds
18
+ ) {
19
+ roles {
20
+ id
21
+ name
22
+ description
23
+ metadata
24
+ createdAt
25
+ updatedAt
26
+ primaryTag {
27
+ id
28
+ name
29
+ color
30
+ isPrimary
31
+ }
32
+ groupCount
33
+ tagCount
34
+ }
35
+ totalCount
36
+ hasNextPage
37
+ }
38
+ }
@@ -6,5 +6,11 @@ mutation UpdateRole($id: ID!, $input: UpdateRoleInput!) {
6
6
  metadata
7
7
  createdAt
8
8
  updatedAt
9
+ tags {
10
+ id
11
+ name
12
+ color
13
+ isPrimary
14
+ }
9
15
  }
10
16
  }
@@ -0,0 +1,39 @@
1
+ mutation AssignUserPermission($input: AssignUserPermissionInput!) {
2
+ assignUserPermission(input: $input) {
3
+ id
4
+ userId
5
+ permissionId
6
+ createdAt
7
+ updatedAt
8
+ }
9
+ }
10
+
11
+ mutation RevokeUserPermission($input: RevokeUserPermissionInput!) {
12
+ revokeUserPermission(input: $input) {
13
+ id
14
+ userId
15
+ permissionId
16
+ deletedAt
17
+ }
18
+ }
19
+
20
+ query GetUserDirectPermissions($scope: Scope!, $userId: ID!) {
21
+ users(scope: $scope, ids: [$userId], limit: 1) {
22
+ users {
23
+ id
24
+ permissionCount
25
+ userPermissions {
26
+ id
27
+ permissionId
28
+ permission(scope: $scope) {
29
+ id
30
+ name
31
+ action
32
+ resource {
33
+ slug
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
@@ -33,6 +33,32 @@ query GetUsers(
33
33
  isPrimary
34
34
  }
35
35
  }
36
+ userGroups {
37
+ id
38
+ groupId
39
+ group(scope: $scope) {
40
+ id
41
+ name
42
+ tags {
43
+ id
44
+ name
45
+ color
46
+ isPrimary
47
+ }
48
+ }
49
+ }
50
+ userPermissions {
51
+ id
52
+ permissionId
53
+ permission(scope: $scope) {
54
+ id
55
+ name
56
+ action
57
+ resource {
58
+ slug
59
+ }
60
+ }
61
+ }
36
62
  tags {
37
63
  id
38
64
  name
@@ -0,0 +1,43 @@
1
+ query GetUsersList(
2
+ $scope: Scope!
3
+ $page: Int
4
+ $limit: Int
5
+ $sort: UserSortInput
6
+ $search: String
7
+ $ids: [ID!]
8
+ $tagIds: [ID!]
9
+ ) {
10
+ users(
11
+ scope: $scope
12
+ page: $page
13
+ limit: $limit
14
+ sort: $sort
15
+ search: $search
16
+ ids: $ids
17
+ tagIds: $tagIds
18
+ ) {
19
+ users {
20
+ id
21
+ name
22
+ pictureUrl
23
+ metadata
24
+ createdAt
25
+ updatedAt
26
+ primaryTag {
27
+ id
28
+ name
29
+ color
30
+ isPrimary
31
+ }
32
+ roleCount
33
+ projectUserApiKeyCount
34
+ tagCount
35
+ authenticationMethods {
36
+ provider
37
+ providerId
38
+ }
39
+ }
40
+ totalCount
41
+ hasNextPage
42
+ }
43
+ }
@@ -5,5 +5,11 @@ mutation UpdateUser($id: ID!, $input: UpdateUserInput!) {
5
5
  metadata
6
6
  createdAt
7
7
  updatedAt
8
+ tags {
9
+ id
10
+ name
11
+ color
12
+ isPrimary
13
+ }
8
14
  }
9
15
  }
@@ -1,3 +1,10 @@
1
+ """
2
+ Check whether the authenticated principal may perform an action on a resource.
3
+
4
+ Unions Role → Group → Permission, User → Group → Permission, Role → Permission,
5
+ and User → Permission before matching the requested resource and action.
6
+ Conditional permissions are evaluated against role/group/user execution context.
7
+ """
1
8
  input IsAuthorizedInput {
2
9
  permission: IsAuthorizedPermissionInput!
3
10
  context: IsAuthorizedContextInput!
@@ -1,3 +1,6 @@
1
1
  extend type Query {
2
+ """
3
+ Evaluate authorization for the current session or API key token.
4
+ """
2
5
  isAuthorized(input: IsAuthorizedInput!): AuthorizationResult!
3
6
  }
@@ -5,6 +5,9 @@ type Group implements Auditable {
5
5
  metadata: JSON!
6
6
  permissions: [Permission!]
7
7
  tags: [Tag!]
8
+ primaryTag: Tag
9
+ permissionCount: Int!
10
+ tagCount: Int!
8
11
  createdAt: Date!
9
12
  updatedAt: Date!
10
13
  deletedAt: Date
@@ -8,6 +8,8 @@ type Permission implements Auditable {
8
8
  condition: JSON
9
9
  metadata: JSON!
10
10
  tags: [Tag!]
11
+ primaryTag: Tag
12
+ tagCount: Int!
11
13
  createdAt: Date!
12
14
  updatedAt: Date!
13
15
  deletedAt: Date
@@ -0,0 +1,27 @@
1
+ type ProjectRolePermission implements Auditable {
2
+ id: ID!
3
+ projectId: ID!
4
+ roleId: ID!
5
+ permissionId: ID!
6
+ createdAt: Date!
7
+ updatedAt: Date!
8
+ deletedAt: Date
9
+ }
10
+
11
+ input AddProjectRolePermissionInput {
12
+ projectId: ID!
13
+ roleId: ID!
14
+ permissionId: ID!
15
+ }
16
+
17
+ input RemoveProjectRolePermissionInput {
18
+ projectId: ID!
19
+ roleId: ID!
20
+ permissionId: ID!
21
+ }
22
+
23
+ input QueryProjectRolePermissionsInput {
24
+ projectId: ID
25
+ roleId: ID
26
+ permissionId: ID
27
+ }
@@ -0,0 +1,27 @@
1
+ type ProjectUserGroup implements Auditable {
2
+ id: ID!
3
+ projectId: ID!
4
+ userId: ID!
5
+ groupId: ID!
6
+ createdAt: Date!
7
+ updatedAt: Date!
8
+ deletedAt: Date
9
+ }
10
+
11
+ input AddProjectUserGroupInput {
12
+ projectId: ID!
13
+ userId: ID!
14
+ groupId: ID!
15
+ }
16
+
17
+ input RemoveProjectUserGroupInput {
18
+ projectId: ID!
19
+ userId: ID!
20
+ groupId: ID!
21
+ }
22
+
23
+ input QueryProjectUserGroupsInput {
24
+ projectId: ID
25
+ userId: ID
26
+ groupId: ID
27
+ }
@@ -0,0 +1,27 @@
1
+ type ProjectUserPermission implements Auditable {
2
+ id: ID!
3
+ projectId: ID!
4
+ userId: ID!
5
+ permissionId: ID!
6
+ createdAt: Date!
7
+ updatedAt: Date!
8
+ deletedAt: Date
9
+ }
10
+
11
+ input AddProjectUserPermissionInput {
12
+ projectId: ID!
13
+ userId: ID!
14
+ permissionId: ID!
15
+ }
16
+
17
+ input RemoveProjectUserPermissionInput {
18
+ projectId: ID!
19
+ userId: ID!
20
+ permissionId: ID!
21
+ }
22
+
23
+ input QueryProjectUserPermissionsInput {
24
+ projectId: ID
25
+ userId: ID
26
+ permissionId: ID
27
+ }
@@ -86,7 +86,15 @@ input RoleCdmInput {
86
86
  key: String!
87
87
  name: String!
88
88
  description: String
89
+ """
90
+ Group keys from the `groups` section. When set, permissions are linked via
91
+ Role → Group → Permission. Omit to use direct `permissions` on the role.
92
+ """
89
93
  groups: [String!]
94
+ """
95
+ Permission document keys or catalog refs (`resourceSlug:action`). Used for
96
+ direct Role → Permission when `groups` is empty.
97
+ """
90
98
  permissions: [String!]
91
99
  tags: [String!]
92
100
  primaryTag: String
@@ -106,8 +114,17 @@ input UserApiKeyCdmInput {
106
114
  input UserCdmInput {
107
115
  key: CdmKeyResolverInput!
108
116
  name: String!
117
+ """
118
+ Role template keys from the `roles` section.
119
+ """
109
120
  roles: [String!]
121
+ """
122
+ Direct group assignment. Each key must appear in the document `groups` section.
123
+ """
110
124
  groups: [String!]
125
+ """
126
+ Direct user → permission grants (document keys or catalog `resourceSlug:action` refs).
127
+ """
111
128
  permissions: [String!]
112
129
  tags: [String!]
113
130
  primaryTag: String
@@ -0,0 +1,5 @@
1
+ input AssignRolePermissionInput {
2
+ roleId: ID!
3
+ permissionId: ID!
4
+ scope: Scope!
5
+ }
@@ -0,0 +1,4 @@
1
+ input QueryRolePermissionsInput {
2
+ roleId: ID
3
+ permissionId: ID
4
+ }
@@ -0,0 +1,6 @@
1
+ input RevokeRolePermissionInput {
2
+ roleId: ID!
3
+ permissionId: ID!
4
+ scope: Scope!
5
+ hardDelete: Boolean
6
+ }
@@ -0,0 +1,3 @@
1
+ extend type Mutation {
2
+ assignRolePermission(input: AssignRolePermissionInput!): RolePermission!
3
+ }
@@ -0,0 +1,3 @@
1
+ extend type Mutation {
2
+ revokeRolePermission(input: RevokeRolePermissionInput!): RolePermission!
3
+ }
@@ -0,0 +1,10 @@
1
+ type RolePermission implements Auditable {
2
+ id: ID!
3
+ roleId: ID!
4
+ permissionId: ID!
5
+ role(scope: Scope!): Role
6
+ permission(scope: Scope!): Permission
7
+ createdAt: Date!
8
+ updatedAt: Date!
9
+ deletedAt: Date
10
+ }
@@ -4,6 +4,7 @@ input CreateRoleInput {
4
4
  metadata: JSON
5
5
  tagIds: [ID!]
6
6
  groupIds: [ID!]
7
+ permissionIds: [ID!]
7
8
  scope: Scope!
8
9
  primaryTagId: ID
9
10
  }
@@ -4,7 +4,12 @@ type Role implements Auditable {
4
4
  description: String
5
5
  metadata: JSON!
6
6
  groups: [Group!]
7
+ rolePermissions: [RolePermission!]
7
8
  tags: [Tag!]
9
+ primaryTag: Tag
10
+ groupCount: Int!
11
+ permissionCount: Int!
12
+ tagCount: Int!
8
13
  createdAt: Date!
9
14
  updatedAt: Date!
10
15
  deletedAt: Date
@@ -0,0 +1,4 @@
1
+ input AddUserGroupInput {
2
+ userId: ID!
3
+ groupId: ID!
4
+ }
@@ -0,0 +1,4 @@
1
+ input QueryUserGroupsInput {
2
+ userId: ID
3
+ groupId: ID
4
+ }
@@ -0,0 +1,4 @@
1
+ input RemoveUserGroupInput {
2
+ userId: ID!
3
+ groupId: ID!
4
+ }
@@ -0,0 +1,10 @@
1
+ type UserGroup implements Auditable {
2
+ id: ID!
3
+ userId: ID!
4
+ groupId: ID!
5
+ user(scope: Scope!): User
6
+ group(scope: Scope!): Group
7
+ createdAt: Date!
8
+ updatedAt: Date!
9
+ deletedAt: Date
10
+ }
@@ -0,0 +1,5 @@
1
+ input AssignUserPermissionInput {
2
+ userId: ID!
3
+ permissionId: ID!
4
+ scope: Scope!
5
+ }
@@ -0,0 +1,4 @@
1
+ input QueryUserPermissionsInput {
2
+ userId: ID
3
+ permissionId: ID
4
+ }
@@ -0,0 +1,6 @@
1
+ input RevokeUserPermissionInput {
2
+ userId: ID!
3
+ permissionId: ID!
4
+ scope: Scope!
5
+ hardDelete: Boolean
6
+ }
@@ -0,0 +1,3 @@
1
+ extend type Mutation {
2
+ assignUserPermission(input: AssignUserPermissionInput!): UserPermission!
3
+ }
@@ -0,0 +1,3 @@
1
+ extend type Mutation {
2
+ revokeUserPermission(input: RevokeUserPermissionInput!): UserPermission!
3
+ }
@@ -0,0 +1,10 @@
1
+ type UserPermission implements Auditable {
2
+ id: ID!
3
+ userId: ID!
4
+ permissionId: ID!
5
+ user(scope: Scope!): User
6
+ permission(scope: Scope!): Permission
7
+ createdAt: Date!
8
+ updatedAt: Date!
9
+ deletedAt: Date
10
+ }
@@ -4,6 +4,8 @@ input CreateUserInput {
4
4
  metadata: JSON
5
5
  tagIds: [ID!]
6
6
  roleIds: [ID!]
7
+ groupIds: [ID!]
8
+ permissionIds: [ID!]
7
9
  scope: Scope!
8
10
  primaryTagId: ID
9
11
  }
@@ -5,5 +5,6 @@ input UpdateUserInput {
5
5
  metadata: JSON
6
6
  tagIds: [ID!]
7
7
  roleIds: [ID!]
8
+ groupIds: [ID!]
8
9
  primaryTagId: ID
9
10
  }
@@ -4,7 +4,14 @@ type User implements Auditable {
4
4
  pictureUrl: String
5
5
  metadata: JSON!
6
6
  roles: [Role!]
7
+ userGroups: [UserGroup!]
8
+ userPermissions: [UserPermission!]
7
9
  tags: [Tag!]
10
+ primaryTag: Tag
11
+ roleCount: Int!
12
+ permissionCount: Int!
13
+ projectUserApiKeyCount: Int!
14
+ tagCount: Int!
8
15
  authenticationMethods: [UserAuthenticationMethod!]
9
16
  accounts: [Account!]
10
17
  createdAt: Date!