@oanda/labs-value-at-risk-widget 1.0.65 → 1.0.67

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 (143) hide show
  1. package/CHANGELOG.md +540 -0
  2. package/dist/main/ValueAtRiskWidget/ChartWithData.js +7 -6
  3. package/dist/main/ValueAtRiskWidget/ChartWithData.js.map +1 -1
  4. package/dist/main/ValueAtRiskWidget/Tool.js +12 -12
  5. package/dist/main/ValueAtRiskWidget/Tool.js.map +1 -1
  6. package/dist/main/ValueAtRiskWidget/ToolWithData.js +3 -3
  7. package/dist/main/ValueAtRiskWidget/ToolWithData.js.map +1 -1
  8. package/dist/main/ValueAtRiskWidget/ValueAtRiskWidget.js +8 -8
  9. package/dist/main/ValueAtRiskWidget/ValueAtRiskWidget.js.map +1 -1
  10. package/dist/main/ValueAtRiskWidget/Widget.js +9 -9
  11. package/dist/main/ValueAtRiskWidget/Widget.js.map +1 -1
  12. package/dist/main/ValueAtRiskWidget/components/Chart/Chart.js +11 -11
  13. package/dist/main/ValueAtRiskWidget/components/Chart/Chart.js.map +1 -1
  14. package/dist/main/ValueAtRiskWidget/components/Chart/getOption.js +11 -7
  15. package/dist/main/ValueAtRiskWidget/components/Chart/getOption.js.map +1 -1
  16. package/dist/main/ValueAtRiskWidget/components/Chart/types.js.map +1 -1
  17. package/dist/main/ValueAtRiskWidget/components/Legend/DashedLine.js +7 -7
  18. package/dist/main/ValueAtRiskWidget/components/Legend/DashedLine.js.map +1 -1
  19. package/dist/main/ValueAtRiskWidget/components/Legend/DesktopLegend.js +5 -5
  20. package/dist/main/ValueAtRiskWidget/components/Legend/DesktopLegend.js.map +1 -1
  21. package/dist/main/ValueAtRiskWidget/components/Legend/Legend.js +15 -15
  22. package/dist/main/ValueAtRiskWidget/components/Legend/Legend.js.map +1 -1
  23. package/dist/main/ValueAtRiskWidget/components/Legend/MobileLegend.js +8 -8
  24. package/dist/main/ValueAtRiskWidget/components/Legend/MobileLegend.js.map +1 -1
  25. package/dist/main/ValueAtRiskWidget/components/Legend/constants.js.map +1 -1
  26. package/dist/main/ValueAtRiskWidget/components/Legend/types.js.map +1 -1
  27. package/dist/main/ValueAtRiskWidget/render.js +9 -9
  28. package/dist/main/ValueAtRiskWidget/render.js.map +1 -1
  29. package/dist/main/ValueAtRiskWidget/types.js.map +1 -1
  30. package/dist/main/ValueAtRiskWidget/utils.js +1 -1
  31. package/dist/main/ValueAtRiskWidget/utils.js.map +1 -1
  32. package/dist/main/gql/getValueAtRiskAssetClasses.js +3 -11
  33. package/dist/main/gql/getValueAtRiskAssetClasses.js.map +1 -1
  34. package/dist/main/gql/getValueAtRiskChart.js +3 -26
  35. package/dist/main/gql/getValueAtRiskChart.js.map +1 -1
  36. package/dist/main/gql/types/fragment-masking.js +3 -2
  37. package/dist/main/gql/types/fragment-masking.js.map +1 -1
  38. package/dist/main/gql/types/gql.js +4 -3
  39. package/dist/main/gql/types/gql.js.map +1 -1
  40. package/dist/main/gql/types/graphql.js +241 -241
  41. package/dist/main/gql/types/graphql.js.map +1 -1
  42. package/dist/main/gql/types/index.js.map +1 -1
  43. package/dist/main/translations/index.js +1 -1
  44. package/dist/main/translations/index.js.map +1 -1
  45. package/dist/main/translations/translations.js.map +1 -1
  46. package/dist/module/ValueAtRiskWidget/ChartWithData.js +7 -6
  47. package/dist/module/ValueAtRiskWidget/ChartWithData.js.map +1 -1
  48. package/dist/module/ValueAtRiskWidget/Tool.js +12 -12
  49. package/dist/module/ValueAtRiskWidget/Tool.js.map +1 -1
  50. package/dist/module/ValueAtRiskWidget/ToolWithData.js +3 -3
  51. package/dist/module/ValueAtRiskWidget/ToolWithData.js.map +1 -1
  52. package/dist/module/ValueAtRiskWidget/ValueAtRiskWidget.js +8 -8
  53. package/dist/module/ValueAtRiskWidget/ValueAtRiskWidget.js.map +1 -1
  54. package/dist/module/ValueAtRiskWidget/Widget.js +9 -9
  55. package/dist/module/ValueAtRiskWidget/Widget.js.map +1 -1
  56. package/dist/module/ValueAtRiskWidget/components/Chart/Chart.js +9 -9
  57. package/dist/module/ValueAtRiskWidget/components/Chart/Chart.js.map +1 -1
  58. package/dist/module/ValueAtRiskWidget/components/Chart/getOption.js +12 -8
  59. package/dist/module/ValueAtRiskWidget/components/Chart/getOption.js.map +1 -1
  60. package/dist/module/ValueAtRiskWidget/components/Chart/types.js.map +1 -1
  61. package/dist/module/ValueAtRiskWidget/components/Legend/DashedLine.js +7 -7
  62. package/dist/module/ValueAtRiskWidget/components/Legend/DashedLine.js.map +1 -1
  63. package/dist/module/ValueAtRiskWidget/components/Legend/DesktopLegend.js +5 -5
  64. package/dist/module/ValueAtRiskWidget/components/Legend/DesktopLegend.js.map +1 -1
  65. package/dist/module/ValueAtRiskWidget/components/Legend/Legend.js +15 -15
  66. package/dist/module/ValueAtRiskWidget/components/Legend/Legend.js.map +1 -1
  67. package/dist/module/ValueAtRiskWidget/components/Legend/MobileLegend.js +8 -8
  68. package/dist/module/ValueAtRiskWidget/components/Legend/MobileLegend.js.map +1 -1
  69. package/dist/module/ValueAtRiskWidget/components/Legend/constants.js.map +1 -1
  70. package/dist/module/ValueAtRiskWidget/components/Legend/types.js.map +1 -1
  71. package/dist/module/ValueAtRiskWidget/render.js +9 -9
  72. package/dist/module/ValueAtRiskWidget/render.js.map +1 -1
  73. package/dist/module/ValueAtRiskWidget/types.js.map +1 -1
  74. package/dist/module/ValueAtRiskWidget/utils.js +2 -2
  75. package/dist/module/ValueAtRiskWidget/utils.js.map +1 -1
  76. package/dist/module/gql/getValueAtRiskAssetClasses.js +3 -11
  77. package/dist/module/gql/getValueAtRiskAssetClasses.js.map +1 -1
  78. package/dist/module/gql/getValueAtRiskChart.js +3 -26
  79. package/dist/module/gql/getValueAtRiskChart.js.map +1 -1
  80. package/dist/module/gql/types/fragment-masking.js +3 -2
  81. package/dist/module/gql/types/fragment-masking.js.map +1 -1
  82. package/dist/module/gql/types/gql.js +4 -3
  83. package/dist/module/gql/types/gql.js.map +1 -1
  84. package/dist/module/gql/types/graphql.js +241 -241
  85. package/dist/module/gql/types/graphql.js.map +1 -1
  86. package/dist/module/gql/types/index.js +2 -2
  87. package/dist/module/gql/types/index.js.map +1 -1
  88. package/dist/module/translations/index.js +1 -1
  89. package/dist/module/translations/index.js.map +1 -1
  90. package/dist/module/translations/translations.js.map +1 -1
  91. package/dist/types/ValueAtRiskWidget/ChartWithData.d.ts +1 -1
  92. package/dist/types/ValueAtRiskWidget/Tool.d.ts +1 -1
  93. package/dist/types/ValueAtRiskWidget/ToolWithData.d.ts +1 -1
  94. package/dist/types/ValueAtRiskWidget/ValueAtRiskWidget.d.ts +1 -1
  95. package/dist/types/ValueAtRiskWidget/Widget.d.ts +2 -2
  96. package/dist/types/ValueAtRiskWidget/components/Chart/Chart.d.ts +1 -1
  97. package/dist/types/ValueAtRiskWidget/components/Chart/getOption.d.ts +1 -1
  98. package/dist/types/ValueAtRiskWidget/components/Chart/types.d.ts +2 -2
  99. package/dist/types/ValueAtRiskWidget/components/Legend/DashedLine.d.ts +2 -2
  100. package/dist/types/ValueAtRiskWidget/components/Legend/DesktopLegend.d.ts +1 -1
  101. package/dist/types/ValueAtRiskWidget/components/Legend/Legend.d.ts +1 -1
  102. package/dist/types/ValueAtRiskWidget/components/Legend/MobileLegend.d.ts +1 -1
  103. package/dist/types/ValueAtRiskWidget/components/Legend/constants.d.ts +1 -1
  104. package/dist/types/ValueAtRiskWidget/components/Legend/types.d.ts +1 -1
  105. package/dist/types/ValueAtRiskWidget/types.d.ts +2 -2
  106. package/dist/types/ValueAtRiskWidget/utils.d.ts +2 -2
  107. package/dist/types/gql/types/gql.d.ts +4 -4
  108. package/dist/types/gql/types/index.d.ts +2 -2
  109. package/dist/types/translations/index.d.ts +2 -2
  110. package/package.json +3 -3
  111. package/src/ValueAtRiskWidget/ChartWithData.tsx +45 -26
  112. package/src/ValueAtRiskWidget/Tool.tsx +42 -28
  113. package/src/ValueAtRiskWidget/ToolWithData.tsx +29 -23
  114. package/src/ValueAtRiskWidget/ValueAtRiskWidget.tsx +16 -16
  115. package/src/ValueAtRiskWidget/Widget.tsx +7 -11
  116. package/src/ValueAtRiskWidget/components/Chart/Chart.tsx +20 -19
  117. package/src/ValueAtRiskWidget/components/Chart/getOption.ts +4 -4
  118. package/src/ValueAtRiskWidget/components/Chart/types.ts +4 -3
  119. package/src/ValueAtRiskWidget/components/Legend/DashedLine.tsx +18 -8
  120. package/src/ValueAtRiskWidget/components/Legend/DesktopLegend.tsx +28 -19
  121. package/src/ValueAtRiskWidget/components/Legend/Legend.tsx +11 -14
  122. package/src/ValueAtRiskWidget/components/Legend/MobileLegend.tsx +40 -22
  123. package/src/ValueAtRiskWidget/components/Legend/constants.tsx +1 -1
  124. package/src/ValueAtRiskWidget/components/Legend/types.tsx +9 -9
  125. package/src/ValueAtRiskWidget/render.tsx +22 -24
  126. package/src/ValueAtRiskWidget/types.ts +7 -3
  127. package/src/ValueAtRiskWidget/utils.ts +18 -10
  128. package/src/gql/getValueAtRiskAssetClasses.ts +1 -1
  129. package/src/gql/getValueAtRiskChart.ts +12 -2
  130. package/src/gql/types/fragment-masking.ts +41 -21
  131. package/src/gql/types/gql.ts +12 -5
  132. package/src/gql/types/graphql.ts +339 -47
  133. package/src/gql/types/index.ts +2 -2
  134. package/src/translations/index.ts +4 -4
  135. package/src/translations/translations.ts +1 -3
  136. package/test/ChartWithData.test.tsx +21 -13
  137. package/test/Tool.test.tsx +35 -21
  138. package/test/ToolWithData.test.tsx +18 -7
  139. package/test/Widget.test.tsx +13 -8
  140. package/test/getPercentValueByPips.test.ts +15 -3
  141. package/test/mocks/assetClassesMock.ts +1 -3
  142. package/test/mocks/responsesMocks.ts +6 -2
  143. package/test/utils.test.ts +14 -7
