-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
Copy pathHasuraMetadataV3.hs
3815 lines (3384 loc) · 109 KB
/
HasuraMetadataV3.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
module QuickType
( PGColumn (..),
ComputedFieldName (..),
RoleName (..),
TriggerName (..),
RemoteRelationshipName (..),
RemoteSchemaName (..),
CollectionName (..),
GraphQLName (..),
GraphQLType (..),
RelationshipName (..),
ActionName (..),
WebhookURL (..),
TableName (..),
QualifiedTable (..),
TableConfig (..),
TableEntry (..),
CustomRootFields (..),
CustomColumnNames (..),
FunctionName (..),
QualifiedFunction (..),
CustomFunction (..),
FunctionConfiguration (..),
ObjectRelationship (..),
ObjRelUsing (..),
ObjRelUsingManualMapping (..),
ArrayRelationship (..),
ArrRelUsing (..),
ArrRelUsingFKeyOn (..),
ArrRelUsingManualMapping (..),
ColumnPresetsExpression (..),
InsertPermissionEntry (..),
InsertPermission (..),
SelectPermissionEntry (..),
SelectPermission (..),
UpdatePermissionEntry (..),
UpdatePermission (..),
DeletePermissionEntry (..),
DeletePermission (..),
ComputedField (..),
ComputedFieldDefinition (..),
EventTrigger (..),
EventTriggerDefinition (..),
EventTriggerColumns (..),
OperationSpec (..),
HeaderFromValue (..),
HeaderFromEnv (..),
RetryConf (..),
CronTrigger (..),
RetryConfST (..),
RemoteSchema (..),
RemoteSchemaDef (..),
RemoteRelationship (..),
RemoteRelationshipDef (..),
RemoteField (..),
InputArguments (..),
QueryCollectionEntry (..),
QueryCollection (..),
AllowList (..),
CustomTypes (..),
InputObjectType (..),
InputObjectField (..),
ObjectType (..),
ObjectField (..),
CustomTypeObjectRelationship (..),
ScalarType (..),
EnumType (..),
EnumValue (..),
Action (..),
ActionDefinition (..),
InputArgument (..),
HasuraMetadataV2 (..),
FromEnv (..),
PGConfiguration (..),
MSSQLConfiguration (..),
BigQueryConfiguration (..),
PGSourceConnectionInfo (..),
MSSQLSourceConnectionInfo (..),
PGConnectionParameters (..),
PGPoolSettings (..),
PGCERTSettings (..),
MSSQLPoolSettings (..),
BackendKind (..),
BaseSource (..),
PGSource (..),
MSSQLSource (..),
BigQuerySource (..),
Source (..),
APILimits (..),
DepthLimit (..),
RateLimit (..),
RateLimitRule (..),
NodeLimit (..),
RESTEndpoint (..),
RESTEndpointDefinition (..),
InheritedRole (..),
HasuraMetadataV3 (..),
RecordStringAny (..),
Header (..),
Permission (..),
Definition (..),
RemoteFieldValue (..),
PGConnectionParametersClass (..),
RecordStringAnyClass (..),
QueryClass (..),
Configuration (..),
SourceConnectionInfo (..),
PoolSettings (..),
ActionDefinitionType (..),
CustomTypeObjectRelationshipType (..),
Columns (..),
IsolationLevel (..),
PGSourceKind (..),
MSSQLSourceKind (..),
BigQuerySourceKind (..),
UniqueParamsEnum (..),
Method (..),
Filter (..),
DatabaseURL (..),
Sslpassword (..),
Datasets (..),
ServiceAccount (..),
UniqueParams (..),
decodeTopLevel,
)
where
import Data.Aeson
import Data.Aeson.Types (emptyObject)
import Data.ByteString.Lazy (ByteString)
import Data.HashMap.Strict (HashMap)
import Data.Text (Text)
import Data.Vector (Vector)
type PGColumn = Text
type ComputedFieldName = Text
type RoleName = Text
type TriggerName = Text
type RemoteRelationshipName = Text
type RemoteSchemaName = Text
type CollectionName = Text
type GraphQLName = Text
type GraphQLType = Text
type RelationshipName = Text
type ActionName = Text
type WebhookURL = Text
type CustomColumnNames = HashMap Text Text
type ColumnPresetsExpression = HashMap Text Text
type RemoteField = HashMap Text RemoteFieldValue
type InputArguments = HashMap Text Text
type RecordStringAny = HashMap Text (Maybe Text)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue
--
-- name:
-- Name of the header
--
-- value:
-- Value of the header
data HeaderFromValue = HeaderFromValue
{ nameHeaderFromValue :: Text,
valueHeaderFromValue :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv
--
-- name:
-- Name of the header
--
-- valueFromEnv:
-- Name of the environment variable which holds the value of the header
data HeaderFromEnv = HeaderFromEnv
{ nameHeaderFromEnv :: Text,
valueFromEnvHeaderFromEnv :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectfield
--
-- description:
-- Description of the Input object type
--
-- name:
-- Name of the Input object type
--
-- objectFieldType:
-- GraphQL type of the Input object type
data ObjectField = ObjectField
{ descriptionObjectField :: Maybe Text,
nameObjectField :: Text,
objectFieldTypeObjectField :: Text
}
deriving (Show)
-- | Type used in exported 'metadata.json' and replace metadata endpoint
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/manage-metadata.html#replace-metadata
data HasuraMetadataV2 = HasuraMetadataV2
{ actionsHasuraMetadataV2 :: Maybe (Vector Action),
allowlistHasuraMetadataV2 :: Maybe (Vector AllowList),
cronTriggersHasuraMetadataV2 :: Maybe (Vector CronTrigger),
customTypesHasuraMetadataV2 :: Maybe CustomTypes,
functionsHasuraMetadataV2 :: Maybe (Vector CustomFunction),
queryCollectionsHasuraMetadataV2 :: Maybe (Vector QueryCollectionEntry),
remoteSchemasHasuraMetadataV2 :: Maybe (Vector RemoteSchema),
tablesHasuraMetadataV2 :: Vector TableEntry,
versionHasuraMetadataV2 :: Float
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#args-syntax
--
-- comment:
-- Comment
--
-- definition:
-- Definition of the action
--
-- name:
-- Name of the action
--
-- permissions:
-- Permissions of the action
data Action = Action
{ commentAction :: Maybe Text,
definitionAction :: ActionDefinition,
nameAction :: Text,
permissionsAction :: Maybe (Vector Permission)
}
deriving (Show)
-- | Definition of the action
--
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#actiondefinition
--
-- handler:
-- A String value which supports templating environment variables enclosed in {{ and }}.
-- Template example: https://{{ACTION_API_DOMAIN}}/create-user
data ActionDefinition = ActionDefinition
{ argumentsActionDefinition :: Maybe (Vector InputArgument),
forwardClientHeadersActionDefinition :: Maybe Bool,
handlerActionDefinition :: Text,
headersActionDefinition :: Maybe (Vector Header),
kindActionDefinition :: Maybe Text,
outputTypeActionDefinition :: Maybe Text,
actionDefinitionTypeActionDefinition :: Maybe ActionDefinitionType
}
deriving (Show)
data ActionDefinitionType
= MutationActionDefinitionType
| QueryActionDefinitionType
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#inputargument
data InputArgument = InputArgument
{ nameInputArgument :: Text,
inputArgumentTypeInputArgument :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue
--
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv
--
-- name:
-- Name of the header
--
-- value:
-- Value of the header
--
-- valueFromEnv:
-- Name of the environment variable which holds the value of the header
data Header = Header
{ nameHeader :: Text,
valueHeader :: Maybe Text,
valueFromEnvHeader :: Maybe Text
}
deriving (Show)
data Permission = Permission
{ rolePermission :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#add-collection-to-allowlist-syntax
--
-- collection:
-- Name of a query collection to be added to the allow-list
data AllowList = AllowList
{ collectionAllowList :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#create-cron-trigger
--
-- comment:
-- Custom comment.
--
-- headers:
-- List of headers to be sent with the webhook
--
-- includeInMetadata:
-- Flag to indicate whether a trigger should be included in the metadata. When a cron
-- trigger is included in the metadata, the user will be able to export it when the metadata
-- of the graphql-engine is exported.
--
-- name:
-- Name of the cron trigger
--
-- payload:
-- Any JSON payload which will be sent when the webhook is invoked.
--
-- retryConf:
-- Retry configuration if scheduled invocation delivery fails
--
-- schedule:
-- Cron expression at which the trigger should be invoked.
--
-- webhook:
-- URL of the webhook
data CronTrigger = CronTrigger
{ commentCronTrigger :: Maybe Text,
headersCronTrigger :: Vector Header,
includeInMetadataCronTrigger :: Bool,
nameCronTrigger :: Text,
payloadCronTrigger :: Maybe (HashMap Text (Maybe Text)),
retryConfCronTrigger :: Maybe RetryConfST,
scheduleCronTrigger :: Text,
webhookCronTrigger :: Text
}
deriving (Show)
-- | Retry configuration if scheduled invocation delivery fails
--
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#retryconfst
--
-- numRetries:
-- Number of times to retry delivery.
-- Default: 0
--
-- retryIntervalSeconds:
-- Number of seconds to wait between each retry.
-- Default: 10
--
-- timeoutSeconds:
-- Number of seconds to wait for response before timing out.
-- Default: 60
--
-- toleranceSeconds:
-- Number of seconds between scheduled time and actual delivery time that is acceptable. If
-- the time difference is more than this, then the event is dropped.
-- Default: 21600 (6 hours)
data RetryConfST = RetryConfST
{ numRetriesRetryConfST :: Maybe Int,
retryIntervalSecondsRetryConfST :: Maybe Int,
timeoutSecondsRetryConfST :: Maybe Int,
toleranceSecondsRetryConfST :: Maybe Int
}
deriving (Show)
data CustomTypes = CustomTypes
{ enumsCustomTypes :: Maybe (Vector EnumType),
inputObjectsCustomTypes :: Maybe (Vector InputObjectType),
objectsCustomTypes :: Maybe (Vector ObjectType),
scalarsCustomTypes :: Maybe (Vector ScalarType)
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumtype
--
-- description:
-- Description of the Enum type
--
-- name:
-- Name of the Enum type
--
-- values:
-- Values of the Enum type
data EnumType = EnumType
{ descriptionEnumType :: Maybe Text,
nameEnumType :: Text,
valuesEnumType :: Vector EnumValue
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumvalue
--
-- description:
-- Description of the Enum value
--
-- isDeprecated:
-- If set to true, the enum value is marked as deprecated
--
-- value:
-- Value of the Enum type
data EnumValue = EnumValue
{ descriptionEnumValue :: Maybe Text,
isDeprecatedEnumValue :: Maybe Bool,
valueEnumValue :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjecttype
--
-- description:
-- Description of the Input object type
--
-- fields:
-- Fields of the Input object type
--
-- name:
-- Name of the Input object type
data InputObjectType = InputObjectType
{ descriptionInputObjectType :: Maybe Text,
fieldsInputObjectType :: Vector InputObjectField,
nameInputObjectType :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjectfield
--
-- description:
-- Description of the Input object type
--
-- name:
-- Name of the Input object type
--
-- inputObjectFieldType:
-- GraphQL type of the Input object type
data InputObjectField = InputObjectField
{ descriptionInputObjectField :: Maybe Text,
nameInputObjectField :: Text,
inputObjectFieldTypeInputObjectField :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objecttype
--
-- description:
-- Description of the Input object type
--
-- fields:
-- Fields of the Input object type
--
-- name:
-- Name of the Input object type
--
-- relationships:
-- Relationships of the Object type to tables
data ObjectType = ObjectType
{ descriptionObjectType :: Maybe Text,
fieldsObjectType :: Vector InputObjectField,
nameObjectType :: Text,
relationshipsObjectType :: Maybe (Vector CustomTypeObjectRelationship)
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectrelationship
--
-- fieldMapping:
-- Mapping of fields of object type to columns of remote table
--
-- name:
-- Name of the relationship, shouldn’t conflict with existing field names
--
-- remoteTable:
-- The table to which relationship is defined
--
-- customTypeObjectRelationshipType:
-- Type of the relationship
data CustomTypeObjectRelationship = CustomTypeObjectRelationship
{ fieldMappingCustomTypeObjectRelationship :: HashMap Text Text,
nameCustomTypeObjectRelationship :: Text,
remoteTableCustomTypeObjectRelationship :: TableName,
customTypeObjectRelationshipTypeCustomTypeObjectRelationship :: CustomTypeObjectRelationshipType
}
deriving (Show)
-- | Type of the relationship
data CustomTypeObjectRelationshipType
= TypeArrayCustomTypeObjectRelationshipType
| TypeObjectCustomTypeObjectRelationshipType
deriving (Show)
data TableName
= QualifiedTableInTableName QualifiedTable
| StringInTableName Text
deriving (Show)
data QualifiedTable = QualifiedTable
{ nameQualifiedTable :: Text,
schemaQualifiedTable :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#scalartype
--
-- description:
-- Description of the Scalar type
--
-- name:
-- Name of the Scalar type
data ScalarType = ScalarType
{ descriptionScalarType :: Maybe Text,
nameScalarType :: Text
}
deriving (Show)
-- | A custom SQL function to add to the GraphQL schema with configuration.
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#args-syntax
--
-- configuration:
-- Configuration for the SQL function
--
-- function:
-- Name of the SQL function
data CustomFunction = CustomFunction
{ configurationCustomFunction :: Maybe FunctionConfiguration,
functionCustomFunction :: FunctionName
}
deriving (Show)
-- | Configuration for the SQL function
--
-- Configuration for a CustomFunction
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#function-configuration
--
-- sessionArgument:
-- Function argument which accepts session info JSON
-- Currently, only functions which satisfy the following constraints can be exposed over the
-- GraphQL API (terminology from Postgres docs):
-- - Function behaviour: ONLY `STABLE` or `IMMUTABLE`
-- - Return type: MUST be `SETOF <table-name>`
-- - Argument modes: ONLY `IN`
data FunctionConfiguration = FunctionConfiguration
{ sessionArgumentFunctionConfiguration :: Maybe Text
}
deriving (Show)
data FunctionName
= QualifiedFunctionInFunctionName QualifiedFunction
| StringInFunctionName Text
deriving (Show)
data QualifiedFunction = QualifiedFunction
{ nameQualifiedFunction :: Text,
schemaQualifiedFunction :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#args-syntax
--
-- comment:
-- Comment
--
-- definition:
-- List of queries
--
-- name:
-- Name of the query collection
data QueryCollectionEntry = QueryCollectionEntry
{ commentQueryCollectionEntry :: Maybe Text,
definitionQueryCollectionEntry :: Definition,
nameQueryCollectionEntry :: Text
}
deriving (Show)
-- | List of queries
data Definition = Definition
{ queriesDefinition :: Vector QueryCollection
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#collectionquery
data QueryCollection = QueryCollection
{ nameQueryCollection :: Text,
queryQueryCollection :: Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-schemas.html#add-remote-schema
--
-- comment:
-- Comment
--
-- definition:
-- Name of the remote schema
--
-- name:
-- Name of the remote schema
data RemoteSchema = RemoteSchema
{ commentRemoteSchema :: Maybe Text,
definitionRemoteSchema :: RemoteSchemaDef,
nameRemoteSchema :: Text
}
deriving (Show)
-- | Name of the remote schema
--
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#remoteschemadef
data RemoteSchemaDef = RemoteSchemaDef
{ forwardClientHeadersRemoteSchemaDef :: Maybe Bool,
headersRemoteSchemaDef :: Maybe (Vector Header),
timeoutSecondsRemoteSchemaDef :: Maybe Float,
urlRemoteSchemaDef :: Maybe Text,
urlFromEnvRemoteSchemaDef :: Maybe Text
}
deriving (Show)
-- | Representation of a table in metadata, 'tables.yaml' and 'metadata.json'
--
-- configuration:
-- Configuration for the table/view
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config
data TableEntry = TableEntry
{ arrayRelationshipsTableEntry :: Maybe (Vector ArrayRelationship),
computedFieldsTableEntry :: Maybe (Vector ComputedField),
configurationTableEntry :: Maybe TableConfig,
deletePermissionsTableEntry :: Maybe (Vector DeletePermissionEntry),
eventTriggersTableEntry :: Maybe (Vector EventTrigger),
insertPermissionsTableEntry :: Maybe (Vector InsertPermissionEntry),
isEnumTableEntry :: Maybe Bool,
objectRelationshipsTableEntry :: Maybe (Vector ObjectRelationship),
remoteRelationshipsTableEntry :: Maybe (Vector RemoteRelationship),
selectPermissionsTableEntry :: Maybe (Vector SelectPermissionEntry),
tableTableEntry :: QualifiedTable,
updatePermissionsTableEntry :: Maybe (Vector UpdatePermissionEntry)
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#create-array-relationship-syntax
--
-- comment:
-- Comment
--
-- name:
-- Name of the new relationship
--
-- using:
-- Use one of the available ways to define an array relationship
data ArrayRelationship = ArrayRelationship
{ commentArrayRelationship :: Maybe Text,
nameArrayRelationship :: Text,
usingArrayRelationship :: ArrRelUsing
}
deriving (Show)
-- | Use one of the available ways to define an array relationship
--
-- Use one of the available ways to define an object relationship
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusing
--
-- foreignKeyConstraintOn:
-- The column with foreign key constraint
--
-- manualConfiguration:
-- Manual mapping of table and columns
data ArrRelUsing = ArrRelUsing
{ foreignKeyConstraintOnArrRelUsing :: Maybe ArrRelUsingFKeyOn,
manualConfigurationArrRelUsing :: Maybe ArrRelUsingManualMapping
}
deriving (Show)
-- | The column with foreign key constraint
--
-- The column with foreign key constraint
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingfkeyon
data ArrRelUsingFKeyOn = ArrRelUsingFKeyOn
{ columnArrRelUsingFKeyOn :: Text,
tableArrRelUsingFKeyOn :: TableName
}
deriving (Show)
-- | Manual mapping of table and columns
--
-- Manual mapping of table and columns
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingmanualmapping
--
-- columnMapping:
-- Mapping of columns from current table to remote table
--
-- remoteTable:
-- The table to which the relationship has to be established
data ArrRelUsingManualMapping = ArrRelUsingManualMapping
{ columnMappingArrRelUsingManualMapping :: HashMap Text Text,
remoteTableArrRelUsingManualMapping :: TableName
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#args-syntax
--
-- comment:
-- Comment
--
-- definition:
-- The computed field definition
--
-- name:
-- Name of the new computed field
data ComputedField = ComputedField
{ commentComputedField :: Maybe Text,
definitionComputedField :: ComputedFieldDefinition,
nameComputedField :: Text
}
deriving (Show)
-- | The computed field definition
--
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#computedfielddefinition
--
-- function:
-- The SQL function
--
-- sessionArgument:
-- Name of the argument which accepts the Hasura session object as a JSON/JSONB value. If
-- omitted, the Hasura session object is not passed to the function
--
-- tableArgument:
-- Name of the argument which accepts a table row type. If omitted, the first argument is
-- considered a table argument
data ComputedFieldDefinition = ComputedFieldDefinition
{ functionComputedFieldDefinition :: FunctionName,
sessionArgumentComputedFieldDefinition :: Maybe Text,
tableArgumentComputedFieldDefinition :: Maybe Text
}
deriving (Show)
-- | Configuration for the table/view
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config
--
-- customColumnNames:
-- Customise the column names
--
-- customName:
-- Customise the table name
--
-- customRootFields:
-- Customise the root fields
data TableConfig = TableConfig
{ customColumnNamesTableConfig :: Maybe (HashMap Text Text),
customNameTableConfig :: Maybe Text,
customRootFieldsTableConfig :: Maybe CustomRootFields
}
deriving (Show)
-- | Customise the root fields
--
-- Customise the root fields
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#custom-root-fields
--
-- delete:
-- Customise the `delete_<table-name>` root field
--
-- deleteByPk:
-- Customise the `delete_<table-name>_by_pk` root field
--
-- insert:
-- Customise the `insert_<table-name>` root field
--
-- insertOne:
-- Customise the `insert_<table-name>_one` root field
--
-- select:
-- Customise the `<table-name>` root field
--
-- selectAggregate:
-- Customise the `<table-name>_aggregate` root field
--
-- selectByPk:
-- Customise the `<table-name>_by_pk` root field
--
-- update:
-- Customise the `update_<table-name>` root field
--
-- updateByPk:
-- Customise the `update_<table-name>_by_pk` root field
data CustomRootFields = CustomRootFields
{ deleteCustomRootFields :: Maybe Text,
deleteByPkCustomRootFields :: Maybe Text,
insertCustomRootFields :: Maybe Text,
insertOneCustomRootFields :: Maybe Text,
selectCustomRootFields :: Maybe Text,
selectAggregateCustomRootFields :: Maybe Text,
selectByPkCustomRootFields :: Maybe Text,
updateCustomRootFields :: Maybe Text,
updateByPkCustomRootFields :: Maybe Text
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-delete-permission-syntax
--
-- comment:
-- Comment
--
-- permission:
-- The permission definition
--
-- role:
-- Role
data DeletePermissionEntry = DeletePermissionEntry
{ commentDeletePermissionEntry :: Maybe Text,
permissionDeletePermissionEntry :: DeletePermission,
roleDeletePermissionEntry :: Text
}
deriving (Show)
-- | The permission definition
--
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#deletepermission
--
-- filter:
-- Only the rows where this precondition holds true are updatable
data DeletePermission = DeletePermission
{ filterDeletePermission :: Maybe (HashMap Text Filter)
}
deriving (Show)
data Filter
= AnythingMapInFilter (HashMap Text (Maybe Text))
| DoubleInFilter Float
| StringInFilter Text
deriving (Show)
-- | NOTE: The metadata type doesn't QUITE match the 'create' arguments here
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#create-event-trigger
--
-- definition:
-- The SQL function
--
-- headers:
-- The SQL function
--
-- name:
-- Name of the event trigger
--
-- retryConf:
-- The SQL function
--
-- webhook:
-- The SQL function
data EventTrigger = EventTrigger
{ definitionEventTrigger :: EventTriggerDefinition,
headersEventTrigger :: Maybe (Vector Header),
nameEventTrigger :: Text,
retryConfEventTrigger :: RetryConf,
webhookEventTrigger :: Maybe Text,
webhookFromEnvEventTrigger :: Maybe Text
}
deriving (Show)
-- | The SQL function
--
-- delete:
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec
--
-- insert:
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec
--
-- update:
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec
data EventTriggerDefinition = EventTriggerDefinition
{ deleteEventTriggerDefinition :: Maybe OperationSpec,
enableManualEventTriggerDefinition :: Bool,
insertEventTriggerDefinition :: Maybe OperationSpec,
updateEventTriggerDefinition :: Maybe OperationSpec
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec
--
-- columns:
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns
--
-- payload:
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns
data OperationSpec = OperationSpec
{ columnsOperationSpec :: EventTriggerColumns,
payloadOperationSpec :: Maybe EventTriggerColumns
}
deriving (Show)
data EventTriggerColumns
= EnumInEventTriggerColumns Columns
| StringArrayInEventTriggerColumns (Vector Text)
deriving (Show)
data Columns
= EmptyColumns
deriving (Show)
-- | The SQL function
--
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#retryconf
--
-- intervalSEC:
-- Number of seconds to wait between each retry.
-- Default: 10
--
-- numRetries:
-- Number of times to retry delivery.
-- Default: 0
--
-- timeoutSEC:
-- Number of seconds to wait for response before timing out.
-- Default: 60
data RetryConf = RetryConf
{ intervalSECRetryConf :: Maybe Int,
numRetriesRetryConf :: Maybe Int,
timeoutSECRetryConf :: Maybe Int
}
deriving (Show)
-- |
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#args-syntax
--
-- comment:
-- Comment
--
-- permission:
-- The permission definition
--
-- role:
-- Role
data InsertPermissionEntry = InsertPermissionEntry
{ commentInsertPermissionEntry :: Maybe Text,
permissionInsertPermissionEntry :: InsertPermission,
roleInsertPermissionEntry :: Text
}
deriving (Show)
-- | The permission definition
--
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#insertpermission
--
-- backendOnly: