relay-runtime 21.0.0 → 21.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.
Files changed (107) hide show
  1. package/experimental.d.ts +34 -0
  2. package/experimental.js +1 -1
  3. package/experimental.js.flow +4 -4
  4. package/handlers/RelayDefaultHandlerProvider.d.ts +12 -0
  5. package/handlers/connection/ConnectionHandler.d.ts +51 -0
  6. package/handlers/connection/ConnectionInterface.d.ts +40 -0
  7. package/handlers/connection/MutationHandlers.d.ts +17 -0
  8. package/index.d.ts +274 -0
  9. package/index.js +1 -1
  10. package/llm-docs/api-reference/relay-runtime/fetch-query.mdx +5 -0
  11. package/llm-docs/getting-started/compiler.mdx +19 -3
  12. package/llm-docs/getting-started/quick-start.mdx +15 -12
  13. package/llm-docs/guides/codemods.mdx +14 -1
  14. package/multi-actor-environment/ActorIdentifier.d.ts +17 -0
  15. package/multi-actor-environment/ActorSpecificEnvironment.js.flow +9 -9
  16. package/multi-actor-environment/MultiActorEnvironment.d.ts +123 -0
  17. package/multi-actor-environment/MultiActorEnvironment.js.flow +22 -18
  18. package/multi-actor-environment/MultiActorEnvironmentTypes.d.ts +225 -0
  19. package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +3 -3
  20. package/multi-actor-environment/index.d.ts +14 -0
  21. package/multi-actor-environment.d.ts +8 -0
  22. package/mutations/RelayDeclarativeMutationConfig.d.ts +70 -0
  23. package/mutations/applyOptimisticMutation.d.ts +25 -0
  24. package/mutations/commitLocalUpdate.d.ts +10 -0
  25. package/mutations/commitMutation.d.ts +48 -0
  26. package/mutations/commitMutation.js.flow +1 -1
  27. package/network/RelayNetwork.d.ts +12 -0
  28. package/network/RelayNetworkTypes.d.ts +145 -0
  29. package/network/RelayNetworkTypes.js.flow +15 -15
  30. package/network/RelayObservable.d.ts +197 -0
  31. package/network/RelayObservable.js.flow +21 -21
  32. package/network/RelayQueryResponseCache.d.ts +16 -0
  33. package/package.json +1 -1
  34. package/query/GraphQLTag.d.ts +45 -0
  35. package/query/fetchQuery.d.ts +21 -0
  36. package/query/fetchQueryInternal.d.ts +26 -0
  37. package/query/fetchQueryInternal.js.flow +4 -4
  38. package/query/fetchQuery_DEPRECATED.d.ts +17 -0
  39. package/store/ClientID.d.ts +14 -0
  40. package/store/DataChecker.js.flow +8 -6
  41. package/store/NormalizationEngine.js.flow +4 -1
  42. package/store/OperationExecutor.d.ts +51 -0
  43. package/store/OperationExecutor.js.flow +33 -30
  44. package/store/RelayModernEnvironment.d.ts +97 -0
  45. package/store/RelayModernEnvironment.js.flow +21 -21
  46. package/store/RelayModernOperationDescriptor.d.ts +28 -0
  47. package/store/RelayModernRecord.d.ts +92 -0
  48. package/store/RelayModernSelector.d.ts +123 -0
  49. package/store/RelayModernStore.d.ts +57 -0
  50. package/store/RelayOperationTracker.d.ts +29 -0
  51. package/store/RelayPublishQueue.js.flow +8 -8
  52. package/store/RelayRecordSource.d.ts +26 -0
  53. package/store/RelayRecordState.d.ts +28 -0
  54. package/store/RelayResponseNormalizer.d.ts +28 -0
  55. package/store/RelayResponseNormalizer.js.flow +8 -8
  56. package/store/RelayStoreTypes.d.ts +1327 -0
  57. package/store/RelayStoreTypes.js.flow +284 -280
  58. package/store/RelayStoreUtils.d.ts +86 -0
  59. package/store/RelayStoreUtils.js.flow +2 -2
  60. package/store/ResolverFragments.d.ts +43 -0
  61. package/store/ResolverFragments.js.flow +14 -6
  62. package/store/StoreInspector.js.flow +2 -2
  63. package/store/ViewerPattern.d.ts +11 -0
  64. package/store/createFragmentSpecResolver.d.ts +16 -0
  65. package/store/defaultGetDataID.js.flow +1 -1
  66. package/store/isRelayModernEnvironment.d.ts +8 -0
  67. package/store/live-resolvers/LiveResolverCache.js.flow +1 -1
  68. package/store/live-resolvers/resolverDataInjector.d.ts +27 -0
  69. package/store/observeFragmentExperimental.d.ts +46 -0
  70. package/store/observeFragmentExperimental.js.flow +1 -1
  71. package/store/observeQueryExperimental.d.ts +30 -0
  72. package/store/readInlineData.d.ts +19 -0
  73. package/store/readInlineData.js.flow +1 -1
  74. package/store/waitForFragmentExperimental.d.ts +49 -0
  75. package/subscription/requestSubscription.d.ts +27 -0
  76. package/subscription/requestSubscription.js.flow +3 -3
  77. package/util/JSResourceTypes.flow.js.flow +4 -4
  78. package/util/NormalizationNode.d.ts +235 -0
  79. package/util/NormalizationNode.js.flow +124 -122
  80. package/util/ReaderNode.d.ts +264 -0
  81. package/util/ReaderNode.js.flow +152 -149
  82. package/util/RelayConcreteNode.d.ts +120 -0
  83. package/util/RelayConcreteNode.js.flow +31 -31
  84. package/util/RelayError.d.ts +13 -0
  85. package/util/RelayFeatureFlags.d.ts +40 -0
  86. package/util/RelayProfiler.d.ts +121 -0
  87. package/util/RelayReplaySubject.d.ts +25 -0
  88. package/util/RelayRuntimeTypes.d.ts +59 -0
  89. package/util/RelayRuntimeTypes.js.flow +33 -30
  90. package/util/createPayloadFor3DField.d.ts +17 -0
  91. package/util/createPayloadFor3DField.js.flow +4 -4
  92. package/util/deepFreeze.d.ts +8 -0
  93. package/util/getFragmentIdentifier.d.ts +10 -0
  94. package/util/getPaginationMetadata.d.ts +20 -0
  95. package/util/getPaginationVariables.d.ts +20 -0
  96. package/util/getPendingOperationsForFragment.d.ts +18 -0
  97. package/util/getRefetchMetadata.d.ts +19 -0
  98. package/util/getRelayHandleKey.d.ts +8 -0
  99. package/util/getRequestIdentifier.d.ts +17 -0
  100. package/util/getValueAtPath.d.ts +8 -0
  101. package/util/handlePotentialSnapshotErrors.d.ts +14 -0
  102. package/util/isEmptyObject.js.flow +1 -1
  103. package/util/isPromise.d.ts +8 -0
  104. package/util/isScalarAndEqual.d.ts +8 -0
  105. package/util/recycleNodesInto.d.ts +8 -0
  106. package/util/stableCopy.d.ts +8 -0
  107. package/util/withProvidedVariables.d.ts +19 -0
