@envelop/core 5.5.0-alpha-20251218090930-1420033fa436a73cad5a4a29b1895dabf6483341 → 5.5.0-alpha-20251218153645-a7eb5c97d7bb8b3a6b27e9d95ebcb85e176485f7

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.
@@ -57,7 +57,7 @@ function withState(pluginFactory) {
57
57
  else {
58
58
  result[hookName] = {
59
59
  [hook.name](payload, ...args) {
60
- if (payload && (payload.request || payload.context || payload.executionRequest)) {
60
+ if (payload && Object.getPrototypeOf(payload) === Object.prototype) {
61
61
  return hook({
62
62
  ...payload,
63
63
  get state() {
@@ -53,7 +53,7 @@ export function withState(pluginFactory) {
53
53
  else {
54
54
  result[hookName] = {
55
55
  [hook.name](payload, ...args) {
56
- if (payload && (payload.request || payload.context || payload.executionRequest)) {
56
+ if (payload && Object.getPrototypeOf(payload) === Object.prototype) {
57
57
  return hook({
58
58
  ...payload,
59
59
  get state() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/core",
3
- "version": "5.5.0-alpha-20251218090930-1420033fa436a73cad5a4a29b1895dabf6483341",
3
+ "version": "5.5.0-alpha-20251218153645-a7eb5c97d7bb8b3a6b27e9d95ebcb85e176485f7",
4
4
  "sideEffects": false,
5
5
  "dependencies": {
6
6
  "@whatwg-node/promise-helpers": "^1.2.4",
@@ -1,4 +1,10 @@
1
1
  import { MaybePromise } from '@whatwg-node/promise-helpers';
2
+ /**
3
+ * A function allowing to add a `state` to the payload (first object parameter of any function)
4
+ */
5
+ export declare function withState<P extends {
6
+ instrumentation?: GenericInstrumentation;
7
+ }, HttpState = object, GraphqlState = object, SubExecState = object>(pluginFactory: (getState: <SP extends {}>(payload: SP) => PayloadWithState<SP, HttpState, GraphqlState, SubExecState>['state']) => PluginWithState<P, HttpState, GraphqlState, SubExecState>): P;
2
8
  export declare function withState<P extends {
3
9
  instrumentation?: GenericInstrumentation;
4
10
  }, State = object>(pluginFactory: (getState: <SP extends {}>(payload: SP) => PayloadWithState<SP, State, State, State>['state']) => PluginWithState<P, State, State, State>): P;
@@ -1,4 +1,10 @@
1
1
  import { MaybePromise } from '@whatwg-node/promise-helpers';
2
+ /**
3
+ * A function allowing to add a `state` to the payload (first object parameter of any function)
4
+ */
5
+ export declare function withState<P extends {
6
+ instrumentation?: GenericInstrumentation;
7
+ }, HttpState = object, GraphqlState = object, SubExecState = object>(pluginFactory: (getState: <SP extends {}>(payload: SP) => PayloadWithState<SP, HttpState, GraphqlState, SubExecState>['state']) => PluginWithState<P, HttpState, GraphqlState, SubExecState>): P;
2
8
  export declare function withState<P extends {
3
9
  instrumentation?: GenericInstrumentation;
4
10
  }, State = object>(pluginFactory: (getState: <SP extends {}>(payload: SP) => PayloadWithState<SP, State, State, State>['state']) => PluginWithState<P, State, State, State>): P;