grafast 1.0.0-rc.1 → 1.0.0-rc.2
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/interfaces.d.ts +18 -4
- package/dist/steps/object.js +1 -1
- package/dist/utils.js +9 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
package/dist/interfaces.d.ts
CHANGED
|
@@ -399,9 +399,11 @@ export interface UnbatchedExecutionExtra extends ExecutionExtraBase {
|
|
|
399
399
|
}
|
|
400
400
|
export type ExecutionValue<TData = any> = BatchExecutionValue<TData> | UnaryExecutionValue<TData>;
|
|
401
401
|
interface ExecutionValueBase<TData = any> {
|
|
402
|
+
/** Data at index in the batch (`0 <= batchIndex < count`) */
|
|
402
403
|
at(i: number): TData;
|
|
404
|
+
/** `false` for unary execution values, `true` otherwise */
|
|
403
405
|
isBatch: boolean;
|
|
404
|
-
/** Returns
|
|
406
|
+
/** Returns the value for a unary execution value; throws if non-unary */
|
|
405
407
|
unaryValue(): TData;
|
|
406
408
|
}
|
|
407
409
|
export interface BatchExecutionValue<TData = any> extends ExecutionValueBase<TData> {
|
|
@@ -422,17 +424,29 @@ export interface ExecutionDetailsStream {
|
|
|
422
424
|
initialCount: number;
|
|
423
425
|
}
|
|
424
426
|
export interface ExecutionDetails<TDeps extends readonly [...any[]] = readonly [...any[]]> {
|
|
427
|
+
/** The size of the batch being processed */
|
|
425
428
|
count: number;
|
|
426
|
-
|
|
427
|
-
indexForEach: IndexForEach;
|
|
429
|
+
/** An "execution value" for each dependency of the step */
|
|
428
430
|
values: {
|
|
429
431
|
[DepIdx in keyof TDeps]: ExecutionValue<TDeps[DepIdx]>;
|
|
430
432
|
} & {
|
|
431
433
|
length: TDeps["length"];
|
|
432
434
|
map: ReadonlyArray<ExecutionValue<TDeps[number]>>["map"];
|
|
433
435
|
};
|
|
434
|
-
|
|
436
|
+
/** Helper; makes array from `callback(batchIndex)` for each `0 <= batchIndex < count` */
|
|
437
|
+
indexMap: IndexMap;
|
|
438
|
+
/** Helper; calls `callback` for each batchIndex in the batch; no return value */
|
|
439
|
+
indexForEach: IndexForEach;
|
|
440
|
+
/**
|
|
441
|
+
* If this step is expected to return a stream (e.g. because it's a
|
|
442
|
+
* `subscription`, or because of the `@stream` incremental delivery
|
|
443
|
+
* directive) then an object with details of the stream, such as how many
|
|
444
|
+
* records were requested up front (`initialCount`). For subscriptions,
|
|
445
|
+
* `initialCount` will always be `0`.
|
|
446
|
+
*/
|
|
435
447
|
stream: ExecutionDetailsStream | null;
|
|
448
|
+
/** Currently experimental, use it at your own risk (and see the source for docs) */
|
|
449
|
+
extra: ExecutionExtra;
|
|
436
450
|
}
|
|
437
451
|
export interface LocationDetails {
|
|
438
452
|
node: ASTNode | readonly ASTNode[];
|
package/dist/steps/object.js
CHANGED
|
@@ -271,7 +271,7 @@ class ObjectStep extends step_js_1.UnbatchedStep {
|
|
|
271
271
|
// Replace self with constant
|
|
272
272
|
// We'll cache so that the constants can be more easily deduplicated
|
|
273
273
|
const meta = opts.meta;
|
|
274
|
-
const keysJoined = this.keys
|
|
274
|
+
const keysJoined = JSON.stringify(this.keys);
|
|
275
275
|
if (!meta[keysJoined]) {
|
|
276
276
|
meta[keysJoined] = [];
|
|
277
277
|
}
|
package/dist/utils.js
CHANGED
|
@@ -731,9 +731,16 @@ function writeableArray(a) {
|
|
|
731
731
|
* directly or indirectly (via a chain of dependencies).
|
|
732
732
|
*/
|
|
733
733
|
function stepADependsOnStepB(stepA, stepB, sansSideEffects = false) {
|
|
734
|
+
return _stepADependsOnStepB(stepA, stepB, sansSideEffects, new Set());
|
|
735
|
+
}
|
|
736
|
+
/** @internal */
|
|
737
|
+
function _stepADependsOnStepB(stepA, stepB, sansSideEffects, visited) {
|
|
734
738
|
if (stepA === stepB) {
|
|
735
739
|
throw new Error("Invalid call to stepADependsOnStepB");
|
|
736
740
|
}
|
|
741
|
+
if (visited.has(stepA))
|
|
742
|
+
return false;
|
|
743
|
+
visited.add(stepA);
|
|
737
744
|
// PERF: bredth-first might be better.
|
|
738
745
|
// PERF: we can stop looking once we pass a certain layerPlan boundary.
|
|
739
746
|
// PERF: maybe some form of caching here would be sensible?
|
|
@@ -747,14 +754,14 @@ function stepADependsOnStepB(stepA, stepB, sansSideEffects = false) {
|
|
|
747
754
|
dep.implicitSideEffectStep !== stepB.implicitSideEffectStep) {
|
|
748
755
|
return false;
|
|
749
756
|
}
|
|
750
|
-
if (
|
|
757
|
+
if (_stepADependsOnStepB(dep, stepB, false, visited)) {
|
|
751
758
|
return true;
|
|
752
759
|
}
|
|
753
760
|
}
|
|
754
761
|
if (stepA.implicitSideEffectStep) {
|
|
755
762
|
if (stepA.implicitSideEffectStep === stepB)
|
|
756
763
|
return true;
|
|
757
|
-
return
|
|
764
|
+
return _stepADependsOnStepB(stepA.implicitSideEffectStep, stepB, false, visited);
|
|
758
765
|
}
|
|
759
766
|
else {
|
|
760
767
|
return false;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.0.0-rc.
|
|
1
|
+
export declare const version = "1.0.0-rc.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grafast",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
4
|
"description": "Cutting edge GraphQL planning and execution engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"node": ">=14.17"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@graphile/lru": "^5.0.0-rc.
|
|
58
|
+
"@graphile/lru": "^5.0.0-rc.2",
|
|
59
59
|
"chalk": "^4.1.2",
|
|
60
|
-
"debug": "^4.4.
|
|
60
|
+
"debug": "^4.4.3",
|
|
61
61
|
"eventemitter3": "^5.0.1",
|
|
62
|
-
"graphile-config": "^1.0.0-rc.
|
|
62
|
+
"graphile-config": "^1.0.0-rc.2",
|
|
63
63
|
"graphql": "^16.9.0",
|
|
64
64
|
"iterall": "^1.3.0",
|
|
65
65
|
"tslib": "^2.8.1"
|