@grantjs/schema 1.4.2 → 1.5.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 (49) hide show
  1. package/package.json +9 -9
  2. package/src/events/event-catalog.ts +214 -0
  3. package/src/events/event-envelope.ts +73 -0
  4. package/src/events/index.ts +2 -0
  5. package/src/generated/graphql.ts +1318 -111
  6. package/src/generated/resolvers.ts +628 -0
  7. package/src/generated/schema-types.ts +312 -0
  8. package/src/index.ts +3 -0
  9. package/src/notifications/notification.types.ts +21 -0
  10. package/src/operations/api-keys/rotate-api-key.graphql +11 -0
  11. package/src/operations/groups/getGroups.graphql +1 -8
  12. package/src/operations/groups/getGroupsList.graphql +6 -0
  13. package/src/operations/me/mark-all-my-notifications-read.graphql +5 -0
  14. package/src/operations/me/mark-my-notification-read.graphql +3 -0
  15. package/src/operations/me/my-notification-preferences.graphql +11 -0
  16. package/src/operations/me/my-notifications.graphql +26 -0
  17. package/src/operations/me/my-project-membership.graphql +14 -0
  18. package/src/operations/me/my-project-memberships.graphql +14 -0
  19. package/src/operations/me/my-unread-notification-count.graphql +5 -0
  20. package/src/operations/me/set-my-notification-preference.graphql +11 -0
  21. package/src/operations/me/update-my-project-membership.graphql +14 -0
  22. package/src/operations/me/upload-my-project-membership-picture.graphql +6 -0
  23. package/src/operations/roles/getRoles.graphql +1 -14
  24. package/src/operations/webhooks/create-webhook-subscription.graphql +13 -0
  25. package/src/operations/webhooks/delete-webhook-subscription.graphql +3 -0
  26. package/src/operations/webhooks/replay-webhook-delivery.graphql +11 -0
  27. package/src/operations/webhooks/rotate-webhook-subscription-secret.graphql +7 -0
  28. package/src/operations/webhooks/update-webhook-subscription.graphql +10 -0
  29. package/src/operations/webhooks/webhook-deliveries.graphql +31 -0
  30. package/src/operations/webhooks/webhook-subscription.graphql +13 -0
  31. package/src/operations/webhooks/webhook-subscriptions.graphql +13 -0
  32. package/src/schema/api-keys/inputs/rotate-api-key.graphql +4 -0
  33. package/src/schema/api-keys/mutations/rotate-api-key.graphql +7 -0
  34. package/src/schema/me/input/notification.graphql +16 -0
  35. package/src/schema/me/input/update-my-project-membership.graphql +5 -0
  36. package/src/schema/me/input/upload-my-project-membership-picture.graphql +6 -0
  37. package/src/schema/me/mutations/my-notifications.graphql +5 -0
  38. package/src/schema/me/mutations/update-my-project-membership.graphql +6 -0
  39. package/src/schema/me/mutations/upload-my-project-membership-picture.graphql +5 -0
  40. package/src/schema/me/queries/my-notifications.graphql +5 -0
  41. package/src/schema/me/queries/my-project-membership.graphql +6 -0
  42. package/src/schema/me/queries/my-project-memberships.graphql +6 -0
  43. package/src/schema/me/types/my-project-membership.graphql +12 -0
  44. package/src/schema/me/types/notification.graphql +63 -0
  45. package/src/schema/webhooks/inputs/webhook-subscription.graphql +33 -0
  46. package/src/schema/webhooks/mutations/webhook-subscriptions.graphql +33 -0
  47. package/src/schema/webhooks/queries/webhook-subscriptions.graphql +22 -0
  48. package/src/schema/webhooks/types/webhook-subscription.graphql +58 -0
  49. package/src/webhooks/webhook.types.ts +25 -0