@@ -66,9 +66,9 @@ export type OperationTracker = RelayOperationTracker;
66
66
  export type Record = RelayModernRecord;
67
67
 
68
68
  export type MutationParameters = {
69
- +response: {...},
70
- +variables: {...},
71
- +rawResponse?: {...},
69
+ readonly response: {...},
70
+ readonly variables: {...},
71
+ readonly rawResponse?: {...},
72
72
  };
73
73
 
74
74
  export type FragmentMap = {[key: string]: ReaderFragment, ...};
@@ -79,20 +79,20 @@ export type FragmentMap = {[key: string]: ReaderFragment, ...};
79
79
  export type SelectorData = {[key: string]: unknown, ...};
80
80
 
81
81
  export type SingularReaderSelector = {
82
- +kind: 'SingularReaderSelector',
83
- +dataID: DataID,
84
- +isWithinUnmatchedTypeRefinement: boolean,
85
- +clientEdgeTraversalPath: ClientEdgeTraversalPath | null,
86
- +node: ReaderFragment,
87
- +owner: RequestDescriptor,
88
- +variables: Variables,
82
+ readonly kind: 'SingularReaderSelector',
83
+ readonly dataID: DataID,
84
+ readonly isWithinUnmatchedTypeRefinement: boolean,
85
+ readonly clientEdgeTraversalPath: ClientEdgeTraversalPath | null,
86
+ readonly node: ReaderFragment,
87
+ readonly owner: RequestDescriptor,
88
+ readonly variables: Variables,
89
89
  };
90
90
 
91
91
  export type ReaderSelector = SingularReaderSelector | PluralReaderSelector;
92
92
 
93
93
  export type PluralReaderSelector = {
94
- +kind: 'PluralReaderSelector',
95
- +selectors: ReadonlyArray<SingularReaderSelector>,
94
+ readonly kind: 'PluralReaderSelector',
95
+ readonly selectors: ReadonlyArray<SingularReaderSelector>,
96
96
  };
97
97
 
98
98
  export type FieldErrorType =
@@ -101,10 +101,10 @@ export type FieldErrorType =
101
101
  | 'PAYLOAD_ERROR';
102
102
 
103
103
  export type RequestDescriptor = {
104
- +identifier: RequestIdentifier,
105
- +node: ConcreteRequest,
106
- +variables: Variables,
107
- +cacheConfig: ?CacheConfig,
104
+ readonly identifier: RequestIdentifier,
105
+ readonly node: ConcreteRequest,
106
+ readonly variables: Variables,
107
+ readonly cacheConfig: ?CacheConfig,
108
108
  };
109
109
 
110
110
  /**
@@ -112,9 +112,9 @@ export type RequestDescriptor = {
112
112
  * purposes of targeting a subgraph.
113
113
  */
114
114
  export type NormalizationSelector = {
115
- +dataID: DataID,
116
- +node: NormalizationSelectableNode,
117
- +variables: Variables,
115
+ readonly dataID: DataID,
116
+ readonly node: NormalizationSelectableNode,
117
+ readonly variables: Variables,
118
118
  };
119
119
 
120
120
  export type FieldError =
@@ -128,29 +128,29 @@ export type FieldError =
128
128
  export type FieldErrors = Array<FieldError>;
129
129
 
130
130
  export type ClientEdgeTraversalInfo = {
131
- +readerClientEdge: ReaderClientEdgeToServerObject,
132
- +clientEdgeDestinationID: DataID,
131
+ readonly readerClientEdge: ReaderClientEdgeToServerObject,
132
+ readonly clientEdgeDestinationID: DataID,
133
133
  };
134
134
 
135
135
  export type ClientEdgeTraversalPath =
136
136
  ReadonlyArray<ClientEdgeTraversalInfo | null>;
137
137
 
138
138
  export type MissingClientEdgeRequestInfo = {
139
- +request: ConcreteRequest,
140
- +clientEdgeDestinationID: DataID,
139
+ readonly request: ConcreteRequest,
140
+ readonly clientEdgeDestinationID: DataID,
141
141
  };
142
142
 
143
143
  /**
144
144
  * A representation of a selector and its results at a particular point in time.
145
145
  */
146
146
  export type Snapshot = {
147
- +data: ?SelectorData,
148
- +isMissingData: boolean,
149
- +missingLiveResolverFields?: ReadonlyArray<DataID>,
150
- +missingClientEdges: null | ReadonlyArray<MissingClientEdgeRequestInfo>,
151
- +seenRecords: DataIDSet,
152
- +selector: SingularReaderSelector,
153
- +fieldErrors: ?FieldErrors,
147
+ readonly data: ?SelectorData,
148
+ readonly isMissingData: boolean,
149
+ readonly missingLiveResolverFields?: ReadonlyArray<DataID>,
150
+ readonly missingClientEdges: null | ReadonlyArray<MissingClientEdgeRequestInfo>,
151
+ readonly seenRecords: DataIDSet,
152
+ readonly selector: SingularReaderSelector,
153
+ readonly fieldErrors: ?FieldErrors,
154
154
  };
155
155
 
156
156
  /**
@@ -163,9 +163,9 @@ export type Snapshot = {
163
163
  * the results of the the operation.
164
164
  */
165
165
  export type OperationDescriptor = {
166
- +fragment: SingularReaderSelector,
167
- +request: RequestDescriptor,
168
- +root: NormalizationSelector,
166
+ readonly fragment: SingularReaderSelector,
167
+ readonly request: RequestDescriptor,
168
+ readonly root: NormalizationSelector,
169
169
  };
170
170
 
171
171
  /**
@@ -246,7 +246,7 @@ export interface RecordSource {
246
246
  /**
247
247
  * A collection of records keyed by id.
248
248
  */
249
- export type RecordSourceJSON = {+[DataID]: ?RecordJSON};
249
+ export type RecordSourceJSON = {readonly [DataID]: ?RecordJSON};
250
250
 
251
251
  /**
252
252
  * A read/write interface for accessing and updating graph data.
@@ -259,10 +259,14 @@ export interface MutableRecordSource extends RecordSource {
259
259
  }
260
260
 
261
261
  export type CheckOptions = {
262
- +handlers: ReadonlyArray<MissingFieldHandler>,
263
- +defaultActorIdentifier: ActorIdentifier,
264
- +getTargetForActor: (actorIdentifier: ActorIdentifier) => MutableRecordSource,
265
- +getSourceForActor: (actorIdentifier: ActorIdentifier) => RecordSource,
262
+ readonly handlers: ReadonlyArray<MissingFieldHandler>,
263
+ readonly defaultActorIdentifier: ActorIdentifier,
264
+ readonly getTargetForActor: (
265
+ actorIdentifier: ActorIdentifier,
266
+ ) => MutableRecordSource,
267
+ readonly getSourceForActor: (
268
+ actorIdentifier: ActorIdentifier,
269
+ ) => RecordSource,
266
270
  };
267
271
 
268
272
  export type OperationAvailability =
@@ -449,8 +453,8 @@ export type Scheduler = (() => void) => void;
449
453
  * A type that can schedule callbacks and also cancel them.
450
454
  */
451
455
  export type TaskScheduler = {
452
- +cancel: (id: string) => void,
453
- +schedule: (fn: () => void, priority?: TaskPriority) => string,
456
+ readonly cancel: (id: string) => void,
457
+ readonly schedule: (fn: () => void, priority?: TaskPriority) => string,
454
458
  };
455
459
 
456
460
  export type TaskPriority = 'default' | 'low';
