@graphql-box/worker-client 5.4.6 → 5.4.7

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.
@@ -1,18 +1,28 @@
1
1
  import { type CoreWorker } from '@cachemap/core-worker';
2
+ import { type CacheManagerDef } from '@graphql-box/cache-manager';
2
3
  import { type PartialRequestContext, type PartialRequestResult, type RequestOptions } from '@graphql-box/core';
3
4
  import { type UserOptions } from './types.ts';
4
5
  export declare class WorkerClient {
5
6
  private static _getMessageContext;
7
+ private static _resolve;
6
8
  private _onMessage;
9
+ /**
10
+ * This cache instance does not actually store anything itself,
11
+ * it is for communicating with the worker cache that the worker
12
+ * client is using within the worker.
13
+ */
7
14
  private _cache;
15
+ private _cacheManager;
8
16
  private _debugManager;
9
17
  private _eventEmitter;
10
18
  private _experimentalDeferStreamSupport;
11
19
  private _messageQueue;
12
20
  private _pending;
21
+ private _requestParser;
13
22
  private _worker;
14
23
  constructor(options: UserOptions);
15
24
  get cache(): CoreWorker;
25
+ get cacheManager(): CacheManagerDef;
16
26
  mutate(request: string, options?: RequestOptions, context?: PartialRequestContext): Promise<PartialRequestResult<import("@graphql-box/core").PlainData<unknown> | null> | AsyncIterableIterator<PartialRequestResult<import("@graphql-box/core").PlainData<unknown> | null> | undefined>>;
17
27
  query(request: string, options?: RequestOptions, context?: PartialRequestContext): Promise<PartialRequestResult<import("@graphql-box/core").PlainData<unknown> | null> | AsyncIterableIterator<PartialRequestResult<import("@graphql-box/core").PlainData<unknown> | null> | undefined>>;
18
28
  request(request: string, options?: RequestOptions, context?: PartialRequestContext): Promise<PartialRequestResult<import("@graphql-box/core").PlainData<unknown> | null> | AsyncIterableIterator<PartialRequestResult<import("@graphql-box/core").PlainData<unknown> | null> | undefined>>;
@@ -20,6 +30,7 @@ export declare class WorkerClient {
20
30
  set worker(worker: Worker);
21
31
  private _addEventListener;
22
32
  private _getRequestContext;
33
+ private _query;
23
34
  private _releaseMessageQueue;
24
35
  private _request;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iBAAiB;IAQzB,OAAO,CAAC,kBAAkB;YAuBZ,MAAM;IA4CpB,OAAO,CAAC,oBAAoB;YAcd,QAAQ;IAqCtB,OAAO,CAAC,UAAU;CAkCnB"}
@@ -1,11 +1,18 @@
1
1
  import { type CoreWorker } from '@cachemap/core-worker';
2
+ import { type CacheManagerDef } from '@graphql-box/cache-manager';
2
3
  import { type Client } from '@graphql-box/client';
3
- import { type DebugManagerDef, type PartialRawFetchData, type PartialRequestResult, type RequestOptions } from '@graphql-box/core';
4
+ import { type DebugManagerDef, type PartialRawFetchData, type PartialRequestResult, type RequestContext, type RequestData, type RequestOptions } from '@graphql-box/core';
5
+ import { type RequestParserDef } from '@graphql-box/request-parser';
6
+ import { type OperationTypeNode } from 'graphql';
4
7
  export interface UserOptions {
5
8
  /**
6
9
  * The cache.
7
10
  */
8
11
  cache: CoreWorker;
12
+ /**
13
+ * The curried function to initialize the cache manager.
14
+ */
15
+ cacheManager: CacheManagerDef;
9
16
  /**
10
17
  * The debug manager.
11
18
  */
@@ -20,6 +27,10 @@ export interface UserOptions {
20
27
  * initialise the worker after the constructor.
21
28
  */
22
29
  lazyWorkerInit?: boolean;
30
+ /**
31
+ * The curried function to initialzie the request parser.
32
+ */
33
+ requestParser: RequestParserDef;
23
34
  /**
24
35
  * The web worker instance.
25
36
  */
@@ -28,6 +39,9 @@ export interface UserOptions {
28
39
  export type MethodNames = 'request' | 'subscribe';
29
40
  export type PendingResolver = (value: PartialRequestResult | AsyncIterableIterator<PartialRequestResult | undefined>) => void;
30
41
  export interface PendingData {
42
+ context?: RequestContext;
43
+ options?: RequestOptions;
44
+ requestData?: RequestData;
31
45
  resolve: PendingResolver;
32
46
  }
33
47
  export type PendingTracker = Map<string, PendingData>;
@@ -46,6 +60,7 @@ export interface MessageResponsePayload {
46
60
  }
47
61
  export interface MessageContext {
48
62
  hasDeferOrStream: boolean;
63
+ operation: OperationTypeNode;
49
64
  requestID: string;
50
65
  }
51
66
  export interface RegisterWorkerOptions {
@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