@@ -0,0 +1,11 @@
1
+ mutation SetMyNotificationPreference($input: SetMyNotificationPreferenceInput!) {
2
+ setMyNotificationPreference(input: $input) {
3
+ id
4
+ scopeTenant
5
+ scopeId
6
+ category
7
+ channel
8
+ enabled
9
+ source
10
+ }
11
+ }
@@ -0,0 +1,14 @@
1
+ mutation UpdateMyProjectMembership($input: UpdateMyProjectMembershipInput!) {
2
+ updateMyProjectMembership(input: $input) {
3
+ projectId
4
+ projectName
5
+ displayName
6
+ pictureUrl
7
+ metadata
8
+ role
9
+ joinedAt
10
+ organizationId
11
+ organizationName
12
+ accountId
13
+ }
14
+ }
@@ -0,0 +1,6 @@
1
+ mutation UploadMyProjectMembershipPicture($input: UploadMyProjectMembershipPictureInput!) {
2
+ uploadMyProjectMembershipPicture(input: $input) {
3
+ url
4
+ path
5
+ }
6
+ }
@@ -23,27 +23,14 @@ query GetRoles(
23
23
  metadata
24
24
  createdAt
25
25
  updatedAt
26
+ # Group ids/names only — no nested group.tags (unused by attachment UIs).
26
27
  groups {
27
28
  id
28
29
  name
29
- tags {
30
- id
31
- name
32
- color
33
- isPrimary
34
- }
35
30
  }
36
31
  rolePermissions {
37
32
  id
38
33
  permissionId
39
- permission(scope: $scope) {
40
- id
41
- name
42
- action
43
- resource {
44
- slug
45
- }
46
- }
47
34
  }
48
35
  tags {
49
36
  id
@@ -0,0 +1,13 @@
1
+ mutation CreateWebhookSubscription($input: CreateWebhookSubscriptionMutationInput!) {
2
+ createWebhookSubscription(input: $input) {
3
+ id
4
+ projectId
5
+ url
6
+ eventTypes
7
+ active
8
+ description
9
+ secret
10
+ createdAt
11
+ updatedAt
12
+ }
13
+ }
@@ -0,0 +1,3 @@
1
+ mutation DeleteWebhookSubscription($input: DeleteWebhookSubscriptionInput!) {
2
+ deleteWebhookSubscription(input: $input)
3
+ }
@@ -0,0 +1,11 @@
1
+ mutation ReplayWebhookDelivery($input: ReplayWebhookDeliveryInput!) {
2
+ replayWebhookDelivery(input: $input) {
3
+ id
4
+ eventId
5
+ subscriptionId
6
+ status
7
+ attemptCount
8
+ nextRetryAt
9
+ updatedAt
10
+ }
11
+ }
@@ -0,0 +1,7 @@
1
+ mutation RotateWebhookSubscriptionSecret($input: RotateWebhookSubscriptionSecretInput!) {
2
+ rotateWebhookSubscriptionSecret(input: $input) {
3
+ id
4
+ secret
5
+ updatedAt
6
+ }
7
+ }
@@ -0,0 +1,10 @@
1
+ mutation UpdateWebhookSubscription($id: ID!, $input: UpdateWebhookSubscriptionMutationInput!) {
2
+ updateWebhookSubscription(id: $id, input: $input) {
3
+ id
4
+ url
5
+ eventTypes
6
+ active
7
+ description
8
+ updatedAt
9
+ }
10
+ }
@@ -0,0 +1,31 @@
1
+ query WebhookDeliveries(
2
+ $scope: Scope!
3
+ $subscriptionId: ID
4
+ $status: WebhookDeliveryStatus
5
+ $page: Int
6
+ $limit: Int
7
+ ) {
8
+ webhookDeliveries(
9
+ scope: $scope
10
+ subscriptionId: $subscriptionId
11
+ status: $status
12
+ page: $page
13
+ limit: $limit
14
+ ) {
15
+ items {
16
+ id
17
+ eventId
18
+ subscriptionId
19
+ status
20
+ attemptCount
21
+ nextRetryAt
22
+ lastResponseStatus
23
+ errorDetails
24
+ deliveredAt
25
+ createdAt
26
+ updatedAt
27
+ }
28
+ totalCount
29
+ hasNextPage
30
+ }
31
+ }
@@ -0,0 +1,13 @@
1
+ query WebhookSubscription($scope: Scope!, $id: ID!) {
2
+ webhookSubscription(scope: $scope, id: $id) {
3
+ id
4
+ projectId
5
+ url
6
+ eventTypes
7
+ active
8
+ description
9
+ createdById
10
+ createdAt
11
+ updatedAt
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ query WebhookSubscriptions($scope: Scope!) {
2
+ webhookSubscriptions(scope: $scope) {
3
+ id
4
+ projectId
5
+ url
6
+ eventTypes
7
+ active
8
+ description
9
+ createdById
10
+ createdAt
11
+ updatedAt
12
+ }
13
+ }
@@ -0,0 +1,4 @@
1
+ input RotateApiKeyInput {
2
+ id: ID!
3
+ scope: Scope!
4
+ }
@@ -0,0 +1,7 @@
1
+ extend type Mutation {
2
+ """
3
+ Rotate an API key secret in place. Returns the new plaintext secret once.
4
+ Keeps the same key id and clientId; rejects revoked keys.
5
+ """
6
+ rotateApiKey(input: RotateApiKeyInput!): CreateApiKeyResult!
7
+ }
@@ -0,0 +1,16 @@
1
+ input MyNotificationsInput {
2
+ unreadOnly: Boolean
3
+ page: Int
4
+ limit: Int
5
+ }
6
+
7
+ input SetMyNotificationPreferenceInput {
8
+ scopeTenant: String!
9
+ scopeId: String
10
+ """
11
+ Notification preference category (security, iam, membership, integrations).
12
+ """
13
+ category: String!
14
+ channel: NotificationChannel!
15
+ enabled: Boolean!
16
+ }
@@ -0,0 +1,5 @@
1
+ input UpdateMyProjectMembershipInput {
2
+ projectId: ID!
3
+ displayName: String
4
+ pictureUrl: String
5
+ }
@@ -0,0 +1,6 @@
1
+ input UploadMyProjectMembershipPictureInput {
2
+ projectId: ID!
3
+ file: String!
4
+ filename: String!
5
+ contentType: String!
6
+ }
@@ -0,0 +1,5 @@
1
+ extend type Mutation {
2
+ markMyNotificationRead(id: ID!): Boolean!
3
+ markAllMyNotificationsRead: MarkAllNotificationsReadResult!
4
+ setMyNotificationPreference(input: SetMyNotificationPreferenceInput!): NotificationPreference!
5
+ }
@@ -0,0 +1,6 @@
1
+ extend type Mutation {
2
+ """
3
+ Update the authenticated user's project membership profile (display name / picture).
4
+ """
5
+ updateMyProjectMembership(input: UpdateMyProjectMembershipInput!): MyProjectMembership!
6
+ }
@@ -0,0 +1,5 @@
1
+ extend type Mutation {
2
+ uploadMyProjectMembershipPicture(
3
+ input: UploadMyProjectMembershipPictureInput!
4
+ ): UploadUserPictureResult!
5
+ }
@@ -0,0 +1,5 @@
1
+ extend type Query {
2
+ myNotifications(input: MyNotificationsInput): NotificationPage!
3
+ myUnreadNotificationCount: UnreadNotificationCount!
4
+ myNotificationPreferences(scopeTenant: String!): [NotificationPreference!]!
5
+ }
@@ -0,0 +1,6 @@
1
+ extend type Query {
2
+ """
3
+ A single project membership for the authenticated user.
4
+ """
5
+ myProjectMembership(projectId: ID!): MyProjectMembership
6
+ }
@@ -0,0 +1,6 @@
1
+ extend type Query {
2
+ """
3
+ Project memberships for the authenticated user (project_users pivots).
4
+ """
5
+ myProjectMemberships: [MyProjectMembership!]!
6
+ }
@@ -0,0 +1,12 @@
1
+ type MyProjectMembership {
2
+ projectId: ID!
3
+ projectName: String!
4
+ displayName: String
5
+ pictureUrl: String
6
+ metadata: JSON!
7
+ role: String
8
+ joinedAt: Date!
9
+ organizationId: ID
10
+ organizationName: String
11
+ accountId: ID
12
+ }
@@ -0,0 +1,63 @@
1
+ enum NotificationChannel {
2
+ in_app
3
+ email
4
+ }
5
+
6
+ enum NotificationStatus {
7
+ pending
8
+ delivered
9
+ failed
10
+ dead
11
+ }
12
+
13
+ enum NotificationPreferenceSource {
14
+ user
15
+ org_enforced
16
+ }
17
+
18
+ type NotificationEventScope {
19
+ tenant: String!
20
+ id: ID!
21
+ }
22
+
23
+ type Notification {
24
+ id: ID!
25
+ eventId: ID!
26
+ category: String!
27
+ type: String!
28
+ channel: NotificationChannel!
29
+ title: String!
30
+ body: String
31
+ refEntity: String
32
+ refId: ID
33
+ scope: NotificationEventScope
34
+ status: NotificationStatus!
35
+ seenAt: Date
36
+ readAt: Date
37
+ createdAt: Date!
38
+ }
39
+
40
+ type NotificationPage {
41
+ notifications: [Notification!]!
42
+ totalCount: Int!
43
+ unreadCount: Int!
44
+ hasNextPage: Boolean!
45
+ }
46
+
47
+ type UnreadNotificationCount {
48
+ unreadCount: Int!
49
+ }
50
+
51
+ type NotificationPreference {
52
+ id: ID!
53
+ scopeTenant: String!
54
+ scopeId: String!
55
+ category: String!
56
+ channel: NotificationChannel!
57
+ enabled: Boolean!
58
+ source: NotificationPreferenceSource!
59
+ }
60
+
61
+ type MarkAllNotificationsReadResult {
62
+ updated: Int!
63
+ }
@@ -0,0 +1,33 @@
1
+ input CreateWebhookSubscriptionMutationInput {
2
+ scope: Scope!
3
+ url: String!
4
+ """
5
+ Domain event type filters (must be known catalog types).
6
+ """
7
+ eventTypes: [String!]!
8
+ description: String
9
+ active: Boolean
10
+ }
11
+
12
+ input UpdateWebhookSubscriptionMutationInput {
13
+ scope: Scope!
14
+ url: String
15
+ eventTypes: [String!]
16
+ description: String
17
+ active: Boolean
18
+ }
19
+
20
+ input DeleteWebhookSubscriptionInput {
21
+ scope: Scope!
22
+ id: ID!
23
+ }
24
+
25
+ input RotateWebhookSubscriptionSecretInput {
26
+ scope: Scope!
27
+ id: ID!
28
+ }
29
+
30
+ input ReplayWebhookDeliveryInput {
31
+ scope: Scope!
32
+ deliveryId: ID!
33
+ }
@@ -0,0 +1,33 @@
1
+ extend type Mutation {
2
+ """
3
+ Create a project webhook subscription. The signing secret is returned once.
4
+ """
5
+ createWebhookSubscription(
6
+ input: CreateWebhookSubscriptionMutationInput!
7
+ ): WebhookSubscriptionWithSecret!
8
+
9
+ """
10
+ Update a webhook subscription URL, event filters, description, or active flag.
11
+ """
12
+ updateWebhookSubscription(
13
+ id: ID!
14
+ input: UpdateWebhookSubscriptionMutationInput!
15
+ ): WebhookSubscription!
16
+
17
+ """
18
+ Soft-delete a webhook subscription.
19
+ """
20
+ deleteWebhookSubscription(input: DeleteWebhookSubscriptionInput!): Boolean!
21
+
22
+ """
23
+ Rotate the signing secret. The new secret is returned once.
24
+ """
25
+ rotateWebhookSubscriptionSecret(
26
+ input: RotateWebhookSubscriptionSecretInput!
27
+ ): WebhookSubscriptionWithSecret!
28
+
29
+ """
30
+ Re-queue a delivery attempt for another POST.
31
+ """
32
+ replayWebhookDelivery(input: ReplayWebhookDeliveryInput!): WebhookDeliveryAttempt!
33
+ }
@@ -0,0 +1,22 @@
1
+ extend type Query {
2
+ """
3
+ List webhook subscriptions for a project scope.
4
+ """
5
+ webhookSubscriptions(scope: Scope!): [WebhookSubscription!]!
6
+
7
+ """
8
+ Get a single webhook subscription by id.
9
+ """
10
+ webhookSubscription(scope: Scope!, id: ID!): WebhookSubscription!
11
+
12
+ """
13
+ List delivery attempts for a project (optionally filtered by subscription or status).
14
+ """
15
+ webhookDeliveries(
16
+ scope: Scope!
17
+ subscriptionId: ID
18
+ status: WebhookDeliveryStatus
19
+ page: Int
20
+ limit: Int
21
+ ): WebhookDeliveryPage!
22
+ }
@@ -0,0 +1,58 @@
1
+ enum WebhookDeliveryStatus {
2
+ pending
3
+ running
4
+ delivered
5
+ failed
6
+ dead
7
+ }
8
+
9
+ type WebhookSubscription {
10
+ id: ID!
11
+ projectId: ID!
12
+ url: String!
13
+ eventTypes: [String!]!
14
+ active: Boolean!
15
+ description: String
16
+ createdById: ID
17
+ createdAt: Date!
18
+ updatedAt: Date!
19
+ }
20
+
21
+ """
22
+ Returned only at creation or secret rotation. Store the secret immediately.
23
+ """
24
+ type WebhookSubscriptionWithSecret {
25
+ id: ID!
26
+ projectId: ID!
27
+ url: String!
28
+ eventTypes: [String!]!
29
+ active: Boolean!
30
+ description: String
31
+ createdById: ID
32
+ createdAt: Date!
33
+ updatedAt: Date!
34
+ """
35
+ Plaintext signing secret. Shown once; never returned by list/get/update.
36
+ """
37
+ secret: String!
38
+ }
39
+
40
+ type WebhookDeliveryAttempt {
41
+ id: ID!
42
+ eventId: ID!
43
+ subscriptionId: ID!
44
+ status: WebhookDeliveryStatus!
45
+ attemptCount: Int!
46
+ nextRetryAt: Date
47
+ lastResponseStatus: Int
48
+ errorDetails: JSON
49
+ deliveredAt: Date
50
+ createdAt: Date!
51
+ updatedAt: Date!
52
+ }
53
+
54
+ type WebhookDeliveryPage {
55
+ items: [WebhookDeliveryAttempt!]!
56
+ totalCount: Int!
57
+ hasNextPage: Boolean!
58
+ }
@@ -0,0 +1,25 @@
1
+ import type { EventType } from '../events/event-catalog';
2
+
3
+ export const WEBHOOK_DELIVERY_STATUSES = [
4
+ 'pending',
5
+ 'running',
6
+ 'delivered',
7
+ 'failed',
8
+ 'dead',
9
+ ] as const;
10
+
11
+ /** Service-layer create payload (scope is passed separately). */
12
+ export interface CreateWebhookSubscriptionInput {
13
+ url: string;
14
+ eventTypes: EventType[];
15
+ description?: string | null;
16
+ active?: boolean;
17
+ }
18
+
19
+ /** Service-layer update payload (scope is passed separately). */
20
+ export interface UpdateWebhookSubscriptionInput {
21
+ url?: string;
22
+ eventTypes?: EventType[];
23
+ description?: string | null;
24
+ active?: boolean;
25
+ }