@isograph/react 0.0.0-main-03306d26 → 0.0.0-main-e7d6b095

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.
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stableIdForFragmentReference = void 0;
3
+ exports.stableIdForFragmentReference = stableIdForFragmentReference;
4
4
  function stableIdForFragmentReference(fragmentReference) {
5
5
  var _a;
6
6
  return `${fragmentReference.root}/TODO_FRAGMENT_NAME/${serializeVariables((_a = fragmentReference.variables) !== null && _a !== void 0 ? _a : {})}`;
7
7
  }
8
- exports.stableIdForFragmentReference = stableIdForFragmentReference;
9
8
  function serializeVariables(variables) {
10
9
  let s = '';
11
10
  const keys = Object.keys(variables);
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ParentCache } from '@isograph/react-disposable-state';
3
2
  import { RetainedQuery } from './garbageCollection';
4
3
  import { WithEncounteredRecords } from './read';
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOrLoadIsographArtifact = exports.getLink = exports.assertLink = exports.defaultMissingFieldHandler = exports.createIsographStore = exports.createIsographEnvironment = exports.ROOT_ID = void 0;
3
+ exports.ROOT_ID = void 0;
4
+ exports.createIsographEnvironment = createIsographEnvironment;
5
+ exports.createIsographStore = createIsographStore;
6
+ exports.defaultMissingFieldHandler = defaultMissingFieldHandler;
7
+ exports.assertLink = assertLink;
8
+ exports.getLink = getLink;
9
+ exports.getOrLoadIsographArtifact = getOrLoadIsographArtifact;
4
10
  const PromiseWrapper_1 = require("./PromiseWrapper");
5
11
  exports.ROOT_ID = '__ROOT';
6
12
  const DEFAULT_GC_BUFFER_SIZE = 10;
@@ -18,13 +24,11 @@ function createIsographEnvironment(store, networkFunction, missingFieldHandler)
18
24
  gcBufferSize: DEFAULT_GC_BUFFER_SIZE,
19
25
  };
20
26
  }
21
- exports.createIsographEnvironment = createIsographEnvironment;
22
27
  function createIsographStore() {
23
28
  return {
24
29
  [exports.ROOT_ID]: {},
25
30
  };
26
31
  }
27
- exports.createIsographStore = createIsographStore;
28
32
  function defaultMissingFieldHandler(_storeRecord, _root, fieldName, arguments_, variables) {
29
33
  if (fieldName === 'node' || fieldName === 'user') {
30
34
  const variable = arguments_ === null || arguments_ === void 0 ? void 0 : arguments_['id'];
@@ -36,7 +40,6 @@ function defaultMissingFieldHandler(_storeRecord, _root, fieldName, arguments_,
36
40
  }
37
41
  }
38
42
  }