@@ -507,7 +511,7 @@ export interface ReadOnlyRecordProxy {
507
511
  * This type is expected by store.readUpdatableFragment.
508
512
  */
509
513
  export type HasUpdatableSpread<TFragmentType> = {
510
- +$updatableFragmentSpreads: TFragmentType,
514
+ readonly $updatableFragmentSpreads: TFragmentType,
511
515
  ...
512
516
  };
513
517
 
@@ -516,7 +520,7 @@ export type HasUpdatableSpread<TFragmentType> = {
516
520
  * readUpdatableFragment.
517
521
  */
518
522
  export type UpdatableData<TData> = {
519
- +updatableData: TData,
523
+ readonly updatableData: TData,
520
524
  };
521
525
 
522
526
  /**
@@ -557,270 +561,270 @@ export interface RecordSourceSelectorProxy extends RecordSourceProxy {
557
561
  }
558
562
 
559
563
  export type SuspenseFragmentLogEvent = {
560
- +name: 'suspense.fragment',
561
- +data: unknown,
562
- +fragment: ReaderFragment,
563
- +isRelayHooks: boolean,
564
- +isMissingData: boolean,
565
- +isPromiseCached: boolean,
566
- +pendingOperations: ReadonlyArray<RequestDescriptor>,
564
+ readonly name: 'suspense.fragment',
565
+ readonly data: unknown,
566
+ readonly fragment: ReaderFragment,
567
+ readonly isRelayHooks: boolean,
568
+ readonly isMissingData: boolean,
569
+ readonly isPromiseCached: boolean,
570
+ readonly pendingOperations: ReadonlyArray<RequestDescriptor>,
567
571
  };
568
572
 
569
573
  export type SuspenseResolverLogEvent = {
570
- +name: 'suspense.resolver',
571
- +fragment: ReaderFragment,
572
- +fragmentOwner: RequestDescriptor,
573
- +isMount: boolean,
574
- +suspendingLiveResolvers: ReadonlyArray<DataID>,
574
+ readonly name: 'suspense.resolver',
575
+ readonly fragment: ReaderFragment,
576
+ readonly fragmentOwner: RequestDescriptor,
577
+ readonly isMount: boolean,
578
+ readonly suspendingLiveResolvers: ReadonlyArray<DataID>,
575
579
  };
576
580
 
577
581
  export type SuspenseClientEdgeLogEvent = {
578
- +name: 'suspense.client_edge',
579
- +fragment: ReaderFragment,
580
- +fragmentOwner: RequestDescriptor,
581
- +isMount: boolean,
582
+ readonly name: 'suspense.client_edge',
583
+ readonly fragment: ReaderFragment,
584
+ readonly fragmentOwner: RequestDescriptor,
585
+ readonly isMount: boolean,
582
586
  };
583
587
 
584
588
  export type SuspenseMissingDataLogEvent = {
585
- +name: 'suspense.missing_data',
586
- +fragment: ReaderFragment,
587
- +fragmentOwner: RequestDescriptor,
588
- +isMount: boolean,
589
- +pendingOperations: ReadonlyArray<RequestDescriptor>,
589
+ readonly name: 'suspense.missing_data',
590
+ readonly fragment: ReaderFragment,
591
+ readonly fragmentOwner: RequestDescriptor,
592
+ readonly isMount: boolean,
593
+ readonly pendingOperations: ReadonlyArray<RequestDescriptor>,
590
594
  };
591
595
 
592
596
  export type SuspenseQueryLogEvent = {
593
- +name: 'suspense.query',
594
- +fetchPolicy: string,
595
- +isPromiseCached: boolean,
596
- +operation: OperationDescriptor,
597
- +queryAvailability: ?OperationAvailability,
598
- +renderPolicy: RenderPolicy,
597
+ readonly name: 'suspense.query',
598
+ readonly fetchPolicy: string,
599
+ readonly isPromiseCached: boolean,
600
+ readonly operation: OperationDescriptor,
601
+ readonly queryAvailability: ?OperationAvailability,
602
+ readonly renderPolicy: RenderPolicy,
599
603
  };
600
604
 
601
605
  export type QueryResourceFetchLogEvent = {
602
- +name: 'queryresource.fetch',
606
+ readonly name: 'queryresource.fetch',
603
607
  // ID of this query resource request and will be the same
604
608
  // if there is an associated queryresource.retain event.
605
- +resourceID: number,
606
- +operation: OperationDescriptor,
609
+ readonly resourceID: number,
610
+ readonly operation: OperationDescriptor,
607
611
  // value from ProfilerContext
608
- +profilerContext: unknown,
612
+ readonly profilerContext: unknown,
609
613
  // FetchPolicy from Relay Hooks
610
- +fetchPolicy: string,
614
+ readonly fetchPolicy: string,
611
615
  // RenderPolicy from Relay Hooks
612
- +renderPolicy: RenderPolicy,
613
- +queryAvailability: OperationAvailability,
614
- +shouldFetch: boolean,
616
+ readonly renderPolicy: RenderPolicy,
617
+ readonly queryAvailability: OperationAvailability,
618
+ readonly shouldFetch: boolean,
615
619
  };
616
620
 
617
621
  export type QueryResourceRetainLogEvent = {
618
- +name: 'queryresource.retain',
619
- +resourceID: number,
622
+ readonly name: 'queryresource.retain',
623
+ readonly resourceID: number,
620
624
  // value from ProfilerContext
621
- +profilerContext: unknown,
625
+ readonly profilerContext: unknown,
622
626
  };
623
627
 
624
628
  export type FragmentResourceMissingDataLogEvent = {
625
629
  // Indicates FragmentResource is going to return a result that is missing
626
630
  // data.
627
- +name: 'fragmentresource.missing_data',
628
- +data: unknown,
629
- +fragment: ReaderFragment,
630
- +isRelayHooks: boolean,
631
+ readonly name: 'fragmentresource.missing_data',
632
+ readonly data: unknown,
633
+ readonly fragment: ReaderFragment,
634
+ readonly isRelayHooks: boolean,
631
635
  // Are we reading this result from the fragment resource cache?
632
- +cached: boolean,
636
+ readonly cached: boolean,
633
637
  };
634
638
 
635
639
  export type PendingOperationFoundLogEvent = {
636
640
  // Indicates getPendingOperationForFragment identified a pending operation.
637
641
  // Useful for measuring how frequently RelayOperationTracker identifies a
638
642
  // related operation on which to suspend.
639
- +name: 'pendingoperation.found',
640
- +fragment: ReaderFragment,
641
- +fragmentOwner: RequestDescriptor,
642
- +pendingOperations: ReadonlyArray<RequestDescriptor>,
643
+ readonly name: 'pendingoperation.found',
644
+ readonly fragment: ReaderFragment,
645
+ readonly fragmentOwner: RequestDescriptor,
646
+ readonly pendingOperations: ReadonlyArray<RequestDescriptor>,
643
647
  };
644
648
 
645
649
  export type NetworkInfoLogEvent = {
646
- +name: 'network.info',
647
- +networkRequestId: number,
648
- +info: unknown,
650
+ readonly name: 'network.info',
651
+ readonly networkRequestId: number,
652
+ readonly info: unknown,
649
653
  };
650
654
 
651
655
  export type NetworkStartLogEvent = {
652
- +name: 'network.start',
653
- +networkRequestId: number,
654
- +params: RequestParameters,
655
- +variables: Variables,
656
- +cacheConfig: CacheConfig,
656
+ readonly name: 'network.start',
657
+ readonly networkRequestId: number,
658
+ readonly params: RequestParameters,
659
+ readonly variables: Variables,
660
+ readonly cacheConfig: CacheConfig,
657
661
  };
658
662
 
659
663
  export type NetworkNextLogEvent = {
660
- +name: 'network.next',
661
- +networkRequestId: number,
662
- +response: GraphQLResponse,
664
+ readonly name: 'network.next',
665
+ readonly networkRequestId: number,
666
+ readonly response: GraphQLResponse,
663
667
  };
664
668
 
665
669
  export type NetworkErrorLogEvent = {
666
- +name: 'network.error',
667
- +networkRequestId: number,
668
- +error: Error,
670
+ readonly name: 'network.error',
671
+ readonly networkRequestId: number,
672
+ readonly error: Error,
669
673
  };
670
674
 
671
675
  export type NetworkCompleteLogEvent = {
672
- +name: 'network.complete',
673
- +networkRequestId: number,
676
+ readonly name: 'network.complete',
677
+ readonly networkRequestId: number,
674
678
  };
675
679
 
676
680
  export type NetworkUnsubscribeLogEvent = {
677
- +name: 'network.unsubscribe',
678
- +networkRequestId: number,
681
+ readonly name: 'network.unsubscribe',
682
+ readonly networkRequestId: number,
679
683
  };
680
684
 
681
685
  export type ExecuteStartLogEvent = {
682
- +name: 'execute.start',
683
- +executeId: number,
684
- +params: RequestParameters,
685
- +variables: Variables,
686
- +cacheConfig: CacheConfig,
686
+ readonly name: 'execute.start',
687
+ readonly executeId: number,
688
+ readonly params: RequestParameters,
689
+ readonly variables: Variables,
690
+ readonly cacheConfig: CacheConfig,
687
691
  };
688
692
 
689
693
  export type ExecuteNextStartLogEvent = {
690
- +name: 'execute.next.start',
691
- +executeId: number,
692
- +response: GraphQLResponse,
693
- +operation: OperationDescriptor,
694
+ readonly name: 'execute.next.start',
695
+ readonly executeId: number,
696
+ readonly response: GraphQLResponse,
697
+ readonly operation: OperationDescriptor,
694
698
  };
695
699
 
696
700
  export type ExecuteNextEndLogEvent = {
697
- +name: 'execute.next.end',
698
- +executeId: number,
699
- +response: GraphQLResponse,
700
- +operation: OperationDescriptor,
701
+ readonly name: 'execute.next.end',
702
+ readonly executeId: number,
703
+ readonly response: GraphQLResponse,
704
+ readonly operation: OperationDescriptor,
701
705
  };
702
706
 
703
707
  export type ExecuteAsyncModuleLogEvent = {
704
- +name: 'execute.async.module',
705
- +executeId: number,
706
- +operationName: string,
707
- +duration: number,
708
+ readonly name: 'execute.async.module',
709
+ readonly executeId: number,
710
+ readonly operationName: string,
711
+ readonly duration: number,
708
712
  };
709
713
 
710
714
  export type ExecuteErrorLogEvent = {
711
- +name: 'execute.error',
712
- +executeId: number,
713
- +error: Error,
715
+ readonly name: 'execute.error',
716
+ readonly executeId: number,
717
+ readonly error: Error,
714
718
  };
715
719
 
716
720
  export type ExecuteCompleteLogEvent = {
717
- +name: 'execute.complete',
718
- +executeId: number,
721
+ readonly name: 'execute.complete',
722
+ readonly executeId: number,
719
723
  };
720
724
 
721
725
  export type ExecuteUnsubscribeLogEvent = {
722
- +name: 'execute.unsubscribe',
723
- +executeId: number,
726
+ readonly name: 'execute.unsubscribe',
727
+ readonly executeId: number,
724
728
  };
725
729
 
726
730
  export type ExecuteNormalizeStart = {
727
- +name: 'execute.normalize.start',
728
- +operation: OperationDescriptor,
731
+ readonly name: 'execute.normalize.start',
732
+ readonly operation: OperationDescriptor,
729
733
  };
730
734
 
731
735
  export type ExecuteNormalizeEnd = {
732
- +name: 'execute.normalize.end',
733
- +operation: OperationDescriptor,
736
+ readonly name: 'execute.normalize.end',
737
+ readonly operation: OperationDescriptor,
734
738
  };
735
739
 
736
740
  export type StoreDataCheckerStartEvent = {
737
- +name: 'store.datachecker.start',
738
- +selector: NormalizationSelector,
741
+ readonly name: 'store.datachecker.start',
742
+ readonly selector: NormalizationSelector,
739
743
  };
740
744
 
741
745
  export type StoreDataCheckerEndEvent = {
742
- +name: 'store.datachecker.end',
743
- +selector: NormalizationSelector,
746
+ readonly name: 'store.datachecker.end',
747
+ readonly selector: NormalizationSelector,
744
748
  };
745
749
 
746
750
  export type StoreDataCheckerMissingEvent = {
747
- +name: 'store.datachecker.missing',
748
- +kind: 'scalar' | 'linked' | 'pluralLinked' | 'unknown_record',
749
- +dataID: DataID,
750
- +fieldName?: string,
751
- +storageKey?: string,
751
+ readonly name: 'store.datachecker.missing',
752
+ readonly kind: 'scalar' | 'linked' | 'pluralLinked' | 'unknown_record',
753
+ readonly dataID: DataID,
754
+ readonly fieldName?: string,
755
+ readonly storageKey?: string,
752
756
  };
753
757
 
754
758
  export type StorePublishLogEvent = {
755
- +name: 'store.publish',
756
- +source: RecordSource,
757
- +optimistic: boolean,
759
+ readonly name: 'store.publish',
760
+ readonly source: RecordSource,
761
+ readonly optimistic: boolean,
758
762
  };
759
763
 
760
764
  export type StoreSnapshotLogEvent = {
761
- +name: 'store.snapshot',
765
+ readonly name: 'store.snapshot',
762
766
  };
763
767
 
764
768
  export type StoreLookupStartEvent = {
765
- +name: 'store.lookup.start',
766
- +selector: SingularReaderSelector,
769
+ readonly name: 'store.lookup.start',
770
+ readonly selector: SingularReaderSelector,
767
771
  };
768
772
 
769
773
  export type StoreLookupEndEvent = {
770
- +name: 'store.lookup.end',
771
- +selector: SingularReaderSelector,
774
+ readonly name: 'store.lookup.end',
775
+ readonly selector: SingularReaderSelector,
772
776
  };
773
777
 
774
778
  export type StoreRestoreLogEvent = {
775
- +name: 'store.restore',
779
+ readonly name: 'store.restore',
776
780
  };
777
781
 
778
782
  export type StoreGcStartEvent = {
779
- +name: 'store.gc.start',
783
+ readonly name: 'store.gc.start',
780
784
  };
781
785
 
782
786
  export type StoreGcInterruptedEvent = {
783
- +name: 'store.gc.interrupted',
787
+ readonly name: 'store.gc.interrupted',
784
788
  };
785
789
 
786
790
  export type StoreGcEndEvent = {
787
- +name: 'store.gc.end',
788
- +references: DataIDSet,
791
+ readonly name: 'store.gc.end',
792
+ readonly references: DataIDSet,
789
793
  };
790
794
 
791
795
  export type StoreBatchStartLogEvent = {
792
- +name: 'store.batch.start',
796
+ readonly name: 'store.batch.start',
793
797
  };
794
798
 
795
799
  export type StoreBatchCompleteLogEvent = {
796
- +name: 'store.batch.complete',
797
- +sourceOperations: Array<OperationDescriptor>,
798
- +invalidateStore: boolean,
800
+ readonly name: 'store.batch.complete',
801
+ readonly sourceOperations: Array<OperationDescriptor>,
802
+ readonly invalidateStore: boolean,
799
803
  };
800
804
 
801
805
  export type StoreNotifyStartLogEvent = {
802
- +name: 'store.notify.start',
803
- +sourceOperation: ?OperationDescriptor,
806
+ readonly name: 'store.notify.start',
807
+ readonly sourceOperation: ?OperationDescriptor,
804
808
  };
805
809
 
806
810
  export type StoreNotifyCompleteLogEvent = {
807
- +name: 'store.notify.complete',
808
- +sourceOperation: ?OperationDescriptor,
809
- +updatedRecordIDs: DataIDSet,
810
- +invalidatedRecordIDs: DataIDSet,
811
- +subscriptionsSize: number,
812
- +updatedOwners: Array<RequestDescriptor>,
811
+ readonly name: 'store.notify.complete',
812
+ readonly sourceOperation: ?OperationDescriptor,
813
+ readonly updatedRecordIDs: DataIDSet,
814
+ readonly invalidatedRecordIDs: DataIDSet,
815
+ readonly subscriptionsSize: number,
816
+ readonly updatedOwners: Array<RequestDescriptor>,
813
817
  };
814
818
 
815
819
  export type StoreNotifySubscriptionLogEvent = {
816
- +name: 'store.notify.subscription',
817
- +sourceOperation: ?OperationDescriptor,
818
- +snapshot: Snapshot,
819
- +nextSnapshot: Snapshot,
820
+ readonly name: 'store.notify.subscription',
821
+ readonly sourceOperation: ?OperationDescriptor,
822
+ readonly snapshot: Snapshot,
823
+ readonly nextSnapshot: Snapshot,
820
824
  };
821
825
 
822
826
  export type ReaderReadFragmentSpread = {
823
- +name: 'reader.fragmentSpread',
827
+ readonly name: 'reader.fragmentSpread',
824
828
  fragmentName: string,
825
829
  data: SelectorData,
826
830
  };
@@ -831,22 +835,22 @@ export type ReaderRead = {
831
835
  };
832
836
 
833
837
  export type EntrypointRootConsumeLogEvent = {
834
- +name: 'entrypoint.root.consume',
835
- +profilerContext: unknown,
836
- +rootModuleID: string,
838
+ readonly name: 'entrypoint.root.consume',
839
+ readonly profilerContext: unknown,
840
+ readonly rootModuleID: string,
837
841
  };
838
842
 
839
843
  export type LiveResolverBatchStartLogEvent = {
840
- +name: 'liveresolver.batch.start',
844
+ readonly name: 'liveresolver.batch.start',
841
845
  };
842
846
 
843
847
  export type LiveResolverBatchEndLogEvent = {
844
- +name: 'liveresolver.batch.end',
848
+ readonly name: 'liveresolver.batch.end',
845
849
  };
846
850
 
847
851
  export type UseFragmentSubscriptionMissedUpdates = {
848
- +name: 'useFragment.subscription.missedUpdates',
849
- +hasDataChanges: boolean,
852
+ readonly name: 'useFragment.subscription.missedUpdates',
853
+ readonly hasDataChanges: boolean,
850
854
  };
851
855
 
852
856
  /**
@@ -854,18 +858,18 @@ export type UseFragmentSubscriptionMissedUpdates = {
854
858
  * but have different types, resulting in an collision in the store.
855
859
  */
856
860
  export type IdCollisionTypenameLogEvent = {
857
- +name: 'idCollision.typename',
858
- +previous_typename: string,
859
- +new_typename: string,
861
+ readonly name: 'idCollision.typename',
862
+ readonly previous_typename: string,
863
+ readonly new_typename: string,
860
864
  };
861
865
 
862
866
  export type FetchQueryFetchLogEvent = {
863
- +name: 'fetchquery.fetch',
864
- +operation: OperationDescriptor,
867
+ readonly name: 'fetchquery.fetch',
868
+ readonly operation: OperationDescriptor,
865
869
  // FetchPolicy from Relay Hooks
866
- +fetchPolicy: string,
867
- +queryAvailability: OperationAvailability,
868
- +shouldFetch: boolean,
870
+ readonly fetchPolicy: string,
871
+ readonly queryAvailability: OperationAvailability,
872
+ readonly shouldFetch: boolean,
869
873
  };
870
874
 
871
875
  export type LogEvent =
@@ -929,7 +933,7 @@ export interface IEnvironment {
929
933
  /**
930
934
  * Extra information attached to the environment instance
931
935
  */
932
- +options: unknown;
936
+ readonly options: unknown;
933
937
 
934
938
  /**
935
939
  * **UNSTABLE** Event based logging API thats scoped to the environment.
@@ -1121,9 +1125,9 @@ export interface IEnvironment {
1121
1125
  * selection
1122
1126
  */
1123
1127
  export type ModuleImportPointer = {
1124
- +__fragmentPropName: ?string,
1125
- +__module_component: unknown,
1126
- +$fragmentSpreads: unknown,
1128
+ readonly __fragmentPropName: ?string,
1129
+ readonly __module_component: unknown,
1130
+ readonly $fragmentSpreads: unknown,
1127
1131
  ...
1128
1132
  };
1129
1133
 
@@ -1148,18 +1152,18 @@ export type Handler = Readonly<{
1148
1152
  */
1149
1153
  export type HandleFieldPayload = {
1150
1154
  // The arguments that were fetched.
1151
- +args: Variables,
1155
+ readonly args: Variables,
1152
1156
  // The __id of the record containing the source/handle field.
1153
- +dataID: DataID,
1157
+ readonly dataID: DataID,
1154
1158
  // The (storage) key at which the original server data was written.
1155
- +fieldKey: string,
1159
+ readonly fieldKey: string,
1156
1160
  // The name of the handle.
1157
- +handle: string,
1161
+ readonly handle: string,
1158
1162
  // The (storage) key at which the handle's data should be written by the
1159
1163
  // handler.
1160
- +handleKey: string,
1164
+ readonly handleKey: string,
1161
1165
  // The arguments applied to the handle
1162
- +handleArgs: Variables,
1166
+ readonly handleArgs: Variables,
1163
1167
  };
1164
1168
 
1165
1169
  /**
@@ -1181,15 +1185,15 @@ export type HandleFieldPayload = {
1181
1185
  *
1182
1186
  */
1183
1187
  export type ModuleImportPayload = {
1184
- +kind: 'ModuleImportPayload',
1185
- +args: ?ReadonlyArray<NormalizationArgument>,
1186
- +data: PayloadData,
1187
- +dataID: DataID,
1188
- +operationReference: unknown,
1189
- +path: ReadonlyArray<string>,
1190
- +typeName: string,
1191
- +variables: Variables,
1192
- +actorIdentifier: ?ActorIdentifier,
1188
+ readonly kind: 'ModuleImportPayload',
1189
+ readonly args: ?ReadonlyArray<NormalizationArgument>,
1190
+ readonly data: PayloadData,
1191
+ readonly dataID: DataID,
1192
+ readonly operationReference: unknown,
1193
+ readonly path: ReadonlyArray<string>,
1194
+ readonly typeName: string,
1195
+ readonly variables: Variables,
1196
+ readonly actorIdentifier: ?ActorIdentifier,
1193
1197
  };
1194
1198
 
1195
1199
  /**
@@ -1208,14 +1212,14 @@ export type ModuleImportPayload = {
1208
1212
  * typeName can also be used to construct a root record for normalization.
1209
1213
  */
1210
1214
  export type ActorPayload = {
1211
- +kind: 'ActorPayload',
1212
- +data: PayloadData,
1213
- +dataID: DataID,
1214
- +node: NormalizationLinkedField,
1215
- +path: ReadonlyArray<string>,
1216
- +typeName: string,
1217
- +variables: Variables,
1218
- +actorIdentifier: ActorIdentifier,
1215
+ readonly kind: 'ActorPayload',
1216
+ readonly data: PayloadData,
1217
+ readonly dataID: DataID,
1218
+ readonly node: NormalizationLinkedField,
1219
+ readonly path: ReadonlyArray<string>,
1220
+ readonly typeName: string,
1221
+ readonly variables: Variables,
1222
+ readonly actorIdentifier: ActorIdentifier,
1219
1223
  };
1220
1224
 
1221
1225
  /**
@@ -1229,22 +1233,22 @@ export type FollowupPayload = ModuleImportPayload | ActorPayload;
1229
1233
  * arrives.
1230
1234
  */
1231
1235
  export type DeferPlaceholder = {
1232
- +kind: 'defer',
1233
- +data: PayloadData,
1234
- +label: string,
1235
- +path: ReadonlyArray<string>,
1236
- +selector: NormalizationSelector,
1237
- +typeName: string,
1238
- +actorIdentifier: ?ActorIdentifier,
1236
+ readonly kind: 'defer',
1237
+ readonly data: PayloadData,
1238
+ readonly label: string,
1239
+ readonly path: ReadonlyArray<string>,
1240
+ readonly selector: NormalizationSelector,
1241
+ readonly typeName: string,
1242
+ readonly actorIdentifier: ?ActorIdentifier,
1239
1243
  };
1240
1244
  export type StreamPlaceholder = {
1241
- +kind: 'stream',
1242
- +label: string,
1243
- +path: ReadonlyArray<string>,
1244
- +parentID: DataID,
1245
- +node: NormalizationSelectableNode,
1246
- +variables: Variables,
1247
- +actorIdentifier: ?ActorIdentifier,
1245
+ readonly kind: 'stream',
1246
+ readonly label: string,
1247
+ readonly path: ReadonlyArray<string>,
1248
+ readonly parentID: DataID,
1249
+ readonly node: NormalizationSelectableNode,
1250
+ readonly variables: Variables,
1251
+ readonly actorIdentifier: ?ActorIdentifier,
1248
1252
  };
1249
1253
  export type IncrementalDataPlaceholder = DeferPlaceholder | StreamPlaceholder;
1250
1254
 
@@ -1286,7 +1290,7 @@ export type StoreUpdater = (store: RecordSourceProxy) => void;
1286
1290
  * order to easily access the root fields of a query/mutation as well as a
1287
1291
  * second argument of the response object of the mutation.
1288
1292
  */
1289
- export type SelectorStoreUpdater<-TMutationResponse> = (
1293
+ export type SelectorStoreUpdater<in TMutationResponse> = (
1290
1294
  store: RecordSourceSelectorProxy,
1291
1295
  data: ?TMutationResponse,
1292
1296
  ) => void;
@@ -1300,20 +1304,20 @@ export type OptimisticUpdate<TMutation extends MutationParameters> =
1300
1304
  | OptimisticUpdateRelayPayload<TMutation>;
1301
1305
 
1302
1306
  export type OptimisticUpdateFunction = {
1303
- +storeUpdater: StoreUpdater,
1307
+ readonly storeUpdater: StoreUpdater,
1304
1308
  };
1305
1309
 
1306
1310
  export type OptimisticUpdateRelayPayload<TMutation extends MutationParameters> =
1307
1311
  {
1308
- +operation: OperationDescriptor,
1309
- +payload: RelayResponsePayload,
1310
- +updater: ?SelectorStoreUpdater<TMutation['response']>,
1312
+ readonly operation: OperationDescriptor,
1313
+ readonly payload: RelayResponsePayload,
1314
+ readonly updater: ?SelectorStoreUpdater<TMutation['response']>,
1311
1315
  };
1312
1316
 
1313
1317
  export type OptimisticResponseConfig<TMutation extends MutationParameters> = {
1314
- +operation: OperationDescriptor,
1315
- +response: ?PayloadData,
1316
- +updater: ?SelectorStoreUpdater<TMutation['response']>,
1318
+ readonly operation: OperationDescriptor,
1319
+ readonly response: ?PayloadData,
1320
+ readonly updater: ?SelectorStoreUpdater<TMutation['response']>,
1317
1321
  };
1318
1322
 
1319
1323
  /**
@@ -1367,11 +1371,11 @@ export type MissingFieldHandler =
1367
1371
  * https://relay.dev/docs/next/guides/throw-on-field-error-directive/
1368
1372
  */
1369
1373
  export type MissingExpectedDataLogEvent = {
1370
- +kind: 'missing_expected_data.log',
1371
- +owner: string,
1374
+ readonly kind: 'missing_expected_data.log',
1375
+ readonly owner: string,
1372
1376
  fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
1373
1377
  // To populate this, you should pass the value to a ReactRelayLoggingContext
1374
- +uiContext: unknown | void,
1378
+ readonly uiContext: unknown | void,
1375
1379
  };
1376
1380
 
1377
1381
  /**
@@ -1395,12 +1399,12 @@ export type MissingExpectedDataLogEvent = {
1395
1399
  * `handled: true` and should not trigger a throw.
1396
1400
  */
1397
1401
  export type MissingExpectedDataThrowEvent = {
1398
- +kind: 'missing_expected_data.throw',
1399
- +owner: string,
1402
+ readonly kind: 'missing_expected_data.throw',
1403
+ readonly owner: string,
1400
1404
  fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
1401
- +handled: boolean,
1405
+ readonly handled: boolean,
1402
1406
  // To populate this, you should pass the value to a ReactRelayLoggingContext
1403
- +uiContext: unknown | void,
1407
+ readonly uiContext: unknown | void,
1404
1408
  };
1405
1409
 
1406
1410
  /**
@@ -1408,11 +1412,11 @@ export type MissingExpectedDataThrowEvent = {
1408
1412
  * store.
1409
1413
  */
1410
1414
  export type MissingRequiredFieldLogEvent = {
1411
- +kind: 'missing_required_field.log',
1412
- +owner: string,
1415
+ readonly kind: 'missing_required_field.log',
1416
+ readonly owner: string,
1413
1417
  fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
1414
1418
  // To populate this, you should pass the value to a ReactRelayLoggingContext
1415
- +uiContext: unknown | void,
1419
+ readonly uiContext: unknown | void,
1416
1420
  };
1417
1421
 
1418
1422
  /**
@@ -1427,12 +1431,12 @@ export type MissingRequiredFieldLogEvent = {
1427
1431
  * `handled: true` and should not trigger a throw.
1428
1432
  */
1429
1433
  export type MissingRequiredFieldThrowEvent = {
1430
- +kind: 'missing_required_field.throw',
1431
- +owner: string,
1434
+ readonly kind: 'missing_required_field.throw',
1435
+ readonly owner: string,
1432
1436
  fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
1433
- +handled: boolean,
1437
+ readonly handled: boolean,
1434
1438
  // To populate this, you should pass the value to a ReactRelayLoggingContext
1435
- +uiContext: unknown | void,
1439
+ readonly uiContext: unknown | void,
1436
1440
  };
1437
1441
 
1438
1442
  /**
@@ -1448,14 +1452,14 @@ export type MissingRequiredFieldThrowEvent = {
1448
1452
  * `handled: true` and should not trigger a throw.
1449
1453
  */
1450
1454
  export type RelayResolverErrorEvent = {
1451
- +kind: 'relay_resolver.error',
1452
- +owner: string,
1453
- +fieldPath: string,
1454
- +error: Error,
1455
- +shouldThrow: boolean,
1456
- +handled: boolean,
1455
+ readonly kind: 'relay_resolver.error',
1456
+ readonly owner: string,
1457
+ readonly fieldPath: string,
1458
+ readonly error: Error,
1459
+ readonly shouldThrow: boolean,
1460
+ readonly handled: boolean,
1457
1461
  // To populate this, you should pass the value to a ReactRelayLoggingContext
1458
- +uiContext: unknown | void,
1462
+ readonly uiContext: unknown | void,
1459
1463
  };
1460
1464
 
1461
1465
  /**
@@ -1476,14 +1480,14 @@ export type RelayResolverErrorEvent = {
1476
1480
  * `handled: true` and should not trigger a throw.
1477
1481
  */
1478
1482
  export type RelayFieldPayloadErrorEvent = {
1479
- +kind: 'relay_field_payload.error',
1480
- +owner: string,
1481
- +fieldPath: string,
1482
- +error: TRelayFieldError,
1483
- +shouldThrow: boolean,
1484
- +handled: boolean,
1483
+ readonly kind: 'relay_field_payload.error',
1484
+ readonly owner: string,
1485
+ readonly fieldPath: string,
1486
+ readonly error: TRelayFieldError,
1487
+ readonly shouldThrow: boolean,
1488
+ readonly handled: boolean,
1485
1489
  // To populate this, you should pass the value to a ReactRelayLoggingContext
1486
- +uiContext: unknown | void,
1490
+ readonly uiContext: unknown | void,
1487
1491
  };
1488
1492
 
1489
1493
  /**
@@ -1506,19 +1510,19 @@ export type RelayFieldLogger = (event: RelayFieldLoggerEvent) => void;
1506
1510
  * The results of normalizing a query.
1507
1511
  */
1508
1512
  export type RelayResponsePayload = {
1509
- +errors: ?Array<PayloadError>,
1510
- +fieldPayloads: ?Array<HandleFieldPayload>,
1511
- +incrementalPlaceholders: ?Array<IncrementalDataPlaceholder>,
1512
- +followupPayloads: ?Array<FollowupPayload>,
1513
- +isFinal: boolean,
1514
- +isPreNormalized?: boolean,
1515
- +s2cExecutions?: ?ReadonlyArray<{
1516
- +recordID: DataID,
1517
- +selections: ReadonlyArray<NormalizationSelection>,
1518
- +typeName: string,
1513
+ readonly errors: ?Array<PayloadError>,
1514
+ readonly fieldPayloads: ?Array<HandleFieldPayload>,
1515
+ readonly incrementalPlaceholders: ?Array<IncrementalDataPlaceholder>,
1516
+ readonly followupPayloads: ?Array<FollowupPayload>,
1517
+ readonly isFinal: boolean,
1518
+ readonly isPreNormalized?: boolean,
1519
+ readonly s2cExecutions?: ?ReadonlyArray<{
1520
+ readonly recordID: DataID,
1521
+ readonly selections: ReadonlyArray<NormalizationSelection>,
1522
+ readonly typeName: string,
1519
1523
  }>,
1520
- +source: MutableRecordSource,
1521
- +storeUpdater?: ?(store: RecordSourceProxy) => void,
1524
+ readonly source: MutableRecordSource,
1525
+ readonly storeUpdater?: ?(store: RecordSourceProxy) => void,
1522
1526
  };
1523
1527
 
1524
1528
  /**
@@ -1591,7 +1595,7 @@ export interface PublishQueue {
1591
1595
  * can only come from a given set.
1592
1596
  */
1593
1597
  export type ConcreteClientEdgeResolverReturnType<T = any> = {
1594
- +id: T & DataID,
1598
+ readonly id: T & DataID,
1595
1599
  };
1596
1600
 
1597
1601
  /**
@@ -1604,7 +1608,7 @@ export type ConcreteClientEdgeResolverReturnType<T = any> = {
1604
1608
  * that the provider of the LiveState value confirms that the value has indeed
1605
1609
  * change before notifying Relay of the change.
1606
1610
  */
1607
- export type LiveState<+T> = {
1611
+ export type LiveState<out T> = {
1608
1612
  /**
1609
1613
  * Returns the current value of the live state.
1610
1614
  */