grafast 0.0.0 → 0.0.1-0.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.
Files changed (77) hide show
  1. package/LICENSE.md +26 -0
  2. package/README.md +3 -1
  3. package/dist/LICENSES.txt +273 -0
  4. package/dist/args.d.ts +3 -0
  5. package/dist/assert.d.ts +3 -0
  6. package/dist/bucket.d.ts +24 -0
  7. package/dist/config.d.ts +9 -0
  8. package/dist/constraints.d.ts +30 -0
  9. package/dist/deferred.d.ts +6 -0
  10. package/dist/dev.d.ts +3 -0
  11. package/dist/engine/LayerPlan.d.ts +80 -0
  12. package/dist/engine/OperationPlan.d.ts +120 -0
  13. package/dist/engine/OutputPlan.d.ts +84 -0
  14. package/dist/engine/StepTracker.d.ts +35 -0
  15. package/dist/engine/executeBucket.d.ts +5 -0
  16. package/dist/engine/executeOutputPlan.d.ts +42 -0
  17. package/dist/engine/lib/withGlobalLayerPlan.d.ts +5 -0
  18. package/dist/envelop.d.ts +7 -0
  19. package/dist/envelop.js +1 -0
  20. package/dist/error.d.ts +13 -0
  21. package/dist/establishOperationPlan.d.ts +9 -0
  22. package/dist/execute.d.ts +5 -0
  23. package/dist/exportAs.d.ts +5 -0
  24. package/dist/global.d.ts +3 -0
  25. package/dist/grafastGraphql.d.ts +5 -0
  26. package/dist/grafastPrint.d.ts +5 -0
  27. package/dist/graphqlCollectFields.d.ts +12 -0
  28. package/dist/graphqlMergeSelectionSets.d.ts +4 -0
  29. package/dist/index.d.ts +23 -0
  30. package/dist/index.js +169 -0
  31. package/dist/input.d.ts +11 -0
  32. package/dist/inspect.d.ts +4 -0
  33. package/dist/interfaces.d.ts +261 -0
  34. package/dist/makeGrafastSchema.d.ts +52 -0
  35. package/dist/mermaid.d.ts +15 -0
  36. package/dist/opPlan-input.d.ts +6 -0
  37. package/dist/polymorphic.d.ts +6 -0
  38. package/dist/prepare.d.ts +11 -0
  39. package/dist/step.d.ts +104 -0
  40. package/dist/steps/__inputDynamicScalar.d.ts +18 -0
  41. package/dist/steps/__inputList.d.ts +23 -0
  42. package/dist/steps/__inputObject.d.ts +24 -0
  43. package/dist/steps/__inputStaticLeaf.d.ts +15 -0
  44. package/dist/steps/__item.d.ts +19 -0
  45. package/dist/steps/__trackedObject.d.ts +28 -0
  46. package/dist/steps/__value.d.ts +16 -0
  47. package/dist/steps/access.d.ts +24 -0
  48. package/dist/steps/connection.d.ts +84 -0
  49. package/dist/steps/constant.d.ts +20 -0
  50. package/dist/steps/deepEval.d.ts +19 -0
  51. package/dist/steps/each.d.ts +5 -0
  52. package/dist/steps/error.d.ts +15 -0
  53. package/dist/steps/filter.d.ts +6 -0
  54. package/dist/steps/first.d.ts +18 -0
  55. package/dist/steps/graphqlResolver.d.ts +65 -0
  56. package/dist/steps/groupBy.d.ts +5 -0
  57. package/dist/steps/index.d.ts +37 -0
  58. package/dist/steps/lambda.d.ts +23 -0
  59. package/dist/steps/last.d.ts +17 -0
  60. package/dist/steps/list.d.ts +24 -0
  61. package/dist/steps/listTransform.d.ts +45 -0
  62. package/dist/steps/listen.d.ts +26 -0
  63. package/dist/steps/loadMany.d.ts +46 -0
  64. package/dist/steps/loadOne.d.ts +30 -0
  65. package/dist/steps/map.d.ts +26 -0
  66. package/dist/steps/node.d.ts +30 -0
  67. package/dist/steps/object.d.ts +49 -0
  68. package/dist/steps/partitionByIndex.d.ts +4 -0
  69. package/dist/steps/proxy.d.ts +22 -0
  70. package/dist/steps/reverse.d.ts +18 -0
  71. package/dist/steps/setter.d.ts +27 -0
  72. package/dist/stringifyPayload.d.ts +3 -0
  73. package/dist/stripAnsi.d.ts +3 -0
  74. package/dist/subscribe.d.ts +4 -0
  75. package/dist/utils.d.ts +60 -0
  76. package/package.json +60 -9
  77. package/index.js +0 -1
