@envelop/execute-subscription-event 2.4.1 → 2.4.3-alpha-62b6e087.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/package.json +4 -4
- package/typings/index.d.cts +14 -0
- package/typings/subscribe.d.cts +6 -0
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/execute-subscription-event",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3-alpha-62b6e087.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "
|
|
6
|
+
"@envelop/core": "2.4.3-alpha-62b6e087.0",
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
26
|
"require": {
|
|
27
|
-
"types": "./typings/index.d.
|
|
27
|
+
"types": "./typings/index.d.cts",
|
|
28
28
|
"default": "./cjs/index.js"
|
|
29
29
|
},
|
|
30
30
|
"import": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"./*": {
|
|
40
40
|
"require": {
|
|
41
|
-
"types": "./typings/*.d.
|
|
41
|
+
"types": "./typings/*.d.cts",
|
|
42
42
|
"default": "./cjs/*.js"
|
|
43
43
|
},
|
|
44
44
|
"import": {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SubscriptionArgs } from 'graphql';
|
|
2
|
+
import { Plugin, PromiseOrValue, DefaultContext } from '@envelop/core';
|
|
3
|
+
export declare type ContextFactoryOptions = {
|
|
4
|
+
/** The arguments with which the subscription was set up. */
|
|
5
|
+
args: SubscriptionArgs;
|
|
6
|
+
};
|
|
7
|
+
export declare type ContextFactoryHook<TContextValue> = {
|
|
8
|
+
/** Context that will be used for the "ExecuteSubscriptionEvent" phase. */
|
|
9
|
+
contextPartial: Partial<TContextValue>;
|
|
10
|
+
/** Optional callback that is invoked once the "ExecuteSubscriptionEvent" phase has ended. Useful for cleanup, such as tearing down database connections. */
|
|
11
|
+
onEnd?: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare type ContextFactoryType<TContextValue = DefaultContext> = (options: ContextFactoryOptions) => PromiseOrValue<ContextFactoryHook<TContextValue> | void>;
|
|
14
|
+
export declare const useExtendContextValuePerExecuteSubscriptionEvent: <TContextValue = unknown>(createContext: ContextFactoryType<TContextValue>) => Plugin<TContextValue>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecuteFunction, SubscribeFunction } from '@envelop/core';
|
|
2
|
+
/**
|
|
3
|
+
* This is a almost identical port from graphql-js subscribe.
|
|
4
|
+
* The only difference is that a custom `execute` function can be injected for customizing the behavior.
|
|
5
|
+
*/
|
|
6
|
+
export declare const subscribe: (execute: ExecuteFunction) => SubscribeFunction;
|