@graphql-mesh/plugin-jwt-auth 1.5.4 → 2.0.0-alpha-1e954fdf19120e1419dd5f0168215cd137bacb28

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @graphql-mesh/plugin-jwt-auth
2
2
 
3
+ ## 2.0.0-alpha-1e954fdf19120e1419dd5f0168215cd137bacb28
4
+
5
+ ### Major Changes
6
+
7
+ - [#1030](https://github.com/graphql-hive/gateway/pull/1030) [`1e954fd`](https://github.com/graphql-hive/gateway/commit/1e954fdf19120e1419dd5f0168215cd137bacb28) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Introduce and use the new Hive Logger
8
+
9
+ - [Read more about it on the Hive Logger documentation here.](https://the-guild.dev/graphql/hive/docs/logger)
10
+ - If coming from Hive Gateway v1, [read the migration guide here.](https://the-guild.dev/graphql/hive/docs/migration-guides/gateway-v1-v2)
11
+
3
12
  ## 1.5.4
4
13
 
5
14
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -38,16 +38,17 @@ function useJWT(options) {
38
38
  executionRequest,
39
39
  subgraphName,
40
40
  setExecutionRequest,
41
- logger
41
+ log
42
42
  }) {
43
43
  if (shouldForward && executionRequest.context?.jwt) {
44
44
  const jwtData = {
45
45
  payload: forwardPayload ? executionRequest.context.jwt.payload : void 0,
46
46
  token: forwardToken ? executionRequest.context.jwt.token : void 0
47
47
  };
48
- logger?.debug(
49
- `Forwarding JWT payload to subgraph ${subgraphName}, payload: `,
50
- jwtData.payload
48
+ log.debug(
49
+ { payload: jwtData.payload },
50
+ "[useJWT] Forwarding JWT payload to subgraph %s",
51
+ subgraphName
51
52
  );
52
53
  setExecutionRequest({
53
54
  ...executionRequest,
package/dist/index.d.cts CHANGED
@@ -2,14 +2,99 @@ import { Plugin, YogaInitialContext, Instrumentation as Instrumentation$2 } from
2
2
  import { DisposableSymbols } from '@whatwg-node/disposablestack';
3
3
  import { ExecutionRequest, ExecutionResult, Executor, MaybePromise as MaybePromise$1, Maybe } from '@graphql-tools/utils';
4
4
  import { GraphQLSchema, OperationTypeNode, GraphQLFieldResolver, GraphQLResolveInfo, GraphQLOutputType, GraphQLError, SelectionSetNode, FragmentDefinitionNode, FieldNode, ExecutionResult as ExecutionResult$1, SelectionNode } from 'graphql';
5
- import { Logger, MeshFetch, KeyValueCache, OnFetchHook } from '@graphql-mesh/types';
6
5
  import DataLoader from 'dataloader';
7
6
  import { GraphQLResolveInfo as GraphQLResolveInfo$1, GraphQLOutputType as GraphQLOutputType$1 } from 'graphql/type';
8
7
  import { MaybePromise } from '@whatwg-node/promise-helpers';
8
+ import { MeshFetch, KeyValueCache, MeshFetchRequestInit, Logger as Logger$1 } from '@graphql-mesh/types';
9
9
  import { FetchInstrumentation } from '@graphql-mesh/utils';
10
10
  import { JwtPluginOptions, JWTExtendContextFields } from '@graphql-yoga/plugin-jwt';
11
11
  export { ExtractTokenFunction, GetSigningKeyFunction, JWTExtendContextFields, JwtPluginOptions, createInlineSigningKeyProvider, createRemoteJwksSigningKeyProvider, extractFromConnectionParams, extractFromCookie, extractFromHeader } from '@graphql-yoga/plugin-jwt';
12
12
 
13
+ type MaybeLazy<T> = T | (() => T);
14
+ type AttributeValue = any;
15
+ type Attributes = AttributeValue[] | {
16
+ [key: string | number]: AttributeValue;
17
+ };
18
+
19
+ interface LogWriter {
20
+ write(level: LogLevel, attrs: Attributes | null | undefined, msg: string | null | undefined): void | Promise<void>;
21
+ }
22
+
23
+ type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';
24
+ interface LoggerOptions {
25
+ /**
26
+ * The minimum log level to log.
27
+ *
28
+ * Providing `false` will disable all logging.
29
+ *
30
+ * Provided function will always be invoked to get the current log level.
31
+ *
32
+ * @default env.LOG_LEVEL || env.DEBUG ? 'debug' : 'info'
33
+ */
34
+ level?: MaybeLazy<LogLevel | false>;
35
+ /** A prefix to include in every log's message. */
36
+ prefix?: string;
37
+ /**
38
+ * The attributes to include in all logs. Is mainly used to pass the parent
39
+ * attributes when creating {@link Logger.child child loggers}.
40
+ */
41
+ attrs?: Attributes;
42
+ /**
43
+ * The log writers to use when writing logs.
44
+ *
45
+ * @default env.LOG_JSON ? [new JSONLogWriter()] : [new ConsoleLogWriter()]
46
+ */
47
+ writers?: [LogWriter, ...LogWriter[]];
48
+ }
49
+ declare class Logger implements AsyncDisposable {
50
+ #private;
51
+ constructor(opts?: LoggerOptions);
52
+ /** The prefix that's prepended to each log message. */
53
+ get prefix(): string | undefined;
54
+ /**
55
+ * The attributes that are added to each log. If the log itself contains
56
+ * attributes with keys existing in {@link attrs}, the log's attributes will
57
+ * override.
58
+ */
59
+ get attrs(): Attributes | undefined;
60
+ /** The current {@link LogLevel} of the logger. You can change the level using the {@link setLevel} method. */
61
+ get level(): false | LogLevel;
62
+ /**
63
+ * Sets the new {@link LogLevel} of the logger. All subsequent logs, and {@link child child loggers} whose
64
+ * level did not change, will respect the new level.
65
+ */
66
+ setLevel(level: MaybeLazy<LogLevel | false>): void;
67
+ write(level: LogLevel, attrs: Attributes | null | undefined, msg: string | null | undefined): void;
68
+ flush(): Promise<void> | undefined;
69
+ [DisposableSymbols.asyncDispose](): Promise<void | undefined>;
70
+ child(prefix: string): Logger;
71
+ child(attrs: Attributes, prefix?: string): Logger;
72
+ log(level: LogLevel): void;
73
+ log(level: LogLevel, attrs: MaybeLazy<Attributes>): void;
74
+ log(level: LogLevel, msg: string, ...interpol: unknown[]): void;
75
+ log(level: LogLevel, attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
76
+ trace(): void;
77
+ trace(attrs: MaybeLazy<Attributes>): void;
78
+ trace(msg: string, ...interpol: unknown[]): void;
79
+ trace(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
80
+ debug(): void;
81
+ debug(attrs: MaybeLazy<Attributes>): void;
82
+ debug(msg: string, ...interpol: unknown[]): void;
83
+ debug(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
84
+ info(): void;
85
+ info(attrs: MaybeLazy<Attributes>): void;
86
+ info(msg: string, ...interpol: unknown[]): void;
87
+ info(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
88
+ warn(): void;
89
+ warn(attrs: MaybeLazy<Attributes>): void;
90
+ warn(msg: string, ...interpol: unknown[]): void;
91
+ warn(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
92
+ error(): void;
93
+ error(attrs: MaybeLazy<Attributes>): void;
94
+ error(msg: string, ...interpol: unknown[]): void;
95
+ error(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
96
+ }
97
+
13
98
  type TopicDataMap = Record<string, any>;
14
99
  interface HivePubSub<Data extends TopicDataMap = TopicDataMap> {
15
100
  /** @deprecated Please use {@link subscribedTopics} if implemented instead. This method will be removed in next major release. */
@@ -130,6 +215,7 @@ type Instrumentation$1 = {
130
215
  */
131
216
  subgraphExecute?: (payload: {
132
217
  executionRequest: ExecutionRequest;
218
+ subgraphName: string;
133
219
  }, wrapped: () => MaybePromise<void>) => MaybePromise<void>;
134
220
  };
135
221
 
@@ -152,8 +238,7 @@ interface OnSubgraphExecutePayload<TContext> {
152
238
  setExecutionRequest(executionRequest: ExecutionRequest): void;
153
239
  executor: Executor;
154
240
  setExecutor(executor: Executor): void;
155
- requestId?: string;
156
- logger?: Logger;
241
+ log: Logger;
157
242
  }
158
243
  interface OnSubgraphExecuteDonePayload {
159
244
  result: AsyncIterable<ExecutionResult$1> | ExecutionResult$1;
@@ -180,8 +265,7 @@ interface OnDelegationPlanHookPayload<TContext> {
180
265
  fragments: Record<string, FragmentDefinitionNode>;
181
266
  fieldNodes: SelectionNode[];
182
267
  context: TContext;
183
- requestId?: string;
184
- logger?: Logger;
268
+ log: Logger;
185
269
  info?: GraphQLResolveInfo$1;
186
270
  delegationPlanBuilder: DelegationPlanBuilder;
187
271
  setDelegationPlanBuilder(delegationPlanBuilder: DelegationPlanBuilder): void;
@@ -204,8 +288,7 @@ interface OnDelegationStageExecutePayload<TContext> {
204
288
  resolver: MergedTypeResolver<TContext>;
205
289
  setResolver: (resolver: MergedTypeResolver<TContext>) => void;
206
290
  typeName: string;
207
- requestId?: string;
208
- logger?: Logger;
291
+ log: Logger;
209
292
  }
210
293
  type OnDelegationStageExecuteDoneHook = (payload: OnDelegationStageExecuteDonePayload) => void;
211
294
  interface OnDelegationStageExecuteDonePayload {
@@ -219,9 +302,9 @@ interface GatewayConfigContext {
219
302
  */
220
303
  fetch: MeshFetch;
221
304
  /**
222
- * The logger to use throught Mesh and it's plugins.
305
+ * The logger to use throught Hive and its plugins.
223
306
  */
224
- logger: Logger;
307
+ log: Logger;
225
308
  /**
226
309
  * Current working directory.
227
310
  */
@@ -246,7 +329,7 @@ interface GatewayContext extends GatewayConfigContext, YogaInitialContext {
246
329
  connectionParams: Record<string, string>;
247
330
  }
248
331
  type GatewayPlugin<TPluginContext extends Record<string, any> = Record<string, any>, TContext extends Record<string, any> = Record<string, any>> = Plugin<Partial<TPluginContext> & GatewayContext & TContext> & UnifiedGraphPlugin<Partial<TPluginContext> & GatewayContext & TContext> & {
249
- onFetch?: OnFetchHook<Partial<TPluginContext> & GatewayContext & TContext>;
332
+ onFetch?: OnFetchHook<Partial<TPluginContext> & TContext>;
250
333
  onCacheGet?: OnCacheGetHook;
251
334
  onCacheSet?: OnCacheSetHook;
252
335
  onCacheDelete?: OnCacheDeleteHook;
@@ -259,6 +342,34 @@ type GatewayPlugin<TPluginContext extends Record<string, any> = Record<string, a
259
342
  */
260
343
  instrumentation?: Instrumentation<TPluginContext & TContext & GatewayContext>;
261
344
  };
345
+ interface OnFetchHookPayload<TContext> {
346
+ url: string;
347
+ setURL(url: URL | string): void;
348
+ options: MeshFetchRequestInit;
349
+ setOptions(options: MeshFetchRequestInit): void;
350
+ /**
351
+ * The context is not available in cases where "fetch" is done in
352
+ * order to pull a supergraph or do some internal work.
353
+ *
354
+ * The logger will be available in all cases.
355
+ */
356
+ context: (GatewayContext & TContext) | {
357
+ log: Logger;
358
+ };
359
+ /** @deprecated Please use `log` from the {@link context} instead. */
360
+ logger: Logger$1;
361
+ info: GraphQLResolveInfo$1;
362
+ fetchFn: MeshFetch;
363
+ setFetchFn: (fetchFn: MeshFetch) => void;
364
+ executionRequest?: ExecutionRequest;
365
+ endResponse: (response$: MaybePromise$1<Response>) => void;
366
+ }
367
+ interface OnFetchHookDonePayload {
368
+ response: Response;
369
+ setResponse: (response: Response) => void;
370
+ }
371
+ type OnFetchHookDone = (payload: OnFetchHookDonePayload) => MaybePromise$1<void>;
372
+ type OnFetchHook<TContext> = (payload: OnFetchHookPayload<TContext>) => MaybePromise$1<void | OnFetchHookDone>;
262
373
  type OnCacheGetHook = (payload: OnCacheGetHookEventPayload) => MaybePromise$1<OnCacheGetHookResult | void>;
263
374
  interface OnCacheGetHookEventPayload {
264
375
  cache: KeyValueCache;
@@ -301,10 +412,6 @@ interface OnCacheDeleteHookEventPayload {
301
412
  }
302
413
  type Instrumentation<TContext extends Record<string, any>> = Instrumentation$2<TContext> & Instrumentation$1 & FetchInstrumentation;
303
414
 
304
- declare global {
305
- var DEBUG: string;
306
- }
307
-
308
415
  type JWTAuthPluginOptions = JwtPluginOptions & {
309
416
  forward?: {
310
417
  payload?: boolean | string;
package/dist/index.d.ts CHANGED
@@ -2,14 +2,99 @@ import { Plugin, YogaInitialContext, Instrumentation as Instrumentation$2 } from
2
2
  import { DisposableSymbols } from '@whatwg-node/disposablestack';
3
3
  import { ExecutionRequest, ExecutionResult, Executor, MaybePromise as MaybePromise$1, Maybe } from '@graphql-tools/utils';
4
4
  import { GraphQLSchema, OperationTypeNode, GraphQLFieldResolver, GraphQLResolveInfo, GraphQLOutputType, GraphQLError, SelectionSetNode, FragmentDefinitionNode, FieldNode, ExecutionResult as ExecutionResult$1, SelectionNode } from 'graphql';
5
- import { Logger, MeshFetch, KeyValueCache, OnFetchHook } from '@graphql-mesh/types';
6
5
  import DataLoader from 'dataloader';
7
6
  import { GraphQLResolveInfo as GraphQLResolveInfo$1, GraphQLOutputType as GraphQLOutputType$1 } from 'graphql/type';
8
7
  import { MaybePromise } from '@whatwg-node/promise-helpers';
8
+ import { MeshFetch, KeyValueCache, MeshFetchRequestInit, Logger as Logger$1 } from '@graphql-mesh/types';
9
9
  import { FetchInstrumentation } from '@graphql-mesh/utils';
10
10
  import { JwtPluginOptions, JWTExtendContextFields } from '@graphql-yoga/plugin-jwt';
11
11
  export { ExtractTokenFunction, GetSigningKeyFunction, JWTExtendContextFields, JwtPluginOptions, createInlineSigningKeyProvider, createRemoteJwksSigningKeyProvider, extractFromConnectionParams, extractFromCookie, extractFromHeader } from '@graphql-yoga/plugin-jwt';
12
12
 
13
+ type MaybeLazy<T> = T | (() => T);
14
+ type AttributeValue = any;
15
+ type Attributes = AttributeValue[] | {
16
+ [key: string | number]: AttributeValue;
17
+ };
18
+
19
+ interface LogWriter {
20
+ write(level: LogLevel, attrs: Attributes | null | undefined, msg: string | null | undefined): void | Promise<void>;
21
+ }
22
+
23
+ type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';
24
+ interface LoggerOptions {
25
+ /**
26
+ * The minimum log level to log.
27
+ *
28
+ * Providing `false` will disable all logging.
29
+ *
30
+ * Provided function will always be invoked to get the current log level.
31
+ *
32
+ * @default env.LOG_LEVEL || env.DEBUG ? 'debug' : 'info'
33
+ */
34
+ level?: MaybeLazy<LogLevel | false>;
35
+ /** A prefix to include in every log's message. */
36
+ prefix?: string;
37
+ /**
38
+ * The attributes to include in all logs. Is mainly used to pass the parent
39
+ * attributes when creating {@link Logger.child child loggers}.
40
+ */
41
+ attrs?: Attributes;
42
+ /**
43
+ * The log writers to use when writing logs.
44
+ *
45
+ * @default env.LOG_JSON ? [new JSONLogWriter()] : [new ConsoleLogWriter()]
46
+ */
47
+ writers?: [LogWriter, ...LogWriter[]];
48
+ }
49
+ declare class Logger implements AsyncDisposable {
50
+ #private;
51
+ constructor(opts?: LoggerOptions);
52
+ /** The prefix that's prepended to each log message. */
53
+ get prefix(): string | undefined;
54
+ /**
55
+ * The attributes that are added to each log. If the log itself contains
56
+ * attributes with keys existing in {@link attrs}, the log's attributes will
57
+ * override.
58
+ */
59
+ get attrs(): Attributes | undefined;
60
+ /** The current {@link LogLevel} of the logger. You can change the level using the {@link setLevel} method. */
61
+ get level(): false | LogLevel;
62
+ /**
63
+ * Sets the new {@link LogLevel} of the logger. All subsequent logs, and {@link child child loggers} whose
64
+ * level did not change, will respect the new level.
65
+ */
66
+ setLevel(level: MaybeLazy<LogLevel | false>): void;
67
+ write(level: LogLevel, attrs: Attributes | null | undefined, msg: string | null | undefined): void;
68
+ flush(): Promise<void> | undefined;
69
+ [DisposableSymbols.asyncDispose](): Promise<void | undefined>;
70
+ child(prefix: string): Logger;
71
+ child(attrs: Attributes, prefix?: string): Logger;
72
+ log(level: LogLevel): void;
73
+ log(level: LogLevel, attrs: MaybeLazy<Attributes>): void;
74
+ log(level: LogLevel, msg: string, ...interpol: unknown[]): void;
75
+ log(level: LogLevel, attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
76
+ trace(): void;
77
+ trace(attrs: MaybeLazy<Attributes>): void;
78
+ trace(msg: string, ...interpol: unknown[]): void;
79
+ trace(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
80
+ debug(): void;
81
+ debug(attrs: MaybeLazy<Attributes>): void;
82
+ debug(msg: string, ...interpol: unknown[]): void;
83
+ debug(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
84
+ info(): void;
85
+ info(attrs: MaybeLazy<Attributes>): void;
86
+ info(msg: string, ...interpol: unknown[]): void;
87
+ info(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
88
+ warn(): void;
89
+ warn(attrs: MaybeLazy<Attributes>): void;
90
+ warn(msg: string, ...interpol: unknown[]): void;
91
+ warn(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
92
+ error(): void;
93
+ error(attrs: MaybeLazy<Attributes>): void;
94
+ error(msg: string, ...interpol: unknown[]): void;
95
+ error(attrs: MaybeLazy<Attributes>, msg: string, ...interpol: unknown[]): void;
96
+ }
97
+
13
98
  type TopicDataMap = Record<string, any>;
14
99
  interface HivePubSub<Data extends TopicDataMap = TopicDataMap> {
15
100
  /** @deprecated Please use {@link subscribedTopics} if implemented instead. This method will be removed in next major release. */
@@ -130,6 +215,7 @@ type Instrumentation$1 = {
130
215
  */
131
216
  subgraphExecute?: (payload: {
132
217
  executionRequest: ExecutionRequest;
218
+ subgraphName: string;
133
219
  }, wrapped: () => MaybePromise<void>) => MaybePromise<void>;
134
220
  };
135
221
 
@@ -152,8 +238,7 @@ interface OnSubgraphExecutePayload<TContext> {
152
238
  setExecutionRequest(executionRequest: ExecutionRequest): void;
153
239
  executor: Executor;
154
240
  setExecutor(executor: Executor): void;
155
- requestId?: string;
156
- logger?: Logger;
241
+ log: Logger;
157
242
  }
158
243
  interface OnSubgraphExecuteDonePayload {
159
244
  result: AsyncIterable<ExecutionResult$1> | ExecutionResult$1;
@@ -180,8 +265,7 @@ interface OnDelegationPlanHookPayload<TContext> {
180
265
  fragments: Record<string, FragmentDefinitionNode>;
181
266
  fieldNodes: SelectionNode[];
182
267
  context: TContext;
183
- requestId?: string;
184
- logger?: Logger;
268
+ log: Logger;
185
269
  info?: GraphQLResolveInfo$1;
186
270
  delegationPlanBuilder: DelegationPlanBuilder;
187
271
  setDelegationPlanBuilder(delegationPlanBuilder: DelegationPlanBuilder): void;
@@ -204,8 +288,7 @@ interface OnDelegationStageExecutePayload<TContext> {
204
288
  resolver: MergedTypeResolver<TContext>;
205
289
  setResolver: (resolver: MergedTypeResolver<TContext>) => void;
206
290
  typeName: string;
207
- requestId?: string;
208
- logger?: Logger;
291
+ log: Logger;
209
292
  }
210
293
  type OnDelegationStageExecuteDoneHook = (payload: OnDelegationStageExecuteDonePayload) => void;
211
294
  interface OnDelegationStageExecuteDonePayload {
@@ -219,9 +302,9 @@ interface GatewayConfigContext {
219
302
  */
220
303
  fetch: MeshFetch;
221
304
  /**
222
- * The logger to use throught Mesh and it's plugins.
305
+ * The logger to use throught Hive and its plugins.
223
306
  */
224
- logger: Logger;
307
+ log: Logger;
225
308
  /**
226
309
  * Current working directory.
227
310
  */
@@ -246,7 +329,7 @@ interface GatewayContext extends GatewayConfigContext, YogaInitialContext {
246
329
  connectionParams: Record<string, string>;
247
330
  }
248
331
  type GatewayPlugin<TPluginContext extends Record<string, any> = Record<string, any>, TContext extends Record<string, any> = Record<string, any>> = Plugin<Partial<TPluginContext> & GatewayContext & TContext> & UnifiedGraphPlugin<Partial<TPluginContext> & GatewayContext & TContext> & {
249
- onFetch?: OnFetchHook<Partial<TPluginContext> & GatewayContext & TContext>;
332
+ onFetch?: OnFetchHook<Partial<TPluginContext> & TContext>;
250
333
  onCacheGet?: OnCacheGetHook;
251
334
  onCacheSet?: OnCacheSetHook;
252
335
  onCacheDelete?: OnCacheDeleteHook;
@@ -259,6 +342,34 @@ type GatewayPlugin<TPluginContext extends Record<string, any> = Record<string, a
259
342
  */
260
343
  instrumentation?: Instrumentation<TPluginContext & TContext & GatewayContext>;
261
344
  };
345
+ interface OnFetchHookPayload<TContext> {
346
+ url: string;
347
+ setURL(url: URL | string): void;
348
+ options: MeshFetchRequestInit;
349
+ setOptions(options: MeshFetchRequestInit): void;
350
+ /**
351
+ * The context is not available in cases where "fetch" is done in
352
+ * order to pull a supergraph or do some internal work.
353
+ *
354
+ * The logger will be available in all cases.
355
+ */
356
+ context: (GatewayContext & TContext) | {
357
+ log: Logger;
358
+ };
359
+ /** @deprecated Please use `log` from the {@link context} instead. */
360
+ logger: Logger$1;
361
+ info: GraphQLResolveInfo$1;
362
+ fetchFn: MeshFetch;
363
+ setFetchFn: (fetchFn: MeshFetch) => void;
364
+ executionRequest?: ExecutionRequest;
365
+ endResponse: (response$: MaybePromise$1<Response>) => void;
366
+ }
367
+ interface OnFetchHookDonePayload {
368
+ response: Response;
369
+ setResponse: (response: Response) => void;
370
+ }
371
+ type OnFetchHookDone = (payload: OnFetchHookDonePayload) => MaybePromise$1<void>;
372
+ type OnFetchHook<TContext> = (payload: OnFetchHookPayload<TContext>) => MaybePromise$1<void | OnFetchHookDone>;
262
373
  type OnCacheGetHook = (payload: OnCacheGetHookEventPayload) => MaybePromise$1<OnCacheGetHookResult | void>;
263
374
  interface OnCacheGetHookEventPayload {
264
375
  cache: KeyValueCache;
@@ -301,10 +412,6 @@ interface OnCacheDeleteHookEventPayload {
301
412
  }
302
413
  type Instrumentation<TContext extends Record<string, any>> = Instrumentation$2<TContext> & Instrumentation$1 & FetchInstrumentation;
303
414
 
304
- declare global {
305
- var DEBUG: string;
306
- }
307
-
308
415
  type JWTAuthPluginOptions = JwtPluginOptions & {
309
416
  forward?: {
310
417
  payload?: boolean | string;
package/dist/index.js CHANGED
@@ -35,16 +35,17 @@ function useJWT(options) {
35
35
  executionRequest,
36
36
  subgraphName,
37
37
  setExecutionRequest,
38
- logger
38
+ log
39
39
  }) {
40
40
  if (shouldForward && executionRequest.context?.jwt) {
41
41
  const jwtData = {
42
42
  payload: forwardPayload ? executionRequest.context.jwt.payload : void 0,
43
43
  token: forwardToken ? executionRequest.context.jwt.token : void 0
44
44
  };
45
- logger?.debug(
46
- `Forwarding JWT payload to subgraph ${subgraphName}, payload: `,
47
- jwtData.payload
45
+ log.debug(
46
+ { payload: jwtData.payload },
47
+ "[useJWT] Forwarding JWT payload to subgraph %s",
48
+ subgraphName
48
49
  );
49
50
  setExecutionRequest({
50
51
  ...executionRequest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/plugin-jwt-auth",
3
- "version": "1.5.4",
3
+ "version": "2.0.0-alpha-1e954fdf19120e1419dd5f0168215cd137bacb28",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",