-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
Copy pathHasuraMetadataV2.ts
2156 lines (1937 loc) · 70.8 KB
/
HasuraMetadataV2.ts
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
// To parse this data:
//
// import { Convert, TableName, QualifiedTable, TableConfig, TableEntry, CustomRootFields, FunctionName, QualifiedFunction, CustomFunction, FunctionConfiguration, ObjectRelationship, ObjRelUsing, ObjRelUsingManualMapping, ArrayRelationship, ArrRelUsing, ArrRelUsingFKeyOn, ArrRelUsingManualMapping, InsertPermissionEntry, InsertPermission, SelectPermissionEntry, SelectPermission, UpdatePermissionEntry, UpdatePermission, DeletePermissionEntry, DeletePermission, ComputedField, ComputedFieldDefinition, EventTrigger, EventTriggerDefinition, EventTriggerColumns, OperationSpec, HeaderFromValue, HeaderFromEnv, RetryConf, CronTrigger, RetryConfST, RemoteSchema, RemoteSchemaDef, RemoteRelationship, RemoteRelationshipDef, QueryCollectionEntry, QueryCollection, AllowList, CustomTypes, InputObjectType, InputObjectField, ObjectType, ObjectField, CustomTypeObjectRelationship, ScalarType, EnumType, EnumValue, Action, ActionDefinition, InputArgument, HasuraMetadataV2 } from "./file";
//
// const pGColumn = Convert.toPGColumn(json);
// const computedFieldName = Convert.toComputedFieldName(json);
// const roleName = Convert.toRoleName(json);
// const triggerName = Convert.toTriggerName(json);
// const remoteRelationshipName = Convert.toRemoteRelationshipName(json);
// const remoteSchemaName = Convert.toRemoteSchemaName(json);
// const collectionName = Convert.toCollectionName(json);
// const graphQLName = Convert.toGraphQLName(json);
// const graphQLType = Convert.toGraphQLType(json);
// const relationshipName = Convert.toRelationshipName(json);
// const actionName = Convert.toActionName(json);
// const webhookURL = Convert.toWebhookURL(json);
// const tableName = Convert.toTableName(json);
// const qualifiedTable = Convert.toQualifiedTable(json);
// const tableConfig = Convert.toTableConfig(json);
// const tableEntry = Convert.toTableEntry(json);
// const customRootFields = Convert.toCustomRootFields(json);
// const customColumnNames = Convert.toCustomColumnNames(json);
// const functionName = Convert.toFunctionName(json);
// const qualifiedFunction = Convert.toQualifiedFunction(json);
// const customFunction = Convert.toCustomFunction(json);
// const functionConfiguration = Convert.toFunctionConfiguration(json);
// const objectRelationship = Convert.toObjectRelationship(json);
// const objRelUsing = Convert.toObjRelUsing(json);
// const objRelUsingManualMapping = Convert.toObjRelUsingManualMapping(json);
// const arrayRelationship = Convert.toArrayRelationship(json);
// const arrRelUsing = Convert.toArrRelUsing(json);
// const arrRelUsingFKeyOn = Convert.toArrRelUsingFKeyOn(json);
// const arrRelUsingManualMapping = Convert.toArrRelUsingManualMapping(json);
// const columnPresetsExpression = Convert.toColumnPresetsExpression(json);
// const insertPermissionEntry = Convert.toInsertPermissionEntry(json);
// const insertPermission = Convert.toInsertPermission(json);
// const selectPermissionEntry = Convert.toSelectPermissionEntry(json);
// const selectPermission = Convert.toSelectPermission(json);
// const updatePermissionEntry = Convert.toUpdatePermissionEntry(json);
// const updatePermission = Convert.toUpdatePermission(json);
// const deletePermissionEntry = Convert.toDeletePermissionEntry(json);
// const deletePermission = Convert.toDeletePermission(json);
// const computedField = Convert.toComputedField(json);
// const computedFieldDefinition = Convert.toComputedFieldDefinition(json);
// const eventTrigger = Convert.toEventTrigger(json);
// const eventTriggerDefinition = Convert.toEventTriggerDefinition(json);
// const eventTriggerColumns = Convert.toEventTriggerColumns(json);
// const operationSpec = Convert.toOperationSpec(json);
// const headerFromValue = Convert.toHeaderFromValue(json);
// const headerFromEnv = Convert.toHeaderFromEnv(json);
// const retryConf = Convert.toRetryConf(json);
// const cronTrigger = Convert.toCronTrigger(json);
// const retryConfST = Convert.toRetryConfST(json);
// const remoteSchema = Convert.toRemoteSchema(json);
// const remoteSchemaDef = Convert.toRemoteSchemaDef(json);
// const remoteRelationship = Convert.toRemoteRelationship(json);
// const remoteRelationshipDef = Convert.toRemoteRelationshipDef(json);
// const remoteField = Convert.toRemoteField(json);
// const inputArguments = Convert.toInputArguments(json);
// const queryCollectionEntry = Convert.toQueryCollectionEntry(json);
// const queryCollection = Convert.toQueryCollection(json);
// const allowList = Convert.toAllowList(json);
// const customTypes = Convert.toCustomTypes(json);
// const inputObjectType = Convert.toInputObjectType(json);
// const inputObjectField = Convert.toInputObjectField(json);
// const objectType = Convert.toObjectType(json);
// const objectField = Convert.toObjectField(json);
// const customTypeObjectRelationship = Convert.toCustomTypeObjectRelationship(json);
// const scalarType = Convert.toScalarType(json);
// const enumType = Convert.toEnumType(json);
// const enumValue = Convert.toEnumValue(json);
// const action = Convert.toAction(json);
// const actionDefinition = Convert.toActionDefinition(json);
// const inputArgument = Convert.toInputArgument(json);
// const hasuraMetadataV2 = Convert.toHasuraMetadataV2(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue
*/
export interface HeaderFromValue {
/**
* Name of the header
*/
name: string;
/**
* Value of the header
*/
value: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv
*/
export interface HeaderFromEnv {
/**
* Name of the header
*/
name: string;
/**
* Name of the environment variable which holds the value of the header
*/
value_from_env: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectfield
*/
export interface ObjectField {
/**
* Description of the Input object type
*/
description?: string;
/**
* Name of the Input object type
*/
name: string;
/**
* GraphQL type of the Input object type
*/
type: string;
}
/**
* 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
*/
export interface HasuraMetadataV2 {
actions?: Action[];
allowlist?: AllowList[];
cron_triggers?: CronTrigger[];
custom_types?: CustomTypes;
functions?: CustomFunction[];
query_collections?: QueryCollectionEntry[];
remote_schemas?: RemoteSchema[];
tables: TableEntry[];
version: number;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#args-syntax
*/
export interface Action {
/**
* Comment
*/
comment?: string;
/**
* Definition of the action
*/
definition: ActionDefinition;
/**
* Name of the action
*/
name: string;
/**
* Permissions of the action
*/
permissions?: Permissions;
}
/**
* Definition of the action
*
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#actiondefinition
*/
export interface ActionDefinition {
arguments?: InputArgument[];
forward_client_headers?: boolean;
/**
* A String value which supports templating environment variables enclosed in {{ and }}.
* Template example: https://{{ACTION_API_DOMAIN}}/create-user
*/
handler: string;
headers?: Header[];
kind?: string;
output_type?: string;
type?: ActionDefinitionType;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#inputargument
*/
export interface InputArgument {
name: string;
type: string;
}
/**
*
* 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
*/
export interface Header {
/**
* Name of the header
*/
name: string;
/**
* Value of the header
*/
value?: string;
/**
* Name of the environment variable which holds the value of the header
*/
value_from_env?: string;
}
export enum ActionDefinitionType {
Mutation = "mutation",
Query = "query",
}
/**
* Permissions of the action
*/
export interface Permissions {
role: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#add-collection-to-allowlist-syntax
*/
export interface AllowList {
/**
* Name of a query collection to be added to the allow-list
*/
collection: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#create-cron-trigger
*/
export interface CronTrigger {
/**
* Custom comment.
*/
comment?: string;
/**
* List of headers to be sent with the webhook
*/
headers: Header[];
/**
* 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.
*/
include_in_metadata: boolean;
/**
* Name of the cron trigger
*/
name: string;
/**
* Any JSON payload which will be sent when the webhook is invoked.
*/
payload?: { [key: string]: any };
/**
* Retry configuration if scheduled invocation delivery fails
*/
retry_conf?: RetryConfST;
/**
* Cron expression at which the trigger should be invoked.
*/
schedule: string;
/**
* URL of the webhook
*/
webhook: string;
}
/**
* Retry configuration if scheduled invocation delivery fails
*
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#retryconfst
*/
export interface RetryConfST {
/**
* Number of times to retry delivery.
* Default: 0
*/
num_retries?: number;
/**
* Number of seconds to wait between each retry.
* Default: 10
*/
retry_interval_seconds?: number;
/**
* Number of seconds to wait for response before timing out.
* Default: 60
*/
timeout_seconds?: number;
/**
* 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)
*/
tolerance_seconds?: number;
}
export interface CustomTypes {
enums?: EnumType[];
input_objects?: InputObjectType[];
objects?: ObjectType[];
scalars?: ScalarType[];
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumtype
*/
export interface EnumType {
/**
* Description of the Enum type
*/
description?: string;
/**
* Name of the Enum type
*/
name: string;
/**
* Values of the Enum type
*/
values: EnumValue[];
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumvalue
*/
export interface EnumValue {
/**
* Description of the Enum value
*/
description?: string;
/**
* If set to true, the enum value is marked as deprecated
*/
is_deprecated?: boolean;
/**
* Value of the Enum type
*/
value: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjecttype
*/
export interface InputObjectType {
/**
* Description of the Input object type
*/
description?: string;
/**
* Fields of the Input object type
*/
fields: InputObjectField[];
/**
* Name of the Input object type
*/
name: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjectfield
*/
export interface InputObjectField {
/**
* Description of the Input object type
*/
description?: string;
/**
* Name of the Input object type
*/
name: string;
/**
* GraphQL type of the Input object type
*/
type: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objecttype
*/
export interface ObjectType {
/**
* Description of the Input object type
*/
description?: string;
/**
* Fields of the Input object type
*/
fields: InputObjectField[];
/**
* Name of the Input object type
*/
name: string;
/**
* Relationships of the Object type to tables
*/
relationships?: CustomTypeObjectRelationship[];
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectrelationship
*/
export interface CustomTypeObjectRelationship {
/**
* Mapping of fields of object type to columns of remote table
*/
field_mapping: { [key: string]: string };
/**
* Name of the relationship, shouldn’t conflict with existing field names
*/
name: string;
/**
* The table to which relationship is defined
*/
remote_table: QualifiedTable | string;
/**
* Type of the relationship
*/
type: CustomTypeObjectRelationshipType;
}
export interface QualifiedTable {
name: string;
schema: string;
}
/**
* Type of the relationship
*/
export enum CustomTypeObjectRelationshipType {
Array = "array",
Object = "object",
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#scalartype
*/
export interface ScalarType {
/**
* Description of the Scalar type
*/
description?: string;
/**
* Name of the Scalar type
*/
name: string;
}
/**
* 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
*/
export interface CustomFunction {
/**
* Configuration for the SQL function
*/
configuration?: FunctionConfiguration;
/**
* Name of the SQL function
*/
function: QualifiedFunction | string;
}
/**
* 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
*/
export interface FunctionConfiguration {
/**
* 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`
*/
session_argument?: string;
}
export interface QualifiedFunction {
name: string;
schema: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#args-syntax
*/
export interface QueryCollectionEntry {
/**
* Comment
*/
comment?: string;
/**
* List of queries
*/
definition: Definition;
/**
* Name of the query collection
*/
name: string;
}
/**
* List of queries
*/
export interface Definition {
queries: QueryCollection[];
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#collectionquery
*/
export interface QueryCollection {
name: string;
query: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-schemas.html#add-remote-schema
*/
export interface RemoteSchema {
/**
* Comment
*/
comment?: string;
/**
* Name of the remote schema
*/
definition: RemoteSchemaDef;
/**
* Name of the remote schema
*/
name: string;
}
/**
* Name of the remote schema
*
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#remoteschemadef
*/
export interface RemoteSchemaDef {
forward_client_headers?: boolean;
headers?: Header[];
timeout_seconds?: number;
url?: string;
url_from_env?: string;
}
/**
* Representation of a table in metadata, 'tables.yaml' and 'metadata.json'
*/
export interface TableEntry {
array_relationships?: ArrayRelationship[];
computed_fields?: ComputedField[];
/**
* Configuration for the table/view
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config
*/
configuration?: TableConfig;
delete_permissions?: DeletePermissionEntry[];
event_triggers?: EventTrigger[];
insert_permissions?: InsertPermissionEntry[];
is_enum?: boolean;
object_relationships?: ObjectRelationship[];
remote_relationships?: RemoteRelationship[];
select_permissions?: SelectPermissionEntry[];
table: QualifiedTable;
update_permissions?: UpdatePermissionEntry[];
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#create-array-relationship-syntax
*/
export interface ArrayRelationship {
/**
* Comment
*/
comment?: string;
/**
* Name of the new relationship
*/
name: string;
/**
* Use one of the available ways to define an array relationship
*/
using: ArrRelUsing;
}
/**
* 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
*/
export interface ArrRelUsing {
/**
* The column with foreign key constraint
*/
foreign_key_constraint_on?: ArrRelUsingFKeyOn;
/**
* Manual mapping of table and columns
*/
manual_configuration?: ArrRelUsingManualMapping;
}
/**
* 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
*/
export interface ArrRelUsingFKeyOn {
column: string;
table: QualifiedTable | string;
}
/**
* 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
*/
export interface ArrRelUsingManualMapping {
/**
* Mapping of columns from current table to remote table
*/
column_mapping: { [key: string]: string };
/**
* The table to which the relationship has to be established
*/
remote_table: QualifiedTable | string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#args-syntax
*/
export interface ComputedField {
/**
* Comment
*/
comment?: string;
/**
* The computed field definition
*/
definition: ComputedFieldDefinition;
/**
* Name of the new computed field
*/
name: string;
}
/**
* The computed field definition
*
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#computedfielddefinition
*/
export interface ComputedFieldDefinition {
/**
* The SQL function
*/
function: QualifiedFunction | string;
/**
* 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
*/
session_argument?: string;
/**
* Name of the argument which accepts a table row type. If omitted, the first argument is
* considered a table argument
*/
table_argument?: string;
}
/**
* Configuration for the table/view
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config
*/
export interface TableConfig {
/**
* Customise the table name / query root name
*/
custom_name: string;
/**
* Customise the column names
*/
custom_column_names?: { [key: string]: string };
/**
* Customise the root fields
*/
custom_root_fields?: CustomRootFields;
}
/**
* 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
*/
export interface CustomRootFields {
/**
* Customise the `delete_<table-name>` root field
*/
delete?: string;
/**
* Customise the `delete_<table-name>_by_pk` root field
*/
delete_by_pk?: string;
/**
* Customise the `insert_<table-name>` root field
*/
insert?: string;
/**
* Customise the `insert_<table-name>_one` root field
*/
insert_one?: string;
/**
* Customise the `<table-name>` root field
*/
select?: string;
/**
* Customise the `<table-name>_aggregate` root field
*/
select_aggregate?: string;
/**
* Customise the `<table-name>_by_pk` root field
*/
select_by_pk?: string;
/**
* Customise the `update_<table-name>` root field
*/
update?: string;
/**
* Customise the `update_<table-name>_by_pk` root field
*/
update_by_pk?: string;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-delete-permission-syntax
*/
export interface DeletePermissionEntry {
/**
* Comment
*/
comment?: string;
/**
* The permission definition
*/
permission: DeletePermission;
/**
* Role
*/
role: string;
}
/**
* The permission definition
*
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#deletepermission
*/
export interface DeletePermission {
/**
* Only the rows where this precondition holds true are updatable
*/
filter?: { [key: string]: number | { [key: string]: any } | string };
}
/**
* 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
*/
export interface EventTrigger {
/**
* The SQL function
*/
definition: EventTriggerDefinition;
/**
* The SQL function
*/
headers?: Header[];
/**
* Name of the event trigger
*/
name: string;
/**
* The SQL function
*/
retry_conf: RetryConf;
/**
* The SQL function
*/
webhook?: string;
webhook_from_env?: string;
}
/**
* The SQL function
*/
export interface EventTriggerDefinition {
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec
*/
delete?: OperationSpec;
enable_manual: boolean;
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec
*/
insert?: OperationSpec;
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec
*/
update?: OperationSpec;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec
*/
export interface OperationSpec {
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns
*/
columns: string[] | Columns;
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns
*/
payload?: string[] | Columns;
}
export enum Columns {
Empty = "*",
}
/**
* The SQL function
*
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#retryconf
*/
export interface RetryConf {
/**
* Number of seconds to wait between each retry.
* Default: 10
*/
interval_sec?: number;
/**
* Number of times to retry delivery.
* Default: 0
*/
num_retries?: number;
/**
* Number of seconds to wait for response before timing out.
* Default: 60
*/
timeout_sec?: number;
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#args-syntax
*/
export interface InsertPermissionEntry {
/**
* Comment
*/
comment?: string;
/**
* The permission definition
*/
permission: InsertPermission;
/**
* Role
*/
role: string;
}
/**
* The permission definition
*
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#insertpermission
*/
export interface InsertPermission {
/**
* When set to true the mutation is accessible only if x-hasura-use-backend-only-permissions
* session variable exists
* and is set to true and request is made with x-hasura-admin-secret set if any auth is
* configured
*/
backend_only?: boolean;
/**
* This expression has to hold true for every new row that is inserted
*/
check?: { [key: string]: number | { [key: string]: any } | string };
/**
* Can insert into only these columns (or all when '*' is specified)
*/
columns: string[] | Columns;
/**
* Preset values for columns that can be sourced from session variables or static values
*/
set?: { [key: string]: string };
}
/**
*
* https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#args-syntax
*/
export interface ObjectRelationship {
/**
* Comment
*/
comment?: string;
/**
* Name of the new relationship
*/
name: string;
/**
* Use one of the available ways to define an object relationship
*/
using: ObjRelUsing;
}
/**
* Use one of the available ways to define an object 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#objrelusing
*/
export interface ObjRelUsing {
/**
* The column with foreign key constraint
*/
foreign_key_constraint_on?: string;
/**
* Manual mapping of table and columns
*/
manual_configuration?: ObjRelUsingManualMapping;
}
/**
* 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#objrelusingmanualmapping
*/
export interface ObjRelUsingManualMapping {
/**
* Mapping of columns from current table to remote table
*/
column_mapping: { [key: string]: string };