@enonic-types/guillotine 0.0.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.
@@ -0,0 +1,23 @@
1
+ // Make sure ScriptValue type exists in global scope:
2
+ /// <reference types="@enonic-types/global"/>
3
+
4
+
5
+ import type {
6
+ LocalContext,
7
+ LocalContextRecord,
8
+ } from './LocalContext'
9
+
10
+
11
+ export declare interface CreateDataFetcherResultParams<
12
+ In extends LocalContextRecord = LocalContext,
13
+ Out extends LocalContextRecord = LocalContext
14
+ > {
15
+ data: ScriptValue // NOTE: ScriptValue type is expected to exist in global scope
16
+ localContext?: LocalContext<Out>
17
+ parentLocalContext?: LocalContext<In>
18
+ }
19
+
20
+ export declare type CreateDataFetcherResult = <
21
+ In extends LocalContextRecord = LocalContext,
22
+ Out extends LocalContextRecord = LocalContext
23
+ >(params: CreateDataFetcherResultParams<In,Out>) => LocalContext<In&Out>
@@ -0,0 +1,7 @@
1
+ /// <reference path="../Global.Modifying.d.ts"/>
2
+
3
+
4
+ import type {ValueOf} from '../Utils'
5
+
6
+ export declare type GraphQLEnumType = ValueOf<GraphQLEnumTypesMap>
7
+ export declare type GraphQLEnumTypeName = keyof GraphQLEnumTypesMap
@@ -0,0 +1,23 @@
1
+ /// <reference path="../Global.Modifying.d.ts"/>
2
+
3
+
4
+ import type {ValueOf} from '../Utils'
5
+ import type {GraphQLEnumType} from './EnumTypes'
6
+ import type {
7
+ GraphQLEnumTypeReference,
8
+ GraphQLInputTypeReference,
9
+ } from './ReferenceTypes'
10
+ import type {GraphQLScalars} from './ScalarTypes'
11
+
12
+
13
+ export declare type GraphQLInputType = ValueOf<GraphQLInputTypesMap>
14
+ export declare type GraphQLInputTypeName = keyof GraphQLInputTypesMap
15
+
16
+ export declare type GraphQLArgs = Record<string,
17
+ | GraphQLEnumType
18
+ | GraphQLEnumTypeReference<GraphQLEnumType>
19
+ | GraphQLInputType
20
+ | GraphQLInputTypeReference<GraphQLInputType>
21
+ | GraphQLScalars
22
+ // GraphQLObjectType doesn't make sense here.
23
+ >
@@ -0,0 +1,7 @@
1
+ /// <reference path="../Global.Modifying.d.ts"/>
2
+
3
+
4
+ import type {ValueOf} from '../Utils'
5
+
6
+ export declare type GraphQLInterfaceType = ValueOf<GraphQLInterfaceTypesMap>
7
+ export declare type GraphQLInterfaceTypeName = keyof GraphQLInterfaceTypesMap
@@ -0,0 +1,9 @@
1
+ export declare type LocalContextRecord = Record<string,string|number|boolean|null>
2
+
3
+ export declare type LocalContext<
4
+ T extends LocalContextRecord = LocalContextRecord
5
+ > = {
6
+ branch: string
7
+ project: string
8
+ siteKey?: string
9
+ } & T
@@ -0,0 +1,8 @@
1
+ /// <reference path="../Global.Modifying.d.ts"/>
2
+
3
+
4
+ import type {ValueOf} from '../Utils'
5
+
6
+
7
+ export declare type GraphQLObjectType = ValueOf<GraphQLObjectTypesMap>
8
+ export declare type GraphQLObjectTypeName = keyof GraphQLObjectTypesMap
@@ -0,0 +1,55 @@
1
+ /// <reference path="../Global.Modifying.d.ts"/>
2
+
3
+
4
+ import type {
5
+ Reference,
6
+ } from '../brand'
7
+ import type {
8
+ ValueOf,
9
+ } from '../Utils'
10
+ import type {
11
+ GraphQLEnumType,
12
+ } from './EnumTypes'
13
+ import type {
14
+ GraphQLInputType,
15
+ } from './InputTypes'
16
+ import type {
17
+ GraphQLInterfaceType,
18
+ } from './InterfaceTypes'
19
+ import type {
20
+ GraphQLObjectType,
21
+ } from './ObjectTypes'
22
+ import type {
23
+ GraphQLUnionType,
24
+ } from './UnionTypes'
25
+
26
+
27
+ // export declare type GraphQLReference<
28
+ // GraphQLEnumOrInputOrInterfaceOrObjectOrUnionType extends ValueOf<
29
+ // GraphQLEnumTypesMap
30
+ // & GraphQLInputTypesMap
31
+ // & GraphQLInterfaceTypesMap
32
+ // & GraphQLObjectTypesMap
33
+ // & GraphQLUnionTypesMap
34
+ // >
35
+ // > = Reference<GraphQLEnumOrInputOrInterfaceOrObjectOrUnionType>
36
+
37
+ export declare type GraphQLEnumTypeReference<
38
+ GraphQLEnumType extends ValueOf<GraphQLEnumTypesMap>
39
+ > = Reference<GraphQLEnumType>
40
+
41
+ export declare type GraphQLInputTypeReference<
42
+ GraphQLInputType extends ValueOf<GraphQLInputTypesMap>
43
+ > = Reference<GraphQLInputType>
44
+
45
+ export declare type GraphQLInterfaceTypeReference<
46
+ GraphQLInterfaceType extends ValueOf<GraphQLInterfaceTypesMap>
47
+ > = Reference<GraphQLInterfaceType>
48
+
49
+ export declare type GraphQLObjectTypeReference<
50
+ GraphQLObjectType extends ValueOf<GraphQLObjectTypesMap>
51
+ > = Reference<GraphQLObjectType>
52
+
53
+ export declare type GraphQLUnionTypeReference<
54
+ GraphQLUnionType extends ValueOf<GraphQLUnionTypesMap>
55
+ > = Reference<GraphQLUnionType>
@@ -0,0 +1,35 @@
1
+ import type {BrandGraphQLScalarType} from '../brand'
2
+
3
+
4
+ export declare type GraphQLBoolean = BrandGraphQLScalarType<'GraphQLBoolean', boolean>
5
+ export declare type GraphQLDate = BrandGraphQLScalarType<'Date', string>
6
+ export declare type GraphQLDateTime = BrandGraphQLScalarType<'DateTime', string>
7
+ export declare type GraphQLFloat = BrandGraphQLScalarType<'GraphQLFloat', number>
8
+ export declare type GraphQLID = BrandGraphQLScalarType<'GraphQLID', string>
9
+ export declare type GraphQLInt = BrandGraphQLScalarType<'GraphQLInt', number>
10
+ export declare type GraphQLJson = BrandGraphQLScalarType<'Json', string>
11
+ export declare type GraphQLLocalDateTime = BrandGraphQLScalarType<'LocalDateTime', string>
12
+ export declare type GraphQLLocalTime = BrandGraphQLScalarType<'LocalTime', string>
13
+ export declare type GraphQLString = BrandGraphQLScalarType<'GraphQLString', string>
14
+
15
+ export declare interface GraphQLBaseScalars {
16
+ GraphQLBoolean: GraphQLBoolean
17
+ GraphQLFloat: GraphQLFloat
18
+ GraphQLID: GraphQLID
19
+ GraphQLInt: GraphQLInt
20
+ GraphQLString: GraphQLString
21
+ }
22
+
23
+ export declare interface GraphQLExtendedScalars {
24
+ Date: GraphQLDate
25
+ DateTime: GraphQLDateTime
26
+ Json: GraphQLJson
27
+ }
28
+
29
+ export declare interface GraphQLCustomScalars {
30
+ LocalDateTime: GraphQLLocalDateTime
31
+ LocalTime: GraphQLLocalTime
32
+ }
33
+
34
+ export declare interface GraphQLScalars
35
+ extends GraphQLBaseScalars, GraphQLExtendedScalars, GraphQLCustomScalars {}
@@ -0,0 +1,7 @@
1
+ /// <reference path="../Global.Modifying.d.ts"/>
2
+
3
+
4
+ import type {ValueOf} from '../Utils'
5
+
6
+ export declare type GraphQLUnionType = ValueOf<GraphQLUnionTypesMap>
7
+ export declare type GraphQLUnionTypeName = keyof GraphQLUnionTypesMap
@@ -0,0 +1,168 @@
1
+ /// <reference path="../Global.Modifying.d.ts"/>
2
+
3
+
4
+ import type {
5
+ AnyGraphQLBrand,
6
+ GetReturnType,
7
+ NonNull,
8
+ Reference,
9
+ } from '../brand'
10
+ import type {
11
+ ArrayElement,
12
+ PartialRecord,
13
+ ValueOf,
14
+ } from '../Utils'
15
+ import type {CreateDataFetcherResult} from './CreateDataFetcherResult'
16
+ import type {
17
+ GraphQLEnumType,
18
+ GraphQLEnumTypeName,
19
+ } from './EnumTypes'
20
+ import type {
21
+ GraphQLInputType,
22
+ GraphQLInputTypeName,
23
+ } from './InputTypes'
24
+ import type {
25
+ GraphQLInterfaceType,
26
+ GraphQLInterfaceTypeName,
27
+ } from './InterfaceTypes'
28
+ import type {
29
+ GraphQLObjectType,
30
+ GraphQLObjectTypeName
31
+ } from './ObjectTypes'
32
+ import type {
33
+ GraphQLEnumTypeReference,
34
+ GraphQLInputTypeReference,
35
+ GraphQLInterfaceTypeReference,
36
+ GraphQLObjectTypeReference,
37
+ GraphQLUnionTypeReference,
38
+ } from './ReferenceTypes'
39
+ import type {
40
+ GraphQLCustomScalars,
41
+ GraphQLExtendedScalars,
42
+ GraphQLScalars,
43
+ } from './ScalarTypes'
44
+ import type {
45
+ GraphQLUnionType,
46
+ GraphQLUnionTypeName
47
+ } from './UnionTypes'
48
+
49
+
50
+ export type {
51
+ CreateDataFetcherResult,
52
+ CreateDataFetcherResultParams,
53
+ } from './CreateDataFetcherResult'
54
+
55
+ export type {
56
+ GraphQLEnumType,
57
+ GraphQLEnumTypeName,
58
+ } from './EnumTypes'
59
+
60
+ export type {
61
+ GraphQLArgs,
62
+ GraphQLInputType,
63
+ GraphQLInputTypeName,
64
+ } from './InputTypes'
65
+
66
+ export type {
67
+ GraphQLInterfaceType,
68
+ GraphQLInterfaceTypeName,
69
+ } from './InterfaceTypes'
70
+
71
+ export type {
72
+ LocalContext,
73
+ LocalContextRecord,
74
+ } from './LocalContext'
75
+
76
+ export type {
77
+ GraphQLObjectType,
78
+ GraphQLObjectTypeName,
79
+ } from './ObjectTypes'
80
+
81
+ export type {
82
+ GraphQLEnumTypeReference,
83
+ GraphQLInputTypeReference,
84
+ GraphQLInterfaceTypeReference,
85
+ GraphQLObjectTypeReference,
86
+ GraphQLUnionTypeReference,
87
+ } from './ReferenceTypes'
88
+
89
+ export type {
90
+ GraphQLBaseScalars,
91
+ GraphQLBoolean,
92
+ GraphQLCustomScalars,
93
+ GraphQLDate,
94
+ GraphQLDateTime,
95
+ GraphQLExtendedScalars,
96
+ GraphQLFloat,
97
+ GraphQLID,
98
+ GraphQLInt,
99
+ GraphQLJson,
100
+ GraphQLLocalDateTime,
101
+ GraphQLLocalTime,
102
+ GraphQLScalars,
103
+ GraphQLString
104
+ } from './ScalarTypes'
105
+
106
+
107
+ export declare type GraphQLNonNull<
108
+ GraphQLObjectType extends ValueOf<GraphQLObjectTypesMap>
109
+ > = NonNull<GraphQLObjectType>
110
+
111
+ export declare type GraphQLType =
112
+ | GraphQLEnumType
113
+ | GraphQLInputType
114
+ | GraphQLObjectType
115
+ | GraphQLScalars
116
+
117
+ export declare interface GraphQL
118
+ extends GraphQLScalars//, GraphQLExtendedScalars, GraphQLCustomScalars
119
+ {
120
+ createDataFetcherResult: CreateDataFetcherResult
121
+ nonNull: (type: GraphQLType) => GraphQLNonNull<typeof type>
122
+ list: (type: GraphQLType) => (typeof type)[]
123
+ reference: (typeName: string) =>
124
+ typeof typeName extends GraphQLEnumTypeName
125
+ ? GraphQLEnumTypeReference<GraphQLEnumTypesMap[typeof typeName]>
126
+ : typeof typeName extends GraphQLInputTypeName
127
+ ? GraphQLInputTypeReference<GraphQLInputTypesMap[typeof typeName]>
128
+ : typeof typeName extends GraphQLInterfaceTypeName
129
+ ? GraphQLInterfaceTypeReference<GraphQLInterfaceTypesMap[typeof typeName]>
130
+ : typeof typeName extends GraphQLObjectTypeName
131
+ ? GraphQLObjectTypeReference<GraphQLObjectTypesMap[typeof typeName]>
132
+ : typeof typeName extends GraphQLUnionTypeName
133
+ ? GraphQLUnionTypeReference<GraphQLUnionTypesMap[typeof typeName]>
134
+ : 'reference(typeName) not registered in global GraphQLEnumTypesMap, GraphQLInputTypesMap, GraphQLInterfaceTypesMap, GraphQLObjectTypesMap or GraphQLUnionTypesMap'
135
+ // GraphQLReference<(GraphQLInputTypesMap & GraphQLObjectTypesMap)[typeof typeKey]> // GraphQLReference<typeof typeKey>
136
+ }
137
+
138
+ //──────────────────────────────────────────────────────────────────────────────
139
+ // Converters:
140
+ //──────────────────────────────────────────────────────────────────────────────
141
+
142
+ export declare type GraphQLTypeToGuillotineFields<
143
+ Type // extends ValueOf<GraphQLObjectTypesMap>
144
+ > = {
145
+ [fieldKey in keyof Type]: {
146
+ type: Type[fieldKey]
147
+ }
148
+ }
149
+
150
+ // type BasicTypes = boolean|number|string
151
+
152
+ // Note: This is sketchy, but perhaps useful?
153
+ export declare type GraphQLTypeToResolverResult<
154
+ Type // extends ValueOf<GraphQLObjectTypesMap>
155
+ > =
156
+ Type extends AnyGraphQLBrand
157
+ ? GetReturnType<Type>
158
+ : Type extends AnyGraphQLBrand[]
159
+ ? GetReturnType<ArrayElement<Type>>[]
160
+ : Type extends Record<string,any>
161
+ ? {
162
+ [fieldKey in keyof Type]: Type[fieldKey] extends AnyGraphQLBrand
163
+ ? GetReturnType<Type[fieldKey]>
164
+ : Type[fieldKey] extends AnyGraphQLBrand[]
165
+ ? GetReturnType<ArrayElement<Type[fieldKey]>>[]
166
+ : 'Record with unhandeled key'
167
+ }
168
+ : 'Unhandled type'
@@ -0,0 +1,47 @@
1
+ // This is a value, do not add declare.
2
+ export enum EnumTypeName {
3
+ ComponentType = 'ComponentType',
4
+ ContentPathType = 'ContentPathType',
5
+ DslGeoPointDistanceType = 'DslGeoPointDistanceType',
6
+ DslOperatorType = 'DslOperatorType',
7
+ DslSortDirectionType = 'DslSortDirectionType',
8
+ FormItemType = 'FormItemType',
9
+ HighlightEncoderType = 'HighlightEncoderType',
10
+ HighlightFragmenterType = 'HighlightFragmenterType',
11
+ HighlightOrderType = 'HighlightOrderType',
12
+ HighlightTagsSchemaType = 'HighlightTagsSchemaType',
13
+ MediaIntentType = 'MediaIntentType',
14
+ Permission = 'Permission',
15
+ PrincipalType = 'PrincipalType',
16
+ UrlType = 'UrlType',
17
+ }
18
+
19
+ export declare type EnumTypeNames = keyof typeof EnumTypeName
20
+
21
+ //──────────────────────────────────────────────────────────────────────────────
22
+
23
+ // This is a value, do not add declare.
24
+ export enum FormItemType {
25
+ ItemSet = 'ItemSet',
26
+ Layout = 'Layout',
27
+ Input = 'Input',
28
+ OptionSet = 'OptionSet',
29
+ }
30
+
31
+ // This is a value, do not add declare.
32
+ export enum Permission {
33
+ READ = 'READ',
34
+ CREATE = 'CREATE',
35
+ MODIFY = 'MODIFY',
36
+ DELETE = 'DELETE',
37
+ PUBLISH = 'PUBLISH',
38
+ READ_PERMISSIONS = 'READ_PERMISSIONS',
39
+ WRITE_PERMISSIONS = 'WRITE_PERMISSIONS',
40
+ }
41
+
42
+ // This is a value, do not add declare.
43
+ export enum PrincipalType {
44
+ user = 'user',
45
+ group = 'group',
46
+ role = 'role',
47
+ }
@@ -0,0 +1,55 @@
1
+ export type {
2
+ EnumTypeNames,
3
+ } from './enumTypes'
4
+
5
+ export type {
6
+ InputTypeNames,
7
+ } from './inputTypes'
8
+
9
+ export type {
10
+ ObjectTypeNames,
11
+ AccessControlEntry,
12
+ Attachment,
13
+ Content,
14
+ ContentConnection,
15
+ ContentEdge,
16
+ ContentType,
17
+ ExtraData,
18
+ FormItem,
19
+ GeoPoint,
20
+ Icon,
21
+ media_Image,
22
+ media_Image_Data,
23
+ MediaFocalPoint,
24
+ MediaUploader,
25
+ PageInfo,
26
+ Permissions,
27
+ portal_Site,
28
+ portal_Site_Data,
29
+ PrincipalKey,
30
+ PublishInfo,
31
+ XData_base_ApplicationConfig,
32
+ XData_base_gpsInfo_DataConfig,
33
+ XData_media_ApplicationConfig,
34
+ XData_media_cameraInfo_DataConfig,
35
+ XData_media_imageInfo_DataConfig,
36
+ } from './objectTypes'
37
+
38
+ export type {
39
+ ScalarTypeNames,
40
+ } from './scalarTypes'
41
+
42
+
43
+
44
+ export {
45
+ EnumTypeName,
46
+ FormItemType,
47
+ Permission,
48
+ PrincipalType,
49
+ } from './enumTypes'
50
+
51
+ export {InputTypeName} from './inputTypes'
52
+
53
+ export {ObjectTypeName} from './objectTypes'
54
+
55
+ export {ScalarTypeName} from './scalarTypes'
@@ -0,0 +1,43 @@
1
+ // This is a value, do not add declare.
2
+ export enum InputTypeName {
3
+ AggregationInput = 'AggregationInput',
4
+ BooleanDSLExpressionInput = 'BooleanDSLExpressionInput',
5
+ BooleanFilterInput = 'BooleanFilterInput',
6
+ DSLExpressionValueInput = 'DSLExpressionValueInput',
7
+ DateHistogramAggregationInput = 'DateHistogramAggregationInput',
8
+ DateRangeAggregationInput = 'DateRangeAggregationInput',
9
+ DateRangeInput = 'DateRangeInput',
10
+ ExistsDSLExpressionInput = 'ExistsDSLExpressionInput',
11
+ ExistsFilterInput = 'ExistsFilterInput',
12
+ FilterInput = 'FilterInput',
13
+ FormInput = 'FormInput',
14
+ FulltextDSLExpressionInput = 'FulltextDSLExpressionInput',
15
+ GeoDistanceAggregationInput = 'GeoDistanceAggregationInput',
16
+ GeoPointInput = 'GeoPointInput',
17
+ GeoPointSortDslInput = 'GeoPointSortDslInput',
18
+ HasValueFilterInput = 'HasValueFilterInput',
19
+ HighlightInputType = 'HighlightInputType',
20
+ HighlightPropertiesInputType = 'HighlightPropertiesInputType',
21
+ IdsFilterInput = 'IdsFilterInput',
22
+ InDSLExpressionInput = 'InDSLExpressionInput',
23
+ LikeDSLExpressionInput = 'LikeDSLExpressionInput',
24
+ MatchAllDSLExpressionInput = 'MatchAllDSLExpressionInput',
25
+ MaxAggregationInput = 'MaxAggregationInput',
26
+ MinAggregationInput = 'MinAggregationInput',
27
+ NgramDSLExpressionInput = 'NgramDSLExpressionInput',
28
+ NotExistsFilterInput = 'NotExistsFilterInput',
29
+ NumberRangeInput = 'NumberRangeInput',
30
+ PathMatchDSLExpressionInput = 'PathMatchDSLExpressionInput',
31
+ ProcessHtmlInput = 'ProcessHtmlInput',
32
+ QueryDSLInput = 'QueryDSLInput',
33
+ RangeAggregationInput = 'RangeAggregationInput',
34
+ RangeDSLExpressionInput = 'RangeDSLExpressionInput',
35
+ SortDslInput = 'SortDslInput',
36
+ StatsAggregationInput = 'StatsAggregationInput',
37
+ StemmedDSLExpressionInput = 'StemmedDSLExpressionInput',
38
+ TermDSLExpressionInput = 'TermDSLExpressionInput',
39
+ TermsAggregationInput = 'TermsAggregationInput',
40
+ ValueCountAggregationInput = 'ValueCountAggregationInput',
41
+ }
42
+
43
+ export declare type InputTypeNames = keyof typeof InputTypeName