@@ -0,0 +1,4 @@
1
+ import type { ExecutableStep } from "../step.js";
2
+ import type { __ListTransformStep, ListTransformItemPlanCallback } from "./listTransform.js";
3
+ export declare function partitionByIndex<TListStep extends ExecutableStep<readonly any[]>, TItemStep extends ExecutableStep<number>>(listPlan: TListStep, mapper: ListTransformItemPlanCallback<TListStep, TItemStep>, startIndex?: 0 | 1): __ListTransformStep<TListStep, TItemStep, unknown[][], any>;
4
+ //# sourceMappingURL=partitionByIndex.d.ts.map
@@ -0,0 +1,22 @@
1
+ import type { GrafastResultsList, GrafastValuesList } from "../index.js";
2
+ import type { ExecutionExtra } from "../interfaces.js";
3
+ import type { ExecutableStep } from "../step.js";
4
+ import { UnbatchedExecutableStep } from "../step.js";
5
+ export declare class ProxyStep<T> extends UnbatchedExecutableStep<T> {
6
+ static $$export: {
7
+ moduleName: string;
8
+ exportName: string;
9
+ };
10
+ isSyncAndSafe: boolean;
11
+ private $depId;
12
+ constructor($dep: ExecutableStep<T>, $actualDep: ExecutableStep);
13
+ toStringMeta(): string | null;
14
+ addDependency(step: ExecutableStep<any>): number;
15
+ execute(values: [GrafastValuesList<T>]): GrafastResultsList<T>;
16
+ unbatchedExecute(extra: ExecutionExtra, value: T): T;
17
+ stream: undefined;
18
+ }
19
+ export declare function proxy<TData, TStep extends ExecutableStep<TData>>($step: TStep, $actualDep?: ExecutableStep): TStep & {
20
+ addDependency(step: ExecutableStep): number;
21
+ };
22
+ //# sourceMappingURL=proxy.d.ts.map
@@ -0,0 +1,18 @@
1
+ import type { ExecutionExtra, GrafastResultsList, GrafastValuesList } from "../interfaces.js";
2
+ import type { ExecutableStep } from "../step.js";
3
+ import { UnbatchedExecutableStep } from "../step.js";
4
+ export declare function reverseArray<TData = any>(list: readonly TData[]): TData[];
5
+ export declare class ReverseStep<TData> extends UnbatchedExecutableStep<readonly TData[]> {
6
+ static $$export: {
7
+ moduleName: string;
8
+ exportName: string;
9
+ };
10
+ isSyncAndSafe: boolean;
11
+ allowMultipleOptimizations: boolean;
12
+ constructor(plan: ExecutableStep<readonly TData[]>);
13
+ execute(values: [GrafastValuesList<TData[]>]): GrafastResultsList<TData[]>;
14
+ unbatchedExecute(extra: ExecutionExtra, arr: TData[]): TData[];
15
+ deduplicate(peers: ReverseStep<TData>[]): ReverseStep<TData>[];
16
+ }
17
+ export declare function reverse<TData>(plan: ExecutableStep<readonly TData[]>): ReverseStep<TData>;
18
+ //# sourceMappingURL=reverse.d.ts.map
@@ -0,0 +1,27 @@
1
+ import type { BaseStep, ExecutableStep } from "../step.js";
2
+ import { ModifierStep } from "../step.js";
3
+ export interface SetterCapableStep<TPlans extends {
4
+ [key: string]: ExecutableStep<any>;
5
+ }> extends BaseStep {
6
+ set<TKey extends keyof TPlans>(key: TKey, value: TPlans[TKey]): void;
7
+ }
8
+ export declare class SetterStep<TPlans extends {
9
+ [key: string]: ExecutableStep<any>;
10
+ } = {
11
+ [key: string]: ExecutableStep<any>;
12
+ }, TParentStep extends SetterCapableStep<TPlans> = SetterCapableStep<TPlans>> extends ModifierStep<TParentStep> {
13
+ static $$export: {
14
+ moduleName: string;
15
+ exportName: string;
16
+ };
17
+ private setters;
18
+ constructor($parent: TParentStep);
19
+ set<TKey extends keyof TPlans>(key: TKey, valuePlan: TPlans[TKey]): void;
20
+ apply(): void;
21
+ }
22
+ export declare function setter<TPlans extends {
23
+ [key: string]: ExecutableStep<any>;
24
+ } = {
25
+ [key: string]: ExecutableStep<any>;
26
+ }, TParentStep extends SetterCapableStep<TPlans> = SetterCapableStep<TPlans>>($parent: TParentStep): SetterStep<TPlans, TParentStep>;
27
+ //# sourceMappingURL=setter.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { JSONObject } from "./interfaces.js";
2
+ export declare function stringifyPayload(payload: JSONObject, asString: boolean | undefined): string;
3
+ //# sourceMappingURL=stringifyPayload.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare const ANSI_REGEXP: RegExp;
2
+ export declare function stripAnsi(str: string): string;
3
+ //# sourceMappingURL=stripAnsi.d.ts.map
@@ -0,0 +1,4 @@
1
+ import type { AsyncExecutionResult, ExecutionArgs, ExecutionResult } from "graphql";
2
+ import type { PromiseOrValue } from "graphql/jsutils/PromiseOrValue";
3
+ export declare function subscribe(args: ExecutionArgs, resolvedPreset?: GraphileConfig.ResolvedPreset, asString?: boolean): PromiseOrValue<AsyncGenerator<ExecutionResult | AsyncExecutionResult, void, void> | ExecutionResult>;
4
+ //# sourceMappingURL=subscribe.d.ts.map
@@ -0,0 +1,60 @@
1
+ import type { FieldNode, GraphQLEnumValueConfig, GraphQLFieldConfig, GraphQLInputFieldConfig, GraphQLInputObjectTypeConfig, GraphQLInputType, GraphQLNamedType, GraphQLObjectTypeConfig, GraphQLOutputType, GraphQLSchema, ValueNode } from "graphql";
2
+ import { GraphQLEnumType, GraphQLInputObjectType, GraphQLObjectType } from "graphql";
3
+ import type { Deferred } from "./deferred.js";
4
+ import type { OperationPlan } from "./engine/OperationPlan.js";
5
+ import type { InputStep } from "./input.js";
6
+ import type { BaseGraphQLArguments, BaseGraphQLContext, GraphileFieldConfig, GraphileInputFieldConfig, OutputPlanForType } from "./interfaces.js";
7
+ import type { ExecutableStep, ModifierStep } from "./step.js";
8
+ export declare const ROOT_VALUE_OBJECT: any;
9
+ export declare function assertNullPrototype(object: Record<string, unknown>, description: string): void;
10
+ export declare function defaultValueToValueNode(type: GraphQLInputType, defaultValue: unknown): ValueNode | undefined;
11
+ export declare function isPromise<T>(t: T | Promise<T>): t is Promise<T>;
12
+ export declare function isPromiseLike<T>(t: T | Promise<T> | PromiseLike<T>): t is PromiseLike<T>;
13
+ export declare function isDeferred<T>(t: T | Promise<T> | Deferred<T>): t is Deferred<T>;
14
+ export declare function arraysMatch<T>(array1: ReadonlyArray<T>, array2: ReadonlyArray<T>, comparator?: (val1: T, val2: T) => boolean): boolean;
15
+ export declare type ObjectTypeFields<TContext extends BaseGraphQLContext, TParentStep extends ExecutableStep<any>> = {
16
+ [key: string]: GraphileFieldConfig<GraphQLOutputType, TContext, TParentStep, any, any>;
17
+ };
18
+ export declare type ObjectTypeSpec<TContext extends BaseGraphQLContext, TParentStep extends ExecutableStep<any>, TFields extends ObjectTypeFields<TContext, TParentStep>> = Omit<GraphQLObjectTypeConfig<any, TContext>, "fields"> & {
19
+ fields: TFields | (() => TFields);
20
+ };
21
+ export declare function objectSpec<TContext extends BaseGraphQLContext, TParentStep extends ExecutableStep<any>, TFields extends ObjectTypeFields<TContext, TParentStep>>(spec: ObjectTypeSpec<TContext, TParentStep, TFields>, Step: {
22
+ new (...args: any[]): TParentStep;
23
+ } | null): GraphQLObjectTypeConfig<any, TContext>;
24
+ export declare type GraphileObjectType<TContext extends BaseGraphQLContext, TParentStep extends ExecutableStep<any>, TFields extends ObjectTypeFields<TContext, TParentStep>> = GraphQLObjectType<TParentStep extends ExecutableStep<infer U> ? U : never, TContext> & {
25
+ TParentStep: TParentStep;
26
+ TFields: TFields;
27
+ };
28
+ export declare function newObjectTypeBuilder<TContext extends BaseGraphQLContext, TParentStep extends ExecutableStep<any>>(Step: {
29
+ new (...args: any[]): TParentStep;
30
+ }): <TFields extends ObjectTypeFields<TContext, TParentStep>>(spec: ObjectTypeSpec<TContext, TParentStep, TFields>) => GraphileObjectType<TContext, TParentStep, TFields>;
31
+ export declare function objectFieldSpec<TContext extends BaseGraphQLContext, TSource extends ExecutableStep<any>, TResult extends ExecutableStep<any> = ExecutableStep<any>, TArgs extends BaseGraphQLArguments = BaseGraphQLArguments>(graphileSpec: GraphileFieldConfig<GraphQLOutputType, TContext, TSource, TResult, TArgs>): GraphQLFieldConfig<any, TContext, TArgs>;
32
+ export declare function newGraphileFieldConfigBuilder<TContext extends BaseGraphQLContext, TParentStep extends ExecutableStep<any>>(): <TType extends GraphQLOutputType, TFieldStep extends OutputPlanForType<TType>, TArgs extends BaseGraphQLArguments>(config: GraphileFieldConfig<TType, TContext, TParentStep, TFieldStep, TArgs>) => typeof config;
33
+ export declare type GraphileInputFieldConfigMap<TContext extends BaseGraphQLContext, TParentStep extends ModifierStep<any>> = {
34
+ [key: string]: GraphileInputFieldConfig<GraphQLInputType, TContext, TParentStep, any, any>;
35
+ };
36
+ export declare type InputObjectTypeSpec<TContext extends BaseGraphQLContext, TParentStep extends ModifierStep<any>, TFields extends GraphileInputFieldConfigMap<TContext, TParentStep>> = Omit<GraphQLInputObjectTypeConfig, "fields"> & {
37
+ fields: TFields | (() => TFields);
38
+ };
39
+ export declare type GraphileInputObjectType<TContext extends BaseGraphQLContext, TParentStep extends ModifierStep<any>, TFields extends GraphileInputFieldConfigMap<TContext, TParentStep>> = GraphQLInputObjectType & {
40
+ TContext: TContext;
41
+ TParentStep: TParentStep;
42
+ TFields: TFields;
43
+ };
44
+ export declare function newInputObjectTypeBuilder<TContext extends BaseGraphQLContext, TParentStep extends ModifierStep<any>>(): <TFields extends GraphileInputFieldConfigMap<TContext, TParentStep>>(spec: InputObjectTypeSpec<TContext, TParentStep, TFields>) => GraphileInputObjectType<TContext, TParentStep, TFields>;
45
+ export declare function inputObjectFieldSpec<TContext extends BaseGraphQLContext, TParent extends ModifierStep<any>, TResult extends ModifierStep<TParent> = ModifierStep<TParent>, TInput extends InputStep = InputStep>(graphileSpec: GraphileInputFieldConfig<GraphQLInputType, TContext, TParent, TResult, TInput>): GraphQLInputFieldConfig;
46
+ export declare function getEnumValueConfig(enumType: GraphQLEnumType, outputValue: unknown): GraphQLEnumValueConfig | undefined;
47
+ export declare const sharedNull: any;
48
+ export declare function stack(message: string, length?: number): void;
49
+ export declare function arrayOfLength(length: number, fill?: any): any[];
50
+ export declare function arrayOfLengthCb(length: number, fill: () => any): any[];
51
+ export declare function findVariableNamesUsed(operationPlan: OperationPlan, field: FieldNode): string[];
52
+ export declare function isTypePlanned(schema: GraphQLSchema, namedType: GraphQLNamedType): boolean;
53
+ export declare function stepADependsOnStepB(stepA: ExecutableStep, stepB: ExecutableStep): boolean;
54
+ export declare function stepAMayDependOnStepB($a: ExecutableStep, $b: ExecutableStep): boolean;
55
+ export declare function stepsAreInSamePhase(ancestor: ExecutableStep, descendent: ExecutableStep): boolean;
56
+ export declare const canonicalJSONStringify: (o: object) => string;
57
+ export declare const isSafeObjectPropertyName: (key: string) => boolean;
58
+ export declare const canRepresentAsIdentifier: (key: string) => boolean;
59
+ export declare const evalSafeProperty: (key: string) => string;
60
+ //# sourceMappingURL=utils.d.ts.map
package/package.json CHANGED
@@ -1,14 +1,65 @@
1
1
  {
2
2
  "name": "grafast",
3
- "version": "0.0.0",
4
- "description": "Coming 2023!",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
3
+ "version": "0.0.1-0.2",
4
+ "description": "Cutting edge GraphQL planning and execution engine",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "node": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./envelop": {
14
+ "types": "./dist/envelop.d.ts",
15
+ "node": "./dist/envelop.js",
16
+ "default": "./dist/envelop.js"
17
+ }
8
18
  },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/graphile/heart.git"
