@graphql-tools/executor 0.0.1 → 0.0.2-alpha-20221029152711-14f4f7a7

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 (45) hide show
  1. package/cjs/directives/defer.js +23 -0
  2. package/cjs/directives/index.js +5 -0
  3. package/cjs/directives/stream.js +28 -0
  4. package/cjs/execution/AccumulatorMap.js +21 -0
  5. package/cjs/execution/collectFields.js +126 -0
  6. package/cjs/execution/execute.js +656 -109
  7. package/cjs/execution/flattenAsyncIterable.js +91 -0
  8. package/cjs/execution/invariant.js +9 -0
  9. package/cjs/execution/promiseForObject.js +21 -0
  10. package/cjs/index.js +1 -0
  11. package/esm/directives/defer.js +20 -0
  12. package/esm/directives/index.js +2 -0
  13. package/esm/directives/stream.js +25 -0
  14. package/esm/execution/AccumulatorMap.js +17 -0
  15. package/esm/execution/collectFields.js +122 -0
  16. package/esm/execution/execute.js +653 -108
  17. package/esm/execution/flattenAsyncIterable.js +87 -0
  18. package/esm/execution/invariant.js +5 -0
  19. package/esm/execution/promiseForObject.js +17 -0
  20. package/esm/index.js +1 -0
  21. package/package.json +2 -2
  22. package/typings/directives/defer.d.cts +5 -0
  23. package/typings/directives/defer.d.ts +5 -0
  24. package/typings/directives/index.d.cts +2 -0
  25. package/typings/directives/index.d.ts +2 -0
  26. package/typings/directives/stream.d.cts +5 -0
  27. package/typings/directives/stream.d.ts +5 -0
  28. package/typings/execution/AccumulatorMap.d.cts +7 -0
  29. package/typings/execution/AccumulatorMap.d.ts +7 -0
  30. package/typings/execution/collectFields.d.cts +32 -0
  31. package/typings/execution/collectFields.d.ts +32 -0
  32. package/typings/execution/execute.d.cts +167 -22
  33. package/typings/execution/execute.d.ts +167 -22
  34. package/typings/execution/flattenAsyncIterable.d.cts +7 -0
  35. package/typings/execution/flattenAsyncIterable.d.ts +7 -0
  36. package/typings/execution/invariant.d.cts +1 -0
  37. package/typings/execution/invariant.d.ts +1 -0
  38. package/typings/execution/promiseForObject.d.cts +12 -0
  39. package/typings/execution/promiseForObject.d.ts +12 -0
  40. package/typings/index.d.cts +1 -0
  41. package/typings/index.d.ts +1 -0
  42. package/cjs/execution/subscribe.js +0 -158
  43. package/esm/execution/subscribe.js +0 -153
  44. package/typings/execution/subscribe.d.cts +0 -59
  45. package/typings/execution/subscribe.d.ts +0 -59
