@enonic-types/guillotine 0.0.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.
@@ -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,157 @@
1
+ // Make sure ScriptValue type exists in global scope:
2
+ /// <reference types="@enonic-types/global"/>
3
+
4
+ import type {CreateDataFetcherResult} from './graphQL/CreateDataFetcherResult'
5
+ import type {AnyResolver} from './extensions/Resolver'
6
+
7
+ declare const __name: unique symbol
8
+
9
+ declare type BrandGraphQLScalarType<
10
+ GQL_SCALAR_TYPE_NAME extends string,
11
+ SCALAR_TYPE extends boolean|string|number
12
+ > = SCALAR_TYPE & {
13
+ [__name]: GQL_SCALAR_TYPE_NAME
14
+ }
15
+
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
+ export declare type GraphQLBoolean = BrandGraphQLScalarType<'GraphQLBoolean', boolean>
33
+ export declare type GraphQLDate = BrandGraphQLScalarType<'Date', string>
34
+ export declare type GraphQLDateTime = BrandGraphQLScalarType<'DateTime', string>
35
+ export declare type GraphQLFloat = BrandGraphQLScalarType<'GraphQLFloat', number>
36
+ export declare type GraphQLID = BrandGraphQLScalarType<'GraphQLID', string>
37
+ export declare type GraphQLInt = BrandGraphQLScalarType<'GraphQLInt', number>
38
+ export declare type GraphQLJson = BrandGraphQLScalarType<'Json', string>
39
+ export declare type GraphQLLocalDateTime = BrandGraphQLScalarType<'LocalDateTime', string>
40
+ export declare type GraphQLLocalTime = BrandGraphQLScalarType<'LocalTime', string>
41
+ export declare type GraphQLString = BrandGraphQLScalarType<'GraphQLString', string>
42
+
43
+ export declare type GraphQLType = any
44
+
45
+ export declare interface GraphQL {
46
+ Date: GraphQLDate
47
+ DateTime: GraphQLDateTime
48
+ GraphQLBoolean: GraphQLBoolean
49
+ GraphQLFloat: GraphQLFloat
50
+ GraphQLID: GraphQLID
51
+ GraphQLInt: GraphQLInt
52
+ GraphQLString: GraphQLString
53
+ Json: GraphQLJson
54
+ LocalDateTime: GraphQLLocalDateTime
55
+ LocalTime: GraphQLLocalTime
56
+ createDataFetcherResult: CreateDataFetcherResult
57
+ nonNull: (type: GraphQLType) => GraphQLType
58
+ list: (type: GraphQLType) => GraphQLType[]
59
+ reference: (typeName: string) => GraphQLType
60
+ }
61
+
62
+ export declare type GraphQLArgs = Record<string, GraphQLType | GraphQLType[]>
63
+
64
+ export declare interface Field {
65
+ args?: GraphQLArgs
66
+ type: GraphQLType | GraphQLType[]
67
+ }
68
+
69
+ export declare type Fields = Record<string, Field>
70
+
71
+ export declare interface CreationCallback {
72
+ (params: {
73
+ addFields: (newFields: Fields) => void
74
+ modifyFields: (existingFields: Fields) => void
75
+ removeFields: (existingFields: string[]) => void
76
+ setDescription: (newDescription: string) => void
77
+ setInterfaces: (reWrittenInterfaces: GraphQLType[]) => void
78
+ }): void
79
+ }
80
+
81
+ export declare type CreationCallbacks = Record<string, CreationCallback>
82
+
83
+ export declare interface Enum {
84
+ description: string
85
+ values: Record<string, string>
86
+ }
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
+
124
+ export declare interface Extensions {
125
+ creationCallbacks?: CreationCallbacks
126
+ enums?: Enums
127
+ inputTypes?: InputTypes
128
+ interfaces?: Interfaces
129
+ resolvers?: Record<
130
+ string,
131
+ Record<
132
+ string,
133
+ AnyResolver
134
+ >
135
+ >
136
+ typeResolvers?: Record<string, (param: any) => string>
137
+ types?: Types
138
+ unions?: Unions
139
+ }
140
+
141
+
142
+ export type {
143
+ BaseFolderContent,
144
+ MediaImageContent,
145
+ PortalSiteContent,
146
+ } from './xp'
147
+
148
+
149
+ export {
150
+ EnumTypeName,
151
+ FormItemType,
152
+ InputTypeName,
153
+ ObjectTypeName,
154
+ Permission,
155
+ PrincipalType,
156
+ ScalarTypeName,
157
+ } from './guillotine'
package/package.json ADDED
@@ -0,0 +1,50 @@
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
+ "prepublishOnly": "node setversion.js",
46
+ "test": "tsd ./"
47
+ },
48
+ "types": "index.ts",
49
+ "version": "0.0.0"
50
+ }
package/xp/index.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type {Content} from '@enonic-types/core';
2
+ import type {Site} from '@enonic-types/lib-content';
3
+
4
+
5
+ export declare type BaseFolderContent = Content<{}, 'base:folder'>;
6
+
7
+ export declare type MediaImageContent = Content<{
8
+ altText?: string
9
+ artist?: string[]
10
+ caption?: string
11
+ copyright?: string
12
+ media: {
13
+ attachment: string
14
+ focalPoint: {
15
+ x: number // Float
16
+ y: number // Float
17
+ }
18
+ }
19
+ tags?: string[]
20
+ }, 'media:image'>;
21
+
22
+ export declare type PortalSiteContent<Config extends any = undefined> = Site<Config>;