@@ -1,4 +1,4 @@
1
- import { DataNames } from './types';
1
+ import type { DataNames } from './types';
2
2
 
3
3
  export const lineTypes: Record<DataNames, string> = {
4
4
  min: '0',
@@ -1,4 +1,4 @@
1
- import { GetValueAtRiskChartQuery } from '../../../gql/types/graphql';
1
+ import type { GetValueAtRiskChartQuery } from '../../../gql/types/graphql';
2
2
 
3
3
  export enum DataNames {
4
4
  MIN = 'min',
@@ -14,8 +14,8 @@ export interface DesktopLegendProps {
14
14
  label: string;
15
15
  value: number;
16
16
  }[];
17
- isDark: boolean,
18
- lang: (key: string) => string
17
+ isDark: boolean;
18
+ lang: (key: string) => string;
19
19
  }
20
20
 
21
21
  export interface MobileLegendProps {
@@ -25,16 +25,16 @@ export interface MobileLegendProps {
25
25
  valueUp: number;
26
26
  valueDown: number;
27
27
  }[];
28
- isDark: boolean,
29
- lang: (key: string) => string
28
+ isDark: boolean;
29
+ lang: (key: string) => string;
30
30
  }
31
31
 
32
32
  export interface LegendProps {
33
- data: GetValueAtRiskChartQuery
33
+ data: GetValueAtRiskChartQuery;
34
34
  }
35
35
 
36
36
  export interface DashedLineProps {
37
- strokeDasharray?: string,
38
- width?: string,
39
- isDark: boolean,
37
+ strokeDasharray?: string;
38
+ width?: string;
39
+ isDark: boolean;
40
40
  }
@@ -1,52 +1,50 @@
1
+ import type { Theme } from '@oanda/labs-widget-common';
2
+ import { validateLocale, validateToolParams } from '@oanda/labs-widget-common';
1
3
  import React from 'react';
2
4
  import { createRoot } from 'react-dom/client';
3
- import { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';
4
- import { ValueAtRiskWidget } from './ValueAtRiskWidget';
5
+
5
6
  import { Division } from '../gql/types/graphql';
7
+ import { ValueAtRiskWidget } from './ValueAtRiskWidget';
6
8
 
7
- const {
8
- graphqlUrl,
9
- } = window.widgetsConfig || {};
9
+ const { graphqlUrl } = window.widgetsConfig || {};
10
10
 
11
- const valueAtRiskParamsElements = document.querySelectorAll('div[data-value-at-risk-params]');
11
+ const valueAtRiskParamsElements = document.querySelectorAll(
12
+ 'div[data-value-at-risk-params]'
13
+ );
12
14
 
13
15
  valueAtRiskParamsElements.forEach((element) => {
14
16
  const root = createRoot(element);
15
17
  const params = element.getAttribute('data-value-at-risk-params');
16
18
  const mode = element.getAttribute('data-mode');
17
- const {
18
- division,
19
- locale,
20
- instrument,
21
- duration,
22
- bars,
23
- logoLink,
24
- } = JSON.parse(params as string);
19
+ const { division, locale, instrument, duration, bars, logoLink } = JSON.parse(
20
+ params as string
21
+ );
25
22
 
26
23
  const isParamError = validateToolParams({ locale, division, graphqlUrl }, [
27
24
  {
28
25
  name: 'locale',
29
- valueCheck: (value) => validateLocale(value),
26
+ valueCheck: (value: string | undefined) => validateLocale(value),
30
27
  },
31
28
  {
32
29
  name: 'division',
33
- valueCheck: (value) => Object.values(Division).includes(value),
30
+ valueCheck: (value: Division) => Object.values(Division).includes(value),
34
31
  },
35
32
  {
36
33
  name: 'graphqlUrl',
37
- }]);
34
+ },
35
+ ]);
38
36
 
39
37
  root.render(
40
38
  <ValueAtRiskWidget
41
- graphqlUrl={graphqlUrl}
42
- locale={locale}
39
+ bars={bars}
43
40
  division={division}
44
- theme={mode as Theme}
45
- isParamError={isParamError}
46
- instrument={instrument}
47
41
  duration={duration}
48
- bars={bars}
42
+ graphqlUrl={graphqlUrl}
43
+ instrument={instrument}
44
+ isParamError={isParamError}
45
+ locale={locale}
49
46
  logoLink={logoLink}
50
- />,
47
+ theme={mode as Theme}
48
+ />
51
49
  );
52
50
  });
