grafast 0.0.1-alpha.2 → 0.0.1-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/input.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { GraphQLInputType, GraphQLType, ListTypeNode, NamedTypeNode, NonNullTypeNode, ValueNode } from "graphql";
1
+ import type { ConstValueNode, GraphQLInputType, GraphQLType, ListTypeNode, NamedTypeNode, NonNullTypeNode, ValueNode } from "graphql";
2
2
  import type { OperationPlan } from "./engine/OperationPlan.js";
3
3
  import { __InputDynamicScalarStep } from "./steps/__inputDynamicScalar.js";
4
4
  import { __InputObjectStep } from "./steps/__inputObject.js";
@@ -7,5 +7,5 @@ import { __InputListStep, __InputStaticLeafStep, __TrackedValueStep } from "./st
7
7
  export type InputStep = __TrackedValueStep | __InputListStep | __InputStaticLeafStep | __InputDynamicScalarStep | __InputObjectStep | ConstantStep<undefined>;
8
8
  export declare function assertInputStep(itemPlan: unknown): asserts itemPlan is InputStep;
9
9
  export declare function graphqlGetTypeForNode(operationPlan: OperationPlan, node: NamedTypeNode | ListTypeNode | NonNullTypeNode): GraphQLType;
10
- export declare function inputPlan(operationPlan: OperationPlan, inputType: GraphQLInputType, seenTypes: Set<GraphQLInputType>, rawInputValue: ValueNode | undefined, defaultValue?: ValueNode | undefined): InputStep;
10
+ export declare function inputPlan(operationPlan: OperationPlan, inputType: GraphQLInputType, rawInputValue: ValueNode | undefined, defaultValue?: ConstValueNode | undefined, inSeenTypes?: ReadonlyArray<GraphQLInputType>): InputStep;
11
11
  //# sourceMappingURL=input.d.ts.map
@@ -1,14 +1,19 @@
1
1
  import type EventEmitter from "eventemitter3";
2
2
  import type { PluginHook } from "graphile-config";
3
- import type { ASTNode, ExecutionArgs, GraphQLArgument, GraphQLArgumentConfig, GraphQLField, GraphQLFieldConfig, GraphQLInputField, GraphQLInputFieldConfig, GraphQLInputObjectType, GraphQLInputType, GraphQLList, GraphQLNonNull, GraphQLOutputType, GraphQLScalarType, GraphQLSchema, GraphQLType } from "graphql";
3
+ import type { ASTNode, ExecutionArgs, GraphQLArgument, GraphQLArgumentConfig, GraphQLField, GraphQLFieldConfig, GraphQLInputField, GraphQLInputFieldConfig, GraphQLInputObjectType, GraphQLInputType, GraphQLList, GraphQLNonNull, GraphQLOutputType, GraphQLScalarType, GraphQLSchema, GraphQLType, ValueNode, VariableNode } from "graphql";
4
4
  import type { Bucket, RequestTools } from "./bucket.js";
5
5
  import type { InputStep } from "./input.js";
6
6
  import type { ExecutableStep, ListCapableStep, ModifierStep } from "./step.js";
7
7
  import type { GrafastInputObjectType, GrafastObjectType } from "./utils.js";
8
8
  type PromiseOrValue<T> = T | Promise<T>;
9
+ export interface GrafastTimeouts {
10
+ planning?: number;
11
+ execution?: number;
12
+ }
9
13
  export interface GrafastOptions {
10
14
  context?: Record<string, any> | (<TContext extends Record<string, any>>(ctx: Partial<Grafast.RequestContext>, currentContext?: Partial<TContext>) => PromiseOrValue<Partial<TContext>>);
11
15
  explain?: boolean | string[];
16
+ timeouts?: GrafastTimeouts;
12
17
  }
