@grantjs/schema 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/package.json +8 -8
  2. package/src/cdm/cdm-export-sections.ts +22 -0
  3. package/src/generated/graphql.ts +1656 -46
  4. package/src/generated/resolvers.ts +727 -0
  5. package/src/index.ts +11 -10
  6. package/src/operations/auth/login.graphql +2 -0
  7. package/src/operations/auth/setupMfa.graphql +7 -0
  8. package/src/operations/auth/verifyMfa.graphql +7 -0
  9. package/src/operations/auth/verifyMfaRecoveryCode.graphql +7 -0
  10. package/src/operations/me/createMyMfaEnrollment.graphql +7 -0
  11. package/src/operations/me/generateMyMfaRecoveryCodes.graphql +3 -0
  12. package/src/operations/me/me.graphql +1 -0
  13. package/src/operations/me/myMfaDevices.graphql +10 -0
  14. package/src/operations/me/myMfaRecoveryCodeStatus.graphql +6 -0
  15. package/src/operations/me/removeMyMfaDevice.graphql +5 -0
  16. package/src/operations/me/setMyPrimaryMfaDevice.graphql +6 -0
  17. package/src/operations/me/verifyMyMfaEnrollment.graphql +5 -0
  18. package/src/operations/organizations/getOrganizations.graphql +1 -0
  19. package/src/operations/organizations/updateOrganization.graphql +1 -0
  20. package/src/operations/projects/cancel-project-sync.graphql +17 -0
  21. package/src/operations/projects/project-sync-job.graphql +37 -0
  22. package/src/operations/projects/project-sync-jobs.graphql +40 -0
  23. package/src/operations/projects/start-project-export.graphql +20 -0
  24. package/src/operations/projects/start-project-sync.graphql +17 -0
  25. package/src/operations/resources/createResource.graphql +6 -0
  26. package/src/schema/auth/inputs/verify-mfa-recovery-code.graphql +3 -0
  27. package/src/schema/auth/inputs/verify-mfa.graphql +3 -0
  28. package/src/schema/auth/mutations/setup-mfa.graphql +3 -0
  29. package/src/schema/auth/mutations/verify-mfa-recovery-code.graphql +3 -0
  30. package/src/schema/auth/mutations/verify-mfa.graphql +3 -0
  31. package/src/schema/auth/types/login-response.graphql +5 -0
  32. package/src/schema/auth/types/mfa-setup-response.graphql +5 -0
  33. package/src/schema/auth/types/mfa-verify-response.graphql +5 -0
  34. package/src/schema/me/inputs/generate-my-mfa-recovery-codes.graphql +3 -0
  35. package/src/schema/me/inputs/remove-my-mfa-device.graphql +3 -0
  36. package/src/schema/me/inputs/set-my-primary-mfa-device.graphql +3 -0
  37. package/src/schema/me/inputs/verify-my-mfa-enrollment.graphql +3 -0
  38. package/src/schema/me/mutations/create-my-mfa-enrollment.graphql +3 -0
  39. package/src/schema/me/mutations/generate-my-mfa-recovery-codes.graphql +3 -0
  40. package/src/schema/me/mutations/remove-my-mfa-device.graphql +3 -0
  41. package/src/schema/me/mutations/set-my-primary-mfa-device.graphql +3 -0
  42. package/src/schema/me/mutations/verify-my-mfa-enrollment.graphql +3 -0
  43. package/src/schema/me/queries/my-mfa-devices.graphql +3 -0
  44. package/src/schema/me/queries/my-mfa-recovery-code-status.graphql +3 -0
  45. package/src/schema/me/types/me-response.graphql +1 -0
  46. package/src/schema/me/types/mfa-device.graphql +8 -0
  47. package/src/schema/me/types/mfa-enrollment.graphql +5 -0
  48. package/src/schema/me/types/mfa-recovery-code-status.graphql +4 -0
  49. package/src/schema/me/types/mfa-verify-result.graphql +3 -0
  50. package/src/schema/organization-users/inputs/add-organization-user.graphql +1 -0
  51. package/src/schema/organization-users/types/organization-user.graphql +1 -0
  52. package/src/schema/organizations/inputs/update-organization.graphql +1 -0
  53. package/src/schema/organizations/types/organization.graphql +1 -0
  54. package/src/schema/permissions/inputs/create-permission.graphql +1 -0
  55. package/src/schema/permissions/inputs/update-permission.graphql +1 -0
  56. package/src/schema/permissions/types/permission.graphql +1 -0
  57. package/src/schema/project-user-api-keys/inputs/add-project-user-api-key.graphql +4 -0
  58. package/src/schema/project-users/inputs/add-project-user.graphql +1 -0
  59. package/src/schema/project-users/types/project-user.graphql +3 -0
  60. package/src/schema/projects/inputs/project-sync-job-sort.graphql +4 -0
  61. package/src/schema/projects/inputs/start-project-export.graphql +31 -0
  62. package/src/schema/projects/inputs/sync-project-cdm.graphql +132 -0
  63. package/src/schema/projects/mutations/cancel-project-sync.graphql +9 -0
  64. package/src/schema/projects/mutations/start-project-export.graphql +12 -0
  65. package/src/schema/projects/mutations/start-project-sync.graphql +15 -0
  66. package/src/schema/projects/queries/project-sync-job.graphql +7 -0
  67. package/src/schema/projects/queries/project-sync-jobs.graphql +17 -0
  68. package/src/schema/projects/types/project-sync-job-page.graphql +8 -0
  69. package/src/schema/projects/types/project-sync-job-sortable-field.graphql +7 -0
  70. package/src/schema/projects/types/project-sync-job.graphql +53 -0
  71. package/src/schema/projects/types/sync-project-result.graphql +27 -0
  72. package/src/schema/resources/inputs/create-resource.graphql +2 -0
  73. package/src/schema/resources/inputs/update-resource.graphql +1 -0
  74. package/src/schema/resources/types/resource.graphql +2 -0
  75. package/src/schema/tags/inputs/create-tag.graphql +1 -0
  76. package/src/schema/tags/inputs/update-tag.graphql +1 -0
  77. package/src/schema/tags/types/tag.graphql +1 -0
