@graphitation/apollo-react-relay-duct-tape 1.4.1 → 1.4.2

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/.eslintcache CHANGED
@@ -1 +1 @@
1
- [{"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/hooks.test.tsx":"1","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/useOverridenOrDefaultApolloClient.test.tsx":"2","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/convertFetchPolicy.ts":"3","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/hooks.ts":"4","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/index.ts":"5","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/compiledHooks.test.tsx":"6","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/fragmentReferencesFieldPolicy.test.ts":"7","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/getPossibleTypesAndDataIdFromNode.test.ts":"8","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/nodeFromCacheFieldPolicy.test.ts":"9","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/index.ts":"10","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/types.ts":"11","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledFragment.ts":"12","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledLazyLoadQuery.ts":"13","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledPaginationFragment.ts":"14","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts":"15","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useDeepCompareMemoize.ts":"16","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useForceUpdate.ts":"17","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/fragmentReferencesFieldPolicy.ts":"18","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/getPossibleTypesAndDataIdFromNode.ts":"19","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/index.ts":"20","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/nodeFromCacheFieldPolicy.ts":"21","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/shallowCompareFragmentReferences.ts":"22","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/typePolicies.ts":"23","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/types.ts":"24","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/useOverridenOrDefaultApolloClient.ts":"25"},{"size":11649,"mtime":1744013801590,"results":"26","hashOfConfig":"27"},{"size":1922,"mtime":1744013801590,"results":"28","hashOfConfig":"27"},{"size":690,"mtime":1744013801590,"results":"29","hashOfConfig":"27"},{"size":12373,"mtime":1744013801590,"results":"30","hashOfConfig":"27"},{"size":174,"mtime":1744013801590,"results":"31","hashOfConfig":"27"},{"size":48212,"mtime":1744013801591,"results":"32","hashOfConfig":"27"},{"size":1839,"mtime":1744013801591,"results":"33","hashOfConfig":"27"},{"size":1709,"mtime":1744013801591,"results":"34","hashOfConfig":"27"},{"size":3041,"mtime":1744013801591,"results":"35","hashOfConfig":"27"},{"size":445,"mtime":1744013801591,"results":"36","hashOfConfig":"27"},{"size":575,"mtime":1744013801591,"results":"37","hashOfConfig":"27"},{"size":3668,"mtime":1744013801591,"results":"38","hashOfConfig":"27"},{"size":4126,"mtime":1744013801591,"results":"39","hashOfConfig":"27"},{"size":10521,"mtime":1744013801592,"results":"40","hashOfConfig":"27"},{"size":5586,"mtime":1744013801592,"results":"41","hashOfConfig":"27"},{"size":843,"mtime":1744013801592,"results":"42","hashOfConfig":"27"},{"size":152,"mtime":1744013801592,"results":"43","hashOfConfig":"27"},{"size":286,"mtime":1744013801592,"results":"44","hashOfConfig":"27"},{"size":1243,"mtime":1744013801592,"results":"45","hashOfConfig":"27"},{"size":230,"mtime":1744013801592,"results":"46","hashOfConfig":"27"},{"size":2829,"mtime":1744013801592,"results":"47","hashOfConfig":"27"},{"size":2325,"mtime":1744013801592,"results":"48","hashOfConfig":"27"},{"size":1110,"mtime":1744013801592,"results":"49","hashOfConfig":"27"},{"size":2069,"mtime":1744013801592,"results":"50","hashOfConfig":"27"},{"size":1352,"mtime":1744013801592,"results":"51","hashOfConfig":"27"},{"filePath":"52","messages":"53","suppressedMessages":"54","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"obk99i",{"filePath":"55","messages":"56","suppressedMessages":"57","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"58","messages":"59","suppressedMessages":"60","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"61","messages":"62","suppressedMessages":"63","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"64","messages":"65","suppressedMessages":"66","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"67","messages":"68","suppressedMessages":"69","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"70","messages":"71","suppressedMessages":"72","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"73","messages":"74","suppressedMessages":"75","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"76","messages":"77","suppressedMessages":"78","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"79","messages":"80","suppressedMessages":"81","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"82","messages":"83","suppressedMessages":"84","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"85","messages":"86","suppressedMessages":"87","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"88","messages":"89","suppressedMessages":"90","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"91","messages":"92","suppressedMessages":"93","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"94","messages":"95","suppressedMessages":"96","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"97","messages":"98","suppressedMessages":"99","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"100","messages":"101","suppressedMessages":"102","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"103","messages":"104","suppressedMessages":"105","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"106","messages":"107","suppressedMessages":"108","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"109","messages":"110","suppressedMessages":"111","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"112","messages":"113","suppressedMessages":"114","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"115","messages":"116","suppressedMessages":"117","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"118","messages":"119","suppressedMessages":"120","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"121","messages":"122","suppressedMessages":"123","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"124","messages":"125","suppressedMessages":"126","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/hooks.test.tsx",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/useOverridenOrDefaultApolloClient.test.tsx",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/convertFetchPolicy.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/hooks.ts",[],["127"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/index.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/compiledHooks.test.tsx",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/fragmentReferencesFieldPolicy.test.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/getPossibleTypesAndDataIdFromNode.test.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/nodeFromCacheFieldPolicy.test.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/index.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/types.ts",[],["128"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledFragment.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledLazyLoadQuery.ts",[],["129"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledPaginationFragment.ts",[],["130","131","132","133","134"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts",[],["135"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useDeepCompareMemoize.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useForceUpdate.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/fragmentReferencesFieldPolicy.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/getPossibleTypesAndDataIdFromNode.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/index.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/nodeFromCacheFieldPolicy.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/shallowCompareFragmentReferences.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/typePolicies.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/types.ts",[],["136","137"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/useOverridenOrDefaultApolloClient.ts",[],["138"],{"ruleId":"139","severity":1,"message":"140","line":320,"column":38,"nodeType":"141","messageId":"142","endLine":320,"endColumn":41,"suggestions":"143","suppressions":"144"},{"ruleId":"139","severity":1,"message":"140","line":16,"column":32,"nodeType":"141","messageId":"142","endLine":16,"endColumn":35,"suggestions":"145","suppressions":"146"},{"ruleId":"139","severity":1,"message":"140","line":104,"column":28,"nodeType":"141","messageId":"142","endLine":104,"endColumn":31,"suggestions":"147","suppressions":"148"},{"ruleId":"139","severity":1,"message":"140","line":174,"column":24,"nodeType":"141","messageId":"142","endLine":174,"endColumn":27,"suggestions":"149","suppressions":"150"},{"ruleId":"139","severity":1,"message":"140","line":177,"column":4,"nodeType":"141","messageId":"142","endLine":177,"endColumn":7,"suggestions":"151","suppressions":"152"},{"ruleId":"139","severity":1,"message":"140","line":179,"column":30,"nodeType":"141","messageId":"142","endLine":179,"endColumn":33,"suggestions":"153","suppressions":"154"},{"ruleId":"139","severity":1,"message":"140","line":189,"column":24,"nodeType":"141","messageId":"142","endLine":189,"endColumn":27,"suggestions":"155","suppressions":"156"},{"ruleId":"139","severity":1,"message":"140","line":225,"column":9,"nodeType":"141","messageId":"142","endLine":225,"endColumn":12,"suggestions":"157","suppressions":"158"},{"ruleId":"139","severity":1,"message":"140","line":38,"column":26,"nodeType":"141","messageId":"142","endLine":38,"endColumn":29,"suggestions":"159","suppressions":"160"},{"ruleId":"139","severity":1,"message":"140","line":5,"column":19,"nodeType":"141","messageId":"142","endLine":5,"endColumn":22,"suggestions":"161","suppressions":"162"},{"ruleId":"139","severity":1,"message":"140","line":10,"column":19,"nodeType":"141","messageId":"142","endLine":10,"endColumn":22,"suggestions":"163","suppressions":"164"},{"ruleId":"139","severity":1,"message":"140","line":17,"column":51,"nodeType":"141","messageId":"142","endLine":17,"endColumn":54,"suggestions":"165","suppressions":"166"},"@typescript-eslint/no-explicit-any","Unexpected any. Specify a different type.","TSAnyKeyword","unexpectedAny",["167","168"],["169"],["170","171"],["172"],["173","174"],["175"],["176","177"],["178"],["179","180"],["181"],["182","183"],["184"],["185","186"],["187"],["188","189"],["190"],["191","192"],["193"],["194","195"],["196"],["197","198"],["199"],["200","201"],["202"],{"messageId":"203","fix":"204","desc":"205"},{"messageId":"206","fix":"207","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"211","desc":"205"},{"messageId":"206","fix":"212","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"213","desc":"205"},{"messageId":"206","fix":"214","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"215","desc":"205"},{"messageId":"206","fix":"216","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"217","desc":"205"},{"messageId":"206","fix":"218","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"219","desc":"205"},{"messageId":"206","fix":"220","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"221","desc":"205"},{"messageId":"206","fix":"222","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"223","desc":"205"},{"messageId":"206","fix":"224","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"225","desc":"205"},{"messageId":"206","fix":"226","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"227","desc":"205"},{"messageId":"206","fix":"228","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"229","desc":"205"},{"messageId":"206","fix":"230","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"231","desc":"205"},{"messageId":"206","fix":"232","desc":"208"},{"kind":"209","justification":"210"},"suggestUnknown",{"range":"233","text":"234"},"Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct.","suggestNever",{"range":"233","text":"235"},"Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.","directive","",{"range":"236","text":"234"},{"range":"236","text":"235"},{"range":"237","text":"234"},{"range":"237","text":"235"},{"range":"238","text":"234"},{"range":"238","text":"235"},{"range":"239","text":"234"},{"range":"239","text":"235"},{"range":"240","text":"234"},{"range":"240","text":"235"},{"range":"241","text":"234"},{"range":"241","text":"235"},{"range":"242","text":"234"},{"range":"242","text":"235"},{"range":"243","text":"234"},{"range":"243","text":"235"},{"range":"244","text":"234"},{"range":"244","text":"235"},{"range":"245","text":"234"},{"range":"245","text":"235"},{"range":"246","text":"234"},{"range":"246","text":"235"},[11748,11751],"unknown","never",[567,570],[3065,3068],[5868,5871],[5969,5972],[6069,6072],[6358,6361],[7422,7425],[1283,1286],[158,161],[276,279],[460,463]]
1
+ [{"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/hooks.test.tsx":"1","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/useOverridenOrDefaultApolloClient.test.tsx":"2","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/convertFetchPolicy.ts":"3","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/hooks.ts":"4","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/index.ts":"5","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/compiledHooks.test.tsx":"6","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/fragmentReferencesFieldPolicy.test.ts":"7","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/getPossibleTypesAndDataIdFromNode.test.ts":"8","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/nodeFromCacheFieldPolicy.test.ts":"9","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/index.ts":"10","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/types.ts":"11","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledFragment.ts":"12","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledLazyLoadQuery.ts":"13","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledPaginationFragment.ts":"14","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts":"15","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useDeepCompareMemoize.ts":"16","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useForceUpdate.ts":"17","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/fragmentReferencesFieldPolicy.ts":"18","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/getPossibleTypesAndDataIdFromNode.ts":"19","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/index.ts":"20","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/nodeFromCacheFieldPolicy.ts":"21","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/shallowCompareFragmentReferences.ts":"22","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/typePolicies.ts":"23","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/types.ts":"24","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/useOverridenOrDefaultApolloClient.ts":"25"},{"size":11649,"mtime":1744099707355,"results":"26","hashOfConfig":"27"},{"size":1922,"mtime":1744099707356,"results":"28","hashOfConfig":"27"},{"size":690,"mtime":1744099707356,"results":"29","hashOfConfig":"27"},{"size":12373,"mtime":1744099707356,"results":"30","hashOfConfig":"27"},{"size":174,"mtime":1744099707356,"results":"31","hashOfConfig":"27"},{"size":48808,"mtime":1744099707357,"results":"32","hashOfConfig":"27"},{"size":1839,"mtime":1744099707357,"results":"33","hashOfConfig":"27"},{"size":1709,"mtime":1744099707357,"results":"34","hashOfConfig":"27"},{"size":3041,"mtime":1744099707357,"results":"35","hashOfConfig":"27"},{"size":445,"mtime":1744099707357,"results":"36","hashOfConfig":"27"},{"size":575,"mtime":1744099707357,"results":"37","hashOfConfig":"27"},{"size":3668,"mtime":1744099707357,"results":"38","hashOfConfig":"27"},{"size":4126,"mtime":1744099707357,"results":"39","hashOfConfig":"27"},{"size":10521,"mtime":1744099707357,"results":"40","hashOfConfig":"27"},{"size":5548,"mtime":1744099707357,"results":"41","hashOfConfig":"27"},{"size":843,"mtime":1744099707357,"results":"42","hashOfConfig":"27"},{"size":152,"mtime":1744099707357,"results":"43","hashOfConfig":"27"},{"size":286,"mtime":1744099707357,"results":"44","hashOfConfig":"27"},{"size":1243,"mtime":1744099707357,"results":"45","hashOfConfig":"27"},{"size":230,"mtime":1744099707357,"results":"46","hashOfConfig":"27"},{"size":2829,"mtime":1744099707358,"results":"47","hashOfConfig":"27"},{"size":2325,"mtime":1744099707358,"results":"48","hashOfConfig":"27"},{"size":1110,"mtime":1744099707358,"results":"49","hashOfConfig":"27"},{"size":2069,"mtime":1744099707358,"results":"50","hashOfConfig":"27"},{"size":1352,"mtime":1744099707358,"results":"51","hashOfConfig":"27"},{"filePath":"52","messages":"53","suppressedMessages":"54","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"obk99i",{"filePath":"55","messages":"56","suppressedMessages":"57","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"58","messages":"59","suppressedMessages":"60","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"61","messages":"62","suppressedMessages":"63","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"64","messages":"65","suppressedMessages":"66","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"67","messages":"68","suppressedMessages":"69","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"70","messages":"71","suppressedMessages":"72","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"73","messages":"74","suppressedMessages":"75","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"76","messages":"77","suppressedMessages":"78","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"79","messages":"80","suppressedMessages":"81","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"82","messages":"83","suppressedMessages":"84","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"85","messages":"86","suppressedMessages":"87","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"88","messages":"89","suppressedMessages":"90","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"91","messages":"92","suppressedMessages":"93","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"94","messages":"95","suppressedMessages":"96","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"97","messages":"98","suppressedMessages":"99","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"100","messages":"101","suppressedMessages":"102","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"103","messages":"104","suppressedMessages":"105","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"106","messages":"107","suppressedMessages":"108","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"109","messages":"110","suppressedMessages":"111","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"112","messages":"113","suppressedMessages":"114","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"115","messages":"116","suppressedMessages":"117","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"118","messages":"119","suppressedMessages":"120","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"121","messages":"122","suppressedMessages":"123","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"124","messages":"125","suppressedMessages":"126","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/hooks.test.tsx",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/useOverridenOrDefaultApolloClient.test.tsx",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/convertFetchPolicy.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/hooks.ts",[],["127"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/index.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/compiledHooks.test.tsx",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/fragmentReferencesFieldPolicy.test.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/getPossibleTypesAndDataIdFromNode.test.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/nodeFromCacheFieldPolicy.test.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/index.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/types.ts",[],["128"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledFragment.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledLazyLoadQuery.ts",[],["129"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledPaginationFragment.ts",[],["130","131","132","133","134"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts",[],["135"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useDeepCompareMemoize.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useForceUpdate.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/fragmentReferencesFieldPolicy.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/getPossibleTypesAndDataIdFromNode.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/index.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/nodeFromCacheFieldPolicy.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/shallowCompareFragmentReferences.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/typePolicies.ts",[],[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/types.ts",[],["136","137"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/useOverridenOrDefaultApolloClient.ts",[],["138"],{"ruleId":"139","severity":1,"message":"140","line":320,"column":38,"nodeType":"141","messageId":"142","endLine":320,"endColumn":41,"suggestions":"143","suppressions":"144"},{"ruleId":"139","severity":1,"message":"140","line":16,"column":32,"nodeType":"141","messageId":"142","endLine":16,"endColumn":35,"suggestions":"145","suppressions":"146"},{"ruleId":"139","severity":1,"message":"140","line":104,"column":28,"nodeType":"141","messageId":"142","endLine":104,"endColumn":31,"suggestions":"147","suppressions":"148"},{"ruleId":"139","severity":1,"message":"140","line":174,"column":24,"nodeType":"141","messageId":"142","endLine":174,"endColumn":27,"suggestions":"149","suppressions":"150"},{"ruleId":"139","severity":1,"message":"140","line":177,"column":4,"nodeType":"141","messageId":"142","endLine":177,"endColumn":7,"suggestions":"151","suppressions":"152"},{"ruleId":"139","severity":1,"message":"140","line":179,"column":30,"nodeType":"141","messageId":"142","endLine":179,"endColumn":33,"suggestions":"153","suppressions":"154"},{"ruleId":"139","severity":1,"message":"140","line":189,"column":24,"nodeType":"141","messageId":"142","endLine":189,"endColumn":27,"suggestions":"155","suppressions":"156"},{"ruleId":"139","severity":1,"message":"140","line":225,"column":9,"nodeType":"141","messageId":"142","endLine":225,"endColumn":12,"suggestions":"157","suppressions":"158"},{"ruleId":"139","severity":1,"message":"140","line":38,"column":26,"nodeType":"141","messageId":"142","endLine":38,"endColumn":29,"suggestions":"159","suppressions":"160"},{"ruleId":"139","severity":1,"message":"140","line":5,"column":19,"nodeType":"141","messageId":"142","endLine":5,"endColumn":22,"suggestions":"161","suppressions":"162"},{"ruleId":"139","severity":1,"message":"140","line":10,"column":19,"nodeType":"141","messageId":"142","endLine":10,"endColumn":22,"suggestions":"163","suppressions":"164"},{"ruleId":"139","severity":1,"message":"140","line":17,"column":51,"nodeType":"141","messageId":"142","endLine":17,"endColumn":54,"suggestions":"165","suppressions":"166"},"@typescript-eslint/no-explicit-any","Unexpected any. Specify a different type.","TSAnyKeyword","unexpectedAny",["167","168"],["169"],["170","171"],["172"],["173","174"],["175"],["176","177"],["178"],["179","180"],["181"],["182","183"],["184"],["185","186"],["187"],["188","189"],["190"],["191","192"],["193"],["194","195"],["196"],["197","198"],["199"],["200","201"],["202"],{"messageId":"203","fix":"204","desc":"205"},{"messageId":"206","fix":"207","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"211","desc":"205"},{"messageId":"206","fix":"212","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"213","desc":"205"},{"messageId":"206","fix":"214","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"215","desc":"205"},{"messageId":"206","fix":"216","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"217","desc":"205"},{"messageId":"206","fix":"218","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"219","desc":"205"},{"messageId":"206","fix":"220","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"221","desc":"205"},{"messageId":"206","fix":"222","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"223","desc":"205"},{"messageId":"206","fix":"224","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"225","desc":"205"},{"messageId":"206","fix":"226","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"227","desc":"205"},{"messageId":"206","fix":"228","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"229","desc":"205"},{"messageId":"206","fix":"230","desc":"208"},{"kind":"209","justification":"210"},{"messageId":"203","fix":"231","desc":"205"},{"messageId":"206","fix":"232","desc":"208"},{"kind":"209","justification":"210"},"suggestUnknown",{"range":"233","text":"234"},"Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct.","suggestNever",{"range":"233","text":"235"},"Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.","directive","",{"range":"236","text":"234"},{"range":"236","text":"235"},{"range":"237","text":"234"},{"range":"237","text":"235"},{"range":"238","text":"234"},{"range":"238","text":"235"},{"range":"239","text":"234"},{"range":"239","text":"235"},{"range":"240","text":"234"},{"range":"240","text":"235"},{"range":"241","text":"234"},{"range":"241","text":"235"},{"range":"242","text":"234"},{"range":"242","text":"235"},{"range":"243","text":"234"},{"range":"243","text":"235"},{"range":"244","text":"234"},{"range":"244","text":"235"},{"range":"245","text":"234"},{"range":"245","text":"235"},{"range":"246","text":"234"},{"range":"246","text":"235"},[11748,11751],"unknown","never",[567,570],[3065,3068],[5868,5871],[5969,5972],[6069,6072],[6358,6361],[7422,7425],[1283,1286],[158,161],[276,279],[460,463]]
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @graphitation/apollo-react-relay-duct-tape
2
2
 
3
- <!-- This log was last generated on Mon, 07 Apr 2025 08:26:49 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Tue, 08 Apr 2025 08:19:04 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.4.2
8
+
9
+ Tue, 08 Apr 2025 08:19:04 GMT
10
+
11
+ ### Patches
12
+
13
+ - fix issue with data not being returned correctly from cache (sjwilczynski@gmail.com)
14
+
7
15
  ## 1.4.1
8
16
 
9
- Mon, 07 Apr 2025 08:26:49 GMT
17
+ Mon, 07 Apr 2025 08:26:58 GMT
10
18
 
11
19
  ### Patches
12
20
 
@@ -88,34 +88,36 @@ function useCompiledRefetchableFragment(documents, fragmentReference) {
88
88
  subscription == null ? void 0 : subscription.unsubscribe();
89
89
  subscription = void 0;
90
90
  disposable.current = void 0;
91
- (0, import_react_dom.unstable_batchedUpdates)(() => {
92
- var _a2;
91
+ }
92
+ (0, import_react_dom.unstable_batchedUpdates)(() => {
93
+ var _a2;
94
+ if (!loading) {
93
95
  if (options == null ? void 0 : options.UNSTABLE_onCompletedWithData) {
94
96
  options.UNSTABLE_onCompletedWithData(error || null, data2);
95
97
  } else {
96
98
  (_a2 = options == null ? void 0 : options.onCompleted) == null ? void 0 : _a2.call(options, error || null);
97
99
  }
98
- if (!error) {
99
- const { id: _, ...variablesToPropagate } = variables;
100
- const nextVariables = {
101
- ...fragmentReference.__fragments,
102
- ...variablesToPropagate
100
+ }
101
+ if (!error) {
102
+ const { id: _, ...variablesToPropagate } = variables;
103
+ const nextVariables = {
104
+ ...fragmentReference.__fragments,
105
+ ...variablesToPropagate
106
+ };
107
+ if (!(0, import_lodash.isEqual)(
108
+ fragmentReferenceWithOwnVariables.__fragments,
109
+ nextVariables
110
+ )) {
111
+ const nextFragmentReference = {
112
+ __fragments: nextVariables
103
113
  };
104
- if (!(0, import_lodash.isEqual)(
105
- fragmentReferenceWithOwnVariables.__fragments,
106
- nextVariables
107
- )) {
108
- const nextFragmentReference = {
109
- __fragments: nextVariables
110
- };
111
- if (fragmentReference.id !== void 0) {
112
- nextFragmentReference.id = fragmentReference.id;
113
- }
114
- setFragmentReferenceWithOwnVariables(nextFragmentReference);
114
+ if (fragmentReference.id !== void 0) {
115
+ nextFragmentReference.id = fragmentReference.id;
115
116
  }
117
+ setFragmentReferenceWithOwnVariables(nextFragmentReference);
116
118
  }
117
- });
118
- }
119
+ }
120
+ });
119
121
  },
120
122
  (error) => {
121
123
  var _a2;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts"],
4
- "sourcesContent": ["import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { unstable_batchedUpdates } from \"react-dom\";\nimport invariant from \"invariant\";\nimport { useCompiledFragment } from \"./useCompiledFragment\";\nimport { isEqual } from \"lodash\";\nimport { convertFetchPolicy } from \"../../convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { FragmentReference } from \"./types\";\nimport type { FetchPolicy } from \"../../types\";\n\nexport interface Disposable {\n dispose(): void;\n}\n\nexport type RefetchFn<Variables extends object = object> = (\n variables: Partial<Variables>,\n options?: RefetchOptions,\n) => Disposable;\n\nexport interface RefetchOptions {\n onCompleted?: (error: Error | null) => void;\n fetchPolicy?: FetchPolicy;\n}\n\n/**\n * These do not exist in the Relay API and should not be exported from the package.\n */\nexport interface PrivateRefetchOptions\n extends Omit<RefetchOptions, \"fetchPolicy\"> {\n /**\n * Returns the fetched data.\n */\n UNSTABLE_onCompletedWithData?: (\n error: Error | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any> | null,\n ) => void;\n\n fetchPolicy?: FetchPolicy | \"no-cache\";\n}\n\nexport function useCompiledRefetchableFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): [data: object, refetch: RefetchFn] {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"useRefetchableFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"useRefetchableFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `useRefetchableFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n\n const client = useOverridenOrDefaultApolloClient();\n\n // We use state for this, so that...\n const [\n fragmentReferenceWithOwnVariables,\n setFragmentReferenceWithOwnVariables,\n ] = useState(fragmentReference);\n // ...this gets invoked again with updated variables.\n const data = useCompiledFragment(\n documents,\n fragmentReferenceWithOwnVariables,\n );\n\n const disposable = useRef<Disposable>();\n useEffect(\n () => () => {\n if (disposable.current) {\n disposable.current.dispose();\n disposable.current = undefined;\n }\n },\n [], // On unmount\n );\n\n const refetch = useCallback<RefetchFn>(\n (variablesSubset, options?: PrivateRefetchOptions) => {\n const variables = {\n ...fragmentReference.__fragments,\n ...variablesSubset,\n id: fragmentReference.id,\n };\n const observable = client.watchQuery({\n fetchPolicy: convertFetchPolicy(options?.fetchPolicy) ?? \"network-only\",\n query: executionQueryDocument,\n variables,\n });\n let subscription: ZenObservable.Subscription | undefined =\n observable.subscribe(\n ({ data, error, loading }) => {\n if (!loading) {\n // Be sure not to keep a retain cycle, so cleanup the reference first thing.\n subscription?.unsubscribe();\n subscription = undefined;\n disposable.current = undefined;\n\n unstable_batchedUpdates(() => {\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error || null, data);\n } else {\n options?.onCompleted?.(error || null);\n }\n if (!error) {\n const { id: _, ...variablesToPropagate } = variables;\n const nextVariables = {\n ...fragmentReference.__fragments,\n ...variablesToPropagate,\n };\n // No need to trigger an update to propagate new variables if they don't actually change.\n if (\n !isEqual(\n fragmentReferenceWithOwnVariables.__fragments,\n nextVariables,\n )\n ) {\n const nextFragmentReference: FragmentReference = {\n __fragments: nextVariables,\n };\n // Don't add an empty key if this is a fragment on the Query type.\n if (fragmentReference.id !== undefined) {\n nextFragmentReference.id = fragmentReference.id;\n }\n setFragmentReferenceWithOwnVariables(nextFragmentReference);\n }\n }\n });\n }\n },\n (error) => {\n // Be sure not to keep a retain cycle\n subscription?.unsubscribe();\n subscription = undefined;\n\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error, null);\n } else {\n options?.onCompleted?.(error);\n }\n },\n );\n disposable.current = { dispose: () => subscription?.unsubscribe() };\n return disposable.current;\n },\n [\n client,\n executionQueryDocument,\n fragmentReference.id,\n fragmentReference.__fragments,\n fragmentReferenceWithOwnVariables.__fragments,\n ],\n );\n\n return [data, refetch];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyD;AACzD,uBAAwC;AACxC,uBAAsB;AACtB,iCAAoC;AACpC,oBAAwB;AACxB,gCAAmC;AACnC,+CAAkD;AAqC3C,SAAS,+BACd,WACA,mBACoC;AACpC,QAAM,EAAE,wBAAwB,SAAS,IAAI;AAC7C,uBAAAA;AAAA,IACE,YAAY,SAAS;AAAA,IACrB;AAAA,EAEF;AACA,uBAAAA;AAAA,IACE;AAAA,IACA;AAAA,IAGA,SAAS,aAAa;AAAA,EACxB;AAEA,QAAM,aAAS,4EAAkC;AAGjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,QAAI,uBAAS,iBAAiB;AAE9B,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qC,qBAAqB;AAAA,gBAC5D;AAAA,cACF;AAAA,YACF,CAAC;AAAA,UACH;AAAA,QACF;AAAA,QACA,CAAC,UAAU;AA1IrB,cAAAA;AA4IY,uDAAc;AACd,yBAAe;AAEf,cAAI,mCAAS,8BAA8B;AACzC,oBAAQ,6BAA6B,OAAO,IAAI;AAAA,UAClD,OAAO;AACL,aAAAA,MAAA,mCAAS,gBAAT,gBAAAA,IAAA,cAAuB;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AACF,iBAAW,UAAU,EAAE,SAAS,MAAM,6CAAc,cAAc;AAClE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB,kCAAkC;AAAA,IACpC;AAAA,EACF;AAEA,SAAO,CAAC,MAAM,OAAO;AACvB;",
4
+ "sourcesContent": ["import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { unstable_batchedUpdates } from \"react-dom\";\nimport invariant from \"invariant\";\nimport { useCompiledFragment } from \"./useCompiledFragment\";\nimport { isEqual } from \"lodash\";\nimport { convertFetchPolicy } from \"../../convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { FragmentReference } from \"./types\";\nimport type { FetchPolicy } from \"../../types\";\n\nexport interface Disposable {\n dispose(): void;\n}\n\nexport type RefetchFn<Variables extends object = object> = (\n variables: Partial<Variables>,\n options?: RefetchOptions,\n) => Disposable;\n\nexport interface RefetchOptions {\n onCompleted?: (error: Error | null) => void;\n fetchPolicy?: FetchPolicy;\n}\n\n/**\n * These do not exist in the Relay API and should not be exported from the package.\n */\nexport interface PrivateRefetchOptions\n extends Omit<RefetchOptions, \"fetchPolicy\"> {\n /**\n * Returns the fetched data.\n */\n UNSTABLE_onCompletedWithData?: (\n error: Error | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any> | null,\n ) => void;\n\n fetchPolicy?: FetchPolicy | \"no-cache\";\n}\n\nexport function useCompiledRefetchableFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): [data: object, refetch: RefetchFn] {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"useRefetchableFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"useRefetchableFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `useRefetchableFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n\n const client = useOverridenOrDefaultApolloClient();\n\n // We use state for this, so that...\n const [\n fragmentReferenceWithOwnVariables,\n setFragmentReferenceWithOwnVariables,\n ] = useState(fragmentReference);\n // ...this gets invoked again with updated variables.\n const data = useCompiledFragment(\n documents,\n fragmentReferenceWithOwnVariables,\n );\n\n const disposable = useRef<Disposable>();\n useEffect(\n () => () => {\n if (disposable.current) {\n disposable.current.dispose();\n disposable.current = undefined;\n }\n },\n [], // On unmount\n );\n\n const refetch = useCallback<RefetchFn>(\n (variablesSubset, options?: PrivateRefetchOptions) => {\n const variables = {\n ...fragmentReference.__fragments,\n ...variablesSubset,\n id: fragmentReference.id,\n };\n const observable = client.watchQuery({\n fetchPolicy: convertFetchPolicy(options?.fetchPolicy) ?? \"network-only\",\n query: executionQueryDocument,\n variables,\n });\n let subscription: ZenObservable.Subscription | undefined =\n observable.subscribe(\n ({ data, error, loading }) => {\n if (!loading) {\n // Be sure not to keep a retain cycle, so cleanup the reference first thing.\n subscription?.unsubscribe();\n subscription = undefined;\n disposable.current = undefined;\n }\n unstable_batchedUpdates(() => {\n if (!loading) {\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error || null, data);\n } else {\n options?.onCompleted?.(error || null); // Public callback fires only when finished loading\n }\n }\n if (!error) {\n const { id: _, ...variablesToPropagate } = variables;\n const nextVariables = {\n ...fragmentReference.__fragments,\n ...variablesToPropagate,\n };\n // No need to trigger an update to propagate new variables if they don't actually change.\n if (\n !isEqual(\n fragmentReferenceWithOwnVariables.__fragments,\n nextVariables,\n )\n ) {\n const nextFragmentReference: FragmentReference = {\n __fragments: nextVariables,\n };\n if (fragmentReference.id !== undefined) {\n nextFragmentReference.id = fragmentReference.id;\n }\n setFragmentReferenceWithOwnVariables(nextFragmentReference);\n }\n }\n });\n },\n (error) => {\n // Be sure not to keep a retain cycle\n subscription?.unsubscribe();\n subscription = undefined;\n\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error, null);\n } else {\n options?.onCompleted?.(error);\n }\n },\n );\n disposable.current = { dispose: () => subscription?.unsubscribe() };\n return disposable.current;\n },\n [\n client,\n executionQueryDocument,\n fragmentReference.id,\n fragmentReference.__fragments,\n fragmentReferenceWithOwnVariables.__fragments,\n ],\n );\n\n return [data, refetch];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyD;AACzD,uBAAwC;AACxC,uBAAsB;AACtB,iCAAoC;AACpC,oBAAwB;AACxB,gCAAmC;AACnC,+CAAkD;AAqC3C,SAAS,+BACd,WACA,mBACoC;AACpC,QAAM,EAAE,wBAAwB,SAAS,IAAI;AAC7C,uBAAAA;AAAA,IACE,YAAY,SAAS;AAAA,IACrB;AAAA,EAEF;AACA,uBAAAA;AAAA,IACE;AAAA,IACA;AAAA,IAGA,SAAS,aAAa;AAAA,EACxB;AAEA,QAAM,aAAS,4EAAkC;AAGjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,QAAI,uBAAS,iBAAiB;AAE9B,QAAM,WAAO;AAAA,IACX;AAAA,IACA;AAAA,EACF;AAEA,QAAM,iBAAa,qBAAmB;AACtC;AAAA,IACE,MAAM,MAAM;AAC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ACH;AAAA,QACA,CAAC,UAAU;AA1IrB,cAAAA;AA4IY,uDAAc;AACd,yBAAe;AAEf,cAAI,mCAAS,8BAA8B;AACzC,oBAAQ,6BAA6B,OAAO,IAAI;AAAA,UAClD,OAAO;AACL,aAAAA,MAAA,mCAAS,gBAAT,gBAAAA,IAAA,cAAuB;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AACF,iBAAW,UAAU,EAAE,SAAS,MAAM,6CAAc,cAAc;AAClE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB,kCAAkC;AAAA,IACpC;AAAA,EACF;AAEA,SAAO,CAAC,MAAM,OAAO;AACvB;",
6
6
  "names": ["invariant", "data", "_a"]
7
7
  }
@@ -56,34 +56,36 @@ function useCompiledRefetchableFragment(documents, fragmentReference) {
56
56
  subscription == null ? void 0 : subscription.unsubscribe();
57
57
  subscription = void 0;
58
58
  disposable.current = void 0;
59
- unstable_batchedUpdates(() => {
60
- var _a2;
59
+ }
60
+ unstable_batchedUpdates(() => {
61
+ var _a2;
62
+ if (!loading) {
61
63
  if (options == null ? void 0 : options.UNSTABLE_onCompletedWithData) {
62
64
  options.UNSTABLE_onCompletedWithData(error || null, data2);
63
65
  } else {
64
66
  (_a2 = options == null ? void 0 : options.onCompleted) == null ? void 0 : _a2.call(options, error || null);
65
67
  }
66
- if (!error) {
67
- const { id: _, ...variablesToPropagate } = variables;
68
- const nextVariables = {
69
- ...fragmentReference.__fragments,
70
- ...variablesToPropagate
68
+ }
69
+ if (!error) {
70
+ const { id: _, ...variablesToPropagate } = variables;
71
+ const nextVariables = {
72
+ ...fragmentReference.__fragments,
73
+ ...variablesToPropagate
74
+ };
75
+ if (!isEqual(
76
+ fragmentReferenceWithOwnVariables.__fragments,
77
+ nextVariables
78
+ )) {
79
+ const nextFragmentReference = {
80
+ __fragments: nextVariables
71
81
  };
72
- if (!isEqual(
73
- fragmentReferenceWithOwnVariables.__fragments,
74
- nextVariables
75
- )) {
76
- const nextFragmentReference = {
77
- __fragments: nextVariables
78
- };
79
- if (fragmentReference.id !== void 0) {
80
- nextFragmentReference.id = fragmentReference.id;
81
- }
82
- setFragmentReferenceWithOwnVariables(nextFragmentReference);
82
+ if (fragmentReference.id !== void 0) {
83
+ nextFragmentReference.id = fragmentReference.id;
83
84
  }
85
+ setFragmentReferenceWithOwnVariables(nextFragmentReference);
84
86
  }
85
- });
86
- }
87
+ }
88
+ });
87
89
  },
88
90
  (error) => {
89
91
  var _a2;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts"],
4
- "sourcesContent": ["import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { unstable_batchedUpdates } from \"react-dom\";\nimport invariant from \"invariant\";\nimport { useCompiledFragment } from \"./useCompiledFragment\";\nimport { isEqual } from \"lodash\";\nimport { convertFetchPolicy } from \"../../convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { FragmentReference } from \"./types\";\nimport type { FetchPolicy } from \"../../types\";\n\nexport interface Disposable {\n dispose(): void;\n}\n\nexport type RefetchFn<Variables extends object = object> = (\n variables: Partial<Variables>,\n options?: RefetchOptions,\n) => Disposable;\n\nexport interface RefetchOptions {\n onCompleted?: (error: Error | null) => void;\n fetchPolicy?: FetchPolicy;\n}\n\n/**\n * These do not exist in the Relay API and should not be exported from the package.\n */\nexport interface PrivateRefetchOptions\n extends Omit<RefetchOptions, \"fetchPolicy\"> {\n /**\n * Returns the fetched data.\n */\n UNSTABLE_onCompletedWithData?: (\n error: Error | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any> | null,\n ) => void;\n\n fetchPolicy?: FetchPolicy | \"no-cache\";\n}\n\nexport function useCompiledRefetchableFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): [data: object, refetch: RefetchFn] {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"useRefetchableFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"useRefetchableFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `useRefetchableFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n\n const client = useOverridenOrDefaultApolloClient();\n\n // We use state for this, so that...\n const [\n fragmentReferenceWithOwnVariables,\n setFragmentReferenceWithOwnVariables,\n ] = useState(fragmentReference);\n // ...this gets invoked again with updated variables.\n const data = useCompiledFragment(\n documents,\n fragmentReferenceWithOwnVariables,\n );\n\n const disposable = useRef<Disposable>();\n useEffect(\n () => () => {\n if (disposable.current) {\n disposable.current.dispose();\n disposable.current = undefined;\n }\n },\n [], // On unmount\n );\n\n const refetch = useCallback<RefetchFn>(\n (variablesSubset, options?: PrivateRefetchOptions) => {\n const variables = {\n ...fragmentReference.__fragments,\n ...variablesSubset,\n id: fragmentReference.id,\n };\n const observable = client.watchQuery({\n fetchPolicy: convertFetchPolicy(options?.fetchPolicy) ?? \"network-only\",\n query: executionQueryDocument,\n variables,\n });\n let subscription: ZenObservable.Subscription | undefined =\n observable.subscribe(\n ({ data, error, loading }) => {\n if (!loading) {\n // Be sure not to keep a retain cycle, so cleanup the reference first thing.\n subscription?.unsubscribe();\n subscription = undefined;\n disposable.current = undefined;\n\n unstable_batchedUpdates(() => {\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error || null, data);\n } else {\n options?.onCompleted?.(error || null);\n }\n if (!error) {\n const { id: _, ...variablesToPropagate } = variables;\n const nextVariables = {\n ...fragmentReference.__fragments,\n ...variablesToPropagate,\n };\n // No need to trigger an update to propagate new variables if they don't actually change.\n if (\n !isEqual(\n fragmentReferenceWithOwnVariables.__fragments,\n nextVariables,\n )\n ) {\n const nextFragmentReference: FragmentReference = {\n __fragments: nextVariables,\n };\n // Don't add an empty key if this is a fragment on the Query type.\n if (fragmentReference.id !== undefined) {\n nextFragmentReference.id = fragmentReference.id;\n }\n setFragmentReferenceWithOwnVariables(nextFragmentReference);\n }\n }\n });\n }\n },\n (error) => {\n // Be sure not to keep a retain cycle\n subscription?.unsubscribe();\n subscription = undefined;\n\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error, null);\n } else {\n options?.onCompleted?.(error);\n }\n },\n );\n disposable.current = { dispose: () => subscription?.unsubscribe() };\n return disposable.current;\n },\n [\n client,\n executionQueryDocument,\n fragmentReference.id,\n fragmentReference.__fragments,\n fragmentReferenceWithOwnVariables.__fragments,\n ],\n );\n\n return [data, refetch];\n}\n"],
5
- "mappings": ";AAAA,SAAS,UAAU,aAAa,QAAQ,iBAAiB;AACzD,SAAS,+BAA+B;AACxC,OAAO,eAAe;AACtB,SAAS,2BAA2B;AACpC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC,SAAS,yCAAyC;AAqC3C,SAAS,+BACd,WACA,mBACoC;AACpC,QAAM,EAAE,wBAAwB,SAAS,IAAI;AAC7C;AAAA,IACE,YAAY,SAAS;AAAA,IACrB;AAAA,EAEF;AACA;AAAA,IACE;AAAA,IACA;AAAA,IAGA,SAAS,aAAa;AAAA,EACxB;AAEA,QAAM,SAAS,kCAAkC;AAGjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI,SAAS,iBAAiB;AAE9B,QAAM,OAAO;AAAA,IACX;AAAA,IACA;AAAA,EACF;AAEA,QAAM,aAAa,OAAmB;AACtC;AAAA,IACE,MAAM,MAAM;AACV,UAAI,WAAW,SAAS;AACtB,mBAAW,QAAQ,QAAQ;AAC3B,mBAAW,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,IACA,CAAC;AAAA;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AO;AACL,aAAAA,MAAA,mCAAS,gBAAT,gBAAAA,IAAA,cAAuB;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AACF,iBAAW,UAAU,EAAE,SAAS,MAAM,6CAAc,cAAc;AAClE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB,kCAAkC;AAAA,IACpC;AAAA,EACF;AAEA,SAAO,CAAC,MAAM,OAAO;AACvB;",
4
+ "sourcesContent": ["import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { unstable_batchedUpdates } from \"react-dom\";\nimport invariant from \"invariant\";\nimport { useCompiledFragment } from \"./useCompiledFragment\";\nimport { isEqual } from \"lodash\";\nimport { convertFetchPolicy } from \"../../convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { FragmentReference } from \"./types\";\nimport type { FetchPolicy } from \"../../types\";\n\nexport interface Disposable {\n dispose(): void;\n}\n\nexport type RefetchFn<Variables extends object = object> = (\n variables: Partial<Variables>,\n options?: RefetchOptions,\n) => Disposable;\n\nexport interface RefetchOptions {\n onCompleted?: (error: Error | null) => void;\n fetchPolicy?: FetchPolicy;\n}\n\n/**\n * These do not exist in the Relay API and should not be exported from the package.\n */\nexport interface PrivateRefetchOptions\n extends Omit<RefetchOptions, \"fetchPolicy\"> {\n /**\n * Returns the fetched data.\n */\n UNSTABLE_onCompletedWithData?: (\n error: Error | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any> | null,\n ) => void;\n\n fetchPolicy?: FetchPolicy | \"no-cache\";\n}\n\nexport function useCompiledRefetchableFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): [data: object, refetch: RefetchFn] {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"useRefetchableFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"useRefetchableFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `useRefetchableFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n\n const client = useOverridenOrDefaultApolloClient();\n\n // We use state for this, so that...\n const [\n fragmentReferenceWithOwnVariables,\n setFragmentReferenceWithOwnVariables,\n ] = useState(fragmentReference);\n // ...this gets invoked again with updated variables.\n const data = useCompiledFragment(\n documents,\n fragmentReferenceWithOwnVariables,\n );\n\n const disposable = useRef<Disposable>();\n useEffect(\n () => () => {\n if (disposable.current) {\n disposable.current.dispose();\n disposable.current = undefined;\n }\n },\n [], // On unmount\n );\n\n const refetch = useCallback<RefetchFn>(\n (variablesSubset, options?: PrivateRefetchOptions) => {\n const variables = {\n ...fragmentReference.__fragments,\n ...variablesSubset,\n id: fragmentReference.id,\n };\n const observable = client.watchQuery({\n fetchPolicy: convertFetchPolicy(options?.fetchPolicy) ?? \"network-only\",\n query: executionQueryDocument,\n variables,\n });\n let subscription: ZenObservable.Subscription | undefined =\n observable.subscribe(\n ({ data, error, loading }) => {\n if (!loading) {\n // Be sure not to keep a retain cycle, so cleanup the reference first thing.\n subscription?.unsubscribe();\n subscription = undefined;\n disposable.current = undefined;\n }\n unstable_batchedUpdates(() => {\n if (!loading) {\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error || null, data);\n } else {\n options?.onCompleted?.(error || null); // Public callback fires only when finished loading\n }\n }\n if (!error) {\n const { id: _, ...variablesToPropagate } = variables;\n const nextVariables = {\n ...fragmentReference.__fragments,\n ...variablesToPropagate,\n };\n // No need to trigger an update to propagate new variables if they don't actually change.\n if (\n !isEqual(\n fragmentReferenceWithOwnVariables.__fragments,\n nextVariables,\n )\n ) {\n const nextFragmentReference: FragmentReference = {\n __fragments: nextVariables,\n };\n if (fragmentReference.id !== undefined) {\n nextFragmentReference.id = fragmentReference.id;\n }\n setFragmentReferenceWithOwnVariables(nextFragmentReference);\n }\n }\n });\n },\n (error) => {\n // Be sure not to keep a retain cycle\n subscription?.unsubscribe();\n subscription = undefined;\n\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error, null);\n } else {\n options?.onCompleted?.(error);\n }\n },\n );\n disposable.current = { dispose: () => subscription?.unsubscribe() };\n return disposable.current;\n },\n [\n client,\n executionQueryDocument,\n fragmentReference.id,\n fragmentReference.__fragments,\n fragmentReferenceWithOwnVariables.__fragments,\n ],\n );\n\n return [data, refetch];\n}\n"],
5
+ "mappings": ";AAAA,SAAS,UAAU,aAAa,QAAQ,iBAAiB;AACzD,SAAS,+BAA+B;AACxC,OAAO,eAAe;AACtB,SAAS,2BAA2B;AACpC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC,SAAS,yCAAyC;AAqC3C,SAAS,+BACd,WACA,mBACoC;AACpC,QAAM,EAAE,wBAAwB,SAAS,IAAI;AAC7C;AAAA,IACE,YAAY,SAAS;AAAA,IACrB;AAAA,EAEF;AACA;AAAA,IACE;AAAA,IACA;AAAA,IAGA,SAAS,aAAa;AAAA,EACxB;AAEA,QAAM,SAAS,kCAAkC;AAGjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI,SAAS,iBAAiB;AAE9B,QAAM,OAAO;AAAA,IACX;AAAA,IACA;AAAA,EACF;AAEA,QAAM,aAAa,OAAmB;AACtC;AAAA,IACE,MAAM,MAAM;AACV,UAAI,WAAW,SAAS;AACtB,mBAAW,QAAQ,QAAQ;AAC3B,mBAAW,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,IACA,CAAC;AAAA;AAAA,EACH;AAEA,QAAM,UAAU;AAAA,IACd,CAAC,iBAAiB,YAAoC;AAtF1D;AAuFM,YAAM,YAAY;AAAA,QAChB,GAAG,kBAAkB;AAAA,QACrB,GA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AAW,UAAU,EAAE,SAAS,MAAM,6CAAc,cAAc;AAClE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB,kCAAkC;AAAA,IACpC;AAAA,EACF;AAEA,SAAO,CAAC,MAAM,OAAO;AACvB;",
6
6
  "names": ["data", "_a"]
7
7
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphitation/apollo-react-relay-duct-tape",
3
3
  "description": "A compatibility wrapper that provides the react-relay API on top of Apollo Client.",
4
4
  "license": "MIT",
5
- "version": "1.4.1",
5
+ "version": "1.4.2",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/microsoft/graphitation.git",