13
18
  declare global {
14
19
  namespace Grafast {
@@ -105,6 +110,9 @@ export declare const $$eventEmitter: unique symbol;
105
110
  export declare const $$streamMore: unique symbol;
106
111
  export declare const $$proxy: unique symbol;
107
112
  export declare const $$safeError: unique symbol;
113
+ export declare const $$subroutine: unique symbol;
114
+ export declare const $$timeout: unique symbol;
115
+ export declare const $$ts: unique symbol;
108
116
  export interface PolymorphicData<TType extends string = string, TData = any> {
109
117
  [$$concreteType]: TType;
110
118
  [$$data]?: TData;
@@ -199,6 +207,7 @@ export interface StepOptions {
199
207
  }
200
208
  export interface StepOptimizeOptions {
201
209
  stream: StepStreamOptions | null;
210
+ meta: Record<string, unknown> | undefined;
202
211
  }
203
212
  export type GrafastSubscriber<TTopics extends {
204
213
  [key: string]: any;
@@ -245,7 +254,8 @@ export type ExecutionEventMap = {
245
254
  };
246
255
  export type ExecutionEventEmitter = TypedEventEmitter<ExecutionEventMap>;
247
256
  export interface ExecutionExtra {
248
- meta: Record<string, unknown>;
257
+ stopTime: number | null;
258
+ meta: Record<string, unknown> | undefined;
249
259
  eventEmitter: ExecutionEventEmitter | undefined;
250
260
  _bucket: Bucket;
251
261
  _requestContext: RequestTools;
@@ -266,5 +276,6 @@ export type UnwrapPlanTuple<TIn extends readonly ExecutableStep[]> = {
266
276
  } & {
267
277
  length: number;
268
278
  };
279
+ export type NotVariableValueNode = Exclude<ValueNode, VariableNode>;
269
280
  export {};
270
281
  //# sourceMappingURL=interfaces.d.ts.map
package/dist/prepare.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import type { ExecutionArgs } from "graphql";
2
2
  import type { AsyncExecutionResult, ExecutionResult } from "graphql/execution/execute";
3
3
  import type { OperationPlan } from "./index.js";
4
- import type { PromiseOrDirect } from "./interfaces.js";
4
+ import type { GrafastTimeouts, PromiseOrDirect } from "./interfaces.js";
5
5
  declare const $$contextPlanCache: unique symbol;
6
6
  export interface GrafastPrepareOptions {
7
7
  explain?: boolean | string[];
8
8
  outputDataAsString?: boolean;
9
+ timeouts?: GrafastTimeouts;
9
10
  }
10
- export declare function executePreemptive(operationPlan: OperationPlan, variableValues: any, context: any, rootValue: any, outputDataAsString: boolean): PromiseOrDirect<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, void>>;
11
+ export declare function executePreemptive(operationPlan: OperationPlan, variableValues: any, context: any, rootValue: any, outputDataAsString: boolean, executionTimeout: number | null): PromiseOrDirect<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, void>>;
11
12
  declare module "./engine/OperationPlan.js" {
12
13
  interface OperationPlan {
13
14
  [$$contextPlanCache]?: string;
package/dist/step.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { GraphQLObjectType } from "graphql";
2
- import type { LayerPlan } from "./engine/LayerPlan.js";
2
+ import type { LayerPlan, LayerPlanReasonSubroutine } from "./engine/LayerPlan.js";
3
3
  import type { OperationPlan } from "./engine/OperationPlan.js";
4
4
  import type { ExecutionExtra, GrafastResultsList, GrafastResultStreamList, GrafastValuesList, PromiseOrDirect, StepOptimizeOptions, StepOptions } from "./interfaces.js";
5
+ import { $$subroutine } from "./interfaces.js";
5
6
  import type { __ItemStep } from "./steps/index.js";
6
7
  export declare const $$deepDepSkip: unique symbol;
7
8
  export declare const $$noExec: unique symbol;
@@ -10,6 +11,7 @@ export declare const assertFinalized: typeof reallyAssertFinalized;
10
11
  export declare abstract class BaseStep {
11
12
  readonly layerPlan: LayerPlan;
12
13
  readonly operationPlan: OperationPlan;
14
+ [$$subroutine]: LayerPlan<LayerPlanReasonSubroutine> | null;
13
15
  isArgumentsFinalized: boolean;
14
16
  isFinalized: boolean;
15
17
  debug: boolean;
@@ -32,9 +34,10 @@ export declare class ExecutableStep<TData = any> extends BaseStep {
32
34
  isOptimized: boolean;
33
35
  allowMultipleOptimizations: boolean;
34
36
  _stepOptions: StepOptions;
35
- polymorphicPaths: ReadonlySet<string>;
37
+ polymorphicPaths: ReadonlySet<string> | null;
36
38
  store: boolean;
37
- metaKey: number | string | symbol;
39
+ metaKey: number | string | symbol | undefined;
40
+ optimizeMetaKey: number | string | symbol | undefined;
38
41
  constructor();
39
42
  protected withMyLayerPlan<T>(callback: () => T): T;
40
43
  protected getStep(id: number): ExecutableStep;
@@ -42,9 +45,9 @@ export declare class ExecutableStep<TData = any> extends BaseStep {
42
45
  protected getDepDeep(depId: number): ExecutableStep;
43
46
  toString(): string;
44
47
  protected addDependency(step: ExecutableStep, skipDeduplication?: boolean): number;
45
- deduplicate(_peers: readonly ExecutableStep[]): readonly ExecutableStep[];
46
- deduplicatedWith(replacement: ExecutableStep): void;
47
- optimize(_options: StepOptimizeOptions): ExecutableStep;
48
+ deduplicate?(_peers: readonly ExecutableStep[]): readonly ExecutableStep[];
49
+ deduplicatedWith?(replacement: ExecutableStep): void;
50
+ optimize?(_options: StepOptimizeOptions): ExecutableStep;
48
51
  finalize(): void;
49
52
  execute(count: number, values: ReadonlyArray<GrafastValuesList<any>>, extra: ExecutionExtra): PromiseOrDirect<GrafastResultsList<TData>>;
50
53
  destroy(): void;
@@ -11,7 +11,7 @@ export declare class __InputDynamicScalarStep<TLeaf = any> extends UnbatchedExec
11
11
  private variableNames;
12
12
  constructor(inputType: GraphQLScalarType, value: ListValueNode | ObjectValueNode);
13
13
  valueFromValues(variableValues: any[]): any;
14
- unbatchedExecute: (extra: ExecutionExtra, ...variableValues: any[]) => TLeaf;
14
+ unbatchedExecute: (_extra: ExecutionExtra, ...variableValues: any[]) => TLeaf;
15
15
  eval(): TLeaf;
16
16
  evalIs(expectedValue: undefined | null | 0): boolean;
17
17
  }
@@ -1,6 +1,7 @@
1
- import type { GraphQLInputType, ValueNode } from "graphql";
2
- import { GraphQLList } from "graphql";
1
+ import type { GraphQLInputType } from "graphql";
2
+ import * as graphql from "graphql";
3
3
  import type { InputStep } from "../input.js";
4
+ import type { NotVariableValueNode } from "../interfaces.js";
4
5
  import { ExecutableStep } from "../step.js";
5
6
  import type { ConstantStep } from "./constant.js";
6
7
  export declare class __InputListStep extends ExecutableStep {
@@ -11,8 +12,8 @@ export declare class __InputListStep extends ExecutableStep {
11
12
  };
12
13
  isSyncAndSafe: boolean;
13
14
  private itemCount;
14
- constructor(inputType: GraphQLList<GraphQLInputType>, seenTypes: Set<GraphQLInputType>, inputValues: ValueNode | undefined);
15
- optimize(): ConstantStep<null> | ConstantStep<any[]>;
15
+ constructor(inputType: graphql.GraphQLList<GraphQLInputType>, seenTypes: ReadonlyArray<GraphQLInputType> | undefined, inputValues: NotVariableValueNode | undefined);
16
+ optimize(): ExecutableStep;
16
17
  execute(): any[];
17
18
  unbatchedExecute: () => any;
18
19
  at(index: number): InputStep | ConstantStep<undefined>;
@@ -1,6 +1,6 @@
1
- import type { GraphQLInputObjectType, GraphQLInputType, ValueNode } from "graphql";
1
+ import type { GraphQLInputObjectType, GraphQLInputType } from "graphql";
2
2
  import type { InputStep } from "../input.js";
3
- import type { ExecutionExtra } from "../interfaces.js";
3
+ import type { ExecutionExtra, NotVariableValueNode } from "../interfaces.js";
4
4
  import { UnbatchedExecutableStep } from "../step.js";
5
5
  export declare class __InputObjectStep extends UnbatchedExecutableStep {
6
6
  private inputObjectType;
@@ -11,10 +11,10 @@ export declare class __InputObjectStep extends UnbatchedExecutableStep {
11
11
  };
12
12
  isSyncAndSafe: boolean;
13
13
  private inputFields;
14
- constructor(inputObjectType: GraphQLInputObjectType, seenTypes: Set<GraphQLInputType>, inputValues: ValueNode | undefined);
14
+ constructor(inputObjectType: GraphQLInputObjectType, seenTypes: ReadonlyArray<GraphQLInputType>, inputValues: NotVariableValueNode | undefined);
15
15
  optimize(): this | import("./constant.js").ConstantStep<null>;
16
16
  finalize(): void;
17
- unbatchedExecute(extra: ExecutionExtra, ...values: any[]): any;
17
+ unbatchedExecute(_extra: ExecutionExtra, ...values: any[]): any;
18
18
  get(attrName: string): InputStep;
19
19
  eval(): any;
20
20
  evalIs(value: null | undefined | 0): boolean;
@@ -1,4 +1,4 @@
1
- import type { GraphQLLeafType, ValueNode } from "graphql";
1
+ import type { BooleanValueNode, EnumValueNode, FloatValueNode, GraphQLLeafType, IntValueNode, NullValueNode, StringValueNode } from "graphql";
2
2
  import { UnbatchedExecutableStep } from "../step.js";
3
3
  export declare class __InputStaticLeafStep<TLeaf = any> extends UnbatchedExecutableStep<TLeaf> {
4
4
  static $$export: {
@@ -7,8 +7,9 @@ export declare class __InputStaticLeafStep<TLeaf = any> extends UnbatchedExecuta
7
7
  };
8
8
  isSyncAndSafe: boolean;
9
9
  private readonly coercedValue;
10
- constructor(inputType: GraphQLLeafType, value: ValueNode | undefined);
10
+ constructor(inputType: GraphQLLeafType, value: IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | undefined);
11
11
  unbatchedExecute(): TLeaf;
12
+ optimize(): import("./constant.js").ConstantStep<any>;
12
13
  eval(): TLeaf;
13
14
  evalIs(expectedValue: unknown): boolean;
14
15
  }
@@ -14,7 +14,7 @@ export declare class __TrackedValueStep<TData = any> extends UnbatchedExecutable
14
14
  private readonly path;
15
15
  constructor(value: TData | undefined, valuePlan: __ValueStep<TData> | AccessStep<TData>, constraints: Constraint[], path?: Array<string | number>);
16
16
  execute(_count: number, values: [GrafastValuesList<TData>]): GrafastResultsList<TData>;
17
- unbatchedExecute(extra: ExecutionExtra, v: TData): TData;
17
+ unbatchedExecute(_extra: ExecutionExtra, v: TData): TData;
18
18
  private getValuePlan;
19
19
  get<TAttribute extends keyof TData & string>(attrName: TAttribute): __TrackedValueStep<TData[TAttribute]>;
20
20
  at<TIndex extends keyof TData & number>(index: TIndex): __TrackedValueStep<TData[TIndex]>;
@@ -16,7 +16,6 @@ export declare class AccessStep<TData> extends UnbatchedExecutableStep<TData> {
16
16
  get<TAttr extends keyof TData>(attrName: TAttr): AccessStep<TData[TAttr]>;
17
17
  at<TIndex extends keyof TData>(index: TIndex): AccessStep<TData[TIndex]>;
18
18
  optimize(): AccessStep<TData>;
19
- finalize(): void;
20
19
  unbatchedExecute(_extra: ExecutionExtra, ..._values: any[]): any;
21
20
  deduplicate(peers: AccessStep<unknown>[]): AccessStep<TData>[];
22
21
  }
@@ -48,7 +48,7 @@ export declare class ConnectionStep<TItemStep extends ExecutableStep, TCursorSte
48
48
  getSubplan(): TStep;
49
49
  cloneSubplanWithoutPagination(...args: ParametersExceptFirst<TStep["connectionClone"]>): TStep;
50
50
  cloneSubplanWithPagination(...args: ParametersExceptFirst<TStep["connectionClone"]> | []): TStep;
51
- edges(): TStep | import("./listTransform.js").__ListTransformStep<any, any, any, any>;
51
+ edges(): ExecutableStep;
52
52
  nodes(): TStep | import("./listTransform.js").__ListTransformStep<any, any, any, any>;
53
53
  wrapEdge($edge: TItemStep): EdgeStep<TItemStep, TCursorStep, TStep, TNodeStep>;
54
54
  pageInfo(): PageInfoCapableStep;
@@ -77,7 +77,7 @@ export declare class EdgeStep<TItemStep extends ExecutableStep, TCursorStep exte
77
77
  optimize(): EdgeStep<TItemStep, TCursorStep, TStep, TNodeStep>;
78
78
  deduplicate(_peers: EdgeStep<any, any, any, any>[]): EdgeStep<TItemStep, TCursorStep, TStep, TNodeStep>[];
79
79
  deduplicatedWith(replacement: EdgeStep<any, any, any, any>): void;
80
- unbatchedExecute(extra: ExecutionExtra, record: any, cursor: any): any;
80
+ unbatchedExecute(_extra: ExecutionExtra, record: any, cursor: any): any;
81
81
  }
82
82
  export declare function connection<TItemStep extends ExecutableStep, TCursorStep extends ExecutableStep, TStep extends ConnectionCapableStep<TItemStep, TCursorStep>, TNodeStep extends ExecutableStep = ExecutableStep>(step: TStep, itemPlan?: ($item: TItemStep) => TNodeStep, cursorPlan?: ($item: TItemStep) => ExecutableStep<string | null>): ConnectionStep<TItemStep, TCursorStep, TStep, TNodeStep>;
83
83
  export {};
@@ -1,13 +1,15 @@
1
1
  import type { GrafastResultsList } from "../interfaces.js";
2
2
  import { UnbatchedExecutableStep } from "../step.js";
3
3
  export declare class ConstantStep<TData> extends UnbatchedExecutableStep<TData> {
4
- private data;
4
+ readonly data: TData;
5
5
  static $$export: {
6
6
  moduleName: string;
7
7
  exportName: string;
8
8
  };
9
9
  isSyncAndSafe: boolean;
10
10
  constructor(data: TData);
11
+ toStringMeta(): string;
12
+ deduplicate(peers: readonly ConstantStep<any>[]): ConstantStep<any>[];
11
13
  execute(count: number): GrafastResultsList<TData>;
12
14
  eval(): TData;
13
15
  evalIs(value: any): boolean;
@@ -10,7 +10,7 @@ export declare class FirstStep<TData> extends UnbatchedExecutableStep<TData> {
10
10
  allowMultipleOptimizations: boolean;
11
11
  constructor(parentPlan: ExecutableStep<ReadonlyArray<TData>>);
12
12
  execute(count: number, values: GrafastValuesList<[ReadonlyArray<TData>]>): GrafastResultsList<TData>;
13
- unbatchedExecute(extra: ExecutionExtra, list: any[]): any;
13
+ unbatchedExecute(_extra: ExecutionExtra, list: any[]): any;
14
14
  deduplicate(peers: FirstStep<TData>[]): FirstStep<TData>[];
15
15
  optimize(): ExecutableStep<any> | this;
16
16
  }
@@ -28,8 +28,8 @@ export declare class GraphQLResolverStep extends UnbatchedExecutableStep {
28
28
  }) | null | undefined, $plan: ExecutableStep, $args: ObjectStep, resolveInfoBase: ResolveInfoBase, returnContextAndResolveInfo?: boolean);
29
29
  toStringMeta(): string | null;
30
30
  deduplicate(peers: GraphQLResolverStep[]): GraphQLResolverStep[];
31
- unbatchedExecute(extra: ExecutionExtra, source: any, args: any, context: any, variableValues: any, rootValue: any): any;
32
- unbatchedStream(extra: ExecutionExtra, source: any, args: any, context: any, variableValues: any, rootValue: any): any;
31
+ unbatchedExecute(_extra: ExecutionExtra, source: any, args: any, context: any, variableValues: any, rootValue: any): any;
32
+ unbatchedStream(_extra: ExecutionExtra, source: any, args: any, context: any, variableValues: any, rootValue: any): any;
33
33
  stream(count: number, values: ReadonlyArray<GrafastValuesList<any>>, extra: ExecutionExtra): Promise<GrafastResultStreamList<any>>;
34
34
  }
35
35
  export declare class GraphQLItemHandler extends ExecutableStep implements PolymorphicStep {
@@ -9,7 +9,7 @@ export declare class LastStep<TData> extends UnbatchedExecutableStep<TData> {
9
9
  isSyncAndSafe: boolean;
10
10
  allowMultipleOptimizations: boolean;
11
11
  constructor(parentPlan: ExecutableStep<ReadonlyArray<TData>>);
12
- unbatchedExecute: (extra: ExecutionExtra, list: ReadonlyArray<TData>) => TData;
12
+ unbatchedExecute: (_extra: ExecutionExtra, list: ReadonlyArray<TData>) => TData;
13
13
  deduplicate(peers: LastStep<TData>[]): LastStep<TData>[];
14
14
  optimize(): ExecutableStep<any> | this;
15
15
  }
@@ -1,6 +1,7 @@
1
- import type { ExecutionExtra, UnwrapPlanTuple } from "../interfaces.js";
1
+ import type { ExecutionExtra, StepOptimizeOptions, UnwrapPlanTuple } from "../interfaces.js";
2
2
  import type { ExecutableStep } from "../step.js";
3
3
  import { UnbatchedExecutableStep } from "../step.js";
4
+ import { ConstantStep } from "./constant.js";
4
5
  export declare class ListStep<const TPlanTuple extends readonly ExecutableStep[]> extends UnbatchedExecutableStep<UnwrapPlanTuple<TPlanTuple>> {
5
6
  static $$export: {
6
7
  moduleName: string;
@@ -8,11 +9,13 @@ export declare class ListStep<const TPlanTuple extends readonly ExecutableStep[]
8
9
  };
9
10
  isSyncAndSafe: boolean;
10
11
  allowMultipleOptimizations: boolean;
12
+ optimizeMetaKey: string;
11
13
  constructor(list: TPlanTuple);
12
14
  toStringMeta(): string;
13
15
  execute(count: number, values: any[][]): Array<UnwrapPlanTuple<TPlanTuple>>;
14
- unbatchedExecute(extra: ExecutionExtra, ...values: any[]): UnwrapPlanTuple<TPlanTuple>;
16
+ unbatchedExecute(_extra: ExecutionExtra, ...values: any[]): UnwrapPlanTuple<TPlanTuple>;
15
17
  deduplicate(peers: ListStep<TPlanTuple>[]): ListStep<TPlanTuple>[];
18
+ optimize(opts: StepOptimizeOptions): this | ConstantStep<any[]>;
16
19
  at<TIndex extends keyof TPlanTuple>(index: TIndex): TPlanTuple[TIndex];
17
20
  }
18
21
  export declare function list<const TPlanTuple extends readonly ExecutableStep[]>(list: TPlanTuple): ListStep<TPlanTuple>;
@@ -18,7 +18,7 @@ export declare class NodeStep<TCodecs extends {
18
18
  }, $id: ExecutableStep<string>);
19
19
  planForType(type: GraphQLObjectType): ExecutableStep;
20
20
  private getTypeNameFromSpecifier;
21
- unbatchedExecute: (extra: ExecutionExtra, specifier: any) => PolymorphicData<string, ReadonlyArray<any>> | null;
21
+ unbatchedExecute: (_extra: ExecutionExtra, specifier: any) => PolymorphicData<string, ReadonlyArray<any>> | null;
22
22
  }
23
23
  export declare function node<TCodecs extends {
24
24
  [key: string]: NodeIdCodec<any>;
@@ -1,6 +1,7 @@
1
- import type { ExecutionExtra } from "../interfaces.js";
1
+ import type { ExecutionExtra, StepOptimizeOptions } from "../interfaces.js";
2
2
  import type { ExecutableStep } from "../step.js";
3
3
  import { UnbatchedExecutableStep } from "../step.js";
4
+ import { ConstantStep } from "./constant.js";
4
5
  import type { SetterCapableStep } from "./setter.js";
5
6
  type DataFromStep<TStep extends ExecutableStep> = TStep extends ExecutableStep<infer TData> ? TData : never;
6
7
  type DataFromPlans<TPlans extends {
@@ -31,15 +32,17 @@ export declare class ObjectStep<TPlans extends {
31
32
  isSyncAndSafe: boolean;
32
33
  allowMultipleOptimizations: boolean;
33
34
  private keys;
35
+ optimizeMetaKey: string;
34
36
  constructor(obj: TPlans);
35
37
  set<TKey extends keyof TPlans>(key: TKey, plan: TPlans[TKey]): void;
36
38
  getStepForKey<TKey extends keyof TPlans>(key: TKey, allowMissing?: boolean): TKey extends keyof TPlans ? TPlans[TKey] : null;
37
39
  toStringMeta(): string;
38
- tupleToObjectJIT(): (extra: ExecutionExtra, ...tuple: Array<DataFromPlans<TPlans>[keyof TPlans]>) => DataFromPlans<TPlans>;
40
+ tupleToObjectJIT(callback: (fn: (extra: ExecutionExtra, ...tuple: Array<DataFromPlans<TPlans>[keyof TPlans]>) => DataFromPlans<TPlans>) => void): void;
39
41
  finalize(): void;
40
42
  execute(count: number, values: Array<Array<DataFromPlans<TPlans>[keyof TPlans]>>, extra: ExecutionExtra): Array<DataFromPlans<TPlans>>;
41
43
  unbatchedExecute(_extra: ExecutionExtra, ..._values: any[]): any;
42
44
  deduplicate(peers: ObjectStep<any>[]): ObjectStep<TPlans>[];
45
+ optimize(opts: StepOptimizeOptions): this | ConstantStep<any>;
43
46
  get<TKey extends keyof TPlans>(key: TKey): TPlans[TKey];
44
47
  }
45
48
  export declare function object<TPlans extends {
@@ -14,7 +14,7 @@ export declare class ProxyStep<T> extends UnbatchedExecutableStep<T> {
14
14
  toStringMeta(): string | null;
15
15
  addDependency(step: ExecutableStep): number;
16
16
  execute(_count: number, values: [GrafastValuesList<T>]): GrafastResultsList<T>;
17
- unbatchedExecute(extra: ExecutionExtra, value: T): T;
17
+ unbatchedExecute(_extra: ExecutionExtra, value: T): T;
18
18
  stream: undefined;
19
19
  }
20
20
  declare module "../step.js" {
@@ -15,8 +15,10 @@ export declare class RemapKeysStep extends UnbatchedExecutableStep {
15
15
  private mapper;
16
16
  constructor($plan: ExecutableStep, actualKeyByDesiredKey: ActualKeyByDesiredKey);
17
17
  toStringMeta(): string;
18
+ optimize(): ExecutableStep<any> | this;
19
+ finalize(): void;
18
20
  execute(_count: number, values: GrafastValuesList<any[]>): GrafastResultsList<any>;
19
- unbatchedExecute(extra: ExecutionExtra, value: any): any;
21
+ unbatchedExecute(_extra: ExecutionExtra, value: any): any;
20
22
  deduplicate(peers: RemapKeysStep[]): RemapKeysStep[];
21
23
  }
22
24
  export declare function remapKeys($step: ExecutableStep, actualKeyByDesiredKey: {
@@ -11,7 +11,7 @@ export declare class ReverseStep<TData> extends UnbatchedExecutableStep<readonly
11
11
  allowMultipleOptimizations: boolean;
12
12
  constructor(plan: ExecutableStep<readonly TData[]>);
13
13
  execute(_count: number, values: [GrafastValuesList<TData[]>]): GrafastResultsList<TData[]>;
14
- unbatchedExecute(extra: ExecutionExtra, arr: TData[]): TData[];
14
+ unbatchedExecute(_extra: ExecutionExtra, arr: TData[]): TData[];
15
15
  deduplicate(peers: ReverseStep<TData>[]): ReverseStep<TData>[];
16
16
  }
17
17
  export declare function reverse<TData>(plan: ExecutableStep<readonly TData[]>): ReverseStep<TData>;
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ export declare const timeSource: import("perf_hooks").Performance | DateConstructor;
3
+ //# sourceMappingURL=timeSource.d.ts.map
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { FieldNode, GraphQLEnumValueConfig, GraphQLFieldConfig, GraphQLInputFieldConfig, GraphQLInputObjectTypeConfig, GraphQLInputType, GraphQLNamedType, GraphQLObjectTypeConfig, GraphQLOutputType, GraphQLSchema, ValueNode } from "graphql";
2
- import { GraphQLEnumType, GraphQLInputObjectType, GraphQLObjectType } from "graphql";
1
+ import type { ConstValueNode, FieldNode, GraphQLEnumValueConfig, GraphQLFieldConfig, GraphQLInputFieldConfig, GraphQLInputObjectTypeConfig, GraphQLInputType, GraphQLNamedType, GraphQLObjectTypeConfig, GraphQLOutputType, GraphQLSchema } from "graphql";
2
+ import * as graphql from "graphql";
3
3
  import type { Deferred } from "./deferred.js";
4
4
  import type { OperationPlan } from "./engine/OperationPlan.js";
5
5
  import type { InputStep } from "./input.js";
@@ -7,7 +7,7 @@ import type { BaseGraphQLArguments, GrafastFieldConfig, GrafastInputFieldConfig,
7
7
  import type { ExecutableStep, ModifierStep } from "./step.js";
8
8
  export declare const ROOT_VALUE_OBJECT: any;
9
9
  export declare function assertNullPrototype(object: Record<string, unknown>, description: string): void;
10
- export declare function defaultValueToValueNode(type: GraphQLInputType, defaultValue: unknown): ValueNode | undefined;
10
+ export declare function defaultValueToValueNode(type: GraphQLInputType, defaultValue: unknown): ConstValueNode | undefined;
11
11
  export declare function isPromise<T>(t: T | Promise<T>): t is Promise<T>;
12
12
  export declare function isPromiseLike<T>(t: T | Promise<T> | PromiseLike<T>): t is PromiseLike<T>;
13
13
  export declare function isDeferred<T>(t: T | Promise<T> | Deferred<T>): t is Deferred<T>;
@@ -21,7 +21,7 @@ export type ObjectTypeSpec<TContext extends Grafast.Context, TParentStep extends
21
21
  export declare function objectSpec<TContext extends Grafast.Context, TParentStep extends ExecutableStep, TFields extends ObjectTypeFields<TContext, TParentStep>>(spec: ObjectTypeSpec<TContext, TParentStep, TFields>, Step: ((step: ExecutableStep) => asserts step is ExecutableStep) | {
22
22
  new (...args: any[]): TParentStep;
23
23
  } | null): GraphQLObjectTypeConfig<any, TContext>;
24
- export type GrafastObjectType<TContext extends Grafast.Context, TParentStep extends ExecutableStep, TFields extends ObjectTypeFields<TContext, TParentStep>> = GraphQLObjectType<TParentStep extends ExecutableStep<infer U> ? U : never, TContext> & {
24
+ export type GrafastObjectType<TContext extends Grafast.Context, TParentStep extends ExecutableStep, TFields extends ObjectTypeFields<TContext, TParentStep>> = graphql.GraphQLObjectType<TParentStep extends ExecutableStep<infer U> ? U : never, TContext> & {
25
25
  TParentStep: TParentStep;
26
26
  TFields: TFields;
27
27
  };
@@ -36,7 +36,7 @@ export type GrafastInputFieldConfigMap<TContext extends Grafast.Context, TParent
36
36
  export type InputObjectTypeSpec<TContext extends Grafast.Context, TParentStep extends ModifierStep<any>, TFields extends GrafastInputFieldConfigMap<TContext, TParentStep>> = Omit<GraphQLInputObjectTypeConfig, "fields"> & {
37
37
  fields: TFields | (() => TFields);
38
38
  };
39
- export type GrafastInputObjectType<TContext extends Grafast.Context, TParentStep extends ModifierStep<any>, TFields extends GrafastInputFieldConfigMap<TContext, TParentStep>> = GraphQLInputObjectType & {
39
+ export type GrafastInputObjectType<TContext extends Grafast.Context, TParentStep extends ModifierStep<any>, TFields extends GrafastInputFieldConfigMap<TContext, TParentStep>> = graphql.GraphQLInputObjectType & {
40
40
  TContext: TContext;
41
41
  TParentStep: TParentStep;
42
42
  TFields: TFields;
@@ -49,7 +49,7 @@ declare module "graphql" {
49
49
  }
50
50
  }
51
51
  declare const $$valueConfigByValue: unique symbol;
52
- export declare function getEnumValueConfig(enumType: GraphQLEnumType, outputValue: string): GraphQLEnumValueConfig | undefined;
52
+ export declare function getEnumValueConfig(enumType: graphql.GraphQLEnumType, outputValue: string): GraphQLEnumValueConfig | undefined;
53
53
  export declare const sharedNull: any;
54
54
  export declare function stack(message: string, length?: number): void;
55
55
  export declare function arrayOfLength(length: number, fill?: any): any[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grafast",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1-alpha.4",
4
4
  "description": "Cutting edge GraphQL planning and execution engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -45,13 +45,13 @@
45
45
  "node": ">=14.17"
46
46
  },
47
47
  "dependencies": {
48
- "@graphile/lru": "^5.0.0-alpha.1",
48
+ "@graphile/lru": "^5.0.0-alpha.2",
49
49
  "debug": "^4.3.3",
50
- "tamedevil": "^0.0.0-alpha.1"
50
+ "tamedevil": "^0.0.0-alpha.2"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@envelop/core": "^3.0.4",
54
- "graphile-config": "^0.0.1-alpha.1",
54
+ "graphile-config": "^0.0.1-alpha.2",
55
55
  "graphql": "^16.1.0-experimental-stream-defer.6"
56
56
  },
57
57
  "peerDependenciesMeta": {