relay-runtime 0.0.0-main-3281299b → 0.0.0-main-201438ec

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-3281299b
2
+ * Relay v0.0.0-main-201438ec
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -18,6 +18,27 @@ var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime
18
18
  var _require = require('../store/RelayStoreUtils'),
19
19
  getArgumentValues = _require.getArgumentValues;
20
20
 
21
+ var _require2 = require('../util/RelayConcreteNode'),
22
+ ACTOR_CHANGE = _require2.ACTOR_CHANGE,
23
+ ALIASED_FRAGMENT_SPREAD = _require2.ALIASED_FRAGMENT_SPREAD,
24
+ ALIASED_INLINE_FRAGMENT_SPREAD = _require2.ALIASED_INLINE_FRAGMENT_SPREAD,
25
+ CLIENT_EDGE_TO_CLIENT_OBJECT = _require2.CLIENT_EDGE_TO_CLIENT_OBJECT,
26
+ CLIENT_EDGE_TO_SERVER_OBJECT = _require2.CLIENT_EDGE_TO_SERVER_OBJECT,
27
+ CLIENT_EXTENSION = _require2.CLIENT_EXTENSION,
28
+ CONDITION = _require2.CONDITION,
29
+ DEFER = _require2.DEFER,
30
+ FLIGHT_FIELD = _require2.FLIGHT_FIELD,
31
+ FRAGMENT_SPREAD = _require2.FRAGMENT_SPREAD,
32
+ INLINE_DATA_FRAGMENT_SPREAD = _require2.INLINE_DATA_FRAGMENT_SPREAD,
33
+ INLINE_FRAGMENT = _require2.INLINE_FRAGMENT,
34
+ LINKED_FIELD = _require2.LINKED_FIELD,
35
+ MODULE_IMPORT = _require2.MODULE_IMPORT,
36
+ RELAY_LIVE_RESOLVER = _require2.RELAY_LIVE_RESOLVER,
37
+ RELAY_RESOLVER = _require2.RELAY_RESOLVER,
38
+ REQUIRED_FIELD = _require2.REQUIRED_FIELD,
39
+ SCALAR_FIELD = _require2.SCALAR_FIELD,
40
+ STREAM = _require2.STREAM;
41
+
21
42
  var nonUpdatableKeys = ['id', '__id', '__typename', 'js'];
22
43
 