22
+ },
23
+ "keywords": [
24
+ "grafast",
25
+ "graphile",
26
+ "graphql",
27
+ "performance",
28
+ "fast",
29
+ "engine",
30
+ "graphqljs",
31
+ "execute",
32
+ "plan",
33
+ "planning",
34
+ "grafast",
35
+ "dataplanner",
36
+ "graphite"
37
+ ],
9
38
  "author": "Benjie Gillam <code@benjiegillam.com>",
10
- "license": "MIT",
39
+ "license": "SEE LICENSE IN LICENSE.md",
40
+ "bugs": {
41
+ "url": "https://github.com/graphile/heart/issues"
42
+ },
43
+ "homepage": "https://grafast.org",
44
+ "engines": {
45
+ "node": ">=14.17"
46
+ },
47
+ "dependencies": {
48
+ "@graphile/lru": "^5.0.0-0.1"
49
+ },
50
+ "peerDependencies": {
51
+ "graphile-config": "^0.0.1-0.0",
52
+ "graphql": "*"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "graphile-config": {
56
+ "optional": true
57
+ }
58
+ },
11
59
  "files": [
12
- "index.js"
13
- ]
14
- }
60
+ "dist"
61
+ ],
62
+ "publishConfig": {
63
+ "access": "public"
64
+ }
65
+ }
package/index.js DELETED
@@ -1 +0,0 @@
1
- console.log('Grafast is coming soon!')