Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed May 23, 2023
1 parent 8cc677e commit 26b3f68
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 26 deletions.
4 changes: 2 additions & 2 deletions graphile-build/graphile-build-pg/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export {
withPgClientFromPgService,
} from "./pgServices.js";
export { PgAllRowsPlugin } from "./plugins/PgAllRowsPlugin.js";
export { PgInterfaceModeUnionAllRowsPlugin } from "./plugins/PgInterfaceModeUnionAllRowsPlugin.js";
export { PgAttributeDeprecationPlugin } from "./plugins/PgAttributeDeprecationPlugin.js";
export { PgAttributesPlugin } from "./plugins/PgAttributesPlugin.js";
export { PgBasicsPlugin } from "./plugins/PgBasicsPlugin.js";
Expand All @@ -24,6 +23,7 @@ export { PgCustomTypeFieldPlugin } from "./plugins/PgCustomTypeFieldPlugin.js";
export { PgEnumTablesPlugin } from "./plugins/PgEnumTablesPlugin.js";
export { PgFakeConstraintsPlugin } from "./plugins/PgFakeConstraintsPlugin.js";
export { PgFirstLastBeforeAfterArgsPlugin } from "./plugins/PgFirstLastBeforeAfterArgsPlugin.js";
export { PgInterfaceModeUnionAllRowsPlugin } from "./plugins/PgInterfaceModeUnionAllRowsPlugin.js";
export { PgIntrospectionPlugin } from "./plugins/PgIntrospectionPlugin.js";
export { PgJWTPlugin } from "./plugins/PgJWTPlugin.js";
export { PgMutationCreatePlugin } from "./plugins/PgMutationCreatePlugin.js";
Expand All @@ -32,6 +32,7 @@ export { PgMutationUpdateDeletePlugin } from "./plugins/PgMutationUpdateDeletePl
export { PgOrderAllAttributesPlugin } from "./plugins/PgOrderAllAttributesPlugin.js";
export { PgOrderByPrimaryKeyPlugin } from "./plugins/PgOrderByPrimaryKeyPlugin.js";
export { PgOrderCustomFieldsPlugin } from "./plugins/PgOrderCustomFieldsPlugin.js";
export { PgPolymorphismPlugin } from "./plugins/PgPolymorphismPlugin.js";
export { PgProceduresPlugin } from "./plugins/PgProceduresPlugin.js";
export { PgRBACPlugin } from "./plugins/PgRBACPlugin.js";
export { PgRegistryPlugin } from "./plugins/PgRegistryPlugin.js";
Expand All @@ -40,6 +41,5 @@ export { PgRowByUniquePlugin } from "./plugins/PgRowByUniquePlugin.js";
export { PgTableNodePlugin } from "./plugins/PgTableNodePlugin.js";
export { PgTablesPlugin } from "./plugins/PgTablesPlugin.js";
export { PgTypesPlugin } from "./plugins/PgTypesPlugin.js";
export { PgPolymorphismPlugin } from "./plugins/PgPolymorphismPlugin.js";
export { defaultPreset } from "./preset.js";
export { addBehaviorToTags } from "./utils.js";
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
import "graphile-config";
import { version } from "../version.js";
import {

import type {
PgCodec,
PgRegistry,
PgResource,
PgUnionAllStepConfigAttributes,
PgUnionAllStepMember,
pgUnionAll,
} from "@dataplan/pg";
import {
GraphQLInterfaceType,
GraphQLList,
GraphQLNonNull,
GraphQLObjectType,
} from "graphql";
import { EXPORTABLE } from "graphile-build";
import { pgUnionAll } from "@dataplan/pg";
import { connection } from "grafast";
import { EXPORTABLE } from "graphile-build";
import type { GraphQLInterfaceType, GraphQLObjectType } from "graphql";

import { version } from "../version.js";

declare global {
namespace GraphileBuild {
interface Inflection {
/**
* The field name for a Cursor Connection field that returns all rows
* from the given '@interface mode:union' codec.
* from the given `@interface mode:union` codec.
*/
allInterfaceModeUnionRowsConnection(
this: Inflection,
Expand All @@ -31,7 +28,7 @@ declare global {

/**
* The field name for a List field that returns all rows from the given
* '@interface mode:union' codec.
* `@interface mode:union` codec.
*/
allInterfaceModeUnionRowsList(this: Inflection, codec: PgCodec): string;
}
Expand Down Expand Up @@ -64,7 +61,12 @@ export const PgInterfaceModeUnionAllRowsPlugin: GraphileConfig.Plugin = {
schema: {
hooks: {
GraphQLObjectType_fields(fields, build, context) {
const { inflection, input, pgGetBehavior: getBehavior } = build;
const {
inflection,
input,
pgGetBehavior: getBehavior,
graphql: { GraphQLList, GraphQLNonNull },
} = build;
const {
scope: { isRootQuery },
fieldWithHooks,
Expand Down Expand Up @@ -226,16 +228,33 @@ export const PgInterfaceModeUnionAllRowsPlugin: GraphileConfig.Plugin = {
},
{
type: fieldType,
plan: EXPORTABLE(() => {
return function plan() {
const $list = pgUnionAll({
attributes,
resourceByTypeName,
members,
});
return useConnection ? connection($list) : $list;
};
}, []),
plan: EXPORTABLE(
(
attributes,
connection,
members,
pgUnionAll,
resourceByTypeName,
useConnection,
) => {
return function plan() {
const $list = pgUnionAll({
attributes,
resourceByTypeName,
members,
});
return useConnection ? connection($list) : $list;
};
},
[
attributes,
connection,
members,
pgUnionAll,
resourceByTypeName,
useConnection,
],
),
},
),
},
Expand Down
2 changes: 1 addition & 1 deletion graphile-build/graphile-build-pg/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { PgEnumTablesPlugin } from "./plugins/PgEnumTablesPlugin.js";
import { PgFakeConstraintsPlugin } from "./plugins/PgFakeConstraintsPlugin.js";
import { PgFirstLastBeforeAfterArgsPlugin } from "./plugins/PgFirstLastBeforeAfterArgsPlugin.js";
import { PgIndexBehaviorsPlugin } from "./plugins/PgIndexBehaviorsPlugin.js";
import { PgInterfaceModeUnionAllRowsPlugin } from "./plugins/PgInterfaceModeUnionAllRowsPlugin.js";
import { PgIntrospectionPlugin } from "./plugins/PgIntrospectionPlugin.js";
import { PgJWTPlugin } from "./plugins/PgJWTPlugin.js";
import { PgMutationCreatePlugin } from "./plugins/PgMutationCreatePlugin.js";
Expand All @@ -25,7 +26,6 @@ import { PgMutationUpdateDeletePlugin } from "./plugins/PgMutationUpdateDeletePl
import { PgOrderAllAttributesPlugin } from "./plugins/PgOrderAllAttributesPlugin.js";
import { PgOrderByPrimaryKeyPlugin } from "./plugins/PgOrderByPrimaryKeyPlugin.js";
import { PgOrderCustomFieldsPlugin } from "./plugins/PgOrderCustomFieldsPlugin.js";
import { PgInterfaceModeUnionAllRowsPlugin } from "./plugins/PgInterfaceModeUnionAllRowsPlugin.js";
import { PgPolymorphismPlugin } from "./plugins/PgPolymorphismPlugin.js";
import { PgProceduresPlugin } from "./plugins/PgProceduresPlugin.js";
import { PgRefsPlugin } from "./plugins/PgRefsPlugin.js";
Expand Down

0 comments on commit 26b3f68

Please sign in to comment.