@envelop/core 1.5.0-alpha-4b48fe8.0 → 1.5.0
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/index.js +8 -0
- package/index.mjs +8 -0
- package/orchestrator.d.ts +1 -2
- package/package.json +3 -3
- package/utils.d.ts +5 -6
package/index.js
CHANGED
|
@@ -422,6 +422,8 @@ function createEnvelopOrchestrator(plugins) {
|
|
|
422
422
|
let result = await subscribeFn({
|
|
423
423
|
...args,
|
|
424
424
|
contextValue: context,
|
|
425
|
+
// Casted for GraphQL.js 15 compatibility
|
|
426
|
+
// Can be removed once we drop support for GraphQL.js 15
|
|
425
427
|
});
|
|
426
428
|
const onNextHandler = [];
|
|
427
429
|
const onEndHandler = [];
|
|
@@ -659,12 +661,16 @@ function traceOrchestrator(orchestrator) {
|
|
|
659
661
|
typeResolver,
|
|
660
662
|
}
|
|
661
663
|
: argsOrSchema;
|
|
664
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
665
|
+
// @ts-ignore GraphQL.js types contextValue as unknown
|
|
662
666
|
const done = createTracer('execute', args.contextValue || {});
|
|
663
667
|
try {
|
|
664
668
|
const result = await orchestrator.execute(args);
|
|
665
669
|
done();
|
|
666
670
|
if (!types.isAsyncIterable(result)) {
|
|
667
671
|
result.extensions = result.extensions || {};
|
|
672
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
673
|
+
// @ts-ignore GraphQL.js types contextValue as unknown
|
|
668
674
|
result.extensions.envelopTracing = args.contextValue._envelopTracing;
|
|
669
675
|
}
|
|
670
676
|
else {
|
|
@@ -691,6 +697,8 @@ function traceOrchestrator(orchestrator) {
|
|
|
691
697
|
subscribeFieldResolver,
|
|
692
698
|
}
|
|
693
699
|
: argsOrSchema;
|
|
700
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
701
|
+
// @ts-ignore GraphQL.js types contextValue as unknown
|
|
694
702
|
const done = createTracer('subscribe', args.contextValue || {});
|
|
695
703
|
try {
|
|
696
704
|
return await orchestrator.subscribe(args);
|
package/index.mjs
CHANGED
|
@@ -419,6 +419,8 @@ function createEnvelopOrchestrator(plugins) {
|
|
|
419
419
|
let result = await subscribeFn({
|
|
420
420
|
...args,
|
|
421
421
|
contextValue: context,
|
|
422
|
+
// Casted for GraphQL.js 15 compatibility
|
|
423
|
+
// Can be removed once we drop support for GraphQL.js 15
|
|
422
424
|
});
|
|
423
425
|
const onNextHandler = [];
|
|
424
426
|
const onEndHandler = [];
|
|
@@ -656,12 +658,16 @@ function traceOrchestrator(orchestrator) {
|
|
|
656
658
|
typeResolver,
|
|
657
659
|
}
|
|
658
660
|
: argsOrSchema;
|
|
661
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
662
|
+
// @ts-ignore GraphQL.js types contextValue as unknown
|
|
659
663
|
const done = createTracer('execute', args.contextValue || {});
|
|
660
664
|
try {
|
|
661
665
|
const result = await orchestrator.execute(args);
|
|
662
666
|
done();
|
|
663
667
|
if (!isAsyncIterable(result)) {
|
|
664
668
|
result.extensions = result.extensions || {};
|
|
669
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
670
|
+
// @ts-ignore GraphQL.js types contextValue as unknown
|
|
665
671
|
result.extensions.envelopTracing = args.contextValue._envelopTracing;
|
|
666
672
|
}
|
|
667
673
|
else {
|
|
@@ -688,6 +694,8 @@ function traceOrchestrator(orchestrator) {
|
|
|
688
694
|
subscribeFieldResolver,
|
|
689
695
|
}
|
|
690
696
|
: argsOrSchema;
|
|
697
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
698
|
+
// @ts-ignore GraphQL.js types contextValue as unknown
|
|
691
699
|
const done = createTracer('subscribe', args.contextValue || {});
|
|
692
700
|
try {
|
|
693
701
|
return await orchestrator.subscribe(args);
|
package/orchestrator.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ArbitraryObject, EnvelopContextFnWrapper, GetEnvelopedFn, Plugin, DefaultContext } from '@envelop/types';
|
|
1
|
+
import { ArbitraryObject, EnvelopContextFnWrapper, GetEnvelopedFn, Plugin, DefaultContext, Maybe } from '@envelop/types';
|
|
2
2
|
import { GraphQLSchema } from 'graphql';
|
|
3
|
-
import { Maybe } from 'graphql/jsutils/Maybe';
|
|
4
3
|
export declare type EnvelopOrchestrator<InitialContext extends ArbitraryObject = ArbitraryObject, PluginsContext extends ArbitraryObject = ArbitraryObject> = {
|
|
5
4
|
init: (initialContext?: Maybe<InitialContext>) => void;
|
|
6
5
|
parse: EnvelopContextFnWrapper<ReturnType<GetEnvelopedFn<PluginsContext>>['parse'], InitialContext>;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/core",
|
|
3
|
-
"version": "1.5.0
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"graphql": "^14.0.0 || ^15.0.0"
|
|
6
|
+
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@envelop/types": "1.
|
|
9
|
+
"@envelop/types": "1.4.0"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
package/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ASTNode, DocumentNode, OperationDefinitionNode, Source, ExecutionResult, SubscriptionArgs, ExecutionArgs } from 'graphql';
|
|
2
|
-
import { AsyncIterableIteratorOrValue, ExecuteFunction, SubscribeFunction } from '@envelop/types';
|
|
3
|
-
import { PromiseOrValue } from 'graphql/jsutils/PromiseOrValue';
|
|
2
|
+
import { AsyncIterableIteratorOrValue, ExecuteFunction, SubscribeFunction, PromiseOrValue } from '@envelop/types';
|
|
4
3
|
export declare const envelopIsIntrospectionSymbol: unique symbol;
|
|
5
4
|
export declare function isOperationDefinition(def: ASTNode): def is OperationDefinitionNode;
|
|
6
5
|
export declare function isIntrospectionOperation(operation: OperationDefinitionNode): boolean;
|
|
@@ -9,11 +8,11 @@ export declare function isIntrospectionOperationString(operation: string | Sourc
|
|
|
9
8
|
/**
|
|
10
9
|
* Utility function for making a subscribe function that handles polymorphic arguments.
|
|
11
10
|
*/
|
|
12
|
-
export declare const makeSubscribe: (subscribeFn: (args: SubscriptionArgs) => PromiseOrValue<AsyncIterableIterator<ExecutionResult
|
|
13
|
-
export declare function mapAsyncIterator<TInput, TOutput = TInput>(asyncIterable:
|
|
11
|
+
export declare const makeSubscribe: (subscribeFn: (args: SubscriptionArgs) => PromiseOrValue<AsyncIterableIterator<ExecutionResult>>) => SubscribeFunction;
|
|
12
|
+
export declare function mapAsyncIterator<TInput, TOutput = TInput>(asyncIterable: AsyncIterable<TInput>, map: (input: TInput) => Promise<TOutput> | TOutput): AsyncIterableIterator<TOutput>;
|
|
14
13
|
/**
|
|
15
14
|
* Utility function for making a execute function that handles polymorphic arguments.
|
|
16
15
|
*/
|
|
17
16
|
export declare const makeExecute: (executeFn: (args: ExecutionArgs) => PromiseOrValue<AsyncIterableIteratorOrValue<ExecutionResult>>) => ExecuteFunction;
|
|
18
|
-
export declare function finalAsyncIterator<TInput>(asyncIterable:
|
|
19
|
-
export declare function errorAsyncIterator<TInput>(asyncIterable:
|
|
17
|
+
export declare function finalAsyncIterator<TInput>(asyncIterable: AsyncIterable<TInput>, onFinal: () => void): AsyncIterableIterator<TInput>;
|
|
18
|
+
export declare function errorAsyncIterator<TInput>(asyncIterable: AsyncIterable<TInput>, onError: (err: unknown) => void): AsyncIterableIterator<TInput>;
|