grafast 0.0.1-alpha.13 → 0.0.1-alpha.15
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/args.d.ts +7 -5
- package/dist/assert.d.ts +2 -0
- package/dist/bucket.d.ts +64 -0
- package/dist/constraints.d.ts +31 -0
- package/dist/deferred.d.ts +7 -0
- package/dist/dev.d.ts +3 -0
- package/dist/engine/LayerPlan.d.ts +131 -0
- package/dist/engine/OperationPlan.d.ts +151 -0
- package/dist/engine/OutputPlan.d.ts +105 -1
- package/dist/engine/StepTracker.d.ts +53 -0
- package/dist/engine/executeBucket.d.ts +2 -0
- package/dist/engine/executeOutputPlan.d.ts +41 -0
- package/dist/envelop.d.ts +12 -0
- package/dist/envelop.js +4 -4
- package/dist/error.d.ts +23 -0
- package/dist/establishOperationPlan.d.ts +7 -0
- package/dist/execute.d.ts +8 -0
- package/dist/exportAs.d.ts +14 -0
- package/dist/grafastGraphql.d.ts +8 -3
- package/dist/grafastPrint.d.ts +8 -0
- package/dist/graphqlCollectFields.d.ts +22 -0
- package/dist/graphqlMergeSelectionSets.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -4
- package/dist/input.d.ts +7 -0
- package/dist/interfaces.d.ts +267 -5
- package/dist/makeGrafastSchema.d.ts +27 -0
- package/dist/mermaid.d.ts +28 -0
- package/dist/polymorphic.d.ts +8 -0
- package/dist/prepare.d.ts +16 -0
- package/dist/step.d.ts +183 -0
- package/dist/steps/__inputDynamicScalar.d.ts +3 -0
- package/dist/steps/__inputList.d.ts +3 -0
- package/dist/steps/__inputObject.d.ts +3 -0
- package/dist/steps/__inputStaticLeaf.d.ts +5 -0
- package/dist/steps/__item.d.ts +8 -0
- package/dist/steps/__trackedValue.d.ts +74 -0
- package/dist/steps/__value.d.ts +5 -0
- package/dist/steps/access.d.ts +19 -0
- package/dist/steps/applyTransforms.d.ts +13 -0
- package/dist/steps/connection.d.ts +47 -0
- package/dist/steps/constant.d.ts +7 -0
- package/dist/steps/each.d.ts +3 -0
- package/dist/steps/filter.d.ts +4 -0
- package/dist/steps/first.d.ts +4 -0
- package/dist/steps/graphqlResolver.d.ts +18 -0
- package/dist/steps/groupBy.d.ts +6 -0
- package/dist/steps/index.d.ts +4 -0
- package/dist/steps/lambda.d.ts +8 -0
- package/dist/steps/last.d.ts +4 -0
- package/dist/steps/list.d.ts +7 -0
- package/dist/steps/listTransform.d.ts +21 -0
- package/dist/steps/listen.d.ts +16 -0
- package/dist/steps/load.d.ts +13 -0
- package/dist/steps/node.d.ts +12 -0
- package/dist/steps/object.d.ts +15 -0
- package/dist/steps/partitionByIndex.d.ts +35 -0
- package/dist/steps/proxy.d.ts +11 -0
- package/dist/steps/remapKeys.d.ts +8 -0
- package/dist/steps/reverse.d.ts +9 -0
- package/dist/subscribe.d.ts +4 -0
- package/dist/utils.d.ts +102 -0
- package/dist/version.d.ts +1 -1
- package/fwd/graphql/index.d.ts +1 -0
- package/fwd/graphql/index.js +1 -0
- package/package.json +2 -2
|
@@ -8,34 +8,80 @@ import type { PayloadRoot } from "./executeOutputPlan.js";
|
|
|
8
8
|
import type { LayerPlan } from "./LayerPlan.js";
|
|
9
9
|
export type OutputPlanTypeIntrospection = {
|
|
10
10
|
mode: "introspection";
|
|
11
|
+
/**
|
|
12
|
+
* The GraphQL introspection field selection (may include arguments/etc). We
|
|
13
|
+
* can build a GraphQL document from this and issue it to graphql-js rather
|
|
14
|
+
* than replicating that effort.
|
|
15
|
+
*/
|
|
11
16
|
field: FieldNode;
|
|
17
|
+
/**
|
|
18
|
+
* The names of the variables used in this document.
|
|
19
|
+
*/
|
|
12
20
|
variableNames: string[];
|
|
21
|
+
/**
|
|
22
|
+
* No need to re-run the introspection each time, may as well cache it,
|
|
23
|
+
* right?
|
|
24
|
+
*
|
|
25
|
+
* Key: canonical JSON stringify of the variables used.
|
|
26
|
+
* Value: the GraphQL result (`{data, errors}`) for this.
|
|
27
|
+
*/
|
|
13
28
|
introspectionCacheByVariableValues: LRU<string, JSONValue>;
|
|
14
29
|
};
|
|
15
30
|
export type OutputPlanTypeRoot = {
|
|
31
|
+
/**
|
|
32
|
+
* Always return `{}`
|
|
33
|
+
*/
|
|
16
34
|
mode: "root";
|
|
17
35
|
typeName: string;
|
|
18
36
|
};
|
|
19
37
|
export type OutputPlanTypeObject = {
|
|
38
|
+
/**
|
|
39
|
+
* Return `{}` if non-null
|
|
40
|
+
*/
|
|
20
41
|
mode: "object";
|
|
21
42
|
typeName: string;
|
|
22
43
|
deferLabel: string | undefined;
|
|
23
44
|
};
|
|
24
45
|
export type OutputPlanTypePolymorphicObject = {
|
|
46
|
+
/**
|
|
47
|
+
* Return `{}` if non-null
|
|
48
|
+
*/
|
|
25
49
|
mode: "polymorphic";
|
|
26
50
|
typeNames: string[];
|
|
27
51
|
deferLabel: string | undefined;
|
|
28
52
|
};
|
|
29
53
|
export type OutputPlanTypeArray = {
|
|
54
|
+
/**
|
|
55
|
+
* Return a list of the same length if an array
|
|
56
|
+
*/
|
|
30
57
|
mode: "array";
|
|
31
58
|
};
|
|
32
59
|
export type OutputPlanTypeLeaf = {
|
|
60
|
+
/**
|
|
61
|
+
* Return the value.
|
|
62
|
+
*/
|
|
33
63
|
mode: "leaf";
|
|
34
64
|
graphqlType: GraphQLScalarType | GraphQLEnumType;
|
|
35
65
|
};
|
|
36
66
|
export type OutputPlanTypeNull = {
|
|
37
67
|
mode: "null";
|
|
38
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Thanks to `@stream`, output plans must handle their own nullability concerns
|
|
71
|
+
* and we might need an output plan for any of these:
|
|
72
|
+
*
|
|
73
|
+
* - A concrete object
|
|
74
|
+
* - A polymorphic object
|
|
75
|
+
* - A leaf (enum/scalar)
|
|
76
|
+
* - Something we know will always be null
|
|
77
|
+
* - A list of any of the above
|
|
78
|
+
* - A list of lists
|
|
79
|
+
*
|
|
80
|
+
* In addition to the above, we also need to cover
|
|
81
|
+
*
|
|
82
|
+
* - The root object (which is like a concrete object, except it's never null)
|
|
83
|
+
* - Introspection
|
|
84
|
+
*/
|
|
39
85
|
export type OutputPlanType = OutputPlanTypeRoot | OutputPlanTypeObject | OutputPlanTypePolymorphicObject | OutputPlanTypeLeaf | OutputPlanTypeNull | OutputPlanTypeArray | OutputPlanTypeIntrospection;
|
|
40
86
|
export type OutputPlanKeyValueOutputPlan = {
|
|
41
87
|
type: "outputPlan";
|
|
@@ -51,22 +97,69 @@ export type OutputPlanKeyValue = OutputPlanKeyValueOutputPlan | OutputPlanKeyVal
|
|
|
51
97
|
export type OutputPlanKeyValueOutputPlanWithCachedBits = OutputPlanKeyValueOutputPlan & {
|
|
52
98
|
layerPlanId: number;
|
|
53
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* Defines a way of taking a layerPlan and converting it into an output value.
|
|
102
|
+
*
|
|
103
|
+
* The result of executing an output plan will be the following:
|
|
104
|
+
*
|
|
105
|
+
* - data?: the data for this layer, could be object, array or leaf (see OutputPlanMode)
|
|
106
|
+
* - errors: a list of errors that occurred (if any), including path details _within the output plan_
|
|
107
|
+
* - streams: a list of streams that were created
|
|
108
|
+
*/
|
|
54
109
|
export declare class OutputPlan<TType extends OutputPlanType = OutputPlanType> {
|
|
55
110
|
layerPlan: LayerPlan;
|
|
56
111
|
readonly type: TType;
|
|
112
|
+
/** For errors */
|
|
57
113
|
readonly locationDetails: LocationDetails;
|
|
114
|
+
/**
|
|
115
|
+
* The step that represents the root value. How this is used depends on the
|
|
116
|
+
* OutputPlanMode.
|
|
117
|
+
*/
|
|
58
118
|
readonly rootStep: ExecutableStep;
|
|
119
|
+
/**
|
|
120
|
+
* Appended to the root step when accessed to avoid the need for AccessSteps
|
|
121
|
+
*/
|
|
59
122
|
private processRoot;
|
|
123
|
+
/**
|
|
124
|
+
* For root/object output plans, the keys to set on the resulting object
|
|
125
|
+
* grouped by the concrete object type name.
|
|
126
|
+
*
|
|
127
|
+
* IMPORTANT: the order of these keys is significant, they MUST match the
|
|
128
|
+
* order in the request otherwise we break GraphQL spec compliance!
|
|
129
|
+
*/
|
|
60
130
|
keys: {
|
|
61
131
|
[key: string]: OutputPlanKeyValueTypeName | OutputPlanKeyValueOutputPlanWithCachedBits;
|
|
62
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* For list output plans, the output plan that describes the list children.
|
|
135
|
+
*/
|
|
63
136
|
child: OutputPlan | null;
|
|
64
137
|
childIsNonNull: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* For polymorphic output plans, the Object output plan for each specific type.
|
|
140
|
+
*/
|
|
65
141
|
childByTypeName: {
|
|
66
142
|
[typeName: string]: OutputPlan<OutputPlanTypeObject>;
|
|
67
143
|
} | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* For object output plan types only.
|
|
146
|
+
*/
|
|
68
147
|
deferredOutputPlans: OutputPlan<OutputPlanTypeObject | OutputPlanTypePolymorphicObject>[];
|
|
69
|
-
constructor(layerPlan: LayerPlan,
|
|
148
|
+
constructor(layerPlan: LayerPlan,
|
|
149
|
+
/**
|
|
150
|
+
* For root, this should always be an object.
|
|
151
|
+
*
|
|
152
|
+
* For object this could represent an object or null.
|
|
153
|
+
*
|
|
154
|
+
* For polymorphic this could represent a polymorphic object or null.
|
|
155
|
+
*
|
|
156
|
+
* For array it's the list itself (or null) and dictates the length of the result.
|
|
157
|
+
*
|
|
158
|
+
* For leaf, it's the leaf plan itself.
|
|
159
|
+
*
|
|
160
|
+
* For `introspection`, `null` it's irrelevant. Use `constant(null)` or whatever.
|
|
161
|
+
*/
|
|
162
|
+
rootStep: ExecutableStep, type: TType, locationDetails: LocationDetails);
|
|
70
163
|
print(): string;
|
|
71
164
|
toString(): string;
|
|
72
165
|
addChild(type: GraphQLObjectType | null, key: string | null, child: OutputPlanKeyValue): void;
|
|
@@ -79,5 +172,16 @@ export declare class OutputPlan<TType extends OutputPlanType = OutputPlanType> {
|
|
|
79
172
|
}
|
|
80
173
|
export declare function coerceError(error: Error, locationDetails: LocationDetails, path: ReadonlyArray<string | number>): graphql.GraphQLError;
|
|
81
174
|
export declare function nonNullError(locationDetails: LocationDetails, path: readonly (string | number)[]): graphql.GraphQLError;
|
|
175
|
+
/**
|
|
176
|
+
* We're currently running OutputPlan `outputPlan` in bucket `bucket` at index
|
|
177
|
+
* `bucketIndex`. If this is an array OutputPlan then we're looping over the
|
|
178
|
+
* entries in our list and we're currently at index `inArrayIndex` (otherwise
|
|
179
|
+
* this is null).
|
|
180
|
+
*
|
|
181
|
+
* Now we want to run `childOutputPlan`, but to do so we need to find the
|
|
182
|
+
* related `childBucket` and `childBucketIndex`.
|
|
183
|
+
*
|
|
184
|
+
* @internal
|
|
185
|
+
*/
|
|
82
186
|
export declare function getChildBucketAndIndex(childOutputPlan: OutputPlan, outputPlan: OutputPlan | null, bucket: Bucket, bucketIndex: number, arrayIndex?: number | null): [Bucket, number] | null;
|
|
83
187
|
//# sourceMappingURL=OutputPlan.d.ts.map
|
|
@@ -2,39 +2,92 @@ import type { OperationPlan } from "../index.js";
|
|
|
2
2
|
import type { ExecutableStep } from "../step";
|
|
3
3
|
import type { LayerPlan, LayerPlanReasonsWithParentStep } from "./LayerPlan";
|
|
4
4
|
import type { OutputPlan } from "./OutputPlan";
|
|
5
|
+
/**
|
|
6
|
+
* This class keeps track of all of our steps, and the dependencies between
|
|
7
|
+
* steps and other steps, layer plans and steps, and output plans and steps.
|
|
8
|
+
*
|
|
9
|
+
* When a step is replaced by another step, all the dependencies are updated
|
|
10
|
+
* such that the replaced step simply evaporates.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
5
14
|
export declare class StepTracker {
|
|
6
15
|
private readonly operationPlan;
|
|
16
|
+
/** @internal */
|
|
7
17
|
stepCount: number;
|
|
18
|
+
/** @internal */
|
|
8
19
|
activeSteps: Set<ExecutableStep<any>>;
|
|
20
|
+
/** @internal */
|
|
9
21
|
stepById: {
|
|
10
22
|
[stepId: number]: ExecutableStep | null;
|
|
11
23
|
};
|
|
24
|
+
/** @internal */
|
|
12
25
|
private aliasesById;
|
|
26
|
+
/** @internal */
|
|
13
27
|
stepsWithNoDependencies: Set<ExecutableStep<any>>;
|
|
28
|
+
/** @internal */
|
|
14
29
|
outputPlansByRootStep: Map<ExecutableStep<any>, Set<OutputPlan<import("./OutputPlan").OutputPlanType>>>;
|
|
30
|
+
/** @internal */
|
|
15
31
|
layerPlansByRootStep: Map<ExecutableStep<any>, Set<LayerPlan<import("./LayerPlan").LayerPlanReason>>>;
|
|
32
|
+
/** @internal */
|
|
16
33
|
layerPlansByParentStep: Map<ExecutableStep<any>, Set<LayerPlan<LayerPlanReasonsWithParentStep>>>;
|
|
34
|
+
/** @internal */
|
|
17
35
|
layerPlans: Array<LayerPlan | null>;
|
|
36
|
+
/**
|
|
37
|
+
* All the OutputPlans that were created to allow a more efficient
|
|
38
|
+
* walkOutputPlans implementation.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
18
42
|
allOutputPlans: OutputPlan[];
|
|
19
43
|
nextStepIdToDeduplicate: number;
|
|
20
44
|
constructor(operationPlan: OperationPlan);
|
|
21
45
|
newStepsSince(oldStepCount: number): ExecutableStep<any>[];
|
|
22
46
|
private forbid;
|
|
47
|
+
/** Called when OperationPlan enters finalize phase. */
|
|
23
48
|
finalizeSteps(): void;
|
|
49
|
+
/** Called when OperationPlan is about to finalize the output plans. */
|
|
24
50
|
finalizeOutputPlans(): void;
|
|
25
51
|
addStep($step: ExecutableStep): number;
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
26
55
|
addLayerPlan(layerPlan: LayerPlan): number;
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
27
59
|
addOutputPlan(outputPlan: OutputPlan): void;
|
|
60
|
+
/**
|
|
61
|
+
* HIGHLY EXPERIMENTAL!
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
28
65
|
deleteLayerPlan(layerPlan: LayerPlan): void;
|
|
29
66
|
getStepById(id: number): ExecutableStep;
|
|
30
67
|
getStepById(id: number, allowUnset: true): ExecutableStep | null;
|
|
31
68
|
addStepDependency($dependent: ExecutableStep, $dependency: ExecutableStep): number;
|
|
32
69
|
setOutputPlanRootStep(outputPlan: OutputPlan, $dependency: ExecutableStep): void;
|
|
33
70
|
setLayerPlanRootStep(layerPlan: LayerPlan, $dependency: ExecutableStep): void;
|
|
71
|
+
/** @internal */
|
|
34
72
|
replaceStep($original: ExecutableStep, $replacement: ExecutableStep): void;
|
|
35
73
|
treeShakeSteps(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Return true if this step can be tree-shaken.
|
|
76
|
+
*/
|
|
36
77
|
private isNotNeeded;
|
|
78
|
+
/**
|
|
79
|
+
* Only for use during planField.
|
|
80
|
+
*/
|
|
37
81
|
purgeBackTo(count: number): void;
|
|
82
|
+
/**
|
|
83
|
+
* ONLY CALL THIS IF NOTHING DEPENDS ON $original! It's intended to be called
|
|
84
|
+
* from `replaceStep` or from itself.
|
|
85
|
+
*
|
|
86
|
+
* This method removes $original from the various maps/sets/lists, and also
|
|
87
|
+
* removes the fact that it was dependent on other steps. If these other
|
|
88
|
+
* steps no longer have any dependents (steps, layer plans or output plans)
|
|
89
|
+
* then they can also be eradicated _except_ during the 'plan' phase.
|
|
90
|
+
*/
|
|
38
91
|
private eradicate;
|
|
39
92
|
moveStepToLayerPlan(step: ExecutableStep, targetLayerPlan: LayerPlan): void;
|
|
40
93
|
addStepToItsLayerPlan(step: ExecutableStep): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Bucket, RequestTools } from "../bucket.js";
|
|
2
2
|
import type { PromiseOrDirect } from "../interfaces.js";
|
|
3
3
|
import type { MetaByMetaKey } from "./OperationPlan.js";
|
|
4
|
+
/** @internal */
|
|
4
5
|
export declare function executeBucket(bucket: Bucket, requestContext: RequestTools): PromiseOrDirect<void>;
|
|
6
|
+
/** @internal */
|
|
5
7
|
export declare function newBucket(spec: Pick<Bucket, "layerPlan" | "store" | "size" | "hasErrors" | "polymorphicPathList" | "iterators">, parentMetaByMetaKey: MetaByMetaKey | null): Bucket;
|
|
6
8
|
//# sourceMappingURL=executeBucket.d.ts.map
|
|
@@ -6,11 +6,49 @@ export type OutputPath = Array<string | number>;
|
|
|
6
6
|
export interface OutputStream {
|
|
7
7
|
asyncIterable: AsyncIterableIterator<any>;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* PayloadRoot handles the root-level of a payload, it's ultimately responsible
|
|
11
|
+
* for sharing the `data`/`errors` with the user. But it also handles the
|
|
12
|
+
* intermediate payloads for stream/defer.
|
|
13
|
+
*
|
|
14
|
+
* A standard GraphQL query/mutation request (one that doesn't use
|
|
15
|
+
* `@stream`/`@defer`) will have just one payload. A standard GraphQL
|
|
16
|
+
* subscription request gets one payload per subscription event.
|
|
17
|
+
*
|
|
18
|
+
* When we mix `@stream` and `@defer` into this, we will require (often quite a
|
|
19
|
+
* lot) more payloads.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
9
23
|
export interface PayloadRoot {
|
|
24
|
+
/**
|
|
25
|
+
* Serialization works differently if we're running inside GraphQL. (Namely:
|
|
26
|
+
* we don't serialize - that's GraphQL's job.)
|
|
27
|
+
*/
|
|
10
28
|
insideGraphQL: false;
|
|
29
|
+
/**
|
|
30
|
+
* The errors that have occurred; these are proper GraphQLErrors and will be
|
|
31
|
+
* returned directly to clients so they must be complete.
|
|
32
|
+
*/
|
|
11
33
|
errors: GraphQLError[];
|
|
34
|
+
/**
|
|
35
|
+
* Defer queue - we don't start executing these until after the main
|
|
36
|
+
* payload is completed (to allow for a non-null boundary to abort
|
|
37
|
+
* execution).
|
|
38
|
+
*/
|
|
12
39
|
queue: Array<SubsequentPayloadSpec>;
|
|
40
|
+
/**
|
|
41
|
+
* Stream queue - we don't start executing these until after the main
|
|
42
|
+
* payload is completed (to allow for a non-null boundary to abort
|
|
43
|
+
* execution).
|
|
44
|
+
*/
|
|
13
45
|
streams: Array<SubsequentStreamSpec>;
|
|
46
|
+
/**
|
|
47
|
+
* VERY DANGEROUS. This is _only_ to pass variables through to introspection
|
|
48
|
+
* selections, it shouldn't be used for anything else.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
* */
|
|
14
52
|
variables: {
|
|
15
53
|
[key: string]: any;
|
|
16
54
|
};
|
|
@@ -38,5 +76,8 @@ export interface SubsequentStreamSpec {
|
|
|
38
76
|
stream: AsyncIterator<any> | Iterator<any>;
|
|
39
77
|
startIndex: number;
|
|
40
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
41
82
|
export declare function executeOutputPlan(ctx: OutputPlanContext, outputPlan: OutputPlan, bucket: Bucket, bucketIndex: number, outputDataAsString: boolean): JSONValue;
|
|
42
83
|
//# sourceMappingURL=executeOutputPlan.d.ts.map
|
package/dist/envelop.d.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import type { Plugin as EnvelopPlugin } from "@envelop/core";
|
|
2
2
|
export interface UseGrafastOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Set this to 'true' to allow all explains; set it to a list of the allowed
|
|
5
|
+
* explains to allow only those, set it to false to disable explains.
|
|
6
|
+
*/
|
|
3
7
|
explainAllowed?: boolean | string[];
|
|
4
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* An Envelop plugin that uses Grafast to prepare and execute the GraphQL
|
|
11
|
+
* query.
|
|
12
|
+
*/
|
|
5
13
|
export declare const useGrafast: (options?: UseGrafastOptions) => EnvelopPlugin;
|
|
14
|
+
/**
|
|
15
|
+
* An Envelop plugin that will make any GraphQL errors easier to read from
|
|
16
|
+
* inside of GraphiQL.
|
|
17
|
+
*/
|
|
6
18
|
export declare const useMoreDetailedErrors: () => EnvelopPlugin;
|
|
7
19
|
//# sourceMappingURL=envelop.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.15";
|
|
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. 21776549661030886";
|
|
32
32
|
const key = scryptSync(password, salt, 24);
|
|
33
|
-
const ivBuffer = Buffer.from("
|
|
33
|
+
const ivBuffer = Buffer.from("fEBkkCJeJGhakF0twHhgpw==", "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 = "SVZfreXeCKfixoCo2KglZqBVDEmE+d593oMh1BEoYVR+c3lbcYTjkjdS8zKowzNB59In9rNZKHOo7mBJXRq+aolaaxudzKRUARRVMPlRi6/o3SFYDaGm0tXZ8RUEuzYMqbpOZEVjbQtzbHTlQGy3Ujc4tZuK41S+POR9DjRuXKgkVosWrwf72JhoG+SGy+To7TS7DG2ZoDlrt4XileUgPEQ9pHZHX0Q90WJ7HFxcIDg0LFiAIAVtFn5ajEi9/PmEAZSqJ+7125CUqYstZm/oMSR+fdS9bcIfinump4u0WQRJmEVKqm7MOOpR4NMK15El01e/Jhr0uvWS/S/LRPjiLdAAub4wka1NYCk3cunmWHOoAhTDVuZGH3sQpZSy3Bv15hN4jG4McEbvRToPUGkZduf/fgNIy3rnDaKRF6Wat5S77LDtgFfVAk7DewACpDScLODZxjLdNWHmlx3GlCiPDaFKN6pMCshTWJYiT0aZYiLtR5zRDgTlxsvruzXdGq2Qq9bttSRLcgFL4bRMWy5NlA7EyO2QxuWYDZfcse+9H1oc0TCntEe7UsrTaK73/hfjZpFEkob5HQJTO7yvAMJxncI8QCP9VNcSY+OokfMhpSAok8sgcMVz9Oif6EcDAwmQi190U68iEvRNg7fF7Yrpk9uNgTjreS6ydzo++jRFFF8ZZp698fyJ1azF65sK0hnUbW/Zq5mGNvOQ9x6vSDbBq8teRD0BxD38KTQGcROGaXN4ojXv9uzOphFgoL+2tkdYK2arUtzZPscfYIj5kgyZwQfZVJ8bShEPf9g6HeTHEU8xxA2P9Je6rxGaOcY0cl8Sbcrz9E0D3XEjvSq/eNmJ+ge+JBb5ItMmaA+4cRUy8v/n6HvbIikbIQ5nMr9k+ux2irM/ZWSeKyB4bYNl1CgodEc1jJqjtHOeOdgCB0ckbwOcolim55rlrpWWBF04p3om1TwzWrp85x3m1hloT524G7M5tPWPPYHFORvp6E/5/0cdJlqBm9zktrH1C56sKFtROUJX6RoNdzGaHQ2T/aQYvyNiu3ItV2oSljREZ5VlNzhLvGvQhs35PYLJLGps1W2/GS9NuO7DAoW2bnWnLG/7u7ZNgY9bUJoooowyjlOWElPkps/s349zcYgyqRwL0cgbs+IjO33IW5VDGTA+jnVUuXkjDieMlpNRAd8yjX4pd6Rynv7iFpmGnmOMgdyxIBbOWM51fHXnwjmqFc/mdoyGB3v7A/dBXs5/LXDdgoGLKGbBxDUh2W1Mqkfk2Ubefszxiq13y48q6JhCxQ36KEQXXiE9uNRI/O7ELUCW/3Dgk6EoozNr3/ijbA6vr2oqTHQNSjvAWPLZbyK1wpIo2U7hqz7VzpI0I6L/Xx1wAkF0cAXFc/zRmyd35HZW98YWQfzlNJSZMo9ctXVESOHEp5LrPLjgimmg2lalcO7Got0KnoMW30N5OxcXwnHUNKTBDStZl+EB5o4Wzn6nhlyIIl/zpJCsLuMbj7bJ/R05+0XLVYX5sk5jU0GA7I6Zbd2pACVneCQlhz6qXAdcIbYhiUD0/j11c8hqMIUbP6lxPD5thmNC+cdA0EedZnhd+DuN6HQ7YWDVpy0o81bys0F4yA23EDiraCS2gPh3mj5XTZ/Tm/Uc5yFQnnCmhdrhxAlCahgnCIucDkCJ2aitOH4sujYFNwRIFOwMXltDMdGZD8Cd0hDndCn8bK59J0Oo2Rv1p4KMi4A1R8zVCeQkjGKvWSprP+WpB4SghgiWRoCbr+sVhVvE/eVboW14PBzgp8IiY2ISppFpckZdw9ux43c6ybvxfN75B5XIqmwc4BLz2ORFNA8="
|
|
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,11 +1,25 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { $$extensions } from "./interfaces.js";
|
|
3
3
|
import { $$safeError } from "./interfaces.js";
|
|
4
|
+
/**
|
|
5
|
+
* Internally we wrap errors that occur in a GrafastError; this allows us to do
|
|
6
|
+
* simple `instanceof` checks to see if a value is an actual value or an error.
|
|
7
|
+
* Users should never use this class; it's for internal usage only.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
4
11
|
export interface GrafastError extends Error {
|
|
5
12
|
originalError: Error;
|
|
6
13
|
[$$extensions]?: Record<string, any>;
|
|
7
14
|
}
|
|
8
15
|
export declare const $$error: unique symbol;
|
|
16
|
+
/**
|
|
17
|
+
* When an error occurs during plan execution we wrap it in a GrafastError so
|
|
18
|
+
* that we can pass it around as a value. It gets unwrapped and thrown in the
|
|
19
|
+
* grafast resolver.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
9
23
|
export declare const _GrafastError: {
|
|
10
24
|
new (originalError: Error, planId: number | null): {
|
|
11
25
|
readonly originalError: Error;
|
|
@@ -20,6 +34,11 @@ export declare const _GrafastError: {
|
|
|
20
34
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
21
35
|
stackTraceLimit: number;
|
|
22
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* DO NOT ALLOW CONSTRUCTION OF ERRORS OUTSIDE OF THIS MODULE!
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
23
42
|
export declare function newGrafastError(error: Error, planId: number | null): {
|
|
24
43
|
readonly originalError: Error;
|
|
25
44
|
extensions: Record<string, any>;
|
|
@@ -29,6 +48,10 @@ export declare function newGrafastError(error: Error, planId: number | null): {
|
|
|
29
48
|
stack?: string | undefined;
|
|
30
49
|
cause?: unknown;
|
|
31
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Is the given value a GrafastError? This is the only public API that people
|
|
53
|
+
* should use for looking at GrafastErrors.
|
|
54
|
+
*/
|
|
32
55
|
export declare function isGrafastError(value: any): value is GrafastError;
|
|
33
56
|
export declare class SafeError<TExtensions extends Record<string, any> | undefined = Record<string, any> | undefined> extends Error {
|
|
34
57
|
extensions: TExtensions;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { GraphQLSchema, OperationDefinitionNode } from "graphql";
|
|
2
2
|
import { OperationPlan } from "./index.js";
|
|
3
3
|
import type { BaseGraphQLRootValue, BaseGraphQLVariables, Fragments } from "./interfaces.js";
|
|
4
|
+
/**
|
|
5
|
+
* Implements the `EstablishOpPlan` algorithm.
|
|
6
|
+
*
|
|
7
|
+
* @remarks Though EstablishOpPlan accepts document and operationName, we
|
|
8
|
+
* instead accept operation and fragments since they're easier to get a hold of
|
|
9
|
+
* in GraphQL.js.
|
|
10
|
+
*/
|
|
4
11
|
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;
|
|
5
12
|
//# sourceMappingURL=establishOperationPlan.d.ts.map
|
package/dist/execute.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { AsyncExecutionResult, ExecutionArgs, ExecutionResult } from "graphql";
|
|
2
2
|
import type { PromiseOrValue } from "graphql/jsutils/PromiseOrValue";
|
|
3
|
+
/**
|
|
4
|
+
* Used by `execute` and `subscribe`.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
3
7
|
export declare function withGrafastArgs(args: ExecutionArgs, resolvedPreset: GraphileConfig.ResolvedPreset, outputDataAsString: boolean): PromiseOrValue<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, void>>;
|
|
8
|
+
/**
|
|
9
|
+
* Use this instead of GraphQL.js' execute method and we'll automatically
|
|
10
|
+
* run grafastPrepare for you and handle the result.
|
|
11
|
+
*/
|
|
4
12
|
export declare function execute(args: ExecutionArgs, resolvedPreset?: GraphileConfig.ResolvedPreset, outputDataAsString?: boolean): PromiseOrValue<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, undefined>>;
|
|
5
13
|
//# sourceMappingURL=execute.d.ts.map
|
package/dist/exportAs.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks that `thing` is exported from the `grafast` module as
|
|
3
|
+
* `exportName` so that `graphile-export` can convert references to `thing`
|
|
4
|
+
* into an `import` statement.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
1
8
|
export declare function exportAs<T extends object>(moduleName: string, thing: T, exportName: string | string[]): T;
|
|
9
|
+
/**
|
|
10
|
+
* Marks that each value in `all` is exported from the `grafast`
|
|
11
|
+
* module as the key in the `all` object so that `graphile-export` can
|
|
12
|
+
* convert references to these values into `import` statements.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
2
16
|
export declare function exportAsMany(moduleName: string, all: {
|
|
3
17
|
[key: string]: any;
|
|
4
18
|
}): void;
|
package/dist/grafastGraphql.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type { AsyncExecutionResult, ExecutionResult
|
|
1
|
+
import type { AsyncExecutionResult, ExecutionResult } from "graphql";
|
|
2
2
|
import type { PromiseOrValue } from "graphql/jsutils/PromiseOrValue";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { GrafastArgs } from "./interfaces.js";
|
|
4
|
+
/**
|
|
5
|
+
* A replacement for GraphQL.js' `graphql` method that calls Grafast's
|
|
6
|
+
* execute instead
|
|
7
|
+
*/
|
|
8
|
+
export declare function grafast(args: GrafastArgs, legacyResolvedPreset?: GraphileConfig.ResolvedPreset, legacyCtx?: Partial<Grafast.RequestContext>): PromiseOrValue<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, undefined>>;
|
|
9
|
+
export declare function grafastSync(args: GrafastArgs, legacyResolvedPreset?: GraphileConfig.ResolvedPreset, legacyRequestContext?: Partial<Grafast.RequestContext>): ExecutionResult;
|
|
5
10
|
//# sourceMappingURL=grafastGraphql.d.ts.map
|
package/dist/grafastPrint.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export declare function _grafastPrint(symbol: string | symbol | symbol[] | Record<symbol, any> | Map<any, any>, seen: Set<any>): string;
|
|
2
2
|
export declare function grafastColor(text: string, n: number): string;
|
|
3
|
+
/**
|
|
4
|
+
* Prints something grafast-style (i.e. concise, coloured, with helpful detail)
|
|
5
|
+
*/
|
|
3
6
|
export declare function grafastPrint(symbol: symbol | symbol[] | Record<symbol, any> | Map<any, any> | any): string;
|
|
7
|
+
/**
|
|
8
|
+
* An ANSI-aware pad function; strips ANSI sequences from the string, figures
|
|
9
|
+
* out how much it needs to pad it by, and then pads the original string by
|
|
10
|
+
* that amount.
|
|
11
|
+
*/
|
|
4
12
|
export declare function ansiPad(ansiString: string, targetLength: number, fill: string, position: "start" | "end"): string;
|
|
5
13
|
//# sourceMappingURL=grafastPrint.d.ts.map
|
|
@@ -2,13 +2,35 @@ import type { DirectiveNode, FieldNode, SelectionNode } from "graphql";
|
|
|
2
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
|
+
/**
|
|
6
|
+
* Given a selection, finds the first directive named `directiveName` and, if
|
|
7
|
+
* found, extracts and returns the value from the argument named
|
|
8
|
+
* `argumentName`, tracking variable access if necessary.
|
|
9
|
+
*
|
|
10
|
+
* @remarks Currently only supports booleans.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*
|
|
14
|
+
* PERF: inline.
|
|
15
|
+
*/
|
|
5
16
|
export declare function evalDirectiveArg<T = unknown>(selection: SelectionNode, directiveName: string, argumentName: string, variableValuesStep: __TrackedValueStep, defaultValue: T): T | undefined;
|
|
6
17
|
export declare function evalDirectiveArgDirect<T = unknown>(directive: DirectiveNode, argumentName: string, variableValuesStep: __TrackedValueStep, defaultValue: T): T | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
7
21
|
export interface SelectionSetDigest {
|
|
8
22
|
label: string | undefined;
|
|
9
23
|
fields: Map<string, FieldNode[]>;
|
|
10
24
|
deferred: SelectionSetDigest[] | undefined;
|
|
11
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Implements the `GraphQLCollectFields` algorithm - like `CollectFields` the
|
|
28
|
+
* GraphQL spec, but modified such that access to variables is tracked.
|
|
29
|
+
*
|
|
30
|
+
* @see https://spec.graphql.org/draft/#CollectFields()
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
12
34
|
export declare function graphqlCollectFields(operationPlan: OperationPlan, parentStepId: number, objectType: graphql.GraphQLObjectType, selections: readonly SelectionNode[], isMutation?: boolean, visitedFragments?: {
|
|
13
35
|
[fragmentName: string]: true;
|
|
14
36
|
}, selectionSetDigest?: SelectionSetDigest): SelectionSetDigest;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { FieldNode, GraphQLObjectType, SelectionNode } from "graphql";
|
|
2
2
|
import type { OperationPlan } from "./index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Given a list of polymorphic selections, return a list of the nested field
|
|
5
|
+
* selections that apply to the object type `type`.
|
|
6
|
+
*/
|
|
3
7
|
export declare function fieldSelectionsForType(operationPlan: OperationPlan, type: GraphQLObjectType, selections: ReadonlyArray<SelectionNode>, result?: Array<FieldNode>): ReadonlyArray<FieldNode>;
|
|
4
8
|
//# sourceMappingURL=graphqlMergeSelectionSets.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export { isAsyncIterable } from "iterall";
|
|
|
21
21
|
export { __InputListStep, __InputObjectStep, __InputObjectStepWithDollars, __InputStaticLeafStep, __ItemStep, __ListTransformStep, __TrackedValueStep, __TrackedValueStepWithDollars, __ValueStep, $$bypassGraphQL, $$eventEmitter, $$extensions, $$idempotent, $$verbatim, access, AccessStep, ActualKeyByDesiredKey, applyTransforms, ApplyTransformsStep, ArgumentApplyPlanResolver, ArgumentInputPlanResolver, arrayOfLength, arraysMatch, assertEdgeCapableStep, assertExecutableStep, assertListCapableStep, assertModifierStep, assertPageInfoCapableStep, BaseEventMap, BaseGraphQLArguments, BaseGraphQLRootValue, BaseGraphQLVariables, BaseStep, connection, ConnectionCapableStep, ConnectionStep, constant, ConstantStep, context, debugPlans, defer, Deferred, each, EdgeCapableStep, EdgeStep, EnumPlans, EnumValueApplyPlanResolver, error, ErrorStep, EventCallback, EventMapKey, ExecutableStep, execute, ExecutionEventEmitter, ExecutionEventMap, ExecutionExtra, exportAs, exportAsMany, FieldArgs, FieldInfo, FieldPlanResolver, FieldPlans, filter, FilterPlanMemo, first, FirstStep, getEnumValueConfig, grafast, GrafastArgumentConfig, GrafastError, GrafastFieldConfig, GrafastFieldConfigArgumentMap, grafast as grafastGraphql, grafastSync as grafastGraphqlSync, GrafastInputFieldConfig, GrafastInputFieldConfigMap, GrafastInputObjectType, GrafastObjectType, GrafastPlans, grafastPrint, GrafastResultsList, GrafastResultStreamList, GrafastSubscriber, grafastSync, GrafastValuesList, 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, LoadedRecordStep, loadMany, LoadManyCallback, loadManyCallback, loadOne, LoadOneCallback, loadOneCallback, LoadOptions, LoadStep, makeGrafastSchema, ModifierStep, newGrafastFieldConfigBuilder, 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, remapKeys, RemapKeysStep, 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
|
export { version } from "./version.js";
|
|
24
|
+
/** @deprecated Renamed to 'applyTransforms' */
|
|
24
25
|
export declare const deepEval: typeof applyTransforms;
|
|
26
|
+
/** @deprecated Renamed to 'ApplyTransformsStep' */
|
|
25
27
|
export declare const DeepEvalStep: typeof ApplyTransformsStep;
|
|
26
28
|
//# sourceMappingURL=index.d.ts.map
|