Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Feb 21, 2025
1 parent dc9f6dd commit 5de0b91
Show file tree
Hide file tree
Showing 32 changed files with 39 additions and 129 deletions.
2 changes: 1 addition & 1 deletion grafast/dataplan-json/src/steps/jsonParse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
GrafastResultsList,
PromiseOrDirect,
} from "grafast";
import { access, exportAs,Step } from "grafast";
import { access, exportAs, Step } from "grafast";

export type JSONValue =
| string
Expand Down
5 changes: 2 additions & 3 deletions grafast/dataplan-pg/src/examples/exampleSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3872,15 +3872,14 @@ export function makeExampleSchema(
},
plan: EXPORTABLE(
(connection, deoptimizeIfAppropriate, messageResource) =>
function plan(_, fieldArgs, { field }) {
function plan(_, fieldArgs) {
const $messages = messageResource.find();
deoptimizeIfAppropriate($messages);
// $messages.leftJoin(...);
// $messages.innerJoin(...);
// $messages.relation('fk_messages_author_id')
// $messages.where(...);
const $connectionPlan = connection($messages);
const orderByArg = field.args.find((a) => a.name === "orderBy");
fieldArgs.apply($messages, "orderBy");
// DEFINITELY NOT $messages.orderBy BECAUSE we don't want that applied to aggregates.
// DEFINITELY NOT $messages.limit BECAUSE we don't want those limits applied to aggregates or page info.
Expand Down Expand Up @@ -4576,7 +4575,7 @@ export function makeExampleSchema(
pgUnionAll,
thirdPartyVulnerabilitiesResource,
) =>
function plan(_, fieldArgs, { field }) {
function plan(_, fieldArgs) {
// IMPORTANT: for cursor pagination, type must be part of cursor condition
const $vulnerabilities = pgUnionAll({
name: "vulnerabilities",
Expand Down
4 changes: 2 additions & 2 deletions grafast/dataplan-pg/src/steps/pgDeleteSingle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
Maybe,
PromiseOrDirect,
} from "grafast";
import { access, exportAs, isDev, SafeError,Step } from "grafast";
import { access, exportAs, isDev, SafeError, Step } from "grafast";
import type { SQL, SQLRawValue } from "pg-sql2";
import sql, { $$toSQL } from "pg-sql2";

Expand Down Expand Up @@ -436,7 +436,7 @@ export function pgDeleteSingle<
exportAs("@dataplan/pg", pgDeleteSingle, "pgDeleteSingle");

export interface PgDeleteSingleQueryBuilder<
TResource extends PgResource<
_TResource extends PgResource<
any,
PgCodecWithAttributes,
any,
Expand Down
6 changes: 2 additions & 4 deletions grafast/dataplan-pg/src/steps/pgInsertSingle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
Setter,
SetterCapable,
} from "grafast";
import { access, exportAs, isDev, setter,Step } from "grafast";
import { access, exportAs, isDev, setter, Step } from "grafast";
import type { SQL, SQLable } from "pg-sql2";
import sql, { $$toSQL } from "pg-sql2";

Expand Down Expand Up @@ -112,9 +112,7 @@ export class PgInsertSingleStep<
resource: TResource,
attributes?: {
[key in keyof GetPgResourceAttributes<TResource>]?:
| PgTypedStep<
GetPgResourceAttributes<TResource>[key]["codec"]
>
| PgTypedStep<GetPgResourceAttributes<TResource>[key]["codec"]>
| Step;
},
) {
Expand Down
2 changes: 0 additions & 2 deletions grafast/dataplan-pg/src/steps/pgSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
isAsyncIterable,
isDev,
isPromiseLike,
operationPlan,
reverseArray,
SafeError,
Step,
Expand All @@ -48,7 +47,6 @@ import type {
GetPgResourceRelations,
PgCodec,
PgCodecRelation,
PgConditionLike,
PgGroupSpec,
PgOrderSpec,
PgQueryBuilder,
Expand Down
2 changes: 1 addition & 1 deletion grafast/dataplan-pg/src/steps/pgSingleTablePolymorphic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
PolymorphicStep,
PromiseOrDirect,
} from "grafast";
import { exportAs, polymorphicWrap,Step } from "grafast";
import { exportAs, polymorphicWrap, Step } from "grafast";
import type { GraphQLObjectType } from "grafast/graphql";

import type { PgResource } from "../datasource.js";
Expand Down
2 changes: 1 addition & 1 deletion grafast/dataplan-pg/src/steps/pgUpdateSingle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
Setter,
SetterCapable,
} from "grafast";
import { access, exportAs, isDev, SafeError, setter,Step } from "grafast";
import { access, exportAs, isDev, SafeError, setter, Step } from "grafast";
import type { SQL, SQLable, SQLRawValue } from "pg-sql2";
import sql, { $$toSQL } from "pg-sql2";

Expand Down
5 changes: 1 addition & 4 deletions grafast/dataplan-pg/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ export function assertPgClassSingleStep<
export function makeScopedSQL<TThis extends { placeholder(value: any): SQL }>(
that: TThis,
): <T>(cb: PgSQLCallbackOrDirect<T>) => T {
const sqlTransformer: Transformer<PgTypedStep<PgCodec>> = (
sql,
value,
) => {
const sqlTransformer: Transformer<PgTypedStep<PgCodec>> = (sql, value) => {
if (value instanceof ExecutableStep && "pgCodec" in value) {
if (value.pgCodec) {
return that.placeholder(value);
Expand Down
2 changes: 1 addition & 1 deletion grafast/grafast/src/bucket.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import type { GraphQLScalarType } from "graphql";

import type { GrafastExecutionArgs,Step } from ".";
import type { GrafastExecutionArgs, Step } from ".";
import type { LayerPlan } from "./engine/LayerPlan";
import type { MetaByMetaKey } from "./engine/OperationPlan";
import type {
Expand Down
69 changes: 3 additions & 66 deletions grafast/grafast/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import type { Constraint } from "./constraints.js";
import type { LayerPlanReasonListItemStream } from "./engine/LayerPlan.js";
import type { OperationPlan } from "./engine/OperationPlan.js";
import type { FlaggedValue, SafeError } from "./error.js";
import type { ListCapableStep,Step } from "./step.js";
import type { ListCapableStep, Step } from "./step.js";
import type { __InputDynamicScalarStep } from "./steps/__inputDynamicScalar.js";
import type { ApplyableExecutableStep } from "./steps/applyInput.js";
import type {
Expand All @@ -44,7 +44,7 @@ import type {
ConstantStep,
ObjectStep,
} from "./steps/index.js";
import type { GrafastInputObjectType, GrafastObjectType } from "./utils.js";
import type { GrafastObjectType } from "./utils.js";

export interface GrafastTimeouts {
/**
Expand Down Expand Up @@ -414,9 +414,7 @@ export type ScalarInputPlanResolver<TResultStep extends Step = Step> = (
*
* @experimental
*/
export type EnumValueApplyResolver<TParent extends any = any> = (
parent: TParent,
) => void;
export type EnumValueApplyResolver<TParent = any> = (parent: TParent) => void;

// TypeScript gets upset if we go too deep, so we try and cover the most common
// use cases and fall back to `any`
Expand All @@ -436,67 +434,6 @@ export type OutputPlanForType<TType extends GraphQLOutputType> =
? OutputPlanForNamedType<U>
: OutputPlanForNamedType<TType>;

// TypeScript gets upset if we go too deep, so we try and cover the most common
// use cases and fall back to `any`
type InputTypeForNamedType<TType extends GraphQLType> =
TType extends GraphQLScalarType<infer U> ? U : any;
type InputTypeFor<TType extends GraphQLInputType> =
TType extends GraphQLNonNull<GraphQLList<GraphQLNonNull<infer U>>>
? InputTypeForNamedType<U>
: TType extends GraphQLNonNull<GraphQLList<infer U>>
? InputTypeForNamedType<U>
: TType extends GraphQLList<GraphQLNonNull<infer U>>
? InputTypeForNamedType<U>
: TType extends GraphQLList<infer U>
? InputTypeForNamedType<U>
: TType extends GraphQLNonNull<infer U>
? InputTypeForNamedType<U>
: InputTypeForNamedType<TType>;

/*
type OutputPlanForType<TType extends GraphQLOutputType> =
TType extends GraphQLList<
infer U
>
? U extends GraphQLOutputType
? ListCapableStep<any, OutputPlanForType<U>>
: never
: TType extends GraphQLNonNull<infer V>
? V extends GraphQLOutputType
? OutputPlanForType<V>
: never
: TType extends GraphQLScalarType | GraphQLEnumType
? ExecutableStep<boolean | number | string>
: ExecutableStep<{ [key: string]: any }>;
type InputPlanForType<TType extends GraphQLInputType> =
TType extends GraphQLList<infer U>
? U extends GraphQLInputType
? InputPlanForType<U>
: never
: TType extends GraphQLNonNull<infer V>
? V extends GraphQLInputType
? InputPlanForType<V>
: never
: TType extends GraphQLScalarType | GraphQLEnumType
? null
: ExecutableStep<{ [key: string]: any }> | null;
type InputTypeFor<TType extends GraphQLInputType> = TType extends GraphQLList<
infer U
>
? U extends GraphQLInputType
? InputTypeFor<U>
: never
: TType extends GraphQLNonNull<infer V>
? V extends GraphQLInputType
? InputTypeFor<V>
: never
: TType extends GraphQLScalarType<infer U>
? U
: any;
*/

/**
* Basically GraphQLFieldConfig but with an easy to access `plan` method.
*/
Expand Down
1 change: 0 additions & 1 deletion grafast/grafast/src/operationPlan-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {
import * as graphql from "graphql";

import type { OperationPlan } from "./engine/OperationPlan.js";
import type { ObjectStep } from "./index.js";
import {
__InputObjectStep,
__TrackedValueStep,
Expand Down
2 changes: 1 addition & 1 deletion grafast/grafast/src/steps/__flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
TRAPPABLE_FLAGS,
} from "../interfaces.js";
import type { ListCapableStep } from "../step.js";
import { isListCapableStep,Step } from "../step.js";
import { isListCapableStep, Step } from "../step.js";
import type { __ItemStep } from "./__item.js";

// PUBLIC FLAGS
Expand Down
1 change: 0 additions & 1 deletion grafast/grafast/src/steps/__inputList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as assert from "../assert.js";
import { assertInputStep, inputStep } from "../input.js";
import type { AnyInputStep, NotVariableValueNode } from "../interfaces.js";
import { Step } from "../step.js";
import type { ConstantStep } from "./constant.js";
import { constant } from "./constant.js";
import { list } from "./list.js";

Expand Down
2 changes: 1 addition & 1 deletion grafast/grafast/src/steps/applyTransforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
type GrafastResultsList,
} from "../interfaces.js";
import type { ListCapableStep } from "../step.js";
import { isListCapableStep,Step } from "../step.js";
import { isListCapableStep, Step } from "../step.js";
import { __ItemStep } from "./__item.js";
import type { ConnectionCapableStep } from "./connection.js";
import { itemsOrStep } from "./connection.js";
Expand Down
2 changes: 1 addition & 1 deletion grafast/grafast/src/steps/each.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import chalk from "chalk";

import type { ListCapableStep,Step } from "../step.js";
import type { ListCapableStep, Step } from "../step.js";
import { isListCapableStep } from "../step.js";
import { __ItemStep } from "./__item.js";
import type {
Expand Down
2 changes: 1 addition & 1 deletion grafast/grafast/src/steps/filter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import chalk from "chalk";

import type { ListCapableStep,Step } from "../step.js";
import type { ListCapableStep, Step } from "../step.js";
import { isListCapableStep } from "../step.js";
import type { __ItemStep } from "./__item.js";
import type { ConnectionCapableStep, ItemsStep } from "./connection.js";
Expand Down
2 changes: 1 addition & 1 deletion grafast/grafast/src/steps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ export {
} from "./remapKeys.js";
export { reverse, reverseArray, ReverseStep } from "./reverse.js";
export {
createObjectAndApplyChildren,
Setter,
setter,
SetterCapable,
createObjectAndApplyChildren,
} from "./setter.js";
export { sideEffect, SideEffectStep } from "./sideEffect.js";

Expand Down
2 changes: 1 addition & 1 deletion grafast/grafast/src/steps/listTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { ConnectionCapableStep, ExecutionDetails } from "../index.js";
import type { GrafastResultsList } from "../interfaces.js";
import { $$deepDepSkip } from "../interfaces.js";
import type { ListCapableStep } from "../step.js";
import { isListCapableStep,Step } from "../step.js";
import { isListCapableStep, Step } from "../step.js";
import { __ItemStep } from "./__item.js";
import type { ItemsStep } from "./connection.js";
import { itemsOrStep } from "./connection.js";
Expand Down
2 changes: 1 addition & 1 deletion grafast/grafast/src/steps/listen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
GrafastResultStreamList,
GrafastSubscriber,
} from "../interfaces.js";
import { isExecutableStep,Step } from "../step.js";
import { isExecutableStep, Step } from "../step.js";
import type { __ItemStep } from "./__item.js";
import { constant } from "./constant.js";

Expand Down
2 changes: 1 addition & 1 deletion grafast/grafast/src/steps/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
} from "../interfaces.js";
import type { Multistep, UnwrapMultistep } from "../multistep.js";
import { isMultistep, multistep } from "../multistep.js";
import { isListLikeStep, isObjectLikeStep,Step } from "../step.js";
import { isListLikeStep, isObjectLikeStep, Step } from "../step.js";
import { arrayOfLength, canonicalJSONStringify, isTuple } from "../utils.js";
import { access } from "./access.js";

Expand Down
1 change: 0 additions & 1 deletion grafast/grafast/src/steps/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { GraphQLObjectType } from "graphql";
import { isDev } from "../dev.js";
import { inspect } from "../inspect.js";
import type {
AnyInputStep,
Maybe,
NodeIdHandler,
PolymorphicData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
sqlValueWithCodec,
} from "@dataplan/pg";
import type { GrafastFieldConfig, Setter } from "grafast";
import { bakedInput, bakedInputRuntime, each } from "grafast";
import { bakedInputRuntime, each } from "grafast";
import type { GraphQLFieldConfigMap, GraphQLOutputType } from "grafast/graphql";
import { EXPORTABLE } from "graphile-build";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import "graphile-config";

import {
type PgCondition,
type PgResource,
type PgResourceParameter,
type PgSelectStep,
sqlValueWithCodec,
import type {
PgCondition,
PgResource,
PgResourceParameter,
} from "@dataplan/pg";
import { sqlValueWithCodec } from "@dataplan/pg";
import { EXPORTABLE } from "graphile-build";
import type { GraphQLInputType } from "graphql";

Expand Down Expand Up @@ -135,7 +134,8 @@ export const PgConditionCustomFieldsPlugin: GraphileConfig.Plugin = {
),
type,
apply: EXPORTABLE(
(pgFieldSource, sql, sqlValueWithCodec) => function plan($condition: PgCondition, val: unknown) {
(pgFieldSource, sql, sqlValueWithCodec) =>
function plan($condition: PgCondition, val: unknown) {
if (val === undefined) return;
if (typeof pgFieldSource.from !== "function") {
throw new Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import type {
PgSelectArgumentDigest,
PgSelectArgumentSpec,
PgSelectQueryBuilder,
PgTypedStep,
PgUpdateSingleStep,
} from "@dataplan/pg";
import {
Expand All @@ -42,7 +41,6 @@ import {
__ListTransformStep,
bakedInput,
connection,
constant,
object,
ObjectStep,
stepAMayDependOnStepB,
Expand Down Expand Up @@ -555,13 +553,6 @@ export const PgCustomTypeFieldPlugin: GraphileConfig.Plugin = {
argDetailsSimple,
`argDetailsSimple_${resource.name}`,
);
let indexAfterWhichAllArgsAreNamed = 0;
const argDetailsLength = argDetails.length;
for (let i = 0; i < argDetailsLength; i++) {
if (!argDetails[i].postgresArgName) {
indexAfterWhichAllArgsAreNamed = i + 1;
}
}

const makeArgs = EXPORTABLE(
(argDetailsSimple, makeArg) =>
Expand Down
Loading

0 comments on commit 5de0b91

Please sign in to comment.