@oanda/labs-crowd-view-widget 1.0.1
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 +8 -0
- package/codegen.ts +15 -0
- package/dist/main/CrowdViewWidget/CrowdViewWidget.js +40 -0
- package/dist/main/CrowdViewWidget/CrowdViewWidget.js.map +1 -0
- package/dist/main/CrowdViewWidget/Main.js +65 -0
- package/dist/main/CrowdViewWidget/Main.js.map +1 -0
- package/dist/main/CrowdViewWidget/config.js +97 -0
- package/dist/main/CrowdViewWidget/config.js.map +1 -0
- package/dist/main/CrowdViewWidget/index.js +28 -0
- package/dist/main/CrowdViewWidget/index.js.map +1 -0
- package/dist/main/CrowdViewWidget/render.js +41 -0
- package/dist/main/CrowdViewWidget/render.js.map +1 -0
- package/dist/main/CrowdViewWidget/types.js +33 -0
- package/dist/main/CrowdViewWidget/types.js.map +1 -0
- package/dist/main/gql/types/fragment-masking.js +23 -0
- package/dist/main/gql/types/fragment-masking.js.map +1 -0
- package/dist/main/gql/types/gql.js +16 -0
- package/dist/main/gql/types/gql.js.map +1 -0
- package/dist/main/gql/types/graphql.js +223 -0
- package/dist/main/gql/types/graphql.js.map +1 -0
- package/dist/main/gql/types/index.js +28 -0
- package/dist/main/gql/types/index.js.map +1 -0
- package/dist/main/gql/validateInstruments.js +16 -0
- package/dist/main/gql/validateInstruments.js.map +1 -0
- package/dist/main/index.js +17 -0
- package/dist/main/index.js.map +1 -0
- package/dist/main/translations/index.js +27 -0
- package/dist/main/translations/index.js.map +1 -0
- package/dist/main/translations/sources/en.json +2 -0
- package/dist/main/translations/sources/es.json +2 -0
- package/dist/main/translations/sources/th.json +2 -0
- package/dist/main/translations/sources/zh_TW.json +2 -0
- package/dist/main/translations/translations.js +8 -0
- package/dist/main/translations/translations.js.map +1 -0
- package/dist/module/CrowdViewWidget/CrowdViewWidget.js +33 -0
- package/dist/module/CrowdViewWidget/CrowdViewWidget.js.map +1 -0
- package/dist/module/CrowdViewWidget/Main.js +57 -0
- package/dist/module/CrowdViewWidget/Main.js.map +1 -0
- package/dist/module/CrowdViewWidget/config.js +92 -0
- package/dist/module/CrowdViewWidget/config.js.map +1 -0
- package/dist/module/CrowdViewWidget/index.js +3 -0
- package/dist/module/CrowdViewWidget/index.js.map +1 -0
- package/dist/module/CrowdViewWidget/render.js +38 -0
- package/dist/module/CrowdViewWidget/render.js.map +1 -0
- package/dist/module/CrowdViewWidget/types.js +27 -0
- package/dist/module/CrowdViewWidget/types.js.map +1 -0
- package/dist/module/gql/types/fragment-masking.js +15 -0
- package/dist/module/gql/types/fragment-masking.js.map +1 -0
- package/dist/module/gql/types/gql.js +8 -0
- package/dist/module/gql/types/gql.js.map +1 -0
- package/dist/module/gql/types/graphql.js +217 -0
- package/dist/module/gql/types/graphql.js.map +1 -0
- package/dist/module/gql/types/index.js +3 -0
- package/dist/module/gql/types/index.js.map +1 -0
- package/dist/module/gql/validateInstruments.js +10 -0
- package/dist/module/gql/validateInstruments.js.map +1 -0
- package/dist/module/index.js +2 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/translations/index.js +20 -0
- package/dist/module/translations/index.js.map +1 -0
- package/dist/module/translations/sources/en.json +2 -0
- package/dist/module/translations/sources/es.json +2 -0
- package/dist/module/translations/sources/th.json +2 -0
- package/dist/module/translations/sources/zh_TW.json +2 -0
- package/dist/module/translations/translations.js +2 -0
- package/dist/module/translations/translations.js.map +1 -0
- package/dist/types/CrowdViewWidget/CrowdViewWidget.d.ts +4 -0
- package/dist/types/CrowdViewWidget/Main.d.ts +4 -0
- package/dist/types/CrowdViewWidget/config.d.ts +20 -0
- package/dist/types/CrowdViewWidget/index.d.ts +2 -0
- package/dist/types/CrowdViewWidget/render.d.ts +1 -0
- package/dist/types/CrowdViewWidget/types.d.ts +32 -0
- package/dist/types/gql/types/fragment-masking.d.ts +15 -0
- package/dist/types/gql/types/gql.d.ts +37 -0
- package/dist/types/gql/types/graphql.d.ts +389 -0
- package/dist/types/gql/types/index.d.ts +2 -0
- package/dist/types/gql/validateInstruments.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/translations/index.d.ts +4 -0
- package/dist/types/translations/translations.d.ts +1 -0
- package/index.ts +1 -0
- package/lokalise.config.json +18 -0
- package/package.json +24 -0
- package/src/CrowdViewWidget/CrowdViewWidget.tsx +40 -0
- package/src/CrowdViewWidget/Main.tsx +91 -0
- package/src/CrowdViewWidget/config.ts +130 -0
- package/src/CrowdViewWidget/index.ts +2 -0
- package/src/CrowdViewWidget/render.tsx +51 -0
- package/src/CrowdViewWidget/types.ts +36 -0
- package/src/gql/types/fragment-masking.ts +86 -0
- package/src/gql/types/gql.ts +46 -0
- package/src/gql/types/graphql.ts +509 -0
- package/src/gql/types/index.ts +2 -0
- package/src/gql/validateInstruments.ts +10 -0
- package/src/index.ts +1 -0
- package/src/translations/index.ts +17 -0
- package/src/translations/sources/en.json +2 -0
- package/src/translations/sources/es.json +2 -0
- package/src/translations/sources/th.json +2 -0
- package/src/translations/sources/zh_TW.json +2 -0
- package/src/translations/translations.ts +1 -0
- package/test/Main.test.tsx +21 -0
- package/tsconfig.types.json +12 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { BookType } from '../gql/types/graphql';
|
|
2
|
+
import { GranularityId, InstrumentId } from './types';
|
|
3
|
+
|
|
4
|
+
const navigationConfig = [
|
|
5
|
+
{
|
|
6
|
+
id: BookType.Order,
|
|
7
|
+
label: 'order_book',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: BookType.Position,
|
|
11
|
+
label: 'position_book',
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const instrumentSelectConfigOC = [
|
|
16
|
+
{
|
|
17
|
+
id: InstrumentId.EUR_AUD,
|
|
18
|
+
label: 'EUR/AUD',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: InstrumentId.EUR_GBP,
|
|
22
|
+
label: 'EUR/GBP',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: InstrumentId.EUR_JPY,
|
|
26
|
+
label: 'EUR/JPY',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: InstrumentId.EUR_USD,
|
|
30
|
+
label: 'EUR/USD',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: InstrumentId.EUR_CHF,
|
|
34
|
+
label: 'EUR/CHF',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: InstrumentId.USD_CHF,
|
|
38
|
+
label: 'USD/CHF',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: InstrumentId.USD_JPY,
|
|
42
|
+
label: 'USD/JPY',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: InstrumentId.USD_CAD,
|
|
46
|
+
label: 'USD/CAD',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: InstrumentId.GBP_USD,
|
|
50
|
+
label: 'GBP/USD',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: InstrumentId.GBP_JPY,
|
|
54
|
+
label: 'GBP/JPY',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: InstrumentId.GBP_CHF,
|
|
58
|
+
label: 'GBP/CHF',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: InstrumentId.AUD_JPY,
|
|
62
|
+
label: 'AUD/JPY',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: InstrumentId.AUD_USD,
|
|
66
|
+
label: 'AUD/USD',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: InstrumentId.NZD_USD,
|
|
70
|
+
label: 'NZD/USD',
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
const instrumentSelectConfig = [
|
|
75
|
+
...instrumentSelectConfigOC,
|
|
76
|
+
{
|
|
77
|
+
id: InstrumentId.XAU_USD,
|
|
78
|
+
label: 'XAU/USD',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: InstrumentId.XAG_USD,
|
|
82
|
+
label: 'XAG/USD',
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const instrumentPrecisionConfig: Record<InstrumentId, number> = {
|
|
87
|
+
[InstrumentId.EUR_AUD]: 5,
|
|
88
|
+
[InstrumentId.EUR_GBP]: 5,
|
|
89
|
+
[InstrumentId.EUR_JPY]: 3,
|
|
90
|
+
[InstrumentId.EUR_USD]: 5,
|
|
91
|
+
[InstrumentId.EUR_CHF]: 5,
|
|
92
|
+
[InstrumentId.USD_CHF]: 5,
|
|
93
|
+
[InstrumentId.USD_JPY]: 3,
|
|
94
|
+
[InstrumentId.USD_CAD]: 5,
|
|
95
|
+
[InstrumentId.GBP_USD]: 5,
|
|
96
|
+
[InstrumentId.GBP_JPY]: 3,
|
|
97
|
+
[InstrumentId.GBP_CHF]: 5,
|
|
98
|
+
[InstrumentId.AUD_JPY]: 3,
|
|
99
|
+
[InstrumentId.AUD_USD]: 5,
|
|
100
|
+
[InstrumentId.NZD_USD]: 5,
|
|
101
|
+
[InstrumentId.XAU_USD]: 3,
|
|
102
|
+
[InstrumentId.XAG_USD]: 5,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const granularitySelectConfig = [
|
|
106
|
+
{
|
|
107
|
+
id: GranularityId.M5,
|
|
108
|
+
label: '5_minutes',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: GranularityId.M15,
|
|
112
|
+
label: '15_minutes',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: GranularityId.H1,
|
|
116
|
+
label: '1_hour',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: GranularityId.D1,
|
|
120
|
+
label: '1_day',
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
granularitySelectConfig,
|
|
126
|
+
instrumentPrecisionConfig,
|
|
127
|
+
instrumentSelectConfig,
|
|
128
|
+
instrumentSelectConfigOC,
|
|
129
|
+
navigationConfig,
|
|
130
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Theme } from '@oanda/labs-widget-common';
|
|
2
|
+
import { validateLocale, validateToolParams } from '@oanda/labs-widget-common';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
5
|
+
|
|
6
|
+
import { Division } from '../gql/types/graphql';
|
|
7
|
+
import { CrowdViewWidget } from './CrowdViewWidget';
|
|
8
|
+
|
|
9
|
+
const { graphqlUrl } = window.widgetsConfig || {};
|
|
10
|
+
|
|
11
|
+
const dataCrowdViewParamsElements = document.querySelectorAll(
|
|
12
|
+
'div[data-crowd-view-params]'
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
dataCrowdViewParamsElements.forEach((element) => {
|
|
16
|
+
const root = createRoot(element);
|
|
17
|
+
const params = element.getAttribute('data-crowd-view-params');
|
|
18
|
+
const mode = element.getAttribute('data-mode');
|
|
19
|
+
const { division, locale } = JSON.parse(params as string);
|
|
20
|
+
|
|
21
|
+
const isParamError = validateToolParams(
|
|
22
|
+
{
|
|
23
|
+
division,
|
|
24
|
+
locale,
|
|
25
|
+
graphqlUrl,
|
|
26
|
+
},
|
|
27
|
+
[
|
|
28
|
+
{
|
|
29
|
+
name: 'locale',
|
|
30
|
+
valueCheck: (value: string | undefined) => validateLocale(value),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'division',
|
|
34
|
+
valueCheck: (value: Division) =>
|
|
35
|
+
Object.values(Division).includes(value),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'graphqlUrl',
|
|
39
|
+
},
|
|
40
|
+
]
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
root.render(
|
|
44
|
+
<CrowdViewWidget
|
|
45
|
+
graphqlUrl={graphqlUrl}
|
|
46
|
+
isParamError={isParamError}
|
|
47
|
+
locale={locale}
|
|
48
|
+
theme={mode as Theme}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { WidgetConfig } from '@oanda/labs-widget-common';
|
|
2
|
+
|
|
3
|
+
import type { Division } from '../gql/types/graphql';
|
|
4
|
+
|
|
5
|
+
export interface CrowdViewConfig extends WidgetConfig {}
|
|
6
|
+
|
|
7
|
+
export interface MainProps {
|
|
8
|
+
instrument?: InstrumentId;
|
|
9
|
+
division: Division;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export enum InstrumentId {
|
|
13
|
+
EUR_AUD = 'EURAUD',
|
|
14
|
+
EUR_GBP = 'EURGBP',
|
|
15
|
+
EUR_JPY = 'EURJPY',
|
|
16
|
+
EUR_USD = 'EURUSD',
|
|
17
|
+
EUR_CHF = 'EURCHF',
|
|
18
|
+
USD_CHF = 'USDCHF',
|
|
19
|
+
USD_JPY = 'USDJPY',
|
|
20
|
+
USD_CAD = 'USDCAD',
|
|
21
|
+
GBP_USD = 'GBPUSD',
|
|
22
|
+
GBP_JPY = 'GBPJPY',
|
|
23
|
+
GBP_CHF = 'GBPCHF',
|
|
24
|
+
AUD_JPY = 'AUDJPY',
|
|
25
|
+
AUD_USD = 'AUDUSD',
|
|
26
|
+
NZD_USD = 'NZDUSD',
|
|
27
|
+
XAU_USD = 'XAUUSD',
|
|
28
|
+
XAG_USD = 'XAGUSD',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum GranularityId {
|
|
32
|
+
M5 = '5M',
|
|
33
|
+
M15 = '15M',
|
|
34
|
+
H1 = '1H',
|
|
35
|
+
D1 = '1D',
|
|
36
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ResultOf,
|
|
3
|
+
DocumentTypeDecoration,
|
|
4
|
+
TypedDocumentNode,
|
|
5
|
+
} from '@graphql-typed-document-node/core';
|
|
6
|
+
import { FragmentDefinitionNode } from 'graphql';
|
|
7
|
+
import { Incremental } from './graphql';
|
|
8
|
+
|
|
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
|
|
17
|
+
: never
|
|
18
|
+
: never;
|
|
19
|
+
|
|
20
|
+
// return non-nullable if `fragmentType` is non-nullable
|
|
21
|
+
export function useFragment<TType>(
|
|
22
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
23
|
+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
|
|
24
|
+
): TType;
|
|
25
|
+
// return nullable if `fragmentType` is nullable
|
|
26
|
+
export function useFragment<TType>(
|
|
27
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
28
|
+
fragmentType:
|
|
29
|
+
| FragmentType<DocumentTypeDecoration<TType, any>>
|
|
30
|
+
| null
|
|
31
|
+
| undefined
|
|
32
|
+
): TType | null | undefined;
|
|
33
|
+
// return array of non-nullable if `fragmentType` is array of non-nullable
|
|
34
|
+
export function useFragment<TType>(
|
|
35
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
36
|
+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
|
|
37
|
+
): ReadonlyArray<TType>;
|
|
38
|
+
// return array of nullable if `fragmentType` is array of nullable
|
|
39
|
+
export function useFragment<TType>(
|
|
40
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
41
|
+
fragmentType:
|
|
42
|
+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
|
|
43
|
+
| null
|
|
44
|
+
| undefined
|
|
45
|
+
): ReadonlyArray<TType> | null | undefined;
|
|
46
|
+
export function useFragment<TType>(
|
|
47
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
48
|
+
fragmentType:
|
|
49
|
+
| FragmentType<DocumentTypeDecoration<TType, any>>
|
|
50
|
+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
|
|
51
|
+
| null
|
|
52
|
+
| undefined
|
|
53
|
+
): TType | ReadonlyArray<TType> | null | undefined {
|
|
54
|
+
return fragmentType as any;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function makeFragmentData<
|
|
58
|
+
F extends DocumentTypeDecoration<any, any>,
|
|
59
|
+
FT extends ResultOf<F>,
|
|
60
|
+
>(data: FT, _fragment: F): FragmentType<F> {
|
|
61
|
+
return data as FragmentType<F>;
|
|
62
|
+
}
|
|
63
|
+
export function isFragmentReady<TQuery, TFrag>(
|
|
64
|
+
queryNode: DocumentTypeDecoration<TQuery, any>,
|
|
65
|
+
fragmentNode: TypedDocumentNode<TFrag>,
|
|
66
|
+
data:
|
|
67
|
+
| FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>
|
|
68
|
+
| null
|
|
69
|
+
| undefined
|
|
70
|
+
): data is FragmentType<typeof fragmentNode> {
|
|
71
|
+
const deferredFields = (
|
|
72
|
+
queryNode as {
|
|
73
|
+
__meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };
|
|
74
|
+
}
|
|
75
|
+
).__meta__?.deferredFields;
|
|
76
|
+
|
|
77
|
+
if (!deferredFields) return true;
|
|
78
|
+
|
|
79
|
+
const fragDef = fragmentNode.definitions[0] as
|
|
80
|
+
| FragmentDefinitionNode
|
|
81
|
+
| undefined;
|
|
82
|
+
const fragName = fragDef?.name?.value;
|
|
83
|
+
|
|
84
|
+
const fields = (fragName && deferredFields[fragName]) || [];
|
|
85
|
+
return fields.length > 0 && fields.every((field) => data && field in data);
|
|
86
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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':
|
|
17
|
+
types.ValidateInstrumentsDocument,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
22
|
+
*
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* The query argument is unknown!
|
|
30
|
+
* Please regenerate the types.
|
|
31
|
+
*/
|
|
32
|
+
export function graphql(source: string): unknown;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
36
|
+
*/
|
|
37
|
+
export function graphql(
|
|
38
|
+
source: '\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n'
|
|
39
|
+
): (typeof documents)['\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n'];
|
|
40
|
+
|
|
41
|
+
export function graphql(source: string) {
|
|
42
|
+
return (documents as any)[source] ?? {};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> =
|
|
46
|
+
TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
|