···22import { it, expect } from 'vitest';
33import { __initAnd_query as query } from '../operations/query';
44import { __initAnd_write as write } from '../operations/write';
55-import { Store } from '../store';
55+import { Store } from '../store/store';
66import { relayPagination } from './relayPagination';
7788function itemNode(numItem: number) {
···22import { it, expect } from 'vitest';
33import { __initAnd_query as query } from '../operations/query';
44import { __initAnd_write as write } from '../operations/write';
55-import { Store } from '../store';
55+import { Store } from '../store/store';
66import { simplePagination } from './simplePagination';
7788it('works with forward pagination', () => {
+1-1
exchanges/graphcache/src/index.ts
···11export * from './types';
22-export type { Store } from './store';
22+export { Store } from './store/store';
33export { cacheExchange } from './cacheExchange';
44export { offlineExchange } from './offlineExchange';
+1-1
exchanges/graphcache/src/operations/invalidate.ts
···11import * as InMemoryData from '../store/data';
22+import { keyOfField } from '../store/keys';
23import { FieldArgs } from '../types';
33-import { keyOfField } from '../store';
4455interface PartialFieldInfo {
66 fieldKey: string;
+1-1
exchanges/graphcache/src/operations/query.test.ts
···44import { minifyIntrospectionQuery } from '@urql/introspection';
55import { describe, it, beforeEach, beforeAll, expect } from 'vitest';
6677-import { Store } from '../store';
77+import { Store } from '../store/store';
88import { __initAnd_write as write } from './write';
99import { __initAnd_query as query } from './query';
1010
+34-29
exchanges/graphcache/src/operations/query.ts
···2727 Dependencies,
2828} from '../types';
29293030-import {
3131- Store,
3232- getCurrentOperation,
3333- getCurrentDependencies,
3434- initDataState,
3535- clearDataState,
3636- joinKeys,
3737- keyOfField,
3838- makeData,
3939- ownsData,
4040-} from '../store';
4141-3030+import { joinKeys, keyOfField } from '../store/keys';
3131+import { Store } from '../store/store';
4232import * as InMemoryData from '../store/data';
4333import { warn, pushDebugNode, popDebugNode } from '../helpers/help';
4434···7565 error?: CombinedError | undefined,
7666 key?: number
7767): QueryResult => {
7878- initDataState('read', store.data, key);
6868+ InMemoryData.initDataState('read', store.data, key);
7969 const result = _query(store, request, data, error);
8080- clearDataState();
7070+ InMemoryData.clearDataState();
8171 return result;
8272};
8373···10090 getFragments(request.query),
10191 rootKey,
10292 rootKey,
103103- false,
10493 error
10594 );
10695···114103 // scratch
115104 const data =
116105 rootKey !== ctx.store.rootFields['query']
117117- ? readRoot(ctx, rootKey, rootSelect, input || makeData())
118118- : readSelection(ctx, rootKey, rootSelect, input || makeData());
106106+ ? readRoot(ctx, rootKey, rootSelect, input || InMemoryData.makeData())
107107+ : readSelection(
108108+ ctx,
109109+ rootKey,
110110+ rootSelect,
111111+ input || InMemoryData.makeData()
112112+ );
119113120114 if (process.env.NODE_ENV !== 'production') {
121115 popDebugNode();
116116+ InMemoryData.getCurrentDependencies();
122117 }
123118124119 return {
125125- dependencies: getCurrentDependencies(),
120120+ dependencies: InMemoryData.currentDependencies!,
126121 partial: ctx.partial || !data,
127122 hasNext: ctx.hasNext,
128123 data: data || null,
···146141147142 let node: FieldNode | void;
148143 let hasChanged = InMemoryData.currentForeignData;
149149- const output = makeData(input);
144144+ const output = InMemoryData.makeData(input);
150145 while ((node = iterate())) {
151146 const fieldAlias = getFieldAlias(node);
152147 const fieldValue = input[fieldAlias];
···274269 variables || {},
275270 fragments,
276271 typename,
277277- entityKey
272272+ entityKey,
273273+ undefined
278274 );
279275280276 const result =
281281- readSelection(ctx, entityKey, getSelectionSet(fragment), makeData()) ||
282282- null;
277277+ readSelection(
278278+ ctx,
279279+ entityKey,
280280+ getSelectionSet(fragment),
281281+ InMemoryData.makeData()
282282+ ) || null;
283283284284 if (process.env.NODE_ENV !== 'production') {
285285 popDebugNode();
···341341 let hasNext = false;
342342 let hasChanged = InMemoryData.currentForeignData;
343343 let node: FieldNode | void;
344344- const output = makeData(input);
344344+ const output = InMemoryData.makeData(input);
345345 while ((node = iterate()) !== undefined) {
346346 // Derive the needed data from our node.
347347 const fieldName = getName(node);
···369369 // The field is a scalar and can be retrieved directly from the result
370370 dataFieldValue = resultValue;
371371 } else if (
372372- getCurrentOperation() === 'read' &&
372372+ InMemoryData.currentOperation === 'read' &&
373373 resolvers &&
374374 resolvers[fieldName]
375375 ) {
···403403 ? output[fieldAlias]
404404 : input[fieldAlias]) as Data,
405405 dataFieldValue,
406406- ownsData(input)
406406+ InMemoryData.ownsData(input)
407407 );
408408 }
409409···431431 ? output[fieldAlias]
432432 : input[fieldAlias]) as Data,
433433 resultValue,
434434- ownsData(input)
434434+ InMemoryData.ownsData(input)
435435 );
436436 } else {
437437 // Otherwise we attempt to get the missing field from the cache
···447447 (output[fieldAlias] !== undefined
448448 ? output[fieldAlias]
449449 : input[fieldAlias]) as Data,
450450- ownsData(input)
450450+ InMemoryData.ownsData(input)
451451 );
452452 } else if (typeof fieldValue === 'object' && fieldValue !== null) {
453453 // The entity on the field was invalid but can still be recovered
···549549 } else if (!isOwnedData && prevData === null) {
550550 return null;
551551 } else if (isDataOrKey(result)) {
552552- const data = (prevData || makeData()) as Data;
552552+ const data = (prevData || InMemoryData.makeData()) as Data;
553553 return typeof result === 'string'
554554 ? readSelection(ctx, result, select, data)
555555 : readSelection(ctx, key, select, data, result);
···616616 return null;
617617 }
618618619619- return readSelection(ctx, link, select, (prevData || makeData()) as Data);
619619+ return readSelection(
620620+ ctx,
621621+ link,
622622+ select,
623623+ (prevData || InMemoryData.makeData()) as Data
624624+ );
620625};
621626622627const isDataOrKey = (x: any): x is string | Data =>
···6677import { __initAnd_write as write } from './write';
88import * as InMemoryData from '../store/data';
99-import { Store } from '../store';
99+import { Store } from '../store/store';
10101111const TODO_QUERY = gql`
1212 query todos {
···66 __initAnd_writeOptimistic as writeOptimistic,
77} from '../operations/write';
88import * as InMemoryData from '../store/data';
99-import { Store } from '../store';
99+import { Store } from '../store/store';
1010import { Data } from '../types';
11111212const Todos = gql`
···22import { it, afterEach, expect } from 'vitest';
33import { __initAnd_query as query } from '../operations/query';
44import { __initAnd_write as write } from '../operations/write';
55-import { Store } from '../store';
55+import { Store } from '../store/store';
6677const Item = gql`
88 {
···22import { it, afterEach, expect } from 'vitest';
33import { __initAnd_query as query } from '../operations/query';
44import { __initAnd_write as write } from '../operations/write';
55-import { Store } from '../store';
55+import { Store } from '../store/store';
6677afterEach(() => {
88 expect(console.warn).not.toHaveBeenCalled();
+1-1
exchanges/graphcache/src/test-utils/suite.test.ts
···33import { it, expect } from 'vitest';
44import { __initAnd_query as query } from '../operations/query';
55import { __initAnd_write as write } from '../operations/write';
66-import { Store } from '../store';
66+import { Store } from '../store/store';
7788interface TestCase {
99 query: DocumentNode;