@grantjs/schema 1.6.2 → 1.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantjs/schema",
3
- "version": "1.6.2",
3
+ "version": "1.8.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,16 +23,17 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@graphql-codegen/add": "^7.1.0",
26
- "@graphql-codegen/cli": "^7.2.0",
26
+ "@graphql-codegen/cli": "^7.4.0",
27
27
  "@graphql-codegen/typed-document-node": "^7.1.0",
28
28
  "@graphql-codegen/typescript": "^6.1.0",
29
29
  "@graphql-codegen/typescript-operations": "^6.1.6",
30
30
  "@graphql-codegen/typescript-resolvers": "^6.1.0",
31
31
  "@parcel/watcher": "^2.6.0",
32
- "@types/node": "^26.2.0",
33
- "eslint": "^10.8.1",
32
+ "@types/node": "^26.4.1",
33
+ "eslint": "^10.10.0",
34
34
  "graphql": "^16.14.2",
35
- "typescript": "^6.0.3",
35
+ "@typescript/native": "npm:typescript@^7.0.2",
36
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
36
37
  "vitest": "^4.1.11"
37
38
  },
38
39
  "scripts": {
@@ -554,6 +554,7 @@ export type MyUserAuthenticationMethodsQuery = {
554
554
  providerId: string;
555
555
  isVerified: boolean;
556
556
  isPrimary: boolean;
557
+ hasPassword: boolean;
557
558
  lastUsedAt: Date | null;
558
559
  createdAt: Date;
559
560
  updatedAt: Date;
@@ -935,7 +936,14 @@ export type CreateOrganizationMutationVariables = Exact<{
935
936
  }>;
936
937
 
937
938
  export type CreateOrganizationMutation = {
938
- createOrganization: { id: string; name: string; slug: string; createdAt: Date; updatedAt: Date };
939
+ createOrganization: {
940
+ id: string;
941
+ name: string;
942
+ slug: string;
943
+ pictureUrl: string | null;
944
+ createdAt: Date;
945
+ updatedAt: Date;
946
+ };
939
947
  };
940
948
 
941
949
  export type DeleteOrganizationMutationVariables = Exact<{
@@ -944,7 +952,14 @@ export type DeleteOrganizationMutationVariables = Exact<{
944
952
  }>;
945
953
 
946
954
  export type DeleteOrganizationMutation = {
947
- deleteOrganization: { id: string; name: string; slug: string; createdAt: Date; updatedAt: Date };
955
+ deleteOrganization: {
956
+ id: string;
957
+ name: string;
958
+ slug: string;
959
+ pictureUrl: string | null;
960
+ createdAt: Date;
961
+ updatedAt: Date;
962
+ };
948
963
  };
949
964
 
950
965
  export type GetOrganizationsQueryVariables = Exact<{
@@ -964,6 +979,7 @@ export type GetOrganizationsQuery = {
964
979
  id: string;
965
980
  name: string;
966
981
  slug: string;
982
+ pictureUrl: string | null;
967
983
  requireMfaForSensitiveActions: boolean;
968
984
  createdAt: Date;
969
985
  updatedAt: Date;
@@ -982,12 +998,21 @@ export type UpdateOrganizationMutation = {
982
998
  id: string;
983
999
  name: string;
984
1000
  slug: string;
1001
+ pictureUrl: string | null;
985
1002
  requireMfaForSensitiveActions: boolean;
986
1003
  createdAt: Date;
987
1004
  updatedAt: Date;
988
1005
  };
989
1006
  };
990
1007
 
1008
+ export type UploadOrganizationPictureMutationVariables = Exact<{
1009
+ input: Types.UploadOrganizationPictureInput;
1010
+ }>;
1011
+
1012
+ export type UploadOrganizationPictureMutation = {
1013
+ uploadOrganizationPicture: { url: string; path: string };
1014
+ };
1015
+
991
1016
  export type CreatePermissionMutationVariables = Exact<{
992
1017
  input: Types.CreatePermissionInput;
993
1018
  }>;
@@ -4148,6 +4173,7 @@ export const MyUserAuthenticationMethodsDocument = {
4148
4173
  { kind: 'Field', name: { kind: 'Name', value: 'providerId' } },
4149
4174
  { kind: 'Field', name: { kind: 'Name', value: 'isVerified' } },
4150
4175
  { kind: 'Field', name: { kind: 'Name', value: 'isPrimary' } },
4176
+ { kind: 'Field', name: { kind: 'Name', value: 'hasPassword' } },
4151
4177
  { kind: 'Field', name: { kind: 'Name', value: 'lastUsedAt' } },
4152
4178
  { kind: 'Field', name: { kind: 'Name', value: 'createdAt' } },
4153
4179
  { kind: 'Field', name: { kind: 'Name', value: 'updatedAt' } },
@@ -5670,6 +5696,7 @@ export const CreateOrganizationDocument = {
5670
5696
  { kind: 'Field', name: { kind: 'Name', value: 'id' } },
5671
5697
  { kind: 'Field', name: { kind: 'Name', value: 'name' } },
5672
5698
  { kind: 'Field', name: { kind: 'Name', value: 'slug' } },
5699
+ { kind: 'Field', name: { kind: 'Name', value: 'pictureUrl' } },
5673
5700
  { kind: 'Field', name: { kind: 'Name', value: 'createdAt' } },
5674
5701
  { kind: 'Field', name: { kind: 'Name', value: 'updatedAt' } },
5675
5702
  ],
@@ -5729,6 +5756,7 @@ export const DeleteOrganizationDocument = {
5729
5756
  { kind: 'Field', name: { kind: 'Name', value: 'id' } },
5730
5757
  { kind: 'Field', name: { kind: 'Name', value: 'name' } },
5731
5758
  { kind: 'Field', name: { kind: 'Name', value: 'slug' } },
5759
+ { kind: 'Field', name: { kind: 'Name', value: 'pictureUrl' } },
5732
5760
  { kind: 'Field', name: { kind: 'Name', value: 'createdAt' } },
5733
5761
  { kind: 'Field', name: { kind: 'Name', value: 'updatedAt' } },
5734
5762
  ],
@@ -5837,6 +5865,7 @@ export const GetOrganizationsDocument = {
5837
5865
  { kind: 'Field', name: { kind: 'Name', value: 'id' } },
5838
5866
  { kind: 'Field', name: { kind: 'Name', value: 'name' } },
5839
5867
  { kind: 'Field', name: { kind: 'Name', value: 'slug' } },
5868
+ { kind: 'Field', name: { kind: 'Name', value: 'pictureUrl' } },
5840
5869
  {
5841
5870
  kind: 'Field',
5842
5871
  name: { kind: 'Name', value: 'requireMfaForSensitiveActions' },
@@ -5918,6 +5947,7 @@ export const UpdateOrganizationDocument = {
5918
5947
  { kind: 'Field', name: { kind: 'Name', value: 'id' } },
5919
5948
  { kind: 'Field', name: { kind: 'Name', value: 'name' } },
5920
5949
  { kind: 'Field', name: { kind: 'Name', value: 'slug' } },
5950
+ { kind: 'Field', name: { kind: 'Name', value: 'pictureUrl' } },
5921
5951
  { kind: 'Field', name: { kind: 'Name', value: 'requireMfaForSensitiveActions' } },
5922
5952
  { kind: 'Field', name: { kind: 'Name', value: 'createdAt' } },
5923
5953
  { kind: 'Field', name: { kind: 'Name', value: 'updatedAt' } },
@@ -5929,6 +5959,55 @@ export const UpdateOrganizationDocument = {
5929
5959
  },
5930
5960
  ],
5931
5961
  } as unknown as DocumentNode<UpdateOrganizationMutation, UpdateOrganizationMutationVariables>;
5962
+ export const UploadOrganizationPictureDocument = {
5963
+ kind: 'Document',
5964
+ definitions: [
5965
+ {
5966
+ kind: 'OperationDefinition',
5967
+ operation: 'mutation',
5968
+ name: { kind: 'Name', value: 'UploadOrganizationPicture' },
5969
+ variableDefinitions: [
5970
+ {
5971
+ kind: 'VariableDefinition',
5972
+ variable: { kind: 'Variable', name: { kind: 'Name', value: 'input' } },
5973
+ type: {
5974
+ kind: 'NonNullType',
5975
+ type: {
5976
+ kind: 'NamedType',
5977
+ name: { kind: 'Name', value: 'UploadOrganizationPictureInput' },
5978
+ },
5979
+ },
5980
+ },
5981
+ ],
5982
+ selectionSet: {
5983
+ kind: 'SelectionSet',
5984
+ selections: [
5985
+ {
5986
+ kind: 'Field',
5987
+ name: { kind: 'Name', value: 'uploadOrganizationPicture' },
5988
+ arguments: [
5989
+ {
5990
+ kind: 'Argument',
5991
+ name: { kind: 'Name', value: 'input' },
5992
+ value: { kind: 'Variable', name: { kind: 'Name', value: 'input' } },
5993
+ },
5994
+ ],
5995
+ selectionSet: {
5996
+ kind: 'SelectionSet',
5997
+ selections: [
5998
+ { kind: 'Field', name: { kind: 'Name', value: 'url' } },
5999
+ { kind: 'Field', name: { kind: 'Name', value: 'path' } },
6000
+ ],
6001
+ },
6002
+ },
6003
+ ],
6004
+ },
6005
+ },
6006
+ ],
6007
+ } as unknown as DocumentNode<
6008
+ UploadOrganizationPictureMutation,
6009
+ UploadOrganizationPictureMutationVariables
6010
+ >;
5932
6011
  export const CreatePermissionDocument = {
5933
6012
  kind: 'Document',
5934
6013
  definitions: [
@@ -521,6 +521,8 @@ export type ResolversTypes = ResolversObject<{
521
521
  UpdateWebhookSubscriptionMutationInput: Types.UpdateWebhookSubscriptionMutationInput;
522
522
  UploadMyProjectMembershipPictureInput: Types.UploadMyProjectMembershipPictureInput;
523
523
  UploadMyUserPictureInput: Types.UploadMyUserPictureInput;
524
+ UploadOrganizationPictureInput: Types.UploadOrganizationPictureInput;
525
+ UploadOrganizationPictureResult: ResolverTypeWrapper<Types.UploadOrganizationPictureResult>;
524
526
  UploadUserPictureInput: Types.UploadUserPictureInput;
525
527
  UploadUserPictureResult: ResolverTypeWrapper<Types.UploadUserPictureResult>;
526
528
  User: ResolverTypeWrapper<Types.User>;
@@ -867,6 +869,8 @@ export type ResolversParentTypes = ResolversObject<{
867
869
  UpdateWebhookSubscriptionMutationInput: Types.UpdateWebhookSubscriptionMutationInput;
868
870
  UploadMyProjectMembershipPictureInput: Types.UploadMyProjectMembershipPictureInput;
869
871
  UploadMyUserPictureInput: Types.UploadMyUserPictureInput;
872
+ UploadOrganizationPictureInput: Types.UploadOrganizationPictureInput;
873
+ UploadOrganizationPictureResult: Types.UploadOrganizationPictureResult;
870
874
  UploadUserPictureInput: Types.UploadUserPictureInput;
871
875
  UploadUserPictureResult: Types.UploadUserPictureResult;
872
876
  User: Types.User;
@@ -1878,6 +1882,12 @@ export type MutationResolvers<
1878
1882
  ContextType,
1879
1883
  RequireFields<Types.MutationUploadMyUserPictureArgs, 'input'>
1880
1884
  >;
1885
+ uploadOrganizationPicture?: Resolver<
1886
+ ResolversTypes['UploadOrganizationPictureResult'],
1887
+ ParentType,
1888
+ ContextType,
1889
+ RequireFields<Types.MutationUploadOrganizationPictureArgs, 'input'>
1890
+ >;
1881
1891
  uploadUserPicture?: Resolver<
1882
1892
  ResolversTypes['UploadUserPictureResult'],
1883
1893
  ParentType,
@@ -1991,6 +2001,7 @@ export type OrganizationResolvers<
1991
2001
  id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
1992
2002
  name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
1993
2003
  permissions?: Resolver<Types.Maybe<Array<ResolversTypes['Permission']>>, ParentType, ContextType>;
2004
+ pictureUrl?: Resolver<Types.Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1994
2005
  projects?: Resolver<Types.Maybe<Array<ResolversTypes['Project']>>, ParentType, ContextType>;
1995
2006
  requireMfaForSensitiveActions?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
1996
2007
  roles?: Resolver<Types.Maybe<Array<ResolversTypes['Role']>>, ParentType, ContextType>;
@@ -3108,6 +3119,15 @@ export type UnreadNotificationCountResolvers<
3108
3119
  unreadCount?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
3109
3120
  }>;
3110
3121
 
3122
+ export type UploadOrganizationPictureResultResolvers<
3123
+ ContextType = any,
3124
+ ParentType extends ResolversParentTypes['UploadOrganizationPictureResult'] =
3125
+ ResolversParentTypes['UploadOrganizationPictureResult'],
3126
+ > = ResolversObject<{
3127
+ path?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
3128
+ url?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
3129
+ }>;
3130
+
3111
3131
  export type UploadUserPictureResultResolvers<
3112
3132
  ContextType = any,
3113
3133
  ParentType extends ResolversParentTypes['UploadUserPictureResult'] =
@@ -3157,6 +3177,7 @@ export type UserAuthenticationMethodResolvers<
3157
3177
  > = ResolversObject<{
3158
3178
  createdAt?: Resolver<ResolversTypes['Date'], ParentType, ContextType>;
3159
3179
  deletedAt?: Resolver<Types.Maybe<ResolversTypes['Date']>, ParentType, ContextType>;
3180
+ hasPassword?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
3160
3181
  id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
3161
3182
  isPrimary?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
3162
3183
  isVerified?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
@@ -3528,6 +3549,7 @@ export type Resolvers<ContextType = any> = ResolversObject<{
3528
3549
  Tag?: TagResolvers<ContextType>;
3529
3550
  TagPage?: TagPageResolvers<ContextType>;
3530
3551
  UnreadNotificationCount?: UnreadNotificationCountResolvers<ContextType>;
3552
+ UploadOrganizationPictureResult?: UploadOrganizationPictureResultResolvers<ContextType>;
3531
3553
  UploadUserPictureResult?: UploadUserPictureResultResolvers<ContextType>;
3532
3554
  User?: UserResolvers<ContextType>;
3533
3555
  UserAuthenticationMethod?: UserAuthenticationMethodResolvers<ContextType>;
@@ -472,7 +472,8 @@ export enum CdmOnConflict {
472
472
 
473
473
  export type ChangeMyPasswordInput = {
474
474
  confirmPassword: Scalars['String']['input'];
475
- currentPassword: Scalars['String']['input'];
475
+ /** Required when a password already exists; omit when setting the first password. */
476
+ currentPassword?: InputMaybe<Scalars['String']['input']>;
476
477
  newPassword: Scalars['String']['input'];
477
478
  };
478
479
 
@@ -1086,6 +1087,8 @@ export type Mutation = {
1086
1087
  updateWebhookSubscription: WebhookSubscription;
1087
1088
  uploadMyProjectMembershipPicture: UploadUserPictureResult;
1088
1089
  uploadMyUserPicture: UploadUserPictureResult;
1090
+ /** Upload an organization logo and persist its public URL. */
1091
+ uploadOrganizationPicture: UploadOrganizationPictureResult;
1089
1092
  uploadUserPicture: UploadUserPictureResult;
1090
1093
  verifyEmail: VerifyEmailResponse;
1091
1094
  verifyMfa: MfaVerifyResponse;
@@ -1411,6 +1414,10 @@ export type MutationUploadMyUserPictureArgs = {
1411
1414
  input: UploadMyUserPictureInput;
1412
1415
  };
1413
1416
 
1417
+ export type MutationUploadOrganizationPictureArgs = {
1418
+ input: UploadOrganizationPictureInput;
1419
+ };
1420
+
1414
1421
  export type MutationUploadUserPictureArgs = {
1415
1422
  input: UploadUserPictureInput;
1416
1423
  };
@@ -1526,6 +1533,7 @@ export type Organization = Auditable & {
1526
1533
  id: Scalars['ID']['output'];
1527
1534
  name: Scalars['String']['output'];
1528
1535
  permissions?: Maybe<Array<Permission>>;
1536
+ pictureUrl?: Maybe<Scalars['String']['output']>;
1529
1537
  projects?: Maybe<Array<Project>>;
1530
1538
  requireMfaForSensitiveActions: Scalars['Boolean']['output'];
1531
1539
  roles?: Maybe<Array<Role>>;
@@ -3436,6 +3444,20 @@ export type UploadMyUserPictureInput = {
3436
3444
  filename: Scalars['String']['input'];
3437
3445
  };
3438
3446
 
3447
+ export type UploadOrganizationPictureInput = {
3448
+ contentType: Scalars['String']['input'];
3449
+ file: Scalars['String']['input'];
3450
+ filename: Scalars['String']['input'];
3451
+ organizationId: Scalars['ID']['input'];
3452
+ scope: Scope;
3453
+ };
3454
+
3455
+ export type UploadOrganizationPictureResult = {
3456
+ __typename?: 'UploadOrganizationPictureResult';
3457
+ path: Scalars['String']['output'];
3458
+ url: Scalars['String']['output'];
3459
+ };
3460
+
3439
3461
  export type UploadUserPictureInput = {
3440
3462
  contentType: Scalars['String']['input'];
3441
3463
  file: Scalars['String']['input'];
@@ -3492,6 +3514,8 @@ export type UserAuthenticationMethod = Auditable & {
3492
3514
  __typename?: 'UserAuthenticationMethod';
3493
3515
  createdAt: Scalars['Date']['output'];
3494
3516
  deletedAt?: Maybe<Scalars['Date']['output']>;
3517
+ /** True when this Email method has a password. Always false for social providers. */
3518
+ hasPassword: Scalars['Boolean']['output'];
3495
3519
  id: Scalars['ID']['output'];
3496
3520
  isPrimary: Scalars['Boolean']['output'];
3497
3521
  isVerified: Scalars['Boolean']['output'];
@@ -6,6 +6,7 @@ query MyUserAuthenticationMethods {
6
6
  providerId
7
7
  isVerified
8
8
  isPrimary
9
+ hasPassword
9
10
  lastUsedAt
10
11
  createdAt
11
12
  updatedAt
@@ -3,6 +3,7 @@ mutation CreateOrganization($input: CreateOrganizationInput!) {
3
3
  id
4
4
  name
5
5
  slug
6
+ pictureUrl
6
7
  createdAt
7
8
  updatedAt
8
9
  }
@@ -3,6 +3,7 @@ mutation DeleteOrganization($id: ID!, $scope: Scope!) {
3
3
  id
4
4
  name
5
5
  slug
6
+ pictureUrl
6
7
  createdAt
7
8
  updatedAt
8
9
  }
@@ -18,6 +18,7 @@ query GetOrganizations(
18
18
  id
19
19
  name
20
20
  slug
21
+ pictureUrl
21
22
  requireMfaForSensitiveActions
22
23
  createdAt
23
24
  updatedAt
@@ -3,6 +3,7 @@ mutation UpdateOrganization($id: ID!, $input: UpdateOrganizationInput!) {
3
3
  id
4
4
  name
5
5
  slug
6
+ pictureUrl
6
7
  requireMfaForSensitiveActions
7
8
  createdAt
8
9
  updatedAt
@@ -0,0 +1,6 @@
1
+ mutation UploadOrganizationPicture($input: UploadOrganizationPictureInput!) {
2
+ uploadOrganizationPicture(input: $input) {
3
+ url
4
+ path
5
+ }
6
+ }
@@ -1,5 +1,8 @@
1
1
  input ChangeMyPasswordInput {
2
- currentPassword: String!
2
+ """
3
+ Required when a password already exists; omit when setting the first password.
4
+ """
5
+ currentPassword: String
3
6
  newPassword: String!
4
7
  confirmPassword: String!
5
8
  }
@@ -0,0 +1,7 @@
1
+ input UploadOrganizationPictureInput {
2
+ scope: Scope!
3
+ organizationId: ID!
4
+ file: String!
5
+ filename: String!
6
+ contentType: String!
7
+ }
@@ -0,0 +1,8 @@
1
+ extend type Mutation {
2
+ """
3
+ Upload an organization logo and persist its public URL.
4
+ """
5
+ uploadOrganizationPicture(
6
+ input: UploadOrganizationPictureInput!
7
+ ): UploadOrganizationPictureResult!
8
+ }
@@ -2,6 +2,7 @@ type Organization implements Auditable {
2
2
  id: ID!
3
3
  name: String!
4
4
  slug: String!
5
+ pictureUrl: String
5
6
  requireMfaForSensitiveActions: Boolean!
6
7
  projects: [Project!]
7
8
  roles: [Role!]
@@ -0,0 +1,4 @@
1
+ type UploadOrganizationPictureResult {
2
+ url: String!
3
+ path: String!
4
+ }
@@ -7,6 +7,10 @@ type UserAuthenticationMethod implements Auditable {
7
7
  providerData: JSON!
8
8
  isVerified: Boolean!
9
9
  isPrimary: Boolean!
10
+ """
11
+ True when this Email method has a password. Always false for social providers.
12
+ """
13
+ hasPassword: Boolean!
10
14
  lastUsedAt: Date
11
15
  createdAt: Date!
12
16
  updatedAt: Date!
@@ -40,9 +40,9 @@ describe('operation documents', () => {
40
40
 
41
41
  // Pinned, not a floor: pass 5 slice 5 removed one file and two query operations
42
42
  // that were superseded by list queries, and a floor would have absorbed that
43
- // silently. 116 before that slice.
43
+ // silently. 116 before that slice, 115 after, 116 with upload-organization-picture.
44
44
  it('finds every document under src/operations', () => {
45
- expect(files).toHaveLength(115);
45
+ expect(files).toHaveLength(116);
46
46
  });
47
47
 
48
48
  it.each(files.map((f) => [relative(process.cwd(), f), f]))('%s validates', (_label, file) => {