@@ -1,59 +0,0 @@
1
- import { GraphQLFieldResolver, GraphQLSchema } from 'graphql';
2
- import { Maybe, ExecutionResult } from '@graphql-tools/utils';
3
- import type { ExecutionArgs } from './execute.cjs';
4
- import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
- /**
6
- * Implements the "Subscribe" algorithm described in the GraphQL specification.
7
- *
8
- * Returns a Promise which resolves to either an AsyncIterator (if successful)
9
- * or an ExecutionResult (error). The promise will be rejected if the schema or
10
- * other arguments to this function are invalid, or if the resolved event stream
11
- * is not an async iterable.
12
- *
13
- * If the client-provided arguments to this function do not result in a
14
- * compliant subscription, a GraphQL Response (ExecutionResult) with
15
- * descriptive errors and no data will be returned.
16
- *
17
- * If the source stream could not be created due to faulty subscription
18
- * resolver logic or underlying systems, the promise will resolve to a single
19
- * ExecutionResult containing `errors` and no `data`.
20
- *
21
- * If the operation succeeded, the promise resolves to an AsyncIterator, which
22
- * yields a stream of ExecutionResults representing the response stream.
23
- *
24
- * Accepts either an object with named arguments, or individual arguments.
25
- */
26
- export declare function subscribe(args: ExecutionArgs): Promise<AsyncIterable<ExecutionResult> | ExecutionResult>;
27
- /**
28
- * Implements the "CreateSourceEventStream" algorithm described in the
29
- * GraphQL specification, resolving the subscription source event stream.
30
- *
31
- * Returns a Promise which resolves to either an AsyncIterable (if successful)
32
- * or an ExecutionResult (error). The promise will be rejected if the schema or
33
- * other arguments to this function are invalid, or if the resolved event stream
34
- * is not an async iterable.
35
- *
36
- * If the client-provided arguments to this function do not result in a
37
- * compliant subscription, a GraphQL Response (ExecutionResult) with
38
- * descriptive errors and no data will be returned.
39
- *
40
- * If the the source stream could not be created due to faulty subscription
41
- * resolver logic or underlying systems, the promise will resolve to a single
42
- * ExecutionResult containing `errors` and no `data`.
43
- *
44
- * If the operation succeeded, the promise resolves to the AsyncIterable for the
45
- * event stream returned by the resolver.
46
- *
47
- * A Source Event Stream represents a sequence of events, each of which triggers
48
- * a GraphQL execution for that event.
49
- *
50
- * This may be useful when hosting the stateful subscription service in a
51
- * different process or machine than the stateless GraphQL execution engine,
52
- * or otherwise separating these two steps. For more on this, see the
53
- * "Supporting Subscriptions at Scale" information in the GraphQL specification.
54
- */
55
- export declare function createSourceEventStream<TData = {
56
- [key: string]: any;
57
- }, TVariables = {
58
- [key: string]: any;
59
- }, TContext = any>(schema: GraphQLSchema, document: TypedDocumentNode<TData, TVariables>, rootValue?: unknown, contextValue?: TContext, variableValues?: TVariables, operationName?: Maybe<string>, subscribeFieldResolver?: Maybe<GraphQLFieldResolver<any, TContext>>): Promise<AsyncIterable<unknown> | ExecutionResult>;
@@ -1,59 +0,0 @@
1
- import { GraphQLFieldResolver, GraphQLSchema } from 'graphql';
2
- import { Maybe, ExecutionResult } from '@graphql-tools/utils';
3
- import type { ExecutionArgs } from './execute.js';
4
- import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
- /**
6
- * Implements the "Subscribe" algorithm described in the GraphQL specification.
7
- *
8
- * Returns a Promise which resolves to either an AsyncIterator (if successful)
9
- * or an ExecutionResult (error). The promise will be rejected if the schema or
10
- * other arguments to this function are invalid, or if the resolved event stream
11
- * is not an async iterable.
12
- *
13
- * If the client-provided arguments to this function do not result in a
14
- * compliant subscription, a GraphQL Response (ExecutionResult) with
15
- * descriptive errors and no data will be returned.
16
- *
17
- * If the source stream could not be created due to faulty subscription
18
- * resolver logic or underlying systems, the promise will resolve to a single
19
- * ExecutionResult containing `errors` and no `data`.
20
- *
21
- * If the operation succeeded, the promise resolves to an AsyncIterator, which
22
- * yields a stream of ExecutionResults representing the response stream.
23
- *
24
- * Accepts either an object with named arguments, or individual arguments.
25
- */
26
- export declare function subscribe(args: ExecutionArgs): Promise<AsyncIterable<ExecutionResult> | ExecutionResult>;
27
- /**
28
- * Implements the "CreateSourceEventStream" algorithm described in the
29
- * GraphQL specification, resolving the subscription source event stream.
30
- *
31
- * Returns a Promise which resolves to either an AsyncIterable (if successful)
32
- * or an ExecutionResult (error). The promise will be rejected if the schema or
33
- * other arguments to this function are invalid, or if the resolved event stream
34
- * is not an async iterable.
35
- *
36
- * If the client-provided arguments to this function do not result in a
37
- * compliant subscription, a GraphQL Response (ExecutionResult) with
38
- * descriptive errors and no data will be returned.
39
- *
40
- * If the the source stream could not be created due to faulty subscription
41
- * resolver logic or underlying systems, the promise will resolve to a single
42
- * ExecutionResult containing `errors` and no `data`.
43
- *
44
- * If the operation succeeded, the promise resolves to the AsyncIterable for the
45
- * event stream returned by the resolver.
46
- *
47
- * A Source Event Stream represents a sequence of events, each of which triggers
48
- * a GraphQL execution for that event.
49
- *
50
- * This may be useful when hosting the stateful subscription service in a
51
- * different process or machine than the stateless GraphQL execution engine,
52
- * or otherwise separating these two steps. For more on this, see the
53
- * "Supporting Subscriptions at Scale" information in the GraphQL specification.
54
- */
55
- export declare function createSourceEventStream<TData = {
56
- [key: string]: any;
57
- }, TVariables = {
58
- [key: string]: any;
59
- }, TContext = any>(schema: GraphQLSchema, document: TypedDocumentNode<TData, TVariables>, rootValue?: unknown, contextValue?: TContext, variableValues?: TVariables, operationName?: Maybe<string>, subscribeFieldResolver?: Maybe<GraphQLFieldResolver<any, TContext>>): Promise<AsyncIterable<unknown> | ExecutionResult>;