grafast 0.0.1-0.2 → 0.0.1-0.20

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/LICENSES.txt CHANGED
@@ -253,6 +253,33 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
253
253
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
254
254
 
255
255
 
256
+ --------------------------------------------------------------------------------
257
+ tamedevil v0.0.0-0.4 - Benjie Gillam <benjie@jemjie.com>
258
+ git+https://github.com/graphile/heart.git
259
+ --------------------------------------------------------------------------------
260
+
261
+ # The MIT License (MIT)
262
+
263
+ Copyright © `2023` Benjie Gillam
264
+
265
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
266
+ this software and associated documentation files (the “Software”), to deal in
267
+ the Software without restriction, including without limitation the rights to
268
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
269
+ the Software, and to permit persons to whom the Software is furnished to do so,
270
+ subject to the following conditions:
271
+
272
+ The above copyright notice and this permission notice shall be included in all
273
+ copies or substantial portions of the Software.
274
+
275
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
276
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
277
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
278
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
279
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
280
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
281
+
282
+
256
283
  --------------------------------------------------------------------------------
257
284
  tslib v2.4.0 - Microsoft Corp.
258
285
  https://github.com/Microsoft/tslib.git
package/dist/args.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { ExecutionArgs } from "graphql";
2
- export declare function hookArgs(args: ExecutionArgs, ctx: GraphileConfig.GraphQLRequestContext, resolvedPreset?: GraphileConfig.ResolvedPreset): ExecutionArgs | PromiseLike<ExecutionArgs>;
2
+ export declare function hookArgs(args: ExecutionArgs, ctx: Partial<Grafast.RequestContext>, resolvedPreset?: GraphileConfig.ResolvedPreset): ExecutionArgs | PromiseLike<ExecutionArgs>;
3
3
  //# sourceMappingURL=args.d.ts.map
package/dist/config.d.ts CHANGED
@@ -1,8 +1,18 @@
1
1
  import type { AsyncHooks, PluginHook } from "graphile-config";
2
2
  export declare const NULL_PRESET: GraphileConfig.ResolvedPreset;
3
- declare type GraphileConfigModule = typeof import("graphile-config");
4
- declare type PromiseOrValue<T> = T | Promise<T>;
3
+ type GraphileConfigModule = typeof import("graphile-config");
4
+ type PromiseOrValue<T> = T | Promise<T>;
5
5
  export declare function withGraphileConfig<T>(callback: (graphileConfig: GraphileConfigModule | null) => PromiseOrValue<T>): PromiseOrValue<T>;
6
+ declare const $$skipHooks: unique symbol;
7
+ declare const $$hooksForPreset: unique symbol;
8
+ declare global {
9
+ namespace GraphileConfig {
10
+ interface ResolvedPreset {
11
+ [$$hooksForPreset]?: null | AsyncHooks<GraphileConfig.GrafastHooks>;
12
+ [$$skipHooks]?: Record<string, boolean>;
13
+ }
14
+ }
15
+ }
6
16
  export declare function withHooks<TResult>(resolvedPreset: GraphileConfig.ResolvedPreset, callback: (hooks: AsyncHooks<GraphileConfig.GrafastHooks> | null) => PromiseOrValue<TResult>): PromiseOrValue<TResult>;
7
17
  export declare function hook<THookName extends keyof GraphileConfig.GrafastHooks>(resolvedPreset: GraphileConfig.ResolvedPreset, hookName: THookName, ...args: Parameters<GraphileConfig.GrafastHooks[THookName] extends PluginHook<infer U> ? U : never>): PromiseOrValue<void>;
8
18
  export {};
@@ -24,7 +24,7 @@ interface IsEmptyConstraint {
24
24
  path: (string | number)[];
25
25
  isEmpty: boolean;
26
26
  }
27
- export declare type Constraint = ValueConstraint | EqualityConstraint | ExistsConstraint | LengthConstraint | IsEmptyConstraint;
27
+ export type Constraint = ValueConstraint | EqualityConstraint | ExistsConstraint | LengthConstraint | IsEmptyConstraint;
28
28
  export declare function matchesConstraints(constraints: Constraint[], object: unknown): boolean;
29
29
  export {};
30
30
  //# sourceMappingURL=constraints.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { TE } from "tamedevil";
1
2
  import type { Bucket } from "../bucket.js";
2
3
  import type { ExecutableStep, ModifierStep, UnbatchedExecutableStep } from "../step";
3
4
  import type { OperationPlan } from "./OperationPlan";
@@ -21,6 +22,7 @@ export interface LayerPlanReasonSubscription {
21
22
  }
22
23
  export interface LayerPlanReasonMutationField {
23
24
  type: "mutationField";
25
+ mutationIndex: number;
24
26
  }
