@enonic-types/guillotine 7.1.0-B1 → 7.1.0-B2

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,4 +18,6 @@ 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
+
21
23
  export declare type ValueOf<T> = T[keyof T]
package/advanced.ts CHANGED
@@ -43,14 +43,27 @@ export type {
43
43
  } from './brand'
44
44
 
45
45
  export type {
46
+ // AnyResolver, // Not certain this should be exported
46
47
  CreationCallback,
47
48
  CreationCallbacks,
48
49
  DataFetchingEnvironment,
50
+ Enum,
51
+ Enums,
49
52
  Extensions,
53
+ Field,
54
+ Fields,
55
+ InputType,
56
+ InputTypeField,
57
+ InputTypeFields,
58
+ InputTypes,
50
59
  Resolver,
51
60
  Resolvers,
52
61
  Type,
62
+ TypeResolver,
63
+ TypeResolvers,
53
64
  Types,
65
+ Union,
66
+ Unions
54
67
  } from './extensions'
55
68
 
56
69
  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 {Field} from './Field'
4
+ import type {Fields} from './Field'
5
5
 
6
6
 
7
7
  export declare interface CreationCallback {
8
8
  (params: {
9
- addFields: (newFields: Record<string, Field>) => void
10
- modifyFields: (existingFields: Record<string, Field>) => void
9
+ addFields: (newFields: Fields) => void
10
+ modifyFields: (existingFields: Fields) => void
11
11
  removeFields: (existingFields: string[]) => void
12
12
  setDescription: (newDescription: string) => void
13
13
  setInterfaces: (reWrittenInterfaces: GraphQLInterfaceTypeReference[]) => void
@@ -0,0 +1,15 @@
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
+ }
@@ -4,7 +4,7 @@ import type {GraphQLObjectTypeReference} from '../graphQL/ReferenceTypes'
4
4
  import type {GraphQLScalars} from '../graphQL/ScalarTypes'
5
5
 
6
6
 
7
- export interface Field {
7
+ export declare interface Field {
8
8
  args?: GraphQLArgs
9
9
  type:
10
10
  | GraphQLScalars
@@ -13,3 +13,5 @@ export 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,14 +8,19 @@ 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
+
11
21
  export declare interface InputType {
12
22
  description?: string
13
- fields: Record<
14
- string, // Could make a global InputTypeFieldsMap
15
- | GraphQLEnumTypeReference<GraphQLEnumType>
16
- | GraphQLInputTypeReference<GraphQLInputType>
17
- | GraphQLScalars
18
- >
23
+ fields: InputTypeFields
19
24
  }
20
25
 
21
26
  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 {Field} from './Field'
4
+ import type {Fields} from './Field'
5
5
 
6
6
 
7
7
  export declare type Interfaces = Record<
8
8
  GraphQLInterfaceTypeName,
9
9
  {
10
10
  description: string
11
- fields: Record<string, Field>
11
+ fields: Fields
12
12
  }
13
13
  >
@@ -0,0 +1,21 @@
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
+ }
@@ -1,33 +1,16 @@
1
+ /// <reference path="./Global.Modifying.d.ts"/>
2
+
1
3
  import type {
2
4
  PartialRecord,
3
5
  ValueOf,
4
6
  } from '../Utils'
5
- import type {LocalContext} from '../graphQL/LocalContext'
6
-
7
-
8
- export declare interface DataFetchingEnvironment<
9
- ARGS extends Record<string, any> = Record<string, any>,
10
- LOCAL_CONTEXT extends LocalContextRecord = LocalContextRecord,
11
- SOURCE extends unknown = unknown,
12
- > {
13
- args: ARGS
14
- localContext: LocalContext<LOCAL_CONTEXT>
15
- source: SOURCE
16
- }
7
+ import type {AnyResolver} from './Resolver'
17
8
 
18
- export declare interface Resolver<
19
- ARGS extends Record<string, any> = Record<string, any>,
20
- LOCAL_CONTEXT extends LocalContextRecord = LocalContextRecord,
21
- SOURCE extends unknown = unknown,
22
- RETURN_TYPE = any
23
- > {
24
- (env: DataFetchingEnvironment<ARGS,LOCAL_CONTEXT,SOURCE>): RETURN_TYPE
25
- }
26
9
 
27
10
  export declare type Resolvers = PartialRecord<
28
11
  keyof GraphQLObjectTypeFieldsMap,
29
12
  Record<
30
13
  keyof ValueOf<GraphQLObjectTypeFieldsMap>,
31
- Resolver
14
+ AnyResolver
32
15
  >
33
16
  >
@@ -3,12 +3,12 @@ import type {
3
3
  GraphQLInterfaceTypeReference,
4
4
  GraphQLObjectType,
5
5
  } from '../graphQL'
6
- import type {Field} from './Field'
6
+ import type {Fields} from './Field'
7
7
 
8
8
 
9
9
  export declare interface Type {
10
10
  description: string
11
- fields: Record<string, Field>
11
+ fields: Fields
12
12
  interfaces: GraphQLInterfaceTypeReference<GraphQLInterfaceType>[]
13
13
  }
14
14
 
@@ -18,16 +18,24 @@ export type {
18
18
  Enums,
19
19
  } from './Enums'
20
20
 
21
+ export type {
22
+ Field,
23
+ Fields,
24
+ }
25
+
21
26
  export type {
22
27
  InputType,
28
+ InputTypeField,
29
+ InputTypeFields,
23
30
  InputTypes,
24
31
  } from './InputTypes'
25
32
 
33
+ export type {DataFetchingEnvironment} from './DataFetchingEnvironment'
26
34
  export type {
27
- DataFetchingEnvironment,
28
- Resolver,
29
- Resolvers,
30
- } from './Resolvers'
35
+ AnyResolver,
36
+ Resolver
37
+ } from './Resolver'
38
+ export type {Resolvers} from './Resolvers'
31
39
 
32
40
  export type {
33
41
  Type,
@@ -47,7 +47,7 @@ export declare type CreateDataFetcherResult = <
47
47
  >(params: CreateDataFetcherResultParams<
48
48
  DATA,
49
49
  LOCAL_CONTEXT,
50
- PARENT_LOCAL_CONTEXT,
50
+ PARENT_LOCAL_CONTEXT
51
51
  >) => DataFetcherResult<
52
52
  DATA,
53
53
  LocalContext<PARENT_LOCAL_CONTEXT & LOCAL_CONTEXT>
package/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /// <reference types="@enonic-types/global"/>
3
3
 
4
4
  import type {CreateDataFetcherResult} from './graphQL/CreateDataFetcherResult'
5
- import type {Resolver} from './extensions/Resolvers'
5
+ import type {AnyResolver} from './extensions/Resolver'
6
6
 
7
7
  declare const __name: unique symbol
8
8
 
@@ -25,11 +25,8 @@ export type {
25
25
  LocalContextRecord,
26
26
  } from './graphQL/LocalContext'
27
27
 
28
- export type {
29
- DataFetchingEnvironment,
30
- Resolver,
31
- // Resolvers, // NOTE: This is not exported because it the advanced version of Resolvers
32
- } from './extensions/Resolvers'
28
+ export type {DataFetchingEnvironment} from './extensions/DataFetchingEnvironment'
29
+ export type {Resolver} from './extensions/Resolver'
33
30
 
34
31
 
35
32
  export declare type GraphQLBoolean = BrandGraphQLScalarType<'GraphQLBoolean', boolean>
@@ -64,68 +61,81 @@ export declare interface GraphQL {
64
61
 
65
62
  export declare type GraphQLArgs = Record<string, GraphQLType | GraphQLType[]>
66
63
 
64
+ export declare interface Field {
65
+ args?: GraphQLArgs
66
+ type: GraphQLType | GraphQLType[]
67
+ }
68
+
69
+ export declare type Fields = Record<string, Field>
70
+
67
71
  export declare interface CreationCallback {
68
72
  (params: {
69
- addFields: (newFields: Record<string, {
70
- args?: GraphQLArgs
71
- type: GraphQLType | GraphQLType[]
72
- }>) => void
73
- modifyFields: (existingFields: Record<string, {
74
- args?: GraphQLArgs
75
- type: GraphQLType | GraphQLType[]
76
- }>) => void
73
+ addFields: (newFields: Fields) => void
74
+ modifyFields: (existingFields: Fields) => void
77
75
  removeFields: (existingFields: string[]) => void
78
76
  setDescription: (newDescription: string) => void
79
77
  setInterfaces: (reWrittenInterfaces: GraphQLType[]) => void
80
78
  }): void
81
79
  }
82
80
 
81
+ export declare type CreationCallbacks = Record<string, CreationCallback>
82
+
83
83
  export declare interface Enum {
84
84
  description: string
85
85
  values: Record<string, string>
86
86
  }
87
87
 
88
+ export declare type Enums = Record<string, Enum>
89
+
90
+ export declare interface Type {
91
+ description: string
92
+ fields: Fields
93
+ }
94
+
95
+ export declare type Types = Record<string, Type>
96
+
97
+ export declare interface InputTypeField {
98
+ type: GraphQLType | GraphQLType[]
99
+ }
100
+
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
+
88
124
  export declare interface Extensions {
89
- creationCallbacks?: Record<string, CreationCallback>
90
- enums?: Record<
91
- string,
92
- Enum
93
- >
94
- inputTypes?: Record<
95
- string,
96
- {
97
- description?: string
98
- fields: Record<
99
- string,
100
- GraphQLType | GraphQLType[]
101
- >
102
- }
103
- >
104
- interfaces?: Record<string, {
105
- description: string
106
- fields: Record<string, {
107
- args?: GraphQLArgs
108
- type: GraphQLType | GraphQLType[]
109
- }>
110
- }>
125
+ creationCallbacks?: CreationCallbacks
126
+ enums?: Enums
127
+ inputTypes?: InputTypes
128
+ interfaces?: Interfaces
111
129
  resolvers?: Record<
112
130
  string,
113
131
  Record<
114
132
  string,
115
- Resolver
133
+ AnyResolver
116
134
  >
117
135
  >
118
136
  typeResolvers?: Record<string, (param: any) => string>
119
- types?: Record<string, {
120
- description: string
121
- fields: Record<string, {
122
- type: GraphQLType | GraphQLType[]
123
- }>
124
- }>
125
- unions?: Record<string, {
126
- description: string
127
- types: GraphQLType[]
128
- }>
137
+ types?: Types
138
+ unions?: Unions
129
139
  }
130
140
 
131
141
 
package/package.json CHANGED
@@ -46,5 +46,5 @@
46
46
  "test": "tsd ./"
47
47
  },
48
48
  "types": "index.ts",
49
- "version": "7.1.0-B1"
49
+ "version": "7.1.0-B2"
50
50
  }