Skip to content

Commit a549c3a

Browse files
committed
Fix types and plugins
1 parent f3ad8b2 commit a549c3a

3 files changed

Lines changed: 27 additions & 8 deletions

File tree

src/PgConnectionArgFilterAttributesPlugin.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ import type { PgConditionStep, PgCodecWithAttributes } from "@dataplan/pg";
22

33
const { version } = require("../package.json");
44

5+
declare global {
6+
namespace GraphileBuild {
7+
interface BehaviorStrings {
8+
"attribute:filter": true;
9+
}
10+
}
11+
}
12+
513
export const PgConnectionArgFilterAttributesPlugin: GraphileConfig.Plugin = {
614
name: "PgConnectionArgFilterAttributesPlugin",
715
version,

src/PgConnectionArgFilterComputedAttributesPlugin.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ export const PgConnectionArgFilterComputedAttributesPlugin: GraphileConfig.Plugi
1515
schema: {
1616
entityBehavior: {
1717
pgResource: {
18-
provides: ["inferred"],
19-
before: ["override"],
20-
after: ["default"],
21-
callback(behavior, entity, build) {
18+
inferred(behavior, entity, build) {
2219
if (
2320
build.options.connectionFilterComputedColumns &&
2421
isComputedScalarAttributeResource(entity)

src/PgConnectionArgFilterPlugin.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ const isSuitableForFiltering = (
2323
(!codec.arrayOfCodec || isSuitableForFiltering(build, codec.arrayOfCodec)) &&
2424
(!codec.domainOfCodec || isSuitableForFiltering(build, codec.domainOfCodec));
2525

26+
declare global {
27+
namespace GraphileBuild {
28+
interface BehaviorStrings {
29+
filterProc: true;
30+
}
31+
}
32+
}
33+
2634
export const PgConnectionArgFilterPlugin: GraphileConfig.Plugin = {
2735
name: "PgConnectionArgFilterPlugin",
2836
version,
@@ -66,13 +74,19 @@ export const PgConnectionArgFilterPlugin: GraphileConfig.Plugin = {
6674
*/
6775

6876
schema: {
77+
behaviorRegistry: {
78+
add: {
79+
filterProc: {
80+
description: "Can this function be filtered?",
81+
entities: ["pgResource"],
82+
},
83+
},
84+
},
85+
6986
entityBehavior: {
7087
pgCodec: "filter",
7188
pgResource: {
72-
provides: ["inferred"],
73-
before: ["override"],
74-
after: ["default"],
75-
callback(behavior, entity, build) {
89+
inferred(behavior, entity, build) {
7690
if (entity.parameters) {
7791
return [
7892
behavior,

0 commit comments

Comments
 (0)