@enonic-types/guillotine 8.0.0 → 9.0.0-B1

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/Utils.d.ts CHANGED
@@ -18,6 +18,4 @@ export declare type PartialRecord<K extends keyof any, T> = {
18
18
  [P in K]?: T
19
19
  }
20
20
 
21
- type RecordValueType<T> = T extends Record<string, infer U> ? U : never;
22
-
23
21
  export declare type ValueOf<T> = T[keyof T]
package/advanced.ts CHANGED
@@ -43,27 +43,14 @@ export type {
43
43
  } from './brand'
44
44
 
45
45
  export type {
46
- // AnyResolver, // Not certain this should be exported
47
46
  CreationCallback,
48
47
  CreationCallbacks,
49
48
  DataFetchingEnvironment,
50
- Enum,
51
- Enums,
52
49
  Extensions,
53
- Field,
54
- Fields,
55
- InputType,
56
- InputTypeField,
57
- InputTypeFields,
58
- InputTypes,
59
50
  Resolver,
60
51
  Resolvers,
61
52
  Type,
62
- TypeResolver,
63
- TypeResolvers,
64
53
  Types,
65
- Union,
66
- Unions
67
54
  } from './extensions'
68
55
 
69
56
  export type {
@@ -112,7 +99,7 @@ export type {
112
99
  ContentConnection,
113
100
  ContentEdge,
114
101
  ContentType,
115
- Mixin,
102
+ ExtraData,
116
103
  FormItem,
117
104
  GeoPoint,
118
105
  Icon,
@@ -126,11 +113,11 @@ export type {
126
113
  portal_Site_Data,
127
114
  PrincipalKey,
128
115
  PublishInfo,
129
- Mixin_base_ApplicationConfig,
130
- Mixin_base_gpsInfo_DataConfig,
131
- Mixin_media_ApplicationConfig,
132
- Mixin_media_cameraInfo_DataConfig,
133
- Mixin_media_imageInfo_DataConfig,
116
+ XData_base_ApplicationConfig,
117
+ XData_base_gpsInfo_DataConfig,
118
+ XData_media_ApplicationConfig,
119
+ XData_media_cameraInfo_DataConfig,
120
+ XData_media_imageInfo_DataConfig,
134
121
  } from './guillotine'
135
122
 
136
123
  export type {
@@ -1,13 +1,13 @@
1
1
  import type {GraphQLArgs} from '../graphQL/InputTypes'
2
2
  import type {GraphQLObjectType} from '../graphQL/ObjectTypes'
3
3
  import type {GraphQLInterfaceTypeReference} from '../graphQL/ReferenceTypes'
4
- import type {Fields} from './Field'
4
+ import type {Field} from './Field'
5
5
 
6
6
 
7
7
  export declare interface CreationCallback {
8
8
  (params: {
9
- addFields: (newFields: Fields) => void
10
- modifyFields: (existingFields: Fields) => void
9
+ addFields: (newFields: Record<string, Field>) => void
10
+ modifyFields: (existingFields: Record<string, Field>) => void
11
11
  removeFields: (existingFields: string[]) => void
12
12
  setDescription: (newDescription: string) => void
13
13
  setInterfaces: (reWrittenInterfaces: GraphQLInterfaceTypeReference[]) => void
@@ -4,7 +4,7 @@ import type {GraphQLObjectTypeReference} from '../graphQL/ReferenceTypes'
4
4
  import type {GraphQLScalars} from '../graphQL/ScalarTypes'
5
5
 
6
6
 
7
- export declare interface Field {
7
+ export interface Field {
8
8
  args?: GraphQLArgs
9
9
  type:
10
10
  | GraphQLScalars
@@ -13,5 +13,3 @@ export declare interface Field {
13
13
  // | GraphQLEnumType doesn't make sense here?
14
14
  // | GraphQLInputType doesn't make sense here.
15
15
  }
16
-
17
- export declare type Fields = Record<string, Field>
@@ -8,19 +8,14 @@ import type {
8
8
  } from '../graphQL/'
9
9
 
10
10
 
11
- export declare type InputTypeField =
12
- | GraphQLEnumTypeReference<GraphQLEnumType>
13
- | GraphQLInputTypeReference<GraphQLInputType>
14
- | GraphQLScalars
15
-
16
- export declare type InputTypeFields = Record<
17
- string, // Could make a global InputTypeFieldsMap
18
- InputTypeField
19
- >
20
-
21
11
  export declare interface InputType {
22
12
  description?: string
23
- fields: InputTypeFields
13
+ fields: Record<
14
+ string, // Could make a global InputTypeFieldsMap
15
+ | GraphQLEnumTypeReference<GraphQLEnumType>
16
+ | GraphQLInputTypeReference<GraphQLInputType>
17
+ | GraphQLScalars
18
+ >
24
19
  }
25
20
 
26
21
  export declare type InputTypes = Record<GraphQLInputTypeName,InputType>
@@ -1,13 +1,13 @@
1
1
  import type {
2
2
  GraphQLInterfaceTypeName
3
3
  } from '../graphQL/InterfaceTypes'
4
- import type {Fields} from './Field'
4
+ import type {Field} from './Field'
5
5
 
6
6
 
7
7
  export declare type Interfaces = Record<
8
8
  GraphQLInterfaceTypeName,
9
9
  {
10
10
  description: string
11
- fields: Fields
11
+ fields: Record<string, Field>
12
12
  }
13
13
  >
@@ -1,16 +1,31 @@
1
- /// <reference path="./Global.Modifying.d.ts"/>
2
-
3
1
  import type {
4
2
  PartialRecord,
5
3
  ValueOf,
6
4
  } from '../Utils'
7
- import type {AnyResolver} from './Resolver'
5
+ import type {LocalContext} from '../graphQL/LocalContext'
6
+
7
+
8
+ export declare interface DataFetchingEnvironment<
9
+ Args extends Record<string, any> = Record<string, any>,
10
+ Source extends unknown = unknown,
11
+ > {
12
+ args: Args
13
+ localContext: LocalContext
14
+ source: Source
15
+ }
8
16
 
17
+ export declare interface Resolver<
18
+ Args extends Record<string, any> = Record<string, any>,
19
+ Source extends unknown = unknown,
20
+ Return = any
21
+ > {
22
+ (env: DataFetchingEnvironment<Args,Source>): Return
23
+ }
9
24
 
10
25
  export declare type Resolvers = PartialRecord<
11
26
  keyof GraphQLObjectTypeFieldsMap,
12
27
  Record<
13
28
  keyof ValueOf<GraphQLObjectTypeFieldsMap>,
14
- AnyResolver
29
+ Resolver
15
30
  >
16
31
  >
@@ -3,12 +3,12 @@ import type {
3
3
  GraphQLInterfaceTypeReference,
4
4
  GraphQLObjectType,
5
5
  } from '../graphQL'
6
- import type {Fields} from './Field'
6
+ import type {Field} from './Field'
7
7
 
8
8
 
9
9
  export declare interface Type {
10
10
  description: string
11
- fields: Fields
11
+ fields: Record<string, Field>
12
12
  interfaces: GraphQLInterfaceTypeReference<GraphQLInterfaceType>[]
13
13
  }
14
14
 
@@ -18,24 +18,16 @@ export type {
18
18
  Enums,
19
19
  } from './Enums'
20
20
 
21
- export type {
22
- Field,
23
- Fields,
24
- }
25
-
26
21
  export type {
27
22
  InputType,
28
- InputTypeField,
29
- InputTypeFields,
30
23
  InputTypes,
31
24
  } from './InputTypes'
32
25
 
33
- export type {DataFetchingEnvironment} from './DataFetchingEnvironment'
34
26
  export type {
35
- AnyResolver,
36
- Resolver
37
- } from './Resolver'
38
- export type {Resolvers} from './Resolvers'
27
+ DataFetchingEnvironment,
28
+ Resolver,
29
+ Resolvers,
30
+ } from './Resolvers'
39
31
 
40
32
  export type {
41
33
  Type,
@@ -1,54 +1,23 @@
1
- // Make sure ScriptValue type exists in global scope:
2
1
  /// <reference types="@enonic-types/global"/>
3
2
 
4
3
 
4
+ import type {ScriptValue} from '@enonic-types/core'
5
5
  import type {
6
6
  LocalContext,
7
7
  LocalContextRecord,
8
8
  } from './LocalContext'
9
9
 
10
10
 
11
- // https://developer.enonic.com/docs/guillotine/stable/extending/resolvers#createdatafetcherresult
12
- //
13
- // If parentLocalContext is not provided, then localContext will override
14
- // parentLocalContext.
15
- //
16
- // Otherwise, localContext will be merged with parentLocalContext and
17
- // localContext will override parentLocalContext if they have the same keys.
18
- //
19
- // If localContext is not provided, then parentLocalContext will be used as
20
- // localContext.
21
-
22
-
23
11
  export declare interface CreateDataFetcherResultParams<
24
- DATA extends any,
25
- LOCAL_CONTEXT extends LocalContextRecord = LocalContext,
26
- PARENT_LOCAL_CONTEXT extends LocalContextRecord = LocalContext
27
- > {
28
- data: ScriptValue // NOTE: ScriptValue type is expected to exist in global scope
29
- localContext?: LocalContext<LOCAL_CONTEXT>
30
- parentLocalContext?: LocalContext<PARENT_LOCAL_CONTEXT>
31
- }
32
-
33
- // NOTE: Same as DataFetchingEnvironment without args.
34
- export interface DataFetcherResult<
35
- DATA extends any,
36
- LOCAL_CONTEXT extends LocalContextRecord = LocalContext
12
+ In extends LocalContextRecord = LocalContext,
13
+ Out extends LocalContextRecord = LocalContext
37
14
  > {
38
- // args, // Depends on the field resolver
39
- localContext: LocalContext<LOCAL_CONTEXT>
40
- source: DATA,
15
+ data: ScriptValue
16
+ localContext?: LocalContext<Out>
17
+ parentLocalContext?: LocalContext<In>
41
18
  }
42
19
 
43
20
  export declare type CreateDataFetcherResult = <
44
- DATA extends any,
45
- LOCAL_CONTEXT extends LocalContextRecord = LocalContext,
46
- PARENT_LOCAL_CONTEXT extends LocalContextRecord = LocalContext
47
- >(params: CreateDataFetcherResultParams<
48
- DATA,
49
- LOCAL_CONTEXT,
50
- PARENT_LOCAL_CONTEXT
51
- >) => DataFetcherResult<
52
- DATA,
53
- LocalContext<PARENT_LOCAL_CONTEXT & LOCAL_CONTEXT>
54
- >
21
+ In extends LocalContextRecord = LocalContext,
22
+ Out extends LocalContextRecord = LocalContext
23
+ >(params: CreateDataFetcherResultParams<In,Out>) => LocalContext<In&Out>
@@ -1,19 +1,9 @@
1
1
  export declare type LocalContextRecord = Record<string,string|number|boolean|null>
2
2
 
3
-
4
- // The documentation:
5
- // https://developer.enonic.com/docs/guillotine/stable/extending/resolvers
6
- //
7
- // Says:
8
- // If parentLocalContext is not provided, then localContext will override
9
- // parentLocalContext.
10
- //
11
- // This means that is possible to remove branch, project and siteKey in some
12
- // parent createDataFetcherResult. Which is why the Partial<> is used.
13
3
  export declare type LocalContext<
14
4
  T extends LocalContextRecord = LocalContextRecord
15
- > = Partial<{
5
+ > = {
16
6
  branch: string
17
7
  project: string
18
8
  siteKey?: string
19
- }> & T
9
+ } & T
@@ -12,11 +12,7 @@ import type {
12
12
  PartialRecord,
13
13
  ValueOf,
14
14
  } from '../Utils'
15
- import type {
16
- CreateDataFetcherResult,
17
- CreateDataFetcherResultParams,
18
- DataFetcherResult,
19
- } from './CreateDataFetcherResult'
15
+ import type {CreateDataFetcherResult} from './CreateDataFetcherResult'
20
16
  import type {
21
17
  GraphQLEnumType,
22
18
  GraphQLEnumTypeName,
@@ -13,7 +13,6 @@ export enum EnumTypeName {
13
13
  MediaIntentType = 'MediaIntentType',
14
14
  Permission = 'Permission',
15
15
  PrincipalType = 'PrincipalType',
16
- UrlType = 'UrlType',
17
16
  }
18
17
 
19
18
  export declare type EnumTypeNames = keyof typeof EnumTypeName
@@ -28,6 +27,12 @@ export enum FormItemType {
28
27
  OptionSet = 'OptionSet',
29
28
  }
30
29
 
30
+ // This is a value, do not add declare.
31
+ export enum MediaIntentType {
32
+ download = 'download',
33
+ inline = 'inline',
34
+ }
35
+
31
36
  // This is a value, do not add declare.
32
37
  export enum Permission {
33
38
  READ = 'READ',
@@ -14,7 +14,7 @@ export type {
14
14
  ContentConnection,
15
15
  ContentEdge,
16
16
  ContentType,
17
- Mixin,
17
+ ExtraData,
18
18
  FormItem,
19
19
  GeoPoint,
20
20
  Icon,
@@ -28,11 +28,11 @@ export type {
28
28
  portal_Site_Data,
29
29
  PrincipalKey,
30
30
  PublishInfo,
31
- Mixin_base_ApplicationConfig,
32
- Mixin_base_gpsInfo_DataConfig,
33
- Mixin_media_ApplicationConfig,
34
- Mixin_media_cameraInfo_DataConfig,
35
- Mixin_media_imageInfo_DataConfig,
31
+ XData_base_ApplicationConfig,
32
+ XData_base_gpsInfo_DataConfig,
33
+ XData_media_ApplicationConfig,
34
+ XData_media_cameraInfo_DataConfig,
35
+ XData_media_imageInfo_DataConfig,
36
36
  } from './objectTypes'
37
37
 
38
38
  export type {
@@ -44,6 +44,7 @@ export type {
44
44
  export {
45
45
  EnumTypeName,
46
46
  FormItemType,
47
+ MediaIntentType,
47
48
  Permission,
48
49
  PrincipalType,
49
50
  } from './enumTypes'
@@ -5,6 +5,7 @@ import type {
5
5
  } from '../brand'
6
6
  import type {
7
7
  FormItemType,
8
+ MediaIntentType,
8
9
  Permission,
9
10
  PrincipalType,
10
11
  } from './enumTypes'
@@ -28,6 +29,7 @@ import type {
28
29
  export enum ObjectTypeName {
29
30
  AccessControlEntry = 'AccessControlEntry',
30
31
  Attachment = 'Attachment',
32
+ AttachmentUrl = 'AttachmentUrl',
31
33
  base_Folder = 'base_Folder',
32
34
  base_Media = 'base_Media',
33
35
  base_Shortcut = 'base_Shortcut',
@@ -54,6 +56,7 @@ export enum ObjectTypeName {
54
56
  Image = 'Image',
55
57
  ImageComponentData = 'ImageComponentData',
56
58
  ImageStyle = 'ImageStyle',
59
+ ImageUrl = 'ImageUrl',
57
60
  LayoutComponentData = 'LayoutComponentData',
58
61
  LayoutComponentDataConfig = 'LayoutComponentDataConfig',
59
62
  Link = 'Link',
@@ -97,6 +100,7 @@ export enum ObjectTypeName {
97
100
  PageComponentData = 'PageComponentData',
98
101
  PageComponentDataConfig = 'PageComponentDataConfig',
99
102
  PageInfo = 'PageInfo',
103
+ PageUrl = 'PageUrl',
100
104
  PartComponentData = 'PartComponentData',
101
105
  PartComponentDataConfig = 'PartComponentDataConfig',
102
106
  Permissions = 'Permissions',
@@ -115,11 +119,11 @@ export enum ObjectTypeName {
115
119
  SiteConfigurator = 'SiteConfigurator',
116
120
  TextComponentData = 'TextComponentData',
117
121
  UntypedContent = 'UntypedContent',
118
- Mixin_base_ApplicationConfig = 'Mixin_base_ApplicationConfig',
119
- Mixin_base_gpsInfo_DataConfig = 'Mixin_base_gpsInfo_DataConfig',
120
- Mixin_media_ApplicationConfig = 'Mixin_media_ApplicationConfig',
121
- Mixin_media_cameraInfo_DataConfig = 'Mixin_media_cameraInfo_DataConfig',
122
- Mixin_media_imageInfo_DataConfig = 'Mixin_media_imageInfo_DataConfig',
122
+ Mixin_base_ApplicationConfig = 'Mixin_base_ApplicationConfig',
123
+ Mixin_base_gpsInfo_DataConfig = 'Mixin_base_gpsInfo_DataConfig',
124
+ Mixin_media_ApplicationConfig = 'Mixin_media_ApplicationConfig',
125
+ Mixin_media_cameraInfo_DataConfig = 'Mixin_media_cameraInfo_DataConfig',
126
+ Mixin_media_imageInfo_DataConfig = 'Mixin_media_imageInfo_DataConfig',
123
127
  }
124
128
 
125
129
  export declare type ObjectTypeNames = keyof typeof ObjectTypeName
@@ -137,7 +141,19 @@ export declare interface Attachment {
137
141
  label: GraphQLString
138
142
  size: GraphQLInt
139
143
  mimeType: GraphQLString
140
- attachmentUrl: GraphQLString
144
+ sha512: GraphQLString
145
+ attachmentUrl: AttachmentUrl
146
+ }
147
+
148
+ export declare interface AttachmentUrl {
149
+ url: GraphQLString
150
+ path: GraphQLString
151
+ queryString: GraphQLString
152
+ context: GraphQLString
153
+ id: GraphQLString
154
+ fingerprint: GraphQLString
155
+ name: GraphQLString
156
+ intent: MediaIntentType
141
157
  }
142
158
 
143
159
  export declare type Content<
@@ -165,14 +181,14 @@ export declare type Content<
165
181
  owner: PrincipalKey
166
182
  pageAsJson: GraphQLJson
167
183
  pageTemplate: Content
168
- pageUrl: GraphQLString
184
+ pageUrl: PageUrl
169
185
  parent: Content
170
186
  permissions: Permissions
171
187
  publish: PublishInfo
172
188
  site: portal_Site
173
189
  type: GraphQLString
174
190
  valid: GraphQLBoolean
175
- x: Mixin
191
+ x: Mixin
176
192
  xAsJson: GraphQLJson
177
193
  } & Extensions,
178
194
  CoreContent
@@ -190,28 +206,27 @@ export declare interface ContentEdge {
190
206
  }
191
207
 
192
208
  export declare interface ContentType {
193
- name: GraphQLString
194
- title: GraphQLString
195
- titleI18nKey: GraphQLString
196
- displayName: GraphQLString
197
- description: GraphQLString
198
- descriptionI18nKey: GraphQLString
199
- superType: GraphQLString
200
- abstract: GraphQLBoolean
201
- final: GraphQLBoolean
202
- allowChildContent: GraphQLBoolean
209
+ name: GraphQLString
210
+ title: GraphQLString
211
+ titleI18nKey: GraphQLString
212
+ description: GraphQLString
213
+ descriptionI18nKey: GraphQLString
214
+ superType: GraphQLString
215
+ abstract: GraphQLBoolean
216
+ final: GraphQLBoolean
217
+ allowChildContent: GraphQLBoolean
203
218
  displayNameExpression: GraphQLString
204
219
  displayNameListExpression: GraphQLString
205
220
  displayNamePlaceholder: GraphQLString
206
221
  displayNamePlaceholderI18nKey: GraphQLString
207
- icon: Icon
208
- form: FormItem[]
209
- formAsJson: GraphQLJson
222
+ icon: Icon
223
+ form: FormItem[]
224
+ formAsJson: GraphQLJson
210
225
  }
211
226
 
212
227
  export declare interface Mixin {
213
- media: Mixin_media_ApplicationConfig
214
- base: Mixin_base_ApplicationConfig
228
+ media: Mixin_media_ApplicationConfig
229
+ base: Mixin_base_ApplicationConfig
215
230
  }
216
231
 
217
232
  export declare interface FormItem {
@@ -231,12 +246,23 @@ export declare interface Icon {
231
246
  modifiedTime: GraphQLString
232
247
  }
233
248
 
249
+ export declare interface ImageUrl {
250
+ url: GraphQLString
251
+ path: GraphQLString
252
+ queryString: GraphQLString
253
+ context: GraphQLString
254
+ id: GraphQLString
255
+ fingerprint: GraphQLString
256
+ scale: GraphQLString
257
+ name: GraphQLString
258
+ }
259
+
234
260
  export declare type media_Image = BrandGraphQLObjectType<
235
261
  'media_Image',
236
262
  {
237
263
  data: media_Image_Data
238
- imageUrl: GraphQLString
239
- mediaUrl: GraphQLString
264
+ imageUrl: ImageUrl
265
+ mediaUrl: AttachmentUrl
240
266
  },
241
267
  MediaImageContent
242
268
  >
@@ -266,6 +292,12 @@ export declare interface PageInfo {
266
292
  hasNext: NonNull<GraphQLBoolean>
267
293
  }
268
294
 
295
+ export declare interface PageUrl {
296
+ url: GraphQLString
297
+ path: GraphQLString
298
+ queryString: GraphQLString
299
+ }
300
+
269
301
  export declare interface Permissions {
270
302
  inheritsPermissions: GraphQLBoolean
271
303
  permissions: AccessControlEntry[]
@@ -297,18 +329,18 @@ export declare interface PublishInfo {
297
329
  }
298
330
 
299
331
  export declare interface Mixin_base_ApplicationConfig {
300
- gpsInfo: Mixin_base_gpsInfo_DataConfig
332
+ gpsInfo: Mixin_base_gpsInfo_DataConfig
301
333
  }
302
334
 
303
335
  export declare interface Mixin_base_gpsInfo_DataConfig {
304
- geoPoint: GeoPoint
305
- altitude: GraphQLString
306
- direction: GraphQLString
336
+ geoPoint: GeoPoint
337
+ altitude: GraphQLString
338
+ direction: GraphQLString
307
339
  }
308
340
 
309
341
  export declare interface Mixin_media_ApplicationConfig {
310
- imageInfo: Mixin_media_imageInfo_DataConfig
311
- cameraInfo: Mixin_media_cameraInfo_DataConfig
342
+ imageInfo: Mixin_media_imageInfo_DataConfig
343
+ cameraInfo: Mixin_media_cameraInfo_DataConfig
312
344
  }
313
345
 
314
346
  export declare interface Mixin_media_cameraInfo_DataConfig {
package/index.ts CHANGED
@@ -1,8 +1,7 @@
1
- // Make sure ScriptValue type exists in global scope:
2
1
  /// <reference types="@enonic-types/global"/>
3
2
 
4
- import type {CreateDataFetcherResult} from './graphQL/CreateDataFetcherResult'
5
- import type {AnyResolver} from './extensions/Resolver'
3
+ import type {ScriptValue} from '@enonic-types/core'
4
+
6
5
 
7
6
  declare const __name: unique symbol
8
7
 
@@ -13,22 +12,6 @@ declare type BrandGraphQLScalarType<
13
12
  [__name]: GQL_SCALAR_TYPE_NAME
14
13
  }
15
14
 
16
-
17
- export type {
18
- CreateDataFetcherResult,
19
- CreateDataFetcherResultParams,
20
- DataFetcherResult,
21
- } from './graphQL/CreateDataFetcherResult'
22
-
23
- export type {
24
- LocalContext,
25
- LocalContextRecord,
26
- } from './graphQL/LocalContext'
27
-
28
- export type {DataFetchingEnvironment} from './extensions/DataFetchingEnvironment'
29
- export type {Resolver} from './extensions/Resolver'
30
-
31
-
32
15
  export declare type GraphQLBoolean = BrandGraphQLScalarType<'GraphQLBoolean', boolean>
33
16
  export declare type GraphQLDate = BrandGraphQLScalarType<'Date', string>
34
17
  export declare type GraphQLDateTime = BrandGraphQLScalarType<'DateTime', string>
@@ -53,7 +36,14 @@ export declare interface GraphQL {
53
36
  Json: GraphQLJson
54
37
  LocalDateTime: GraphQLLocalDateTime
55
38
  LocalTime: GraphQLLocalTime
56
- createDataFetcherResult: CreateDataFetcherResult
39
+ createDataFetcherResult: <
40
+ In extends LocalContextRecord = LocalContext,
41
+ Out extends LocalContextRecord = LocalContext
42
+ > () => {
43
+ data: ScriptValue
44
+ localContext?: LocalContext<Out>
45
+ parentLocalContext?: LocalContext<In>
46
+ }
57
47
  nonNull: (type: GraphQLType) => GraphQLType
58
48
  list: (type: GraphQLType) => GraphQLType[]
59
49
  reference: (typeName: string) => GraphQLType
@@ -61,81 +51,95 @@ export declare interface GraphQL {
61
51
 
62
52
  export declare type GraphQLArgs = Record<string, GraphQLType | GraphQLType[]>
63
53
 
64
- export declare interface Field {
65
- args?: GraphQLArgs
66
- type: GraphQLType | GraphQLType[]
67
- }
68
-
69
- export declare type Fields = Record<string, Field>
70
-
71
54
  export declare interface CreationCallback {
72
55
  (params: {
73
- addFields: (newFields: Fields) => void
74
- modifyFields: (existingFields: Fields) => void
56
+ addFields: (newFields: Record<string, {
57
+ args?: GraphQLArgs
58
+ type: GraphQLType | GraphQLType[]
59
+ }>) => void
60
+ modifyFields: (existingFields: Record<string, {
61
+ args?: GraphQLArgs
62
+ type: GraphQLType | GraphQLType[]
63
+ }>) => void
75
64
  removeFields: (existingFields: string[]) => void
76
65
  setDescription: (newDescription: string) => void
77
66
  setInterfaces: (reWrittenInterfaces: GraphQLType[]) => void
78
67
  }): void
79
68
  }
80
69
 
81
- export declare type CreationCallbacks = Record<string, CreationCallback>
82
-
83
70
  export declare interface Enum {
84
71
  description: string
85
72
  values: Record<string, string>
86
73
  }
87
74
 
88
- export declare type Enums = Record<string, Enum>
89
-
90
- export declare interface Type {
91
- description: string
92
- fields: Fields
75
+ export declare type LocalContextRecord = Record<string,string|number|boolean|null>
76
+
77
+ export declare type LocalContext<
78
+ T extends LocalContextRecord = LocalContextRecord
79
+ > = {
80
+ branch: string
81
+ project: string
82
+ siteKey?: string
83
+ } & T
84
+
85
+ export declare interface DataFetchingEnvironment<
86
+ Args extends Record<string, any> = Record<string, any>,
87
+ Source extends unknown = unknown,
88
+ > {
89
+ args: Args
90
+ localContext: LocalContext
91
+ source: Source
93
92
  }
94
93
 
95
- export declare type Types = Record<string, Type>
96
-
97
- export declare interface InputTypeField {
98
- type: GraphQLType | GraphQLType[]
94
+ export declare interface Resolver<
95
+ Args extends Record<string, any> = Record<string, any>,
96
+ Source extends unknown = unknown,
97
+ Return = any
98
+ > {
99
+ (env: DataFetchingEnvironment<Args,Source>): Return
99
100
  }
100
101
 
101
- export declare type InputTypeFields = Record<string, InputTypeField>
102
-
103
- export declare interface InputType {
104
- description?: string
105
- fields: InputTypeFields
106
- }
107
-
108
- export declare type InputTypes = Record<string, InputType>
109
-
110
- export declare interface Interface {
111
- description: string
112
- fields: Fields
113
- }
114
-
115
- export declare type Interfaces = Record<string, Interface>
116
-
117
- export declare interface Union {
118
- description: string
119
- types: GraphQLType[]
120
- }
121
-
122
- export declare type Unions = Record<string, Union>
123
-
124
102
  export declare interface Extensions {
125
- creationCallbacks?: CreationCallbacks
126
- enums?: Enums
127
- inputTypes?: InputTypes
128
- interfaces?: Interfaces
103
+ creationCallbacks?: Record<string, CreationCallback>
104
+ enums?: Record<
105
+ string,
106
+ Enum
107
+ >
108
+ inputTypes?: Record<
109
+ string,
110
+ {
111
+ description?: string
112
+ fields: Record<
113
+ string,
114
+ GraphQLType | GraphQLType[]
115
+ >
116
+ }
117
+ >
118
+ interfaces?: Record<string, {
119
+ description: string
120
+ fields: Record<string, {
121
+ args?: GraphQLArgs
122
+ type: GraphQLType | GraphQLType[]
123
+ }>
124
+ }>
129
125
  resolvers?: Record<
130
126
  string,
131
127
  Record<
132
128
  string,
133
- AnyResolver
129
+ Resolver
134
130
  >
135
131
  >
136
132
  typeResolvers?: Record<string, (param: any) => string>
137
- types?: Types
138
- unions?: Unions
133
+ types?: Record<string, {
134
+ description: string
135
+ fields: Record<string, {
136
+ type: GraphQLType | GraphQLType[]
137
+ }>
138
+ }>
139
+ unions?: Record<string, {
140
+ description: string
141
+ types: GraphQLType[]
142
+ }>
139
143
  }
140
144
 
141
145
 
package/package.json CHANGED
@@ -45,5 +45,5 @@
45
45
  "test": "tsd ./"
46
46
  },
47
47
  "types": "index.ts",
48
- "version": "8.0.0"
48
+ "version": "9.0.0-B1"
49
49
  }
@@ -1,15 +0,0 @@
1
- import type {
2
- LocalContext,
3
- LocalContextRecord
4
- } from '../graphQL/LocalContext'
5
-
6
-
7
- export declare interface DataFetchingEnvironment<
8
- ARGS extends Record<string, any> = Record<string, any>,
9
- LOCAL_CONTEXT extends LocalContextRecord = LocalContextRecord,
10
- SOURCE = any,
11
- > {
12
- args: ARGS
13
- localContext: LocalContext<LOCAL_CONTEXT>
14
- source: SOURCE
15
- }
@@ -1,21 +0,0 @@
1
- import type {LocalContextRecord} from '../graphQL/LocalContext'
2
- import type {DataFetchingEnvironment} from './DataFetchingEnvironment'
3
-
4
-
5
- export declare interface AnyResolver<
6
- ARGS extends Record<string, any> = Record<string, any>,
7
- LOCAL_CONTEXT extends LocalContextRecord = any,
8
- SOURCE = any,
9
- RETURN_TYPE = any
10
- > {
11
- (env: DataFetchingEnvironment<ARGS,LOCAL_CONTEXT,SOURCE>): RETURN_TYPE
12
- }
13
-
14
- export declare interface Resolver<
15
- ARGS extends Record<string, any>,
16
- LOCAL_CONTEXT extends LocalContextRecord,
17
- SOURCE,
18
- RETURN_TYPE
19
- > {
20
- (env: DataFetchingEnvironment<ARGS,LOCAL_CONTEXT,SOURCE>): RETURN_TYPE
21
- }