Skip to content

Commit 9359b33

Browse files
committed
Give operators names
1 parent 0255f77 commit 9359b33

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/PgConnectionArgFilterOperatorsPlugin.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ export const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin = {
364364
resolveType: resolveTypeToListOfNonNullable,
365365
},
366366
};
367+
for (const key in standardOperators) {
368+
standardOperators[key].name ??= key;
369+
}
370+
367371
const sortOperators: { [fieldName: string]: OperatorSpec } = {
368372
lessThan: {
369373
description: "Less than the specified value.",
@@ -406,6 +410,9 @@ export const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin = {
406410
resolveSqlIdentifier: resolveSqlIdentifierSensitive,
407411
},
408412
};
413+
for (const key in sortOperators) {
414+
sortOperators[key].name ??= key;
415+
}
409416

410417
const patternMatchingOperators: { [fieldName: string]: OperatorSpec } =
411418
{
@@ -653,6 +660,10 @@ export const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin = {
653660
resolveSqlIdentifier: resolveSqlIdentifierInsensitive,
654661
},
655662
};
663+
for (const key in patternMatchingOperators) {
664+
patternMatchingOperators[key].name ??= key;
665+
}
666+
656667
const resolveTextArrayInputCodec = EXPORTABLE(
657668
(TYPES, listOfCodec) => () =>
658669
listOfCodec(TYPES.text, { extensions: { listItemNonNull: true } }),
@@ -712,6 +723,10 @@ export const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin = {
712723
),
713724
},
714725
};
726+
for (const key in hstoreOperators) {
727+
hstoreOperators[key].name ??= key;
728+
}
729+
715730
const jsonbOperators: { [fieldName: string]: OperatorSpec } = {
716731
contains: {
717732
description: "Contains the specified JSON.",
@@ -763,6 +778,10 @@ export const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin = {
763778
),
764779
},
765780
};
781+
for (const key in jsonbOperators) {
782+
jsonbOperators[key].name ??= key;
783+
}
784+
766785
const inetOperators: { [fieldName: string]: OperatorSpec } = {
767786
contains: {
768787
description: "Contains the specified internet address.",
@@ -807,6 +826,9 @@ export const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin = {
807826
),
808827
},
809828
};
829+
for (const key in inetOperators) {
830+
inetOperators[key].name ??= key;
831+
}
810832

811833
const insensitiveOperators: { [fieldName: string]: OperatorSpec } = {};
812834

@@ -926,6 +948,9 @@ export const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin = {
926948
resolveSqlValue,
927949
};
928950
}
951+
for (const key in insensitiveOperators) {
952+
insensitiveOperators[key].name ??= key;
953+
}
929954

930955
const connectionFilterEnumOperators = {
931956
...standardOperators,
@@ -1024,6 +1049,9 @@ export const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin = {
10241049
),
10251050
},
10261051
};
1052+
for (const key in connectionFilterRangeOperators) {
1053+
connectionFilterRangeOperators[key].name ??= key;
1054+
}
10271055

10281056
const connectionFilterArrayOperators: {
10291057
[fieldName: string]: OperatorSpec;
@@ -1121,6 +1149,9 @@ export const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin = {
11211149
),
11221150
},
11231151
};
1152+
for (const key in connectionFilterArrayOperators) {
1153+
connectionFilterArrayOperators[key].name ??= key;
1154+
}
11241155

11251156
const {
11261157
//inputTypeName,
@@ -1607,6 +1638,6 @@ export function makeApplyFromOperatorSpec(
16071638
sql,
16081639
sqlValueWithCodec,
16091640
],
1610-
"makeApplyFromOperatorSpec"
1641+
`pgAggregatesApply_${spec.name ?? "unknown"}`
16111642
);
16121643
}

0 commit comments

Comments
 (0)