@isograph/react 0.0.0-main-3f26c9c8 → 0.0.0-main-84b67b62
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/.turbo/turbo-compile-libs.log +1 -1
- package/dist/core/IsographEnvironment.d.ts +9 -6
- package/dist/core/IsographEnvironment.d.ts.map +1 -1
- package/dist/core/IsographEnvironment.js +7 -1
- package/dist/core/cache.d.ts +2 -1
- package/dist/core/cache.d.ts.map +1 -1
- package/dist/core/cache.js +17 -27
- package/dist/core/check.d.ts.map +1 -1
- package/dist/core/check.js +10 -7
- package/dist/core/garbageCollection.d.ts +2 -1
- package/dist/core/garbageCollection.d.ts.map +1 -1
- package/dist/core/garbageCollection.js +21 -13
- package/dist/core/logging.d.ts +3 -2
- package/dist/core/logging.d.ts.map +1 -1
- package/dist/core/makeNetworkRequest.d.ts.map +1 -1
- package/dist/core/makeNetworkRequest.js +10 -1
- package/dist/core/optimisticProxy.d.ts +51 -0
- package/dist/core/optimisticProxy.d.ts.map +1 -0
- package/dist/core/optimisticProxy.js +372 -0
- package/dist/core/read.d.ts.map +1 -1
- package/dist/core/read.js +5 -4
- package/dist/core/startUpdate.d.ts +2 -1
- package/dist/core/startUpdate.d.ts.map +1 -1
- package/dist/core/startUpdate.js +31 -32
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/core/IsographEnvironment.ts +16 -6
- package/src/core/cache.ts +21 -14
- package/src/core/check.ts +11 -6
- package/src/core/garbageCollection.ts +27 -15
- package/src/core/logging.ts +2 -2
- package/src/core/makeNetworkRequest.ts +14 -1
- package/src/core/optimisticProxy.ts +510 -0
- package/src/core/read.ts +2 -1
- package/src/core/startUpdate.ts +44 -28
- package/src/index.ts +1 -1
- package/src/tests/garbageCollection.test.ts +2 -2
- package/src/tests/normalizeData.test.ts +5 -3
- package/src/tests/optimisticProxy.test.ts +860 -0
- package/src/tests/startUpdate.test.ts +7 -5
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOrInsertRecord = getOrInsertRecord;
|
|
4
|
+
exports.getStoreRecordProxy = getStoreRecordProxy;
|
|
5
|
+
exports.getMutableStoreRecordProxy = getMutableStoreRecordProxy;
|
|
6
|
+
exports.addNetworkResponseStoreLayer = addNetworkResponseStoreLayer;
|
|
7
|
+
exports.addStartUpdateStoreLayer = addStartUpdateStoreLayer;
|
|
8
|
+
exports.addOptimisticStoreLayer = addOptimisticStoreLayer;
|
|
9
|
+
exports.revertOptimisticStoreLayerAndMaybeReplace = revertOptimisticStoreLayerAndMaybeReplace;
|
|
10
|
+
const cache_1 = require("./cache");
|
|
11
|
+
function getOrInsertRecord(dataLayer, link) {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
var _c, _d;
|
|
14
|
+
const recordsById = ((_a = dataLayer[_c = link.__typename]) !== null && _a !== void 0 ? _a : (dataLayer[_c] = {}));
|
|
15
|
+
return ((_b = recordsById[_d = link.__link]) !== null && _b !== void 0 ? _b : (recordsById[_d] = {}));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Given the child-most store layer (i.e. environment.store) and a link (identifying a
|
|
19
|
+
* store record), create a proxy object that attempts to read through each successive
|
|
20
|
+
* store layer until a value (i.e. field name) is found. If found, return that value.
|
|
21
|
+
*/
|
|
22
|
+
function getStoreRecordProxy(storeLayer, link) {
|
|
23
|
+
var _a;
|
|
24
|
+
let startNode = storeLayer;
|
|
25
|
+
while (startNode !== null) {
|
|
26
|
+
const storeRecord = (_a = startNode.data[link.__typename]) === null || _a === void 0 ? void 0 : _a[link.__link];
|
|
27
|
+
if (storeRecord === null) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if (storeRecord != null) {
|
|
31
|
+
return getMutableStoreRecordProxy(startNode, link);
|
|
32
|
+
}
|
|
33
|
+
startNode = startNode.parentStoreLayer;
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
function getMutableStoreRecordProxy(childMostStoreLayer, link) {
|
|
38
|
+
return new Proxy({}, {
|
|
39
|
+
get(_, propertyName) {
|
|
40
|
+
var _a;
|
|
41
|
+
let currentStoreLayer = childMostStoreLayer;
|
|
42
|
+
while (currentStoreLayer !== null) {
|
|
43
|
+
const storeRecord = (_a = currentStoreLayer.data[link.__typename]) === null || _a === void 0 ? void 0 : _a[link.__link];
|
|
44
|
+
if (storeRecord === null) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
if (storeRecord != null) {
|
|
48
|
+
const value = Reflect.get(storeRecord, propertyName);
|
|
49
|
+
if (value !== undefined) {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
currentStoreLayer = currentStoreLayer.parentStoreLayer;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
has(_, propertyName) {
|
|
57
|
+
var _a;
|
|
58
|
+
let currentStoreLayer = childMostStoreLayer;
|
|
59
|
+
while (currentStoreLayer !== null) {
|
|
60
|
+
const storeRecord = (_a = currentStoreLayer.data[link.__typename]) === null || _a === void 0 ? void 0 : _a[link.__link];
|
|
61
|
+
if (storeRecord === null) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (storeRecord != null) {
|
|
65
|
+
const value = Reflect.has(storeRecord, propertyName);
|
|
66
|
+
if (value !== undefined) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
currentStoreLayer = currentStoreLayer.parentStoreLayer;
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
},
|
|
74
|
+
set(_, p, newValue) {
|
|
75
|
+
return Reflect.set(getOrInsertRecord(childMostStoreLayer.data, link), p, newValue);
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function addNetworkResponseStoreLayer(parent) {
|
|
80
|
+
switch (parent.kind) {
|
|
81
|
+
case 'NetworkResponseStoreLayer':
|
|
82
|
+
case 'BaseStoreLayer': {
|
|
83
|
+
return parent;
|
|
84
|
+
}
|
|
85
|
+
case 'StartUpdateStoreLayer':
|
|
86
|
+
case 'OptimisticStoreLayer': {
|
|
87
|
+
const node = {
|
|
88
|
+
kind: 'NetworkResponseStoreLayer',
|
|
89
|
+
parentStoreLayer: parent,
|
|
90
|
+
childStoreLayer: null,
|
|
91
|
+
data: {},
|
|
92
|
+
};
|
|
93
|
+
parent.childStoreLayer = node;
|
|
94
|
+
return node;
|
|
95
|
+
}
|
|
96
|
+
default: {
|
|
97
|
+
parent;
|
|
98
|
+
throw new Error('Unreachable. This is a bug in Isograph.');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function mergeDataLayer(target, source) {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
for (const [typeName, sourceById] of Object.entries(source)) {
|
|
105
|
+
if (sourceById == null) {
|
|
106
|
+
target[typeName] = sourceById;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const targetRecordById = ((_a = target[typeName]) !== null && _a !== void 0 ? _a : (target[typeName] = {}));
|
|
110
|
+
for (const [id, sourceRecord] of Object.entries(sourceById)) {
|
|
111
|
+
if (sourceRecord === null) {
|
|
112
|
+
targetRecordById[id] = null;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const targetRecord = ((_b = targetRecordById[id]) !== null && _b !== void 0 ? _b : (targetRecordById[id] = {}));
|
|
116
|
+
Object.assign(targetRecord, sourceRecord);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function addStartUpdateStoreLayer(parent, startUpdate) {
|
|
121
|
+
switch (parent.kind) {
|
|
122
|
+
case 'BaseStoreLayer': {
|
|
123
|
+
startUpdate(parent);
|
|
124
|
+
return parent;
|
|
125
|
+
}
|
|
126
|
+
case 'StartUpdateStoreLayer': {
|
|
127
|
+
const node = parent;
|
|
128
|
+
const prevStartUpdate = node.startUpdate;
|
|
129
|
+
node.startUpdate = () => {
|
|
130
|
+
prevStartUpdate(node);
|
|
131
|
+
startUpdate(node);
|
|
132
|
+
};
|
|
133
|
+
startUpdate(node);
|
|
134
|
+
return node;
|
|
135
|
+
}
|
|
136
|
+
case 'NetworkResponseStoreLayer':
|
|
137
|
+
case 'OptimisticStoreLayer': {
|
|
138
|
+
const node = {
|
|
139
|
+
kind: 'StartUpdateStoreLayer',
|
|
140
|
+
parentStoreLayer: parent,
|
|
141
|
+
childStoreLayer: null,
|
|
142
|
+
data: {},
|
|
143
|
+
startUpdate: startUpdate,
|
|
144
|
+
};
|
|
145
|
+
parent.childStoreLayer = node;
|
|
146
|
+
startUpdate(node);
|
|
147
|
+
return node;
|
|
148
|
+
}
|
|
149
|
+
default: {
|
|
150
|
+
parent;
|
|
151
|
+
throw new Error('Unreachable. This is a bug in Isograph.');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function addOptimisticStoreLayer(parent, startUpdate) {
|
|
156
|
+
switch (parent.kind) {
|
|
157
|
+
case 'BaseStoreLayer':
|
|
158
|
+
case 'StartUpdateStoreLayer':
|
|
159
|
+
case 'NetworkResponseStoreLayer':
|
|
160
|
+
case 'OptimisticStoreLayer': {
|
|
161
|
+
const node = {
|
|
162
|
+
kind: 'OptimisticStoreLayer',
|
|
163
|
+
parentStoreLayer: parent,
|
|
164
|
+
childStoreLayer: null,
|
|
165
|
+
data: {},
|
|
166
|
+
startUpdate: startUpdate,
|
|
167
|
+
};
|
|
168
|
+
startUpdate(node);
|
|
169
|
+
parent.childStoreLayer = node;
|
|
170
|
+
return node;
|
|
171
|
+
}
|
|
172
|
+
default: {
|
|
173
|
+
parent;
|
|
174
|
+
throw new Error('Unreachable. This is a bug in Isograph.');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Merge storeLayerToMerge, and its children, into baseStoreLayer.
|
|
180
|
+
* We can merge until we reach a revertible layer (i.e. an optimistic layer).
|
|
181
|
+
* All other layers cannot be reverted, so for housekeeping + perf, we merge
|
|
182
|
+
* them into a single layer.
|
|
183
|
+
*
|
|
184
|
+
* Note that BaseStoreLayer.childStoreLayer has type OptimisticStoreLayer | null.
|
|
185
|
+
* So, the state of the stack is never e.g. base <- network response. Instead,
|
|
186
|
+
* we have a base + a child that we would like to attach to the base. So, we merge
|
|
187
|
+
* (flatten) until we reach an optimistic layer or null, at which point, we can
|
|
188
|
+
* set baseStoreLayer.childStoreLayer = storeLayerToMerge (via setChildOfNode).
|
|
189
|
+
*/
|
|
190
|
+
function mergeLayersWithDataIntoBaseLayer(environment, storeLayerToMerge, baseStoreLayer) {
|
|
191
|
+
while (storeLayerToMerge &&
|
|
192
|
+
storeLayerToMerge.kind !== 'OptimisticStoreLayer') {
|
|
193
|
+
mergeDataLayer(baseStoreLayer.data, storeLayerToMerge.data);
|
|
194
|
+
storeLayerToMerge = storeLayerToMerge.childStoreLayer;
|
|
195
|
+
}
|
|
196
|
+
setChildOfNode(environment, baseStoreLayer, storeLayerToMerge);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Now that we have replaced the optimistic layer with a network response layer, we need
|
|
200
|
+
* to
|
|
201
|
+
* - re-execute startUpdate and optimistic nodes, in light of the replaced data, and
|
|
202
|
+
* - create two objects containing the old merged data (from the optimistic update layer
|
|
203
|
+
* onward) and the new merged data (from the network response layer onward).
|
|
204
|
+
* - we will compare the new and old merged data in order to determine the changed records
|
|
205
|
+
* and trigger subscriptions.
|
|
206
|
+
*
|
|
207
|
+
* Here, "merged data" means all of the records + fields that were modified, starting at
|
|
208
|
+
* storeLayer, e.g. in BaseLayer <- OptimisticLayer <- StartUpdateLayer, if we
|
|
209
|
+
* are replacing Optimistic, then oldData will contain the records + fields modified by
|
|
210
|
+
* OptimisticLayer + StartUpdateLayer.
|
|
211
|
+
*/
|
|
212
|
+
function reexecuteUpdatesAndMergeData(storeLayer,
|
|
213
|
+
// reflects the (now reverted) optimistic layer
|
|
214
|
+
oldMergedData,
|
|
215
|
+
// reflects whatever replaced the optimistic layer
|
|
216
|
+
newMergedData) {
|
|
217
|
+
while (storeLayer !== null) {
|
|
218
|
+
mergeDataLayer(oldMergedData, storeLayer.data);
|
|
219
|
+
switch (storeLayer.kind) {
|
|
220
|
+
case 'NetworkResponseStoreLayer':
|
|
221
|
+
break;
|
|
222
|
+
case 'StartUpdateStoreLayer': {
|
|
223
|
+
storeLayer.data = {};
|
|
224
|
+
storeLayer.startUpdate(storeLayer);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
case 'OptimisticStoreLayer': {
|
|
228
|
+
storeLayer.data = {};
|
|
229
|
+
storeLayer.startUpdate(storeLayer);
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
default: {
|
|
233
|
+
storeLayer;
|
|
234
|
+
throw new Error('Unreachable. This is a bug in Isograph.');
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
mergeDataLayer(newMergedData, storeLayer.data);
|
|
238
|
+
storeLayer = storeLayer.childStoreLayer;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Set storeLayerToModify's child to a given layer. This may be null!
|
|
243
|
+
* If it is null, set the environment.store to storeLayerToModify.
|
|
244
|
+
* If it is not null, then the existing environment.store value remains
|
|
245
|
+
* valid.
|
|
246
|
+
*/
|
|
247
|
+
function setChildOfNode(environment, storeLayerToModify, newChildStoreLayer) {
|
|
248
|
+
storeLayerToModify.childStoreLayer = newChildStoreLayer;
|
|
249
|
+
if (newChildStoreLayer !== null) {
|
|
250
|
+
newChildStoreLayer.parentStoreLayer = storeLayerToModify;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
environment.store = storeLayerToModify;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Remove an optimistic store layer from the stack, potentially replacing it
|
|
258
|
+
* with a network response.
|
|
259
|
+
*
|
|
260
|
+
* After we do this, we must re-execute all child startUpdate and optimistic
|
|
261
|
+
* layers (since their data may have changed.) We also keep track of changed
|
|
262
|
+
* records, in order to call affected subscriptions.
|
|
263
|
+
*/
|
|
264
|
+
function revertOptimisticStoreLayerAndMaybeReplace(environment, optimisticNode, normalizeData) {
|
|
265
|
+
var _a;
|
|
266
|
+
// We cannot just replace the optimistic node with the network response node,
|
|
267
|
+
// because (e.g.) the types allow Base <- Opt, but not Base <- NetworkResponse.
|
|
268
|
+
// We also may be removing the optimistic layer without replacing it with
|
|
269
|
+
// anything, which would also be disallowed if the original stack was
|
|
270
|
+
// Base <- Opt <- NetworkResponse.
|
|
271
|
+
//
|
|
272
|
+
// Thus, instead, we will (1) replace the optimistic node's data with an empty object
|
|
273
|
+
// and attach the network response as a child.
|
|
274
|
+
const oldMergedData = optimisticNode.data;
|
|
275
|
+
optimisticNode.data = {};
|
|
276
|
+
let newMergedData = {};
|
|
277
|
+
let childNode = optimisticNode.childStoreLayer;
|
|
278
|
+
if (normalizeData !== null) {
|
|
279
|
+
const networkResponseStoreLayer = {
|
|
280
|
+
kind: 'NetworkResponseStoreLayer',
|
|
281
|
+
data: {},
|
|
282
|
+
parentStoreLayer: optimisticNode,
|
|
283
|
+
childStoreLayer: null,
|
|
284
|
+
};
|
|
285
|
+
normalizeData(networkResponseStoreLayer);
|
|
286
|
+
if ((childNode === null || childNode === void 0 ? void 0 : childNode.kind) === 'NetworkResponseStoreLayer') {
|
|
287
|
+
// (2) if the optimistic layer's child was a network response, and we are
|
|
288
|
+
// replacing it with a network response, we must merge the replacement
|
|
289
|
+
// and the child.
|
|
290
|
+
mergeDataLayer(networkResponseStoreLayer.data, childNode.data);
|
|
291
|
+
mergeDataLayer(oldMergedData, childNode.data);
|
|
292
|
+
childNode = childNode.childStoreLayer;
|
|
293
|
+
}
|
|
294
|
+
newMergedData = structuredClone(networkResponseStoreLayer.data);
|
|
295
|
+
setChildOfNode(environment, networkResponseStoreLayer, childNode);
|
|
296
|
+
optimisticNode.childStoreLayer = networkResponseStoreLayer;
|
|
297
|
+
}
|
|
298
|
+
// (3) Re-execute all updates, accumulating all changed values into newMergedData.
|
|
299
|
+
// Since we have already written the network response into newMergedData, we
|
|
300
|
+
// can proceed from the child of the (potentially merged) network response layer.
|
|
301
|
+
//
|
|
302
|
+
// Note that it is important that reexecuteUpdatesAndMergeData is called here!
|
|
303
|
+
// That is because we created newMergedData from the network response layer's data,
|
|
304
|
+
// and later, we may merge that network response into the parent layer (if it is
|
|
305
|
+
// a base layer). That merged layer will contain many extraneous records (unless the
|
|
306
|
+
// base layer is empty).
|
|
307
|
+
//
|
|
308
|
+
// This would cause us to re-execute subscriptions unnecessarily, as these records
|
|
309
|
+
// do not represent changes between the optimistic and network response layers.
|
|
310
|
+
reexecuteUpdatesAndMergeData(childNode, oldMergedData, newMergedData);
|
|
311
|
+
// (4) Now, we can finally remove the optimistic layer, i.e. do
|
|
312
|
+
// optimistic.parent.child = optimistic.child.
|
|
313
|
+
// But the types don't line up, so we handle the cases differently, based on the
|
|
314
|
+
// parent layer type.
|
|
315
|
+
if (optimisticNode.parentStoreLayer.kind === 'BaseStoreLayer') {
|
|
316
|
+
// (4a) If the optimistic parent is the base layer, then we have a problem: base.child
|
|
317
|
+
// must be an optimistic layer or null. So, we merge the optimistic children into the
|
|
318
|
+
// base layer until we reach an optimistic layer.
|
|
319
|
+
mergeLayersWithDataIntoBaseLayer(environment, optimisticNode.childStoreLayer, optimisticNode.parentStoreLayer);
|
|
320
|
+
}
|
|
321
|
+
else if (optimisticNode.parentStoreLayer.kind === 'NetworkResponseStoreLayer' &&
|
|
322
|
+
((_a = optimisticNode.childStoreLayer) === null || _a === void 0 ? void 0 : _a.kind) === 'NetworkResponseStoreLayer') {
|
|
323
|
+
// (4b) if the parent is a network response layer, simply merge those. (We do not
|
|
324
|
+
// attempt to merge other layers, e.g. startUpdate layers, because there is some
|
|
325
|
+
// optimistic layer between this layer and the base, and the startUpdate will need
|
|
326
|
+
// to be recalculated if the optimistic layer is reverted.)
|
|
327
|
+
mergeDataLayer(optimisticNode.parentStoreLayer.data, optimisticNode.childStoreLayer.data);
|
|
328
|
+
setChildOfNode(environment, optimisticNode.parentStoreLayer, optimisticNode.childStoreLayer.childStoreLayer);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
// (4c) Otherwise, the parent is an optimistic or start update layer, and we can
|
|
332
|
+
// set optimistic.parent.child = optimistic.child.
|
|
333
|
+
setChildOfNode(environment, optimisticNode.parentStoreLayer, optimisticNode.childStoreLayer);
|
|
334
|
+
}
|
|
335
|
+
// (5) finally, compare the oldMergedData and newMergedData objects, in order to extract
|
|
336
|
+
// the modified IDs, and re-execute subscriptions.
|
|
337
|
+
let encounteredIds = new Map();
|
|
338
|
+
compareData(oldMergedData, newMergedData, encounteredIds);
|
|
339
|
+
(0, cache_1.callSubscriptions)(environment, encounteredIds);
|
|
340
|
+
}
|
|
341
|
+
function compareData(oldData, newData, encounteredIds) {
|
|
342
|
+
var _a;
|
|
343
|
+
const oldDataTypeNames = new Set(Object.keys(oldData));
|
|
344
|
+
const newDataTypeNames = new Set(Object.keys(newData));
|
|
345
|
+
for (const oldTypeName of oldDataTypeNames.difference(newDataTypeNames)) {
|
|
346
|
+
const set = (0, cache_1.insertEmptySetIfMissing)(encounteredIds, oldTypeName);
|
|
347
|
+
for (const id in oldData[oldTypeName]) {
|
|
348
|
+
set.add(id);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
for (const [typeName, newRecords] of Object.entries(newData)) {
|
|
352
|
+
if (newRecords == null) {
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
const oldRecords = oldData[typeName];
|
|
356
|
+
outer: for (const [id, newRecord] of Object.entries(newRecords)) {
|
|
357
|
+
if (newRecord == null) {
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const oldRecord = oldRecords === null || oldRecords === void 0 ? void 0 : oldRecords[id];
|
|
361
|
+
for (const [recordKey, newRecordValue] of Object.entries(newRecord)) {
|
|
362
|
+
// TODO: compare links, compare arrays
|
|
363
|
+
if (newRecordValue !== (oldRecord === null || oldRecord === void 0 ? void 0 : oldRecord[recordKey])) {
|
|
364
|
+
const set = (0, cache_1.insertEmptySetIfMissing)(encounteredIds, typeName);
|
|
365
|
+
set.add(id);
|
|
366
|
+
continue outer;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
(_a = encounteredIds.get(typeName)) === null || _a === void 0 ? void 0 : _a.delete(id);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
package/dist/core/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/core/read.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAEL,wCAAwC,EAEzC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/core/read.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAEL,wCAAwC,EAEzC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,E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,cAAc,CAAC,EAC9B,IAAI,EAAE,SAAS,KACZ,cAAc,CAAC,MAAM,CAAC,GAC1B,cAAc,CAAC,OAAO,CAAC,CAkGzB;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,wBAAgB,oCAAoC,CAClD,qBAAqB,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,GAAG,IAAI,GAClE,2BAA2B,CAK7B;AAiBD,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,mBAAmB,EAChC,KAAK,EAAE,6BAA6B,EACpC,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,EACpB,oBAAoB,EAAE,wCAAwC,EAAE,EAChE,cAAc,EAAE,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,EACzC,qBAAqB,EAAE,2BAA2B,EAClD,yBAAyB,EAAE,cAAc,GACxC,cAAc,CAAC,OAAO,CAAC,CAuDzB"}
|
package/dist/core/read.js
CHANGED
|
@@ -13,6 +13,7 @@ const componentCache_1 = require("./componentCache");
|
|
|
13
13
|
const IsographEnvironment_1 = require("./IsographEnvironment");
|
|
14
14
|
const logging_1 = require("./logging");
|
|
15
15
|
const makeNetworkRequest_1 = require("./makeNetworkRequest");
|
|
16
|
+
const optimisticProxy_1 = require("./optimisticProxy");
|
|
16
17
|
const PromiseWrapper_1 = require("./PromiseWrapper");
|
|
17
18
|
const startUpdate_1 = require("./startUpdate");
|
|
18
19
|
function readButDoNotEvaluate(environment, fragmentReference, networkRequestOptions) {
|
|
@@ -63,10 +64,10 @@ function readButDoNotEvaluate(environment, fragmentReference, networkRequestOpti
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
function readData(environment, ast, root, variables, nestedRefetchQueries, networkRequest, networkRequestOptions, mutableEncounteredRecords) {
|
|
66
|
-
var _a, _b
|
|
67
|
+
var _a, _b;
|
|
67
68
|
const encounteredIds = (0, cache_1.insertEmptySetIfMissing)(mutableEncounteredRecords, root.__typename);
|
|
68
69
|
encounteredIds.add(root.__link);
|
|
69
|
-
let storeRecord = (
|
|
70
|
+
let storeRecord = (0, optimisticProxy_1.getStoreRecordProxy)(environment.store, root);
|
|
70
71
|
if (storeRecord === undefined) {
|
|
71
72
|
return {
|
|
72
73
|
kind: 'MissingData',
|
|
@@ -88,7 +89,7 @@ function readData(environment, ast, root, variables, nestedRefetchQueries, netwo
|
|
|
88
89
|
if (data.kind === 'MissingData') {
|
|
89
90
|
return data;
|
|
90
91
|
}
|
|
91
|
-
target[(
|
|
92
|
+
target[(_a = field.alias) !== null && _a !== void 0 ? _a : field.fieldName] = data.data;
|
|
92
93
|
break;
|
|
93
94
|
}
|
|
94
95
|
case 'Link': {
|
|
@@ -100,7 +101,7 @@ function readData(environment, ast, root, variables, nestedRefetchQueries, netwo
|
|
|
100
101
|
if (data.kind === 'MissingData') {
|
|
101
102
|
return data;
|
|
102
103
|
}
|
|
103
|
-
target[(
|
|
104
|
+
target[(_b = field.alias) !== null && _b !== void 0 ? _b : field.fieldName] = data.data;
|
|
104
105
|
break;
|
|
105
106
|
}
|
|
106
107
|
case 'ImperativelyLoadedField': {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type EncounteredIds } from './cache';
|
|
2
2
|
import { type ExtractStartUpdate, type ExtractUpdatableData, type FragmentReference, type UnknownTReadFromStore } from './FragmentReference';
|
|
3
3
|
import { type IsographEnvironment } from './IsographEnvironment';
|
|
4
|
+
import { type StoreLayer } from './optimisticProxy';
|
|
4
5
|
import { type NetworkRequestReaderOptions } from './read';
|
|
5
6
|
export declare function getOrCreateCachedStartUpdate<TReadFromStore extends UnknownTReadFromStore>(environment: IsographEnvironment, fragmentReference: FragmentReference<TReadFromStore, unknown>, eagerResolverName: string, networkRequestOptions: NetworkRequestReaderOptions): ExtractStartUpdate<TReadFromStore>;
|
|
6
7
|
export declare function createStartUpdate<TReadFromStore extends UnknownTReadFromStore>(environment: IsographEnvironment, fragmentReference: FragmentReference<TReadFromStore, unknown>, networkRequestOptions: NetworkRequestReaderOptions): ExtractStartUpdate<TReadFromStore>;
|
|
7
|
-
export declare function createUpdatableProxy<TReadFromStore extends UnknownTReadFromStore>(environment: IsographEnvironment, fragmentReference: FragmentReference<TReadFromStore, unknown>, networkRequestOptions: NetworkRequestReaderOptions, mutableUpdatedIds: EncounteredIds): ExtractUpdatableData<TReadFromStore>;
|
|
8
|
+
export declare function createUpdatableProxy<TReadFromStore extends UnknownTReadFromStore>(environment: IsographEnvironment, storeLayer: StoreLayer, fragmentReference: FragmentReference<TReadFromStore, unknown>, networkRequestOptions: NetworkRequestReaderOptions, mutableUpdatedIds: EncounteredIds): ExtractUpdatableData<TReadFromStore>;
|
|
8
9
|
//# sourceMappingURL=startUpdate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startUpdate.d.ts","sourceRoot":"","sources":["../../src/core/startUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"startUpdate.d.ts","sourceRoot":"","sources":["../../src/core/startUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAML,KAAK,2BAA2B,EAEjC,MAAM,QAAQ,CAAC;AAGhB,wBAAgB,4BAA4B,CAC1C,cAAc,SAAS,qBAAqB,EAE5C,WAAW,EAAE,mBAAmB,EAChC,iBAAiB,EAAE,iBAAiB,CAAC,cAAc,EAAE,OAAO,CAAC,EAC7D,iBAAiB,EAAE,MAAM,EACzB,qBAAqB,EAAE,2BAA2B,GACjD,kBAAkB,CAAC,cAAc,CAAC,CAQpC;AAED,wBAAgB,iBAAiB,CAAC,cAAc,SAAS,qBAAqB,EAC5E,WAAW,EAAE,mBAAmB,EAChC,iBAAiB,EAAE,iBAAiB,CAAC,cAAc,EAAE,OAAO,CAAC,EAC7D,qBAAqB,EAAE,2BAA2B,GACjD,kBAAkB,CAAC,cAAc,CAAC,CAqCpC;AAED,wBAAgB,oBAAoB,CAClC,cAAc,SAAS,qBAAqB,EAE5C,WAAW,EAAE,mBAAmB,EAChC,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,CAAC,cAAc,EAAE,OAAO,CAAC,EAC7D,qBAAqB,EAAE,2BAA2B,EAClD,iBAAiB,EAAE,cAAc,GAChC,oBAAoB,CAAC,cAAc,CAAC,CAmBtC"}
|
package/dist/core/startUpdate.js
CHANGED
|
@@ -7,6 +7,7 @@ const cache_1 = require("./cache");
|
|
|
7
7
|
const FragmentReference_1 = require("./FragmentReference");
|
|
8
8
|
const IsographEnvironment_1 = require("./IsographEnvironment");
|
|
9
9
|
const logging_1 = require("./logging");
|
|
10
|
+
const optimisticProxy_1 = require("./optimisticProxy");
|
|
10
11
|
const PromiseWrapper_1 = require("./PromiseWrapper");
|
|
11
12
|
const read_1 = require("./read");
|
|
12
13
|
function getOrCreateCachedStartUpdate(environment, fragmentReference, eagerResolverName, networkRequestOptions) {
|
|
@@ -17,30 +18,32 @@ function getOrCreateCachedStartUpdate(environment, fragmentReference, eagerResol
|
|
|
17
18
|
function createStartUpdate(environment, fragmentReference, networkRequestOptions) {
|
|
18
19
|
return (updater) => {
|
|
19
20
|
let mutableUpdatedIds = new Map();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
const startUpdate = (storeLayer) => {
|
|
22
|
+
mutableUpdatedIds.clear();
|
|
23
|
+
let updatableData = createUpdatableProxy(environment, storeLayer, fragmentReference, networkRequestOptions, mutableUpdatedIds);
|
|
24
|
+
try {
|
|
25
|
+
updater({ updatableData });
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
(0, logging_1.logMessage)(environment, () => ({
|
|
29
|
+
kind: 'StartUpdateError',
|
|
30
|
+
error: e,
|
|
31
|
+
}));
|
|
32
|
+
throw e;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
environment.store = (0, optimisticProxy_1.addStartUpdateStoreLayer)(environment.store, startUpdate);
|
|
36
|
+
(0, logging_1.logMessage)(environment, () => ({
|
|
37
|
+
kind: 'StartUpdateComplete',
|
|
38
|
+
updatedIds: mutableUpdatedIds,
|
|
39
|
+
}));
|
|
40
|
+
(0, cache_1.callSubscriptions)(environment, mutableUpdatedIds);
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
|
-
function createUpdatableProxy(environment, fragmentReference, networkRequestOptions, mutableUpdatedIds) {
|
|
43
|
+
function createUpdatableProxy(environment, storeLayer, fragmentReference, networkRequestOptions, mutableUpdatedIds) {
|
|
41
44
|
var _a;
|
|
42
45
|
const readerWithRefetchQueries = (0, PromiseWrapper_1.readPromise)(fragmentReference.readerWithRefetchQueries);
|
|
43
|
-
return readUpdatableData(environment, readerWithRefetchQueries.readerArtifact.readerAst, fragmentReference.root, (_a = fragmentReference.variables) !== null && _a !== void 0 ? _a : {}, readerWithRefetchQueries.nestedRefetchQueries, fragmentReference.networkRequest, networkRequestOptions, {
|
|
46
|
+
return readUpdatableData(environment, storeLayer, readerWithRefetchQueries.readerArtifact.readerAst, fragmentReference.root, (_a = fragmentReference.variables) !== null && _a !== void 0 ? _a : {}, readerWithRefetchQueries.nestedRefetchQueries, fragmentReference.networkRequest, networkRequestOptions, {
|
|
44
47
|
lastInvalidated: 0,
|
|
45
48
|
}, mutableUpdatedIds).data;
|
|
46
49
|
}
|
|
@@ -65,21 +68,15 @@ function defineCachedProperty(target, property, mutableState, get, set) {
|
|
|
65
68
|
},
|
|
66
69
|
})));
|
|
67
70
|
}
|
|
68
|
-
function readUpdatableData(environment, ast, root, variables, nestedRefetchQueries, networkRequest, networkRequestOptions, mutableState, mutableUpdatedIds) {
|
|
69
|
-
var _a, _b
|
|
70
|
-
|
|
71
|
-
if (storeRecord == null) {
|
|
72
|
-
return {
|
|
73
|
-
kind: 'Success',
|
|
74
|
-
data: null,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
71
|
+
function readUpdatableData(environment, storeLayer, ast, root, variables, nestedRefetchQueries, networkRequest, networkRequestOptions, mutableState, mutableUpdatedIds) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const storeRecord = (0, optimisticProxy_1.getMutableStoreRecordProxy)(storeLayer, root);
|
|
77
74
|
let target = {};
|
|
78
75
|
for (const field of ast) {
|
|
79
76
|
switch (field.kind) {
|
|
80
77
|
case 'Scalar': {
|
|
81
78
|
const storeRecordName = (0, cache_1.getParentRecordKey)(field, variables);
|
|
82
|
-
defineCachedProperty(target, (
|
|
79
|
+
defineCachedProperty(target, (_a = field.alias) !== null && _a !== void 0 ? _a : field.fieldName, mutableState, () => {
|
|
83
80
|
const data = (0, read_1.readScalarFieldData)(field, storeRecord, root, variables);
|
|
84
81
|
if (data.kind === 'MissingData') {
|
|
85
82
|
throw new Error(data.reason);
|
|
@@ -87,6 +84,7 @@ function readUpdatableData(environment, ast, root, variables, nestedRefetchQueri
|
|
|
87
84
|
return data.data;
|
|
88
85
|
}, field.isUpdatable
|
|
89
86
|
? (newValue) => {
|
|
87
|
+
const storeRecord = (0, optimisticProxy_1.getOrInsertRecord)(storeLayer.data, root);
|
|
90
88
|
storeRecord[storeRecordName] = newValue;
|
|
91
89
|
const updatedIds = (0, cache_1.insertEmptySetIfMissing)(mutableUpdatedIds, root.__typename);
|
|
92
90
|
updatedIds.add(root.__link);
|
|
@@ -96,14 +94,15 @@ function readUpdatableData(environment, ast, root, variables, nestedRefetchQueri
|
|
|
96
94
|
}
|
|
97
95
|
case 'Linked': {
|
|
98
96
|
const storeRecordName = (0, cache_1.getParentRecordKey)(field, variables);
|
|
99
|
-
defineCachedProperty(target, (
|
|
100
|
-
const data = (0, read_1.readLinkedFieldData)(environment, field, storeRecord, root, variables, nestedRefetchQueries, networkRequest, networkRequestOptions, (ast, root) => readUpdatableData(environment, ast, root, variables, nestedRefetchQueries, networkRequest, networkRequestOptions, mutableState, mutableUpdatedIds));
|
|
97
|
+
defineCachedProperty(target, (_b = field.alias) !== null && _b !== void 0 ? _b : field.fieldName, mutableState, () => {
|
|
98
|
+
const data = (0, read_1.readLinkedFieldData)(environment, field, storeRecord, root, variables, nestedRefetchQueries, networkRequest, networkRequestOptions, (ast, root) => readUpdatableData(environment, storeLayer, ast, root, variables, nestedRefetchQueries, networkRequest, networkRequestOptions, mutableState, mutableUpdatedIds));
|
|
101
99
|
if (data.kind === 'MissingData') {
|
|
102
100
|
throw new Error(data.reason);
|
|
103
101
|
}
|
|
104
102
|
return data.data;
|
|
105
103
|
}, 'isUpdatable' in field && field.isUpdatable
|
|
106
104
|
? (newValue) => {
|
|
105
|
+
const storeRecord = (0, optimisticProxy_1.getOrInsertRecord)(storeLayer.data, root);
|
|
107
106
|
if (Array.isArray(newValue)) {
|
|
108
107
|
storeRecord[storeRecordName] = newValue.map((node) => (0, IsographEnvironment_1.assertLink)(node === null || node === void 0 ? void 0 : node.__link));
|
|
109
108
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { retainQuery, unretainQuery, type RetainedQuery, garbageCollectEnvironme
|
|
|
2
2
|
export { type PromiseWrapper, readPromise, getPromiseState, wrapResolvedValue, wrapPromise, type PromiseState, type Result, type AnyError, type NotSet, NOT_SET, } from './core/PromiseWrapper';
|
|
3
3
|
export { callSubscriptions, subscribe, normalizeData, type NetworkResponseObject, type NetworkResponseValue, type NetworkResponseScalarValue, type EncounteredIds, } from './core/cache';
|
|
4
4
|
export { makeNetworkRequest } from './core/makeNetworkRequest';
|
|
5
|
-
export { ROOT_ID, type DataId, type DataTypeValue, type IsographEnvironment, type IsographNetworkFunction, type IsographStore, type MissingFieldHandler, type StoreLink, type Link, type StoreRecord, type CacheMap, createIsographEnvironment, createIsographStore, type FieldCache, type Subscriptions, type Subscription, type TypeName, type FragmentSubscription, type AnyChangesToRecordSubscription, type AnyRecordSubscription, type ComponentOrFieldName, type StringifiedArgs, } from './core/IsographEnvironment';
|
|
5
|
+
export { ROOT_ID, type DataId, type DataTypeValue, type IsographEnvironment, type IsographNetworkFunction, type BaseStoreLayerData as IsographStore, type MissingFieldHandler, type StoreLink, type Link, type StoreRecord, type CacheMap, createIsographEnvironment, createIsographStore, type FieldCache, type Subscriptions, type Subscription, type TypeName, type FragmentSubscription, type AnyChangesToRecordSubscription, type AnyRecordSubscription, type ComponentOrFieldName, type StringifiedArgs, } from './core/IsographEnvironment';
|
|
6
6
|
export { type EagerReaderArtifact, type ComponentReaderArtifact, type RefetchReaderArtifact, type ReaderAst, type ReaderAstNode, type ReaderLinkedField, type ReaderNonLoadableResolverField, type ReaderScalarField, type TopLevelReaderArtifact, type LoadableField, type StableId, type ResolverFirstParameter, type ReaderImperativelyLoadedField, type LoadablySelectedField as ReaderLoadableField, type ReaderLinkField, type StartUpdate, } from './core/reader';
|
|
7
7
|
export { type NormalizationAst, type NormalizationAstNode, type NormalizationAstNodes, type NormalizationAstLoader, type NormalizationLinkedField, type NormalizationScalarField, type IsographEntrypoint, type IsographOperation, type IsographPersistedOperation, type IsographPersistedOperationExtraInfo, assertIsEntrypoint, type RefetchQueryNormalizationArtifact, type RefetchQueryNormalizationArtifactWrapper, type ExtractProps, type ExtractReadFromStore, type ExtractResolverResult, type NetworkRequestInfo, type NormalizationInlineFragment, type ReaderWithRefetchQueries, type IsographEntrypointLoader, } from './core/entrypoint';
|
|
8
8
|
export { readButDoNotEvaluate, type WithEncounteredRecords, type NetworkRequestReaderOptions, type ReadDataResult, } from './core/read';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,KAAK,aAAa,EAClB,yBAAyB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,cAAc,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,OAAO,GACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,OAAO,EACP,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,KAAK,aAAa,EAClB,yBAAyB,EACzB,KAAK,oBAAoB,GAC1B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C,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,sBAAsB,EACtB,KAAK,4BAA4B,GAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,KAAK,4BAA4B,GAClC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAEtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EACL,iCAAiC,EACjC,KAAK,gCAAgC,IAAI,uCAAuC,GACjF,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,sBAAsB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,GAC7B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,2BAA2B,EAC3B,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,GAC9B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,0BAA0B,EAC1B,KAAK,gCAAgC,GACtC,MAAM,6CAA6C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isograph/react",
|
|
3
|
-
"version": "0.0.0-main-
|
|
3
|
+
"version": "0.0.0-main-84b67b62",
|
|
4
4
|
"description": "Use Isograph with React",
|
|
5
5
|
"homepage": "https://isograph.dev",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"iso": "cross-env ISO_PRINT_ABSOLUTE_FILEPATH=1 ../../target/debug/isograph_cli --config ./isograph.config.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@isograph/disposable-types": "0.0.0-main-
|
|
23
|
-
"@isograph/react-disposable-state": "0.0.0-main-
|
|
24
|
-
"@isograph/reference-counted-pointer": "0.0.0-main-
|
|
22
|
+
"@isograph/disposable-types": "0.0.0-main-84b67b62",
|
|
23
|
+
"@isograph/react-disposable-state": "0.0.0-main-84b67b62",
|
|
24
|
+
"@isograph/reference-counted-pointer": "0.0.0-main-84b67b62"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "^18.0.0 || ^19.0.0"
|