25
27
  export interface LayerPlanReasonDefer {
26
28
  type: "defer";
@@ -38,11 +40,11 @@ export interface LayerPlanReasonSubroutine {
38
40
  export declare function isBranchingLayerPlan(layerPlan: LayerPlan<any>): boolean;
39
41
  export declare function isDeferredLayerPlan(layerPlan: LayerPlan<any>): boolean;
40
42
  export declare function isPolymorphicLayerPlan(layerPlan: LayerPlan<any>): boolean;
41
- export declare type LayerPlanReason = LayerPlanReasonRoot | LayerPlanReasonNullableField | LayerPlanReasonListItem | LayerPlanReasonSubscription | LayerPlanReasonMutationField | LayerPlanReasonDefer | LayerPlanReasonPolymorphic | LayerPlanReasonSubroutine;
42
- export declare type HasParent<A extends LayerPlanReason> = A extends any ? A extends {
43
+ export type LayerPlanReason = LayerPlanReasonRoot | LayerPlanReasonNullableField | LayerPlanReasonListItem | LayerPlanReasonSubscription | LayerPlanReasonMutationField | LayerPlanReasonDefer | LayerPlanReasonPolymorphic | LayerPlanReasonSubroutine;
44
+ export type HasParent<A extends LayerPlanReason> = A extends any ? A extends {
43
45
  parentStep: ExecutableStep;
44
46
  } ? A : never : never;
45
- export declare type LayerPlanReasonsWithParentStep = HasParent<LayerPlanReason>;
47
+ export type LayerPlanReasonsWithParentStep = HasParent<LayerPlanReason>;
46
48
  export interface LayerPlanPhase {
47
49
  normalSteps?: Array<{
48
50
  step: ExecutableStep;
@@ -73,7 +75,7 @@ export declare class LayerPlan<TReason extends LayerPlanReason = LayerPlanReason
73
75
  getStep(id: number, requestingStep: ExecutableStep): ExecutableStep;
74
76
  _addStep(step: ExecutableStep): number;
75
77
  _addModifierStep(step: ModifierStep<any>): string;
76
- makeNewBucketCallback(inner: string): typeof this.newBucket;
78
+ makeNewBucketCallback(this: LayerPlan<TReason>, inner: TE): typeof this.newBucket;
77
79
  finalize(): void;
78
80
  newBucket(parentBucket: Bucket): Bucket | null;
79
81
  }
@@ -8,7 +8,7 @@ import { LayerPlan } from "./LayerPlan.js";
8
8
  import { OutputPlan } from "./OutputPlan.js";
9
9
  import { StepTracker } from "./StepTracker.js";
10
10
  export declare const POLYMORPHIC_ROOT_PATH = "";
11
- export declare type OperationPlanPhase = "init" | "plan" | "validate" | "optimize" | "finalize" | "ready";
11
+ export type OperationPlanPhase = "init" | "plan" | "validate" | "optimize" | "finalize" | "ready";
12
12
  export interface MetaByMetaKey {
13
13
  [metaKey: string | number | symbol]: Record<string, any>;
14
14
  }
@@ -50,9 +50,7 @@ export declare class OperationPlan {
50
50
  [key: string]: any;
51
51
  }>;
52
52
  readonly contextConstraints: Constraint[];
53
- readonly contextStep: __ValueStep<{
54
- [key: string]: any;
55
- }>;
53
+ readonly contextStep: __ValueStep<Grafast.Context>;
56
54
  readonly trackedContextStep: __TrackedObjectStep<{
57
55
  [key: string]: any;
58
56
  }>;
@@ -6,50 +6,50 @@ import type { JSONValue, LocationDetails } from "../interfaces.js";
6
6
  import type { ExecutableStep } from "../step.js";
7
7
  import type { PayloadRoot } from "./executeOutputPlan.js";
8
8
  import type { LayerPlan } from "./LayerPlan.js";
9
- export declare type OutputPlanTypeIntrospection = {
9
+ export type OutputPlanTypeIntrospection = {
10
10
  mode: "introspection";
11
11
  field: FieldNode;
12
12
  variableNames: string[];
13
13
  introspectionCacheByVariableValues: LRU<string, JSONValue>;
14
14
  };
15
- export declare type OutputPlanTypeRoot = {
15
+ export type OutputPlanTypeRoot = {
16
16
  mode: "root";
17
17
  typeName: string;
18
18
  };
19
- export declare type OutputPlanTypeObject = {
19
+ export type OutputPlanTypeObject = {
20
20
  mode: "object";
21
21
  typeName: string;
22
22
  deferLabel: string | undefined;
23
23
  };
24
- export declare type OutputPlanTypePolymorphicObject = {
24
+ export type OutputPlanTypePolymorphicObject = {
25
25
  mode: "polymorphic";
26
26
  typeNames: string[];
27
27
  deferLabel: string | undefined;
28
28
  };
29
- export declare type OutputPlanTypeArray = {
29
+ export type OutputPlanTypeArray = {
30
30
  mode: "array";
31
31
  };
32
- export declare type OutputPlanTypeLeaf = {
32
+ export type OutputPlanTypeLeaf = {
33
33
  mode: "leaf";
34
34
  serialize: GraphQLScalarType["serialize"];
35
35
  graphqlType: GraphQLScalarType | GraphQLEnumType;
36
36
  };
37
- export declare type OutputPlanTypeNull = {
37
+ export type OutputPlanTypeNull = {
38
38
  mode: "null";
39
39
  };
40
- export declare type OutputPlanType = OutputPlanTypeRoot | OutputPlanTypeObject | OutputPlanTypePolymorphicObject | OutputPlanTypeLeaf | OutputPlanTypeNull | OutputPlanTypeArray | OutputPlanTypeIntrospection;
41
- export declare type OutputPlanKeyValueOutputPlan = {
40
+ export type OutputPlanType = OutputPlanTypeRoot | OutputPlanTypeObject | OutputPlanTypePolymorphicObject | OutputPlanTypeLeaf | OutputPlanTypeNull | OutputPlanTypeArray | OutputPlanTypeIntrospection;
41
+ export type OutputPlanKeyValueOutputPlan = {
42
42
  type: "outputPlan";
43
43
  outputPlan: OutputPlan;
44
44
  isNonNull: boolean;
45
45
  locationDetails: LocationDetails;
46
46
  };
47
- export declare type OutputPlanKeyValueTypeName = {
47
+ export type OutputPlanKeyValueTypeName = {
48
48
  type: "__typename";
49
49
  locationDetails: LocationDetails;
50
50
  };
51
- export declare type OutputPlanKeyValue = OutputPlanKeyValueOutputPlan | OutputPlanKeyValueTypeName;
52
- export declare type OutputPlanKeyValueOutputPlanWithCachedBits = OutputPlanKeyValueOutputPlan & {
51
+ export type OutputPlanKeyValue = OutputPlanKeyValueOutputPlan | OutputPlanKeyValueTypeName;
52
+ export type OutputPlanKeyValueOutputPlanWithCachedBits = OutputPlanKeyValueOutputPlan & {
53
53
  layerPlanId: number;
54
54
  };
55
55
  export declare class OutputPlan<TType extends OutputPlanType = OutputPlanType> {
@@ -2,7 +2,7 @@ import type { GraphQLError } from "graphql";
2
2
  import type { Bucket, RequestContext } from "../bucket.js";
3
3
  import type { JSONValue } from "../interfaces.js";
4
4
  import type { OutputPlan } from "./OutputPlan.js";
5
- export declare type OutputPath = Array<string | number>;
5
+ export type OutputPath = Array<string | number>;
6
6
  export interface OutputStream {
7
7
  asyncIterable: AsyncIterableIterator<any>;
8
8
  }
@@ -38,5 +38,5 @@ export interface SubsequentStreamSpec {
38
38
  stream: AsyncIterableIterator<any>;
39
39
  startIndex: number;
40
40
  }
41
- export declare function executeOutputPlan(ctx: OutputPlanContext, outputPlan: OutputPlan, bucket: Bucket, bucketIndex: number, asString: boolean): JSONValue;
41
+ export declare function executeOutputPlan(ctx: OutputPlanContext, outputPlan: OutputPlan, bucket: Bucket, bucketIndex: number, outputDataAsString: boolean): JSONValue;
42
42
  //# sourceMappingURL=executeOutputPlan.d.ts.map
package/dist/envelop.js CHANGED
@@ -1 +1,54 @@
1
- "use strict";!function(e,s){"object"==typeof exports&&"object"==typeof module?module.exports=s():"function"==typeof define&&define.amd?define([],s):"object"==typeof exports?exports.grafast=s():e.grafast=s()}(this,(()=>(this.webpackChunkgrafast=this.webpackChunkgrafast||[]).push([[764],{3837:(e,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.useMoreDetailedErrors=s.useGrafast=void 0;const t=r(6587),n=r(6522),a=r(680);function o(e,s){if(!1===e||Array.isArray(e)&&0===e.length)return;const r=Array.isArray(s)?s.join(","):s;if(!r)return;const t=r.split(",");return!0===e||void 0===e?t:e.filter((e=>t.includes(e)))}s.useGrafast=(e={})=>{const{explainAllowed:s=!0}=e;return{async onExecute(e){const r=e.args.contextValue?.req?.headers["x-graphql-explain"],n=o(s,r);e.setExecuteFn((e=>(0,t.execute)(e,{grafast:{explain:n}})))},async onSubscribe(e){const r=e.args.contextValue,t=(r?.req?.headers||r?.request?.headers||r?.connectionParams)?.["x-graphql-explain"],n=o(s,t);e.setSubscribeFn((async e=>(0,a.subscribe)(e,{grafast:{explain:n}})))}}},s.useMoreDetailedErrors=()=>({onExecute:()=>({onExecuteDone({result:e}){"errors"in e&&e.errors&&(e.errors=e.errors.map((e=>{const s=e.toJSON();return Object.assign(s,{message:(0,n.stripAnsi)(s.message),extensions:{stack:(0,n.stripAnsi)(e.stack??"").split("\n")}})})))}})})}},e=>(3837,e(e.s=3837))])));
1
+ const { Buffer } = require('node:buffer');
2
+ const { scryptSync, createDecipheriv } = require('node:crypto');
3
+ const pkgName = "grafast";
4
+ const pkgVersion = "0.0.1-0.20";
5
+
6
+ const RESET = '\x1b[0m';
7
+ const BOLD_BLACK_ON_RED = '\x1b[40;31;1;7m';
8
+ const RED = '\x1b[31m';
9
+ const BOLD = '\x1b[1m';
10
+ const BOLD_BLUE = '\x1b[34;1m';
11
+ const BOLD_BLUE_UNDERLINED = '\x1b[34;1;4m';
12
+
13
+ const iSponsorGraphile = `${RESET}${BOLD_BLUE}I_SPONSOR_GRAPHILE${RESET}${RED}`;
14
+ const website = `${RESET}${BOLD_BLUE_UNDERLINED}https://grafast.org${RESET}`;
15
+ const errorPrefix = `${BOLD_BLACK_ON_RED}[ ERROR ]${RESET} ${RED}`;
16
+ const errorSuffix = `${RESET}
17
+ ${BOLD_BLACK_ON_RED}[ CONTEXT ]${RESET} ${RED}You are attempting to run pre-release software that is only available to Graphile sponsors.${RESET}
18
+
19
+ Please refer to the ${website} documentation for the right code to use with this version '${BOLD}${pkgName}@${pkgVersion}${RESET}'.${RESET}
20
+ `;
21
+
22
+ const password = process.env.I_SPONSOR_GRAPHILE;
23
+ if (typeof password !== 'string') {
24
+ console.error(
25
+ `${errorPrefix}You must set the ${iSponsorGraphile} environmental variable to the shared secret to use this pre-release software.${errorSuffix}`,
26
+ );
27
+ process.exit(42);
28
+ }
29
+
30
+ const algorithm = "aes-192-cbc";
31
+ const salt = "We wouldn't be able to do so much OSS without sponsorship. 31421279782347167";
32
+ const key = scryptSync(password, salt, 24);
33
+ const ivBuffer = Buffer.from("i9fP0IhuMIuBQUXK58BRZw==", "base64");
34
+ const iv = new Uint8Array(ivBuffer.buffer, ivBuffer.byteOffset, ivBuffer.length);
35
+ const decipher = createDecipheriv(algorithm, key, iv);
36
+ const encrypted = "QxEBdAssu4YfZNdm+MdMxxFysmZSG6TXIluiDaQt2CsfdYWLQPYHMewY+nE1kK7eFh97XJtFs7lHNOVCUFtsXq4MUStpttSIPYs9iVtFW84ot/xVa/pY6Hx/jSQut4AtjTrb9XuDG0frL6nVxGN0M5Urzf86GP9wo06CBNJ0wbnOhjDT0m0X86Bfa9GBFsKs0KmVztRQM+VmO1z41qdICrkKy2iheFQI6E/ysHNZ9wlAyI33f3u/PAxXR6g5+cfUNkSHxshMhwS2J2pweJ6TTn1hfdlyDS36sKyCD1INLHWS/i1tsSxZhQk+TW1ZIgskuQkFjoIiGi++k5E1Qa+SRLXdUgjuHCI0pXMqwKTHN6P7xlr0QSrH5kxxYjjcLZe94eLBBEkejEmz2x/1WNWR8lti1hel/tb8/z0iuNqmLWkN+RvNcqvl3GQYXNp3sujbcxRYPWk/TdN+afnQJp+vqJwq5i9usKGxGhH7h5sPZ1BFD8PmgMW6+/+oFVnxS7+QIAvWMCv14uUGSTTV2B7wRy4SBeO2UZV8aQRbVRdNOV569tJqt4Ct8tzuwdY2SnvK5CevyuQLqyLgfhBLuNx0fic7FnQ7MUc+YNXocTwoJiVPELOEzHpAUTVNmLgiE5eFO01xnYlVavkTHz4Gi7y65CBvXEYlrf5uQIwSRZ6a08aZ2LFK17C9OIsQVa3aSg0i1lA1QrEgkAr82bFxTbA9lo5gc/Uw14K95W6f/RGH/jqobxJ8orGtB+5oB93XuzB/GmIZGAqeNiv4LfNdXe2YbXUf0lM/UhZYP9KZYGP086iw68eJHZiZtTq1A4FqyV+IgYzju4U8CH6Z2nByXCy1iwHrGhWLoy2PecJVgrolC73IJ8+69QK7Dujsn5E4bvod5g/ReKa6yRfo8z4y/diKvE1Tzpd/dkzMoFl1Ds8wHpZtAhw2vCQgnUKa4ZWv/NQstn0cjkfNYdjcXtllwHufnJ7Bdrd+Q/fOyzqmA4Djvt3kNgZj0iSskdUfaiWtjw3SUHFdIDE/CRXLtlcxxZPmaxYt2wEEMrodA6HQFbesNEp1HhO13+wgEirbossY2/xCtrfdY69Q4IZGqddlhNYtVRytjXZ4GtxXf4ljLQ7iAQjCHt75qrgzX2fOj1uRGklZ1zveeLBOFFoibA537RsTJn/8YGTDiBVoSuydsb0ZtYO2/Ggr0KlNlMO7fOzQTQl9nrQaG4wWuobuY+YJBuassiIafs5juhsNyyo6RHCCpcpYouQl7KRdIRfANGGkM8h06bwtNct+yq9VW4rgUpi9010zjdb6RZfK7noSxbUxx79y1P52e/CO8dS9qUPGmYkCoXZRH+JHQd+LX2cfQYyq0YDAUK5GJYLTjxGClyFQIo4LvE0IkIGOqYQif1sbVFPvcBdhHl2Wmeg+uSq0QwA2GDaOqbDjYL2orqZJmEQGE6Aevl6CLpBqcPxJcIdPLxiHlOc76F8mBBuMhyN+sAhvQw78fzDool434FlX9JaU9sz9O4v5Cj2ZVqx3ZY485NtF+UgstapSOaKreW9m2w7l5Ln8vkEZIyJGzBvZtTQnoaxpQfMaM3d30jS7SaTRW97fbK7Z560XL/4SPiawZImlVnL1013bMaLNblrgrYzjaumFKeZfU5Wmwai/lgF7aNsUckxNcWMfxX7YHUbmn7eScKzj7Wm7fBCjJbfaItFRmka8Nm6Qzdi0qUytBwWYttNy+8i895/8cnVdb2AM89e1OmnFvNrpHALaWk00OqPia2G1ESrS2hp4DA2g0fZd8fo7RhPhJqJbOkxcqVpF09xdbA=="
37
+ let decrypted;
38
+ try {
39
+ decrypted = decipher.update(encrypted, 'base64', 'utf8') + decipher.final('utf8');
40
+ } catch (e) {
41
+ console.error(
42
+ `${errorPrefix}The value for the ${iSponsorGraphile} environmental variable (value: '${password.slice(
43
+ 0,
44
+ 2,
45
+ )}...${password.slice(-2)}') is incorrect.${errorSuffix}`,
46
+ );
47
+ process.exit(42);
48
+ }
49
+
50
+ // Convince Node to allow ESM named imports
51
+
52
+
53
+ // Load our decrypted module
54
+ eval(decrypted);
package/dist/error.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import type { $$extensions } from "./interfaces.js";
2
+ import { $$safeError } from "./interfaces.js";
1
3
  export interface GrafastError extends Error {
2
4
  originalError: Error;
5
+ [$$extensions]?: Record<string, any>;
3
6
  }
4
7
  export declare const $$error: unique symbol;
5
8
  export declare class _GrafastError extends Error implements GrafastError {
@@ -10,4 +13,10 @@ export declare class _GrafastError extends Error implements GrafastError {
10
13
  }
11
14
  export declare function newGrafastError(error: Error, planId: number | null): _GrafastError;
12
15
  export declare function isGrafastError(value: any): value is GrafastError;
16
+ export declare class SafeError extends Error {
17
+ extensions?: Record<string, any> | undefined;
18
+ [$$safeError]: boolean;
19
+ constructor(message: string, extensions?: Record<string, any> | undefined);
20
+ }
21
+ export declare function isSafeError(error: Error): error is SafeError;
13
22
  //# sourceMappingURL=error.d.ts.map
@@ -1,9 +1,25 @@
1
+ import LRU from "@graphile/lru";
1
2
  import type { FragmentDefinitionNode, GraphQLSchema, OperationDefinitionNode } from "graphql";
2
3
  import { OperationPlan } from "./index.js";
3
- import type { BaseGraphQLContext, BaseGraphQLRootValue, BaseGraphQLVariables } from "./interfaces.js";
4
- declare type Fragments = {
4
+ import type { BaseGraphQLRootValue, BaseGraphQLVariables } from "./interfaces.js";
5
+ type Fragments = {
5
6
  [key: string]: FragmentDefinitionNode;
6
7
  };
7
- export declare function establishOperationPlan<TVariables extends BaseGraphQLVariables = BaseGraphQLVariables, TContext extends BaseGraphQLContext = BaseGraphQLContext, TRootValue extends BaseGraphQLRootValue = BaseGraphQLRootValue>(schema: GraphQLSchema, operation: OperationDefinitionNode, fragments: Fragments, variableValues: TVariables, context: TContext, rootValue: TRootValue): OperationPlan;
8
+ interface LinkedList<T> {
9
+ value: T;
10
+ next: LinkedList<T> | null;
11
+ }
12
+ interface Cache {
13
+ possibleOpPlans: LinkedList<OperationPlan>;
14
+ fragments: Fragments;
15
+ }
16
+ type CacheByOperation = LRU<OperationDefinitionNode, Cache>;
17
+ declare const $$cacheByOperation: unique symbol;
18
+ declare module "graphql" {
19
+ interface GraphQLSchema {
20
+ [$$cacheByOperation]?: CacheByOperation;
21
+ }
22
+ }
23
+ export declare function establishOperationPlan<TVariables extends BaseGraphQLVariables = BaseGraphQLVariables, TContext extends Grafast.Context = Grafast.Context, TRootValue extends BaseGraphQLRootValue = BaseGraphQLRootValue>(schema: GraphQLSchema, operation: OperationDefinitionNode, fragments: Fragments, variableValues: TVariables, context: TContext, rootValue: TRootValue): OperationPlan;
8
24
  export {};
9
25
  //# sourceMappingURL=establishOperationPlan.d.ts.map
package/dist/execute.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AsyncExecutionResult, ExecutionArgs, ExecutionResult } from "graphql";
2
2
  import type { PromiseOrValue } from "graphql/jsutils/PromiseOrValue";
3
- export declare function withGrafastArgs(args: ExecutionArgs, resolvedPreset: GraphileConfig.ResolvedPreset, asString: boolean): PromiseOrValue<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, void>>;
4
- export declare function execute(args: ExecutionArgs, resolvedPreset?: GraphileConfig.ResolvedPreset, asString?: boolean): PromiseOrValue<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, undefined>>;
3
+ export declare function withGrafastArgs(args: ExecutionArgs, resolvedPreset: GraphileConfig.ResolvedPreset, outputDataAsString: boolean): PromiseOrValue<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, void>>;
4
+ export declare function execute(args: ExecutionArgs, resolvedPreset?: GraphileConfig.ResolvedPreset, outputDataAsString?: boolean): PromiseOrValue<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, undefined>>;
5
5
  //# sourceMappingURL=execute.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { AsyncExecutionResult, ExecutionResult, GraphQLArgs } from "graphql";
2
2
  import type { PromiseOrValue } from "graphql/jsutils/PromiseOrValue";
3
- export declare function grafastGraphql(args: GraphQLArgs, resolvedPreset?: GraphileConfig.ResolvedPreset): PromiseOrValue<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, undefined>>;
3
+ export declare function grafastGraphql(args: GraphQLArgs, resolvedPreset?: GraphileConfig.ResolvedPreset, ctx?: Partial<Grafast.RequestContext>): PromiseOrValue<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, undefined>>;
4
4
  export declare function grafastGraphqlSync(args: GraphQLArgs, resolvedPreset?: GraphileConfig.ResolvedPreset): ExecutionResult;
5
5
  //# sourceMappingURL=grafastGraphql.d.ts.map
package/dist/index.d.ts CHANGED
@@ -5,19 +5,19 @@ import { PrintPlanGraphOptions } from "./mermaid.js";
5
5
  import { defer, Deferred } from "./deferred.js";
6
6
  import { isDev, noop } from "./dev.js";
7
7
  import { OperationPlan } from "./engine/OperationPlan.js";
8
- import { GrafastError, isGrafastError } from "./error.js";
8
+ import { GrafastError, isGrafastError, isSafeError, SafeError } from "./error.js";
9
9
  import { execute } from "./execute.js";
10
10
  import { grafastGraphql, grafastGraphqlSync } from "./grafastGraphql.js";
11
11
  import { InputStep } from "./input.js";
12
- import { $$bypassGraphQL, $$concreteType, $$data, $$eventEmitter, $$extensions, $$idempotent, $$verbatim, ArgumentApplyPlanResolver, ArgumentInputPlanResolver, BaseEventMap, BaseGraphQLArguments, BaseGraphQLContext, BaseGraphQLRootValue, BaseGraphQLVariables, EnumValueApplyPlanResolver, EventCallback, EventMapKey, ExecutionEventEmitter, ExecutionEventMap, ExecutionExtra, FieldArgs, FieldInfo, FieldPlanResolver, GrafastArgumentExtensions, GrafastEnumValueExtensions, GrafastFieldExtensions, GrafastInputFieldExtensions, GrafastObjectTypeExtensions, GrafastResultsList, GrafastResultStreamList, GrafastSubscriber, GrafastValuesList, GraphileArgumentConfig, GraphileFieldConfig, GraphileFieldConfigArgumentMap, GraphileInputFieldConfig, InputObjectFieldApplyPlanResolver, InputObjectFieldInputPlanResolver, InputObjectTypeInputPlanResolver, NodeIdCodec, NodeIdHandler, OutputPlanForType, PolymorphicData, PromiseOrDirect, ScalarPlanResolver, StepOptimizeOptions, StepStreamOptions, TypedEventEmitter } from "./interfaces.js";
13
- import { polymorphicWrap, resolveType } from "./polymorphic.js";
12
+ import { $$bypassGraphQL, $$eventEmitter, $$extensions, $$idempotent, $$verbatim, ArgumentApplyPlanResolver, ArgumentInputPlanResolver, BaseEventMap, BaseGraphQLArguments, BaseGraphQLRootValue, BaseGraphQLVariables, EnumValueApplyPlanResolver, EventCallback, EventMapKey, ExecutionEventEmitter, ExecutionEventMap, ExecutionExtra, FieldArgs, FieldInfo, FieldPlanResolver, GrafastArgumentExtensions, GrafastEnumValueExtensions, GrafastFieldExtensions, GrafastInputFieldExtensions, GrafastObjectTypeExtensions, GrafastResultsList, GrafastResultStreamList, GrafastSubscriber, GrafastValuesList, GraphileArgumentConfig, GraphileFieldConfig, GraphileFieldConfigArgumentMap, GraphileInputFieldConfig, InputObjectFieldApplyPlanResolver, InputObjectFieldInputPlanResolver, InputObjectTypeInputPlanResolver, JSONArray, JSONObject, JSONValue, NodeIdCodec, NodeIdHandler, OutputPlanForType, PolymorphicData, PromiseOrDirect, ScalarPlanResolver, StepOptimizeOptions, StepStreamOptions, TypedEventEmitter } from "./interfaces.js";
13
+ import { polymorphicWrap } from "./polymorphic.js";
14
14
  import { assertListCapableStep, BaseStep, ExecutableStep, isExecutableStep, isListCapableStep, isModifierStep, isObjectLikeStep, isStreamableStep, ListCapableStep, ModifierStep, ObjectLikeStep, PolymorphicStep, StreamableStep, UnbatchedExecutableStep } from "./step.js";
15
- import { __InputListStep, __InputObjectStep, __InputStaticLeafStep, __ItemStep, __ListTransformStep, __TrackedObjectStep, __ValueStep, access, AccessStep, ActualKeyByDesiredKey, connection, ConnectionCapableStep, ConnectionStep, constant, ConstantStep, context, debugPlans, deepEval, DeepEvalStep, each, EdgeCapableStep, EdgeStep, error, ErrorStep, filter, FilterPlanMemo, first, FirstStep, GraphQLItemHandler, graphqlItemHandler, GraphQLPolymorphicUnwrap, graphqlPolymorphicUnwrap, graphqlResolver, GraphQLResolverStep, groupBy, GroupByPlanMemo, lambda, LambdaStep, last, LastStep, list, listen, ListenStep, ListStep, listTransform, ListTransformItemPlanCallback, ListTransformOptions, ListTransformReduce, loadMany, LoadManyCallback, loadManyCallback, LoadManyOptions, LoadManySingleRecordStep, LoadManyStep, loadOne, LoadOneCallback, loadOneCallback, LoadOneOptions, LoadOneStep, makeMapper, map, MapStep, node, NodeStep, object, ObjectPlanMeta, ObjectStep, operationPlan, PageInfoCapableStep, partitionByIndex, proxy, ProxyStep, reverse, reverseArray, ReverseStep, setter, SetterCapableStep, SetterStep, specFromNodeId } from "./steps/index.js";
15
+ import { __InputListStep, __InputObjectStep, __InputStaticLeafStep, __ItemStep, __ListTransformStep, __TrackedObjectStep, __ValueStep, access, AccessStep, ActualKeyByDesiredKey, connection, ConnectionCapableStep, ConnectionStep, constant, ConstantStep, context, debugPlans, deepEval, DeepEvalStep, each, EdgeCapableStep, EdgeStep, error, ErrorStep, filter, FilterPlanMemo, first, FirstStep, GraphQLItemHandler, graphqlItemHandler, graphqlResolver, GraphQLResolverStep, groupBy, GroupByPlanMemo, lambda, LambdaStep, last, LastStep, list, listen, ListenStep, ListStep, listTransform, ListTransformItemPlanCallback, ListTransformOptions, ListTransformReduce, loadMany, LoadManyCallback, loadManyCallback, LoadManyOptions, LoadManySingleRecordStep, LoadManyStep, loadOne, LoadOneCallback, loadOneCallback, LoadOneOptions, LoadOneStep, makeMapper, map, MapStep, node, NodeStep, object, ObjectPlanMeta, ObjectStep, operationPlan, PageInfoCapableStep, partitionByIndex, proxy, ProxyStep, reverse, reverseArray, ReverseStep, setter, SetterCapableStep, SetterStep, specFromNodeId } from "./steps/index.js";
16
16
  import { stringifyPayload } from "./stringifyPayload.js";
17
17
  import { stripAnsi } from "./stripAnsi.js";
18
18
  import { subscribe } from "./subscribe.js";
19
- import { arrayOfLength, arraysMatch, canRepresentAsIdentifier, evalSafeProperty, getEnumValueConfig, GraphileInputFieldConfigMap, GraphileInputObjectType, GraphileObjectType, inputObjectFieldSpec, InputObjectTypeSpec, isPromiseLike, isSafeObjectPropertyName, newGraphileFieldConfigBuilder, newInputObjectTypeBuilder, newObjectTypeBuilder, objectFieldSpec, objectSpec, ObjectTypeFields, ObjectTypeSpec, stepADependsOnStepB, stepAMayDependOnStepB, stepsAreInSamePhase } from "./utils.js";
19
+ import { arrayOfLength, arraysMatch, getEnumValueConfig, GraphileInputFieldConfigMap, GraphileInputObjectType, GraphileObjectType, inputObjectFieldSpec, InputObjectTypeSpec, isPromiseLike, newGraphileFieldConfigBuilder, newInputObjectTypeBuilder, newObjectTypeBuilder, objectFieldSpec, objectSpec, ObjectTypeFields, ObjectTypeSpec, stepADependsOnStepB, stepAMayDependOnStepB, stepsAreInSamePhase } from "./utils.js";
20
20
  export { isAsyncIterable } from "iterall";
21
- export { __InputListStep, __InputObjectStep, __InputStaticLeafStep, __ItemStep, __ListTransformStep, __TrackedObjectStep, __ValueStep, $$bypassGraphQL, $$concreteType, $$data, $$eventEmitter, $$extensions, $$idempotent, $$verbatim, access, AccessStep, ActualKeyByDesiredKey, ArgumentApplyPlanResolver, ArgumentInputPlanResolver, arrayOfLength, arraysMatch, assertListCapableStep, BaseEventMap, BaseGraphQLArguments, BaseGraphQLContext, BaseGraphQLRootValue, BaseGraphQLVariables, BaseStep, canRepresentAsIdentifier, connection, ConnectionCapableStep, ConnectionStep, constant, ConstantStep, context, debugPlans, deepEval, DeepEvalStep, defer, Deferred, each, EdgeCapableStep, EdgeStep, EnumPlans, EnumValueApplyPlanResolver, error, ErrorStep, evalSafeProperty, EventCallback, EventMapKey, ExecutableStep, execute, ExecutionEventEmitter, ExecutionEventMap, ExecutionExtra, exportAsMany, FieldArgs, FieldInfo, FieldPlanResolver, FieldPlans, filter, FilterPlanMemo, first, FirstStep, getEnumValueConfig, grafastGraphql as grafast, GrafastArgumentExtensions, GrafastEnumValueExtensions, GrafastError, GrafastFieldExtensions, grafastGraphql, grafastGraphqlSync, GrafastInputFieldExtensions, GrafastObjectTypeExtensions, GrafastPlans, grafastPrint, GrafastResultsList, GrafastResultStreamList, GrafastSubscriber, grafastGraphqlSync as grafastSync, GrafastValuesList, GraphileArgumentConfig, GraphileFieldConfig, GraphileFieldConfigArgumentMap, GraphileInputFieldConfig, GraphileInputFieldConfigMap, GraphileInputObjectType, GraphileObjectType, GraphQLItemHandler, graphqlItemHandler, GraphQLPolymorphicUnwrap, graphqlPolymorphicUnwrap, graphqlResolver, GraphQLResolverStep, groupBy, GroupByPlanMemo, InputObjectFieldApplyPlanResolver, InputObjectFieldInputPlanResolver, inputObjectFieldSpec, InputObjectPlans, InputObjectTypeInputPlanResolver, InputObjectTypeSpec, InputStep, InterfaceOrUnionPlans, isDev, isExecutableStep, isGrafastError, isListCapableStep, isModifierStep, isObjectLikeStep, isPromiseLike, isSafeObjectPropertyName, isStreamableStep, lambda, LambdaStep, last, LastStep, list, ListCapableStep, listen, ListenStep, ListStep, listTransform, ListTransformItemPlanCallback, ListTransformOptions, ListTransformReduce, loadMany, LoadManyCallback, loadManyCallback, LoadManyOptions, LoadManySingleRecordStep, LoadManyStep, loadOne, LoadOneCallback, loadOneCallback, LoadOneOptions, LoadOneStep, makeGrafastSchema, makeMapper, map, MapStep, ModifierStep, newGraphileFieldConfigBuilder, newInputObjectTypeBuilder, newObjectTypeBuilder, node, NodeIdCodec, NodeIdHandler, NodeStep, noop, object, objectFieldSpec, ObjectLikeStep, ObjectPlanMeta, ObjectPlans, objectSpec, ObjectStep, ObjectTypeFields, ObjectTypeSpec, OperationPlan, operationPlan, OutputPlanForType, PageInfoCapableStep, partitionByIndex, PolymorphicData, PolymorphicStep, polymorphicWrap, PrintPlanGraphOptions, PromiseOrDirect, proxy, ProxyStep, resolveType, reverse, reverseArray, ReverseStep, ScalarPlanResolver, ScalarPlans, setter, SetterCapableStep, SetterStep, specFromNodeId, stepADependsOnStepB, stepAMayDependOnStepB, StepOptimizeOptions, stepsAreInSamePhase, StepStreamOptions, StreamableStep, stringifyPayload, stripAnsi, subscribe, TypedEventEmitter, UnbatchedExecutableStep, };
21
+ export { __InputListStep, __InputObjectStep, __InputStaticLeafStep, __ItemStep, __ListTransformStep, __TrackedObjectStep, __ValueStep, $$bypassGraphQL, $$eventEmitter, $$extensions, $$idempotent, $$verbatim, access, AccessStep, ActualKeyByDesiredKey, ArgumentApplyPlanResolver, ArgumentInputPlanResolver, arrayOfLength, arraysMatch, assertListCapableStep, BaseEventMap, BaseGraphQLArguments, BaseGraphQLRootValue, BaseGraphQLVariables, BaseStep, connection, ConnectionCapableStep, ConnectionStep, constant, ConstantStep, context, debugPlans, deepEval, DeepEvalStep, defer, Deferred, each, EdgeCapableStep, EdgeStep, EnumPlans, EnumValueApplyPlanResolver, error, ErrorStep, EventCallback, EventMapKey, ExecutableStep, execute, ExecutionEventEmitter, ExecutionEventMap, ExecutionExtra, exportAsMany, FieldArgs, FieldInfo, FieldPlanResolver, FieldPlans, filter, FilterPlanMemo, first, FirstStep, getEnumValueConfig, grafastGraphql as grafast, GrafastArgumentExtensions, GrafastEnumValueExtensions, GrafastError, GrafastFieldExtensions, grafastGraphql, grafastGraphqlSync, GrafastInputFieldExtensions, GrafastObjectTypeExtensions, GrafastPlans, grafastPrint, GrafastResultsList, GrafastResultStreamList, GrafastSubscriber, grafastGraphqlSync as grafastSync, GrafastValuesList, GraphileArgumentConfig, GraphileFieldConfig, GraphileFieldConfigArgumentMap, GraphileInputFieldConfig, GraphileInputFieldConfigMap, GraphileInputObjectType, GraphileObjectType, GraphQLItemHandler, graphqlItemHandler, graphqlResolver, GraphQLResolverStep, groupBy, GroupByPlanMemo, InputObjectFieldApplyPlanResolver, InputObjectFieldInputPlanResolver, inputObjectFieldSpec, InputObjectPlans, InputObjectTypeInputPlanResolver, InputObjectTypeSpec, InputStep, InterfaceOrUnionPlans, isDev, isExecutableStep, isGrafastError, isListCapableStep, isModifierStep, isObjectLikeStep, isPromiseLike, isSafeError, isStreamableStep, JSONArray, JSONObject, JSONValue, lambda, LambdaStep, last, LastStep, list, ListCapableStep, listen, ListenStep, ListStep, listTransform, ListTransformItemPlanCallback, ListTransformOptions, ListTransformReduce, loadMany, LoadManyCallback, loadManyCallback, LoadManyOptions, LoadManySingleRecordStep, LoadManyStep, loadOne, LoadOneCallback, loadOneCallback, LoadOneOptions, LoadOneStep, makeGrafastSchema, makeMapper, map, MapStep, ModifierStep, newGraphileFieldConfigBuilder, newInputObjectTypeBuilder, newObjectTypeBuilder, node, NodeIdCodec, NodeIdHandler, NodeStep, noop, object, objectFieldSpec, ObjectLikeStep, ObjectPlanMeta, ObjectPlans, objectSpec, ObjectStep, ObjectTypeFields, ObjectTypeSpec, OperationPlan, operationPlan, OutputPlanForType, PageInfoCapableStep, partitionByIndex, PolymorphicData, PolymorphicStep, polymorphicWrap, PrintPlanGraphOptions, PromiseOrDirect, proxy, ProxyStep, reverse, reverseArray, ReverseStep, SafeError, ScalarPlanResolver, ScalarPlans, setter, SetterCapableStep, SetterStep, specFromNodeId, stepADependsOnStepB, stepAMayDependOnStepB, StepOptimizeOptions, stepsAreInSamePhase, StepStreamOptions, StreamableStep, stringifyPayload, stripAnsi, subscribe, TypedEventEmitter, UnbatchedExecutableStep, };
22
22
  export { hookArgs } from "./args.js";
23
23
  //# sourceMappingURL=index.d.ts.map