@@ -1,6 +1,10 @@
1
- import { WidgetConfig } from '@oanda/labs-widget-common';
2
- import {
3
- Division, GetValueAtRiskAssetClassesQuery, ValueAtRiskBars, ValueAtRiskDuration,
1
+ import type { WidgetConfig } from '@oanda/labs-widget-common';
2
+
3
+ import type {
4
+ Division,
5
+ GetValueAtRiskAssetClassesQuery,
6
+ ValueAtRiskBars,
7
+ ValueAtRiskDuration,
4
8
  } from '../gql/types/graphql';
5
9
 
6
10
  export interface ValueAtRiskConfig extends WidgetConfig {
@@ -1,24 +1,32 @@
1
- import { AssetClass, Instrument } from '../gql/types/graphql';
1
+ import type { AssetClass, Instrument } from '../gql/types/graphql';
2
2
 
3
- const capitalize = (name: string) => `${name[0].toUpperCase()}${name.substring(1)}`;
3
+ const capitalize = (name: string) =>
4
+ `${name[0].toUpperCase()}${name.substring(1)}`;
4
5
 
5
6
  function sortAlphabetically<T extends Record<string, string>>(
6
7
  paramName: keyof T,
7
- items: T[],
8
+ items: T[]
8
9
  ): T[] {
9
- return [...items]
10
- .sort((itemA, itemB) => itemA[paramName].localeCompare(itemB[paramName], 'en', { sensitivity: 'base' }));
10
+ return [...items].sort((itemA, itemB) =>
11
+ itemA[paramName].localeCompare(itemB[paramName], 'en', {
12
+ sensitivity: 'base',
13
+ })
14
+ );
11
15
  }
12
16
 
13
17
  const getAssetClassesList = (data: AssetClass[]) => {
14
- const list = data
15
- .map(({ name }) => ({ id: name.toLowerCase(), label: capitalize(name) }));
18
+ const list = data.map(({ name }) => ({
19
+ id: name.toLowerCase(),
20
+ label: capitalize(name),
21
+ }));
16
22
 
17
23
  return sortAlphabetically('label', list);
18
24
  };
19
25
 
20
- const mapInstrumentsList = (data: Instrument[]) => sortAlphabetically('displayName', data)
21
- .map(({ name: id, displayName: label }) => ({ id, label }));
26
+ const mapInstrumentsList = (data: Instrument[]) =>
27
+ sortAlphabetically('displayName', data).map(
28
+ ({ name: id, displayName: label }) => ({ id, label })
29
+ );
22
30
 
23
31
  const getInstrumentsByAssetClassId = (data: AssetClass[], id: string) => {
24
32
  const [{ instruments }] = data.filter(({ name }) => id === name);
@@ -28,6 +36,6 @@ const getInstrumentsByAssetClassId = (data: AssetClass[], id: string) => {
28
36
 
29
37
  export {
30
38
  getAssetClassesList,
31
- sortAlphabetically,
32
39
  getInstrumentsByAssetClassId,
40
+ sortAlphabetically,
33
41
  };
@@ -2,7 +2,7 @@ import { gql } from '@apollo/client';
2
2
 
3
3
  export const getValueAtRiskAssetClasses = gql`
4
4
  query GetValueAtRiskAssetClasses($division: Division) {
5
- valueAtRiskAssetClasses(division: $division) {
5
+ valueAtRiskAssetClasses(division: $division) {
6
6
  name
7
7
  instruments {
8
8
  name
@@ -1,8 +1,18 @@
1
1
  import { gql } from '@apollo/client';
2
2
 
3
3
  export const getValueAtRiskChart = gql`
4
- query getValueAtRiskChart($instrument: String!, $division: Division!, $duration: ValueAtRiskDuration!, $bars: ValueAtRiskBars!) {
5
- valueAtRiskChart(instrument: $instrument, division: $division, duration: $duration, bars: $bars) {
4
+ query getValueAtRiskChart(
5
+ $instrument: String!
6
+ $division: Division!
7
+ $duration: ValueAtRiskDuration!
8
+ $bars: ValueAtRiskBars!
9
+ ) {
10
+ valueAtRiskChart(
11
+ instrument: $instrument
12
+ division: $division
13
+ duration: $duration
14
+ bars: $bars
15
+ ) {
6
16
  up {
7
17
  points {
8
18
  pips
@@ -1,18 +1,21 @@
1
- import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
1
+ import {
2
+ ResultOf,
3
+ DocumentTypeDecoration,
4
+ TypedDocumentNode,
5
+ } from '@graphql-typed-document-node/core';
2
6
  import { FragmentDefinitionNode } from 'graphql';
3
7
  import { Incremental } from './graphql';
4
8
 
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 } }
9
+ export type FragmentType<
10
+ TDocumentType extends DocumentTypeDecoration<any, any>,
11
+ > =
12
+ TDocumentType extends DocumentTypeDecoration<infer TType, any>
13
+ ? [TType] extends [{ ' $fragmentName'?: infer TKey }]
14
+ ? TKey extends string
15
+ ? { ' $fragmentRefs'?: { [key in TKey]: TType } }
16
+ : never
13
17
  : never
14
- : never
15
- : never;
18
+ : never;
16
19
 
17
20
  // return non-nullable if `fragmentType` is non-nullable
18
21
  export function useFragment<TType>(
@@ -22,7 +25,10 @@ export function useFragment<TType>(
22
25
  // return nullable if `fragmentType` is nullable
23
26
  export function useFragment<TType>(
24
27
  _documentNode: DocumentTypeDecoration<TType, any>,
25
- fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
28
+ fragmentType:
29
+ | FragmentType<DocumentTypeDecoration<TType, any>>
30
+ | null
31
+ | undefined
26
32
  ): TType | null | undefined;
27
33
  // return array of non-nullable if `fragmentType` is array of non-nullable
28
34
  export function useFragment<TType>(
@@ -32,35 +38,49 @@ export function useFragment<TType>(
32
38
  // return array of nullable if `fragmentType` is array of nullable
33
39
  export function useFragment<TType>(
34
40
  _documentNode: DocumentTypeDecoration<TType, any>,
35
- fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
41
+ fragmentType:
42
+ | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
43
+ | null
44
+ | undefined
36
45
  ): ReadonlyArray<TType> | null | undefined;
37
46
  export function useFragment<TType>(
38
47
  _documentNode: DocumentTypeDecoration<TType, any>,
39
- fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
48
+ fragmentType:
49
+ | FragmentType<DocumentTypeDecoration<TType, any>>
50
+ | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
51
+ | null
52
+ | undefined
40
53
  ): TType | ReadonlyArray<TType> | null | undefined {
41
54
  return fragmentType as any;
42
55
  }
43
56
 
44
-
45
57
  export function makeFragmentData<
46
58
  F extends DocumentTypeDecoration<any, any>,
47
- FT extends ResultOf<F>
59
+ FT extends ResultOf<F>,
48
60
  >(data: FT, _fragment: F): FragmentType<F> {
49
61
  return data as FragmentType<F>;
50
62
  }
51
63
  export function isFragmentReady<TQuery, TFrag>(
52
64
  queryNode: DocumentTypeDecoration<TQuery, any>,
53
65
  fragmentNode: TypedDocumentNode<TFrag>,
54
- data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined
66
+ data:
67
+ | FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>
68
+ | null
69
+ | undefined
55
70
  ): data is FragmentType<typeof fragmentNode> {
56
- const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__
57
- ?.deferredFields;
71
+ const deferredFields = (
72
+ queryNode as {
73
+ __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };
74
+ }
75
+ ).__meta__?.deferredFields;
58
76
 
59
77
  if (!deferredFields) return true;
60
78
 
61
- const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;
79
+ const fragDef = fragmentNode.definitions[0] as
80
+ | FragmentDefinitionNode
81
+ | undefined;
62
82
  const fragName = fragDef?.name?.value;
63
83
 
64
84
  const fields = (fragName && deferredFields[fragName]) || [];
65
- return fields.length > 0 && fields.every(field => data && field in data);
85
+ return fields.length > 0 && fields.every((field) => data && field in data);
66
86
  }
@@ -13,8 +13,10 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
13
13
  * Therefore it is highly recommended to use the babel or swc plugin for production.
14
14
  */
15
15
  const documents = {
16
- "\n query GetValueAtRiskAssetClasses($division: Division) {\n valueAtRiskAssetClasses(division: $division) {\n name\n instruments {\n name\n displayName\n }\n }\n }\n": types.GetValueAtRiskAssetClassesDocument,
17
- "\n query getValueAtRiskChart($instrument: String!, $division: Division!, $duration: ValueAtRiskDuration!, $bars: ValueAtRiskBars!) {\n valueAtRiskChart(instrument: $instrument, division: $division, duration: $duration, bars: $bars) {\n up {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n down {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n }\n }\n": types.GetValueAtRiskChartDocument,
16
+ '\n query GetValueAtRiskAssetClasses($division: Division) {\n valueAtRiskAssetClasses(division: $division) {\n name\n instruments {\n name\n displayName\n }\n }\n }\n':
17
+ types.GetValueAtRiskAssetClassesDocument,
18
+ '\n query getValueAtRiskChart($instrument: String!, $division: Division!, $duration: ValueAtRiskDuration!, $bars: ValueAtRiskBars!) {\n valueAtRiskChart(instrument: $instrument, division: $division, duration: $duration, bars: $bars) {\n up {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n down {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n }\n }\n':
19
+ types.GetValueAtRiskChartDocument,
18
20
  };
19
21
 
20
22
  /**
@@ -34,14 +36,19 @@ export function graphql(source: string): unknown;
34
36
  /**
35
37
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
36
38
  */
37
- export function graphql(source: "\n query GetValueAtRiskAssetClasses($division: Division) {\n valueAtRiskAssetClasses(division: $division) {\n name\n instruments {\n name\n displayName\n }\n }\n }\n"): (typeof documents)["\n query GetValueAtRiskAssetClasses($division: Division) {\n valueAtRiskAssetClasses(division: $division) {\n name\n instruments {\n name\n displayName\n }\n }\n }\n"];
39
+ export function graphql(
40
+ source: '\n query GetValueAtRiskAssetClasses($division: Division) {\n valueAtRiskAssetClasses(division: $division) {\n name\n instruments {\n name\n displayName\n }\n }\n }\n'
41
+ ): (typeof documents)['\n query GetValueAtRiskAssetClasses($division: Division) {\n valueAtRiskAssetClasses(division: $division) {\n name\n instruments {\n name\n displayName\n }\n }\n }\n'];
38
42
  /**
39
43
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
40
44
  */
41
- export function graphql(source: "\n query getValueAtRiskChart($instrument: String!, $division: Division!, $duration: ValueAtRiskDuration!, $bars: ValueAtRiskBars!) {\n valueAtRiskChart(instrument: $instrument, division: $division, duration: $duration, bars: $bars) {\n up {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n down {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n }\n }\n"): (typeof documents)["\n query getValueAtRiskChart($instrument: String!, $division: Division!, $duration: ValueAtRiskDuration!, $bars: ValueAtRiskBars!) {\n valueAtRiskChart(instrument: $instrument, division: $division, duration: $duration, bars: $bars) {\n up {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n down {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n }\n }\n"];
45
+ export function graphql(
46
+ source: '\n query getValueAtRiskChart($instrument: String!, $division: Division!, $duration: ValueAtRiskDuration!, $bars: ValueAtRiskBars!) {\n valueAtRiskChart(instrument: $instrument, division: $division, duration: $duration, bars: $bars) {\n up {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n down {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n }\n }\n'
47
+ ): (typeof documents)['\n query getValueAtRiskChart($instrument: String!, $division: Division!, $duration: ValueAtRiskDuration!, $bars: ValueAtRiskBars!) {\n valueAtRiskChart(instrument: $instrument, division: $division, duration: $duration, bars: $bars) {\n up {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n down {\n points {\n pips\n percent\n }\n average\n median\n max\n threshold\n }\n }\n }\n'];
42
48
 
43
49
  export function graphql(source: string) {
44
50
  return (documents as any)[source] ?? {};
45
51
  }
46
52
 
47
- export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;
53
+ export type DocumentType<TDocumentNode extends DocumentNode<any, any>> =
54
+ TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;