graphile / graphile/crystal

`argWithHooks` method doesn't exist

Open
#1,814 0 comments 0 reactions 0 assignees View on GitHub
✨ feature
Dominant language
TypeScript
Stars
12.9k
Forks
625
Avg merge
5h 23m
Merged PRs (30d)
24

Description

Really we ought to have this to enable arguments to have their own scopes, so they can be individually hooked.

```diff
diff --git i/graphile-build/graphile-build/src/global.ts w/graphile-build/graphile-build/src/global.ts
index cc842ea4f..b13fef5b6 100644
--- i/graphile-build/graphile-build/src/global.ts
+++ w/graphile-build/graphile-build/src/global.ts
@@ -628,6 +628,7 @@ declare global {
interface ScopeObjectFieldsFieldArgs extends ScopeObjectFieldsField {}
interface ContextObjectFieldsFieldArgs extends ContextObjectFieldsField {
scope: ScopeObjectFieldsFieldArgs;
+ argWithHooks: ArgWithHooksFunction;
}

interface ScopeObjectFieldsFieldArgsArg extends ScopeObjectFieldsFieldArgs {
@@ -668,6 +669,7 @@ declare global {
interface ContextInterfaceFieldsFieldArgs
extends ContextInterfaceFieldsField {
scope: ScopeInterfaceFieldsFieldArgs;
+ argWithHooks: InterfaceArgWithHooksFunction;
}

interface ScopeInterfaceFieldsFieldArgsArg
@@ -829,6 +831,26 @@ declare global {
) => GrafastInputFieldConfig),
) => GrafastInputFieldConfig;

+ // TODO: generics
+ /** @experimental */
+ type ArgWithHooksFunction = (
+ argScope: ScopeObjectFieldsFieldArgsArg,
+ spec:
+ | GrafastArgumentConfig
+ | ((context: ContextObjectFieldsFieldArgsArg) => GrafastArgumentConfig),
+ ) => GrafastArgumentConfig;
+
+ // TODO: types
+ /** @experimental */
+ type InterfaceArgWithHooksFunction = (
+ argScope: ScopeInterfaceFieldsFieldArgsArg,
+ spec:
+ | GraphQLArgumentConfig
+ | ((
+ context: ContextInterfaceFieldsFieldArgsArg,
+ ) => GraphQLArgumentConfig),
+ ) => GraphQLArgumentConfig;
+
// type WatchUnwatch = (triggerChange: TriggerChangeType) => void;

// type SchemaListener = (newSchema: GraphQLSchema) => void;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.