@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,340 @@
1
+ import type {Content as CoreContent} from '@enonic-types/core';
2
+ import type {
3
+ BrandGraphQLObjectType,
4
+ NonNull
5
+ } from '../brand'
6
+ import type {
7
+ FormItemType,
8
+ Permission,
9
+ PrincipalType,
10
+ } from './enumTypes'
11
+ import type {
12
+ GraphQLBoolean,
13
+ GraphQLDateTime,
14
+ GraphQLFloat,
15
+ GraphQLID,
16
+ GraphQLInt,
17
+ GraphQLJson,
18
+ GraphQLLocalDateTime,
19
+ GraphQLString,
20
+ } from '../graphQL/ScalarTypes'
21
+ import type {
22
+ MediaImageContent,
23
+ PortalSiteContent,
24
+ } from '../xp'
25
+
26
+
27
+ // This is a value, do not add declare.
28
+ export enum ObjectTypeName {
29
+ AccessControlEntry = 'AccessControlEntry',
30
+ Attachment = 'Attachment',
31
+ base_Folder = 'base_Folder',
32
+ base_Media = 'base_Media',
33
+ base_Shortcut = 'base_Shortcut',
34
+ base_Shortcut_Data = 'base_Shortcut_Data',
35
+ base_Shortcut_Parameters = 'base_Shortcut_Parameters',
36
+ base_Structured = 'base_Structured',
37
+ base_Unstructured = 'base_Unstructured',
38
+ Component = 'Component',
39
+ Content = 'Content',
40
+ ContentConnection = 'ContentConnection',
41
+ ContentEdge = 'ContentEdge',
42
+ ContentType = 'ContentType',
43
+ DefaultValue = 'DefaultValue',
44
+ ExtraData = 'ExtraData',
45
+ FormItem = 'FormItem',
46
+ FormItemSet = 'FormItemSet',
47
+ FormLayout = 'FormLayout',
48
+ FormOptionSet = 'FormOptionSet',
49
+ FormOptionSetOption = 'FormOptionSetOption',
50
+ FragmentComponentData = 'FragmentComponentData',
51
+ GeoPoint = 'GeoPoint',
52
+ HeadlessCms = 'HeadlessCms',
53
+ Icon = 'Icon',
54
+ Image = 'Image',
55
+ ImageComponentData = 'ImageComponentData',
56
+ ImageStyle = 'ImageStyle',
57
+ LayoutComponentData = 'LayoutComponentData',
58
+ LayoutComponentDataConfig = 'LayoutComponentDataConfig',
59
+ Link = 'Link',
60
+ Macro = 'Macro',
61
+ Macro_system_disable_DataConfig = 'Macro_system_disable_DataConfig',
62
+ Macro_system_embed_DataConfig = 'Macro_system_embed_DataConfig',
63
+ MacroConfig = 'MacroConfig',
64
+ Media = 'Media',
65
+ MediaFocalPoint = 'MediaFocalPoint',
66
+ MediaUploader = 'MediaUploader',
67
+ media_Archive = 'media_Archive',
68
+ media_Archive_Data = 'media_Archive_Data',
69
+ media_Audio = 'media_Audio',
70
+ media_Audio_Data = 'media_Audio_Data',
71
+ media_Code = 'media_Code',
72
+ media_Code_Data = 'media_Code_Data',
73
+ media_Data = 'media_Data',
74
+ media_Data_Data = 'media_Data_Data',
75
+ media_Document = 'media_Document',
76
+ media_Document_Data = 'media_Document_Data',
77
+ media_Executable = 'media_Executable',
78
+ media_Executable_Data = 'media_Executable_Data',
79
+ media_Image = 'media_Image',
80
+ media_Image_Data = 'media_Image_Data',
81
+ media_Presentation = 'media_Presentation',
82
+ media_Presentation_Data = 'media_Presentation_Data',
83
+ media_Spreadsheet = 'media_Spreadsheet',
84
+ media_Spreadsheet_Data = 'media_Spreadsheet_Data',
85
+ media_Text = 'media_Text',
86
+ media_Text_Data = 'media_Text_Data',
87
+ media_Unknown = 'media_Unknown',
88
+ media_Unknown_Data = 'media_Unknown_Data',
89
+ media_Vector = 'media_Vector',
90
+ media_Vector_Data = 'media_Vector_Data',
91
+ media_Video = 'media_Video',
92
+ media_Video_Data = 'media_Video_Data',
93
+ // Menu = 'Menu', // Not builtin?
94
+ // MenuItem = 'MenuItem', // Not builtin?
95
+ // MetaFields = 'MetaFields', // Not builtin!
96
+ Occurrences = 'Occurrences',
97
+ PageComponentData = 'PageComponentData',
98
+ PageComponentDataConfig = 'PageComponentDataConfig',
99
+ PageInfo = 'PageInfo',
100
+ PartComponentData = 'PartComponentData',
101
+ PartComponentDataConfig = 'PartComponentDataConfig',
102
+ Permissions = 'Permissions',
103
+ portal_Fragment = 'portal_Fragment',
104
+ portal_PageTemplate = 'portal_PageTemplate',
105
+ portal_PageTemplate_Data = 'portal_PageTemplate_Data',
106
+ portal_Site = 'portal_Site',
107
+ portal_Site_Data = 'portal_Site_Data',
108
+ portal_TemplateFolder = 'portal_TemplateFolder',
109
+ PrincipalKey = 'PrincipalKey',
110
+ PublishInfo = 'PublishInfo',
111
+ QueryContentConnection = 'QueryContentConnection',
112
+ QueryDSLContentConnection = 'QueryDSLContentConnection',
113
+ RichText = 'RichText',
114
+ // RobotsTxt = 'RobotsTxt', // Not builtin?
115
+ SiteConfigurator = 'SiteConfigurator',
116
+ TextComponentData = 'TextComponentData',
117
+ UntypedContent = 'UntypedContent',
118
+ XData_base_ApplicationConfig = 'XData_base_ApplicationConfig',
119
+ XData_base_gpsInfo_DataConfig = 'XData_base_gpsInfo_DataConfig',
120
+ XData_media_ApplicationConfig = 'XData_media_ApplicationConfig',
121
+ XData_media_cameraInfo_DataConfig = 'XData_media_cameraInfo_DataConfig',
122
+ XData_media_imageInfo_DataConfig = 'XData_media_imageInfo_DataConfig',
123
+ }
124
+
125
+ export declare type ObjectTypeNames = keyof typeof ObjectTypeName
126
+
127
+ //──────────────────────────────────────────────────────────────────────────────
128
+
129
+ export declare interface AccessControlEntry {
130
+ principal: PrincipalKey
131
+ allow: Permission[] // enum
132
+ deny: Permission[] // enum
133
+ }
134
+
135
+ export declare interface Attachment {
136
+ name: GraphQLString
137
+ label: GraphQLString
138
+ size: GraphQLInt
139
+ mimeType: GraphQLString
140
+ attachmentUrl: GraphQLString
141
+ }
142
+
143
+ export declare type Content<
144
+ Extensions extends Record<string, unknown> = Record<string, unknown>
145
+ > = BrandGraphQLObjectType<
146
+ 'Content',
147
+ {
148
+ _id: NonNull<GraphQLID>
149
+ _name: NonNull<GraphQLString>
150
+ _path: NonNull<GraphQLString>
151
+ _references: Content[]
152
+ _score: GraphQLFloat
153
+ attachments: Attachment[]
154
+ children: Content[]
155
+ childrenConnection: ContentConnection
156
+ components: Content[]
157
+ contentType: ContentType
158
+ createdTime: GraphQLDateTime
159
+ creator: PrincipalKey
160
+ dataAsJson: GraphQLJson
161
+ displayName: GraphQLString
162
+ hasChildren: GraphQLBoolean
163
+ language: GraphQLString
164
+ modifiedTime: GraphQLDateTime
165
+ modifier: PrincipalKey
166
+ owner: PrincipalKey
167
+ pageAsJson: GraphQLJson
168
+ pageTemplate: Content
169
+ pageUrl: GraphQLString
170
+ parent: Content
171
+ permissions: Permissions
172
+ publish: PublishInfo
173
+ site: portal_Site
174
+ type: GraphQLString
175
+ valid: GraphQLBoolean
176
+ x: ExtraData
177
+ xAsJson: GraphQLJson
178
+ } & Extensions,
179
+ CoreContent
180
+ >
181
+
182
+ export declare interface ContentConnection {
183
+ totalCount: NonNull<GraphQLInt>
184
+ edges?: ContentEdge[]
185
+ pageInfo?: PageInfo
186
+ }
187
+
188
+ export declare interface ContentEdge {
189
+ node: NonNull<Content>
190
+ cursor: NonNull<GraphQLString>
191
+ }
192
+
193
+ export declare interface ContentType {
194
+ name: GraphQLString
195
+ displayName: GraphQLString
196
+ description: GraphQLString
197
+ superType: GraphQLString
198
+ abstract: GraphQLBoolean
199
+ final: GraphQLBoolean
200
+ allowChildContent: GraphQLBoolean
201
+ contentDisplayNameScript: GraphQLString
202
+ icon: Icon
203
+ form: FormItem[]
204
+ formAsJson: GraphQLJson
205
+ }
206
+
207
+ export declare interface ExtraData {
208
+ media: XData_media_ApplicationConfig
209
+ base: XData_base_ApplicationConfig
210
+ }
211
+
212
+ export declare interface FormItem {
213
+ formItemType: FormItemType // enum
214
+ name: GraphQLString
215
+ label: GraphQLString
216
+ }
217
+
218
+ export declare interface GeoPoint {
219
+ value: GraphQLString
220
+ latitude: GraphQLFloat
221
+ longitude: GraphQLFloat
222
+ }
223
+
224
+ export declare interface Icon {
225
+ mimeType: GraphQLString
226
+ modifiedTime: GraphQLString
227
+ }
228
+
229
+ export declare type media_Image = BrandGraphQLObjectType<
230
+ 'media_Image',
231
+ {
232
+ data: media_Image_Data
233
+ imageUrl: GraphQLString
234
+ mediaUrl: GraphQLString
235
+ },
236
+ MediaImageContent
237
+ >
238
+
239
+ export declare interface media_Image_Data {
240
+ media: MediaUploader
241
+ caption: GraphQLString
242
+ altText: GraphQLString
243
+ artist: GraphQLString[]
244
+ copyright: GraphQLString
245
+ tags: GraphQLString[]
246
+ }
247
+
248
+ export declare interface MediaFocalPoint {
249
+ x: GraphQLFloat
250
+ y: GraphQLFloat
251
+ }
252
+
253
+ export declare interface MediaUploader {
254
+ attachment: GraphQLString
255
+ focalPoint: MediaFocalPoint
256
+ }
257
+
258
+ export declare interface PageInfo {
259
+ startCursor: NonNull<GraphQLString>
260
+ endCursor: NonNull<GraphQLString>
261
+ hasNext: NonNull<GraphQLBoolean>
262
+ }
263
+
264
+ export declare interface Permissions {
265
+ inheritsPermissions: GraphQLBoolean
266
+ permissions: AccessControlEntry[]
267
+ }
268
+
269
+ export declare type portal_Site = BrandGraphQLObjectType<
270
+ 'portal_Site',
271
+ {
272
+ data: portal_Site_Data
273
+ },
274
+ PortalSiteContent
275
+ >
276
+
277
+ export declare interface portal_Site_Data {
278
+ description: GraphQLString
279
+ }
280
+
281
+ export declare interface PrincipalKey {
282
+ idProvider: GraphQLString
283
+ principalId: GraphQLString
284
+ type: PrincipalType // enum
285
+ value: GraphQLString
286
+ }
287
+
288
+ export declare interface PublishInfo {
289
+ from: GraphQLString
290
+ to: GraphQLString
291
+ first: GraphQLString
292
+ }
293
+
294
+ export declare interface XData_base_ApplicationConfig {
295
+ gpsInfo: XData_base_gpsInfo_DataConfig
296
+ }
297
+
298
+ export declare interface XData_base_gpsInfo_DataConfig {
299
+ geoPoint: GeoPoint
300
+ altitude: GraphQLString
301
+ direction: GraphQLString
302
+ }
303
+
304
+ export declare interface XData_media_ApplicationConfig {
305
+ imageInfo: XData_media_imageInfo_DataConfig
306
+ cameraInfo: XData_media_cameraInfo_DataConfig
307
+ }
308
+
309
+ export declare interface XData_media_cameraInfo_DataConfig {
310
+ date: GraphQLLocalDateTime
311
+ make: GraphQLString
312
+ model: GraphQLString
313
+ lens: GraphQLString
314
+ iso: GraphQLString
315
+ focalLength: GraphQLString
316
+ focalLength35: GraphQLString
317
+ exposureBias: GraphQLString
318
+ aperture: GraphQLString[]
319
+ shutterTime: GraphQLString
320
+ flash: GraphQLString
321
+ autoFlashCompensation: GraphQLString
322
+ whiteBalance: GraphQLString
323
+ exposureProgram: GraphQLString
324
+ shootingMode: GraphQLString
325
+ meteringMode: GraphQLString
326
+ exposureMode: GraphQLString
327
+ focusDistance: GraphQLString
328
+ orientation: GraphQLString
329
+ }
330
+
331
+ export declare interface XData_media_imageInfo_DataConfig {
332
+ pixelSize: GraphQLString
333
+ imageHeight: GraphQLString
334
+ imageWidth: GraphQLString
335
+ contentType: GraphQLString
336
+ description: GraphQLString
337
+ byteSize: GraphQLString
338
+ colorSpace: GraphQLString[]
339
+ fileSource: GraphQLString
340
+ }
@@ -0,0 +1,15 @@
1
+ // This is a value, do not add declare.
2
+ export enum ScalarTypeName {
3
+ Boolean = 'Boolean',
4
+ Date = 'Date',
5
+ DateTime = 'DateTime',
6
+ Float = 'Float',
7
+ ID = 'ID',
8
+ Int = 'Int',
9
+ Json = 'Json',
10
+ LocalDateTime = 'LocalDateTime',
11
+ LocalTime = 'LocalTime',
12
+ String = 'String',
13
+ }
14
+
15
+ export declare type ScalarTypeNames = keyof typeof ScalarTypeName
package/index.ts ADDED
@@ -0,0 +1,153 @@
1
+ // Make sure ScriptValue type exists in global scope:
2
+ /// <reference types="@enonic-types/global"/>
3
+
4
+
5
+ declare const __name: unique symbol
6
+
7
+ declare type BrandGraphQLScalarType<
8
+ GQL_SCALAR_TYPE_NAME extends string,
9
+ SCALAR_TYPE extends boolean|string|number
10
+ > = SCALAR_TYPE & {
11
+ [__name]: GQL_SCALAR_TYPE_NAME
12
+ }
13
+
14
+ export declare type GraphQLBoolean = BrandGraphQLScalarType<'GraphQLBoolean', boolean>
15
+ export declare type GraphQLDate = BrandGraphQLScalarType<'Date', string>
16
+ export declare type GraphQLDateTime = BrandGraphQLScalarType<'DateTime', string>
17
+ export declare type GraphQLFloat = BrandGraphQLScalarType<'GraphQLFloat', number>
18
+ export declare type GraphQLID = BrandGraphQLScalarType<'GraphQLID', string>
19
+ export declare type GraphQLInt = BrandGraphQLScalarType<'GraphQLInt', number>
20
+ export declare type GraphQLJson = BrandGraphQLScalarType<'Json', string>
21
+ export declare type GraphQLLocalDateTime = BrandGraphQLScalarType<'LocalDateTime', string>
22
+ export declare type GraphQLLocalTime = BrandGraphQLScalarType<'LocalTime', string>
23
+ export declare type GraphQLString = BrandGraphQLScalarType<'GraphQLString', string>
24
+
25
+ export declare type GraphQLType = any
26
+
27
+ export declare interface GraphQL {
28
+ Date: GraphQLDate
29
+ DateTime: GraphQLDateTime
30
+ GraphQLBoolean: GraphQLBoolean
31
+ GraphQLFloat: GraphQLFloat
32
+ GraphQLID: GraphQLID
33
+ GraphQLInt: GraphQLInt
34
+ GraphQLString: GraphQLString
35
+ Json: GraphQLJson
36
+ LocalDateTime: GraphQLLocalDateTime
37
+ LocalTime: GraphQLLocalTime
38
+ createDataFetcherResult: <
39
+ In extends LocalContextRecord = LocalContext,
40
+ Out extends LocalContextRecord = LocalContext
41
+ > () => {
42
+ data: ScriptValue // NOTE: ScriptValue type is expected to exist in global scope
43
+ localContext?: LocalContext<Out>
44
+ parentLocalContext?: LocalContext<In>
45
+ }
46
+ nonNull: (type: GraphQLType) => GraphQLType
47
+ list: (type: GraphQLType) => GraphQLType[]
48
+ reference: (typeName: string) => GraphQLType
49
+ }
50
+
51
+ export declare type GraphQLArgs = Record<string, GraphQLType | GraphQLType[]>
52
+
53
+ export declare interface CreationCallback {
54
+ (params: {
55
+ addFields: (newFields: Record<string, {
56
+ args?: GraphQLArgs
57
+ type: GraphQLType | GraphQLType[]
58
+ }>) => void
59
+ modifyFields: (existingFields: Record<string, {
60
+ args?: GraphQLArgs
61
+ type: GraphQLType | GraphQLType[]
62
+ }>) => void
63
+ removeFields: (existingFields: string[]) => void
64
+ setDescription: (newDescription: string) => void
65
+ setInterfaces: (reWrittenInterfaces: GraphQLType[]) => void
66
+ }): void
67
+ }
68
+
69
+ export declare interface Enum {
70
+ description: string
71
+ values: Record<string, string>
72
+ }
73
+
74
+ export declare type LocalContextRecord = Record<string,string|number|boolean|null>
75
+
76
+ export declare type LocalContext<
77
+ T extends LocalContextRecord = LocalContextRecord
78
+ > = {
79
+ branch: string
80
+ project: string
81
+ siteKey?: string
82
+ } & T
83
+
84
+ export declare interface DataFetchingEnvironment<
85
+ Args extends Record<string, any> = Record<string, any>,
86
+ Source extends unknown = unknown,
87
+ > {
88
+ args: Args
89
+ localContext: LocalContext
90
+ source: Source
91
+ }
92
+
93
+ export declare interface Resolver<
94
+ Args extends Record<string, any> = Record<string, any>,
95
+ Source extends unknown = unknown,
96
+ Return = any
97
+ > {
98
+ (env: DataFetchingEnvironment<Args,Source>): Return
99
+ }
100
+
101
+ export declare interface Extensions {
102
+ creationCallbacks?: Record<string, CreationCallback>
103
+ enums?: Record<
104
+ string,
105
+ Enum
106
+ >
107
+ inputTypes?: Record<
108
+ string,
109
+ {
110
+ description?: string
111
+ fields: Record<
112
+ string,
113
+ GraphQLType | GraphQLType[]
114
+ >
115
+ }
116
+ >
117
+ interfaces?: Record<string, {
118
+ description: string
119
+ fields: Record<string, {
120
+ args?: GraphQLArgs
121
+ type: GraphQLType | GraphQLType[]
122
+ }>
123
+ }>
124
+ resolvers?: Record<
125
+ string,
126
+ Record<
127
+ string,
128
+ Resolver
129
+ >
130
+ >
131
+ typeResolvers?: Record<string, (param: any) => string>
132
+ types?: Record<string, {
133
+ description: string
134
+ fields: Record<string, {
135
+ type: GraphQLType | GraphQLType[]
136
+ }>
137
+ }>
138
+ unions?: Record<string, {
139
+ description: string
140
+ types: GraphQLType[]
141
+ }>
142
+ }
143
+
144
+
145
+ export {
146
+ EnumTypeName,
147
+ FormItemType,
148
+ InputTypeName,
149
+ ObjectTypeName,
150
+ Permission,
151
+ PrincipalType,
152
+ ScalarTypeName,
153
+ } from './guillotine'
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "author": "Christian Westgaard cwe@enonic.com",
3
+ "bugs": {
4
+ "url": "https://github.com/enonic/app-guillotine/issues"
5
+ },
6
+ "dependencies": {
7
+ "@enonic-types/core": "^7.14.0",
8
+ "@enonic-types/global": "^7.14.0",
9
+ "@enonic-types/lib-content": "^7.14.0"
10
+ },
11
+ "description": "Types for Guillotine extensions",
12
+ "devDependencies": {
13
+ "tsd": "^0.30.4",
14
+ "typescript": "^5.3.3"
15
+ },
16
+ "files": [
17
+ "extensions",
18
+ "graphQL",
19
+ "guillotine",
20
+ "xp",
21
+ "*.ts"
22
+ ],
23
+ "homepage": "https://github.com/enonic/app-guillotine/tree/master#readme",
24
+ "keywords": [
25
+ "enonic",
26
+ "enonic-xp",
27
+ "extensions",
28
+ "graphql",
29
+ "guillotine",
30
+ "types",
31
+ "typescript"
32
+ ],
33
+ "license": "Apache-2.0",
34
+ "main": "index.ts",
35
+ "name": "@enonic-types/guillotine",
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/enonic/app-guillotine.git#master"
42
+ },
43
+ "scripts": {
44
+ "check": "npx tsc --noEmit",
45
+ "test": "tsd ./"
46
+ },
47
+ "types": "index.ts",
48
+ "version": "0.0.1"
49
+ }
package/xp/index.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import type {Content} from '@enonic-types/core';
2
+ import type {Site} from '@enonic-types/lib-content';
3
+
4
+
5
+ export declare type MediaImageContent = Content<{
6
+ altText?: string
7
+ artist?: string[]
8
+ caption?: string
9
+ copyright?: string
10
+ media: {
11
+ attachment: string
12
+ focalPoint: {
13
+ x: number // Float
14
+ y: number // Float
15
+ }
16
+ }
17
+ tags?: string[]
18
+ }, 'media:image'>;
19
+
20
+ export declare type PortalSiteContent<Config extends any = undefined> = Site<Config>;