@@ -0,0 +1,132 @@
1
+ enum CdmModeStrategy {
2
+ merge
3
+ replace
4
+ }
5
+
6
+ enum CdmOnConflict {
7
+ fail
8
+ skip
9
+ update
10
+ }
11
+
12
+ enum CdmFindBy {
13
+ key
14
+ id
15
+ email
16
+ name
17
+ slug
18
+ }
19
+
20
+ enum CdmIfMissing {
21
+ fail
22
+ skip
23
+ createNew
24
+ }
25
+
26
+ input CdmModeInput {
27
+ strategy: CdmModeStrategy!
28
+ onConflict: CdmOnConflict
29
+ confirmDestructive: Boolean
30
+ }
31
+
32
+ input CdmKeyResolverInput {
33
+ value: String!
34
+ findBy: CdmFindBy
35
+ ifMissing: CdmIfMissing
36
+ }
37
+
38
+ """
39
+ Project resource row for CDM import/export.
40
+ """
41
+ input ResourceCdmInput {
42
+ key: String!
43
+ slug: String
44
+ name: String!
45
+ description: String
46
+ actions: [String!]!
47
+ tags: [String!]
48
+ primaryTag: String
49
+ metadata: JSON
50
+ }
51
+
52
+ """
53
+ Custom permission for this project; `resource` is an opaque key in the same document.
54
+ """
55
+ input PermissionCdmInput {
56
+ key: String!
57
+ resource: String!
58
+ action: String!
59
+ name: String!
60
+ description: String
61
+ condition: JSON
62
+ groups: [String!]
63
+ tags: [String!]
64
+ primaryTag: String
65
+ metadata: JSON
66
+ }
67
+
68
+ input TagCdmInput {
69
+ key: String!
70
+ name: String!
71
+ color: String!
72
+ metadata: JSON
73
+ }
74
+
75
+ input GroupCdmInput {
76
+ key: String!
77
+ name: String!
78
+ description: String
79
+ permissions: [String!]
80
+ tags: [String!]
81
+ primaryTag: String
82
+ metadata: JSON
83
+ }
84
+
85
+ input RoleCdmInput {
86
+ key: String!
87
+ name: String!
88
+ description: String
89
+ groups: [String!]
90
+ permissions: [String!]
91
+ tags: [String!]
92
+ primaryTag: String
93
+ metadata: JSON
94
+ }
95
+
96
+ input UserApiKeyCdmInput {
97
+ key: String
98
+ clientId: String
99
+ clientSecret: String
100
+ name: String
101
+ description: String
102
+ expiresAt: Date
103
+ metadata: JSON
104
+ }
105
+
106
+ input UserCdmInput {
107
+ key: CdmKeyResolverInput!
108
+ name: String!
109
+ roles: [String!]
110
+ groups: [String!]
111
+ permissions: [String!]
112
+ tags: [String!]
113
+ primaryTag: String
114
+ apiKeys: [UserApiKeyCdmInput!]
115
+ metadata: JSON
116
+ }
117
+
118
+ """
119
+ Versioned canonical project document (CDM) for export/import: roles, users,
120
+ resources, permissions, groups, and tags scoped to one project.
121
+ """
122
+ input SyncProjectInput {
123
+ version: Int!
124
+ id: String
125
+ mode: CdmModeInput!
126
+ roles: [RoleCdmInput!]!
127
+ users: [UserCdmInput!]!
128
+ resources: [ResourceCdmInput!]
129
+ permissions: [PermissionCdmInput!]
130
+ groups: [GroupCdmInput!]
131
+ tags: [TagCdmInput!]
132
+ }
@@ -0,0 +1,9 @@
1
+ extend type Mutation {
2
+ """
3
+ Cancel a pending or running project CDM sync job. Cancellation is
4
+ immediate when the job is still PENDING; if the job is already RUNNING, the
5
+ cancellation is recorded and the worker stops at the next checkpoint
6
+ (best-effort).
7
+ """
8
+ cancelProjectSync(id: ID!, scope: Scope!, jobId: ID!): ProjectSyncJob!
9
+ }
@@ -0,0 +1,12 @@
1
+ extend type Mutation {
2
+ """
3
+ Enqueue an asynchronous CDM **export** job for the given project. The worker
4
+ snapshots current permission state into a replay-ready `SyncProjectInput` and
5
+ stores it on the job row (`snapshot`); poll `projectSyncJob` for status.
6
+
7
+ Requires Project:update in the given project scope (same as starting import jobs).
8
+
9
+ Pass optional `input.jobName` for idempotency with the same rules as import `input.id`.
10
+ """
11
+ startProjectExport(id: ID!, scope: Scope!, input: StartProjectExportInput!): ProjectSyncJob!
12
+ }
@@ -0,0 +1,15 @@
1
+ extend type Mutation {
2
+ """
3
+ Enqueue an asynchronous project CDM import job for the given project.
4
+ Applies a canonical data model document: roles, groups, resources, permissions,
5
+ tags, project pivots, and user assignments scoped to the project.
6
+ Requires Project:update in the given project scope.
7
+
8
+ Returns immediately with a job descriptor in the PENDING status; the actual
9
+ import runs in the background. Poll `projectSyncJob` for status.
10
+ Pass optional `input.id` as a stable **job name** for idempotency: if an active job
11
+ already exists for the same `(project, operation=IMPORT, jobName)`, that job is
12
+ returned instead of creating a new one.
13
+ """
14
+ startProjectSync(id: ID!, scope: Scope!, input: SyncProjectInput!): ProjectSyncJob!
15
+ }
@@ -0,0 +1,7 @@
1
+ extend type Query {
2
+ """
3
+ Read the current state of a project CDM sync job. Use this to poll
4
+ the lifecycle of a job started via `startProjectSync`.
5
+ """
6
+ projectSyncJob(id: ID!, scope: Scope!, jobId: ID!): ProjectSyncJob!
7
+ }
@@ -0,0 +1,17 @@
1
+ extend type Query {
2
+ """
3
+ List project CDM sync jobs for a project, with optional pagination,
4
+ search (matches jobName), status filter, and sort. Use this to populate the
5
+ job history view. Use `projectSyncJob` to read a single job's
6
+ current state for polling.
7
+ """
8
+ projectSyncJobs(
9
+ id: ID!
10
+ scope: Scope!
11
+ page: Int
12
+ limit: Int
13
+ search: String
14
+ sort: ProjectSyncJobSortInput
15
+ status: ProjectSyncJobStatus
16
+ ): ProjectSyncJobPage!
17
+ }
@@ -0,0 +1,8 @@
1
+ """
2
+ Paginated list of project CDM sync jobs.
3
+ """
4
+ type ProjectSyncJobPage implements PaginatedResults {
5
+ jobs: [ProjectSyncJob!]!
6
+ totalCount: Int!
7
+ hasNextPage: Boolean!
8
+ }
@@ -0,0 +1,7 @@
1
+ enum ProjectSyncJobSortableField {
2
+ enqueuedAt
3
+ startedAt
4
+ completedAt
5
+ status
6
+ jobName
7
+ }
@@ -0,0 +1,53 @@
1
+ """
2
+ Lifecycle status of an asynchronous project CDM sync job.
3
+ """
4
+ enum ProjectSyncJobStatus {
5
+ PENDING
6
+ RUNNING
7
+ COMPLETED
8
+ FAILED
9
+ CANCELLED
10
+ }
11
+
12
+ """
13
+ CDM import or export work for a project (`project_sync_jobs`).
14
+ """
15
+ enum ProjectSyncJobOperation {
16
+ IMPORT
17
+ EXPORT
18
+ }
19
+
20
+ """
21
+ Asynchronous project CDM import or export job.
22
+ """
23
+ type ProjectSyncJob {
24
+ id: ID!
25
+ projectId: ID!
26
+ status: ProjectSyncJobStatus!
27
+ cdmVersion: Int!
28
+ """
29
+ Client idempotency key from `SyncProjectInput.id` on import.
30
+ """
31
+ jobName: String
32
+ operation: ProjectSyncJobOperation!
33
+ """
34
+ Import merge/replace; null for export.
35
+ """
36
+ modeStrategy: CdmModeStrategy
37
+ """
38
+ Import counters when completed; null for export (CDM in snapshot download).
39
+ """
40
+ result: SyncProjectResult
41
+ warnings: [String!]!
42
+ errorMessage: String
43
+ enqueuedAt: Date!
44
+ startedAt: Date
45
+ completedAt: Date
46
+ cancelledAt: Date
47
+ """
48
+ Rollback snapshot (import) or exported CDM (export); REST `.../snapshot`.
49
+ """
50
+ hasSnapshot: Boolean!
51
+ snapshotTakenAt: Date
52
+ snapshotSizeBytes: Int
53
+ }
@@ -0,0 +1,27 @@
1
+ """
2
+ Counters and warnings from a completed CDM import.
3
+ """
4
+ type SyncProjectResult {
5
+ projectId: ID!
6
+ importId: String
7
+ rolesCreated: Int!
8
+ groupsCreated: Int!
9
+ roleGroupsLinked: Int!
10
+ groupPermissionsLinked: Int!
11
+ projectRolesLinked: Int!
12
+ projectGroupsLinked: Int!
13
+ projectPermissionsLinked: Int!
14
+ projectResourcesLinked: Int!
15
+ projectUsersEnsured: Int!
16
+ usersCreated: Int!
17
+ userRolesAssigned: Int!
18
+ projectUserApiKeysCreated: Int!
19
+ resourcesCreated: Int!
20
+ permissionsCreated: Int!
21
+ tagsCreated: Int!
22
+ projectTagsLinked: Int!
23
+ roleTagsLinked: Int!
24
+ groupTagsLinked: Int!
25
+ userTagsLinked: Int!
26
+ warnings: [String!]!
27
+ }
@@ -7,4 +7,6 @@ input CreateResourceInput {
7
7
  isActive: Boolean
8
8
  tagIds: [ID!]
9
9
  primaryTagId: ID
10
+ createPermissions: Boolean
11
+ metadata: JSON
10
12
  }
