@vladimirdev635/gql-client 0.0.43 → 0.0.45

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vladimirdev635/gql-client",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/parser.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { ClientParser, Operation, RequestContext } from './types/index.js';
2
- import { ClientParserParseBodyOptions } from './types/parser.js';
1
+ import { ClientParser, Operation, RequestContext, ClientParserParseBodyOptions } from './types/index.js';
3
2
  export interface CreateParserOptions<TClientContext, TRequestContext extends RequestContext> {
4
3
  onErrors: <T extends Operation>(options: ClientParserParseBodyOptions<TClientContext, TRequestContext, T>, errors: any[]) => Promise<void> | void;
5
4
  }
package/parser.js CHANGED
@@ -13,13 +13,13 @@ export function createParser(parserOptions = defaultParserOptions) {
13
13
  }
14
14
  assert(options.response.headers.get('content-type') ===
15
15
  'text/event-stream');
16
- const stream = options.response.body;
17
- assert(stream !== null);
18
- const reader = stream.getReader();
16
+ const rStream = options.response.body;
17
+ assert(rStream !== null);
18
+ const reader = rStream.getReader();
19
19
  const decoder = new TextDecoder();
20
20
  let shouldClose = false;
21
- const cancel = () => shouldClose = true;
22
- const streamGen = async function* () {
21
+ const close = () => shouldClose = true;
22
+ const stream = async function* () {
23
23
  while (!shouldClose) {
24
24
  const readResult = await reader.read();
25
25
  if (readResult.done || shouldClose)
@@ -36,7 +36,7 @@ export function createParser(parserOptions = defaultParserOptions) {
36
36
  }
37
37
  }
38
38
  }();
39
- return { stream: streamGen, cancel };
39
+ return { stream, close };
40
40
  }
41
41
  const json = await options.response.json();
42
42
  if (json.errors) {
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { Operation, SyncOperation, SubscriptionOperation, RequestContext, } from './base.js';
2
2
  export type { BeforeSerializationMiddleware, AfterSerializationMiddleware, BeforeParsingMiddleware, AfterParsingMiddleware, ClientMiddlewaresConfig } from './middlewares.js';
3
- export type { ClientParser, SubOpAsyncIterable } from './parser.js';
3
+ export type { ClientParser, ClientParserParseBodyOptions, SubOpAsyncIterable } from './parser.js';
4
4
  export type { ClientSerializer } from './serializer.js';
5
5
  export type { ClientConfig } from './config.js';
6
6
  export type { OperationResult, OperationVariables, OpResultBasedOnOp } from './utils.js';