grafast 0.0.1-alpha.2 → 0.0.1-alpha.3
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 +1 -1
- package/dist/bucket.d.ts +3 -1
- package/dist/engine/LayerPlan.d.ts +10 -8
- package/dist/engine/OperationPlan.d.ts +21 -4
- package/dist/engine/OutputPlan.d.ts +5 -6
- package/dist/engine/StepTracker.d.ts +6 -1
- package/dist/engine/lib/withGlobalLayerPlan.d.ts +2 -2
- package/dist/envelop.js +4 -4
- package/dist/error.d.ts +24 -7
- package/dist/establishOperationPlan.d.ts +11 -3
- package/dist/graphqlCollectFields.d.ts +8 -5
- package/dist/index.js +4 -4
- package/dist/input.d.ts +2 -2
- package/dist/interfaces.d.ts +13 -2
- package/dist/prepare.d.ts +3 -2
- package/dist/step.d.ts +9 -6
- package/dist/steps/__inputDynamicScalar.d.ts +1 -1
- package/dist/steps/__inputList.d.ts +5 -4
- package/dist/steps/__inputObject.d.ts +4 -4
- package/dist/steps/__inputStaticLeaf.d.ts +3 -2
- package/dist/steps/__trackedValue.d.ts +1 -1
- package/dist/steps/access.d.ts +0 -1
- package/dist/steps/connection.d.ts +2 -2
- package/dist/steps/constant.d.ts +3 -1
- package/dist/steps/first.d.ts +1 -1
- package/dist/steps/graphqlResolver.d.ts +2 -2
- package/dist/steps/last.d.ts +1 -1
- package/dist/steps/list.d.ts +5 -2
- package/dist/steps/node.d.ts +1 -1
- package/dist/steps/object.d.ts +5 -2
- package/dist/steps/proxy.d.ts +1 -1
- package/dist/steps/remapKeys.d.ts +3 -1
- package/dist/steps/reverse.d.ts +1 -1
- package/dist/timeSource.d.ts +3 -0
- package/dist/utils.d.ts +6 -6
- package/package.json +4 -4
package/dist/LICENSES.txt
CHANGED
|
@@ -254,7 +254,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
254
254
|
|
|
255
255
|
|
|
256
256
|
--------------------------------------------------------------------------------
|
|
257
|
-
tamedevil v0.0.0-alpha.
|
|
257
|
+
tamedevil v0.0.0-alpha.2 - Benjie Gillam <benjie@jemjie.com>
|
|
258
258
|
git+https://github.com/graphile/heart.git
|
|
259
259
|
--------------------------------------------------------------------------------
|
|
260
260
|
|
package/dist/bucket.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { LayerPlan } from "./engine/LayerPlan";
|
|
|
2
2
|
import type { MetaByMetaKey } from "./engine/OperationPlan";
|
|
3
3
|
import type { ExecutionEventEmitter } from "./interfaces.js";
|
|
4
4
|
export interface RequestTools {
|
|
5
|
+
startTime: number;
|
|
6
|
+
stopTime: number | null;
|
|
5
7
|
readonly eventEmitter: ExecutionEventEmitter | undefined;
|
|
6
8
|
metaByMetaKey: MetaByMetaKey;
|
|
7
9
|
insideGraphQL: false;
|
|
@@ -9,7 +11,7 @@ export interface RequestTools {
|
|
|
9
11
|
export interface Bucket {
|
|
10
12
|
layerPlan: LayerPlan;
|
|
11
13
|
size: number;
|
|
12
|
-
polymorphicPathList: readonly string[];
|
|
14
|
+
polymorphicPathList: readonly (string | null)[];
|
|
13
15
|
store: Map<number, any[]>;
|
|
14
16
|
isComplete: boolean;
|
|
15
17
|
hasErrors: boolean;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { TE } from "tamedevil";
|
|
2
1
|
import type { Bucket } from "../bucket.js";
|
|
3
2
|
import type { ExecutableStep, ModifierStep, UnbatchedExecutableStep } from "../step";
|
|
4
3
|
import type { OperationPlan } from "./OperationPlan";
|
|
@@ -32,6 +31,7 @@ export interface LayerPlanReasonPolymorphic {
|
|
|
32
31
|
type: "polymorphic";
|
|
33
32
|
typeNames: string[];
|
|
34
33
|
parentStep: ExecutableStep;
|
|
34
|
+
polymorphicPaths: Set<string>;
|
|
35
35
|
}
|
|
36
36
|
export interface LayerPlanReasonSubroutine {
|
|
37
37
|
type: "subroutine";
|
|
@@ -46,20 +46,20 @@ export type HasParent<A extends LayerPlanReason> = A extends any ? A extends {
|
|
|
46
46
|
} ? A : never : never;
|
|
47
47
|
export type LayerPlanReasonsWithParentStep = HasParent<LayerPlanReason>;
|
|
48
48
|
export interface LayerPlanPhase {
|
|
49
|
-
|
|
49
|
+
checkTimeout: boolean;
|
|
50
|
+
normalSteps: Array<{
|
|
50
51
|
step: ExecutableStep;
|
|
51
|
-
}
|
|
52
|
-
unbatchedSyncAndSafeSteps
|
|
52
|
+
}> | undefined;
|
|
53
|
+
unbatchedSyncAndSafeSteps: Array<{
|
|
53
54
|
step: UnbatchedExecutableStep;
|
|
54
55
|
scratchpad: any;
|
|
55
|
-
}
|
|
56
|
+
}> | undefined;
|
|
56
57
|
_allSteps: ExecutableStep[];
|
|
57
58
|
}
|
|
58
59
|
export declare class LayerPlan<TReason extends LayerPlanReason = LayerPlanReason> {
|
|
59
60
|
readonly operationPlan: OperationPlan;
|
|
60
61
|
parentLayerPlan: LayerPlan | null;
|
|
61
62
|
readonly reason: TReason;
|
|
62
|
-
polymorphicPaths: ReadonlySet<string>;
|
|
63
63
|
id: number;
|
|
64
64
|
readonly rootStep: ExecutableStep | null;
|
|
65
65
|
copyStepIds: number[];
|
|
@@ -68,14 +68,16 @@ export declare class LayerPlan<TReason extends LayerPlanReason = LayerPlanReason
|
|
|
68
68
|
pendingSteps: ExecutableStep[];
|
|
69
69
|
phases: Array<LayerPlanPhase>;
|
|
70
70
|
ancestry: LayerPlan[];
|
|
71
|
-
|
|
71
|
+
depth: number;
|
|
72
|
+
deferBoundaryDepth: number;
|
|
73
|
+
stepsByConstructor: Map<Function, Set<ExecutableStep>>;
|
|
74
|
+
constructor(operationPlan: OperationPlan, parentLayerPlan: LayerPlan | null, reason: TReason);
|
|
72
75
|
toString(): string;
|
|
73
76
|
print(depth?: number): string;
|
|
74
77
|
setRootStep($root: ExecutableStep): void;
|
|
75
78
|
getStep(id: number, requestingStep: ExecutableStep): ExecutableStep;
|
|
76
79
|
_addStep(step: ExecutableStep): number;
|
|
77
80
|
_addModifierStep(step: ModifierStep<any>): string;
|
|
78
|
-
makeNewBucketCallback(this: LayerPlan<TReason>, inner: TE): typeof this.newBucket;
|
|
79
81
|
finalize(): void;
|
|
80
82
|
newBucket(parentBucket: Bucket): Bucket | null;
|
|
81
83
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import type { FragmentDefinitionNode, GraphQLObjectType, GraphQLSchema, GraphQLUnionType, OperationDefinitionNode } from "graphql";
|
|
1
|
+
import type { FragmentDefinitionNode, GraphQLFieldMap, GraphQLObjectType, GraphQLSchema, GraphQLUnionType, OperationDefinitionNode } from "graphql";
|
|
2
2
|
import type { Constraint } from "../constraints.js";
|
|
3
|
+
import type { SelectionSetDigest } from "../graphqlCollectFields.js";
|
|
3
4
|
import type { ModifierStep } from "../index.js";
|
|
4
5
|
import { __TrackedValueStep, __ValueStep, ExecutableStep } from "../index.js";
|
|
6
|
+
import { $$timeout, $$ts } from "../interfaces.js";
|
|
5
7
|
import type { PrintPlanGraphOptions } from "../mermaid.js";
|
|
6
8
|
import type { LayerPlanReasonSubroutine } from "./LayerPlan.js";
|
|
7
9
|
import { LayerPlan } from "./LayerPlan.js";
|
|
8
10
|
import { OutputPlan } from "./OutputPlan.js";
|
|
9
11
|
import { StepTracker } from "./StepTracker.js";
|
|
10
|
-
export declare const POLYMORPHIC_ROOT_PATH
|
|
12
|
+
export declare const POLYMORPHIC_ROOT_PATH: null;
|
|
13
|
+
export declare const POLYMORPHIC_ROOT_PATHS: ReadonlySet<string> | null;
|
|
11
14
|
export type OperationPlanPhase = "init" | "plan" | "validate" | "optimize" | "finalize" | "ready";
|
|
12
15
|
export interface MetaByMetaKey {
|
|
13
16
|
[metaKey: string | number | symbol]: Record<string, any>;
|
|
@@ -25,6 +28,9 @@ export declare class OperationPlan {
|
|
|
25
28
|
[key: string]: any;
|
|
26
29
|
};
|
|
27
30
|
readonly rootValue: any;
|
|
31
|
+
private readonly planningTimeout;
|
|
32
|
+
readonly [$$timeout]: undefined;
|
|
33
|
+
readonly [$$ts]: undefined;
|
|
28
34
|
readonly queryType: GraphQLObjectType;
|
|
29
35
|
readonly mutationType: GraphQLObjectType | null;
|
|
30
36
|
readonly subscriptionType: GraphQLObjectType | null;
|
|
@@ -62,13 +68,20 @@ export declare class OperationPlan {
|
|
|
62
68
|
[listStepId: number]: number | undefined;
|
|
63
69
|
};
|
|
64
70
|
pure: boolean;
|
|
71
|
+
private startTime;
|
|
72
|
+
private previousLap;
|
|
73
|
+
private laps;
|
|
74
|
+
private optimizeMeta;
|
|
75
|
+
private scalarPlanInfo;
|
|
65
76
|
constructor(schema: GraphQLSchema, operation: OperationDefinitionNode, fragments: {
|
|
66
77
|
[fragmentName: string]: FragmentDefinitionNode;
|
|
67
78
|
}, variableValues: {
|
|
68
79
|
[key: string]: any;
|
|
69
80
|
}, context: {
|
|
70
81
|
[key: string]: any;
|
|
71
|
-
}, rootValue: any);
|
|
82
|
+
}, rootValue: any, planningTimeout: number | null);
|
|
83
|
+
private lap;
|
|
84
|
+
private checkTimeout;
|
|
72
85
|
addLayerPlan(layerPlan: LayerPlan): number;
|
|
73
86
|
_addStep(plan: ExecutableStep): number;
|
|
74
87
|
_addModifierStep(step: ModifierStep<any>): string;
|
|
@@ -79,6 +92,7 @@ export declare class OperationPlan {
|
|
|
79
92
|
private planMutation;
|
|
80
93
|
private planSubscription;
|
|
81
94
|
private itemStepForListStep;
|
|
95
|
+
processGroupedFieldSet(outputPlan: OutputPlan, path: readonly string[], polymorphicPath: string | null, polymorphicPaths: ReadonlySet<string> | null, parentStep: ExecutableStep, objectType: GraphQLObjectType, objectTypeFields: GraphQLFieldMap<any, any>, isMutation: boolean, groupedFieldSet: SelectionSetDigest): void;
|
|
82
96
|
private planSelectionSet;
|
|
83
97
|
private planIntoOutputPlan;
|
|
84
98
|
private polymorphicLayerPlanByPathByLayerPlan;
|
|
@@ -89,14 +103,17 @@ export declare class OperationPlan {
|
|
|
89
103
|
private track;
|
|
90
104
|
private validateSteps;
|
|
91
105
|
private replaceStep;
|
|
92
|
-
|
|
106
|
+
private processStep;
|
|
107
|
+
processSteps(actionDescription: string, order: "dependents-first" | "dependencies-first", callback: (plan: ExecutableStep) => ExecutableStep): void;
|
|
93
108
|
private getPeers;
|
|
94
109
|
private isImmoveable;
|
|
95
110
|
private hoistStep;
|
|
96
111
|
private pushDown;
|
|
97
112
|
private _deduplicateInnerLogic;
|
|
98
113
|
private deduplicateStep;
|
|
114
|
+
private deduplicateStepsProcess;
|
|
99
115
|
private deduplicateSteps;
|
|
116
|
+
private hoistAndDeduplicate;
|
|
100
117
|
private hoistSteps;
|
|
101
118
|
private pushDownSteps;
|
|
102
119
|
private getStepOptionsForStep;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import LRU from "@graphile/lru";
|
|
2
2
|
import type { FieldNode, GraphQLEnumType, GraphQLObjectType, GraphQLScalarType } from "graphql";
|
|
3
|
-
import
|
|
3
|
+
import * as graphql from "graphql";
|
|
4
4
|
import type { Bucket } from "../bucket.js";
|
|
5
5
|
import type { JSONValue, LocationDetails } from "../interfaces.js";
|
|
6
6
|
import type { ExecutableStep } from "../step.js";
|
|
@@ -31,7 +31,6 @@ export type OutputPlanTypeArray = {
|
|
|
31
31
|
};
|
|
32
32
|
export type OutputPlanTypeLeaf = {
|
|
33
33
|
mode: "leaf";
|
|
34
|
-
serialize: GraphQLScalarType["serialize"];
|
|
35
34
|
graphqlType: GraphQLScalarType | GraphQLEnumType;
|
|
36
35
|
};
|
|
37
36
|
export type OutputPlanTypeNull = {
|
|
@@ -65,7 +64,7 @@ export declare class OutputPlan<TType extends OutputPlanType = OutputPlanType> {
|
|
|
65
64
|
childIsNonNull: boolean;
|
|
66
65
|
childByTypeName: {
|
|
67
66
|
[typeName: string]: OutputPlan<OutputPlanTypeObject>;
|
|
68
|
-
};
|
|
67
|
+
} | undefined;
|
|
69
68
|
deferredOutputPlans: OutputPlan<OutputPlanTypeObject | OutputPlanTypePolymorphicObject>[];
|
|
70
69
|
constructor(layerPlan: LayerPlan, rootStep: ExecutableStep, type: TType, locationDetails: LocationDetails);
|
|
71
70
|
print(): string;
|
|
@@ -78,7 +77,7 @@ export declare class OutputPlan<TType extends OutputPlanType = OutputPlanType> {
|
|
|
78
77
|
optimize(): void;
|
|
79
78
|
finalize(): void;
|
|
80
79
|
}
|
|
81
|
-
export declare function coerceError(error: Error, locationDetails: LocationDetails, path: ReadonlyArray<string | number>): GraphQLError;
|
|
82
|
-
export declare function nonNullError(locationDetails: LocationDetails, path: readonly (string | number)[]): GraphQLError;
|
|
80
|
+
export declare function coerceError(error: Error, locationDetails: LocationDetails, path: ReadonlyArray<string | number>): graphql.GraphQLError;
|
|
81
|
+
export declare function nonNullError(locationDetails: LocationDetails, path: readonly (string | number)[]): graphql.GraphQLError;
|
|
83
82
|
export declare function getChildBucketAndIndex(childOutputPlan: OutputPlan, outputPlan: OutputPlan | null, bucket: Bucket, bucketIndex: number, arrayIndex?: number | null): [Bucket, number] | null;
|
|
84
83
|
//# sourceMappingURL=OutputPlan.d.ts.map
|
|
@@ -16,8 +16,10 @@ export declare class StepTracker {
|
|
|
16
16
|
layerPlansByParentStep: Map<ExecutableStep<any>, Set<LayerPlan<LayerPlanReasonsWithParentStep>>>;
|
|
17
17
|
layerPlans: Array<LayerPlan | null>;
|
|
18
18
|
allOutputPlans: OutputPlan[];
|
|
19
|
+
nextStepIdToDeduplicate: number;
|
|
19
20
|
constructor(operationPlan: OperationPlan);
|
|
20
|
-
|
|
21
|
+
newStepsSince(oldStepCount: number): ExecutableStep<any>[];
|
|
22
|
+
finalize(): void;
|
|
21
23
|
addStep($step: ExecutableStep): number;
|
|
22
24
|
addLayerPlan(layerPlan: LayerPlan): number;
|
|
23
25
|
addOutputPlan(outputPlan: OutputPlan): void;
|
|
@@ -31,5 +33,8 @@ export declare class StepTracker {
|
|
|
31
33
|
treeShakeSteps(): void;
|
|
32
34
|
private isNotNeeded;
|
|
33
35
|
private eradicate;
|
|
36
|
+
moveStepToLayerPlan(step: ExecutableStep, targetLayerPlan: LayerPlan): void;
|
|
37
|
+
addStepToItsLayerPlan(step: ExecutableStep): void;
|
|
38
|
+
removeStepFromItsLayerPlan(step: ExecutableStep): void;
|
|
34
39
|
}
|
|
35
40
|
//# sourceMappingURL=StepTracker.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LayerPlan } from "../LayerPlan";
|
|
2
|
-
export declare function withGlobalLayerPlan<T>(layerPlan: LayerPlan, polymorphicPaths: ReadonlySet<string
|
|
2
|
+
export declare function withGlobalLayerPlan<T, TThis = any, TArgs extends [...args: any[]] = [...args: any[]]>(layerPlan: LayerPlan, polymorphicPaths: ReadonlySet<string> | null, callback: (this: TThis, ...args: TArgs) => T, callbackThis?: TThis, ...callbackArgs: TArgs): T;
|
|
3
3
|
export declare function currentLayerPlan(): LayerPlan;
|
|
4
|
-
export declare function currentPolymorphicPaths(): ReadonlySet<string
|
|
4
|
+
export declare function currentPolymorphicPaths(): ReadonlySet<string> | null;
|
|
5
5
|
//# sourceMappingURL=withGlobalLayerPlan.d.ts.map
|
package/dist/envelop.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { Buffer } = require('node:buffer');
|
|
2
2
|
const { scryptSync, createDecipheriv } = require('node:crypto');
|
|
3
3
|
const pkgName = "grafast";
|
|
4
|
-
const pkgVersion = "0.0.1-alpha.
|
|
4
|
+
const pkgVersion = "0.0.1-alpha.3";
|
|
5
5
|
|
|
6
6
|
const RESET = '\x1b[0m';
|
|
7
7
|
const BOLD_BLACK_ON_RED = '\x1b[40;31;1;7m';
|
|
@@ -28,12 +28,12 @@ if (typeof password !== 'string') {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const algorithm = "aes-192-cbc";
|
|
31
|
-
const salt = "We wouldn't be able to do so much OSS without sponsorship.
|
|
31
|
+
const salt = "We wouldn't be able to do so much OSS without sponsorship. 39495447036723696";
|
|
32
32
|
const key = scryptSync(password, salt, 24);
|
|
33
|
-
const ivBuffer = Buffer.from("
|
|
33
|
+
const ivBuffer = Buffer.from("jEXpl/Z7hTFmHWLUTZT5qA==", "base64");
|
|
34
34
|
const iv = new Uint8Array(ivBuffer.buffer, ivBuffer.byteOffset, ivBuffer.length);
|
|
35
35
|
const decipher = createDecipheriv(algorithm, key, iv);
|
|
36
|
-
const encrypted = "
|
|
36
|
+
const encrypted = "A2dJ4I5eERsJG4tyk9DuwRvtt6XW+Ue7h6i3klXdhCZunY4Wg+iFqAnZh/cSve7BKdBrNsZTnVR5ggmByVd6ZtksZvkqhNenju9Y/3zlTCDV0Pixf1Q0rgQdinJbxGVZD4fsKzZugrjW1X8zM51Q1fXhZHHZyLMub9npWZYwt7myTFENKht1SJgh/LZwfyyzEW2XEMw2Fy9mAxi7tTbLra4sTJcku78raMhRervlXMGlo5XpwBLqUypJ1t4r0acXdSEwRiEnvwc2q3S0hmydBHWK8JGfr7sgaW9XeEi+O8k+4o/pZdg1I/cG/4W1Mbj38GvV7lKTKeCyrpn8R3PeYqfx9p0Q8sAUD/6rLJzdQEgviL7nuf0fD8ZzRlJARMUhmHgzN4PPsxidueVTvvZCUmm3tM9RiyNXObSz/eS4hrFISiHwGz22owHxgZoNvQhpWcuexRQFf0WO09JjH3lqUxSKzTaDgZMkJY/X4qUF1KQlHYV1Bs7L/+eP8A3rxbmDX3iSYbMjV+3FODbKIwXmT91fDnV3q/GQ9StE2ZIsRqP9Dde23NSiG8n6QtbvNryjWkW4RRecs4qsqLopODoYObecfpwI+xmU0suAVKjlOMw6Uq0k62JgUS2PsExAlt75rpYGFRoSgen1pVsWfeo+N+0r+buuEEy0q934+M/ErXbXfvVboD6kKkeNzJ7iIi2RBnDOUxdV1WLGg3jxWjSMLsa1YQsT+lHeQIyPtF6/EfUSag9MI5HcRacH1+acjpz/16nAkLXVAsShQD1RwDM5NU7k12VyU3IzfoEQ2A+JuXVq8Sx0vsgrkf/+ADflKSIONRHjeWU51JTwb2lvU7BgoOxWbBfvZ1C0sbyAxJ1NXRUMOcYZMSejw4jCjucqC4B+6s5/6rutVkdYMpTL8p/Cvn75V/wmN/hnR7bJ9wrG8wOjBIUXB9T6aeYVR0hcrjkdRZi/mVyvs6a6S3sYETvl4OGk8YI4GPOFavW9kC8dBPO7+djJdBGqwrNpy3XgUwSvFdb3l23wfw6o7XQ7Cwuu/di/LPQ+JPOt03zmYxNy2J4z4gpCPwFXs04FySi607jKhTjhIe7QjSQzRzVqAa9QRo7IZB1WFKkrnF9ITm+XNr9oJYcW/GBg0V/tuA/l3yAUsnwSIVptpp80FmaeH7PvoW3GS1sGdZXna1hAgftYIADqsSdQBZS3dTPVu6s3h1VawaXQA69vURwh3I2EMP/wkfikaIHC/Cguy++f0IGO60nGFIWxqk8NWisHMFOLbZpfqib5WDFILEB7emswheL7sB3/j2j6v1cwmTSY+IQ/MM5ClDkYC0XbLbTp02oB+VnMexvGLnbabF0BkmIbxPIrkF/JoVQYqAyvEtfu56ZZFeb16x/g6jRgCveUsxR2WaV5hi2VC2uhDhW1fyfxKfr6Q98wuHA2jki4SsKd9TmCAHuE/Yj5VejK/eXq2XSbpRfjb1sXCwFR1geDxyx6CPgGRnH2Hh63g+X6z46fh1V2hm7Xz4fXnjD5sD6cxFc+SyTA+iG3BTKpdhv40Z8j8cl8bXo0Qfl0Ofhy8hiOyJqUXt+JQ8TkEOt7XFpO7TcWiDjn/nSvob/DLjpNXP4Mcvhm/CAkfdoYCEiVFNDYihzlCTg31gbnfXW35mogXoZpBExe+3u3q4POOl9SztUH/U/xSwcJF2HDW+GogTmUz1Br0tOtIKpHsVtwZ10B3Gycy+0elAilNVCndu0rvKOluSmd3+Q9TScEnUj5TAzRwZFdVV8ariVZapqIm0XXAn/vpJuFScy5/pqYf0GIbN4eAy5LISwVFntADswYbk+gIu31Fdw="
|
|
37
37
|
let decrypted;
|
|
38
38
|
try {
|
|
39
39
|
decrypted = decipher.update(encrypted, 'base64', 'utf8') + decipher.final('utf8');
|
package/dist/error.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { $$extensions } from "./interfaces.js";
|
|
2
3
|
import { $$safeError } from "./interfaces.js";
|
|
3
4
|
export interface GrafastError extends Error {
|
|
@@ -5,18 +6,34 @@ export interface GrafastError extends Error {
|
|
|
5
6
|
[$$extensions]?: Record<string, any>;
|
|
6
7
|
}
|
|
7
8
|
export declare const $$error: unique symbol;
|
|
8
|
-
export declare
|
|
9
|
+
export declare const _GrafastError: {
|
|
10
|
+
new (originalError: Error, planId: number | null): {
|
|
11
|
+
readonly originalError: Error;
|
|
12
|
+
extensions: Record<string, any>;
|
|
13
|
+
[$$error]: boolean;
|
|
14
|
+
name: string;
|
|
15
|
+
message: string;
|
|
16
|
+
stack?: string | undefined;
|
|
17
|
+
cause?: unknown;
|
|
18
|
+
};
|
|
19
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
20
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
21
|
+
stackTraceLimit: number;
|
|
22
|
+
};
|
|
23
|
+
export declare function newGrafastError(error: Error, planId: number | null): {
|
|
9
24
|
readonly originalError: Error;
|
|
10
25
|
extensions: Record<string, any>;
|
|
11
26
|
[$$error]: boolean;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
name: string;
|
|
28
|
+
message: string;
|
|
29
|
+
stack?: string | undefined;
|
|
30
|
+
cause?: unknown;
|
|
31
|
+
};
|
|
15
32
|
export declare function isGrafastError(value: any): value is GrafastError;
|
|
16
|
-
export declare class SafeError extends Error {
|
|
17
|
-
extensions
|
|
33
|
+
export declare class SafeError<TExtensions extends Record<string, any> | undefined = Record<string, any> | undefined> extends Error {
|
|
34
|
+
extensions: TExtensions;
|
|
18
35
|
[$$safeError]: boolean;
|
|
19
|
-
constructor(message: string, extensions?:
|
|
36
|
+
constructor(message: string, extensions?: TExtensions, errorOptions?: ErrorOptions);
|
|
20
37
|
}
|
|
21
38
|
export declare function isSafeError(error: Error): error is SafeError;
|
|
22
39
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import LRU from "@graphile/lru";
|
|
2
2
|
import type { FragmentDefinitionNode, GraphQLSchema, OperationDefinitionNode } from "graphql";
|
|
3
|
-
import { OperationPlan } from "./index.js";
|
|
3
|
+
import { OperationPlan, SafeError } from "./index.js";
|
|
4
4
|
import type { BaseGraphQLRootValue, BaseGraphQLVariables } from "./interfaces.js";
|
|
5
|
+
import { $$timeout, $$ts } from "./interfaces.js";
|
|
5
6
|
type Fragments = {
|
|
6
7
|
[key: string]: FragmentDefinitionNode;
|
|
7
8
|
};
|
|
9
|
+
type OperationPlanOrError = OperationPlan | Error | SafeError<{
|
|
10
|
+
[$$timeout]: number;
|
|
11
|
+
[$$ts]: number;
|
|
12
|
+
} | {
|
|
13
|
+
[$$timeout]?: undefined;
|
|
14
|
+
[$$ts]?: undefined;
|
|
15
|
+
} | undefined>;
|
|
8
16
|
interface LinkedList<T> {
|
|
9
17
|
value: T;
|
|
10
18
|
next: LinkedList<T> | null;
|
|
11
19
|
}
|
|
12
20
|
interface Cache {
|
|
13
|
-
possibleOperationPlans: LinkedList<
|
|
21
|
+
possibleOperationPlans: LinkedList<OperationPlanOrError> | null;
|
|
14
22
|
fragments: Fragments;
|
|
15
23
|
}
|
|
16
24
|
type CacheByOperation = LRU<OperationDefinitionNode, Cache>;
|
|
@@ -20,6 +28,6 @@ declare module "graphql" {
|
|
|
20
28
|
[$$cacheByOperation]?: CacheByOperation;
|
|
21
29
|
}
|
|
22
30
|
}
|
|
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;
|
|
31
|
+
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, planningTimeout?: number | null): OperationPlan;
|
|
24
32
|
export {};
|
|
25
33
|
//# sourceMappingURL=establishOperationPlan.d.ts.map
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import type { FieldNode, SelectionNode } from "graphql";
|
|
2
|
-
import
|
|
1
|
+
import type { DirectiveNode, FieldNode, SelectionNode } from "graphql";
|
|
2
|
+
import * as graphql from "graphql";
|
|
3
3
|
import type { OperationPlan } from "./engine/OperationPlan.js";
|
|
4
4
|
import type { __TrackedValueStep } from "./steps/index.js";
|
|
5
|
-
export declare function evalDirectiveArg<T = unknown>(selection: SelectionNode, directiveName: string, argumentName: string, variableValuesStep: __TrackedValueStep): T | undefined;
|
|
5
|
+
export declare function evalDirectiveArg<T = unknown>(selection: SelectionNode, directiveName: string, argumentName: string, variableValuesStep: __TrackedValueStep, defaultValue: T): T | undefined;
|
|
6
|
+
export declare function evalDirectiveArgDirect<T = unknown>(directive: DirectiveNode, argumentName: string, variableValuesStep: __TrackedValueStep, defaultValue: T): T | undefined;
|
|
6
7
|
export interface SelectionSetDigest {
|
|
7
8
|
label: string | undefined;
|
|
8
9
|
fields: Map<string, FieldNode[]>;
|
|
9
|
-
deferred: SelectionSetDigest[];
|
|
10
|
+
deferred: SelectionSetDigest[] | undefined;
|
|
10
11
|
}
|
|
11
|
-
export declare function graphqlCollectFields(operationPlan: OperationPlan, parentStepId: number, objectType: GraphQLObjectType, selections: readonly SelectionNode[], isMutation?: boolean, visitedFragments?:
|
|
12
|
+
export declare function graphqlCollectFields(operationPlan: OperationPlan, parentStepId: number, objectType: graphql.GraphQLObjectType, selections: readonly SelectionNode[], isMutation?: boolean, visitedFragments?: {
|
|
13
|
+
[fragmentName: string]: true;
|
|
14
|
+
}, selectionSetDigest?: SelectionSetDigest): SelectionSetDigest;
|
|
12
15
|
//# sourceMappingURL=graphqlCollectFields.d.ts.map
|