forked from gatsbyjs/gatsby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
1633 lines (1438 loc) · 42.8 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import type { TrailingSlash } from "gatsby-page-utils"
import type { Express } from "express"
import { IProgram, Stage } from "../commands/types"
import { GraphQLFieldExtensionDefinition } from "../schema/extensions"
import {
DocumentNode,
GraphQLSchema,
DefinitionNode,
SourceLocation,
} from "graphql"
import { SchemaComposer } from "graphql-compose"
import { IGatsbyCLIState } from "gatsby-cli/src/reporter/redux/types"
import { ThunkAction } from "redux-thunk"
import { InternalJob, JobResultInterface } from "../utils/jobs/manager"
import { ITypeMetadata } from "../schema/infer/inference-metadata"
import { Span } from "opentracing"
import { ICollectedSlices } from "../utils/babel/find-slices"
import type {
IAdapter,
IAdapterFinalConfig,
IAdapterManager,
} from "../utils/adapter/types"
type SystemPath = string
type Identifier = string
export interface IRedirect {
fromPath: string
toPath: string
isPermanent?: boolean
redirectInBrowser?: boolean
ignoreCase: boolean
statusCode?: HttpStatusCode
// Users can add anything to this createRedirect API
[key: string]: any
}
export enum ProgramStatus {
BOOTSTRAP_FINISHED = `BOOTSTRAP_FINISHED`,
BOOTSTRAP_QUERY_RUNNING_FINISHED = `BOOTSTRAP_QUERY_RUNNING_FINISHED`,
}
export type PageMode = "SSG" | "DSG" | "SSR"
export interface IGatsbyPage {
internalComponentName: string
path: string
matchPath: undefined | string
component: SystemPath
componentChunkName: string
isCreatedByStatefulCreatePages: boolean
context: Record<string, unknown>
updatedAt: number
// eslint-disable-next-line @typescript-eslint/naming-convention
pluginCreator___NODE: Identifier
pluginCreatorId: Identifier
componentPath: SystemPath
ownerNodeId: Identifier
manifestId?: string
defer?: boolean
/**
* INTERNAL. Do not use `page.mode`, it can be removed at any time
* `page.mode` is currently reliable only in engines and `onPostBuild` hook
* (in develop it is dynamic and can change at any time)
* TODO: remove, see comments in utils/page-mode:materializePageMode
*
* @internal
*/
mode: PageMode
slices: Record<string, string>
}
export interface IGatsbySlice {
componentPath: string
componentChunkName: string
context: Record<string, unknown>
name: string
updatedAt: number
}
export interface IGatsbyFunction {
/** The route in the browser to access the function **/
functionRoute: string
/** The absolute path to the original function **/
originalAbsoluteFilePath: string
/** The relative path to the original function **/
originalRelativeFilePath: string
/** The relative path to the compiled function (always ends with .js) **/
relativeCompiledFilePath: string
/** The absolute path to the compiled function (doesn't transfer across machines) **/
absoluteCompiledFilePath: string
/** The matchPath regex created by path-to-regexp. Only created if the function is dynamic. **/
matchPath: string | undefined
/** The plugin that owns this function route **/
pluginName: string
/** Function identifier used to match functions usage in routes manifest */
functionId: string
}
export interface IGraphQLTypegenOptions {
typesOutputPath: string
documentSearchPaths: Array<string>
generateOnBuild: boolean
}
export interface IHeader {
source: string
headers: Array<{
key: string
value: string
}>
}
// TODO: The keys of IGatsbyConfig are all optional so that in reducers like reducers/config.ts the default state for the config can be an empty object. This isn't ideal because some of those options are actually always defined because Joi validation sets defaults. Somehow fix this :D
export interface IGatsbyConfig {
plugins?: Array<{
// This is the name of the plugin like `gatsby-plugin-manifest`
resolve: string
options: {
[key: string]: unknown
}
}>
siteMetadata?: {
title?: string
author?: string
description?: string
siteUrl?: string
// siteMetadata is free form
[key: string]: unknown
}
// @deprecated
polyfill?: boolean
developMiddleware?: (app: Express) => void
proxy?: any
partytownProxiedURLs?: Array<string>
pathPrefix?: string
assetPrefix?: string
mapping?: Record<string, string>
jsxRuntime?: "classic" | "automatic"
jsxImportSource?: string
trailingSlash?: TrailingSlash
graphqlTypegen?: IGraphQLTypegenOptions
headers?: Array<IHeader>
adapter?: IAdapter | false
}
export interface IGatsbyNode {
id: Identifier
parent: Identifier
children: Array<Identifier>
internal: {
type: string
counter: number
owner: string
contentDigest: string
mediaType?: string
content?: string
description?: string
}
[key: string]: unknown
fields: Array<string>
}
export interface IGatsbyPlugin {
id: Identifier
name: string
version: string
[key: string]: any
}
export interface IGatsbyPluginContext {
[key: string]: (...args: Array<any>) => any
}
export interface IGatsbyStaticQueryComponents {
name: string
componentPath: SystemPath
id: Identifier
query: string
hash: string
}
export interface IGatsbyPageComponent {
componentPath: SystemPath
componentChunkName: string
query: string
pages: Set<string>
isInBootstrap: boolean
serverData: boolean
config: boolean
isSlice: boolean
Head: boolean
}
export interface IDefinitionMeta {
name: string
def: DefinitionNode
filePath: string
text: string
templateLoc: SourceLocation
printedAst: string | null
isHook: boolean
isStaticQuery: boolean
isFragment: boolean
isConfigQuery: boolean
hash: number
}
type GatsbyNodes = Map<string, IGatsbyNode>
export interface IGatsbyIncompleteJobV2 {
job: InternalJob
}
export interface IGatsbyIncompleteJob {
job: InternalJob
plugin: IGatsbyPlugin
}
export interface IGatsbyCompleteJobV2 {
result: JobResultInterface
inputPaths: InternalJob["inputPaths"]
}
export interface IPlugin {
name: string
options: Record<string, unknown>
}
export interface IBabelStage {
plugins: Array<IPlugin>
presets: Array<IPlugin>
options?: {
cacheDirectory: boolean
sourceType: string
sourceMaps?: string
}
}
export interface IStateProgram extends IProgram {
extensions: Array<string>
browserslist: Array<string>
}
export interface IQueryState {
dirty: number
running: number
}
export interface IComponentState {
componentPath: string
query: string
pages: Set<Identifier>
errors: number
}
export interface IHtmlFileState {
dirty: number
isDeleted: boolean
pageDataHash: string
}
export interface IStaticQueryResultState {
dirty: number
staticQueryResultHash: string
}
export type GatsbyNodeAPI =
| "onPreBootstrap"
| "onPostBootstrap"
| "onCreateWebpackConfig"
| "onCreatePage"
| "onCreateNode"
| "sourceNodes"
| "createPagesStatefully"
| "createPages"
| "onPostBuild"
export interface IGatsbyState {
program: IStateProgram
nodes: GatsbyNodes
nodesByType: Map<string, GatsbyNodes>
resolvedNodesCache: Map<string, any> // TODO
nodesTouched: Set<string>
typeOwners: {
pluginsToTypes: Map<
IGatsbyPlugin[`name`],
Set<IGatsbyNode[`internal`][`type`]>
>
typesToPlugins: Map<IGatsbyNode[`internal`][`type`], IGatsbyPlugin[`name`]>
}
nodeManifests: Array<INodeManifest>
requestHeaders: Map<string, { [header: string]: string }>
statefulSourcePlugins: Set<string>
telemetry: ITelemetry
lastAction: ActionsUnion
flattenedPlugins: Array<{
resolve: SystemPath
id: Identifier
name: string
version: string
pluginOptions: {
plugins: []
[key: string]: unknown
}
nodeAPIs: Array<GatsbyNodeAPI>
browserAPIs: Array<
| "onRouteUpdate"
| "registerServiceWorker"
| "onServiceWorkerActive"
| "onPostPrefetchPathname"
>
ssrAPIs: Array<"onRenderBody" | "onPreRenderHTML">
pluginFilepath: SystemPath
subPluginPaths?: Array<string>
modulePath?: string
}>
config: IGatsbyConfig
functions: Array<IGatsbyFunction>
pages: Map<string, IGatsbyPage>
schema: GraphQLSchema
definitions: Map<string, IDefinitionMeta>
status: {
plugins: Record<string, IGatsbyPlugin>
PLUGINS_HASH: Identifier
LAST_NODE_COUNTER: number
cdnObfuscatedPrefix: string
}
queries: {
byNode: Map<Identifier, Set<Identifier>>
byConnection: Map<string, Set<Identifier>>
queryNodes: Map<Identifier, Set<Identifier>>
trackedQueries: Map<Identifier, IQueryState>
trackedComponents: Map<string, IComponentState>
deletedQueries: Set<Identifier>
dirtyQueriesListToEmitViaWebsocket: Array<string>
}
components: Map<IGatsbyPageComponent["componentPath"], IGatsbyPageComponent>
staticQueryComponents: Map<
IGatsbyStaticQueryComponents["id"],
IGatsbyStaticQueryComponents
>
staticQueriesByTemplate: Map<SystemPath, Array<Identifier>>
pendingPageDataWrites: {
pagePaths: Set<string>
sliceNames: Set<string>
}
// @deprecated
jobs: {
active: Array<any> // TODO
done: Array<any> // TODO
}
jobsV2: {
incomplete: Map<Identifier, IGatsbyIncompleteJobV2>
complete: Map<Identifier, IGatsbyCompleteJobV2>
jobsByRequest: Map<string, Set<Identifier>>
}
webpack: any // TODO This should be the output from ./utils/webpack.config.js
webpackCompilationHash: string
redirects: Array<IRedirect>
babelrc: {
stages: {
[key in Stage]: IBabelStage
}
}
schemaCustomization: {
composer: null | SchemaComposer<any>
context: Record<string, any>
fieldExtensions: GraphQLFieldExtensionDefinition
printConfig: {
path?: string
include?: { types?: Array<string>; plugins?: Array<string> }
exclude?: { types?: Array<string>; plugins?: Array<string> }
withFieldTypes?: boolean
} | null
thirdPartySchemas: Array<GraphQLSchema>
types: Array<
string | { typeOrTypeDef: DocumentNode; plugin: IGatsbyPlugin }
>
}
logs: IGatsbyCLIState
inferenceMetadata: {
step: string // TODO make enum or union
typeMap: {
[key: string]: ITypeMetadata
}
}
pageDataStats: Map<SystemPath, number>
visitedPages: Map<string, Set<string>>
html: {
trackedHtmlFiles: Map<Identifier, IHtmlFileState>
browserCompilationHash: string
ssrCompilationHash: string
trackedStaticQueryResults: Map<string, IStaticQueryResultState>
unsafeBuiltinWasUsedInSSR: boolean
templateCompilationHashes: Record<string, string>
slicesProps: {
bySliceId: Map<
string,
{
pages: Set<string>
props: Record<string, unknown>
sliceName: string
hasChildren: boolean
dirty: number
}
>
byPagePath: Map<string, Set<string>>
bySliceName: Map<
string,
{
sliceDataHash: string
dirty: number
props: Set<string>
}
>
}
pagesThatNeedToStitchSlices: Set<string>
}
slices: Map<string, IGatsbySlice>
componentsUsingSlices: Map<string, ICollectedSlices>
slicesByTemplate: Map<SystemPath, ICollectedSlices>
adapter: {
instance?: IAdapter
manager: IAdapterManager
config: IAdapterFinalConfig
}
}
export type GatsbyStateKeys = keyof IGatsbyState
export interface ICachedReduxState {
nodes?: IGatsbyState["nodes"]
typeOwners?: IGatsbyState["typeOwners"]
statefulSourcePlugins?: IGatsbyState["statefulSourcePlugins"]
status: IGatsbyState["status"]
components: IGatsbyState["components"]
jobsV2: IGatsbyState["jobsV2"]
staticQueryComponents: IGatsbyState["staticQueryComponents"]
webpackCompilationHash: IGatsbyState["webpackCompilationHash"]
pageDataStats: IGatsbyState["pageDataStats"]
pages?: IGatsbyState["pages"]
staticQueriesByTemplate: IGatsbyState["staticQueriesByTemplate"]
pendingPageDataWrites: IGatsbyState["pendingPageDataWrites"]
queries: IGatsbyState["queries"]
html: IGatsbyState["html"]
slices: IGatsbyState["slices"]
slicesByTemplate: IGatsbyState["slicesByTemplate"]
}
export type ActionsUnion =
| IInitAction
| IAddChildNodeToParentNodeAction
| IAddFieldToNodeAction
| IAddThirdPartySchema
| IApiFinishedAction
| ICreateFieldExtension
| ICreateNodeAction
| ICreatePageAction
| ICreatePageDependencyAction
| ICreateTypes
| IDeleteCacheAction
| IDeleteNodeAction
| IDeletePageAction
| IPageQueryRunAction
| IPrintTypeDefinitions
| IQueryClearDirtyQueriesListToEmitViaWebsocket
| IQueryExtractedAction
| IQueryExtractedBabelSuccessAction
| IQueryExtractionBabelErrorAction
| IQueryExtractionGraphQLErrorAction
| IQueryStartAction
| IRemoveStaticQuery
| IReplaceComponentQueryAction
| IReplaceStaticQueryAction
| IReplaceWebpackConfigAction
| ISetPluginStatusAction
| ISetProgramStatusAction
| ISetResolvedNodesAction
| ISetSchemaAction
| ISetGraphQLDefinitionsAction
| ISetSiteFlattenedPluginsAction
| ISetWebpackCompilationHashAction
| ISetSSRGlobalSharedWebpackCompilationHashAction
| ISetWebpackConfigAction
| ITouchNodeAction
| IUpdatePluginsHashAction
| ICreateJobV2Action
| IEndJobV2Action
| IRemoveStaleJobV2Action
| IAddPageDataStatsAction
| IAddSliceDataStatsAction
| IRemoveTemplateComponentAction
| ISetBabelPluginAction
| ISetBabelPresetAction
| ISetBabelOptionsAction
| ICreateJobAction
| ISetJobAction
| IEndJobAction
| ISetStaticQueriesByTemplateAction
| IAddPendingPageDataWriteAction
| IAddPendingTemplateDataWriteAction
| IAddPendingSliceDataWriteAction
| IAddPendingSliceTemplateDataWriteAction
| IClearPendingPageDataWriteAction
| IClearPendingSliceDataWriteAction
| ICreateResolverContext
| IClearSchemaCustomizationAction
| ISetSchemaComposerAction
| IStartIncrementalInferenceAction
| IBuildTypeMetadataAction
| IDisableTypeInferenceAction
| ISetProgramAction
| ISetProgramExtensions
| IRemovedHtml
| ITrackedHtmlCleanup
| IGeneratedHtml
| IMarkHtmlDirty
| ISSRUsedUnsafeBuiltin
| ISetSiteConfig
| IMergeWorkerQueryState
| ISetComponentFeatures
| IMaterializePageMode
| ISetJobV2Context
| IClearJobV2Context
| ISetDomainRequestHeaders
| IEnableStatefulSourcePluginAction
| ICreateSliceAction
| IDeleteSliceAction
| ISetSSRTemplateWebpackCompilationHashAction
| ISetComponentsUsingSlicesAction
| ISetSlicesByTemplateAction
| ISetSlicesProps
| ISlicesPropsRemoveStale
| ISlicesPropsRendered
| ISlicesStitched
| ISlicesScriptsRegenerated
| IProcessGatsbyImageSourceUrlAction
| IClearGatsbyImageSourceUrlAction
| ISetAdapterAction
| IDisablePluginsByNameAction
export interface IInitAction {
type: `INIT`
}
export interface ISetComponentFeatures {
type: `SET_COMPONENT_FEATURES`
payload: {
componentPath: string
serverData: boolean
config: boolean
Head: boolean
}
}
export interface IApiFinishedAction {
type: `API_FINISHED`
payload: {
apiName: GatsbyNodeAPI
}
}
interface ISetBabelPluginAction {
type: `SET_BABEL_PLUGIN`
payload: {
stage: Stage
name: IPlugin["name"]
options: IPlugin["options"]
}
}
interface ISetBabelPresetAction {
type: `SET_BABEL_PRESET`
payload: {
stage: Stage
name: IPlugin["name"]
options: IPlugin["options"]
}
}
interface ISetBabelOptionsAction {
type: `SET_BABEL_OPTIONS`
payload: {
stage: Stage
name: IPlugin["name"]
options: IPlugin["options"]
}
}
export interface ICreateJobV2Action {
type: `CREATE_JOB_V2`
payload: {
job: IGatsbyIncompleteJobV2["job"]
}
plugin: { name: string }
}
export interface IEndJobV2Action {
type: `END_JOB_V2`
payload: {
jobContentDigest: string
result: JobResultInterface
}
plugin: { name: string }
}
export interface IRemoveStaleJobV2Action {
type: `REMOVE_STALE_JOB_V2`
payload: {
contentDigest: string
}
}
export type ICreateJobV2FromInternalAction = ThunkAction<
Promise<Record<string, unknown>>,
IGatsbyState,
void,
ActionsUnion
>
interface ICreateJobAction {
type: `CREATE_JOB`
payload: {
id: string
job: IGatsbyIncompleteJob["job"]
}
plugin: IGatsbyIncompleteJob["plugin"]
}
interface ISetJobAction {
type: `SET_JOB`
payload: {
id: string
job: IGatsbyIncompleteJob["job"]
}
plugin: IGatsbyIncompleteJob["plugin"]
}
interface IEndJobAction {
type: `END_JOB`
payload: {
id: string
job: IGatsbyIncompleteJob["job"]
}
plugin: IGatsbyIncompleteJob["plugin"]
}
export interface ICreatePageDependencyActionPayloadType {
path: string
nodeId?: string
connection?: string
}
export interface ICreatePageDependencyAction {
type: `CREATE_COMPONENT_DEPENDENCY`
plugin?: string
payload: Array<ICreatePageDependencyActionPayloadType>
}
export interface IDeleteComponentDependenciesAction {
type: "DELETE_COMPONENTS_DEPENDENCIES"
payload: {
paths: Array<string>
}
}
export interface IReplaceComponentQueryAction {
type: "REPLACE_COMPONENT_QUERY"
payload: {
query: string
componentPath: string
}
}
export interface IReplaceStaticQueryAction {
type: `REPLACE_STATIC_QUERY`
plugin: IGatsbyPlugin | null | undefined
payload: {
name: string
componentPath: string
id: string
query: string
hash: string
}
}
export interface IQueryClearDirtyQueriesListToEmitViaWebsocket {
type: `QUERY_CLEAR_DIRTY_QUERIES_LIST_TO_EMIT_VIA_WEBSOCKET`
}
export interface IQueryExtractedAction {
type: `QUERY_EXTRACTED`
plugin: IGatsbyPlugin
traceId: string | undefined
payload: { componentPath: string; query: string }
}
export interface IQueryExtractionGraphQLErrorAction {
type: `QUERY_EXTRACTION_GRAPHQL_ERROR`
plugin: IGatsbyPlugin
traceId: string | undefined
payload: { componentPath: string; error: string }
}
export interface IQueryExtractedBabelSuccessAction {
type: `QUERY_EXTRACTION_BABEL_SUCCESS`
plugin: IGatsbyPlugin
traceId: string | undefined
payload: { componentPath: string }
}
export interface IQueryExtractionBabelErrorAction {
type: `QUERY_EXTRACTION_BABEL_ERROR`
plugin: IGatsbyPlugin
traceId: string | undefined
payload: {
componentPath: string
error: Error
}
}
export interface ISetProgramStatusAction {
type: `SET_PROGRAM_STATUS`
plugin: IGatsbyPlugin
traceId: string | undefined
payload: ProgramStatus
}
export interface IPageQueryRunAction {
type: `PAGE_QUERY_RUN`
plugin: IGatsbyPlugin
traceId: string | undefined
payload: {
path: string
componentPath: string
queryType: "page" | "static" | "slice"
resultHash: string
queryHash: string
}
}
export interface IQueryStartAction {
type: `QUERY_START`
plugin: IGatsbyPlugin
traceId: string | undefined
payload: { path: string; componentPath: string; isPage: boolean }
}
export interface IRemoveStaleJobAction {
type: `REMOVE_STALE_JOB_V2`
plugin: IGatsbyPlugin | undefined
traceId?: string
payload: { contentDigest: string }
}
export interface IAddThirdPartySchema {
type: `ADD_THIRD_PARTY_SCHEMA`
plugin: IGatsbyPlugin
traceId?: string
payload: GraphQLSchema
}
export interface ICreateTypes {
type: `CREATE_TYPES`
plugin: IGatsbyPlugin
traceId?: string
payload: DocumentNode | Array<DocumentNode>
}
export interface ICreateFieldExtension {
type: `CREATE_FIELD_EXTENSION`
plugin: IGatsbyPlugin
traceId?: string
payload: {
name: string
extension: GraphQLFieldExtensionDefinition
}
}
export interface IPrintTypeDefinitions {
type: `PRINT_SCHEMA_REQUESTED`
plugin: IGatsbyPlugin
traceId?: string
payload: {
path?: string
include?: { types?: Array<string>; plugins?: Array<string> }
exclude?: { types?: Array<string>; plugins?: Array<string> }
withFieldTypes?: boolean
}
}
export interface ICreateResolverContext {
type: `CREATE_RESOLVER_CONTEXT`
plugin: IGatsbyPlugin
traceId?: string
payload:
| IGatsbyPluginContext
| { [camelCasedPluginNameWithoutPrefix: string]: IGatsbyPluginContext }
}
interface IClearSchemaCustomizationAction {
type: `CLEAR_SCHEMA_CUSTOMIZATION`
}
interface ISetSchemaComposerAction {
type: `SET_SCHEMA_COMPOSER`
payload: SchemaComposer<any>
}
export interface ICreateServerVisitedPage {
type: `CREATE_SERVER_VISITED_PAGE`
payload: IGatsbyPage
plugin?: IGatsbyPlugin
}
export interface ICreatePageAction {
type: `CREATE_PAGE`
payload: IGatsbyPage
plugin?: IGatsbyPlugin
contextModified?: boolean
componentModified?: boolean
slicesModified?: boolean
}
export interface ICreateSliceAction {
type: `CREATE_SLICE`
payload: IGatsbySlice
plugin?: IGatsbyPlugin
traceId: string | undefined
componentModified?: boolean
contextModified?: boolean
}
export interface IDeleteSliceAction {
type: `DELETE_SLICE`
payload: {
name: string
componentPath: string
}
}
export interface ISetComponentsUsingSlicesAction {
type: `SET_COMPONENTS_USING_PAGE_SLICES`
payload: Map<string, ICollectedSlices>
}
export interface ISetSlicesByTemplateAction {
type: `SET_SLICES_BY_TEMPLATE`
payload: {
componentPath: string
slices: ICollectedSlices
}
}
export interface ISetSlicesProps {
type: `SET_SLICES_PROPS`
payload: Record<
string,
Record<
string,
{
props: Record<string, unknown>
sliceName: string
hasChildren: boolean
}
>
>
}
export interface ISlicesPropsRemoveStale {
type: `SLICES_PROPS_REMOVE_STALE`
}
export interface ISlicesPropsRendered {
type: `SLICES_PROPS_RENDERED`
payload: Array<{ sliceId: string }>
}
export interface ISlicesStitched {
type: `SLICES_STITCHED`
}
export interface ISlicesScriptsRegenerated {
type: `SLICES_SCRIPTS_REGENERATED`
}
export interface ICreateRedirectAction {
type: `CREATE_REDIRECT`
payload: IRedirect
}
export interface IDeleteCacheAction {
type: `DELETE_CACHE`
cacheIsCorrupt?: boolean
}
export interface IRemoveTemplateComponentAction {
type: `REMOVE_STATIC_QUERIES_BY_TEMPLATE`
payload: {
componentPath: string
}
}
export interface ISetStaticQueriesByTemplateAction {
type: `SET_STATIC_QUERIES_BY_TEMPLATE`
payload: {
componentPath: string
staticQueryHashes: Array<Identifier>
}
}
export interface IAddPendingPageDataWriteAction {
type: `ADD_PENDING_PAGE_DATA_WRITE`
payload: {
path: string
}
}
export interface IAddPendingTemplateDataWriteAction {
type: `ADD_PENDING_TEMPLATE_DATA_WRITE`
payload: {
componentPath: SystemPath
pages: Array<string>
}
}
export interface IAddPendingSliceDataWriteAction {
type: `ADD_PENDING_SLICE_DATA_WRITE`
payload: {
name: string
}
}
export interface IAddPendingSliceTemplateDataWriteAction {
type: `ADD_PENDING_SLICE_TEMPLATE_DATA_WRITE`
payload: {
componentPath: SystemPath
sliceNames: Array<string>
}
}
export interface IClearPendingPageDataWriteAction {
type: `CLEAR_PENDING_PAGE_DATA_WRITE`
payload: {
page: string
}
}
export interface IClearPendingSliceDataWriteAction {
type: `CLEAR_PENDING_SLICE_DATA_WRITE`
payload: {
name: string
}
}
export interface IDeletePageAction {
type: `DELETE_PAGE`
payload: IGatsbyPage
}
export interface IRemoveStaticQuery {
type: `REMOVE_STATIC_QUERY`
payload: IGatsbyStaticQueryComponents["id"]
}
export interface ISetWebpackCompilationHashAction {
type: `SET_WEBPACK_COMPILATION_HASH`
payload: IGatsbyState["webpackCompilationHash"]
}
export interface ISetSSRGlobalSharedWebpackCompilationHashAction {
type: `SET_SSR_WEBPACK_COMPILATION_HASH`
payload: string
}
export interface ISetSSRTemplateWebpackCompilationHashAction {
type: `SET_SSR_TEMPLATE_WEBPACK_COMPILATION_HASH`
payload: {
templateHash: string
templatePath: string
isSlice: boolean
pages: Array<string>
}
}
export interface IUpdatePluginsHashAction {
type: `UPDATE_PLUGINS_HASH`
payload: Identifier
}
export interface ISetPluginStatusAction {
type: `SET_PLUGIN_STATUS`
plugin: IGatsbyPlugin
payload: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any
}
}