@graphitation/apollo-react-relay-duct-tape 1.0.7 → 1.0.8

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__/nodeFromCacheFieldPolicy.test.ts":"8","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/index.ts":"9","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/types.ts":"10","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledFragment.ts":"11","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledLazyLoadQuery.ts":"12","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledPaginationFragment.ts":"13","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts":"14","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useDeepCompareMemoize.ts":"15","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useForceUpdate.ts":"16","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/fragmentReferencesFieldPolicy.ts":"17","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/index.ts":"18","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/nodeFromCacheFieldPolicy.ts":"19","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/shallowCompareFragmentReferences.ts":"20","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/typePolicies.ts":"21","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/types.ts":"22","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/useOverridenOrDefaultApolloClient.ts":"23"},{"size":11195,"mtime":1689212356892,"results":"24","hashOfConfig":"25"},{"size":1917,"mtime":1689212356892,"results":"26","hashOfConfig":"25"},{"size":690,"mtime":1689212356892,"results":"27","hashOfConfig":"25"},{"size":11338,"mtime":1689212356892,"results":"28","hashOfConfig":"25"},{"size":174,"mtime":1689212356892,"results":"29","hashOfConfig":"25"},{"size":33757,"mtime":1689212356896,"results":"30","hashOfConfig":"25"},{"size":1839,"mtime":1689212356896,"results":"31","hashOfConfig":"25"},{"size":3041,"mtime":1689212356896,"results":"32","hashOfConfig":"25"},{"size":445,"mtime":1689212356896,"results":"33","hashOfConfig":"25"},{"size":575,"mtime":1689212356896,"results":"34","hashOfConfig":"25"},{"size":2426,"mtime":1689212356896,"results":"35","hashOfConfig":"25"},{"size":3662,"mtime":1689212356896,"results":"36","hashOfConfig":"25"},{"size":9254,"mtime":1689212356896,"results":"37","hashOfConfig":"25"},{"size":5414,"mtime":1689212356896,"results":"38","hashOfConfig":"25"},{"size":843,"mtime":1689212356896,"results":"39","hashOfConfig":"25"},{"size":152,"mtime":1689212356896,"results":"40","hashOfConfig":"25"},{"size":286,"mtime":1689212356896,"results":"41","hashOfConfig":"25"},{"size":342,"mtime":1689212356896,"results":"42","hashOfConfig":"25"},{"size":2829,"mtime":1689212356896,"results":"43","hashOfConfig":"25"},{"size":2163,"mtime":1689212356896,"results":"44","hashOfConfig":"25"},{"size":1110,"mtime":1689212356896,"results":"45","hashOfConfig":"25"},{"size":2058,"mtime":1689212356896,"results":"46","hashOfConfig":"25"},{"size":1314,"mtime":1689212356896,"results":"47","hashOfConfig":"25"},{"filePath":"48","messages":"49","suppressedMessages":"50","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"m9c228",{"filePath":"51","messages":"52","suppressedMessages":"53","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"54","messages":"55","suppressedMessages":"56","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"57","messages":"58","suppressedMessages":"59","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"60","messages":"61","suppressedMessages":"62","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"63","messages":"64","suppressedMessages":"65","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"66","messages":"67","suppressedMessages":"68","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"69","messages":"70","suppressedMessages":"71","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"72","messages":"73","suppressedMessages":"74","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"75","messages":"76","suppressedMessages":"77","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"78","messages":"79","suppressedMessages":"80","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"81","messages":"82","suppressedMessages":"83","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"84","messages":"85","suppressedMessages":"86","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"87","messages":"88","suppressedMessages":"89","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"90","messages":"91","suppressedMessages":"92","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"93","messages":"94","suppressedMessages":"95","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"96","messages":"97","suppressedMessages":"98","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"99","messages":"100","suppressedMessages":"101","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"102","messages":"103","suppressedMessages":"104","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"105","messages":"106","suppressedMessages":"107","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"108","messages":"109","suppressedMessages":"110","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"111","messages":"112","suppressedMessages":"113","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"114","messages":"115","suppressedMessages":"116","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",[],["117"],"/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__/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",[],["118"],"/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",[],["119"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledPaginationFragment.ts",[],["120","121","122","123","124"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts",[],["125"],"/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/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",[],["126","127"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/useOverridenOrDefaultApolloClient.ts",[],["128"],{"ruleId":"129","severity":1,"message":"130","line":287,"column":38,"nodeType":"131","messageId":"132","endLine":287,"endColumn":41,"suggestions":"133","suppressions":"134"},{"ruleId":"129","severity":1,"message":"130","line":16,"column":32,"nodeType":"131","messageId":"132","endLine":16,"endColumn":35,"suggestions":"135","suppressions":"136"},{"ruleId":"129","severity":1,"message":"130","line":87,"column":28,"nodeType":"131","messageId":"132","endLine":87,"endColumn":31,"suggestions":"137","suppressions":"138"},{"ruleId":"129","severity":1,"message":"130","line":163,"column":24,"nodeType":"131","messageId":"132","endLine":163,"endColumn":27,"suggestions":"139","suppressions":"140"},{"ruleId":"129","severity":1,"message":"130","line":166,"column":4,"nodeType":"131","messageId":"132","endLine":166,"endColumn":7,"suggestions":"141","suppressions":"142"},{"ruleId":"129","severity":1,"message":"130","line":168,"column":30,"nodeType":"131","messageId":"132","endLine":168,"endColumn":33,"suggestions":"143","suppressions":"144"},{"ruleId":"129","severity":1,"message":"130","line":178,"column":24,"nodeType":"131","messageId":"132","endLine":178,"endColumn":27,"suggestions":"145","suppressions":"146"},{"ruleId":"129","severity":1,"message":"130","line":214,"column":9,"nodeType":"131","messageId":"132","endLine":214,"endColumn":12,"suggestions":"147","suppressions":"148"},{"ruleId":"129","severity":1,"message":"130","line":38,"column":26,"nodeType":"131","messageId":"132","endLine":38,"endColumn":29,"suggestions":"149","suppressions":"150"},{"ruleId":"129","severity":1,"message":"130","line":5,"column":19,"nodeType":"131","messageId":"132","endLine":5,"endColumn":22,"suggestions":"151","suppressions":"152"},{"ruleId":"129","severity":1,"message":"130","line":10,"column":19,"nodeType":"131","messageId":"132","endLine":10,"endColumn":22,"suggestions":"153","suppressions":"154"},{"ruleId":"129","severity":1,"message":"130","line":17,"column":51,"nodeType":"131","messageId":"132","endLine":17,"endColumn":54,"suggestions":"155","suppressions":"156"},"@typescript-eslint/no-explicit-any","Unexpected any. Specify a different type.","TSAnyKeyword","unexpectedAny",["157","158"],["159"],["160","161"],["162"],["163","164"],["165"],["166","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"],{"messageId":"193","fix":"194","desc":"195"},{"messageId":"196","fix":"197","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"201","desc":"195"},{"messageId":"196","fix":"202","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"203","desc":"195"},{"messageId":"196","fix":"204","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"205","desc":"195"},{"messageId":"196","fix":"206","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"207","desc":"195"},{"messageId":"196","fix":"208","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"209","desc":"195"},{"messageId":"196","fix":"210","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"211","desc":"195"},{"messageId":"196","fix":"212","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"213","desc":"195"},{"messageId":"196","fix":"214","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"215","desc":"195"},{"messageId":"196","fix":"216","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"217","desc":"195"},{"messageId":"196","fix":"218","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"219","desc":"195"},{"messageId":"196","fix":"220","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"221","desc":"195"},{"messageId":"196","fix":"222","desc":"198"},{"kind":"199","justification":"200"},"suggestUnknown",{"range":"223","text":"224"},"Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct.","suggestNever",{"range":"223","text":"225"},"Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.","directive","",{"range":"226","text":"224"},{"range":"226","text":"225"},{"range":"227","text":"224"},{"range":"227","text":"225"},{"range":"228","text":"224"},{"range":"228","text":"225"},{"range":"229","text":"224"},{"range":"229","text":"225"},{"range":"230","text":"224"},{"range":"230","text":"225"},{"range":"231","text":"224"},{"range":"231","text":"225"},{"range":"232","text":"224"},{"range":"232","text":"225"},{"range":"233","text":"224"},{"range":"233","text":"225"},{"range":"234","text":"224"},{"range":"234","text":"225"},{"range":"235","text":"224"},{"range":"235","text":"225"},{"range":"236","text":"224"},{"range":"236","text":"225"},[10788,10791],"unknown","never",[567,570],[2626,2629],[5394,5397],[5495,5498],[5595,5598],[5884,5887],[6948,6951],[1283,1286],[158,161],[276,279],[455,458]]
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__/nodeFromCacheFieldPolicy.test.ts":"8","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/index.ts":"9","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/types.ts":"10","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledFragment.ts":"11","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledLazyLoadQuery.ts":"12","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledPaginationFragment.ts":"13","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts":"14","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useDeepCompareMemoize.ts":"15","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useForceUpdate.ts":"16","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/fragmentReferencesFieldPolicy.ts":"17","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/index.ts":"18","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/nodeFromCacheFieldPolicy.ts":"19","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/shallowCompareFragmentReferences.ts":"20","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/typePolicies.ts":"21","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/types.ts":"22","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/useOverridenOrDefaultApolloClient.ts":"23"},{"size":11195,"mtime":1690011033926,"results":"24","hashOfConfig":"25"},{"size":1917,"mtime":1690011033926,"results":"26","hashOfConfig":"25"},{"size":690,"mtime":1690011033926,"results":"27","hashOfConfig":"25"},{"size":11575,"mtime":1690011033926,"results":"28","hashOfConfig":"25"},{"size":174,"mtime":1690011033926,"results":"29","hashOfConfig":"25"},{"size":33757,"mtime":1690011033926,"results":"30","hashOfConfig":"25"},{"size":1839,"mtime":1690011033926,"results":"31","hashOfConfig":"25"},{"size":3041,"mtime":1690011033926,"results":"32","hashOfConfig":"25"},{"size":445,"mtime":1690011033926,"results":"33","hashOfConfig":"25"},{"size":575,"mtime":1690011033926,"results":"34","hashOfConfig":"25"},{"size":2426,"mtime":1690011033926,"results":"35","hashOfConfig":"25"},{"size":3662,"mtime":1690011033926,"results":"36","hashOfConfig":"25"},{"size":9254,"mtime":1690011033926,"results":"37","hashOfConfig":"25"},{"size":5414,"mtime":1690011033926,"results":"38","hashOfConfig":"25"},{"size":843,"mtime":1690011033926,"results":"39","hashOfConfig":"25"},{"size":152,"mtime":1690011033926,"results":"40","hashOfConfig":"25"},{"size":286,"mtime":1690011033926,"results":"41","hashOfConfig":"25"},{"size":342,"mtime":1690011033926,"results":"42","hashOfConfig":"25"},{"size":2829,"mtime":1690011033926,"results":"43","hashOfConfig":"25"},{"size":2322,"mtime":1690011033926,"results":"44","hashOfConfig":"25"},{"size":1110,"mtime":1690011033926,"results":"45","hashOfConfig":"25"},{"size":2058,"mtime":1690011033926,"results":"46","hashOfConfig":"25"},{"size":1314,"mtime":1690011033926,"results":"47","hashOfConfig":"25"},{"filePath":"48","messages":"49","suppressedMessages":"50","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"m9c228",{"filePath":"51","messages":"52","suppressedMessages":"53","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"54","messages":"55","suppressedMessages":"56","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"57","messages":"58","suppressedMessages":"59","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"60","messages":"61","suppressedMessages":"62","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"63","messages":"64","suppressedMessages":"65","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"66","messages":"67","suppressedMessages":"68","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"69","messages":"70","suppressedMessages":"71","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"72","messages":"73","suppressedMessages":"74","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"75","messages":"76","suppressedMessages":"77","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"78","messages":"79","suppressedMessages":"80","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"81","messages":"82","suppressedMessages":"83","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"84","messages":"85","suppressedMessages":"86","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"87","messages":"88","suppressedMessages":"89","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"90","messages":"91","suppressedMessages":"92","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"93","messages":"94","suppressedMessages":"95","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"96","messages":"97","suppressedMessages":"98","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"99","messages":"100","suppressedMessages":"101","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"102","messages":"103","suppressedMessages":"104","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"105","messages":"106","suppressedMessages":"107","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"108","messages":"109","suppressedMessages":"110","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"111","messages":"112","suppressedMessages":"113","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"114","messages":"115","suppressedMessages":"116","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",[],["117"],"/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__/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",[],["118"],"/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",[],["119"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledPaginationFragment.ts",[],["120","121","122","123","124"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts",[],["125"],"/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/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",[],["126","127"],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/useOverridenOrDefaultApolloClient.ts",[],["128"],{"ruleId":"129","severity":1,"message":"130","line":295,"column":38,"nodeType":"131","messageId":"132","endLine":295,"endColumn":41,"suggestions":"133","suppressions":"134"},{"ruleId":"129","severity":1,"message":"130","line":16,"column":32,"nodeType":"131","messageId":"132","endLine":16,"endColumn":35,"suggestions":"135","suppressions":"136"},{"ruleId":"129","severity":1,"message":"130","line":87,"column":28,"nodeType":"131","messageId":"132","endLine":87,"endColumn":31,"suggestions":"137","suppressions":"138"},{"ruleId":"129","severity":1,"message":"130","line":163,"column":24,"nodeType":"131","messageId":"132","endLine":163,"endColumn":27,"suggestions":"139","suppressions":"140"},{"ruleId":"129","severity":1,"message":"130","line":166,"column":4,"nodeType":"131","messageId":"132","endLine":166,"endColumn":7,"suggestions":"141","suppressions":"142"},{"ruleId":"129","severity":1,"message":"130","line":168,"column":30,"nodeType":"131","messageId":"132","endLine":168,"endColumn":33,"suggestions":"143","suppressions":"144"},{"ruleId":"129","severity":1,"message":"130","line":178,"column":24,"nodeType":"131","messageId":"132","endLine":178,"endColumn":27,"suggestions":"145","suppressions":"146"},{"ruleId":"129","severity":1,"message":"130","line":214,"column":9,"nodeType":"131","messageId":"132","endLine":214,"endColumn":12,"suggestions":"147","suppressions":"148"},{"ruleId":"129","severity":1,"message":"130","line":38,"column":26,"nodeType":"131","messageId":"132","endLine":38,"endColumn":29,"suggestions":"149","suppressions":"150"},{"ruleId":"129","severity":1,"message":"130","line":5,"column":19,"nodeType":"131","messageId":"132","endLine":5,"endColumn":22,"suggestions":"151","suppressions":"152"},{"ruleId":"129","severity":1,"message":"130","line":10,"column":19,"nodeType":"131","messageId":"132","endLine":10,"endColumn":22,"suggestions":"153","suppressions":"154"},{"ruleId":"129","severity":1,"message":"130","line":17,"column":51,"nodeType":"131","messageId":"132","endLine":17,"endColumn":54,"suggestions":"155","suppressions":"156"},"@typescript-eslint/no-explicit-any","Unexpected any. Specify a different type.","TSAnyKeyword","unexpectedAny",["157","158"],["159"],["160","161"],["162"],["163","164"],["165"],["166","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"],{"messageId":"193","fix":"194","desc":"195"},{"messageId":"196","fix":"197","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"201","desc":"195"},{"messageId":"196","fix":"202","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"203","desc":"195"},{"messageId":"196","fix":"204","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"205","desc":"195"},{"messageId":"196","fix":"206","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"207","desc":"195"},{"messageId":"196","fix":"208","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"209","desc":"195"},{"messageId":"196","fix":"210","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"211","desc":"195"},{"messageId":"196","fix":"212","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"213","desc":"195"},{"messageId":"196","fix":"214","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"215","desc":"195"},{"messageId":"196","fix":"216","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"217","desc":"195"},{"messageId":"196","fix":"218","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"219","desc":"195"},{"messageId":"196","fix":"220","desc":"198"},{"kind":"199","justification":"200"},{"messageId":"193","fix":"221","desc":"195"},{"messageId":"196","fix":"222","desc":"198"},{"kind":"199","justification":"200"},"suggestUnknown",{"range":"223","text":"224"},"Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct.","suggestNever",{"range":"223","text":"225"},"Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.","directive","",{"range":"226","text":"224"},{"range":"226","text":"225"},{"range":"227","text":"224"},{"range":"227","text":"225"},{"range":"228","text":"224"},{"range":"228","text":"225"},{"range":"229","text":"224"},{"range":"229","text":"225"},{"range":"230","text":"224"},{"range":"230","text":"225"},{"range":"231","text":"224"},{"range":"231","text":"225"},{"range":"232","text":"224"},{"range":"232","text":"225"},{"range":"233","text":"224"},{"range":"233","text":"225"},{"range":"234","text":"224"},{"range":"234","text":"225"},{"range":"235","text":"224"},{"range":"235","text":"225"},{"range":"236","text":"224"},{"range":"236","text":"225"},[11025,11028],"unknown","never",[567,570],[2626,2629],[5394,5397],[5495,5498],[5595,5598],[5884,5887],[6948,6951],[1283,1286],[158,161],[276,279],[455,458]]
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @graphitation/apollo-react-relay-duct-tape
2
2
 
3
- This log was last generated on Thu, 13 Jul 2023 01:43:30 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 22 Jul 2023 07:35:01 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.0.8
8
+
9
+ Sat, 22 Jul 2023 07:35:01 GMT
10
+
11
+ ### Patches
12
+
13
+ - Fix type-checking (eloy.de.enige@gmail.com)
14
+ - Bump @graphitation/apollo-react-relay-duct-tape-compiler to v1.2.1
15
+
7
16
  ## 1.0.7
8
17
 
9
- Thu, 13 Jul 2023 01:43:30 GMT
18
+ Thu, 13 Jul 2023 01:43:35 GMT
10
19
 
11
20
  ### Patches
12
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,SAAS,EACT,YAAY,EAKb,MAAM,kCAAkC,CAAC;AAM1C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,SAAS,aAAa,EAC3D,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAC9B,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;CAAE,GACnE;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,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AAyB,CAAC,gBAAgB,CAAC,KACjD,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,gBAAgB,SAAS,aAAa,EAChE,QAAQ,EAAE,iBAAiB,GAC1B,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,CA4B/C"}
package/lib/hooks.js CHANGED
@@ -116,7 +116,11 @@ function useFragment(fragmentInput, fragmentRef) {
116
116
  }
117
117
  function useRefetchableFragment(fragmentInput, fragmentRef) {
118
118
  (0, import_invariant.default)(
119
- fragmentInput && fragmentInput.__brand === void 0,
119
+ fragmentInput,
120
+ "useRefetchableFragment: Missing metadata; did you forget to use the @refetchable directive?"
121
+ );
122
+ (0, import_invariant.default)(
123
+ fragmentInput.__brand === void 0,
120
124
  "useRefetchableFragment: fragmentInput must be a valid runtime type."
121
125
  );
122
126
  (0, import_invariant.default)(
@@ -130,7 +134,11 @@ function useRefetchableFragment(fragmentInput, fragmentRef) {
130
134
  }
131
135
  function usePaginationFragment(fragmentInput, fragmentRef) {
132
136
  (0, import_invariant.default)(
133
- fragmentInput && fragmentInput.__brand === void 0,
137
+ fragmentInput,
138
+ "usePaginationFragment: Missing metadata; did you forget to use the @refetchable directive?"
139
+ );
140
+ (0, import_invariant.default)(
141
+ fragmentInput.__brand === void 0,
134
142
  "usePaginationFragment: fragmentInput must be a valid runtime type."
135
143
  );
136
144
  (0, import_invariant.default)(
package/lib/hooks.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/hooks.ts"],
4
- "sourcesContent": ["import { DocumentNode } from \"graphql\";\nimport invariant from \"invariant\";\nimport {\n useSubscription as useApolloSubscription,\n useQuery as useApolloQuery,\n useMutation as useApolloMutation,\n SubscriptionHookOptions as ApolloSubscriptionHookOptions,\n ErrorPolicy as ApolloErrorPolicy,\n ApolloClient,\n} from \"@apollo/client\";\n\nimport {\n FetchPolicy,\n GraphQLTaggedNode,\n KeyType,\n KeyTypeData,\n OperationType,\n} from \"./types\";\nimport {\n RefetchFn,\n PaginationFn,\n useCompiledLazyLoadQuery,\n useCompiledFragment,\n useCompiledRefetchableFragment,\n useCompiledPaginationFragment,\n} from \"./storeObservation/compiledHooks\";\nimport { convertFetchPolicy } from \"./convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"./useOverridenOrDefaultApolloClient\";\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport { FragmentReference } from \"./storeObservation/compiledHooks/types\";\n\n/**\n * Executes a GraphQL query.\n *\n * This hook is called 'lazy' as it is used to fetch a GraphQL query _during_ render. This hook can trigger multiple\n * round trips, one for loading and one for resolving.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-lazy-load-query}\n *\n * @param query The query operation to perform.\n * @param variables Object containing the variable values to fetch the query. These variables need to match GraphQL\n * variables declared inside the query.\n * @param options Options passed on to the underlying implementation.\n * @param options.context The query context to pass along the apollo link chain. Should be avoided when possible as\n * it will not be compatible with Relay APIs.\n * @returns An object with either an error, the result data, or neither while loading.\n */\nexport function useLazyLoadQuery<TQuery extends OperationType>(\n query: GraphQLTaggedNode,\n variables: TQuery[\"variables\"],\n options?: { fetchPolicy?: FetchPolicy; context?: TQuery[\"context\"] },\n): { error?: Error; data?: TQuery[\"response\"] } {\n invariant(\n query?.__brand === undefined,\n \"useLazyLoadQuery: query must be a valid runtime type.\",\n );\n const apolloOptions = options && {\n ...options,\n fetchPolicy: convertFetchPolicy(options.fetchPolicy),\n };\n if (query.watchQueryDocument) {\n return useCompiledLazyLoadQuery(query as CompiledArtefactModule, {\n variables,\n ...apolloOptions,\n });\n } else {\n const client = useOverridenOrDefaultApolloClient();\n return useApolloQuery(\n // Compiled documents without narrow observables should be treated like\n // normal queries.\n query.executionQueryDocument || query,\n {\n client,\n variables,\n ...apolloOptions,\n },\n );\n }\n}\n\n/**\n * A first-class way for an individual component to express its direct data requirements using GraphQL. The fragment\n * should select all the fields that the component directly uses in its rendering or needs to pass to external\n * functions. It should *not* select data that its children need, unless those children are intended to remain their\n * pure React props as data inputs.\n *\n * For children that *do* have their own data requirements expressed using GraphQL, the fragment should ensure to\n * spread in the child's fragment.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-fragment}\n *\n * @note For migration purposes, this hook supports the notion that the fragment reference can be undefined. This is\n * to support cases where useFragment is used in a tree that is conditionally using fragments.\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections.\n */\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): KeyTypeData<TKey>;\nexport function useFragment(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: undefined,\n): undefined;\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey | undefined,\n): KeyTypeData<TKey> | undefined;\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode | undefined,\n fragmentRef: TKey,\n): KeyTypeData<TKey> {\n invariant(\n fragmentInput?.__brand === undefined,\n \"useFragment: fragmentInput must be a valid runtime type.\",\n );\n // If fragmentInput is undefined, it means the fragment is not compiled and we should just return the fragmentRef.\n // This is an implementation detail that should never surface to the user.\n if (fragmentInput && fragmentInput.watchQueryDocument) {\n return useCompiledFragment(fragmentInput, fragmentRef as FragmentReference);\n } else {\n return fragmentRef as unknown;\n }\n}\n\n/**\n * Equivalent to `useFragment`, but allows refetching of its subtree of the overall query.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-refetchable-fragment}\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections and a function to perform the refetch.\n */\nexport function useRefetchableFragment<\n TQuery extends OperationType,\n TKey extends KeyType,\n>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): [data: KeyTypeData<TKey>, refetch: RefetchFn<TQuery[\"variables\"]>] {\n invariant(\n fragmentInput && fragmentInput.__brand === undefined,\n \"useRefetchableFragment: fragmentInput must be a valid runtime type.\",\n );\n invariant(\n !!fragmentInput.watchQueryDocument,\n \"useRefetchableFragment is only supported at this time when using compilation\",\n );\n return useCompiledRefetchableFragment(\n fragmentInput as CompiledArtefactModule,\n fragmentRef as FragmentReference,\n );\n}\n\n/**\n * Equivalent to `useFragment`, but allows pagination of its subtree of the overall query.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-pagination-fragment}\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections and functions to deal with pagination.\n */\nexport function usePaginationFragment<\n TQuery extends OperationType,\n TKey extends KeyType,\n>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): {\n data: KeyTypeData<TKey>;\n loadNext: PaginationFn;\n loadPrevious: PaginationFn;\n hasNext: boolean;\n hasPrevious: boolean;\n isLoadingNext: boolean;\n isLoadingPrevious: boolean;\n refetch: RefetchFn<TQuery[\"variables\"]>;\n} {\n invariant(\n fragmentInput && fragmentInput.__brand === undefined,\n \"usePaginationFragment: fragmentInput must be a valid runtime type.\",\n );\n invariant(\n !!fragmentInput.watchQueryDocument,\n \"usePaginationFragment is only supported at this time when using compilation\",\n );\n return useCompiledPaginationFragment(\n fragmentInput as CompiledArtefactModule,\n fragmentRef as FragmentReference,\n );\n}\n\n// https://github.com/facebook/relay/blob/master/website/docs/api-reference/types/GraphQLSubscriptionConfig.md\ninterface GraphQLSubscriptionConfig<\n TSubscriptionPayload extends OperationType,\n> {\n subscription: GraphQLTaggedNode;\n variables: TSubscriptionPayload[\"variables\"];\n /**\n * Should be avoided when possible as it will not be compatible with Relay APIs.\n */\n context?: TSubscriptionPayload[\"context\"];\n /**\n * Should response be nullable?\n */\n onNext?: (response: TSubscriptionPayload[\"response\"]) => void;\n onError?: (error: Error) => void;\n}\n\n/**\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-subscription}\n *\n * @param config\n */\nexport function useSubscription<TSubscriptionPayload extends OperationType>(\n config: GraphQLSubscriptionConfig<TSubscriptionPayload>,\n): void {\n const client = useOverridenOrDefaultApolloClient();\n const { error } = useApolloSubscription(\n // TODO: Right now we don't replace mutation documents with imported artefacts.\n config.subscription as DocumentNode,\n {\n client,\n variables: config.variables,\n context: config.context,\n onSubscriptionData: ({ subscriptionData }) => {\n // Supposedly this never gets triggered for an error by design:\n // https://github.com/apollographql/react-apollo/issues/3177#issuecomment-506758144\n invariant(\n !subscriptionData.error,\n \"Did not expect to receive an error here\",\n );\n if (subscriptionData.data && config.onNext) {\n config.onNext(subscriptionData.data);\n }\n },\n errorPolicy: \"ignore\",\n } as ApolloSubscriptionHookOptions & {\n errorPolicy: ApolloErrorPolicy;\n },\n );\n if (error) {\n if (config.onError) {\n config.onError(error);\n } else {\n console.warn(\n `An unhandled GraphQL subscription error occurred: ${error.message}`,\n );\n }\n }\n}\n\ninterface IMutationCommitterOptions<TMutationPayload extends OperationType> {\n variables: TMutationPayload[\"variables\"];\n /**\n * Should be avoided when possible as it will not be compatible with Relay APIs.\n */\n context?: TMutationPayload[\"context\"];\n optimisticResponse?: Partial<TMutationPayload[\"response\"]> | null;\n}\n\ntype MutationCommiter<TMutationPayload extends OperationType> = (\n options: IMutationCommitterOptions<TMutationPayload>,\n) => Promise<{ errors?: Error[]; data?: TMutationPayload[\"response\"] }>;\n\n/**\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-mutation}\n *\n * @param mutation\n * @returns\n */\nexport function useMutation<TMutationPayload extends OperationType>(\n mutation: GraphQLTaggedNode,\n): [MutationCommiter<TMutationPayload>, boolean] {\n const client = useOverridenOrDefaultApolloClient();\n const [apolloUpdater, { loading: mutationLoading }] = useApolloMutation(\n // TODO: Right now we don't replace mutation documents with imported artefacts.\n mutation as DocumentNode,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n { client: client as ApolloClient<any> },\n );\n\n return [\n async (options: IMutationCommitterOptions<TMutationPayload>) => {\n const apolloResult = await apolloUpdater({\n variables: options.variables || {},\n context: options.context,\n optimisticResponse: options.optimisticResponse,\n });\n if (apolloResult.errors) {\n return {\n errors: Array.from(Object.values(apolloResult.errors)),\n data: apolloResult.data,\n };\n }\n return {\n data: apolloResult.data,\n };\n },\n mutationLoading,\n ];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,uBAAsB;AACtB,oBAOO;AASP,2BAOO;AACP,gCAAmC;AACnC,+CAAkD;AAoB3C,SAAS,iBACd,OACA,WACA,SAC8C;AAC9C,uBAAAA;AAAA,KACE,+BAAO,aAAY;AAAA,IACnB;AAAA,EACF;AACA,QAAM,gBAAgB,WAAW,iCAC5B,UAD4B;AAAA,IAE/B,iBAAa,8CAAmB,QAAQ,WAAW;AAAA,EACrD;AACA,MAAI,MAAM,oBAAoB;AAC5B,eAAO,+CAAyB,OAAiC;AAAA,MAC/D;AAAA,OACG,cACJ;AAAA,EACH,OAAO;AACL,UAAM,aAAS,4EAAkC;AACjD,eAAO,cAAAC;AAAA;AAAA;AAAA,MAGL,MAAM,0BAA0B;AAAA,MAChC;AAAA,QACE;AAAA,QACA;AAAA,SACG;AAAA,IAEP;AAA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BO,SAAS,YACd,UAC+C;AAC/C,QAAM,aAAS,4EAAkC;AACjD,QAAM,CAAC,eAAe,EAAE,SAAS,gBAAgB,CAAC,QAAI,cAAAG;AAAA;AAAA,IAEpD;AAAA;AAAA,IAEA,EAAE,OAAoC;AAAA,EACxC;AAEA,SAAO;AAAA,IACL,CAAO,YAAyD;AAC9D,YAAM,eAAe,MAAM,cAAc;AAAA,QACvC,WAAW,QAAQ,aAAa,CAAC;AAAA,QACjC,SAAS,QAAQ;AAAA,QACjB,oBAAoB,QAAQ;AAAA,MAC9B,CAAC;AACD,UAAI,aAAa,QAAQ;AACvB,eAAO;AAAA,UACL,QAAQ,MAAM,KAAK,OAAO,OAAO,aAAa,MAAM,CAAC;AAAA,UACrD,MAAM,aAAa;AAAA,QACrB;AAAA,MACF;AACA,aAAO;AAAA,QACL,MAAM,aAAa;AAAA,MACrB;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { DocumentNode } from \"graphql\";\nimport invariant from \"invariant\";\nimport {\n useSubscription as useApolloSubscription,\n useQuery as useApolloQuery,\n useMutation as useApolloMutation,\n SubscriptionHookOptions as ApolloSubscriptionHookOptions,\n ErrorPolicy as ApolloErrorPolicy,\n ApolloClient,\n} from \"@apollo/client\";\n\nimport {\n FetchPolicy,\n GraphQLTaggedNode,\n KeyType,\n KeyTypeData,\n OperationType,\n} from \"./types\";\nimport {\n RefetchFn,\n PaginationFn,\n useCompiledLazyLoadQuery,\n useCompiledFragment,\n useCompiledRefetchableFragment,\n useCompiledPaginationFragment,\n} from \"./storeObservation/compiledHooks\";\nimport { convertFetchPolicy } from \"./convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"./useOverridenOrDefaultApolloClient\";\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport { FragmentReference } from \"./storeObservation/compiledHooks/types\";\n\n/**\n * Executes a GraphQL query.\n *\n * This hook is called 'lazy' as it is used to fetch a GraphQL query _during_ render. This hook can trigger multiple\n * round trips, one for loading and one for resolving.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-lazy-load-query}\n *\n * @param query The query operation to perform.\n * @param variables Object containing the variable values to fetch the query. These variables need to match GraphQL\n * variables declared inside the query.\n * @param options Options passed on to the underlying implementation.\n * @param options.context The query context to pass along the apollo link chain. Should be avoided when possible as\n * it will not be compatible with Relay APIs.\n * @returns An object with either an error, the result data, or neither while loading.\n */\nexport function useLazyLoadQuery<TQuery extends OperationType>(\n query: GraphQLTaggedNode,\n variables: TQuery[\"variables\"],\n options?: { fetchPolicy?: FetchPolicy; context?: TQuery[\"context\"] },\n): { error?: Error; data?: TQuery[\"response\"] } {\n invariant(\n query?.__brand === undefined,\n \"useLazyLoadQuery: query must be a valid runtime type.\",\n );\n const apolloOptions = options && {\n ...options,\n fetchPolicy: convertFetchPolicy(options.fetchPolicy),\n };\n if (query.watchQueryDocument) {\n return useCompiledLazyLoadQuery(query as CompiledArtefactModule, {\n variables,\n ...apolloOptions,\n });\n } else {\n const client = useOverridenOrDefaultApolloClient();\n return useApolloQuery(\n // Compiled documents without narrow observables should be treated like\n // normal queries.\n query.executionQueryDocument || query,\n {\n client,\n variables,\n ...apolloOptions,\n },\n );\n }\n}\n\n/**\n * A first-class way for an individual component to express its direct data requirements using GraphQL. The fragment\n * should select all the fields that the component directly uses in its rendering or needs to pass to external\n * functions. It should *not* select data that its children need, unless those children are intended to remain their\n * pure React props as data inputs.\n *\n * For children that *do* have their own data requirements expressed using GraphQL, the fragment should ensure to\n * spread in the child's fragment.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-fragment}\n *\n * @note For migration purposes, this hook supports the notion that the fragment reference can be undefined. This is\n * to support cases where useFragment is used in a tree that is conditionally using fragments.\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections.\n */\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): KeyTypeData<TKey>;\nexport function useFragment(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: undefined,\n): undefined;\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey | undefined,\n): KeyTypeData<TKey> | undefined;\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode | undefined,\n fragmentRef: TKey,\n): KeyTypeData<TKey> {\n invariant(\n fragmentInput?.__brand === undefined,\n \"useFragment: fragmentInput must be a valid runtime type.\",\n );\n // If fragmentInput is undefined, it means the fragment is not compiled and we should just return the fragmentRef.\n // This is an implementation detail that should never surface to the user.\n if (fragmentInput && fragmentInput.watchQueryDocument) {\n return useCompiledFragment(fragmentInput, fragmentRef as FragmentReference);\n } else {\n return fragmentRef as unknown;\n }\n}\n\n/**\n * Equivalent to `useFragment`, but allows refetching of its subtree of the overall query.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-refetchable-fragment}\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections and a function to perform the refetch.\n */\nexport function useRefetchableFragment<\n TQuery extends OperationType,\n TKey extends KeyType,\n>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): [data: KeyTypeData<TKey>, refetch: RefetchFn<TQuery[\"variables\"]>] {\n invariant(\n fragmentInput,\n \"useRefetchableFragment: Missing metadata; did you forget to use the @refetchable directive?\",\n );\n invariant(\n fragmentInput.__brand === undefined,\n \"useRefetchableFragment: fragmentInput must be a valid runtime type.\",\n );\n invariant(\n !!fragmentInput.watchQueryDocument,\n \"useRefetchableFragment is only supported at this time when using compilation\",\n );\n return useCompiledRefetchableFragment(\n fragmentInput as CompiledArtefactModule,\n fragmentRef as FragmentReference,\n );\n}\n\n/**\n * Equivalent to `useFragment`, but allows pagination of its subtree of the overall query.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-pagination-fragment}\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections and functions to deal with pagination.\n */\nexport function usePaginationFragment<\n TQuery extends OperationType,\n TKey extends KeyType,\n>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): {\n data: KeyTypeData<TKey>;\n loadNext: PaginationFn;\n loadPrevious: PaginationFn;\n hasNext: boolean;\n hasPrevious: boolean;\n isLoadingNext: boolean;\n isLoadingPrevious: boolean;\n refetch: RefetchFn<TQuery[\"variables\"]>;\n} {\n invariant(\n fragmentInput,\n \"usePaginationFragment: Missing metadata; did you forget to use the @refetchable directive?\",\n );\n invariant(\n fragmentInput.__brand === undefined,\n \"usePaginationFragment: fragmentInput must be a valid runtime type.\",\n );\n invariant(\n !!fragmentInput.watchQueryDocument,\n \"usePaginationFragment is only supported at this time when using compilation\",\n );\n return useCompiledPaginationFragment(\n fragmentInput as CompiledArtefactModule,\n fragmentRef as FragmentReference,\n );\n}\n\n// https://github.com/facebook/relay/blob/master/website/docs/api-reference/types/GraphQLSubscriptionConfig.md\ninterface GraphQLSubscriptionConfig<\n TSubscriptionPayload extends OperationType,\n> {\n subscription: GraphQLTaggedNode;\n variables: TSubscriptionPayload[\"variables\"];\n /**\n * Should be avoided when possible as it will not be compatible with Relay APIs.\n */\n context?: TSubscriptionPayload[\"context\"];\n /**\n * Should response be nullable?\n */\n onNext?: (response: TSubscriptionPayload[\"response\"]) => void;\n onError?: (error: Error) => void;\n}\n\n/**\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-subscription}\n *\n * @param config\n */\nexport function useSubscription<TSubscriptionPayload extends OperationType>(\n config: GraphQLSubscriptionConfig<TSubscriptionPayload>,\n): void {\n const client = useOverridenOrDefaultApolloClient();\n const { error } = useApolloSubscription(\n // TODO: Right now we don't replace mutation documents with imported artefacts.\n config.subscription as DocumentNode,\n {\n client,\n variables: config.variables,\n context: config.context,\n onSubscriptionData: ({ subscriptionData }) => {\n // Supposedly this never gets triggered for an error by design:\n // https://github.com/apollographql/react-apollo/issues/3177#issuecomment-506758144\n invariant(\n !subscriptionData.error,\n \"Did not expect to receive an error here\",\n );\n if (subscriptionData.data && config.onNext) {\n config.onNext(subscriptionData.data);\n }\n },\n errorPolicy: \"ignore\",\n } as ApolloSubscriptionHookOptions & {\n errorPolicy: ApolloErrorPolicy;\n },\n );\n if (error) {\n if (config.onError) {\n config.onError(error);\n } else {\n console.warn(\n `An unhandled GraphQL subscription error occurred: ${error.message}`,\n );\n }\n }\n}\n\ninterface IMutationCommitterOptions<TMutationPayload extends OperationType> {\n variables: TMutationPayload[\"variables\"];\n /**\n * Should be avoided when possible as it will not be compatible with Relay APIs.\n */\n context?: TMutationPayload[\"context\"];\n optimisticResponse?: Partial<TMutationPayload[\"response\"]> | null;\n}\n\ntype MutationCommiter<TMutationPayload extends OperationType> = (\n options: IMutationCommitterOptions<TMutationPayload>,\n) => Promise<{ errors?: Error[]; data?: TMutationPayload[\"response\"] }>;\n\n/**\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-mutation}\n *\n * @param mutation\n * @returns\n */\nexport function useMutation<TMutationPayload extends OperationType>(\n mutation: GraphQLTaggedNode,\n): [MutationCommiter<TMutationPayload>, boolean] {\n const client = useOverridenOrDefaultApolloClient();\n const [apolloUpdater, { loading: mutationLoading }] = useApolloMutation(\n // TODO: Right now we don't replace mutation documents with imported artefacts.\n mutation as DocumentNode,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n { client: client as ApolloClient<any> },\n );\n\n return [\n async (options: IMutationCommitterOptions<TMutationPayload>) => {\n const apolloResult = await apolloUpdater({\n variables: options.variables || {},\n context: options.context,\n optimisticResponse: options.optimisticResponse,\n });\n if (apolloResult.errors) {\n return {\n errors: Array.from(Object.values(apolloResult.errors)),\n data: apolloResult.data,\n };\n }\n return {\n data: apolloResult.data,\n };\n },\n mutationLoading,\n ];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,uBAAsB;AACtB,oBAOO;AASP,2BAOO;AACP,gCAAmC;AACnC,+CAAkD;AAoB3C,SAAS,iBACd,OACA,WACA,SAC8C;AAC9C,uBAAAA;AAAA,KACE,+BAAO,aAAY;AAAA,IACnB;AAAA,EACF;AACA,QAAM,gBAAgB,WAAW,iCAC5B,UAD4B;AAAA,IAE/B,iBAAa,8CAAmB,QAAQ,WAAW;AAAA,EACrD;AACA,MAAI,MAAM,oBAAoB;AAC5B,eAAO,+CAAyB,OAAiC;AAAA,MAC/D;AAAA,OACG,cACJ;AAAA,EACH,OAAO;AACL,UAAM,aAAS,4EAAkC;AACjD,eAAO,cAAAC;AAAA;AAAA;AAAA,MAGL,MAAM,0BAA0B;AAAA,MAChC;AAAA,QACE;AAAA,QACA;AAAA,SACG;AAAA,IAEP;AAAA,EACF;AACF;AAiCO,SAAS,YACd,eACA,aACmB;AACnB,uBAAAD;AAAA,KACE,+CAAe,aAAY;AAAA,IAC3B;AAAA,EACF;AAGA,MAAI,iBAAiB,cAAc,oBAAoB;AACrD,eAAO,0CAAoB,eAAe,WAAgC;AAAA,EAC5E,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAYO,SAAS,uBAId,eACA,aACoE;AACpE,uBAAAA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AACA,uBAAAA;AAAA,IACE,cAAc,YAAY;AAAA,IAC1B;AAAA,EACF;AACA,uBAAAA;AAAA,IACE,CAAC,CAAC,cA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oBAAoB,QAAQ;AAAA,MAC9B,CAAC;AACD,UAAI,aAAa,QAAQ;AACvB,eAAO;AAAA,UACL,QAAQ,MAAM,KAAK,OAAO,OAAO,aAAa,MAAM,CAAC;AAAA,UACrD,MAAM,aAAa;AAAA,QACrB;AAAA,MACF;AACA,aAAO;AAAA,QACL,MAAM,aAAa;AAAA,MACrB;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": ["invariant", "useApolloQuery", "useApolloSubscription", "useApolloMutation"]
7
7
  }
package/lib/hooks.mjs CHANGED
@@ -91,7 +91,11 @@ function useFragment(fragmentInput, fragmentRef) {
91
91
  }
92
92
  function useRefetchableFragment(fragmentInput, fragmentRef) {
93
93
  invariant(
94
- fragmentInput && fragmentInput.__brand === void 0,
94
+ fragmentInput,
95
+ "useRefetchableFragment: Missing metadata; did you forget to use the @refetchable directive?"
96
+ );
97
+ invariant(
98
+ fragmentInput.__brand === void 0,
95
99
  "useRefetchableFragment: fragmentInput must be a valid runtime type."
96
100
  );
97
101
  invariant(
@@ -105,7 +109,11 @@ function useRefetchableFragment(fragmentInput, fragmentRef) {
105
109
  }
106
110
  function usePaginationFragment(fragmentInput, fragmentRef) {
107
111
  invariant(
108
- fragmentInput && fragmentInput.__brand === void 0,
112
+ fragmentInput,
113
+ "usePaginationFragment: Missing metadata; did you forget to use the @refetchable directive?"
114
+ );
115
+ invariant(
116
+ fragmentInput.__brand === void 0,
109
117
  "usePaginationFragment: fragmentInput must be a valid runtime type."
110
118
  );
111
119
  invariant(
package/lib/hooks.mjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/hooks.ts"],
4
- "sourcesContent": ["import { DocumentNode } from \"graphql\";\nimport invariant from \"invariant\";\nimport {\n useSubscription as useApolloSubscription,\n useQuery as useApolloQuery,\n useMutation as useApolloMutation,\n SubscriptionHookOptions as ApolloSubscriptionHookOptions,\n ErrorPolicy as ApolloErrorPolicy,\n ApolloClient,\n} from \"@apollo/client\";\n\nimport {\n FetchPolicy,\n GraphQLTaggedNode,\n KeyType,\n KeyTypeData,\n OperationType,\n} from \"./types\";\nimport {\n RefetchFn,\n PaginationFn,\n useCompiledLazyLoadQuery,\n useCompiledFragment,\n useCompiledRefetchableFragment,\n useCompiledPaginationFragment,\n} from \"./storeObservation/compiledHooks\";\nimport { convertFetchPolicy } from \"./convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"./useOverridenOrDefaultApolloClient\";\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport { FragmentReference } from \"./storeObservation/compiledHooks/types\";\n\n/**\n * Executes a GraphQL query.\n *\n * This hook is called 'lazy' as it is used to fetch a GraphQL query _during_ render. This hook can trigger multiple\n * round trips, one for loading and one for resolving.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-lazy-load-query}\n *\n * @param query The query operation to perform.\n * @param variables Object containing the variable values to fetch the query. These variables need to match GraphQL\n * variables declared inside the query.\n * @param options Options passed on to the underlying implementation.\n * @param options.context The query context to pass along the apollo link chain. Should be avoided when possible as\n * it will not be compatible with Relay APIs.\n * @returns An object with either an error, the result data, or neither while loading.\n */\nexport function useLazyLoadQuery<TQuery extends OperationType>(\n query: GraphQLTaggedNode,\n variables: TQuery[\"variables\"],\n options?: { fetchPolicy?: FetchPolicy; context?: TQuery[\"context\"] },\n): { error?: Error; data?: TQuery[\"response\"] } {\n invariant(\n query?.__brand === undefined,\n \"useLazyLoadQuery: query must be a valid runtime type.\",\n );\n const apolloOptions = options && {\n ...options,\n fetchPolicy: convertFetchPolicy(options.fetchPolicy),\n };\n if (query.watchQueryDocument) {\n return useCompiledLazyLoadQuery(query as CompiledArtefactModule, {\n variables,\n ...apolloOptions,\n });\n } else {\n const client = useOverridenOrDefaultApolloClient();\n return useApolloQuery(\n // Compiled documents without narrow observables should be treated like\n // normal queries.\n query.executionQueryDocument || query,\n {\n client,\n variables,\n ...apolloOptions,\n },\n );\n }\n}\n\n/**\n * A first-class way for an individual component to express its direct data requirements using GraphQL. The fragment\n * should select all the fields that the component directly uses in its rendering or needs to pass to external\n * functions. It should *not* select data that its children need, unless those children are intended to remain their\n * pure React props as data inputs.\n *\n * For children that *do* have their own data requirements expressed using GraphQL, the fragment should ensure to\n * spread in the child's fragment.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-fragment}\n *\n * @note For migration purposes, this hook supports the notion that the fragment reference can be undefined. This is\n * to support cases where useFragment is used in a tree that is conditionally using fragments.\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections.\n */\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): KeyTypeData<TKey>;\nexport function useFragment(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: undefined,\n): undefined;\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey | undefined,\n): KeyTypeData<TKey> | undefined;\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode | undefined,\n fragmentRef: TKey,\n): KeyTypeData<TKey> {\n invariant(\n fragmentInput?.__brand === undefined,\n \"useFragment: fragmentInput must be a valid runtime type.\",\n );\n // If fragmentInput is undefined, it means the fragment is not compiled and we should just return the fragmentRef.\n // This is an implementation detail that should never surface to the user.\n if (fragmentInput && fragmentInput.watchQueryDocument) {\n return useCompiledFragment(fragmentInput, fragmentRef as FragmentReference);\n } else {\n return fragmentRef as unknown;\n }\n}\n\n/**\n * Equivalent to `useFragment`, but allows refetching of its subtree of the overall query.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-refetchable-fragment}\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections and a function to perform the refetch.\n */\nexport function useRefetchableFragment<\n TQuery extends OperationType,\n TKey extends KeyType,\n>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): [data: KeyTypeData<TKey>, refetch: RefetchFn<TQuery[\"variables\"]>] {\n invariant(\n fragmentInput && fragmentInput.__brand === undefined,\n \"useRefetchableFragment: fragmentInput must be a valid runtime type.\",\n );\n invariant(\n !!fragmentInput.watchQueryDocument,\n \"useRefetchableFragment is only supported at this time when using compilation\",\n );\n return useCompiledRefetchableFragment(\n fragmentInput as CompiledArtefactModule,\n fragmentRef as FragmentReference,\n );\n}\n\n/**\n * Equivalent to `useFragment`, but allows pagination of its subtree of the overall query.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-pagination-fragment}\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections and functions to deal with pagination.\n */\nexport function usePaginationFragment<\n TQuery extends OperationType,\n TKey extends KeyType,\n>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): {\n data: KeyTypeData<TKey>;\n loadNext: PaginationFn;\n loadPrevious: PaginationFn;\n hasNext: boolean;\n hasPrevious: boolean;\n isLoadingNext: boolean;\n isLoadingPrevious: boolean;\n refetch: RefetchFn<TQuery[\"variables\"]>;\n} {\n invariant(\n fragmentInput && fragmentInput.__brand === undefined,\n \"usePaginationFragment: fragmentInput must be a valid runtime type.\",\n );\n invariant(\n !!fragmentInput.watchQueryDocument,\n \"usePaginationFragment is only supported at this time when using compilation\",\n );\n return useCompiledPaginationFragment(\n fragmentInput as CompiledArtefactModule,\n fragmentRef as FragmentReference,\n );\n}\n\n// https://github.com/facebook/relay/blob/master/website/docs/api-reference/types/GraphQLSubscriptionConfig.md\ninterface GraphQLSubscriptionConfig<\n TSubscriptionPayload extends OperationType,\n> {\n subscription: GraphQLTaggedNode;\n variables: TSubscriptionPayload[\"variables\"];\n /**\n * Should be avoided when possible as it will not be compatible with Relay APIs.\n */\n context?: TSubscriptionPayload[\"context\"];\n /**\n * Should response be nullable?\n */\n onNext?: (response: TSubscriptionPayload[\"response\"]) => void;\n onError?: (error: Error) => void;\n}\n\n/**\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-subscription}\n *\n * @param config\n */\nexport function useSubscription<TSubscriptionPayload extends OperationType>(\n config: GraphQLSubscriptionConfig<TSubscriptionPayload>,\n): void {\n const client = useOverridenOrDefaultApolloClient();\n const { error } = useApolloSubscription(\n // TODO: Right now we don't replace mutation documents with imported artefacts.\n config.subscription as DocumentNode,\n {\n client,\n variables: config.variables,\n context: config.context,\n onSubscriptionData: ({ subscriptionData }) => {\n // Supposedly this never gets triggered for an error by design:\n // https://github.com/apollographql/react-apollo/issues/3177#issuecomment-506758144\n invariant(\n !subscriptionData.error,\n \"Did not expect to receive an error here\",\n );\n if (subscriptionData.data && config.onNext) {\n config.onNext(subscriptionData.data);\n }\n },\n errorPolicy: \"ignore\",\n } as ApolloSubscriptionHookOptions & {\n errorPolicy: ApolloErrorPolicy;\n },\n );\n if (error) {\n if (config.onError) {\n config.onError(error);\n } else {\n console.warn(\n `An unhandled GraphQL subscription error occurred: ${error.message}`,\n );\n }\n }\n}\n\ninterface IMutationCommitterOptions<TMutationPayload extends OperationType> {\n variables: TMutationPayload[\"variables\"];\n /**\n * Should be avoided when possible as it will not be compatible with Relay APIs.\n */\n context?: TMutationPayload[\"context\"];\n optimisticResponse?: Partial<TMutationPayload[\"response\"]> | null;\n}\n\ntype MutationCommiter<TMutationPayload extends OperationType> = (\n options: IMutationCommitterOptions<TMutationPayload>,\n) => Promise<{ errors?: Error[]; data?: TMutationPayload[\"response\"] }>;\n\n/**\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-mutation}\n *\n * @param mutation\n * @returns\n */\nexport function useMutation<TMutationPayload extends OperationType>(\n mutation: GraphQLTaggedNode,\n): [MutationCommiter<TMutationPayload>, boolean] {\n const client = useOverridenOrDefaultApolloClient();\n const [apolloUpdater, { loading: mutationLoading }] = useApolloMutation(\n // TODO: Right now we don't replace mutation documents with imported artefacts.\n mutation as DocumentNode,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n { client: client as ApolloClient<any> },\n );\n\n return [\n async (options: IMutationCommitterOptions<TMutationPayload>) => {\n const apolloResult = await apolloUpdater({\n variables: options.variables || {},\n context: options.context,\n optimisticResponse: options.optimisticResponse,\n });\n if (apolloResult.errors) {\n return {\n errors: Array.from(Object.values(apolloResult.errors)),\n data: apolloResult.data,\n };\n }\n return {\n data: apolloResult.data,\n };\n },\n mutationLoading,\n ];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,eAAe;AACtB;AAAA,EACE,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,eAAe;AAAA,OAIV;AASP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,yCAAyC;AAoB3C,SAAS,iBACd,OACA,WACA,SAC8C;AAC9C;AAAA,KACE,+BAAO,aAAY;AAAA,IACnB;AAAA,EACF;AACA,QAAM,gBAAgB,WAAW,iCAC5B,UAD4B;AAAA,IAE/B,aAAa,mBAAmB,QAAQ,WAAW;AAAA,EACrD;AACA,MAAI,MAAM,oBAAoB;AAC5B,WAAO,yBAAyB,OAAiC;AAAA,MAC/D;AAAA,OACG,cACJ;AAAA,EACH,OAAO;AACL,UAAM,SAAS,kCAAkC;AACjD,WAAO;AAAA;AAAA;AAAA,MAGL,MAAM,0BAA0B;AAAA,MAChC;AAAA,QACE;AAAA,QACA;AAAA,SACG;AAAA,IAEP;AAAA,EACF;AACF;AAiCO,SAAS,YACd,eAC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gB,CAAC,IAAI;AAAA;AAAA,IAEpD;AAAA;AAAA,IAEA,EAAE,OAAoC;AAAA,EACxC;AAEA,SAAO;AAAA,IACL,CAAO,YAAyD;AAC9D,YAAM,eAAe,MAAM,cAAc;AAAA,QACvC,WAAW,QAAQ,aAAa,CAAC;AAAA,QACjC,SAAS,QAAQ;AAAA,QACjB,oBAAoB,QAAQ;AAAA,MAC9B,CAAC;AACD,UAAI,aAAa,QAAQ;AACvB,eAAO;AAAA,UACL,QAAQ,MAAM,KAAK,OAAO,OAAO,aAAa,MAAM,CAAC;AAAA,UACrD,MAAM,aAAa;AAAA,QACrB;AAAA,MACF;AACA,aAAO;AAAA,QACL,MAAM,aAAa;AAAA,MACrB;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { DocumentNode } from \"graphql\";\nimport invariant from \"invariant\";\nimport {\n useSubscription as useApolloSubscription,\n useQuery as useApolloQuery,\n useMutation as useApolloMutation,\n SubscriptionHookOptions as ApolloSubscriptionHookOptions,\n ErrorPolicy as ApolloErrorPolicy,\n ApolloClient,\n} from \"@apollo/client\";\n\nimport {\n FetchPolicy,\n GraphQLTaggedNode,\n KeyType,\n KeyTypeData,\n OperationType,\n} from \"./types\";\nimport {\n RefetchFn,\n PaginationFn,\n useCompiledLazyLoadQuery,\n useCompiledFragment,\n useCompiledRefetchableFragment,\n useCompiledPaginationFragment,\n} from \"./storeObservation/compiledHooks\";\nimport { convertFetchPolicy } from \"./convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"./useOverridenOrDefaultApolloClient\";\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport { FragmentReference } from \"./storeObservation/compiledHooks/types\";\n\n/**\n * Executes a GraphQL query.\n *\n * This hook is called 'lazy' as it is used to fetch a GraphQL query _during_ render. This hook can trigger multiple\n * round trips, one for loading and one for resolving.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-lazy-load-query}\n *\n * @param query The query operation to perform.\n * @param variables Object containing the variable values to fetch the query. These variables need to match GraphQL\n * variables declared inside the query.\n * @param options Options passed on to the underlying implementation.\n * @param options.context The query context to pass along the apollo link chain. Should be avoided when possible as\n * it will not be compatible with Relay APIs.\n * @returns An object with either an error, the result data, or neither while loading.\n */\nexport function useLazyLoadQuery<TQuery extends OperationType>(\n query: GraphQLTaggedNode,\n variables: TQuery[\"variables\"],\n options?: { fetchPolicy?: FetchPolicy; context?: TQuery[\"context\"] },\n): { error?: Error; data?: TQuery[\"response\"] } {\n invariant(\n query?.__brand === undefined,\n \"useLazyLoadQuery: query must be a valid runtime type.\",\n );\n const apolloOptions = options && {\n ...options,\n fetchPolicy: convertFetchPolicy(options.fetchPolicy),\n };\n if (query.watchQueryDocument) {\n return useCompiledLazyLoadQuery(query as CompiledArtefactModule, {\n variables,\n ...apolloOptions,\n });\n } else {\n const client = useOverridenOrDefaultApolloClient();\n return useApolloQuery(\n // Compiled documents without narrow observables should be treated like\n // normal queries.\n query.executionQueryDocument || query,\n {\n client,\n variables,\n ...apolloOptions,\n },\n );\n }\n}\n\n/**\n * A first-class way for an individual component to express its direct data requirements using GraphQL. The fragment\n * should select all the fields that the component directly uses in its rendering or needs to pass to external\n * functions. It should *not* select data that its children need, unless those children are intended to remain their\n * pure React props as data inputs.\n *\n * For children that *do* have their own data requirements expressed using GraphQL, the fragment should ensure to\n * spread in the child's fragment.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-fragment}\n *\n * @note For migration purposes, this hook supports the notion that the fragment reference can be undefined. This is\n * to support cases where useFragment is used in a tree that is conditionally using fragments.\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections.\n */\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): KeyTypeData<TKey>;\nexport function useFragment(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: undefined,\n): undefined;\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey | undefined,\n): KeyTypeData<TKey> | undefined;\nexport function useFragment<TKey extends KeyType>(\n fragmentInput: GraphQLTaggedNode | undefined,\n fragmentRef: TKey,\n): KeyTypeData<TKey> {\n invariant(\n fragmentInput?.__brand === undefined,\n \"useFragment: fragmentInput must be a valid runtime type.\",\n );\n // If fragmentInput is undefined, it means the fragment is not compiled and we should just return the fragmentRef.\n // This is an implementation detail that should never surface to the user.\n if (fragmentInput && fragmentInput.watchQueryDocument) {\n return useCompiledFragment(fragmentInput, fragmentRef as FragmentReference);\n } else {\n return fragmentRef as unknown;\n }\n}\n\n/**\n * Equivalent to `useFragment`, but allows refetching of its subtree of the overall query.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-refetchable-fragment}\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections and a function to perform the refetch.\n */\nexport function useRefetchableFragment<\n TQuery extends OperationType,\n TKey extends KeyType,\n>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): [data: KeyTypeData<TKey>, refetch: RefetchFn<TQuery[\"variables\"]>] {\n invariant(\n fragmentInput,\n \"useRefetchableFragment: Missing metadata; did you forget to use the @refetchable directive?\",\n );\n invariant(\n fragmentInput.__brand === undefined,\n \"useRefetchableFragment: fragmentInput must be a valid runtime type.\",\n );\n invariant(\n !!fragmentInput.watchQueryDocument,\n \"useRefetchableFragment is only supported at this time when using compilation\",\n );\n return useCompiledRefetchableFragment(\n fragmentInput as CompiledArtefactModule,\n fragmentRef as FragmentReference,\n );\n}\n\n/**\n * Equivalent to `useFragment`, but allows pagination of its subtree of the overall query.\n *\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-pagination-fragment}\n *\n * @param fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.\n * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's\n * fragment.\n * @returns The data corresponding to the field selections and functions to deal with pagination.\n */\nexport function usePaginationFragment<\n TQuery extends OperationType,\n TKey extends KeyType,\n>(\n fragmentInput: GraphQLTaggedNode,\n fragmentRef: TKey,\n): {\n data: KeyTypeData<TKey>;\n loadNext: PaginationFn;\n loadPrevious: PaginationFn;\n hasNext: boolean;\n hasPrevious: boolean;\n isLoadingNext: boolean;\n isLoadingPrevious: boolean;\n refetch: RefetchFn<TQuery[\"variables\"]>;\n} {\n invariant(\n fragmentInput,\n \"usePaginationFragment: Missing metadata; did you forget to use the @refetchable directive?\",\n );\n invariant(\n fragmentInput.__brand === undefined,\n \"usePaginationFragment: fragmentInput must be a valid runtime type.\",\n );\n invariant(\n !!fragmentInput.watchQueryDocument,\n \"usePaginationFragment is only supported at this time when using compilation\",\n );\n return useCompiledPaginationFragment(\n fragmentInput as CompiledArtefactModule,\n fragmentRef as FragmentReference,\n );\n}\n\n// https://github.com/facebook/relay/blob/master/website/docs/api-reference/types/GraphQLSubscriptionConfig.md\ninterface GraphQLSubscriptionConfig<\n TSubscriptionPayload extends OperationType,\n> {\n subscription: GraphQLTaggedNode;\n variables: TSubscriptionPayload[\"variables\"];\n /**\n * Should be avoided when possible as it will not be compatible with Relay APIs.\n */\n context?: TSubscriptionPayload[\"context\"];\n /**\n * Should response be nullable?\n */\n onNext?: (response: TSubscriptionPayload[\"response\"]) => void;\n onError?: (error: Error) => void;\n}\n\n/**\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-subscription}\n *\n * @param config\n */\nexport function useSubscription<TSubscriptionPayload extends OperationType>(\n config: GraphQLSubscriptionConfig<TSubscriptionPayload>,\n): void {\n const client = useOverridenOrDefaultApolloClient();\n const { error } = useApolloSubscription(\n // TODO: Right now we don't replace mutation documents with imported artefacts.\n config.subscription as DocumentNode,\n {\n client,\n variables: config.variables,\n context: config.context,\n onSubscriptionData: ({ subscriptionData }) => {\n // Supposedly this never gets triggered for an error by design:\n // https://github.com/apollographql/react-apollo/issues/3177#issuecomment-506758144\n invariant(\n !subscriptionData.error,\n \"Did not expect to receive an error here\",\n );\n if (subscriptionData.data && config.onNext) {\n config.onNext(subscriptionData.data);\n }\n },\n errorPolicy: \"ignore\",\n } as ApolloSubscriptionHookOptions & {\n errorPolicy: ApolloErrorPolicy;\n },\n );\n if (error) {\n if (config.onError) {\n config.onError(error);\n } else {\n console.warn(\n `An unhandled GraphQL subscription error occurred: ${error.message}`,\n );\n }\n }\n}\n\ninterface IMutationCommitterOptions<TMutationPayload extends OperationType> {\n variables: TMutationPayload[\"variables\"];\n /**\n * Should be avoided when possible as it will not be compatible with Relay APIs.\n */\n context?: TMutationPayload[\"context\"];\n optimisticResponse?: Partial<TMutationPayload[\"response\"]> | null;\n}\n\ntype MutationCommiter<TMutationPayload extends OperationType> = (\n options: IMutationCommitterOptions<TMutationPayload>,\n) => Promise<{ errors?: Error[]; data?: TMutationPayload[\"response\"] }>;\n\n/**\n * @see {@link https://microsoft.github.io/graphitation/docs/apollo-react-relay-duct-tape/use-mutation}\n *\n * @param mutation\n * @returns\n */\nexport function useMutation<TMutationPayload extends OperationType>(\n mutation: GraphQLTaggedNode,\n): [MutationCommiter<TMutationPayload>, boolean] {\n const client = useOverridenOrDefaultApolloClient();\n const [apolloUpdater, { loading: mutationLoading }] = useApolloMutation(\n // TODO: Right now we don't replace mutation documents with imported artefacts.\n mutation as DocumentNode,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n { client: client as ApolloClient<any> },\n );\n\n return [\n async (options: IMutationCommitterOptions<TMutationPayload>) => {\n const apolloResult = await apolloUpdater({\n variables: options.variables || {},\n context: options.context,\n optimisticResponse: options.optimisticResponse,\n });\n if (apolloResult.errors) {\n return {\n errors: Array.from(Object.values(apolloResult.errors)),\n data: apolloResult.data,\n };\n }\n return {\n data: apolloResult.data,\n };\n },\n mutationLoading,\n ];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,eAAe;AACtB;AAAA,EACE,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,eAAe;AAAA,OAIV;AASP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,yCAAyC;AAoB3C,SAAS,iBACd,OACA,WACA,SAC8C;AAC9C;AAAA,KACE,+BAAO,aAAY;AAAA,IACnB;AAAA,EACF;AACA,QAAM,gBAAgB,WAAW,iCAC5B,UAD4B;AAAA,IAE/B,aAAa,mBAAmB,QAAQ,WAAW;AAAA,EACrD;AACA,MAAI,MAAM,oBAAoB;AAC5B,WAAO,yBAAyB,OAAiC;AAAA,MAC/D;AAAA,OACG,cACJ;AAAA,EACH,OAAO;AACL,UAAM,SAAS,kCAAkC;AACjD,WAAO;AAAA;AAAA;AAAA,MAGL,MAAM,0BAA0B;AAAA,MAChC;AAAA,QACE;AAAA,QACA;AAAA,SACG;AAAA,IAEP;AAAA,EACF;AACF;AAiCO,SAAS,YACd,eACA,aACmB;AACnB;AAAA,KACE,+CAAe,aAAY;AAAA,IAC3B;AAAA,EACF;AAGA,MAAI,iBAAiB,cAAc,oBAAoB;AACrD,WAAO,oBAAoB,eAAe,WAAgC;AAAA,EAC5E,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAYO,SAAS,uBAId,eACA,aACoE;AACpE;AAAA,IACE;AAAA,IACA;AAAA,EACF;AACA;AAAA,IACE,cAAc,YAAY;AAAA,IAC1B;AAAA,EACF;AACA;AAAA,IACE,CAAC,CAAC,cAAc;AAAA,IAChB;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAYO,SAAS,sBAId,eACA,aAUA;AACA;AAAA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QACrB;AAAA,MACF;AACA,aAAO;AAAA,QACL,MAAM,aAAa;AAAA,MACrB;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -19,9 +19,9 @@
19
19
  * A comparator with parameters typed such that TS can verify the component
20
20
  * passed to React.memo() has props that match.
21
21
  */
22
- export declare function shallowCompareFragmentReferences<K extends string>(...fragmentReferenceProps: K[]): (prevProps: Record<K, {
23
- id?: unknown;
24
- }>, nextProps: Record<K, {
25
- id?: unknown;
26
- }>) => boolean;
22
+ export declare function shallowCompareFragmentReferences<K extends string, ComparatorParam extends {
23
+ [key in K]: {
24
+ " $fragmentRefs": unknown;
25
+ };
26
+ }>(...fragmentReferenceProps: K[]): (prevProps: ComparatorParam, nextProps: ComparatorParam) => boolean;
27
27
  //# sourceMappingURL=shallowCompareFragmentReferences.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shallowCompareFragmentReferences.d.ts","sourceRoot":"","sources":["../../src/storeObservation/shallowCompareFragmentReferences.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,MAAM,EAC/D,GAAG,sBAAsB,EAAE,CAAC,EAAE,eAGjB,OAAO,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,aAC3B,OAAO,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,aA2BzC"}
1
+ {"version":3,"file":"shallowCompareFragmentReferences.d.ts","sourceRoot":"","sources":["../../src/storeObservation/shallowCompareFragmentReferences.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gCAAgC,CAC9C,CAAC,SAAS,MAAM,EAChB,eAAe,SAAS;KAAG,GAAG,IAAI,CAAC,GAAG;QAAE,gBAAgB,EAAE,OAAO,CAAA;KAAE;CAAE,EAErE,GAAG,sBAAsB,EAAE,CAAC,EAAE,GAC7B,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,KAAK,OAAO,CA8BrE"}
@@ -44,7 +44,10 @@ function shallowCompareFragmentReferences(...fragmentReferenceProps) {
44
44
  }
45
45
  for (let i = 0; i < keysPrev.length; i++) {
46
46
  const checkKey = keysPrev[i];
47
- if (!Object.prototype.hasOwnProperty.call(nextProps, checkKey) || fragmentReferenceProps.includes(checkKey) ? !idsEqual(prevProps[checkKey], nextProps[checkKey]) : !Object.is(prevProps[checkKey], nextProps[checkKey])) {
47
+ if (!Object.prototype.hasOwnProperty.call(nextProps, checkKey) || fragmentReferenceProps.includes(checkKey) ? !idsEqual(
48
+ prevProps[checkKey],
49
+ nextProps[checkKey]
50
+ ) : !Object.is(prevProps[checkKey], nextProps[checkKey])) {
48
51
  return false;
49
52
  }
50
53
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/storeObservation/shallowCompareFragmentReferences.ts"],
4
- "sourcesContent": ["/**\n * Modified from https://github.com/facebook/react/blob/201af81b0168cabea3cc07cd8201378a4fec4aaf/packages/shared/shallowEqual.js\n * Copying is the suggested way, as mentioned here https://github.com/facebook/react/issues/16919\n */\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found at\n * https://github.com/facebook/react/blob/201af81b0168cabea3cc07cd8201378a4fec4aaf/LICENSE\n */\n\nimport invariant from \"invariant\";\n\n/**\n * A custom React.memo() comparator function factory that can be used with\n * components that use `useFragment` on a GraphQL type that implements the\n * `Node` interface, in which case only the `id` value needs to be equal to\n * avoid a re-render.\n *\n * @todo\n * Support arrays with fragment references\n *\n * @param fragmentReferenceProps\n * The props that refer to fragment references and should only be compared by\n * their [Node] ids.\n *\n * @returns\n * A comparator with parameters typed such that TS can verify the component\n * passed to React.memo() has props that match.\n */\nexport function shallowCompareFragmentReferences<K extends string>(\n ...fragmentReferenceProps: K[]\n) {\n return (\n prevProps: Record<K, { id?: unknown }>,\n nextProps: Record<K, { id?: unknown }>,\n ) => {\n if (Object.is(prevProps, nextProps)) {\n return true;\n }\n\n const keysPrev = Object.keys(prevProps);\n const keysNext = Object.keys(nextProps);\n\n if (keysPrev.length !== keysNext.length) {\n return false;\n }\n\n for (let i = 0; i < keysPrev.length; i++) {\n const checkKey = keysPrev[i] as K;\n if (\n !Object.prototype.hasOwnProperty.call(nextProps, checkKey) ||\n fragmentReferenceProps.includes(checkKey)\n ? !idsEqual(prevProps[checkKey], nextProps[checkKey])\n : !Object.is(prevProps[checkKey], nextProps[checkKey])\n ) {\n return false;\n }\n }\n\n return true;\n };\n}\n\nfunction idsEqual(objA: { id?: unknown }, objB: { id?: unknown }) {\n invariant(\n objA.id && objB.id,\n \"Expected both fragment reference objects to have an id field\",\n );\n return objA.id === objB.id;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,uBAAsB;AAmBf,SAAS,oCACX,wBACH;AACA,SAAO,CACL,WACA,cACG;AACH,QAAI,OAAO,GAAG,WAAW,SAAS,GAAG;AACnC,aAAO;AAAA,IACT;AAEA,UAAM,WAAW,OAAO,KAAK,SAAS;AACtC,UAAM,WAAW,OAAO,KAAK,SAAS;AAEtC,QAAI,SAAS,WAAW,SAAS,QAAQ;AACvC,aAAO;AAAA,IACT;AAEA,aAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,YAAM,WAAW,SAAS,CAAC;AAC3B,UACE,CAAC,OAAO,UAAU,eAAe,KAAK,WAAW,QAAQ,KACzD,uBAAuB,SAAS,QAAQ,IACpC,CAAC,SAAS,UAAU,QAAQ,GAAG,UAAU,QAAQ,CAAC,IAClD,CAAC,OAAO,GAAG,UAAU,QAAQ,GAAG,UAAU,QAAQ,CAAC,GACvD;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEA,SAAS,SAAS,MAAwB,MAAwB;AAChE,uBAAAA;AAAA,IACE,KAAK,MAAM,KAAK;AAAA,IAChB;AAAA,EACF;AACA,SAAO,KAAK,OAAO,KAAK;AAC1B;",
4
+ "sourcesContent": ["/**\n * Modified from https://github.com/facebook/react/blob/201af81b0168cabea3cc07cd8201378a4fec4aaf/packages/shared/shallowEqual.js\n * Copying is the suggested way, as mentioned here https://github.com/facebook/react/issues/16919\n */\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found at\n * https://github.com/facebook/react/blob/201af81b0168cabea3cc07cd8201378a4fec4aaf/LICENSE\n */\n\nimport invariant from \"invariant\";\n\n/**\n * A custom React.memo() comparator function factory that can be used with\n * components that use `useFragment` on a GraphQL type that implements the\n * `Node` interface, in which case only the `id` value needs to be equal to\n * avoid a re-render.\n *\n * @todo\n * Support arrays with fragment references\n *\n * @param fragmentReferenceProps\n * The props that refer to fragment references and should only be compared by\n * their [Node] ids.\n *\n * @returns\n * A comparator with parameters typed such that TS can verify the component\n * passed to React.memo() has props that match.\n */\nexport function shallowCompareFragmentReferences<\n K extends string,\n ComparatorParam extends { [key in K]: { \" $fragmentRefs\": unknown } },\n>(\n ...fragmentReferenceProps: K[]\n): (prevProps: ComparatorParam, nextProps: ComparatorParam) => boolean {\n return (prevProps, nextProps) => {\n if (Object.is(prevProps, nextProps)) {\n return true;\n }\n\n const keysPrev = Object.keys(prevProps);\n const keysNext = Object.keys(nextProps);\n\n if (keysPrev.length !== keysNext.length) {\n return false;\n }\n\n for (let i = 0; i < keysPrev.length; i++) {\n const checkKey = keysPrev[i] as K;\n if (\n !Object.prototype.hasOwnProperty.call(nextProps, checkKey) ||\n fragmentReferenceProps.includes(checkKey)\n ? !idsEqual(\n prevProps[checkKey] as { id?: unknown },\n nextProps[checkKey] as { id?: unknown },\n )\n : !Object.is(prevProps[checkKey], nextProps[checkKey])\n ) {\n return false;\n }\n }\n\n return true;\n };\n}\n\nfunction idsEqual(objA: { id?: unknown }, objB: { id?: unknown }) {\n invariant(\n objA.id && objB.id,\n \"Expected both fragment reference objects to have an id field\",\n );\n return objA.id === objB.id;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,uBAAsB;AAmBf,SAAS,oCAIX,wBACkE;AACrE,SAAO,CAAC,WAAW,cAAc;AAC/B,QAAI,OAAO,GAAG,WAAW,SAAS,GAAG;AACnC,aAAO;AAAA,IACT;AAEA,UAAM,WAAW,OAAO,KAAK,SAAS;AACtC,UAAM,WAAW,OAAO,KAAK,SAAS;AAEtC,QAAI,SAAS,WAAW,SAAS,QAAQ;AACvC,aAAO;AAAA,IACT;AAEA,aAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,YAAM,WAAW,SAAS,CAAC;AAC3B,UACE,CAAC,OAAO,UAAU,eAAe,KAAK,WAAW,QAAQ,KACzD,uBAAuB,SAAS,QAAQ,IACpC,CAAC;AAAA,QACC,UAAU,QAAQ;AAAA,QAClB,UAAU,QAAQ;AAAA,MACpB,IACA,CAAC,OAAO,GAAG,UAAU,QAAQ,GAAG,UAAU,QAAQ,CAAC,GACvD;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEA,SAAS,SAAS,MAAwB,MAAwB;AAChE,uBAAAA;AAAA,IACE,KAAK,MAAM,KAAK;AAAA,IAChB;AAAA,EACF;AACA,SAAO,KAAK,OAAO,KAAK;AAC1B;",
6
6
  "names": ["invariant"]
7
7
  }
@@ -12,7 +12,10 @@ function shallowCompareFragmentReferences(...fragmentReferenceProps) {
12
12
  }
13
13
  for (let i = 0; i < keysPrev.length; i++) {
14
14
  const checkKey = keysPrev[i];
15
- if (!Object.prototype.hasOwnProperty.call(nextProps, checkKey) || fragmentReferenceProps.includes(checkKey) ? !idsEqual(prevProps[checkKey], nextProps[checkKey]) : !Object.is(prevProps[checkKey], nextProps[checkKey])) {
15
+ if (!Object.prototype.hasOwnProperty.call(nextProps, checkKey) || fragmentReferenceProps.includes(checkKey) ? !idsEqual(
16
+ prevProps[checkKey],
17
+ nextProps[checkKey]
18
+ ) : !Object.is(prevProps[checkKey], nextProps[checkKey])) {
16
19
  return false;
17
20
  }
18
21
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/storeObservation/shallowCompareFragmentReferences.ts"],
4
- "sourcesContent": ["/**\n * Modified from https://github.com/facebook/react/blob/201af81b0168cabea3cc07cd8201378a4fec4aaf/packages/shared/shallowEqual.js\n * Copying is the suggested way, as mentioned here https://github.com/facebook/react/issues/16919\n */\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found at\n * https://github.com/facebook/react/blob/201af81b0168cabea3cc07cd8201378a4fec4aaf/LICENSE\n */\n\nimport invariant from \"invariant\";\n\n/**\n * A custom React.memo() comparator function factory that can be used with\n * components that use `useFragment` on a GraphQL type that implements the\n * `Node` interface, in which case only the `id` value needs to be equal to\n * avoid a re-render.\n *\n * @todo\n * Support arrays with fragment references\n *\n * @param fragmentReferenceProps\n * The props that refer to fragment references and should only be compared by\n * their [Node] ids.\n *\n * @returns\n * A comparator with parameters typed such that TS can verify the component\n * passed to React.memo() has props that match.\n */\nexport function shallowCompareFragmentReferences<K extends string>(\n ...fragmentReferenceProps: K[]\n) {\n return (\n prevProps: Record<K, { id?: unknown }>,\n nextProps: Record<K, { id?: unknown }>,\n ) => {\n if (Object.is(prevProps, nextProps)) {\n return true;\n }\n\n const keysPrev = Object.keys(prevProps);\n const keysNext = Object.keys(nextProps);\n\n if (keysPrev.length !== keysNext.length) {\n return false;\n }\n\n for (let i = 0; i < keysPrev.length; i++) {\n const checkKey = keysPrev[i] as K;\n if (\n !Object.prototype.hasOwnProperty.call(nextProps, checkKey) ||\n fragmentReferenceProps.includes(checkKey)\n ? !idsEqual(prevProps[checkKey], nextProps[checkKey])\n : !Object.is(prevProps[checkKey], nextProps[checkKey])\n ) {\n return false;\n }\n }\n\n return true;\n };\n}\n\nfunction idsEqual(objA: { id?: unknown }, objB: { id?: unknown }) {\n invariant(\n objA.id && objB.id,\n \"Expected both fragment reference objects to have an id field\",\n );\n return objA.id === objB.id;\n}\n"],
5
- "mappings": ";AAYA,OAAO,eAAe;AAmBf,SAAS,oCACX,wBACH;AACA,SAAO,CACL,WACA,cACG;AACH,QAAI,OAAO,GAAG,WAAW,SAAS,GAAG;AACnC,aAAO;AAAA,IACT;AAEA,UAAM,WAAW,OAAO,KAAK,SAAS;AACtC,UAAM,WAAW,OAAO,KAAK,SAAS;AAEtC,QAAI,SAAS,WAAW,SAAS,QAAQ;AACvC,aAAO;AAAA,IACT;AAEA,aAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,YAAM,WAAW,SAAS,CAAC;AAC3B,UACE,CAAC,OAAO,UAAU,eAAe,KAAK,WAAW,QAAQ,KACzD,uBAAuB,SAAS,QAAQ,IACpC,CAAC,SAAS,UAAU,QAAQ,GAAG,UAAU,QAAQ,CAAC,IAClD,CAAC,OAAO,GAAG,UAAU,QAAQ,GAAG,UAAU,QAAQ,CAAC,GACvD;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEA,SAAS,SAAS,MAAwB,MAAwB;AAChE;AAAA,IACE,KAAK,MAAM,KAAK;AAAA,IAChB;AAAA,EACF;AACA,SAAO,KAAK,OAAO,KAAK;AAC1B;",
4
+ "sourcesContent": ["/**\n * Modified from https://github.com/facebook/react/blob/201af81b0168cabea3cc07cd8201378a4fec4aaf/packages/shared/shallowEqual.js\n * Copying is the suggested way, as mentioned here https://github.com/facebook/react/issues/16919\n */\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found at\n * https://github.com/facebook/react/blob/201af81b0168cabea3cc07cd8201378a4fec4aaf/LICENSE\n */\n\nimport invariant from \"invariant\";\n\n/**\n * A custom React.memo() comparator function factory that can be used with\n * components that use `useFragment` on a GraphQL type that implements the\n * `Node` interface, in which case only the `id` value needs to be equal to\n * avoid a re-render.\n *\n * @todo\n * Support arrays with fragment references\n *\n * @param fragmentReferenceProps\n * The props that refer to fragment references and should only be compared by\n * their [Node] ids.\n *\n * @returns\n * A comparator with parameters typed such that TS can verify the component\n * passed to React.memo() has props that match.\n */\nexport function shallowCompareFragmentReferences<\n K extends string,\n ComparatorParam extends { [key in K]: { \" $fragmentRefs\": unknown } },\n>(\n ...fragmentReferenceProps: K[]\n): (prevProps: ComparatorParam, nextProps: ComparatorParam) => boolean {\n return (prevProps, nextProps) => {\n if (Object.is(prevProps, nextProps)) {\n return true;\n }\n\n const keysPrev = Object.keys(prevProps);\n const keysNext = Object.keys(nextProps);\n\n if (keysPrev.length !== keysNext.length) {\n return false;\n }\n\n for (let i = 0; i < keysPrev.length; i++) {\n const checkKey = keysPrev[i] as K;\n if (\n !Object.prototype.hasOwnProperty.call(nextProps, checkKey) ||\n fragmentReferenceProps.includes(checkKey)\n ? !idsEqual(\n prevProps[checkKey] as { id?: unknown },\n nextProps[checkKey] as { id?: unknown },\n )\n : !Object.is(prevProps[checkKey], nextProps[checkKey])\n ) {\n return false;\n }\n }\n\n return true;\n };\n}\n\nfunction idsEqual(objA: { id?: unknown }, objB: { id?: unknown }) {\n invariant(\n objA.id && objB.id,\n \"Expected both fragment reference objects to have an id field\",\n );\n return objA.id === objB.id;\n}\n"],
5
+ "mappings": ";AAYA,OAAO,eAAe;AAmBf,SAAS,oCAIX,wBACkE;AACrE,SAAO,CAAC,WAAW,cAAc;AAC/B,QAAI,OAAO,GAAG,WAAW,SAAS,GAAG;AACnC,aAAO;AAAA,IACT;AAEA,UAAM,WAAW,OAAO,KAAK,SAAS;AACtC,UAAM,WAAW,OAAO,KAAK,SAAS;AAEtC,QAAI,SAAS,WAAW,SAAS,QAAQ;AACvC,aAAO;AAAA,IACT;AAEA,aAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,YAAM,WAAW,SAAS,CAAC;AAC3B,UACE,CAAC,OAAO,UAAU,eAAe,KAAK,WAAW,QAAQ,KACzD,uBAAuB,SAAS,QAAQ,IACpC,CAAC;AAAA,QACC,UAAU,QAAQ;AAAA,QAClB,UAAU,QAAQ;AAAA,MACpB,IACA,CAAC,OAAO,GAAG,UAAU,QAAQ,GAAG,UAAU,QAAQ,CAAC,GACvD;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEA,SAAS,SAAS,MAAwB,MAAwB;AAChE;AAAA,IACE,KAAK,MAAM,KAAK;AAAA,IAChB;AAAA,EACF;AACA,SAAO,KAAK,OAAO,KAAK;AAC1B;",
6
6
  "names": []
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.0.7",
5
+ "version": "1.0.8",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/microsoft/graphitation.git",
@@ -30,7 +30,7 @@
30
30
  "graphql": "^15.0.0",
31
31
  "monorepo-scripts": "*",
32
32
  "react": "^17.0.2",
33
- "@graphitation/apollo-react-relay-duct-tape-compiler": "^1.2.0",
33
+ "@graphitation/apollo-react-relay-duct-tape-compiler": "^1.2.1",
34
34
  "ts-expect": "^1.3.0"
35
35
  },
36
36
  "peerDependencies": {