39
- exports.defaultMissingFieldHandler = defaultMissingFieldHandler;
40
43
  function assertLink(link) {
41
44
  if (Array.isArray(link)) {
42
45
  throw new Error('Unexpected array');
@@ -49,7 +52,6 @@ function assertLink(link) {
49
52
  }
50
53
  throw new Error('Invalid link');
51
54
  }
52
- exports.assertLink = assertLink;
53
55
  function getLink(maybeLink) {
54
56
  if (maybeLink != null &&
55
57
  typeof maybeLink === 'object' &&
@@ -59,7 +61,6 @@ function getLink(maybeLink) {
59
61
  }
60
62
  return null;
61
63
  }
62
- exports.getLink = getLink;
63
64
  function getOrLoadIsographArtifact(environment, key, loader) {
64
65
  const value = environment.entrypointArtifactCache.get(key);
65
66
  if (value != null) {
@@ -69,4 +70,3 @@ function getOrLoadIsographArtifact(environment, key, loader) {
69
70
  environment.entrypointArtifactCache.set(key, wrapped);
70
71
  return wrapped;
71
72
  }
72
- exports.getOrLoadIsographArtifact = getOrLoadIsographArtifact;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPromiseState = exports.readPromise = exports.wrapResolvedValue = exports.wrapPromise = void 0;
3
+ exports.wrapPromise = wrapPromise;
4
+ exports.wrapResolvedValue = wrapResolvedValue;
5
+ exports.readPromise = readPromise;
6
+ exports.getPromiseState = getPromiseState;
4
7
  const NOT_SET = Symbol('NOT_SET');
5
8
  function wrapPromise(promise) {
6
9
  // TODO confirm suspense works if the promise is already resolved.
@@ -16,7 +19,6 @@ function wrapPromise(promise) {
16
19
  });
17
20
  return wrapper;
18
21
  }
19
- exports.wrapPromise = wrapPromise;
20
22
  function wrapResolvedValue(value) {
21
23
  return {
22
24
  promise: Promise.resolve(value),
@@ -27,7 +29,6 @@ function wrapResolvedValue(value) {
27
29
  },
28
30
  };
29
31
  }
30
- exports.wrapResolvedValue = wrapResolvedValue;
31
32
  function readPromise(p) {
32
33
  const { result } = p;
33
34
  if (result !== NOT_SET) {
@@ -42,7 +43,6 @@ function readPromise(p) {
42
43
  }
43
44
  throw p.promise;
44
45
  }
45
- exports.readPromise = readPromise;
46
46
  function getPromiseState(p) {
47
47
  const { result } = p;
48
48
  if (result !== NOT_SET) {
@@ -55,4 +55,3 @@ function getPromiseState(p) {
55
55
  promise: p.promise,
56
56
  };
57
57
  }
58
- exports.getPromiseState = getPromiseState;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeObjectsUsingReaderAst = exports.mergeArraysUsingReaderAst = exports.mergeUsingReaderAst = void 0;
3
+ exports.mergeUsingReaderAst = mergeUsingReaderAst;
4
+ exports.mergeArraysUsingReaderAst = mergeArraysUsingReaderAst;
5
+ exports.mergeObjectsUsingReaderAst = mergeObjectsUsingReaderAst;
4
6
  function mergeUsingReaderAst(field, oldItem, newItem) {
5
7
  if (newItem === null) {
6
8
  return oldItem === null ? oldItem : newItem;
@@ -30,7 +32,6 @@ function mergeUsingReaderAst(field, oldItem, newItem) {
30
32
  }
31
33
  }
32
34
  }
33
- exports.mergeUsingReaderAst = mergeUsingReaderAst;
34
35
  function mergeArraysUsingReaderAst(field, oldItems, newItems) {
35
36
  if (newItems.length !== oldItems.length) {
36
37
  return newItems;
@@ -47,7 +48,6 @@ function mergeArraysUsingReaderAst(field, oldItems, newItems) {
47
48
  }
48
49
  return canRecycle ? oldItems : newItems;
49
50
  }
50
- exports.mergeArraysUsingReaderAst = mergeArraysUsingReaderAst;
51
51
  function mergeObjectsUsingReaderAst(ast, oldItemObject, newItemObject) {
52
52
  var _a;
53
53
  let canRecycle = true;
@@ -93,4 +93,3 @@ function mergeObjectsUsingReaderAst(ast, oldItemObject, newItemObject) {
93
93
  }
94
94
  return canRecycle ? oldItemObject : newItemObject;
95
95
  }
96
- exports.mergeObjectsUsingReaderAst = mergeObjectsUsingReaderAst;
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SECOND_SPLIT_KEY = exports.FIRST_SPLIT_KEY = exports.getParentRecordKey = exports.onNextChangeToRecord = exports.subscribe = exports.subscribeToAnyChangesToRecord = exports.subscribeToAnyChange = exports.normalizeData = exports.getOrCreateCacheForArtifact = exports.stableCopy = exports.getOrCreateItemInSuspenseCache = void 0;
3
+ exports.SECOND_SPLIT_KEY = exports.FIRST_SPLIT_KEY = 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.getParentRecordKey = getParentRecordKey;
4
13
  const react_disposable_state_1 = require("@isograph/react-disposable-state");
5
14
  const IsographEnvironment_1 = require("./IsographEnvironment");
6
15
  const read_1 = require("./read");
@@ -22,7 +31,6 @@ function getOrCreateItemInSuspenseCache(environment, index, factory) {
22
31
  }
23
32
  return environment.fragmentCache[index];
24
33
  }
25
- exports.getOrCreateItemInSuspenseCache = getOrCreateItemInSuspenseCache;
26
34
  /**
27
35
  * Creates a copy of the provided value, ensuring any nested objects have their
28
36
  * keys sorted such that equivalent values would have identical JSON.stringify
@@ -44,7 +52,6 @@ function stableCopy(value) {
44
52
  }
45
53
  return stable;
46
54
  }
47
- exports.stableCopy = stableCopy;
48
55
  function getOrCreateCacheForArtifact(environment, entrypoint, variables) {
49
56
  const cacheKey = entrypoint.queryText + JSON.stringify(stableCopy(variables));
50
57
  const factory = () => {
@@ -67,7 +74,6 @@ function getOrCreateCacheForArtifact(environment, entrypoint, variables) {
67
74
  };
68
75
  return getOrCreateItemInSuspenseCache(environment, cacheKey, factory);
69
76
  }
70
- exports.getOrCreateCacheForArtifact = getOrCreateCacheForArtifact;
71
77
  function normalizeData(environment, normalizationAst, networkResponse, variables, nestedRefetchQueries) {
72
78
  const encounteredIds = new Set();
73
79
  // @ts-expect-error
@@ -86,7 +92,6 @@ function normalizeData(environment, normalizationAst, networkResponse, variables
86
92
  callSubscriptions(environment, encounteredIds);
87
93
  return encounteredIds;
88
94
  }
89
- exports.normalizeData = normalizeData;
90
95
  function subscribeToAnyChange(environment, callback) {
91
96
  const subscription = {
92
97
  kind: 'AnyRecords',
@@ -95,7 +100,6 @@ function subscribeToAnyChange(environment, callback) {
95
100
  environment.subscriptions.add(subscription);
96
101
  return () => environment.subscriptions.delete(subscription);
97
102
  }
98
- exports.subscribeToAnyChange = subscribeToAnyChange;
99
103
  function subscribeToAnyChangesToRecord(environment, recordId, callback) {
100
104
  const subscription = {
101
105
  kind: 'AnyChangesToRecord',
@@ -105,7 +109,6 @@ function subscribeToAnyChangesToRecord(environment, recordId, callback) {
105
109
  environment.subscriptions.add(subscription);
106
110
  return () => environment.subscriptions.delete(subscription);
107
111
  }
108
- exports.subscribeToAnyChangesToRecord = subscribeToAnyChangesToRecord;
109
112
  // TODO we should re-read and call callback if the value has changed
110
113
  function subscribe(environment, encounteredDataAndRecords, fragmentReference, callback, readerAst) {
111
114
  const fragmentSubscription = {
@@ -118,7 +121,6 @@ function subscribe(environment, encounteredDataAndRecords, fragmentReference, ca
118
121
  environment.subscriptions.add(fragmentSubscription);
119
122
  return () => environment.subscriptions.delete(fragmentSubscription);
120
123
  }
121
- exports.subscribe = subscribe;
122
124
  function onNextChangeToRecord(environment, recordId) {
123
125
  return new Promise((resolve) => {
124
126
  const unsubscribe = subscribeToAnyChangesToRecord(environment, recordId, () => {
@@ -127,7 +129,6 @@ function onNextChangeToRecord(environment, recordId) {
127
129
  });
128
130
  });
129
131
  }
130
- exports.onNextChangeToRecord = onNextChangeToRecord;
131
132
  // Calls to readButDoNotEvaluate can suspend (i.e. throw a promise).
132
133
  // Maybe in the future, they will be able to throw errors.
133
134
  //
@@ -377,7 +378,6 @@ function getParentRecordKey(astNode, variables) {
377
378
  }
378
379
  return parentRecordKey;
379
380
  }
380
- exports.getParentRecordKey = getParentRecordKey;
381
381
  function getStoreKeyChunkForArgumentValue(argumentValue, variables) {
382
382
  var _a;
383
383
  switch (argumentValue.kind) {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { IsographEnvironment } from './IsographEnvironment';
3
2
  import { FragmentReference } from './FragmentReference';
4
3
  import { NetworkRequestReaderOptions } from './read';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOrCreateCachedComponent = void 0;
3
+ exports.getOrCreateCachedComponent = getOrCreateCachedComponent;
4
4
  const cache_1 = require("./cache");
5
5
  const useReadAndSubscribe_1 = require("../react/useReadAndSubscribe");
6
6
  const PromiseWrapper_1 = require("./PromiseWrapper");
@@ -39,4 +39,3 @@ function getOrCreateCachedComponent(environment, componentName, fragmentReferenc
39
39
  })();
40
40
  return byArgs[stringifiedArgs];
41
41
  }
42
- exports.getOrCreateCachedComponent = getOrCreateCachedComponent;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TopLevelReaderArtifact } from './reader';
3
2
  import { Arguments } from './util';
4
3
  export type ReaderWithRefetchQueries<TReadFromStore extends {
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertIsEntrypoint = void 0;
3
+ exports.assertIsEntrypoint = assertIsEntrypoint;
4
4
  function assertIsEntrypoint(value) {
5
5
  if (typeof value === 'function')
6
6
  throw new Error('Not a string');
7
7
  }
8
- exports.assertIsEntrypoint = assertIsEntrypoint;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.garbageCollectEnvironment = exports.retainQuery = exports.unretainQuery = void 0;
3
+ exports.unretainQuery = unretainQuery;
4
+ exports.retainQuery = retainQuery;
5
+ exports.garbageCollectEnvironment = garbageCollectEnvironment;
4
6
  const IsographEnvironment_1 = require("./IsographEnvironment");
5
7
  const cache_1 = require("./cache");
6
8
  function unretainQuery(environment, retainedQuery) {
@@ -12,14 +14,12 @@ function unretainQuery(environment, retainedQuery) {
12
14
  }
13
15
  return false;
14
16
  }
15
- exports.unretainQuery = unretainQuery;
16
17
  function retainQuery(environment, queryToRetain) {
17
18
  environment.retainedQueries.add(queryToRetain);
18
19
  // TODO can we remove this query from the buffer somehow?
19
20
  // We are relying on === equality, but we really should be comparing
20
21
  // id + variables
21
22
  }
22
- exports.retainQuery = retainQuery;
23
23
  function garbageCollectEnvironment(environment) {
24
24
  const retainedIds = new Set([IsographEnvironment_1.ROOT_ID]);
25
25
  for (const query of environment.retainedQueries) {
@@ -34,7 +34,6 @@ function garbageCollectEnvironment(environment) {
34
34
  }
35
35
  }
36
36
  }
37
- exports.garbageCollectEnvironment = garbageCollectEnvironment;
38
37
  function recordReachableIds(store, retainedQuery, mutableRetainedIds) {
39
38
  recordReachableIdsFromRecord(store, store[IsographEnvironment_1.ROOT_ID], mutableRetainedIds, retainedQuery.normalizationAst, retainedQuery.variables);
40
39
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeNetworkRequest = void 0;
3
+ exports.makeNetworkRequest = makeNetworkRequest;
4
4
  const garbageCollection_1 = require("./garbageCollection");
5
5
  const PromiseWrapper_1 = require("./PromiseWrapper");
6
6
  const cache_1 = require("./cache");
@@ -59,4 +59,3 @@ function makeNetworkRequest(environment, artifact, variables) {
59
59
  ];
60
60
  return response;
61
61
  }
62
- exports.makeNetworkRequest = makeNetworkRequest;
package/dist/core/read.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNetworkRequestOptionsWithDefaults = exports.readButDoNotEvaluate = void 0;
3
+ exports.readButDoNotEvaluate = readButDoNotEvaluate;
4
+ exports.getNetworkRequestOptionsWithDefaults = getNetworkRequestOptionsWithDefaults;
4
5
  const cache_1 = require("./cache");
5
6
  const componentCache_1 = require("./componentCache");
6
7
  const IsographEnvironment_1 = require("./IsographEnvironment");
@@ -42,7 +43,6 @@ function readButDoNotEvaluate(environment, fragmentReference, networkRequestOpti
42
43
  };
43
44
  }
44
45
  }
45
- exports.readButDoNotEvaluate = readButDoNotEvaluate;
46
46
  function readData(environment, ast, root, variables, nestedRefetchQueries, networkRequest, networkRequestOptions, mutableEncounteredRecords) {
47
47
  var _a, _b, _c, _d, _e;
48
48
  mutableEncounteredRecords.add(root);
@@ -412,7 +412,6 @@ function getNetworkRequestOptionsWithDefaults(networkRequestOptions) {
412
412
  throwOnNetworkError: (_b = networkRequestOptions === null || networkRequestOptions === void 0 ? void 0 : networkRequestOptions.throwOnNetworkError) !== null && _b !== void 0 ? _b : true,
413
413
  };
414
414
  }
415
- exports.getNetworkRequestOptionsWithDefaults = getNetworkRequestOptionsWithDefaults;
416
415
  // TODO use a description of the params for this?
417
416
  // TODO call stableStringifyArgs on the variable values, as well.
418
417
  // This doesn't matter for now, since we are just using primitive values
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Factory } from '@isograph/disposable-types';
3
2
  import { FragmentReference, ExtractParameters, ExtractData } from './FragmentReference';
4
3
  import { ComponentOrFieldName, DataId, IsographEnvironment } from './IsographEnvironment';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useClientSideDefer = void 0;
3
+ exports.useClientSideDefer = useClientSideDefer;
4
4
  const IsographEnvironmentProvider_1 = require("../react/IsographEnvironmentProvider");
5
5
  const cache_1 = require("../core/cache");
6
6
  const react_disposable_state_1 = require("@isograph/react-disposable-state");
@@ -11,4 +11,3 @@ function useClientSideDefer(loadableField, args) {
11
11
  const fragmentReference = (0, react_disposable_state_1.useLazyDisposableState)(cache).state;
12
12
  return { fragmentReference };
13
13
  }
14
- exports.useClientSideDefer = useClientSideDefer;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useConnectionSpecPagination = void 0;
3
+ exports.useConnectionSpecPagination = useConnectionSpecPagination;
4
4
  const react_disposable_state_1 = require("@isograph/react-disposable-state");
5
5
  const reference_counted_pointer_1 = require("@isograph/reference-counted-pointer");
6
6
  const react_1 = require("react");
@@ -145,4 +145,3 @@ function useConnectionSpecPagination(loadableField) {
145
145
  }
146
146
  }
147
147
  }
148
- exports.useConnectionSpecPagination = useConnectionSpecPagination;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useImperativeExposedMutationField = void 0;
3
+ exports.useImperativeExposedMutationField = useImperativeExposedMutationField;
4
4
  // Note: this function doesn't seem to work if there are additional arguments,
5
5
  // e.g. with set_pet_tagline. Why? This seems to straightforwardly call
6
6
  // exposedField(args)[1](); Odd.
@@ -12,4 +12,3 @@ function useImperativeExposedMutationField(exposedField) {
12
12
  },
13
13
  };
14
14
  }
15
- exports.useImperativeExposedMutationField = useImperativeExposedMutationField;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useImperativeLoadableField = void 0;
3
+ exports.useImperativeLoadableField = useImperativeLoadableField;
4
4
  const react_disposable_state_1 = require("@isograph/react-disposable-state");
5
5
  function useImperativeLoadableField(loadableField) {
6
6
  const { state, setState } = (0, react_disposable_state_1.useUpdatableDisposableState)();
@@ -12,4 +12,3 @@ function useImperativeLoadableField(loadableField) {
12
12
  fragmentReference: state,
13
13
  };
14
14
  }
15
- exports.useImperativeLoadableField = useImperativeLoadableField;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSkipLimitPagination = void 0;
3
+ exports.useSkipLimitPagination = useSkipLimitPagination;
4
4
  const IsographEnvironmentProvider_1 = require("../react/IsographEnvironmentProvider");
5
5
  const useResult_1 = require("../react/useResult");
6
6
  const read_1 = require("../core/read");
@@ -135,4 +135,3 @@ function useSkipLimitPagination(loadableField) {
135
135
  }
136
136
  }
137
137
  }
138
- exports.useSkipLimitPagination = useSkipLimitPagination;
@@ -23,11 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.FragmentReader = void 0;
26
+ exports.FragmentReader = FragmentReader;
27
27
  const React = __importStar(require("react"));
28
28
  const useResult_1 = require("./useResult");
29
29
  function FragmentReader(props) {
30
30
  const Component = (0, useResult_1.useResult)(props.fragmentReference, props.networkRequestOptions);
31
31
  return React.createElement(Component, Object.assign({}, props.additionalProps));
32
32
  }
33
- exports.FragmentReader = FragmentReader;
@@ -23,14 +23,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.useIsographEnvironment = exports.IsographEnvironmentProvider = exports.IsographEnvironmentContext = void 0;
26
+ exports.IsographEnvironmentContext = void 0;
27
+ exports.IsographEnvironmentProvider = IsographEnvironmentProvider;
28
+ exports.useIsographEnvironment = useIsographEnvironment;
27
29
  const React = __importStar(require("react"));
28
30
  const react_1 = require("react");
29
31
  exports.IsographEnvironmentContext = (0, react_1.createContext)(null);
30
32
  function IsographEnvironmentProvider({ environment, children, }) {
31
33
  return (React.createElement(exports.IsographEnvironmentContext.Provider, { value: environment }, children));
32
34
  }
33
- exports.IsographEnvironmentProvider = IsographEnvironmentProvider;
34
35
  function useIsographEnvironment() {
35
36
  const context = (0, react_1.useContext)(exports.IsographEnvironmentContext);
36
37
  if (context == null) {
@@ -39,4 +40,3 @@ function useIsographEnvironment() {
39
40
  }
40
41
  return context;
41
42
  }
42
- exports.useIsographEnvironment = useIsographEnvironment;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * This is a function that will render a component only after it commits.
4
3
  * It should not be used in production. It's useful as a way to debug issues
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RenderAfterCommit__DO_NOT_USE = void 0;
3
+ exports.RenderAfterCommit__DO_NOT_USE = RenderAfterCommit__DO_NOT_USE;
4
4
  const react_1 = require("react");
5
5
  /**
6
6
  * This is a function that will render a component only after it commits.
@@ -13,4 +13,3 @@ function RenderAfterCommit__DO_NOT_USE({ children, }) {
13
13
  (0, react_1.useEffect)(() => setShow(true), []);
14
14
  return show ? children : null;
15
15
  }
16
- exports.RenderAfterCommit__DO_NOT_USE = RenderAfterCommit__DO_NOT_USE;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useImperativeReference = void 0;
3
+ exports.useImperativeReference = useImperativeReference;
4
4
  const react_disposable_state_1 = require("@isograph/react-disposable-state");
5
5
  const IsographEnvironmentProvider_1 = require("./IsographEnvironmentProvider");
6
6
  const IsographEnvironment_1 = require("../core/IsographEnvironment");
@@ -33,4 +33,3 @@ function useImperativeReference(entrypoint) {
33
33
  },
34
34
  };
35
35
  }
36
- exports.useImperativeReference = useImperativeReference;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useLazyReference = void 0;
3
+ exports.useLazyReference = useLazyReference;
4
4
  const IsographEnvironmentProvider_1 = require("./IsographEnvironmentProvider");
5
5
  const cache_1 = require("../core/cache");
6
6
  const react_disposable_state_1 = require("@isograph/react-disposable-state");
@@ -18,4 +18,3 @@ function useLazyReference(entrypoint, variables) {
18
18
  fragmentReference: (0, react_disposable_state_1.useLazyDisposableState)(cache).state,
19
19
  };
20
20
  }
21
- exports.useLazyReference = useLazyReference;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSubscribeToMultiple = exports.useReadAndSubscribe = void 0;
3
+ exports.useReadAndSubscribe = useReadAndSubscribe;
4
+ exports.useSubscribeToMultiple = useSubscribeToMultiple;
4
5
  const react_1 = require("react");
5
6
  const FragmentReference_1 = require("../core/FragmentReference");
6
7
  const read_1 = require("../core/read");
@@ -16,7 +17,6 @@ function useReadAndSubscribe(fragmentReference, networkRequestOptions, readerAst
16
17
  (0, useRerenderOnChange_1.useRerenderOnChange)(readOutDataAndRecords, fragmentReference, setReadOutDataAndRecords, readerAst);
17
18
  return readOutDataAndRecords.item;
18
19
  }
19
- exports.useReadAndSubscribe = useReadAndSubscribe;
20
20
  function useSubscribeToMultiple(items) {
21
21
  const environment = (0, IsographEnvironmentProvider_1.useIsographEnvironment)();
22
22
  (0, react_1.useEffect)(() => {
@@ -38,4 +38,3 @@ function useSubscribeToMultiple(items) {
38
38
  .join('.'),
39
39
  ]);
40
40
  }
41
- exports.useSubscribeToMultiple = useSubscribeToMultiple;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useRerenderOnChange = void 0;
3
+ exports.useRerenderOnChange = useRerenderOnChange;
4
4
  const react_1 = require("react");
5
5
  const cache_1 = require("../core/cache");
6
6
  const IsographEnvironmentProvider_1 = require("./IsographEnvironmentProvider");
@@ -20,4 +20,3 @@ function useRerenderOnChange(encounteredDataAndRecords, fragmentReference, setEn
20
20
  // the dependency array
21
21
  }, []);
22
22
  }
23
- exports.useRerenderOnChange = useRerenderOnChange;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.maybeUnwrapNetworkRequest = exports.useResult = void 0;
3
+ exports.useResult = useResult;
4
+ exports.maybeUnwrapNetworkRequest = maybeUnwrapNetworkRequest;
4
5
  const IsographEnvironmentProvider_1 = require("../react/IsographEnvironmentProvider");
5
6
  const componentCache_1 = require("../core/componentCache");
6
7
  const useReadAndSubscribe_1 = require("./useReadAndSubscribe");
@@ -26,7 +27,6 @@ function useResult(fragmentReference, partialNetworkRequestOptions) {
26
27
  }
27
28
  }
28
29
  }
29
- exports.useResult = useResult;
30
30
  function maybeUnwrapNetworkRequest(networkRequest, networkRequestOptions) {
31
31
  const state = (0, PromiseWrapper_1.getPromiseState)(networkRequest);
32
32
  if (state.kind === 'Err' && networkRequestOptions.throwOnNetworkError) {
@@ -37,4 +37,3 @@ function maybeUnwrapNetworkRequest(networkRequest, networkRequestOptions) {
37
37
  throw state.promise;
38
38
  }
39
39
  }
40
- exports.maybeUnwrapNetworkRequest = maybeUnwrapNetworkRequest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isograph/react",
3
- "version": "0.0.0-main-03306d26",
3
+ "version": "0.0.0-main-e7d6b095",
4
4
  "description": "Use Isograph with React",
5
5
  "homepage": "https://isograph.dev",
6
6
  "main": "dist/index.js",
@@ -17,18 +17,18 @@
17
17
  "tsc": "tsc"
18
18
  },
19
19
  "dependencies": {
20
- "@isograph/disposable-types": "0.0.0-main-03306d26",
21
- "@isograph/react-disposable-state": "0.0.0-main-03306d26",
22
- "@isograph/reference-counted-pointer": "0.0.0-main-03306d26"
20
+ "@isograph/disposable-types": "0.0.0-main-e7d6b095",
21
+ "@isograph/react-disposable-state": "0.0.0-main-e7d6b095",
22
+ "@isograph/reference-counted-pointer": "0.0.0-main-e7d6b095"
23
23
  },
24
24
  "peerDependencies": {
25
- "react": "18.2.0"
25
+ "react": "18.3.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@babel/preset-typescript": "^7.24.7",
29
- "@types/react": "^18.0.31",
29
+ "@types/react": "18.3.1",
30
30
  "react-test-renderer": "^18.2.0",
31
- "typescript": "^5.0.3",
31
+ "typescript": "5.6.3",
32
32
  "vite-plugin-babel": "^1.2.0",
33
33
  "vite-plugin-commonjs": "^0.10.1"
34
34
  },