@@ -7,4 +7,5 @@ input UpdateResourceInput {
7
7
  isActive: Boolean
8
8
  tagIds: [ID!]
9
9
  primaryTagId: ID
10
+ metadata: JSON
10
11
  }
@@ -5,7 +5,9 @@ type Resource implements Auditable {
5
5
  description: String
6
6
  actions: [String!]!
7
7
  isActive: Boolean!
8
+ metadata: JSON!
8
9
  tags: [Tag!]!
10
+ permissions: [Permission!]
9
11
  createdAt: Date!
10
12
  updatedAt: Date!
11
13
  deletedAt: Date
@@ -1,5 +1,6 @@
1
1
  input CreateTagInput {
2
2
  name: String!
3
3
  color: String!
4
+ metadata: JSON
4
5
  scope: Scope!
5
6
  }
@@ -2,4 +2,5 @@ input UpdateTagInput {
2
2
  scope: Scope!
3
3
  name: String
4
4
  color: String
5
+ metadata: JSON
5
6
  }
@@ -3,6 +3,7 @@ type Tag implements Auditable {
3
3
  name: String!
4
4
  color: String!
5
5
  isPrimary: Boolean
6
+ metadata: JSON!
6
7
  createdAt: Date!
7
8
  updatedAt: Date!
8
9
  deletedAt: Date