graphile-build-pg 4.9.1 → 4.11.2
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.
- package/README.md +1 -0
- package/node8plus/plugins/PageInfoStartEndCursor.js +2 -2
- package/node8plus/plugins/PageInfoStartEndCursor.js.flow +6 -2
- package/node8plus/plugins/PageInfoStartEndCursor.js.map +1 -1
- package/node8plus/plugins/PgAllRows.js +1 -1
- package/node8plus/plugins/PgAllRows.js.flow +6 -3
- package/node8plus/plugins/PgAllRows.js.map +1 -1
- package/node8plus/plugins/PgBackwardRelationPlugin.js +2 -2
- package/node8plus/plugins/PgBackwardRelationPlugin.js.flow +8 -2
- package/node8plus/plugins/PgBackwardRelationPlugin.js.map +1 -1
- package/node8plus/plugins/PgBasicsPlugin.js +1 -1
- package/node8plus/plugins/PgBasicsPlugin.js.flow +1 -1
- package/node8plus/plugins/PgBasicsPlugin.js.map +1 -1
- package/node8plus/plugins/PgConditionComputedColumnPlugin.js +1 -1
- package/node8plus/plugins/PgConditionComputedColumnPlugin.js.flow +4 -1
- package/node8plus/plugins/PgConditionComputedColumnPlugin.js.map +1 -1
- package/node8plus/plugins/PgConnectionArgCondition.js +3 -3
- package/node8plus/plugins/PgConnectionArgCondition.js.flow +11 -3
- package/node8plus/plugins/PgConnectionArgCondition.js.map +1 -1
- package/node8plus/plugins/PgConnectionArgFirstLastBeforeAfter.js +5 -5
- package/node8plus/plugins/PgConnectionArgFirstLastBeforeAfter.js.flow +20 -7
- package/node8plus/plugins/PgConnectionArgFirstLastBeforeAfter.js.map +1 -1
- package/node8plus/plugins/PgConnectionArgOrderBy.js +2 -2
- package/node8plus/plugins/PgConnectionArgOrderBy.js.flow +8 -2
- package/node8plus/plugins/PgConnectionArgOrderBy.js.map +1 -1
- package/node8plus/plugins/PgConnectionTotalCount.js +1 -1
- package/node8plus/plugins/PgConnectionTotalCount.js.flow +4 -1
- package/node8plus/plugins/PgConnectionTotalCount.js.map +1 -1
- package/node8plus/plugins/PgForwardRelationPlugin.js +1 -1
- package/node8plus/plugins/PgForwardRelationPlugin.js.flow +4 -1
- package/node8plus/plugins/PgForwardRelationPlugin.js.map +1 -1
- package/node8plus/plugins/PgIntrospectionPlugin.d.ts +1 -0
- package/node8plus/plugins/PgIntrospectionPlugin.js +182 -159
- package/node8plus/plugins/PgIntrospectionPlugin.js.flow +218 -198
- package/node8plus/plugins/PgIntrospectionPlugin.js.map +1 -1
- package/node8plus/plugins/PgJWTPlugin.js +1 -1
- package/node8plus/plugins/PgJWTPlugin.js.flow +3 -1
- package/node8plus/plugins/PgJWTPlugin.js.map +1 -1
- package/node8plus/plugins/PgMutationCreatePlugin.js +7 -7
- package/node8plus/plugins/PgMutationCreatePlugin.js.flow +26 -7
- package/node8plus/plugins/PgMutationCreatePlugin.js.map +1 -1
- package/node8plus/plugins/PgMutationPayloadEdgePlugin.js +2 -2
- package/node8plus/plugins/PgMutationPayloadEdgePlugin.js.flow +8 -2
- package/node8plus/plugins/PgMutationPayloadEdgePlugin.js.map +1 -1
- package/node8plus/plugins/PgMutationUpdateDeletePlugin.js +11 -11
- package/node8plus/plugins/PgMutationUpdateDeletePlugin.js.flow +40 -11
- package/node8plus/plugins/PgMutationUpdateDeletePlugin.js.map +1 -1
- package/node8plus/plugins/PgRecordFunctionConnectionPlugin.js +6 -6
- package/node8plus/plugins/PgRecordFunctionConnectionPlugin.js.flow +24 -6
- package/node8plus/plugins/PgRecordFunctionConnectionPlugin.js.map +1 -1
- package/node8plus/plugins/PgRecordReturnTypesPlugin.js +1 -1
- package/node8plus/plugins/PgRecordReturnTypesPlugin.js.flow +6 -3
- package/node8plus/plugins/PgRecordReturnTypesPlugin.js.map +1 -1
- package/node8plus/plugins/PgRowNode.js +2 -2
- package/node8plus/plugins/PgRowNode.js.flow +8 -2
- package/node8plus/plugins/PgRowNode.js.map +1 -1
- package/node8plus/plugins/PgScalarFunctionConnectionPlugin.js +6 -6
- package/node8plus/plugins/PgScalarFunctionConnectionPlugin.js.flow +24 -6
- package/node8plus/plugins/PgScalarFunctionConnectionPlugin.js.map +1 -1
- package/node8plus/plugins/PgTablesPlugin.js +13 -13
- package/node8plus/plugins/PgTablesPlugin.js.flow +56 -20
- package/node8plus/plugins/PgTablesPlugin.js.map +1 -1
- package/node8plus/plugins/PgTypesPlugin.js +62 -78
- package/node8plus/plugins/PgTypesPlugin.js.flow +193 -76
- package/node8plus/plugins/PgTypesPlugin.js.map +1 -1
- package/node8plus/plugins/makeProcField.js +3 -3
- package/node8plus/plugins/makeProcField.js.flow +16 -7
- package/node8plus/plugins/makeProcField.js.map +1 -1
- package/node8plus/plugins/viaTemporaryTable.js +1 -1
- package/node8plus/plugins/viaTemporaryTable.js.flow +8 -4
- package/node8plus/plugins/viaTemporaryTable.js.map +1 -1
- package/node8plus/postgresInterval.js +12 -33
- package/node8plus/postgresInterval.js.flow +22 -51
- package/node8plus/postgresInterval.js.map +1 -1
- package/package.json +9 -9
- package/res/watch-fixtures.sql +1 -1
|
@@ -3,8 +3,7 @@ import type { Plugin } from "graphile-build";
|
|
|
3
3
|
|
|
4
4
|
import makeGraphQLJSONType from "../GraphQLJSON";
|
|
5
5
|
|
|
6
|
-
import { parseInterval
|
|
7
|
-
import LRU from "@graphile/lru";
|
|
6
|
+
import { parseInterval } from "../postgresInterval";
|
|
8
7
|
|
|
9
8
|
function indent(str) {
|
|
10
9
|
return " " + str.replace(/\n/g, "\n ");
|
|
@@ -14,17 +13,6 @@ function identity(value) {
|
|
|
14
13
|
return value;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
const parseCache = new LRU({ maxLength: 500 });
|
|
18
|
-
function parseInterval(str) {
|
|
19
|
-
let result = parseCache.get(str);
|
|
20
|
-
if (!result) {
|
|
21
|
-
result = rawParseInterval(str);
|
|
22
|
-
Object.freeze(result);
|
|
23
|
-
parseCache.set(str, result);
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
16
|
export default (function PgTypesPlugin(
|
|
29
17
|
builder,
|
|
30
18
|
{
|
|
@@ -149,9 +137,11 @@ export default (function PgTypesPlugin(
|
|
|
149
137
|
return sql.fragment`array[${sql.join(
|
|
150
138
|
val.map(v => gql2pg(v, type.arrayItemType, modifier)),
|
|
151
139
|
", "
|
|
152
|
-
)}]::${
|
|
153
|
-
type.
|
|
154
|
-
|
|
140
|
+
)}]::${
|
|
141
|
+
type.isFake
|
|
142
|
+
? sql.identifier("unknown")
|
|
143
|
+
: sql.identifier(type.namespaceName, type.name)
|
|
144
|
+
}`;
|
|
155
145
|
} else {
|
|
156
146
|
return sql.value(val);
|
|
157
147
|
}
|
|
@@ -160,28 +150,36 @@ export default (function PgTypesPlugin(
|
|
|
160
150
|
const makeIntervalFields = () => {
|
|
161
151
|
return {
|
|
162
152
|
seconds: {
|
|
163
|
-
description:
|
|
153
|
+
description: build.wrapDescription(
|
|
164
154
|
"A quantity of seconds. This is the only non-integer field, as all the other fields will dump their overflow into a smaller unit of time. Intervals don’t have a smaller unit than seconds.",
|
|
155
|
+
"field"
|
|
156
|
+
),
|
|
165
157
|
type: GraphQLFloat,
|
|
166
158
|
},
|
|
167
159
|
minutes: {
|
|
168
|
-
description:
|
|
160
|
+
description: build.wrapDescription(
|
|
161
|
+
"A quantity of minutes.",
|
|
162
|
+
"field"
|
|
163
|
+
),
|
|
169
164
|
type: GraphQLInt,
|
|
170
165
|
},
|
|
171
166
|
hours: {
|
|
172
|
-
description: "A quantity of hours.",
|
|
167
|
+
description: build.wrapDescription("A quantity of hours.", "field"),
|
|
173
168
|
type: GraphQLInt,
|
|
174
169
|
},
|
|
175
170
|
days: {
|
|
176
|
-
description: "A quantity of days.",
|
|
171
|
+
description: build.wrapDescription("A quantity of days.", "field"),
|
|
177
172
|
type: GraphQLInt,
|
|
178
173
|
},
|
|
179
174
|
months: {
|
|
180
|
-
description:
|
|
175
|
+
description: build.wrapDescription(
|
|
176
|
+
"A quantity of months.",
|
|
177
|
+
"field"
|
|
178
|
+
),
|
|
181
179
|
type: GraphQLInt,
|
|
182
180
|
},
|
|
183
181
|
years: {
|
|
184
|
-
description: "A quantity of years.",
|
|
182
|
+
description: build.wrapDescription("A quantity of years.", "field"),
|
|
185
183
|
type: GraphQLInt,
|
|
186
184
|
},
|
|
187
185
|
};
|
|
@@ -190,8 +188,10 @@ export default (function PgTypesPlugin(
|
|
|
190
188
|
GraphQLObjectType,
|
|
191
189
|
{
|
|
192
190
|
name: inflection.builtin("Interval"),
|
|
193
|
-
description:
|
|
191
|
+
description: build.wrapDescription(
|
|
194
192
|
"An interval of time that has passed where the smallest distinct unit is a second.",
|
|
193
|
+
"type"
|
|
194
|
+
),
|
|
195
195
|
fields: makeIntervalFields(),
|
|
196
196
|
},
|
|
197
197
|
{
|
|
@@ -204,8 +204,10 @@ export default (function PgTypesPlugin(
|
|
|
204
204
|
GraphQLInputObjectType,
|
|
205
205
|
{
|
|
206
206
|
name: inflection.inputType(inflection.builtin("Interval")),
|
|
207
|
-
description:
|
|
207
|
+
description: build.wrapDescription(
|
|
208
208
|
"An interval of time that has passed where the smallest distinct unit is a second.",
|
|
209
|
+
"type"
|
|
210
|
+
),
|
|
209
211
|
fields: makeIntervalFields(),
|
|
210
212
|
},
|
|
211
213
|
{
|
|
@@ -236,11 +238,17 @@ export default (function PgTypesPlugin(
|
|
|
236
238
|
|
|
237
239
|
const BigFloat = stringType(
|
|
238
240
|
inflection.builtin("BigFloat"),
|
|
239
|
-
|
|
241
|
+
build.wrapDescription(
|
|
242
|
+
"A floating point number that requires more precision than IEEE 754 binary 64",
|
|
243
|
+
"type"
|
|
244
|
+
)
|
|
240
245
|
);
|
|
241
246
|
const BitString = stringType(
|
|
242
247
|
inflection.builtin("BitString"),
|
|
243
|
-
|
|
248
|
+
build.wrapDescription(
|
|
249
|
+
"A string representing a series of binary bits",
|
|
250
|
+
"type"
|
|
251
|
+
)
|
|
244
252
|
);
|
|
245
253
|
addType(BigFloat, "graphile-build-pg built-in");
|
|
246
254
|
addType(BitString, "graphile-build-pg built-in");
|
|
@@ -379,23 +387,35 @@ export default (function PgTypesPlugin(
|
|
|
379
387
|
*/
|
|
380
388
|
const SimpleDate = stringType(
|
|
381
389
|
inflection.builtin("Date"),
|
|
382
|
-
"The day, does not include a time."
|
|
390
|
+
build.wrapDescription("The day, does not include a time.", "type")
|
|
383
391
|
);
|
|
384
392
|
const SimpleDatetime = stringType(
|
|
385
393
|
inflection.builtin("Datetime"),
|
|
386
|
-
|
|
394
|
+
build.wrapDescription(
|
|
395
|
+
"A point in time as described by the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. May or may not include a timezone.",
|
|
396
|
+
"type"
|
|
397
|
+
)
|
|
387
398
|
);
|
|
388
399
|
const SimpleTime = stringType(
|
|
389
400
|
inflection.builtin("Time"),
|
|
390
|
-
|
|
401
|
+
build.wrapDescription(
|
|
402
|
+
"The exact time of day, does not include the date. May or may not have a timezone offset.",
|
|
403
|
+
"type"
|
|
404
|
+
)
|
|
391
405
|
);
|
|
392
406
|
const SimpleJSON = stringType(
|
|
393
407
|
inflection.builtin("JSON"),
|
|
394
|
-
|
|
408
|
+
build.wrapDescription(
|
|
409
|
+
"A JavaScript object encoded in the JSON format as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).",
|
|
410
|
+
"type"
|
|
411
|
+
)
|
|
395
412
|
);
|
|
396
413
|
const SimpleUUID = stringType(
|
|
397
414
|
inflection.builtin("UUID"),
|
|
398
|
-
|
|
415
|
+
build.wrapDescription(
|
|
416
|
+
"A universally unique identifier as defined by [RFC 4122](https://tools.ietf.org/html/rfc4122).",
|
|
417
|
+
"type"
|
|
418
|
+
),
|
|
399
419
|
string => {
|
|
400
420
|
if (
|
|
401
421
|
!/^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$/i.test(
|
|
@@ -411,61 +431,97 @@ export default (function PgTypesPlugin(
|
|
|
411
431
|
);
|
|
412
432
|
const InetType = stringType(
|
|
413
433
|
inflection.builtin("InternetAddress"),
|
|
414
|
-
|
|
434
|
+
build.wrapDescription(
|
|
435
|
+
"An IPv4 or IPv6 host address, and optionally its subnet.",
|
|
436
|
+
"type"
|
|
437
|
+
)
|
|
415
438
|
);
|
|
416
439
|
const RegProcType = stringType(
|
|
417
440
|
inflection.builtin("RegProc"),
|
|
418
|
-
|
|
441
|
+
build.wrapDescription(
|
|
442
|
+
"A builtin object identifier type for a function name",
|
|
443
|
+
"type"
|
|
444
|
+
)
|
|
419
445
|
);
|
|
420
446
|
const RegProcedureType = stringType(
|
|
421
447
|
inflection.builtin("RegProcedure"),
|
|
422
|
-
|
|
448
|
+
build.wrapDescription(
|
|
449
|
+
"A builtin object identifier type for a function with argument types",
|
|
450
|
+
"type"
|
|
451
|
+
)
|
|
423
452
|
);
|
|
424
453
|
const RegOperType = stringType(
|
|
425
454
|
inflection.builtin("RegOper"),
|
|
426
|
-
|
|
455
|
+
build.wrapDescription(
|
|
456
|
+
"A builtin object identifier type for an operator",
|
|
457
|
+
"type"
|
|
458
|
+
)
|
|
427
459
|
);
|
|
428
460
|
const RegOperatorType = stringType(
|
|
429
461
|
inflection.builtin("RegOperator"),
|
|
430
|
-
|
|
462
|
+
build.wrapDescription(
|
|
463
|
+
"A builtin object identifier type for an operator with argument types",
|
|
464
|
+
"type"
|
|
465
|
+
)
|
|
431
466
|
);
|
|
432
467
|
const RegClassType = stringType(
|
|
433
468
|
inflection.builtin("RegClass"),
|
|
434
|
-
|
|
469
|
+
build.wrapDescription(
|
|
470
|
+
"A builtin object identifier type for a relation name",
|
|
471
|
+
"type"
|
|
472
|
+
)
|
|
435
473
|
);
|
|
436
474
|
const RegTypeType = stringType(
|
|
437
475
|
inflection.builtin("RegType"),
|
|
438
|
-
|
|
476
|
+
build.wrapDescription(
|
|
477
|
+
"A builtin object identifier type for a data type name",
|
|
478
|
+
"type"
|
|
479
|
+
)
|
|
439
480
|
);
|
|
440
481
|
const RegRoleType = stringType(
|
|
441
482
|
inflection.builtin("RegRole"),
|
|
442
|
-
|
|
483
|
+
build.wrapDescription(
|
|
484
|
+
"A builtin object identifier type for a role name",
|
|
485
|
+
"type"
|
|
486
|
+
)
|
|
443
487
|
);
|
|
444
488
|
const RegNamespaceType = stringType(
|
|
445
489
|
inflection.builtin("RegNamespace"),
|
|
446
|
-
|
|
490
|
+
build.wrapDescription(
|
|
491
|
+
"A builtin object identifier type for a namespace name",
|
|
492
|
+
"type"
|
|
493
|
+
)
|
|
447
494
|
);
|
|
448
495
|
const RegConfigType = stringType(
|
|
449
496
|
inflection.builtin("RegConfig"),
|
|
450
|
-
|
|
497
|
+
build.wrapDescription(
|
|
498
|
+
"A builtin object identifier type for a text search configuration",
|
|
499
|
+
"type"
|
|
500
|
+
)
|
|
451
501
|
);
|
|
452
502
|
const RegDictionaryType = stringType(
|
|
453
503
|
inflection.builtin("RegDictionary"),
|
|
454
|
-
|
|
504
|
+
build.wrapDescription(
|
|
505
|
+
"A builtin object identifier type for a text search dictionary",
|
|
506
|
+
"type"
|
|
507
|
+
)
|
|
455
508
|
);
|
|
456
509
|
const CidrType = pgUseCustomNetworkScalars
|
|
457
510
|
? stringType(
|
|
458
511
|
inflection.builtin("CidrAddress"),
|
|
459
|
-
"An IPv4 or IPv6 CIDR address."
|
|
512
|
+
build.wrapDescription("An IPv4 or IPv6 CIDR address.", "type")
|
|
460
513
|
)
|
|
461
514
|
: GraphQLString;
|
|
462
515
|
const MacAddrType = pgUseCustomNetworkScalars
|
|
463
|
-
? stringType(
|
|
516
|
+
? stringType(
|
|
517
|
+
inflection.builtin("MacAddress"),
|
|
518
|
+
build.wrapDescription("A 6-byte MAC address.", "type")
|
|
519
|
+
)
|
|
464
520
|
: GraphQLString;
|
|
465
521
|
const MacAddr8Type = pgUseCustomNetworkScalars
|
|
466
522
|
? stringType(
|
|
467
523
|
inflection.builtin("MacAddress8"),
|
|
468
|
-
"An 8-byte MAC address."
|
|
524
|
+
build.wrapDescription("An 8-byte MAC address.", "type")
|
|
469
525
|
)
|
|
470
526
|
: GraphQLString;
|
|
471
527
|
|
|
@@ -534,7 +590,10 @@ export default (function PgTypesPlugin(
|
|
|
534
590
|
const oidLookup = {
|
|
535
591
|
20: stringType(
|
|
536
592
|
inflection.builtin("BigInt"),
|
|
537
|
-
|
|
593
|
+
build.wrapDescription(
|
|
594
|
+
"A signed eight-byte integer. The upper big integer values are greater than the max value for a JavaScript number. Therefore all big integers will be output as strings and not numbers.",
|
|
595
|
+
"type"
|
|
596
|
+
)
|
|
538
597
|
), // bitint - even though this is int8, it's too big for JS int, so cast to string.
|
|
539
598
|
21: GraphQLInt, // int2
|
|
540
599
|
23: GraphQLInt, // int4
|
|
@@ -750,16 +809,23 @@ export default (function PgTypesPlugin(
|
|
|
750
809
|
GraphQLObjectType,
|
|
751
810
|
{
|
|
752
811
|
name: inflection.rangeBoundType(gqlRangeSubType.name),
|
|
753
|
-
description:
|
|
812
|
+
description: build.wrapDescription(
|
|
754
813
|
"The value at one end of a range. A range can either include this value, or not.",
|
|
814
|
+
"type"
|
|
815
|
+
),
|
|
755
816
|
fields: {
|
|
756
817
|
value: {
|
|
757
|
-
description:
|
|
818
|
+
description: build.wrapDescription(
|
|
819
|
+
"The value at one end of our range.",
|
|
820
|
+
"field"
|
|
821
|
+
),
|
|
758
822
|
type: new GraphQLNonNull(gqlRangeSubType),
|
|
759
823
|
},
|
|
760
824
|
inclusive: {
|
|
761
|
-
description:
|
|
825
|
+
description: build.wrapDescription(
|
|
762
826
|
"Whether or not the value of this bound is included in the range.",
|
|
827
|
+
"field"
|
|
828
|
+
),
|
|
763
829
|
type: new GraphQLNonNull(GraphQLBoolean),
|
|
764
830
|
},
|
|
765
831
|
},
|
|
@@ -775,16 +841,23 @@ export default (function PgTypesPlugin(
|
|
|
775
841
|
GraphQLInputObjectType,
|
|
776
842
|
{
|
|
777
843
|
name: inflection.inputType(RangeBound.name),
|
|
778
|
-
description:
|
|
844
|
+
description: build.wrapDescription(
|
|
779
845
|
"The value at one end of a range. A range can either include this value, or not.",
|
|
846
|
+
"type"
|
|
847
|
+
),
|
|
780
848
|
fields: {
|
|
781
849
|
value: {
|
|
782
|
-
description:
|
|
850
|
+
description: build.wrapDescription(
|
|
851
|
+
"The value at one end of our range.",
|
|
852
|
+
"field"
|
|
853
|
+
),
|
|
783
854
|
type: new GraphQLNonNull(gqlRangeInputSubType),
|
|
784
855
|
},
|
|
785
856
|
inclusive: {
|
|
786
|
-
description:
|
|
857
|
+
description: build.wrapDescription(
|
|
787
858
|
"Whether or not the value of this bound is included in the range.",
|
|
859
|
+
"field"
|
|
860
|
+
),
|
|
788
861
|
type: new GraphQLNonNull(GraphQLBoolean),
|
|
789
862
|
},
|
|
790
863
|
},
|
|
@@ -800,14 +873,23 @@ export default (function PgTypesPlugin(
|
|
|
800
873
|
GraphQLObjectType,
|
|
801
874
|
{
|
|
802
875
|
name: inflection.rangeType(gqlRangeSubType.name),
|
|
803
|
-
description:
|
|
876
|
+
description: build.wrapDescription(
|
|
877
|
+
`A range of \`${gqlRangeSubType.name}\`.`,
|
|
878
|
+
"type"
|
|
879
|
+
),
|
|
804
880
|
fields: {
|
|
805
881
|
start: {
|
|
806
|
-
description:
|
|
882
|
+
description: build.wrapDescription(
|
|
883
|
+
"The starting bound of our range.",
|
|
884
|
+
"field"
|
|
885
|
+
),
|
|
807
886
|
type: RangeBound,
|
|
808
887
|
},
|
|
809
888
|
end: {
|
|
810
|
-
description:
|
|
889
|
+
description: build.wrapDescription(
|
|
890
|
+
"The ending bound of our range.",
|
|
891
|
+
"field"
|
|
892
|
+
),
|
|
811
893
|
type: RangeBound,
|
|
812
894
|
},
|
|
813
895
|
},
|
|
@@ -823,14 +905,23 @@ export default (function PgTypesPlugin(
|
|
|
823
905
|
GraphQLInputObjectType,
|
|
824
906
|
{
|
|
825
907
|
name: inflection.inputType(Range.name),
|
|
826
|
-
description:
|
|
908
|
+
description: build.wrapDescription(
|
|
909
|
+
`A range of \`${gqlRangeSubType.name}\`.`,
|
|
910
|
+
"type"
|
|
911
|
+
),
|
|
827
912
|
fields: {
|
|
828
913
|
start: {
|
|
829
|
-
description:
|
|
914
|
+
description: build.wrapDescription(
|
|
915
|
+
"The starting bound of our range.",
|
|
916
|
+
"field"
|
|
917
|
+
),
|
|
830
918
|
type: RangeBoundInput,
|
|
831
919
|
},
|
|
832
920
|
end: {
|
|
833
|
-
description:
|
|
921
|
+
description: build.wrapDescription(
|
|
922
|
+
"The ending bound of our range.",
|
|
923
|
+
"field"
|
|
924
|
+
),
|
|
834
925
|
type: RangeBoundInput,
|
|
835
926
|
},
|
|
836
927
|
},
|
|
@@ -910,10 +1001,10 @@ end`;
|
|
|
910
1001
|
type.domainBaseTypeId,
|
|
911
1002
|
typeModifier
|
|
912
1003
|
);
|
|
913
|
-
const baseInputType =
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1004
|
+
const baseInputType = getGqlInputTypeByTypeIdAndModifier(
|
|
1005
|
+
type.domainBaseTypeId,
|
|
1006
|
+
typeModifier
|
|
1007
|
+
);
|
|
917
1008
|
// Hack stolen from: https://github.com/graphile/postgraphile/blob/ade728ed8f8e3ecdc5fdad7d770c67aa573578eb/src/graphql/schema/type/aliasGqlType.ts#L16
|
|
918
1009
|
gqlTypeByTypeIdAndModifier[type.id][typeModifierKey] = Object.assign(
|
|
919
1010
|
Object.create(baseType),
|
|
@@ -1232,7 +1323,6 @@ end`;
|
|
|
1232
1323
|
pgRegisterGqlInputTypeByTypeId,
|
|
1233
1324
|
pg2GqlMapper,
|
|
1234
1325
|
pgSql: sql,
|
|
1235
|
-
graphql,
|
|
1236
1326
|
} = build;
|
|
1237
1327
|
|
|
1238
1328
|
// Check we have the hstore extension
|
|
@@ -1257,7 +1347,7 @@ end`;
|
|
|
1257
1347
|
// We're going to use our own special HStore type for this so that we get
|
|
1258
1348
|
// better validation; but you could just as easily use JSON directly if you
|
|
1259
1349
|
// wanted to.
|
|
1260
|
-
const GraphQLHStoreType = makeGraphQLHstoreType(
|
|
1350
|
+
const GraphQLHStoreType = makeGraphQLHstoreType(build, hstoreTypeName);
|
|
1261
1351
|
|
|
1262
1352
|
// Now register the hstore type with the type system for both output and input.
|
|
1263
1353
|
pgRegisterGqlTypeByTypeId(hstoreType.id, () => GraphQLHStoreType);
|
|
@@ -1322,8 +1412,10 @@ end`;
|
|
|
1322
1412
|
}
|
|
1323
1413
|
return new GraphQLObjectType({
|
|
1324
1414
|
name: inflection.builtin("Line"),
|
|
1325
|
-
description:
|
|
1415
|
+
description: build.wrapDescription(
|
|
1326
1416
|
"An infinite line that passes through points 'a' and 'b'.",
|
|
1417
|
+
"type"
|
|
1418
|
+
),
|
|
1327
1419
|
fields: {
|
|
1328
1420
|
a: { type: Point },
|
|
1329
1421
|
b: { type: Point },
|
|
@@ -1334,8 +1426,10 @@ end`;
|
|
|
1334
1426
|
const PointInput = pgGetGqlInputTypeByTypeIdAndModifier("600", null);
|
|
1335
1427
|
return new GraphQLInputObjectType({
|
|
1336
1428
|
name: inflection.builtin("LineInput"),
|
|
1337
|
-
description:
|
|
1429
|
+
description: build.wrapDescription(
|
|
1338
1430
|
"An infinite line that passes through points 'a' and 'b'.",
|
|
1431
|
+
"type"
|
|
1432
|
+
),
|
|
1339
1433
|
fields: {
|
|
1340
1434
|
a: { type: PointInput },
|
|
1341
1435
|
b: { type: PointInput },
|
|
@@ -1368,7 +1462,10 @@ end`;
|
|
|
1368
1462
|
const Point = pgGetGqlTypeByTypeIdAndModifier("600", null);
|
|
1369
1463
|
return new GraphQLObjectType({
|
|
1370
1464
|
name: inflection.builtin("LineSegment"),
|
|
1371
|
-
description:
|
|
1465
|
+
description: build.wrapDescription(
|
|
1466
|
+
"An finite line between points 'a' and 'b'.",
|
|
1467
|
+
"type"
|
|
1468
|
+
),
|
|
1372
1469
|
fields: {
|
|
1373
1470
|
a: { type: Point },
|
|
1374
1471
|
b: { type: Point },
|
|
@@ -1379,7 +1476,10 @@ end`;
|
|
|
1379
1476
|
const PointInput = pgGetGqlInputTypeByTypeIdAndModifier("600", null);
|
|
1380
1477
|
return new GraphQLInputObjectType({
|
|
1381
1478
|
name: inflection.builtin("LineSegmentInput"),
|
|
1382
|
-
description:
|
|
1479
|
+
description: build.wrapDescription(
|
|
1480
|
+
"An finite line between points 'a' and 'b'.",
|
|
1481
|
+
"type"
|
|
1482
|
+
),
|
|
1383
1483
|
fields: {
|
|
1384
1484
|
a: { type: PointInput },
|
|
1385
1485
|
b: { type: PointInput },
|
|
@@ -1410,8 +1510,10 @@ end`;
|
|
|
1410
1510
|
const Point = pgGetGqlTypeByTypeIdAndModifier("600", null);
|
|
1411
1511
|
return new GraphQLObjectType({
|
|
1412
1512
|
name: inflection.builtin("Box"),
|
|
1413
|
-
description:
|
|
1513
|
+
description: build.wrapDescription(
|
|
1414
1514
|
"A rectangular box defined by two opposite corners 'a' and 'b'",
|
|
1515
|
+
"type"
|
|
1516
|
+
),
|
|
1415
1517
|
fields: {
|
|
1416
1518
|
a: { type: Point },
|
|
1417
1519
|
b: { type: Point },
|
|
@@ -1422,8 +1524,10 @@ end`;
|
|
|
1422
1524
|
const PointInput = pgGetGqlInputTypeByTypeIdAndModifier("600", null);
|
|
1423
1525
|
return new GraphQLInputObjectType({
|
|
1424
1526
|
name: inflection.builtin("BoxInput"),
|
|
1425
|
-
description:
|
|
1527
|
+
description: build.wrapDescription(
|
|
1426
1528
|
"A rectangular box defined by two opposite corners 'a' and 'b'",
|
|
1529
|
+
"type"
|
|
1530
|
+
),
|
|
1427
1531
|
fields: {
|
|
1428
1532
|
a: { type: PointInput },
|
|
1429
1533
|
b: { type: PointInput },
|
|
@@ -1454,14 +1558,19 @@ end`;
|
|
|
1454
1558
|
const Point = pgGetGqlTypeByTypeIdAndModifier("600", null);
|
|
1455
1559
|
return new GraphQLObjectType({
|
|
1456
1560
|
name: inflection.builtin("Path"),
|
|
1457
|
-
description:
|
|
1561
|
+
description: build.wrapDescription(
|
|
1562
|
+
"A path (open or closed) made up of points",
|
|
1563
|
+
"type"
|
|
1564
|
+
),
|
|
1458
1565
|
fields: {
|
|
1459
1566
|
points: {
|
|
1460
1567
|
type: new GraphQLList(Point),
|
|
1461
1568
|
},
|
|
1462
1569
|
isOpen: {
|
|
1463
|
-
description:
|
|
1570
|
+
description: build.wrapDescription(
|
|
1464
1571
|
"True if this is a closed path (similar to a polygon), false otherwise.",
|
|
1572
|
+
"field"
|
|
1573
|
+
),
|
|
1465
1574
|
type: GraphQLBoolean,
|
|
1466
1575
|
},
|
|
1467
1576
|
},
|
|
@@ -1471,14 +1580,19 @@ end`;
|
|
|
1471
1580
|
const PointInput = pgGetGqlInputTypeByTypeIdAndModifier("600", null);
|
|
1472
1581
|
return new GraphQLInputObjectType({
|
|
1473
1582
|
name: inflection.builtin("PathInput"),
|
|
1474
|
-
description:
|
|
1583
|
+
description: build.wrapDescription(
|
|
1584
|
+
"A path (open or closed) made up of points",
|
|
1585
|
+
"type"
|
|
1586
|
+
),
|
|
1475
1587
|
fields: {
|
|
1476
1588
|
points: {
|
|
1477
1589
|
type: new GraphQLList(PointInput),
|
|
1478
1590
|
},
|
|
1479
1591
|
isOpen: {
|
|
1480
|
-
description:
|
|
1592
|
+
description: build.wrapDescription(
|
|
1481
1593
|
"True if this is a closed path (similar to a polygon), false otherwise.",
|
|
1594
|
+
"field"
|
|
1595
|
+
),
|
|
1482
1596
|
type: GraphQLBoolean,
|
|
1483
1597
|
},
|
|
1484
1598
|
},
|
|
@@ -1620,7 +1734,8 @@ end`;
|
|
|
1620
1734
|
/* End of geometric types */
|
|
1621
1735
|
}: Plugin);
|
|
1622
1736
|
|
|
1623
|
-
function makeGraphQLHstoreType(
|
|
1737
|
+
function makeGraphQLHstoreType(build, hstoreTypeName) {
|
|
1738
|
+
const { graphql } = build;
|
|
1624
1739
|
const { GraphQLScalarType, Kind } = graphql;
|
|
1625
1740
|
|
|
1626
1741
|
function isValidHstoreObject(obj) {
|
|
@@ -1719,8 +1834,10 @@ function makeGraphQLHstoreType(graphql, hstoreTypeName) {
|
|
|
1719
1834
|
// TODO: use newWithHooks instead
|
|
1720
1835
|
const GraphQLHStore = new GraphQLScalarType({
|
|
1721
1836
|
name: hstoreTypeName,
|
|
1722
|
-
description:
|
|
1837
|
+
description: build.wrapDescription(
|
|
1723
1838
|
"A set of key/value pairs, keys are strings, values may be a string or null. Exposed as a JSON object.",
|
|
1839
|
+
"type"
|
|
1840
|
+
),
|
|
1724
1841
|
serialize: identity,
|
|
1725
1842
|
parseValue: identityWithCheck,
|
|
1726
1843
|
parseLiteral,
|