@oanda/labs-currency-cross-table 1.0.6 → 1.0.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/codegen.ts +15 -0
  3. package/dist/main/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +12 -4
  4. package/dist/main/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
  5. package/dist/main/CurrencyCrossTableWidget/Main.js +11 -9
  6. package/dist/main/CurrencyCrossTableWidget/Main.js.map +1 -1
  7. package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js +2 -1
  8. package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
  9. package/dist/main/CurrencyCrossTableWidget/components/CellValidationWrapper.js +51 -0
  10. package/dist/main/CurrencyCrossTableWidget/components/CellValidationWrapper.js.map +1 -0
  11. package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js +19 -11
  12. package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
  13. package/dist/main/CurrencyCrossTableWidget/components/types.js.map +1 -1
  14. package/dist/main/CurrencyCrossTableWidget/render.js +7 -2
  15. package/dist/main/CurrencyCrossTableWidget/render.js.map +1 -1
  16. package/dist/main/CurrencyCrossTableWidget/types.js +0 -13
  17. package/dist/main/CurrencyCrossTableWidget/types.js.map +1 -1
  18. package/dist/main/CurrencyCrossTableWidget/utils.js +13 -30
  19. package/dist/main/CurrencyCrossTableWidget/utils.js.map +1 -1
  20. package/dist/main/gql/types/fragment-masking.js +23 -0
  21. package/dist/main/gql/types/fragment-masking.js.map +1 -0
  22. package/dist/main/gql/types/gql.js +16 -0
  23. package/dist/main/gql/types/gql.js.map +1 -0
  24. package/dist/main/gql/types/graphql.js +223 -0
  25. package/dist/main/gql/types/graphql.js.map +1 -0
  26. package/dist/main/gql/types/index.js +28 -0
  27. package/dist/main/gql/types/index.js.map +1 -0
  28. package/dist/main/gql/validateInstruments.js +16 -0
  29. package/dist/main/gql/validateInstruments.js.map +1 -0
  30. package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +10 -2
  31. package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
  32. package/dist/module/CurrencyCrossTableWidget/Main.js +13 -11
  33. package/dist/module/CurrencyCrossTableWidget/Main.js.map +1 -1
  34. package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js +2 -1
  35. package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
  36. package/dist/module/CurrencyCrossTableWidget/components/CellValidationWrapper.js +44 -0
  37. package/dist/module/CurrencyCrossTableWidget/components/CellValidationWrapper.js.map +1 -0
  38. package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js +20 -12
  39. package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
  40. package/dist/module/CurrencyCrossTableWidget/components/types.js.map +1 -1
  41. package/dist/module/CurrencyCrossTableWidget/render.js +6 -1
  42. package/dist/module/CurrencyCrossTableWidget/render.js.map +1 -1
  43. package/dist/module/CurrencyCrossTableWidget/types.js +0 -12
  44. package/dist/module/CurrencyCrossTableWidget/types.js.map +1 -1
  45. package/dist/module/CurrencyCrossTableWidget/utils.js +10 -29
  46. package/dist/module/CurrencyCrossTableWidget/utils.js.map +1 -1
  47. package/dist/module/gql/types/fragment-masking.js +15 -0
  48. package/dist/module/gql/types/fragment-masking.js.map +1 -0
  49. package/dist/module/gql/types/gql.js +8 -0
  50. package/dist/module/gql/types/gql.js.map +1 -0
  51. package/dist/module/gql/types/graphql.js +217 -0
  52. package/dist/module/gql/types/graphql.js.map +1 -0
  53. package/dist/module/gql/types/index.js +3 -0
  54. package/dist/module/gql/types/index.js.map +1 -0
  55. package/dist/module/gql/validateInstruments.js +10 -0
  56. package/dist/module/gql/validateInstruments.js.map +1 -0
  57. package/dist/types/CurrencyCrossTableWidget/CurrencyCrossTableWidget.d.ts +1 -1
  58. package/dist/types/CurrencyCrossTableWidget/Main.d.ts +1 -1
  59. package/dist/types/CurrencyCrossTableWidget/components/CellValidationWrapper.d.ts +4 -0
  60. package/dist/types/CurrencyCrossTableWidget/components/CellWithData.d.ts +1 -1
  61. package/dist/types/CurrencyCrossTableWidget/components/types.d.ts +15 -1
  62. package/dist/types/CurrencyCrossTableWidget/types.d.ts +3 -11
  63. package/dist/types/CurrencyCrossTableWidget/utils.d.ts +5 -6
  64. package/dist/types/gql/types/fragment-masking.d.ts +15 -0
  65. package/dist/types/gql/types/gql.d.ts +37 -0
  66. package/dist/types/gql/types/graphql.d.ts +384 -0
  67. package/dist/types/gql/types/index.d.ts +2 -0
  68. package/dist/types/gql/validateInstruments.d.ts +1 -0
  69. package/package.json +12 -4
  70. package/src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx +16 -6
  71. package/src/CurrencyCrossTableWidget/Main.tsx +19 -13
  72. package/src/CurrencyCrossTableWidget/ValidationWrapper.tsx +1 -0
  73. package/src/CurrencyCrossTableWidget/components/CellValidationWrapper.tsx +51 -0
  74. package/src/CurrencyCrossTableWidget/components/CellWithData.tsx +30 -14
  75. package/src/CurrencyCrossTableWidget/components/types.ts +15 -1
  76. package/src/CurrencyCrossTableWidget/render.tsx +6 -2
  77. package/src/CurrencyCrossTableWidget/types.tsx +3 -12
  78. package/src/CurrencyCrossTableWidget/utils.ts +17 -37
  79. package/src/gql/types/fragment-masking.ts +66 -0
  80. package/src/gql/types/gql.ts +42 -0
  81. package/src/gql/types/graphql.ts +423 -0
  82. package/src/gql/types/index.ts +2 -0
  83. package/src/gql/validateInstruments.ts +10 -0
  84. package/test/Main.test.tsx +12 -6
  85. package/test/mocks.ts +225 -0
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { useSuspenseQuery } from '@apollo/client';
3
+ import { CellValidationWrapperProps } from './types';
4
+ import { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../../gql/types/graphql';
5
+ import { validateInstruments } from '../../gql/validateInstruments';
6
+ import { CellWithData } from './CellWithData';
7
+ import { divisionMapper } from '../utils';
8
+
9
+ const CellValidationWrapper = ({
10
+ currency,
11
+ pair,
12
+ instrument,
13
+ target,
14
+ additionalBorderBottom,
15
+ setSelectedCurrency,
16
+ setSelectedPair,
17
+ division,
18
+ }: CellValidationWrapperProps) => {
19
+ const { error } = useSuspenseQuery<
20
+ ValidateInstrumentsQuery,
21
+ ValidateInstrumentsQueryVariables
22
+ >(validateInstruments, {
23
+ variables: {
24
+ instruments: [instrument],
25
+ division,
26
+ },
27
+ fetchPolicy: 'network-only',
28
+ errorPolicy: 'all',
29
+ });
30
+
31
+ const instrumentForCalculations = error ? `${pair}${divisionMapper(division)}${currency}` : '';
32
+
33
+ return (
34
+ <CellWithData
35
+ currency={currency}
36
+ pair={pair}
37
+ record={{
38
+ instrument,
39
+ displayName: `${currency}${divisionMapper(division)}${pair}`,
40
+ }}
41
+ instrumentForCalculations={instrumentForCalculations}
42
+ target={target}
43
+ additionalBorderBottom={additionalBorderBottom}
44
+ setSelectedCurrency={setSelectedCurrency}
45
+ setSelectedPair={setSelectedPair}
46
+ division={division}
47
+ />
48
+ );
49
+ };
50
+
51
+ export { CellValidationWrapper };
@@ -1,35 +1,46 @@
1
1
  import React, { useState } from 'react';
2
- import { Price } from '@oanda/labs-widget-common';
3
- import { useRecords } from '../utils';
4
- import { CellWithDataProps } from './types';
2
+ import { Price, useLiveRatesMessage } from '@oanda/labs-widget-common';
5
3
  import { Cell } from './Cell';
4
+ import { CellWithDataProps } from './types';
5
+ import { getBuyPrice, getPriceMovement } from '../utils';
6
6
 
7
7
  const CellWithData = ({
8
- loading,
8
+ currency,
9
+ pair,
9
10
  record,
11
+ instrumentForCalculations,
10
12
  target,
11
13
  additionalBorderBottom,
12
14
  setSelectedCurrency,
13
15
  setSelectedPair,
14
16
  }: CellWithDataProps) => {
15
17
  const [hovered, setHovered] = useState(false);
16
- const { updatedRecord, error } = useRecords(record, record.instrument ? target : null);
17
18
 
18
- const checkLoading = (id: string) => loading || (!error && updatedRecord?.[id] === undefined);
19
+ const instrumentForUpdates = instrumentForCalculations || record.instrument;
19
20
 
20
- const handleMouseEnter = () => {
21
- setHovered(true);
21
+ const { update, error: liveRatesError } = useLiveRatesMessage(
22
+ instrumentForUpdates,
23
+ target,
24
+ );
22
25
 
23
- const currency = record.instrument.substring(0, 3);
24
- const pair = record.instrument.substring(record.instrument.length - 3);
26
+ const updatedRecord: Record<string, any> = {
27
+ displayName: record.displayName,
28
+ instrument: record.instrument,
29
+ buy: update?.ask,
30
+ buyPriceMovement: update?.askPriceMovement,
31
+ displayPrecision: update?.displayPrecision,
32
+ };
33
+
34
+ const checkLoading = (id: string) => (!liveRatesError && updatedRecord?.[id] === undefined);
25
35
 
36
+ const handleMouseEnter = () => {
37
+ setHovered(true);
26
38
  setSelectedCurrency(currency);
27
39
  setSelectedPair(pair);
28
40
  };
29
41
 
30
42
  const handleMouseLeave = () => {
31
43
  setHovered(false);
32
-
33
44
  setSelectedCurrency('');
34
45
  setSelectedPair('');
35
46
  };
@@ -37,14 +48,19 @@ const CellWithData = ({
37
48
  return (
38
49
  <Cell
39
50
  isLoading={checkLoading('buy')}
40
- isError={!!error}
51
+ isError={!!liveRatesError}
41
52
  additionalBorderBottom={additionalBorderBottom}
42
53
  hovered={hovered}
43
54
  mouseEnterHandler={handleMouseEnter}
44
55
  mouseLeaveHandler={handleMouseLeave}
45
56
  >
46
- <Price priceMovement={updatedRecord.buyPriceMovement} movementIndicator="background">
47
- <span>{updatedRecord.buy?.toFixed(updatedRecord.displayPrecision)}</span>
57
+ <Price priceMovement={getPriceMovement(updatedRecord.buyPriceMovement, !!instrumentForCalculations)} movementIndicator="background">
58
+ <span>
59
+ {getBuyPrice(
60
+ updatedRecord.buy,
61
+ !!instrumentForCalculations,
62
+ ).toFixed(updatedRecord.displayPrecision)}
63
+ </span>
48
64
  </Price>
49
65
  </Cell>
50
66
  );
@@ -1,10 +1,24 @@
1
1
  import { DataRecord, LoaderSize } from '@oanda/labs-widget-common';
2
+ import { Division } from '../../gql/types/graphql';
2
3
 
4
+ export interface CellValidationWrapperProps {
5
+ currency: string;
6
+ pair: string;
7
+ instrument: string;
8
+ target: EventTarget | null;
9
+ additionalBorderBottom? : boolean;
10
+ division: Division;
11
+ setSelectedCurrency: React.Dispatch<React.SetStateAction<string>>;
12
+ setSelectedPair: React.Dispatch<React.SetStateAction<string>>;
13
+ }
3
14
  export interface CellWithDataProps {
4
- loading: boolean;
15
+ currency: string;
16
+ pair: string;
17
+ instrumentForCalculations: string;
5
18
  record: DataRecord;
6
19
  target: EventTarget | null;
7
20
  additionalBorderBottom? : boolean;
21
+ division: Division;
8
22
  setSelectedCurrency: React.Dispatch<React.SetStateAction<string>>;
9
23
  setSelectedPair: React.Dispatch<React.SetStateAction<string>>;
10
24
  }
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  import { createRoot } from 'react-dom/client';
3
3
  import { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';
4
4
  import { CurrencyCrossTableWidget } from './CurrencyCrossTableWidget';
5
- import { Division } from './types';
5
+ import { Division } from '../gql/types/graphql';
6
6
 
7
7
  const {
8
+ graphqlUrl,
8
9
  liveRatesUrl,
9
10
  } = window.widgetsConfig || {};
10
11
 
@@ -19,7 +20,7 @@ currencyCrossTableElements.forEach((element) => {
19
20
  } = JSON.parse(params as string);
20
21
 
21
22
  const isParamError = validateToolParams({
22
- division, locale, currencies, liveRatesUrl,
23
+ division, locale, currencies, graphqlUrl, liveRatesUrl,
23
24
  }, [{
24
25
  name: 'locale',
25
26
  valueCheck: (value) => validateLocale(value),
@@ -29,12 +30,15 @@ currencyCrossTableElements.forEach((element) => {
29
30
  }, {
30
31
  name: 'currencies',
31
32
  valueCheck: (value) => (value as string[]).length > 0 && (value as string[]).length <= 8,
33
+ }, {
34
+ name: 'graphqlUrl',
32
35
  }, {
33
36
  name: 'liveRatesUrl',
34
37
  }]);
35
38
 
36
39
  root.render(
37
40
  <CurrencyCrossTableWidget
41
+ graphqlUrl={graphqlUrl}
38
42
  liveRatesUrl={liveRatesUrl}
39
43
  division={division}
40
44
  currencies={currencies}
@@ -1,22 +1,12 @@
1
1
  import { Locale } from '@oanda/mono-i18n';
2
2
  import { Theme } from '@oanda/labs-widget-common';
3
+ import { Division } from '../gql/types/graphql';
3
4
 
4
5
  export { Locale } from '@oanda/mono-i18n';
5
6
 
6
- export enum Division {
7
- Oap = 'OAP',
8
- Oau = 'OAU',
9
- Oc = 'OC',
10
- Ocan = 'OCAN',
11
- Oel = 'OEL',
12
- Ogm = 'OGM',
13
- Oj = 'OJ',
14
- Opt = 'OPT',
15
- Otms = 'OTMS',
16
- }
17
-
18
7
  export interface CurrencyCrossTableConfig {
19
8
  division: Division;
9
+ graphqlUrl: string;
20
10
  liveRatesUrl: string;
21
11
  currencies: string[];
22
12
  locale: Locale;
@@ -33,4 +23,5 @@ export interface ValidationWrapperProps {
33
23
  export interface MainProps {
34
24
  currencies: string[];
35
25
  instruments: string[];
26
+ division: Division;
36
27
  }
@@ -1,60 +1,40 @@
1
- import { useEffect, useState } from 'react';
2
- import { DataRecord, LiveRatesErrorMessage, useLiveRatesMessage } from '@oanda/labs-widget-common';
3
1
  import { MAJOR_CURRENCIES } from './constant';
2
+ import { Division } from '../gql/types/graphql';
4
3
 
5
4
  const validCurrencies = (currencies: string[]) => currencies
6
5
  .every((currency) => MAJOR_CURRENCIES.includes(currency));
7
6
 
8
- const currenciesToInstruments = (currencies: string[], division: any) => {
9
- const divisionMapper = division === 'OGM' ? '' : '_';
7
+ const divisionMapper = (division: Division) => (division === 'OGM' ? '' : '_');
10
8
 
9
+ const currenciesToInstruments = (currencies: string[], division: any) => {
11
10
  const pairs = currencies.reduce((acc, cV, index, array) => {
12
11
  const unique = array.filter((_item, idx) => index !== idx);
13
12
 
14
13
  return [
15
14
  ...acc,
16
- ...unique.map((el) => `${cV}${divisionMapper}${el}`),
15
+ ...unique.map((el) => `${cV}${divisionMapper(division)}${el}`),
17
16
  ];
18
17
  }, [] as string[]);
19
18
 
20
19
  return pairs;
21
20
  };
22
21
 
23
- const useRecords = (
24
- record: DataRecord,
25
- target: EventTarget | null,
26
- ) => {
27
- const [updatedRecord, setUpdatedRecord] = useState<DataRecord>({
28
- displayName: record.displayName,
29
- instrument: record.instrument,
30
- });
31
-
32
- const [error, setError] = useState<LiveRatesErrorMessage | null>(null);
33
-
34
- const { update, error: liveRatesError } = useLiveRatesMessage(
35
- record.instrument,
36
- target,
37
- );
38
-
39
- useEffect(() => {
40
- setUpdatedRecord({
41
- displayName: record.displayName,
42
- instrument: record.instrument,
43
- buy: update?.ask,
44
- buyPriceMovement: update?.askPriceMovement,
45
- displayPrecision: update?.displayPrecision,
46
- });
47
- setError(liveRatesError);
48
- }, [update, record, liveRatesError]);
49
-
50
- return {
51
- updatedRecord,
52
- error,
53
- };
22
+ const getPriceMovement = (priceMovement: number | undefined, isReversed: boolean) => {
23
+ if (priceMovement === undefined) return 0;
24
+
25
+ return isReversed ? priceMovement * -1 : priceMovement;
26
+ };
27
+
28
+ const getBuyPrice = (price: number | undefined, isReversed: boolean) => {
29
+ if (price === undefined) return 0;
30
+
31
+ return isReversed ? 1 / price : price;
54
32
  };
55
33
 
56
34
  export {
57
35
  validCurrencies,
58
36
  currenciesToInstruments,
59
- useRecords,
37
+ divisionMapper,
38
+ getPriceMovement,
39
+ getBuyPrice,
60
40
  };
@@ -0,0 +1,66 @@
1
+ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
2
+ import { FragmentDefinitionNode } from 'graphql';
3
+ import { Incremental } from './graphql';
4
+
5
+
6
+ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<
7
+ infer TType,
8
+ any
9
+ >
10
+ ? [TType] extends [{ ' $fragmentName'?: infer TKey }]
11
+ ? TKey extends string
12
+ ? { ' $fragmentRefs'?: { [key in TKey]: TType } }
13
+ : never
14
+ : never
15
+ : never;
16
+
17
+ // return non-nullable if `fragmentType` is non-nullable
18
+ export function useFragment<TType>(
19
+ _documentNode: DocumentTypeDecoration<TType, any>,
20
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
21
+ ): TType;
22
+ // return nullable if `fragmentType` is nullable
23
+ export function useFragment<TType>(
24
+ _documentNode: DocumentTypeDecoration<TType, any>,
25
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
26
+ ): TType | null | undefined;
27
+ // return array of non-nullable if `fragmentType` is array of non-nullable
28
+ export function useFragment<TType>(
29
+ _documentNode: DocumentTypeDecoration<TType, any>,
30
+ fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
31
+ ): ReadonlyArray<TType>;
32
+ // return array of nullable if `fragmentType` is array of nullable
33
+ export function useFragment<TType>(
34
+ _documentNode: DocumentTypeDecoration<TType, any>,
35
+ fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
36
+ ): ReadonlyArray<TType> | null | undefined;
37
+ export function useFragment<TType>(
38
+ _documentNode: DocumentTypeDecoration<TType, any>,
39
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
40
+ ): TType | ReadonlyArray<TType> | null | undefined {
41
+ return fragmentType as any;
42
+ }
43
+
44
+
45
+ export function makeFragmentData<
46
+ F extends DocumentTypeDecoration<any, any>,
47
+ FT extends ResultOf<F>
48
+ >(data: FT, _fragment: F): FragmentType<F> {
49
+ return data as FragmentType<F>;
50
+ }
51
+ export function isFragmentReady<TQuery, TFrag>(
52
+ queryNode: DocumentTypeDecoration<TQuery, any>,
53
+ fragmentNode: TypedDocumentNode<TFrag>,
54
+ data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined
55
+ ): data is FragmentType<typeof fragmentNode> {
56
+ const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__
57
+ ?.deferredFields;
58
+
59
+ if (!deferredFields) return true;
60
+
61
+ const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;
62
+ const fragName = fragDef?.name?.value;
63
+
64
+ const fields = (fragName && deferredFields[fragName]) || [];
65
+ return fields.length > 0 && fields.every(field => data && field in data);
66
+ }
@@ -0,0 +1,42 @@
1
+ /* eslint-disable */
2
+ import * as types from './graphql';
3
+ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
4
+
5
+ /**
6
+ * Map of all GraphQL operations in the project.
7
+ *
8
+ * This map has several performance disadvantages:
9
+ * 1. It is not tree-shakeable, so it will include all operations in the project.
10
+ * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
11
+ * 3. It does not support dead code elimination, so it will add unused operations.
12
+ *
13
+ * Therefore it is highly recommended to use the babel or swc plugin for production.
14
+ */
15
+ const documents = {
16
+ "\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n": types.ValidateInstrumentsDocument,
17
+ };
18
+
19
+ /**
20
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
21
+ *
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
26
+ * ```
27
+ *
28
+ * The query argument is unknown!
29
+ * Please regenerate the types.
30
+ */
31
+ export function graphql(source: string): unknown;
32
+
33
+ /**
34
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
35
+ */
36
+ export function graphql(source: "\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n"): (typeof documents)["\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n"];
37
+
38
+ export function graphql(source: string) {
39
+ return (documents as any)[source] ?? {};
40
+ }
41
+
42
+ export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;