@isograph/react 0.1.1 → 0.3.0
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/dist/core/FragmentReference.d.ts +25 -0
- package/dist/core/FragmentReference.d.ts.map +1 -0
- package/dist/core/FragmentReference.js +16 -0
- package/dist/core/IsographEnvironment.d.ts +89 -0
- package/dist/core/IsographEnvironment.d.ts.map +1 -0
- package/dist/core/IsographEnvironment.js +65 -0
- package/dist/core/PromiseWrapper.d.ts +28 -0
- package/dist/core/PromiseWrapper.d.ts.map +1 -0
- package/dist/core/PromiseWrapper.js +57 -0
- package/dist/core/areEqualWithDeepComparison.d.ts +5 -0
- package/dist/core/areEqualWithDeepComparison.d.ts.map +1 -0
- package/dist/core/areEqualWithDeepComparison.js +95 -0
- package/dist/core/cache.d.ts +44 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +514 -0
- package/dist/core/check.d.ts +18 -0
- package/dist/core/check.d.ts.map +1 -0
- package/dist/core/check.js +127 -0
- package/dist/core/componentCache.d.ts +5 -0
- package/dist/core/componentCache.d.ts.map +1 -0
- package/dist/core/componentCache.js +38 -0
- package/dist/core/entrypoint.d.ts +69 -0
- package/dist/core/entrypoint.d.ts.map +1 -0
- package/dist/core/entrypoint.js +7 -0
- package/dist/core/garbageCollection.d.ts +13 -0
- package/dist/core/garbageCollection.d.ts.map +1 -0
- package/dist/core/garbageCollection.js +107 -0
- package/dist/core/logging.d.ts +69 -0
- package/dist/core/logging.d.ts.map +1 -0
- package/dist/core/logging.js +19 -0
- package/dist/core/makeNetworkRequest.d.ts +9 -0
- package/dist/core/makeNetworkRequest.d.ts.map +1 -0
- package/dist/core/makeNetworkRequest.js +118 -0
- package/dist/core/read.d.ts +27 -0
- package/dist/core/read.d.ts.map +1 -0
- package/dist/core/read.js +478 -0
- package/dist/core/reader.d.ts +87 -0
- package/dist/core/reader.d.ts.map +1 -0
- package/dist/core/reader.js +2 -0
- package/dist/core/util.d.ts +19 -0
- package/dist/core/util.d.ts.map +1 -0
- package/dist/core/util.js +2 -0
- package/dist/index.d.ts +26 -120
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -306
- package/dist/loadable-hooks/useClientSideDefer.d.ts +16 -0
- package/dist/loadable-hooks/useClientSideDefer.d.ts.map +1 -0
- package/dist/loadable-hooks/useClientSideDefer.js +13 -0
- package/dist/loadable-hooks/useConnectionSpecPagination.d.ts +34 -0
- package/dist/loadable-hooks/useConnectionSpecPagination.d.ts.map +1 -0
- package/dist/loadable-hooks/useConnectionSpecPagination.js +160 -0
- package/dist/loadable-hooks/useImperativeExposedMutationField.d.ts +6 -0
- package/dist/loadable-hooks/useImperativeExposedMutationField.d.ts.map +1 -0
- package/dist/loadable-hooks/useImperativeExposedMutationField.js +14 -0
- package/dist/loadable-hooks/useImperativeLoadableField.d.ts +17 -0
- package/dist/loadable-hooks/useImperativeLoadableField.d.ts.map +1 -0
- package/dist/loadable-hooks/useImperativeLoadableField.js +14 -0
- package/dist/loadable-hooks/useSkipLimitPagination.d.ts +27 -0
- package/dist/loadable-hooks/useSkipLimitPagination.d.ts.map +1 -0
- package/dist/loadable-hooks/useSkipLimitPagination.js +162 -0
- package/dist/react/FragmentReader.d.ts +16 -0
- package/dist/react/FragmentReader.d.ts.map +1 -0
- package/dist/{EntrypointReader.js → react/FragmentReader.js} +7 -5
- package/dist/react/IsographEnvironmentProvider.d.ts +11 -0
- package/dist/react/IsographEnvironmentProvider.d.ts.map +1 -0
- package/dist/{IsographEnvironment.js → react/IsographEnvironmentProvider.js} +4 -22
- package/dist/react/RenderAfterCommit__DO_NOT_USE.d.ts +10 -0
- package/dist/react/RenderAfterCommit__DO_NOT_USE.d.ts.map +1 -0
- package/dist/react/RenderAfterCommit__DO_NOT_USE.js +15 -0
- package/dist/react/useImperativeReference.d.ts +12 -0
- package/dist/react/useImperativeReference.d.ts.map +1 -0
- package/dist/react/useImperativeReference.js +35 -0
- package/dist/react/useLazyReference.d.ts +10 -0
- package/dist/react/useLazyReference.d.ts.map +1 -0
- package/dist/react/useLazyReference.js +21 -0
- package/dist/react/useReadAndSubscribe.d.ts +20 -0
- package/dist/react/useReadAndSubscribe.d.ts.map +1 -0
- package/dist/react/useReadAndSubscribe.js +40 -0
- package/dist/react/useRerenderOnChange.d.ts +8 -0
- package/dist/react/useRerenderOnChange.d.ts.map +1 -0
- package/dist/react/useRerenderOnChange.js +22 -0
- package/dist/react/useResult.d.ts +9 -0
- package/dist/react/useResult.d.ts.map +1 -0
- package/dist/react/useResult.js +39 -0
- package/docs/how-useLazyReference-works.md +117 -0
- package/isograph.config.json +7 -0
- package/package.json +18 -9
- package/schema.graphql +17 -0
- package/src/core/FragmentReference.ts +49 -0
- package/src/core/IsographEnvironment.ts +192 -0
- package/src/core/PromiseWrapper.ts +86 -0
- package/src/core/areEqualWithDeepComparison.ts +112 -0
- package/src/core/cache.ts +835 -0
- package/src/core/check.ts +207 -0
- package/src/core/componentCache.ts +62 -0
- package/src/core/entrypoint.ts +106 -0
- package/src/core/garbageCollection.ts +173 -0
- package/src/core/logging.ts +116 -0
- package/src/core/makeNetworkRequest.ts +175 -0
- package/src/core/read.ts +722 -0
- package/src/core/reader.ts +160 -0
- package/src/core/util.ts +27 -0
- package/src/index.ts +99 -0
- package/src/loadable-hooks/useClientSideDefer.ts +58 -0
- package/src/loadable-hooks/useConnectionSpecPagination.ts +331 -0
- package/src/loadable-hooks/useImperativeExposedMutationField.ts +17 -0
- package/src/loadable-hooks/useImperativeLoadableField.ts +52 -0
- package/src/loadable-hooks/useSkipLimitPagination.ts +352 -0
- package/src/react/FragmentReader.tsx +43 -0
- package/src/react/IsographEnvironmentProvider.tsx +33 -0
- package/src/react/RenderAfterCommit__DO_NOT_USE.tsx +17 -0
- package/src/react/useImperativeReference.ts +68 -0
- package/src/react/useLazyReference.ts +42 -0
- package/src/react/useReadAndSubscribe.ts +81 -0
- package/src/react/useRerenderOnChange.ts +38 -0
- package/src/react/useResult.ts +73 -0
- package/src/tests/__isograph/Query/meName/entrypoint.ts +52 -0
- package/src/tests/__isograph/Query/meName/output_type.ts +3 -0
- package/src/tests/__isograph/Query/meName/param_type.ts +9 -0
- package/src/tests/__isograph/Query/meName/resolver_reader.ts +33 -0
- package/src/tests/__isograph/Query/meNameSuccessor/entrypoint.ts +90 -0
- package/src/tests/__isograph/Query/meNameSuccessor/output_type.ts +3 -0
- package/src/tests/__isograph/Query/meNameSuccessor/param_type.ts +14 -0
- package/src/tests/__isograph/Query/meNameSuccessor/resolver_reader.ts +57 -0
- package/src/tests/__isograph/Query/nodeField/entrypoint.ts +57 -0
- package/src/tests/__isograph/Query/nodeField/output_type.ts +3 -0
- package/src/tests/__isograph/Query/nodeField/param_type.ts +10 -0
- package/src/tests/__isograph/Query/nodeField/parameters_type.ts +3 -0
- package/src/tests/__isograph/Query/nodeField/resolver_reader.ts +38 -0
- package/src/tests/__isograph/Query/subquery/entrypoint.ts +67 -0
- package/src/tests/__isograph/Query/subquery/output_type.ts +3 -0
- package/src/tests/__isograph/Query/subquery/param_type.ts +12 -0
- package/src/tests/__isograph/Query/subquery/parameters_type.ts +3 -0
- package/src/tests/__isograph/Query/subquery/resolver_reader.ts +47 -0
- package/src/tests/__isograph/iso.ts +99 -0
- package/src/tests/garbageCollection.test.ts +142 -0
- package/src/tests/meNameSuccessor.ts +25 -0
- package/src/tests/nodeQuery.ts +19 -0
- package/src/tests/normalizeData.test.ts +120 -0
- package/src/tests/tsconfig.json +21 -0
- package/tsconfig.json +6 -0
- package/tsconfig.pkg.json +7 -1
- package/vitest.config.ts +20 -0
- package/dist/EntrypointReader.d.ts +0 -6
- package/dist/IsographEnvironment.d.ts +0 -56
- package/dist/PromiseWrapper.d.ts +0 -13
- package/dist/PromiseWrapper.js +0 -22
- package/dist/cache.d.ts +0 -26
- package/dist/cache.js +0 -274
- package/dist/componentCache.d.ts +0 -6
- package/dist/componentCache.js +0 -31
- package/dist/useImperativeReference.d.ts +0 -8
- package/dist/useImperativeReference.js +0 -28
- package/src/EntrypointReader.tsx +0 -20
- package/src/IsographEnvironment.tsx +0 -120
- package/src/PromiseWrapper.ts +0 -29
- package/src/cache.tsx +0 -484
- package/src/componentCache.ts +0 -41
- package/src/index.tsx +0 -617
- package/src/useImperativeReference.ts +0 -58
@@ -0,0 +1,514 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SECOND_SPLIT_KEY = exports.FIRST_SPLIT_KEY = exports.TYPENAME_FIELD_NAME = void 0;
|
4
|
+
exports.getOrCreateItemInSuspenseCache = getOrCreateItemInSuspenseCache;
|
5
|
+
exports.stableCopy = stableCopy;
|
6
|
+
exports.getOrCreateCacheForArtifact = getOrCreateCacheForArtifact;
|
7
|
+
exports.normalizeData = normalizeData;
|
8
|
+
exports.subscribeToAnyChange = subscribeToAnyChange;
|
9
|
+
exports.subscribeToAnyChangesToRecord = subscribeToAnyChangesToRecord;
|
10
|
+
exports.subscribe = subscribe;
|
11
|
+
exports.onNextChangeToRecord = onNextChangeToRecord;
|
12
|
+
exports.insertIfNotExists = insertIfNotExists;
|
13
|
+
exports.getParentRecordKey = getParentRecordKey;
|
14
|
+
const react_disposable_state_1 = require("@isograph/react-disposable-state");
|
15
|
+
const IsographEnvironment_1 = require("./IsographEnvironment");
|
16
|
+
const read_1 = require("./read");
|
17
|
+
const areEqualWithDeepComparison_1 = require("./areEqualWithDeepComparison");
|
18
|
+
const makeNetworkRequest_1 = require("./makeNetworkRequest");
|
19
|
+
const PromiseWrapper_1 = require("./PromiseWrapper");
|
20
|
+
const logging_1 = require("./logging");
|
21
|
+
exports.TYPENAME_FIELD_NAME = '__typename';
|
22
|
+
function getOrCreateItemInSuspenseCache(environment, index, factory) {
|
23
|
+
// TODO this is probably a useless message, we should remove it
|
24
|
+
(0, logging_1.logMessage)(environment, {
|
25
|
+
kind: 'GettingSuspenseCacheItem',
|
26
|
+
index,
|
27
|
+
availableCacheItems: Object.keys(environment.fragmentCache),
|
28
|
+
found: !!environment.fragmentCache[index],
|
29
|
+
});
|
30
|
+
if (environment.fragmentCache[index] == null) {
|
31
|
+
environment.fragmentCache[index] = new react_disposable_state_1.ParentCache(factory);
|
32
|
+
}
|
33
|
+
return environment.fragmentCache[index];
|
34
|
+
}
|
35
|
+
/**
|
36
|
+
* Creates a copy of the provided value, ensuring any nested objects have their
|
37
|
+
* keys sorted such that equivalent values would have identical JSON.stringify
|
38
|
+
* results.
|
39
|
+
*/
|
40
|
+
function stableCopy(value) {
|
41
|
+
if (!value || typeof value !== 'object') {
|
42
|
+
return value;
|
43
|
+
}
|
44
|
+
if (Array.isArray(value)) {
|
45
|
+
// @ts-ignore
|
46
|
+
return value.map(stableCopy);
|
47
|
+
}
|
48
|
+
const keys = Object.keys(value).sort();
|
49
|
+
const stable = {};
|
50
|
+
for (let i = 0; i < keys.length; i++) {
|
51
|
+
// @ts-ignore
|
52
|
+
stable[keys[i]] = stableCopy(value[keys[i]]);
|
53
|
+
}
|
54
|
+
return stable;
|
55
|
+
}
|
56
|
+
function getOrCreateCacheForArtifact(environment, entrypoint, variables, fetchOptions) {
|
57
|
+
const cacheKey = entrypoint.networkRequestInfo.queryText +
|
58
|
+
JSON.stringify(stableCopy(variables));
|
59
|
+
const factory = () => {
|
60
|
+
const [networkRequest, disposeNetworkRequest] = (0, makeNetworkRequest_1.maybeMakeNetworkRequest)(environment, entrypoint, variables, fetchOptions);
|
61
|
+
const itemCleanupPair = [
|
62
|
+
{
|
63
|
+
kind: 'FragmentReference',
|
64
|
+
readerWithRefetchQueries: (0, PromiseWrapper_1.wrapResolvedValue)({
|
65
|
+
kind: 'ReaderWithRefetchQueries',
|
66
|
+
readerArtifact: entrypoint.readerWithRefetchQueries.readerArtifact,
|
67
|
+
nestedRefetchQueries: entrypoint.readerWithRefetchQueries.nestedRefetchQueries,
|
68
|
+
}),
|
69
|
+
root: { __link: IsographEnvironment_1.ROOT_ID, __typename: entrypoint.concreteType },
|
70
|
+
variables,
|
71
|
+
networkRequest: networkRequest,
|
72
|
+
},
|
73
|
+
disposeNetworkRequest,
|
74
|
+
];
|
75
|
+
return itemCleanupPair;
|
76
|
+
};
|
77
|
+
return getOrCreateItemInSuspenseCache(environment, cacheKey, factory);
|
78
|
+
}
|
79
|
+
function normalizeData(environment, normalizationAst, networkResponse, variables, nestedRefetchQueries, root) {
|
80
|
+
var _a, _b;
|
81
|
+
var _c, _d, _e;
|
82
|
+
const encounteredIds = new Map();
|
83
|
+
(0, logging_1.logMessage)(environment, {
|
84
|
+
kind: 'AboutToNormalize',
|
85
|
+
normalizationAst,
|
86
|
+
networkResponse,
|
87
|
+
variables,
|
88
|
+
});
|
89
|
+
const recordsById = ((_a = (_c = environment.store)[_d = root.__typename]) !== null && _a !== void 0 ? _a : (_c[_d] = {}));
|
90
|
+
const newStoreRecord = ((_b = recordsById[_e = root.__link]) !== null && _b !== void 0 ? _b : (recordsById[_e] = {}));
|
91
|
+
normalizeDataIntoRecord(environment, normalizationAst, networkResponse, newStoreRecord, root, variables, nestedRefetchQueries, encounteredIds);
|
92
|
+
(0, logging_1.logMessage)(environment, {
|
93
|
+
kind: 'AfterNormalization',
|
94
|
+
store: environment.store,
|
95
|
+
encounteredIds,
|
96
|
+
});
|
97
|
+
callSubscriptions(environment, encounteredIds);
|
98
|
+
return encounteredIds;
|
99
|
+
}
|
100
|
+
function subscribeToAnyChange(environment, callback) {
|
101
|
+
const subscription = {
|
102
|
+
kind: 'AnyRecords',
|
103
|
+
callback,
|
104
|
+
};
|
105
|
+
environment.subscriptions.add(subscription);
|
106
|
+
return () => environment.subscriptions.delete(subscription);
|
107
|
+
}
|
108
|
+
function subscribeToAnyChangesToRecord(environment, recordLink, callback) {
|
109
|
+
const subscription = {
|
110
|
+
kind: 'AnyChangesToRecord',
|
111
|
+
recordLink,
|
112
|
+
callback,
|
113
|
+
};
|
114
|
+
environment.subscriptions.add(subscription);
|
115
|
+
return () => environment.subscriptions.delete(subscription);
|
116
|
+
}
|
117
|
+
// TODO we should re-read and call callback if the value has changed
|
118
|
+
function subscribe(environment, encounteredDataAndRecords, fragmentReference, callback, readerAst) {
|
119
|
+
const fragmentSubscription = {
|
120
|
+
kind: 'FragmentSubscription',
|
121
|
+
callback,
|
122
|
+
encounteredDataAndRecords,
|
123
|
+
fragmentReference,
|
124
|
+
readerAst,
|
125
|
+
};
|
126
|
+
environment.subscriptions.add(fragmentSubscription);
|
127
|
+
return () => environment.subscriptions.delete(fragmentSubscription);
|
128
|
+
}
|
129
|
+
function onNextChangeToRecord(environment, recordLink) {
|
130
|
+
return new Promise((resolve) => {
|
131
|
+
const unsubscribe = subscribeToAnyChangesToRecord(environment, recordLink, () => {
|
132
|
+
unsubscribe();
|
133
|
+
resolve();
|
134
|
+
});
|
135
|
+
});
|
136
|
+
}
|
137
|
+
// Calls to readButDoNotEvaluate can suspend (i.e. throw a promise).
|
138
|
+
// Maybe in the future, they will be able to throw errors.
|
139
|
+
//
|
140
|
+
// That's probably okay to ignore. We don't, however, want to prevent
|
141
|
+
// updating other subscriptions if one subscription had missing data.
|
142
|
+
function withErrorHandling(f) {
|
143
|
+
return (t) => {
|
144
|
+
try {
|
145
|
+
return f(t);
|
146
|
+
}
|
147
|
+
catch (_a) { }
|
148
|
+
};
|
149
|
+
}
|
150
|
+
function callSubscriptions(environment, recordsEncounteredWhenNormalizing) {
|
151
|
+
environment.subscriptions.forEach(withErrorHandling((subscription) => {
|
152
|
+
var _a;
|
153
|
+
switch (subscription.kind) {
|
154
|
+
case 'FragmentSubscription': {
|
155
|
+
// TODO if there are multiple components subscribed to the same
|
156
|
+
// fragment, we will call readButNotEvaluate multiple times. We
|
157
|
+
// should fix that.
|
158
|
+
if (hasOverlappingIds(recordsEncounteredWhenNormalizing, subscription.encounteredDataAndRecords.encounteredRecords)) {
|
159
|
+
const newEncounteredDataAndRecords = (0, read_1.readButDoNotEvaluate)(environment, subscription.fragmentReference,
|
160
|
+
// Is this wrong?
|
161
|
+
// Reasons to think no:
|
162
|
+
// - we are only updating the read-out value, and the network
|
163
|
+
// options only affect whether we throw.
|
164
|
+
// - the component will re-render, and re-throw on its own, anyway.
|
165
|
+
//
|
166
|
+
// Reasons to think not:
|
167
|
+
// - it seems more efficient to suspend here and not update state,
|
168
|
+
// if we expect that the component will just throw anyway
|
169
|
+
// - consistency
|
170
|
+
// - it's also weird, this is called from makeNetworkRequest, where
|
171
|
+
// we don't currently pass network request options
|
172
|
+
{
|
173
|
+
suspendIfInFlight: false,
|
174
|
+
throwOnNetworkError: false,
|
175
|
+
});
|
176
|
+
const mergedItem = (0, areEqualWithDeepComparison_1.mergeObjectsUsingReaderAst)(subscription.readerAst, subscription.encounteredDataAndRecords.item, newEncounteredDataAndRecords.item);
|
177
|
+
(0, logging_1.logMessage)(environment, {
|
178
|
+
kind: 'DeepEqualityCheck',
|
179
|
+
fragmentReference: subscription.fragmentReference,
|
180
|
+
old: subscription.encounteredDataAndRecords.item,
|
181
|
+
new: newEncounteredDataAndRecords.item,
|
182
|
+
deeplyEqual: mergedItem === subscription.encounteredDataAndRecords.item,
|
183
|
+
});
|
184
|
+
if (mergedItem !== subscription.encounteredDataAndRecords.item) {
|
185
|
+
subscription.callback(newEncounteredDataAndRecords);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
return;
|
189
|
+
}
|
190
|
+
case 'AnyRecords': {
|
191
|
+
subscription.callback();
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
case 'AnyChangesToRecord': {
|
195
|
+
if ((_a = recordsEncounteredWhenNormalizing
|
196
|
+
.get(subscription.recordLink.__typename)) === null || _a === void 0 ? void 0 : _a.has(subscription.recordLink.__link)) {
|
197
|
+
subscription.callback();
|
198
|
+
}
|
199
|
+
return;
|
200
|
+
}
|
201
|
+
default: {
|
202
|
+
// Ensure we have covered all variants
|
203
|
+
const _ = subscription;
|
204
|
+
_;
|
205
|
+
throw new Error('Unexpected case');
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}));
|
209
|
+
}
|
210
|
+
function hasOverlappingIds(ids1, ids2) {
|
211
|
+
for (const [typeName, set1] of ids1.entries()) {
|
212
|
+
const set2 = ids2.get(typeName);
|
213
|
+
if (set2 === undefined) {
|
214
|
+
continue;
|
215
|
+
}
|
216
|
+
if (isNotDisjointFrom(set1, set2)) {
|
217
|
+
return true;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
return false;
|
221
|
+
}
|
222
|
+
// TODO use a polyfill library
|
223
|
+
function isNotDisjointFrom(set1, set2) {
|
224
|
+
for (const id of set1) {
|
225
|
+
if (set2.has(id)) {
|
226
|
+
return true;
|
227
|
+
}
|
228
|
+
}
|
229
|
+
return false;
|
230
|
+
}
|
231
|
+
/**
|
232
|
+
* Mutate targetParentRecord according to the normalizationAst and networkResponseParentRecord.
|
233
|
+
*/
|
234
|
+
function normalizeDataIntoRecord(environment, normalizationAst, networkResponseParentRecord, targetParentRecord, targetParentRecordLink, variables, nestedRefetchQueries, mutableEncounteredIds) {
|
235
|
+
let recordHasBeenUpdated = false;
|
236
|
+
for (const normalizationNode of normalizationAst) {
|
237
|
+
switch (normalizationNode.kind) {
|
238
|
+
case 'Scalar': {
|
239
|
+
const scalarFieldResultedInChange = normalizeScalarField(normalizationNode, networkResponseParentRecord, targetParentRecord, variables);
|
240
|
+
recordHasBeenUpdated =
|
241
|
+
recordHasBeenUpdated || scalarFieldResultedInChange;
|
242
|
+
break;
|
243
|
+
}
|
244
|
+
case 'Linked': {
|
245
|
+
const linkedFieldResultedInChange = normalizeLinkedField(environment, normalizationNode, networkResponseParentRecord, targetParentRecord, targetParentRecordLink, variables, nestedRefetchQueries, mutableEncounteredIds);
|
246
|
+
recordHasBeenUpdated =
|
247
|
+
recordHasBeenUpdated || linkedFieldResultedInChange;
|
248
|
+
break;
|
249
|
+
}
|
250
|
+
case 'InlineFragment': {
|
251
|
+
const inlineFragmentResultedInChange = normalizeInlineFragment(environment, normalizationNode, networkResponseParentRecord, targetParentRecord, targetParentRecordLink, variables, nestedRefetchQueries, mutableEncounteredIds);
|
252
|
+
recordHasBeenUpdated =
|
253
|
+
recordHasBeenUpdated || inlineFragmentResultedInChange;
|
254
|
+
break;
|
255
|
+
}
|
256
|
+
default: {
|
257
|
+
// Ensure we have covered all variants
|
258
|
+
let _ = normalizationNode;
|
259
|
+
_;
|
260
|
+
throw new Error('Unexpected normalization node kind');
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
if (recordHasBeenUpdated) {
|
265
|
+
let encounteredRecordsIds = insertIfNotExists(mutableEncounteredIds, targetParentRecordLink.__typename);
|
266
|
+
encounteredRecordsIds.add(targetParentRecordLink.__link);
|
267
|
+
}
|
268
|
+
return recordHasBeenUpdated;
|
269
|
+
}
|
270
|
+
function insertIfNotExists(map, key) {
|
271
|
+
let result = map.get(key);
|
272
|
+
if (result === undefined) {
|
273
|
+
result = new Set();
|
274
|
+
map.set(key, result);
|
275
|
+
}
|
276
|
+
return result;
|
277
|
+
}
|
278
|
+
function normalizeScalarField(astNode, networkResponseParentRecord, targetStoreRecord, variables) {
|
279
|
+
const networkResponseKey = getNetworkResponseKey(astNode);
|
280
|
+
const networkResponseData = networkResponseParentRecord[networkResponseKey];
|
281
|
+
const parentRecordKey = getParentRecordKey(astNode, variables);
|
282
|
+
if (networkResponseData == null ||
|
283
|
+
isScalarOrEmptyArray(networkResponseData)) {
|
284
|
+
const existingValue = targetStoreRecord[parentRecordKey];
|
285
|
+
targetStoreRecord[parentRecordKey] = networkResponseData;
|
286
|
+
return existingValue !== networkResponseData;
|
287
|
+
}
|
288
|
+
else {
|
289
|
+
throw new Error('Unexpected object array when normalizing scalar');
|
290
|
+
}
|
291
|
+
}
|
292
|
+
/**
|
293
|
+
* Mutate targetParentRecord with a given linked field ast node.
|
294
|
+
*/
|
295
|
+
function normalizeLinkedField(environment, astNode, networkResponseParentRecord, targetParentRecord, targetParentRecordLink, variables, nestedRefetchQueries, mutableEncounteredIds) {
|
296
|
+
var _a, _b;
|
297
|
+
const networkResponseKey = getNetworkResponseKey(astNode);
|
298
|
+
const networkResponseData = networkResponseParentRecord[networkResponseKey];
|
299
|
+
const parentRecordKey = getParentRecordKey(astNode, variables);
|
300
|
+
const existingValue = targetParentRecord[parentRecordKey];
|
301
|
+
if (networkResponseData == null) {
|
302
|
+
targetParentRecord[parentRecordKey] = null;
|
303
|
+
return existingValue !== null;
|
304
|
+
}
|
305
|
+
if (isScalarOrEmptyArray(networkResponseData) &&
|
306
|
+
!isNullOrEmptyArray(networkResponseData)) {
|
307
|
+
throw new Error('Unexpected scalar network response when normalizing a linked field');
|
308
|
+
}
|
309
|
+
if (Array.isArray(networkResponseData)) {
|
310
|
+
// TODO check astNode.plural or the like
|
311
|
+
const dataIds = [];
|
312
|
+
for (let i = 0; i < networkResponseData.length; i++) {
|
313
|
+
const networkResponseObject = networkResponseData[i];
|
314
|
+
if (networkResponseObject == null) {
|
315
|
+
dataIds.push(null);
|
316
|
+
continue;
|
317
|
+
}
|
318
|
+
const newStoreRecordId = normalizeNetworkResponseObject(environment, astNode, networkResponseObject, targetParentRecordLink, variables, i, nestedRefetchQueries, mutableEncounteredIds);
|
319
|
+
const __typename = (_a = astNode.concreteType) !== null && _a !== void 0 ? _a : networkResponseObject[exports.TYPENAME_FIELD_NAME];
|
320
|
+
if (__typename == null) {
|
321
|
+
throw new Error('Unexpected missing __typename in network response when normalizing a linked field. ' +
|
322
|
+
'This is indicative of a bug in Isograph.');
|
323
|
+
}
|
324
|
+
dataIds.push({
|
325
|
+
__link: newStoreRecordId,
|
326
|
+
__typename,
|
327
|
+
});
|
328
|
+
}
|
329
|
+
targetParentRecord[parentRecordKey] = dataIds;
|
330
|
+
return !dataIdsAreTheSame(existingValue, dataIds);
|
331
|
+
}
|
332
|
+
else {
|
333
|
+
const newStoreRecordId = normalizeNetworkResponseObject(environment, astNode, networkResponseData, targetParentRecordLink, variables, null, nestedRefetchQueries, mutableEncounteredIds);
|
334
|
+
let __typename = (_b = astNode.concreteType) !== null && _b !== void 0 ? _b : networkResponseData[exports.TYPENAME_FIELD_NAME];
|
335
|
+
if (__typename == null) {
|
336
|
+
throw new Error('Unexpected missing __typename in network response when normalizing a linked field. ' +
|
337
|
+
'This is indicative of a bug in Isograph.');
|
338
|
+
}
|
339
|
+
targetParentRecord[parentRecordKey] = {
|
340
|
+
__link: newStoreRecordId,
|
341
|
+
__typename,
|
342
|
+
};
|
343
|
+
const link = (0, IsographEnvironment_1.getLink)(existingValue);
|
344
|
+
return (link === null || link === void 0 ? void 0 : link.__link) !== newStoreRecordId || link.__typename !== __typename;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
/**
|
348
|
+
* Mutate targetParentRecord with a given linked field ast node.
|
349
|
+
*/
|
350
|
+
function normalizeInlineFragment(environment, astNode, networkResponseParentRecord, targetParentRecord, targetParentRecordLink, variables, nestedRefetchQueries, mutableEncounteredIds) {
|
351
|
+
const typeToRefineTo = astNode.type;
|
352
|
+
if (networkResponseParentRecord[exports.TYPENAME_FIELD_NAME] === typeToRefineTo) {
|
353
|
+
const hasBeenModified = normalizeDataIntoRecord(environment, astNode.selections, networkResponseParentRecord, targetParentRecord, targetParentRecordLink, variables, nestedRefetchQueries, mutableEncounteredIds);
|
354
|
+
return hasBeenModified;
|
355
|
+
}
|
356
|
+
return false;
|
357
|
+
}
|
358
|
+
function dataIdsAreTheSame(existingValue, newDataIds) {
|
359
|
+
var _a, _b;
|
360
|
+
if (Array.isArray(existingValue)) {
|
361
|
+
if (newDataIds.length !== existingValue.length) {
|
362
|
+
return false;
|
363
|
+
}
|
364
|
+
for (let i = 0; i < newDataIds.length; i++) {
|
365
|
+
const maybeLink = (0, IsographEnvironment_1.getLink)(existingValue[i]);
|
366
|
+
if (((_a = newDataIds[i]) === null || _a === void 0 ? void 0 : _a.__link) !== (maybeLink === null || maybeLink === void 0 ? void 0 : maybeLink.__link) ||
|
367
|
+
((_b = newDataIds[i]) === null || _b === void 0 ? void 0 : _b.__typename) !== (maybeLink === null || maybeLink === void 0 ? void 0 : maybeLink.__typename)) {
|
368
|
+
return false;
|
369
|
+
}
|
370
|
+
}
|
371
|
+
return true;
|
372
|
+
}
|
373
|
+
else {
|
374
|
+
return false;
|
375
|
+
}
|
376
|
+
}
|
377
|
+
function normalizeNetworkResponseObject(environment, astNode, networkResponseData, targetParentRecordLink, variables, index, nestedRefetchQueries, mutableEncounteredIds) {
|
378
|
+
var _a, _b, _c;
|
379
|
+
var _d;
|
380
|
+
const newStoreRecordId = getDataIdOfNetworkResponse(targetParentRecordLink, networkResponseData, astNode, variables, index);
|
381
|
+
const __typename = (_a = astNode.concreteType) !== null && _a !== void 0 ? _a : networkResponseData[exports.TYPENAME_FIELD_NAME];
|
382
|
+
if (__typename == null) {
|
383
|
+
throw new Error('Unexpected missing __typename in network response object. ' +
|
384
|
+
'This is indicative of a bug in Isograph.');
|
385
|
+
}
|
386
|
+
const recordsById = ((_b = (_d = environment.store)[__typename]) !== null && _b !== void 0 ? _b : (_d[__typename] = {}));
|
387
|
+
const newStoreRecord = ((_c = recordsById[newStoreRecordId]) !== null && _c !== void 0 ? _c : (recordsById[newStoreRecordId] = {}));
|
388
|
+
normalizeDataIntoRecord(environment, astNode.selections, networkResponseData, newStoreRecord, { __link: newStoreRecordId, __typename: __typename }, variables, nestedRefetchQueries, mutableEncounteredIds);
|
389
|
+
return newStoreRecordId;
|
390
|
+
}
|
391
|
+
function isScalarOrEmptyArray(data) {
|
392
|
+
// N.B. empty arrays count as empty arrays of scalar fields.
|
393
|
+
if (Array.isArray(data)) {
|
394
|
+
// This is maybe fixed in a new version of Typescript??
|
395
|
+
return data.every((x) => isScalarOrEmptyArray(x));
|
396
|
+
}
|
397
|
+
const isScalarValue = data === null ||
|
398
|
+
typeof data === 'string' ||
|
399
|
+
typeof data === 'number' ||
|
400
|
+
typeof data === 'boolean';
|
401
|
+
return isScalarValue;
|
402
|
+
}
|
403
|
+
function isNullOrEmptyArray(data) {
|
404
|
+
if (Array.isArray(data)) {
|
405
|
+
if (data.length === 0) {
|
406
|
+
return true;
|
407
|
+
}
|
408
|
+
return data.every((x) => isNullOrEmptyArray(x));
|
409
|
+
}
|
410
|
+
return data === null;
|
411
|
+
}
|
412
|
+
function getParentRecordKey(astNode, variables) {
|
413
|
+
let parentRecordKey = astNode.fieldName;
|
414
|
+
const fieldParameters = astNode.arguments;
|
415
|
+
if (fieldParameters != null) {
|
416
|
+
for (const fieldParameter of fieldParameters) {
|
417
|
+
parentRecordKey += getStoreKeyChunkForArgument(fieldParameter, variables);
|
418
|
+
}
|
419
|
+
}
|
420
|
+
return parentRecordKey;
|
421
|
+
}
|
422
|
+
function getStoreKeyChunkForArgumentValue(argumentValue, variables) {
|
423
|
+
var _a;
|
424
|
+
switch (argumentValue.kind) {
|
425
|
+
case 'Literal': {
|
426
|
+
return argumentValue.value;
|
427
|
+
}
|
428
|
+
case 'Variable': {
|
429
|
+
return (_a = variables[argumentValue.name]) !== null && _a !== void 0 ? _a : 'null';
|
430
|
+
}
|
431
|
+
case 'String': {
|
432
|
+
return argumentValue.value;
|
433
|
+
}
|
434
|
+
case 'Enum': {
|
435
|
+
return argumentValue.value;
|
436
|
+
}
|
437
|
+
default: {
|
438
|
+
// TODO configure eslint to allow unused vars starting with _
|
439
|
+
// Ensure we have covered all variants
|
440
|
+
const _ = argumentValue;
|
441
|
+
_;
|
442
|
+
throw new Error('Unexpected case');
|
443
|
+
}
|
444
|
+
}
|
445
|
+
}
|
446
|
+
function getStoreKeyChunkForArgument(argument, variables) {
|
447
|
+
const chunk = getStoreKeyChunkForArgumentValue(argument[1], variables);
|
448
|
+
return `${exports.FIRST_SPLIT_KEY}${argument[0]}${exports.SECOND_SPLIT_KEY}${chunk}`;
|
449
|
+
}
|
450
|
+
function getNetworkResponseKey(astNode) {
|
451
|
+
let networkResponseKey = astNode.fieldName;
|
452
|
+
const fieldParameters = astNode.arguments;
|
453
|
+
if (fieldParameters != null) {
|
454
|
+
for (const fieldParameter of fieldParameters) {
|
455
|
+
const [argumentName, argumentValue] = fieldParameter;
|
456
|
+
let argumentValueChunk;
|
457
|
+
switch (argumentValue.kind) {
|
458
|
+
case 'Literal': {
|
459
|
+
argumentValueChunk = 'l_' + argumentValue.value;
|
460
|
+
break;
|
461
|
+
}
|
462
|
+
case 'Variable': {
|
463
|
+
argumentValueChunk = 'v_' + argumentValue.name;
|
464
|
+
break;
|
465
|
+
}
|
466
|
+
case 'String': {
|
467
|
+
argumentValueChunk = 's_' + argumentValue.value;
|
468
|
+
break;
|
469
|
+
}
|
470
|
+
case 'Enum': {
|
471
|
+
argumentValueChunk = 'e_' + argumentValue.value;
|
472
|
+
break;
|
473
|
+
}
|
474
|
+
default: {
|
475
|
+
// Ensure we have covered all variants
|
476
|
+
let _ = argumentValue;
|
477
|
+
_;
|
478
|
+
throw new Error('Unexpected case');
|
479
|
+
}
|
480
|
+
}
|
481
|
+
networkResponseKey += `${exports.FIRST_SPLIT_KEY}${argumentName}${exports.SECOND_SPLIT_KEY}${argumentValueChunk}`;
|
482
|
+
}
|
483
|
+
}
|
484
|
+
return networkResponseKey;
|
485
|
+
}
|
486
|
+
// an alias might be pullRequests____first___first____after___cursor
|
487
|
+
exports.FIRST_SPLIT_KEY = '____';
|
488
|
+
exports.SECOND_SPLIT_KEY = '___';
|
489
|
+
// Returns a key to look up an item in the store
|
490
|
+
function getDataIdOfNetworkResponse(parentRecordLink, dataToNormalize, astNode, variables, index) {
|
491
|
+
// If we are dealing with nested Query, use __ROOT as id
|
492
|
+
// TODO do not hard code this value here
|
493
|
+
if (astNode.concreteType === 'Query') {
|
494
|
+
return IsographEnvironment_1.ROOT_ID;
|
495
|
+
}
|
496
|
+
// Check whether the dataToNormalize has an id field. If so, that is the key.
|
497
|
+
// If not, we construct an id from the parentRecordId and the field parameters.
|
498
|
+
const dataId = dataToNormalize.id;
|
499
|
+
if (dataId != null) {
|
500
|
+
return dataId;
|
501
|
+
}
|
502
|
+
let storeKey = `${parentRecordLink.__typename}:${parentRecordLink.__link}.${astNode.fieldName}`;
|
503
|
+
if (index != null) {
|
504
|
+
storeKey += `.${index}`;
|
505
|
+
}
|
506
|
+
const fieldParameters = astNode.arguments;
|
507
|
+
if (fieldParameters == null) {
|
508
|
+
return storeKey;
|
509
|
+
}
|
510
|
+
for (const fieldParameter of fieldParameters) {
|
511
|
+
storeKey += getStoreKeyChunkForArgument(fieldParameter, variables);
|
512
|
+
}
|
513
|
+
return storeKey;
|
514
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { NormalizationAst } from './entrypoint';
|
2
|
+
import { Variables } from './FragmentReference';
|
3
|
+
import { IsographEnvironment, Link } from './IsographEnvironment';
|
4
|
+
export type ShouldFetch = 'Yes' | 'No' | 'IfNecessary';
|
5
|
+
export declare const DEFAULT_SHOULD_FETCH_VALUE: ShouldFetch;
|
6
|
+
export type FetchOptions = {
|
7
|
+
shouldFetch?: ShouldFetch;
|
8
|
+
onComplete?: () => void;
|
9
|
+
onError?: () => void;
|
10
|
+
};
|
11
|
+
export type CheckResult = {
|
12
|
+
kind: 'EnoughData';
|
13
|
+
} | {
|
14
|
+
kind: 'MissingData';
|
15
|
+
record: Link;
|
16
|
+
};
|
17
|
+
export declare function check(environment: IsographEnvironment, normalizationAst: NormalizationAst, variables: Variables, root: Link): CheckResult;
|
18
|
+
//# sourceMappingURL=check.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/core/check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAEL,mBAAmB,EACnB,IAAI,EAEL,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,IAAI,GAAG,aAAa,CAAC;AAEvD,eAAO,MAAM,0BAA0B,EAAE,WAA2B,CAAC;AAErE,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB;IACE,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,IAAI,CAAC;CACd,CAAC;AAEN,wBAAgB,KAAK,CACnB,WAAW,EAAE,mBAAmB,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,GACT,WAAW,CAgBb"}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.DEFAULT_SHOULD_FETCH_VALUE = void 0;
|
4
|
+
exports.check = check;
|
5
|
+
const cache_1 = require("./cache");
|
6
|
+
const IsographEnvironment_1 = require("./IsographEnvironment");
|
7
|
+
const logging_1 = require("./logging");
|
8
|
+
exports.DEFAULT_SHOULD_FETCH_VALUE = 'IfNecessary';
|
9
|
+
function check(environment, normalizationAst, variables, root) {
|
10
|
+
var _a, _b;
|
11
|
+
var _c, _d, _e;
|
12
|
+
const recordsById = ((_a = (_c = environment.store)[_d = root.__typename]) !== null && _a !== void 0 ? _a : (_c[_d] = {}));
|
13
|
+
const newStoreRecord = ((_b = recordsById[_e = root.__link]) !== null && _b !== void 0 ? _b : (recordsById[_e] = {}));
|
14
|
+
const checkResult = checkFromRecord(environment, normalizationAst, variables, newStoreRecord, root);
|
15
|
+
(0, logging_1.logMessage)(environment, {
|
16
|
+
kind: 'EnvironmentCheck',
|
17
|
+
result: checkResult,
|
18
|
+
});
|
19
|
+
return checkResult;
|
20
|
+
}
|
21
|
+
function checkFromRecord(environment, normalizationAst, variables, record, recordLink) {
|
22
|
+
var _a, _b;
|
23
|
+
normalizationAstLoop: for (const normalizationAstNode of normalizationAst) {
|
24
|
+
switch (normalizationAstNode.kind) {
|
25
|
+
case 'Scalar': {
|
26
|
+
const parentRecordKey = (0, cache_1.getParentRecordKey)(normalizationAstNode, variables);
|
27
|
+
const scalarValue = record[parentRecordKey];
|
28
|
+
// null means the value is known to be missing, so it must
|
29
|
+
// be exactly undefined
|
30
|
+
if (scalarValue === undefined) {
|
31
|
+
return {
|
32
|
+
kind: 'MissingData',
|
33
|
+
record: recordLink,
|
34
|
+
};
|
35
|
+
}
|
36
|
+
continue normalizationAstLoop;
|
37
|
+
}
|
38
|
+
case 'Linked': {
|
39
|
+
const parentRecordKey = (0, cache_1.getParentRecordKey)(normalizationAstNode, variables);
|
40
|
+
const linkedValue = record[parentRecordKey];
|
41
|
+
if (linkedValue === undefined) {
|
42
|
+
return {
|
43
|
+
kind: 'MissingData',
|
44
|
+
record: recordLink,
|
45
|
+
};
|
46
|
+
}
|
47
|
+
else if (linkedValue === null) {
|
48
|
+
continue;
|
49
|
+
}
|
50
|
+
else if (Array.isArray(linkedValue)) {
|
51
|
+
arrayItemsLoop: for (const item of linkedValue) {
|
52
|
+
const link = (0, IsographEnvironment_1.getLink)(item);
|
53
|
+
if (link === null) {
|
54
|
+
throw new Error('Unexpected non-link in the Isograph store. ' +
|
55
|
+
'This is indicative of a bug in Isograph.');
|
56
|
+
}
|
57
|
+
const linkedRecord = (_a = environment.store[link.__typename]) === null || _a === void 0 ? void 0 : _a[link.__link];
|
58
|
+
if (linkedRecord === undefined) {
|
59
|
+
return {
|
60
|
+
kind: 'MissingData',
|
61
|
+
record: link,
|
62
|
+
};
|
63
|
+
}
|
64
|
+
else if (linkedRecord === null) {
|
65
|
+
continue arrayItemsLoop;
|
66
|
+
}
|
67
|
+
else {
|
68
|
+
// TODO in __DEV__ assert linkedRecord is an object
|
69
|
+
const result = checkFromRecord(environment, normalizationAstNode.selections, variables, linkedRecord, link);
|
70
|
+
if (result.kind === 'MissingData') {
|
71
|
+
return result;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
const link = (0, IsographEnvironment_1.getLink)(linkedValue);
|
78
|
+
if (link === null) {
|
79
|
+
throw new Error('Unexpected non-link in the Isograph store. ' +
|
80
|
+
'This is indicative of a bug in Isograph.');
|
81
|
+
}
|
82
|
+
const linkedRecord = (_b = environment.store[link.__typename]) === null || _b === void 0 ? void 0 : _b[link.__link];
|
83
|
+
if (linkedRecord === undefined) {
|
84
|
+
return {
|
85
|
+
kind: 'MissingData',
|
86
|
+
record: link,
|
87
|
+
};
|
88
|
+
}
|
89
|
+
else if (linkedRecord === null) {
|
90
|
+
continue normalizationAstLoop;
|
91
|
+
}
|
92
|
+
else {
|
93
|
+
// TODO in __DEV__ assert linkedRecord is an object
|
94
|
+
const result = checkFromRecord(environment, normalizationAstNode.selections, variables, linkedRecord, link);
|
95
|
+
if (result.kind === 'MissingData') {
|
96
|
+
return result;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
continue normalizationAstLoop;
|
101
|
+
}
|
102
|
+
case 'InlineFragment': {
|
103
|
+
const existingRecordTypename = record['__typename'];
|
104
|
+
if (existingRecordTypename == null ||
|
105
|
+
existingRecordTypename !== normalizationAstNode.type) {
|
106
|
+
return {
|
107
|
+
kind: 'MissingData',
|
108
|
+
record: recordLink,
|
109
|
+
};
|
110
|
+
}
|
111
|
+
const result = checkFromRecord(environment, normalizationAstNode.selections, variables, record, recordLink);
|
112
|
+
if (result.kind === 'MissingData') {
|
113
|
+
return result;
|
114
|
+
}
|
115
|
+
continue normalizationAstLoop;
|
116
|
+
}
|
117
|
+
default: {
|
118
|
+
let _ = normalizationAstNode;
|
119
|
+
_;
|
120
|
+
throw new Error('Unexpected case. This is indicative of a bug in Isograph.');
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
return {
|
125
|
+
kind: 'EnoughData',
|
126
|
+
};
|
127
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { IsographEnvironment } from './IsographEnvironment';
|
2
|
+
import { FragmentReference } from './FragmentReference';
|
3
|
+
import { NetworkRequestReaderOptions } from './read';
|
4
|
+
export declare function getOrCreateCachedComponent(environment: IsographEnvironment, componentName: string, fragmentReference: FragmentReference<any, any>, networkRequestOptions: NetworkRequestReaderOptions): React.FC<any>;
|
5
|
+
//# sourceMappingURL=componentCache.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"componentCache.d.ts","sourceRoot":"","sources":["../../src/core/componentCache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAIrD,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,mBAAmB,EAChC,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,EAC9C,qBAAqB,EAAE,2BAA2B,GACjD,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAgDf"}
|