23
44
  function createUpdatableProxy(updatableProxyRootRecord, variables, selections, recordSourceProxy) {
@@ -45,7 +66,7 @@ function updateProxyFromSelections(mutableUpdatableProxy, updatableProxyRootReco
45
66
  var selection = _step.value;
46
67
 
47
68
  switch (selection.kind) {
48
- case 'LinkedField':
69
+ case LINKED_FIELD:
49
70
  if (selection.plural) {
50
71
  Object.defineProperty(mutableUpdatableProxy, (_selection$alias = selection.alias) !== null && _selection$alias !== void 0 ? _selection$alias : selection.name, {
51
72
  // $FlowFixMe[incompatible-call] these getters and setters have different types on purpose
@@ -61,7 +82,7 @@ function updateProxyFromSelections(mutableUpdatableProxy, updatableProxyRootReco
61
82
 
62
83
  break;
63
84
 
64
- case 'ScalarField':
85
+ case SCALAR_FIELD:
65
86
  var scalarFieldName = (_selection$alias3 = selection.alias) !== null && _selection$alias3 !== void 0 ? _selection$alias3 : selection.name;
66
87
  Object.defineProperty(mutableUpdatableProxy, scalarFieldName, {
67
88
  get: function get() {
@@ -84,22 +105,40 @@ function updateProxyFromSelections(mutableUpdatableProxy, updatableProxyRootReco
84
105
  });
85
106
  break;
86
107
 
87
- case 'InlineFragment':
108
+ case INLINE_FRAGMENT:
88
109
  if (updatableProxyRootRecord.getType() === selection.type) {
89
110
  updateProxyFromSelections(mutableUpdatableProxy, updatableProxyRootRecord, variables, selection.selections, recordSourceProxy);
90
111
  }
91
112
 
92
113
  break;
93
114
 
94
- case 'ClientExtension':
115
+ case CLIENT_EXTENSION:
95
116
  updateProxyFromSelections(mutableUpdatableProxy, updatableProxyRootRecord, variables, selection.selections, recordSourceProxy);
96
117
  break;
97
118
 
98
- case 'FragmentSpread':
119
+ case FRAGMENT_SPREAD:
99
120
  // Explicitly ignore
100
121
  break;
101
122
 
123
+ case CONDITION:
124
+ case ACTOR_CHANGE:
125
+ case ALIASED_FRAGMENT_SPREAD:
126
+ case INLINE_DATA_FRAGMENT_SPREAD:
127
+ case ALIASED_INLINE_FRAGMENT_SPREAD:
128
+ case CLIENT_EDGE_TO_CLIENT_OBJECT:
129
+ case CLIENT_EDGE_TO_SERVER_OBJECT:
130
+ case DEFER:
131
+ case FLIGHT_FIELD:
132
+ case MODULE_IMPORT:
133
+ case RELAY_LIVE_RESOLVER:
134
+ case REQUIRED_FIELD:
135
+ case STREAM:
136
+ case RELAY_RESOLVER:
137
+ // These types of reader nodes are not currently handled.
138
+ throw new Error('Encountered an unexpected ReaderSelection variant in RelayRecordSourceProxy. This indicates a bug in Relay.');
139
+
102
140
  default:
141
+ selection.kind;
103
142
  throw new Error('Encountered an unexpected ReaderSelection variant in RelayRecordSourceProxy. This indicates a bug in Relay.');
104
143
  }
105
144
  };
@@ -18,6 +18,27 @@ import type {ReaderLinkedField, ReaderSelection} from '../util/ReaderNode';
18
18
  import type {Variables} from '../util/RelayRuntimeTypes';
19
19
 
20
20
  const {getArgumentValues} = require('../store/RelayStoreUtils');
21
+ const {
22
+ ACTOR_CHANGE,
23
+ ALIASED_FRAGMENT_SPREAD,
24
+ ALIASED_INLINE_FRAGMENT_SPREAD,
25
+ CLIENT_EDGE_TO_CLIENT_OBJECT,
26
+ CLIENT_EDGE_TO_SERVER_OBJECT,
27
+ CLIENT_EXTENSION,
28
+ CONDITION,
29
+ DEFER,
30
+ FLIGHT_FIELD,
31
+ FRAGMENT_SPREAD,
32
+ INLINE_DATA_FRAGMENT_SPREAD,
33
+ INLINE_FRAGMENT,
34
+ LINKED_FIELD,
35
+ MODULE_IMPORT,
36
+ RELAY_LIVE_RESOLVER,
37
+ RELAY_RESOLVER,
38
+ REQUIRED_FIELD,
39
+ SCALAR_FIELD,
40
+ STREAM,
41
+ } = require('../util/RelayConcreteNode');
21
42
 
22
43
  const nonUpdatableKeys = ['id', '__id', '__typename', 'js'];
23
44
 
@@ -53,7 +74,7 @@ function updateProxyFromSelections<TData>(
53
74
  ) {
54
75
  for (const selection of selections) {
55
76
  switch (selection.kind) {
56
- case 'LinkedField':
77
+ case LINKED_FIELD:
57
78
  if (selection.plural) {
58
79
  Object.defineProperty(
59
80
  mutableUpdatableProxy,
@@ -95,7 +116,7 @@ function updateProxyFromSelections<TData>(
95
116
  );
96
117
  }
97
118
  break;
98
- case 'ScalarField':
119
+ case SCALAR_FIELD:
99
120
  const scalarFieldName = selection.alias ?? selection.name;
100
121
  Object.defineProperty(mutableUpdatableProxy, scalarFieldName, {
101
122
  get: function () {
@@ -128,7 +149,7 @@ function updateProxyFromSelections<TData>(
128
149
  },
129
150
  });
130
151
  break;
131
- case 'InlineFragment':
152
+ case INLINE_FRAGMENT:
132
153
  if (updatableProxyRootRecord.getType() === selection.type) {
133
154
  updateProxyFromSelections(
134
155
  mutableUpdatableProxy,
@@ -139,7 +160,7 @@ function updateProxyFromSelections<TData>(
139
160
  );
140
161
  }
141
162
  break;
142
- case 'ClientExtension':
163
+ case CLIENT_EXTENSION:
143
164
  updateProxyFromSelections(
144
165
  mutableUpdatableProxy,
145
166
  updatableProxyRootRecord,
@@ -148,10 +169,29 @@ function updateProxyFromSelections<TData>(
148
169
  recordSourceProxy,
149
170
  );
150
171
  break;
151
- case 'FragmentSpread':
172
+ case FRAGMENT_SPREAD:
152
173
  // Explicitly ignore
153
174
  break;
175
+ case CONDITION:
176
+ case ACTOR_CHANGE:
177
+ case ALIASED_FRAGMENT_SPREAD:
178
+ case INLINE_DATA_FRAGMENT_SPREAD:
179
+ case ALIASED_INLINE_FRAGMENT_SPREAD:
180
+ case CLIENT_EDGE_TO_CLIENT_OBJECT:
181
+ case CLIENT_EDGE_TO_SERVER_OBJECT:
182
+ case DEFER:
183
+ case FLIGHT_FIELD:
184
+ case MODULE_IMPORT:
185
+ case RELAY_LIVE_RESOLVER:
186
+ case REQUIRED_FIELD:
187
+ case STREAM:
188
+ case RELAY_RESOLVER:
189
+ // These types of reader nodes are not currently handled.
190
+ throw new Error(
191
+ 'Encountered an unexpected ReaderSelection variant in RelayRecordSourceProxy. This indicates a bug in Relay.',
192
+ );
154
193
  default:
194
+ (selection.kind: empty);
155
195
  throw new Error(
156
196
  'Encountered an unexpected ReaderSelection variant in RelayRecordSourceProxy. This indicates a bug in Relay.',
157
197
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "relay-runtime",
3
3
  "description": "A core runtime for building GraphQL-driven applications.",
4
- "version": "0.0.0-main-3281299b",
4
+ "version": "0.0.0-main-201438ec",
5
5
  "keywords": [
6
6
  "graphql",
7
7
  "relay"