@graphitation/apollo-react-relay-duct-tape 1.0.1 → 1.0.3

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.
Files changed (45) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.md +18 -2
  3. package/lib/hooks.d.ts.map +1 -1
  4. package/lib/hooks.js +1 -0
  5. package/lib/hooks.js.map +2 -2
  6. package/lib/hooks.mjs +1 -0
  7. package/lib/hooks.mjs.map +2 -2
  8. package/lib/storeObservation/compiledHooks/types.d.ts.map +1 -1
  9. package/lib/storeObservation/compiledHooks/types.js.map +1 -1
  10. package/lib/storeObservation/compiledHooks/useCompiledFragment.d.ts +1 -1
  11. package/lib/storeObservation/compiledHooks/useCompiledFragment.d.ts.map +1 -1
  12. package/lib/storeObservation/compiledHooks/useCompiledFragment.js.map +2 -2
  13. package/lib/storeObservation/compiledHooks/useCompiledFragment.mjs.map +2 -2
  14. package/lib/storeObservation/compiledHooks/useCompiledLazyLoadQuery.d.ts +2 -2
  15. package/lib/storeObservation/compiledHooks/useCompiledLazyLoadQuery.d.ts.map +1 -1
  16. package/lib/storeObservation/compiledHooks/useCompiledLazyLoadQuery.js.map +2 -2
  17. package/lib/storeObservation/compiledHooks/useCompiledLazyLoadQuery.mjs.map +2 -2
  18. package/lib/storeObservation/compiledHooks/useCompiledPaginationFragment.d.ts.map +1 -1
  19. package/lib/storeObservation/compiledHooks/useCompiledPaginationFragment.js +1 -1
  20. package/lib/storeObservation/compiledHooks/useCompiledPaginationFragment.js.map +2 -2
  21. package/lib/storeObservation/compiledHooks/useCompiledPaginationFragment.mjs +1 -1
  22. package/lib/storeObservation/compiledHooks/useCompiledPaginationFragment.mjs.map +2 -2
  23. package/lib/storeObservation/compiledHooks/useCompiledRefetchableFragment.d.ts +2 -2
  24. package/lib/storeObservation/compiledHooks/useCompiledRefetchableFragment.d.ts.map +1 -1
  25. package/lib/storeObservation/compiledHooks/useCompiledRefetchableFragment.js +2 -2
  26. package/lib/storeObservation/compiledHooks/useCompiledRefetchableFragment.js.map +2 -2
  27. package/lib/storeObservation/compiledHooks/useCompiledRefetchableFragment.mjs +2 -2
  28. package/lib/storeObservation/compiledHooks/useCompiledRefetchableFragment.mjs.map +2 -2
  29. package/lib/storeObservation/nodeFromCacheFieldPolicy.js +6 -5
  30. package/lib/storeObservation/nodeFromCacheFieldPolicy.js.map +2 -2
  31. package/lib/storeObservation/nodeFromCacheFieldPolicy.mjs +6 -5
  32. package/lib/storeObservation/nodeFromCacheFieldPolicy.mjs.map +2 -2
  33. package/lib/storeObservation/shallowCompareFragmentReferences.d.ts +5 -1
  34. package/lib/storeObservation/shallowCompareFragmentReferences.d.ts.map +1 -1
  35. package/lib/storeObservation/shallowCompareFragmentReferences.js +1 -1
  36. package/lib/storeObservation/shallowCompareFragmentReferences.js.map +2 -2
  37. package/lib/storeObservation/shallowCompareFragmentReferences.mjs +1 -1
  38. package/lib/storeObservation/shallowCompareFragmentReferences.mjs.map +2 -2
  39. package/lib/types.d.ts.map +1 -1
  40. package/lib/types.js.map +1 -1
  41. package/lib/useOverridenOrDefaultApolloClient.d.ts +1 -1
  42. package/lib/useOverridenOrDefaultApolloClient.d.ts.map +1 -1
  43. package/lib/useOverridenOrDefaultApolloClient.js.map +2 -2
  44. package/lib/useOverridenOrDefaultApolloClient.mjs.map +2 -2
  45. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/storeObservation/compiledHooks/useCompiledPaginationFragment.ts"],
4
- "sourcesContent": ["import { useState, useCallback } from \"react\";\nimport { ApolloCache, DataProxy, StoreValue } from \"@apollo/client\";\nimport invariant from \"invariant\";\nimport { useCompiledRefetchableFragment } from \"./useCompiledRefetchableFragment\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { FragmentReference } from \"./types\";\nimport type {\n RefetchFn,\n Disposable,\n PrivateRefetchOptions,\n RefetchOptions,\n} from \"./useCompiledRefetchableFragment\";\nimport type {\n CompiledArtefactModule,\n Metadata,\n} from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { DocumentNode } from \"graphql\";\n\nexport type PaginationFn = (\n count: number,\n options?: RefetchOptions,\n) => Disposable;\n\ninterface PaginationParams {\n fragmentReference: FragmentReference;\n refetch: RefetchFn;\n metadata: Metadata;\n executionQueryDocument: DocumentNode;\n cache: ApolloCache<unknown>;\n countVariable: string | undefined;\n cursorVariable: string | undefined;\n connectionSelectionPath: string[];\n cursorValue: string | undefined;\n updater: <T>(existing: T[], incoming: T[]) => T[];\n}\n\nfunction useLoadMore({\n fragmentReference,\n refetch,\n metadata,\n executionQueryDocument,\n cache,\n countVariable,\n cursorVariable,\n connectionSelectionPath,\n cursorValue,\n updater,\n}: PaginationParams): [loadPage: PaginationFn, isLoadingMore: boolean] {\n const apolloClient = useOverridenOrDefaultApolloClient();\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n const loadPage = useCallback<PaginationFn>(\n (countValue, options) => {\n invariant(\n countVariable,\n \"usePaginationFragment(): Expected a count variable to exist\",\n );\n invariant(\n cursorVariable,\n \"usePaginationFragment(): Expected a cursor variable to exist\",\n );\n invariant(\n cursorValue,\n \"usePaginationFragment(): Expected a cursor value to exist\",\n );\n const previousVariables = {\n ...metadata.connection?.filterVariableDefaults,\n ...fragmentReference.__fragments,\n id: fragmentReference.id,\n };\n const newVariables = {\n ...previousVariables,\n [countVariable]: countValue,\n [cursorVariable]: cursorValue,\n };\n const refetchOptions: PrivateRefetchOptions = {\n fetchPolicy: \"no-cache\",\n UNSTABLE_onCompletedWithData: (error, data) => {\n // NOTE: We can do this now already, because `refetch` wraps the\n // onCompleted callback in a batchedUpdates callback.\n setIsLoadingMore(false);\n\n if (!error) {\n invariant(\n data,\n \"usePaginationFragment(): Expected to have response data\",\n );\n const newData = metadata.rootSelection\n ? data[metadata.rootSelection]\n : data;\n const mainFragment = metadata.mainFragment;\n invariant(\n mainFragment,\n \"usePaginationFragment(): Expected mainFragment metadata\",\n );\n const cacheSelector: DataProxy.Fragment<any, any> = {\n id: cache.identify({\n __typename: mainFragment.typeCondition,\n id: fragmentReference.id as StoreValue,\n }),\n variables: previousVariables,\n fragmentName: mainFragment.name,\n // Create new document with operation filtered out.\n fragment: {\n kind: \"Document\",\n definitions: executionQueryDocument.definitions.filter(\n (def) => def.kind === \"FragmentDefinition\",\n ),\n },\n };\n /**\n * Note: Even though we already have the latest data from the\n * useCompiledFragment hook, we can't really use that as it may contain\n * __fragments fields and we don't want to write those to the cache. If\n * we figure out a way from a field-policy's merge function to not write\n * to the cache, then that would be preferable.\n */\n const existingData = cache.readFragment(cacheSelector);\n const newCacheData = mergeEdges(\n connectionSelectionPath,\n newData,\n existingData,\n updater,\n );\n cache.writeFragment({\n ...cacheSelector,\n variables: newVariables,\n data: newCacheData,\n });\n }\n\n options?.onCompleted?.(error);\n },\n };\n // TODO: Measure if invoking `refetch` leads to React updates and if it\n // makes sense to wrap it and the following setIsLoadingMore(true)\n // call in a batchedUpdates callback.\n const disposable = refetch(\n newVariables,\n refetchOptions as RefetchOptions,\n );\n setIsLoadingMore(true);\n return disposable;\n },\n [\n fragmentReference.id,\n fragmentReference.__fragments,\n refetch,\n metadata,\n executionQueryDocument,\n cache,\n countVariable,\n cursorVariable,\n connectionSelectionPath,\n cursorValue,\n ],\n );\n return [loadPage, isLoadingMore];\n}\n\nfunction getValueAtSelectionPath(\n data: Record<string, any>,\n selectionPath: string[],\n): any {\n let object: Record<string, any> = data;\n selectionPath.forEach((field) => {\n object = object[field];\n invariant(object, \"Expected path to connection in response to exist\");\n });\n return object;\n}\n\nfunction getPageInfo(\n data: Record<string, any>,\n selectionPath: string[],\n): {\n startCursor?: string;\n endCursor?: string;\n hasPreviousPage?: boolean;\n hasNextPage?: boolean;\n} {\n const object = getValueAtSelectionPath(data, selectionPath);\n const pageInfo = object.pageInfo;\n invariant(pageInfo, \"Expected to find the connection's page info object\");\n return pageInfo;\n}\n\nfunction mergeEdges(\n connectionPath: string[],\n destination: {},\n source: {},\n updater: <T>(existing: T[], incoming: T[]) => T[],\n) {\n const edgesPath = [...connectionPath, \"edges\"];\n const existingEdges = getValueAtSelectionPath(source, edgesPath);\n const newEdges = getValueAtSelectionPath(destination, edgesPath);\n const allEdges = updater(existingEdges, newEdges);\n\n const connection = getValueAtSelectionPath(destination, connectionPath);\n connection[\"edges\"] = allEdges;\n\n return destination;\n}\n\nexport function useCompiledPaginationFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): {\n data: any;\n loadNext: PaginationFn;\n loadPrevious: PaginationFn;\n hasNext: boolean;\n hasPrevious: boolean;\n isLoadingNext: boolean;\n isLoadingPrevious: boolean;\n refetch: RefetchFn;\n} {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"usePaginationFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"usePaginationFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `usePaginationFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n const connectionMetadata = metadata.connection;\n invariant(\n connectionMetadata,\n \"usePaginationFragment: Expected fragment `%s` to include a \" +\n \"connection when using `usePaginationFragment`. Did you forget to add a @connection \" +\n \"directive to the connection field in the fragment?\",\n metadata.mainFragment.name,\n );\n const [data, refetch] = useCompiledRefetchableFragment(\n documents,\n fragmentReference,\n );\n const commonPaginationParams = {\n fragmentReference,\n refetch,\n metadata,\n executionQueryDocument,\n cache: useOverridenOrDefaultApolloClient().cache,\n connectionSelectionPath: connectionMetadata.selectionPath,\n };\n const pageInfo = getPageInfo(data, connectionMetadata.selectionPath);\n const [loadNext, isLoadingNext] = useLoadMore({\n ...commonPaginationParams,\n countVariable: connectionMetadata.forwardCountVariable,\n cursorVariable: connectionMetadata.forwardCursorVariable,\n cursorValue: pageInfo?.endCursor,\n updater: (existing, incoming) => [...existing, ...incoming],\n });\n const [loadPrevious, isLoadingPrevious] = useLoadMore({\n ...commonPaginationParams,\n countVariable: connectionMetadata.backwardCountVariable,\n cursorVariable: connectionMetadata.backwardCursorVariable,\n cursorValue: pageInfo?.startCursor,\n updater: (existing, incoming) => [...incoming, ...existing],\n });\n return {\n data,\n refetch,\n hasNext: !!pageInfo?.hasNextPage,\n hasPrevious: !!pageInfo?.hasPreviousPage,\n isLoadingNext,\n isLoadingPrevious,\n loadNext,\n loadPrevious,\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,mBAAmB;AAEtC,OAAO,eAAe;AACtB,SAAS,sCAAsC;AAC/C,SAAS,yCAAyC;AAiClD,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuE;AACrE,QAAM,eAAe,kCAAkC;AACvD,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,WAAW;AAAA,IACf,CAAC,YAAY,YAAY;AApD7B;AAqDM;AAAA,QACE;AAAA,QACA;AAAA,MACF;AACA;AAAA,QACE;AAAA,QACA;AAAA,MACF;AACA;AAAA,QACE;AAAA,QACA;AAAA,MACF;AACA,YAAM,oBAAoB,iDACrB,cAAS,eAAT,mBAAqB,yBACrB,kBAAkB,cAFG;AAAA,QAGxB,IAAI,kBAAkB;AAAA,MACxB;AACA,YAAM,eAAe,iCAChB,oBADgB;AAAA,QAEnB,CAAC,aAAa,GAAG;AAAA,QACjB,CAAC,cAAc,GAAG;AAAA,MACpB;AACA,YAAM,iBAAwC;AAAA,QAC5C,aAAa;AAAA,QACb,8BAA8B,CAAC,OAAO,SAAS;AA7EvD,cAAAA;AAgFU,2BAAiB,KAAK;AAEtB,cAAI,CAAC,OAAO;AACV;AAAA,cACE;AAAA,cACA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AAAA,IACnC,aAAa,qCAAU;AAAA,IACvB,SAAS,CAAC,UAAU,aAAa,CAAC,GAAG,UAAU,GAAG,QAAQ;AAAA,EAC5D,EAAC;AACD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,SAAS,CAAC,EAAC,qCAAU;AAAA,IACrB,aAAa,CAAC,EAAC,qCAAU;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { useState, useCallback } from \"react\";\nimport { ApolloCache, DataProxy, StoreValue } from \"@apollo/client\";\nimport invariant from \"invariant\";\nimport { useCompiledRefetchableFragment } from \"./useCompiledRefetchableFragment\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { FragmentReference } from \"./types\";\nimport type {\n RefetchFn,\n Disposable,\n PrivateRefetchOptions,\n RefetchOptions,\n} from \"./useCompiledRefetchableFragment\";\nimport type {\n CompiledArtefactModule,\n Metadata,\n} from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { DocumentNode } from \"graphql\";\n\nexport type PaginationFn = (\n count: number,\n options?: RefetchOptions,\n) => Disposable;\n\ninterface PaginationParams {\n fragmentReference: FragmentReference;\n refetch: RefetchFn;\n metadata: Metadata;\n executionQueryDocument: DocumentNode;\n cache: ApolloCache<unknown>;\n countVariable: string | undefined;\n cursorVariable: string | undefined;\n connectionSelectionPath: string[];\n cursorValue: string | undefined;\n updater: <T>(existing: T[], incoming: T[]) => T[];\n}\n\nfunction useLoadMore({\n fragmentReference,\n refetch,\n metadata,\n executionQueryDocument,\n cache,\n countVariable,\n cursorVariable,\n connectionSelectionPath,\n cursorValue,\n updater,\n}: PaginationParams): [loadPage: PaginationFn, isLoadingMore: boolean] {\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n const loadPage = useCallback<PaginationFn>(\n (countValue, options) => {\n invariant(\n countVariable,\n \"usePaginationFragment(): Expected a count variable to exist\",\n );\n invariant(\n cursorVariable,\n \"usePaginationFragment(): Expected a cursor variable to exist\",\n );\n invariant(\n cursorValue,\n \"usePaginationFragment(): Expected a cursor value to exist\",\n );\n const previousVariables = {\n ...metadata.connection?.filterVariableDefaults,\n ...fragmentReference.__fragments,\n id: fragmentReference.id,\n };\n const newVariables = {\n ...previousVariables,\n [countVariable]: countValue,\n [cursorVariable]: cursorValue,\n };\n const refetchOptions: PrivateRefetchOptions = {\n fetchPolicy: \"no-cache\",\n UNSTABLE_onCompletedWithData: (error, data) => {\n // NOTE: We can do this now already, because `refetch` wraps the\n // onCompleted callback in a batchedUpdates callback.\n setIsLoadingMore(false);\n\n if (!error) {\n invariant(\n data,\n \"usePaginationFragment(): Expected to have response data\",\n );\n const newData = metadata.rootSelection\n ? data[metadata.rootSelection]\n : data;\n const mainFragment = metadata.mainFragment;\n invariant(\n mainFragment,\n \"usePaginationFragment(): Expected mainFragment metadata\",\n );\n const cacheSelector: DataProxy.Fragment<unknown, object> = {\n id: cache.identify({\n __typename: mainFragment.typeCondition,\n id: fragmentReference.id as StoreValue,\n }),\n variables: previousVariables,\n fragmentName: mainFragment.name,\n // Create new document with operation filtered out.\n fragment: {\n kind: \"Document\",\n definitions: executionQueryDocument.definitions.filter(\n (def) => def.kind === \"FragmentDefinition\",\n ),\n },\n };\n /**\n * Note: Even though we already have the latest data from the\n * useCompiledFragment hook, we can't really use that as it may contain\n * __fragments fields and we don't want to write those to the cache. If\n * we figure out a way from a field-policy's merge function to not write\n * to the cache, then that would be preferable.\n */\n const existingData = cache.readFragment(cacheSelector);\n invariant(existingData, \"Expected existing data\");\n const newCacheData = mergeEdges(\n connectionSelectionPath,\n newData,\n existingData,\n updater,\n );\n cache.writeFragment({\n ...cacheSelector,\n variables: newVariables,\n data: newCacheData,\n });\n }\n\n options?.onCompleted?.(error);\n },\n };\n // TODO: Measure if invoking `refetch` leads to React updates and if it\n // makes sense to wrap it and the following setIsLoadingMore(true)\n // call in a batchedUpdates callback.\n const disposable = refetch(\n newVariables,\n refetchOptions as RefetchOptions,\n );\n setIsLoadingMore(true);\n return disposable;\n },\n [\n fragmentReference.id,\n fragmentReference.__fragments,\n refetch,\n metadata,\n executionQueryDocument,\n cache,\n countVariable,\n cursorVariable,\n connectionSelectionPath,\n cursorValue,\n ],\n );\n return [loadPage, isLoadingMore];\n}\n\nfunction getValueAtSelectionPath(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any>,\n selectionPath: string[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let object: Record<string, any> = data;\n selectionPath.forEach((field) => {\n object = object[field];\n invariant(object, \"Expected path to connection in response to exist\");\n });\n return object;\n}\n\nfunction getPageInfo(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any>,\n selectionPath: string[],\n): {\n startCursor?: string;\n endCursor?: string;\n hasPreviousPage?: boolean;\n hasNextPage?: boolean;\n} {\n const object = getValueAtSelectionPath(data, selectionPath);\n const pageInfo = object.pageInfo;\n invariant(pageInfo, \"Expected to find the connection's page info object\");\n return pageInfo;\n}\n\nfunction mergeEdges(\n connectionPath: string[],\n destination: object,\n source: object,\n updater: <T>(existing: T[], incoming: T[]) => T[],\n) {\n const edgesPath = [...connectionPath, \"edges\"];\n const existingEdges = getValueAtSelectionPath(source, edgesPath);\n const newEdges = getValueAtSelectionPath(destination, edgesPath);\n const allEdges = updater(existingEdges, newEdges);\n\n const connection = getValueAtSelectionPath(destination, connectionPath);\n connection[\"edges\"] = allEdges;\n\n return destination;\n}\n\nexport function useCompiledPaginationFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n loadNext: PaginationFn;\n loadPrevious: PaginationFn;\n hasNext: boolean;\n hasPrevious: boolean;\n isLoadingNext: boolean;\n isLoadingPrevious: boolean;\n refetch: RefetchFn;\n} {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"usePaginationFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"usePaginationFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `usePaginationFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n const connectionMetadata = metadata.connection;\n invariant(\n connectionMetadata,\n \"usePaginationFragment: Expected fragment `%s` to include a \" +\n \"connection when using `usePaginationFragment`. Did you forget to add a @connection \" +\n \"directive to the connection field in the fragment?\",\n metadata.mainFragment.name,\n );\n const [data, refetch] = useCompiledRefetchableFragment(\n documents,\n fragmentReference,\n );\n const commonPaginationParams = {\n fragmentReference,\n refetch,\n metadata,\n executionQueryDocument,\n cache: useOverridenOrDefaultApolloClient().cache,\n connectionSelectionPath: connectionMetadata.selectionPath,\n };\n const pageInfo = getPageInfo(data, connectionMetadata.selectionPath);\n const [loadNext, isLoadingNext] = useLoadMore({\n ...commonPaginationParams,\n countVariable: connectionMetadata.forwardCountVariable,\n cursorVariable: connectionMetadata.forwardCursorVariable,\n cursorValue: pageInfo?.endCursor,\n updater: (existing, incoming) => [...existing, ...incoming],\n });\n const [loadPrevious, isLoadingPrevious] = useLoadMore({\n ...commonPaginationParams,\n countVariable: connectionMetadata.backwardCountVariable,\n cursorVariable: connectionMetadata.backwardCursorVariable,\n cursorValue: pageInfo?.startCursor,\n updater: (existing, incoming) => [...incoming, ...existing],\n });\n return {\n data,\n refetch,\n hasNext: !!pageInfo?.hasNextPage,\n hasPrevious: !!pageInfo?.hasPreviousPage,\n isLoadingNext,\n isLoadingPrevious,\n loadNext,\n loadPrevious,\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,mBAAmB;AAEtC,OAAO,eAAe;AACtB,SAAS,sCAAsC;AAC/C,SAAS,yCAAyC;AAiClD,SAAS,YAAY;AAAA,EACnB;AAAA,E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IACE;AAAA,IACA;AAAA,IAGA,SAAS,aAAa;AAAA,EACxB;AACA,QAAM,qBAAqB,SAAS;AACpC;AAAA,IACE;AAAA,IACA;AAAA,IAGA,SAAS,aAAa;AAAA,EACxB;AACA,QAAM,CAAC,MAAM,OAAO,IAAI;AAAA,IACtB;AAAA,IACA;AAAA,EACF;AACA,QAAM,yBAAyB;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,kCAAkC,EAAE;AAAA,IAC3C,yBAAyB,mBAAmB;AAAA,EAC9C;AACA,QAAM,WAAW,YAAY,MAAM,mBAAmB,aAAa;AACnE,QAAM,CAAC,UAAU,aAAa,IAAI,YAAY,iCACzC,yBADyC;AAAA,IAE5C,eAAe,mBAAmB;AAAA,IAClC,gBAAgB,mBAAmB;AAAA,IACnC,aAAa,qCAAU;AAAA,IACvB,SAAS,CAAC,UAAU,aAAa,CAAC,GAAG,UAAU,GAAG,QAAQ;AAAA,EAC5D,EAAC;AACD,QAAM,CAAC,cAAc,iBAAiB,IAAI,YAAY,iCACjD,yBADiD;AAAA,IAEpD,eAAe,mBAAmB;AAAA,IAClC,gBAAgB,mBAAmB;AAAA,IACnC,aAAa,qCAAU;AAAA,IACvB,SAAS,CAAC,UAAU,aAAa,CAAC,GAAG,UAAU,GAAG,QAAQ;AAAA,EAC5D,EAAC;AACD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,SAAS,CAAC,EAAC,qCAAU;AAAA,IACrB,aAAa,CAAC,EAAC,qCAAU;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": ["_a"]
7
7
  }
@@ -4,7 +4,7 @@ import type { FetchPolicy } from "../../types";
4
4
  export interface Disposable {
5
5
  dispose(): void;
6
6
  }
7
- export declare type RefetchFn<Variables extends {} = {}> = (variables: Partial<Variables>, options?: RefetchOptions) => Disposable;
7
+ export declare type RefetchFn<Variables extends object = object> = (variables: Partial<Variables>, options?: RefetchOptions) => Disposable;
8
8
  export interface RefetchOptions {
9
9
  onCompleted?: (error: Error | null) => void;
10
10
  fetchPolicy?: FetchPolicy;
@@ -19,5 +19,5 @@ export interface PrivateRefetchOptions extends Omit<RefetchOptions, "fetchPolicy
19
19
  UNSTABLE_onCompletedWithData?: (error: Error | null, data: Record<string, any> | null) => void;
20
20
  fetchPolicy?: FetchPolicy | "no-cache";
21
21
  }
22
- export declare function useCompiledRefetchableFragment(documents: CompiledArtefactModule, fragmentReference: FragmentReference): [data: {}, refetch: RefetchFn];
22
+ export declare function useCompiledRefetchableFragment(documents: CompiledArtefactModule, fragmentReference: FragmentReference): [data: object, refetch: RefetchFn];
23
23
  //# sourceMappingURL=useCompiledRefetchableFragment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCompiledRefetchableFragment.d.ts","sourceRoot":"","sources":["../../../src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,oBAAY,SAAS,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,IAAI,CACjD,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,EAC7B,OAAO,CAAC,EAAE,cAAc,KACrB,UAAU,CAAC;AAEhB,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC;IAC3C;;OAEG;IACH,4BAA4B,CAAC,EAAE,CAC7B,KAAK,EAAE,KAAK,GAAG,IAAI,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAC7B,IAAI,CAAC;IAEV,WAAW,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CACxC;AAED,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,sBAAsB,EACjC,iBAAiB,EAAE,iBAAiB,GACnC,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,CAkHhC"}
1
+ {"version":3,"file":"useCompiledRefetchableFragment.d.ts","sourceRoot":"","sources":["../../../src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,oBAAY,SAAS,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,CACzD,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,EAC7B,OAAO,CAAC,EAAE,cAAc,KACrB,UAAU,CAAC;AAEhB,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC;IAC3C;;OAEG;IACH,4BAA4B,CAAC,EAAE,CAC7B,KAAK,EAAE,KAAK,GAAG,IAAI,EAEnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAC7B,IAAI,CAAC;IAEV,WAAW,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CACxC;AAED,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,sBAAsB,EACjC,iBAAiB,EAAE,iBAAiB,GACnC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAkHpC"}
@@ -111,7 +111,7 @@ function useCompiledRefetchableFragment(documents, fragmentReference) {
111
111
  });
112
112
  let subscription = observable.subscribe(
113
113
  ({ data: data2, error }) => {
114
- subscription.unsubscribe();
114
+ subscription == null ? void 0 : subscription.unsubscribe();
115
115
  subscription = void 0;
116
116
  disposable.current = void 0;
117
117
  (0, import_react_dom.unstable_batchedUpdates)(() => {
@@ -141,7 +141,7 @@ function useCompiledRefetchableFragment(documents, fragmentReference) {
141
141
  },
142
142
  (error) => {
143
143
  var _a2;
144
- subscription.unsubscribe();
144
+ subscription == null ? void 0 : subscription.unsubscribe();
145
145
  subscription = void 0;
146
146
  if (options == null ? void 0 : options.UNSTABLE_onCompletedWithData) {
147
147
  options.UNSTABLE_onCompletedWithData(error, null);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts"],
4
- "sourcesContent": ["import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { unstable_batchedUpdates } from \"react-dom\";\nimport invariant from \"invariant\";\nimport { useCompiledFragment } from \"./useCompiledFragment\";\nimport { isEqual } from \"lodash\";\nimport { convertFetchPolicy } from \"../../convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { FragmentReference } from \"./types\";\nimport type { FetchPolicy } from \"../../types\";\n\nexport interface Disposable {\n dispose(): void;\n}\n\nexport type RefetchFn<Variables extends {} = {}> = (\n variables: Partial<Variables>,\n options?: RefetchOptions,\n) => Disposable;\n\nexport interface RefetchOptions {\n onCompleted?: (error: Error | null) => void;\n fetchPolicy?: FetchPolicy;\n}\n\n/**\n * These do not exist in the Relay API and should not be exported from the package.\n */\nexport interface PrivateRefetchOptions\n extends Omit<RefetchOptions, \"fetchPolicy\"> {\n /**\n * Returns the fetched data.\n */\n UNSTABLE_onCompletedWithData?: (\n error: Error | null,\n data: Record<string, any> | null,\n ) => void;\n\n fetchPolicy?: FetchPolicy | \"no-cache\";\n}\n\nexport function useCompiledRefetchableFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): [data: {}, refetch: RefetchFn] {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"useRefetchableFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"useRefetchableFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `useRefetchableFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n\n const client = useOverridenOrDefaultApolloClient();\n\n // We use state for this, so that...\n const [\n fragmentReferenceWithOwnVariables,\n setFragmentReferenceWithOwnVariables,\n ] = useState(fragmentReference);\n // ...this gets invoked again with updated variables.\n const data = useCompiledFragment(\n documents,\n fragmentReferenceWithOwnVariables,\n );\n\n const disposable = useRef<Disposable>();\n useEffect(\n () => () => {\n if (disposable.current) {\n disposable.current.dispose();\n disposable.current = undefined;\n }\n },\n [], // On unmount\n );\n\n const refetch = useCallback<RefetchFn>(\n (variablesSubset, options?: PrivateRefetchOptions) => {\n const variables = {\n ...fragmentReference.__fragments,\n ...variablesSubset,\n id: fragmentReference.id,\n };\n const observable = client.watchQuery({\n fetchPolicy: convertFetchPolicy(options?.fetchPolicy) ?? \"network-only\",\n query: executionQueryDocument,\n variables,\n });\n let subscription: ZenObservable.Subscription | undefined =\n observable.subscribe(\n ({ data, error }) => {\n // Be sure not to keep a retain cycle, so cleanup the reference first thing.\n subscription!.unsubscribe();\n subscription = undefined;\n disposable.current = undefined;\n\n unstable_batchedUpdates(() => {\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error || null, data);\n } else {\n options?.onCompleted?.(error || null);\n }\n if (!error) {\n const { id: _, ...variablesToPropagate } = variables;\n const nextVariables = {\n ...fragmentReference.__fragments,\n ...variablesToPropagate,\n };\n // No need to trigger an update to propagate new variables if they don't actually change.\n if (\n !isEqual(\n fragmentReferenceWithOwnVariables.__fragments,\n nextVariables,\n )\n ) {\n const nextFragmentReference: FragmentReference = {\n __fragments: nextVariables,\n };\n // Don't add an empty key if this is a fragment on the Query type.\n if (fragmentReference.id !== undefined) {\n nextFragmentReference.id = fragmentReference.id;\n }\n setFragmentReferenceWithOwnVariables(nextFragmentReference);\n }\n }\n });\n },\n (error) => {\n // Be sure not to keep a retain cycle\n subscription!.unsubscribe();\n subscription = undefined;\n\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error, null);\n } else {\n options?.onCompleted?.(error);\n }\n },\n );\n disposable.current = { dispose: () => subscription?.unsubscribe() };\n return disposable.current;\n },\n [\n client,\n executionQueryDocument,\n fragmentReference.id,\n fragmentReference.__fragments,\n ],\n );\n\n return [data, refetch];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyD;AACzD,uBAAwC;AACxC,uBAAsB;AACtB,iCAAoC;AACpC,oBAAwB;AACxB,gCAAmC;AACnC,+CAAkD;AAoC3C,SAAS,+BACd,WACA,mBACgC;AAChC,QAAM,EAAE,wBAAwB,SAAS,IAAI;AAC7C,uBAAAA;AAAA,IACE,YAAY,SAAS;AAAA,IACrB;AAAA,EAEF;AACA,uBAAAA;AAAA,IACE;AAAA,IACA;AAAA,IAGA,SAAS,aAAa;AAAA,EACxB;AAEA,QAAM,aAAS,4EAAkC;AA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/C;AACA,qDAAqC,qBAAqB;AAAA,cAC5D;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AAAA,QACA,CAAC,UAAU;AAvIrB,cAAAA;AAyIY,uBAAc,YAAY;AAC1B,yBAAe;AAEf,cAAI,mCAAS,8BAA8B;AACzC,oBAAQ,6BAA6B,OAAO,IAAI;AAAA,UAClD,OAAO;AACL,aAAAA,MAAA,mCAAS,gBAAT,gBAAAA,IAAA,cAAuB;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AACF,iBAAW,UAAU,EAAE,SAAS,MAAM,6CAAc,cAAc;AAClE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,CAAC,MAAM,OAAO;AACvB;",
4
+ "sourcesContent": ["import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { unstable_batchedUpdates } from \"react-dom\";\nimport invariant from \"invariant\";\nimport { useCompiledFragment } from \"./useCompiledFragment\";\nimport { isEqual } from \"lodash\";\nimport { convertFetchPolicy } from \"../../convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { FragmentReference } from \"./types\";\nimport type { FetchPolicy } from \"../../types\";\n\nexport interface Disposable {\n dispose(): void;\n}\n\nexport type RefetchFn<Variables extends object = object> = (\n variables: Partial<Variables>,\n options?: RefetchOptions,\n) => Disposable;\n\nexport interface RefetchOptions {\n onCompleted?: (error: Error | null) => void;\n fetchPolicy?: FetchPolicy;\n}\n\n/**\n * These do not exist in the Relay API and should not be exported from the package.\n */\nexport interface PrivateRefetchOptions\n extends Omit<RefetchOptions, \"fetchPolicy\"> {\n /**\n * Returns the fetched data.\n */\n UNSTABLE_onCompletedWithData?: (\n error: Error | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any> | null,\n ) => void;\n\n fetchPolicy?: FetchPolicy | \"no-cache\";\n}\n\nexport function useCompiledRefetchableFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): [data: object, refetch: RefetchFn] {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"useRefetchableFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"useRefetchableFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `useRefetchableFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n\n const client = useOverridenOrDefaultApolloClient();\n\n // We use state for this, so that...\n const [\n fragmentReferenceWithOwnVariables,\n setFragmentReferenceWithOwnVariables,\n ] = useState(fragmentReference);\n // ...this gets invoked again with updated variables.\n const data = useCompiledFragment(\n documents,\n fragmentReferenceWithOwnVariables,\n );\n\n const disposable = useRef<Disposable>();\n useEffect(\n () => () => {\n if (disposable.current) {\n disposable.current.dispose();\n disposable.current = undefined;\n }\n },\n [], // On unmount\n );\n\n const refetch = useCallback<RefetchFn>(\n (variablesSubset, options?: PrivateRefetchOptions) => {\n const variables = {\n ...fragmentReference.__fragments,\n ...variablesSubset,\n id: fragmentReference.id,\n };\n const observable = client.watchQuery({\n fetchPolicy: convertFetchPolicy(options?.fetchPolicy) ?? \"network-only\",\n query: executionQueryDocument,\n variables,\n });\n let subscription: ZenObservable.Subscription | undefined =\n observable.subscribe(\n ({ data, error }) => {\n // Be sure not to keep a retain cycle, so cleanup the reference first thing.\n subscription?.unsubscribe();\n subscription = undefined;\n disposable.current = undefined;\n\n unstable_batchedUpdates(() => {\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error || null, data);\n } else {\n options?.onCompleted?.(error || null);\n }\n if (!error) {\n const { id: _, ...variablesToPropagate } = variables;\n const nextVariables = {\n ...fragmentReference.__fragments,\n ...variablesToPropagate,\n };\n // No need to trigger an update to propagate new variables if they don't actually change.\n if (\n !isEqual(\n fragmentReferenceWithOwnVariables.__fragments,\n nextVariables,\n )\n ) {\n const nextFragmentReference: FragmentReference = {\n __fragments: nextVariables,\n };\n // Don't add an empty key if this is a fragment on the Query type.\n if (fragmentReference.id !== undefined) {\n nextFragmentReference.id = fragmentReference.id;\n }\n setFragmentReferenceWithOwnVariables(nextFragmentReference);\n }\n }\n });\n },\n (error) => {\n // Be sure not to keep a retain cycle\n subscription?.unsubscribe();\n subscription = undefined;\n\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error, null);\n } else {\n options?.onCompleted?.(error);\n }\n },\n );\n disposable.current = { dispose: () => subscription?.unsubscribe() };\n return disposable.current;\n },\n [\n client,\n executionQueryDocument,\n fragmentReference.id,\n fragmentReference.__fragments,\n ],\n );\n\n return [data, refetch];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyD;AACzD,uBAAwC;AACxC,uBAAsB;AACtB,iCAAoC;AACpC,oBAAwB;AACxB,gCAAmC;AACnC,+CAAkD;AAqC3C,SAAS,+BACd,WACA,mBACoC;AACpC,QAAM,EAAE,wBAAwB,SAAS,IAAI;AAC7C,uBAAAA;AAAA,IACE,YAAY,SAAS;AAAA,IACrB;AAAA,EAEF;AACA,uBAAAA;AAAA,IACE;AAAA,IACA;AAAA,IAGA,SAAS,aAAa;AAAA,EACxB;AAEA,QAAM,aAAS,4EAAkC;AAGjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,QAAI,uBAAS,iBAAiB;AAE9B,QAAM,WAAO;AAAA,IACX;AAAA,IACA;AAAA,EACF;AAEA,QAAM,iBAAa,qBAAmB;AACtC;AAAA,IACE,MAAM,MAAM;AACV,UAAI,WAAW,SAAS;A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AAAA,UAClD,OAAO;AACL,aAAAA,MAAA,mCAAS,gBAAT,gBAAAA,IAAA,cAAuB;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AACF,iBAAW,UAAU,EAAE,SAAS,MAAM,6CAAc,cAAc;AAClE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,CAAC,MAAM,OAAO;AACvB;",
6
6
  "names": ["invariant", "data", "_a"]
7
7
  }
@@ -82,7 +82,7 @@ function useCompiledRefetchableFragment(documents, fragmentReference) {
82
82
  });
83
83
  let subscription = observable.subscribe(
84
84
  ({ data: data2, error }) => {
85
- subscription.unsubscribe();
85
+ subscription == null ? void 0 : subscription.unsubscribe();
86
86
  subscription = void 0;
87
87
  disposable.current = void 0;
88
88
  unstable_batchedUpdates(() => {
@@ -112,7 +112,7 @@ function useCompiledRefetchableFragment(documents, fragmentReference) {
112
112
  },
113
113
  (error) => {
114
114
  var _a2;
115
- subscription.unsubscribe();
115
+ subscription == null ? void 0 : subscription.unsubscribe();
116
116
  subscription = void 0;
117
117
  if (options == null ? void 0 : options.UNSTABLE_onCompletedWithData) {
118
118
  options.UNSTABLE_onCompletedWithData(error, null);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/storeObservation/compiledHooks/useCompiledRefetchableFragment.ts"],
4
- "sourcesContent": ["import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { unstable_batchedUpdates } from \"react-dom\";\nimport invariant from \"invariant\";\nimport { useCompiledFragment } from \"./useCompiledFragment\";\nimport { isEqual } from \"lodash\";\nimport { convertFetchPolicy } from \"../../convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { FragmentReference } from \"./types\";\nimport type { FetchPolicy } from \"../../types\";\n\nexport interface Disposable {\n dispose(): void;\n}\n\nexport type RefetchFn<Variables extends {} = {}> = (\n variables: Partial<Variables>,\n options?: RefetchOptions,\n) => Disposable;\n\nexport interface RefetchOptions {\n onCompleted?: (error: Error | null) => void;\n fetchPolicy?: FetchPolicy;\n}\n\n/**\n * These do not exist in the Relay API and should not be exported from the package.\n */\nexport interface PrivateRefetchOptions\n extends Omit<RefetchOptions, \"fetchPolicy\"> {\n /**\n * Returns the fetched data.\n */\n UNSTABLE_onCompletedWithData?: (\n error: Error | null,\n data: Record<string, any> | null,\n ) => void;\n\n fetchPolicy?: FetchPolicy | \"no-cache\";\n}\n\nexport function useCompiledRefetchableFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): [data: {}, refetch: RefetchFn] {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"useRefetchableFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"useRefetchableFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `useRefetchableFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n\n const client = useOverridenOrDefaultApolloClient();\n\n // We use state for this, so that...\n const [\n fragmentReferenceWithOwnVariables,\n setFragmentReferenceWithOwnVariables,\n ] = useState(fragmentReference);\n // ...this gets invoked again with updated variables.\n const data = useCompiledFragment(\n documents,\n fragmentReferenceWithOwnVariables,\n );\n\n const disposable = useRef<Disposable>();\n useEffect(\n () => () => {\n if (disposable.current) {\n disposable.current.dispose();\n disposable.current = undefined;\n }\n },\n [], // On unmount\n );\n\n const refetch = useCallback<RefetchFn>(\n (variablesSubset, options?: PrivateRefetchOptions) => {\n const variables = {\n ...fragmentReference.__fragments,\n ...variablesSubset,\n id: fragmentReference.id,\n };\n const observable = client.watchQuery({\n fetchPolicy: convertFetchPolicy(options?.fetchPolicy) ?? \"network-only\",\n query: executionQueryDocument,\n variables,\n });\n let subscription: ZenObservable.Subscription | undefined =\n observable.subscribe(\n ({ data, error }) => {\n // Be sure not to keep a retain cycle, so cleanup the reference first thing.\n subscription!.unsubscribe();\n subscription = undefined;\n disposable.current = undefined;\n\n unstable_batchedUpdates(() => {\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error || null, data);\n } else {\n options?.onCompleted?.(error || null);\n }\n if (!error) {\n const { id: _, ...variablesToPropagate } = variables;\n const nextVariables = {\n ...fragmentReference.__fragments,\n ...variablesToPropagate,\n };\n // No need to trigger an update to propagate new variables if they don't actually change.\n if (\n !isEqual(\n fragmentReferenceWithOwnVariables.__fragments,\n nextVariables,\n )\n ) {\n const nextFragmentReference: FragmentReference = {\n __fragments: nextVariables,\n };\n // Don't add an empty key if this is a fragment on the Query type.\n if (fragmentReference.id !== undefined) {\n nextFragmentReference.id = fragmentReference.id;\n }\n setFragmentReferenceWithOwnVariables(nextFragmentReference);\n }\n }\n });\n },\n (error) => {\n // Be sure not to keep a retain cycle\n subscription!.unsubscribe();\n subscription = undefined;\n\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error, null);\n } else {\n options?.onCompleted?.(error);\n }\n },\n );\n disposable.current = { dispose: () => subscription?.unsubscribe() };\n return disposable.current;\n },\n [\n client,\n executionQueryDocument,\n fragmentReference.id,\n fragmentReference.__fragments,\n ],\n );\n\n return [data, refetch];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,aAAa,QAAQ,iBAAiB;AACzD,SAAS,+BAA+B;AACxC,OAAO,eAAe;AACtB,SAAS,2BAA2B;AACpC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC,SAAS,yCAAyC;AAoC3C,SAAS,+BACd,WACA,mBACgC;AAChC,QAAM,EAAE,wBAAwB,SAAS,IAAI;AAC7C;AAAA,IACE,Y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,sBAAM,wBAA2C;AAAA,kBAC/C,aAAa;AAAA,gBACf;AAEA,oBAAI,kBAAkB,OAAO,QAAW;AACtC,wCAAsB,KAAK,kBAAkB;AAAA,gBAC/C;AACA,qDAAqC,qBAAqB;AAAA,cAC5D;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AAAA,QACA,CAAC,UAAU;AAvIrB,cAAAA;AAyIY,uBAAc,YAAY;AAC1B,yBAAe;AAEf,cAAI,mCAAS,8BAA8B;AACzC,oBAAQ,6BAA6B,OAAO,IAAI;AAAA,UAClD,OAAO;AACL,aAAAA,MAAA,mCAAS,gBAAT,gBAAAA,IAAA,cAAuB;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AACF,iBAAW,UAAU,EAAE,SAAS,MAAM,6CAAc,cAAc;AAClE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,CAAC,MAAM,OAAO;AACvB;",
4
+ "sourcesContent": ["import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { unstable_batchedUpdates } from \"react-dom\";\nimport invariant from \"invariant\";\nimport { useCompiledFragment } from \"./useCompiledFragment\";\nimport { isEqual } from \"lodash\";\nimport { convertFetchPolicy } from \"../../convertFetchPolicy\";\nimport { useOverridenOrDefaultApolloClient } from \"../../useOverridenOrDefaultApolloClient\";\n\nimport type { CompiledArtefactModule } from \"@graphitation/apollo-react-relay-duct-tape-compiler\";\nimport type { FragmentReference } from \"./types\";\nimport type { FetchPolicy } from \"../../types\";\n\nexport interface Disposable {\n dispose(): void;\n}\n\nexport type RefetchFn<Variables extends object = object> = (\n variables: Partial<Variables>,\n options?: RefetchOptions,\n) => Disposable;\n\nexport interface RefetchOptions {\n onCompleted?: (error: Error | null) => void;\n fetchPolicy?: FetchPolicy;\n}\n\n/**\n * These do not exist in the Relay API and should not be exported from the package.\n */\nexport interface PrivateRefetchOptions\n extends Omit<RefetchOptions, \"fetchPolicy\"> {\n /**\n * Returns the fetched data.\n */\n UNSTABLE_onCompletedWithData?: (\n error: Error | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any> | null,\n ) => void;\n\n fetchPolicy?: FetchPolicy | \"no-cache\";\n}\n\nexport function useCompiledRefetchableFragment(\n documents: CompiledArtefactModule,\n fragmentReference: FragmentReference,\n): [data: object, refetch: RefetchFn] {\n const { executionQueryDocument, metadata } = documents;\n invariant(\n metadata && metadata.mainFragment,\n \"useRefetchableFragment(): Expected metadata to have been extracted from \" +\n \"the fragment. Did you forget to invoke the compiler?\",\n );\n invariant(\n executionQueryDocument,\n \"useRefetchableFragment(): Expected fragment `%s` to be refetchable when \" +\n \"using `useRefetchableFragment`. Did you forget to add a @refetchable \" +\n \"directive to the fragment?\",\n metadata.mainFragment.name,\n );\n\n const client = useOverridenOrDefaultApolloClient();\n\n // We use state for this, so that...\n const [\n fragmentReferenceWithOwnVariables,\n setFragmentReferenceWithOwnVariables,\n ] = useState(fragmentReference);\n // ...this gets invoked again with updated variables.\n const data = useCompiledFragment(\n documents,\n fragmentReferenceWithOwnVariables,\n );\n\n const disposable = useRef<Disposable>();\n useEffect(\n () => () => {\n if (disposable.current) {\n disposable.current.dispose();\n disposable.current = undefined;\n }\n },\n [], // On unmount\n );\n\n const refetch = useCallback<RefetchFn>(\n (variablesSubset, options?: PrivateRefetchOptions) => {\n const variables = {\n ...fragmentReference.__fragments,\n ...variablesSubset,\n id: fragmentReference.id,\n };\n const observable = client.watchQuery({\n fetchPolicy: convertFetchPolicy(options?.fetchPolicy) ?? \"network-only\",\n query: executionQueryDocument,\n variables,\n });\n let subscription: ZenObservable.Subscription | undefined =\n observable.subscribe(\n ({ data, error }) => {\n // Be sure not to keep a retain cycle, so cleanup the reference first thing.\n subscription?.unsubscribe();\n subscription = undefined;\n disposable.current = undefined;\n\n unstable_batchedUpdates(() => {\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error || null, data);\n } else {\n options?.onCompleted?.(error || null);\n }\n if (!error) {\n const { id: _, ...variablesToPropagate } = variables;\n const nextVariables = {\n ...fragmentReference.__fragments,\n ...variablesToPropagate,\n };\n // No need to trigger an update to propagate new variables if they don't actually change.\n if (\n !isEqual(\n fragmentReferenceWithOwnVariables.__fragments,\n nextVariables,\n )\n ) {\n const nextFragmentReference: FragmentReference = {\n __fragments: nextVariables,\n };\n // Don't add an empty key if this is a fragment on the Query type.\n if (fragmentReference.id !== undefined) {\n nextFragmentReference.id = fragmentReference.id;\n }\n setFragmentReferenceWithOwnVariables(nextFragmentReference);\n }\n }\n });\n },\n (error) => {\n // Be sure not to keep a retain cycle\n subscription?.unsubscribe();\n subscription = undefined;\n\n if (options?.UNSTABLE_onCompletedWithData) {\n options.UNSTABLE_onCompletedWithData(error, null);\n } else {\n options?.onCompleted?.(error);\n }\n },\n );\n disposable.current = { dispose: () => subscription?.unsubscribe() };\n return disposable.current;\n },\n [\n client,\n executionQueryDocument,\n fragmentReference.id,\n fragmentReference.__fragments,\n ],\n );\n\n return [data, refetch];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,aAAa,QAAQ,iBAAiB;AACzD,SAAS,+BAA+B;AACxC,OAAO,eAAe;AACtB,SAAS,2BAA2B;AACpC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC,SAAS,yCAAyC;AAqC3C,SAAS,+BACd,WACA,mBACoC;AACpC,QAAM,EAAE,wBAAwB,SAAS,IAAI;AAC7C;AAAA,IACE,YAAY,SAAS;AAAA,IACrB;AAAA,EAEF;AACA;AAAA,IACE;AAAA,IACA;AAAA,IAGA,SAAS,aAAa;AAAA,EACxB;AAEA,QAAM,SAAS,kCAAkC;AAGjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI,SAAS,iBAAiB;AAE9B,QAAM,OAAO;AAAA,IACX;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rB,cAAAA;AA0IY,uDAAc;AACd,yBAAe;AAEf,cAAI,mCAAS,8BAA8B;AACzC,oBAAQ,6BAA6B,OAAO,IAAI;AAAA,UAClD,OAAO;AACL,aAAAA,MAAA,mCAAS,gBAAT,gBAAAA,IAAA,cAAuB;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AACF,iBAAW,UAAU,EAAE,SAAS,MAAM,6CAAc,cAAc;AAClE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,CAAC,MAAM,OAAO;AACvB;",
6
6
  "names": ["data", "_a"]
7
7
  }
@@ -34,11 +34,12 @@ __export(nodeFromCacheFieldPolicy_exports, {
34
34
  module.exports = __toCommonJS(nodeFromCacheFieldPolicy_exports);
35
35
  var import_invariant = __toESM(require("invariant"));
36
36
  const nodeFromCacheFieldPolicyWithDefaultApolloClientStoreKeys = (_existingCacheData, options) => {
37
- const nodeId = options.args.id;
37
+ var _a, _b, _c;
38
+ const nodeId = (_a = options.args) == null ? void 0 : _a.id;
38
39
  (0, import_invariant.default)(nodeId, "Expected an `id` argument");
39
- const fragmentNames = options.field.selectionSet.selections.filter(
40
+ const fragmentNames = ((_c = (_b = options.field) == null ? void 0 : _b.selectionSet) == null ? void 0 : _c.selections.filter(
40
41
  (sel) => sel.kind === "FragmentSpread"
41
- ).map((fragmentSpreadNode) => fragmentSpreadNode.name.value);
42
+ )).map((fragmentSpreadNode) => fragmentSpreadNode.name.value);
42
43
  (0, import_invariant.default)(
43
44
  fragmentNames.length === 1,
44
45
  "Expected a single fragment spread in the watch node query, instead got `%s`",
@@ -59,8 +60,8 @@ const nodeFromCacheFieldPolicyWithDefaultApolloClientStoreKeys = (_existingCache
59
60
  });
60
61
  };
61
62
  const nodeFromCacheFieldPolicyWithGlobalObjectIdStoreKeys = (_existingCacheData, options) => {
62
- var _a;
63
- const nodeId = (_a = options.args.id) == null ? void 0 : _a.toString();
63
+ var _a, _b;
64
+ const nodeId = (_b = (_a = options.args) == null ? void 0 : _a.id) == null ? void 0 : _b.toString();
64
65
  (0, import_invariant.default)(nodeId, "Expected an `id` argument");
65
66
  return options.toReference(nodeId);
66
67
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/storeObservation/nodeFromCacheFieldPolicy.ts"],
4
- "sourcesContent": ["import { FieldReadFunction } from \"@apollo/client\";\nimport { FragmentSpreadNode, FragmentDefinitionNode } from \"graphql\";\nimport invariant from \"invariant\";\n\n/**\n * Use this as the field policy function for the node root field, which is what\n * gets invoked when using relay-compiler's refetch query. Queries that use a\n * cache-only cache-policy will read the data from the store, which is expected\n * to be populated by a different query beforehand.\n *\n * This specific version is for when you're using Apollo Client's default\n * configuration, which prefixes the `id` value with the typename for its store\n * keys.\n */\nexport const nodeFromCacheFieldPolicyWithDefaultApolloClientStoreKeys: FieldReadFunction =\n (_existingCacheData, options) => {\n const nodeId = options.args!.id;\n invariant(nodeId, \"Expected an `id` argument\");\n\n const fragmentNames = (\n options.field!.selectionSet!.selections.filter(\n (sel) => sel.kind === \"FragmentSpread\",\n ) as FragmentSpreadNode[]\n ).map((fragmentSpreadNode) => fragmentSpreadNode.name.value);\n invariant(\n fragmentNames.length === 1,\n \"Expected a single fragment spread in the watch node query, instead got `%s`\",\n fragmentNames.length,\n );\n const fragmentName = fragmentNames[0];\n\n const fragment = options.query.definitions.find(\n (defNode) =>\n defNode.kind === \"FragmentDefinition\" &&\n defNode.name.value === fragmentName,\n ) as FragmentDefinitionNode;\n invariant(\n fragment,\n \"Expected document to contain a fragment by name `%s`\",\n fragmentName,\n );\n\n return options.toReference({\n __typename: fragment.typeCondition.name.value,\n id: nodeId,\n });\n };\n\n/**\n * Use this as the field policy function for the node root field, which is what\n * gets invoked when using relay-compiler's refetch query. Queries that use a\n * cache-only cache-policy will read the data from the store, which is expected\n * to be populated by a different query beforehand.\n *\n * This specific version is for when your Apollo Client instance is configured\n * to strictly follow the Global Object Identification and there's no need for\n * Apollo Client to prefix the `id` value with the typename for its store keys.\n *\n * @example\n * \n ```ts\n new InMemoryCache({\n dataIdFromObject(responseObject) {\n return (\n responseObject.id?.toString() ||\n defaultDataIdFromObject(responseObject)\n );\n }\n })\n ```\n * \n * @see {https://www.apollographql.com/docs/react/caching/cache-configuration/}\n */\nexport const nodeFromCacheFieldPolicyWithGlobalObjectIdStoreKeys: FieldReadFunction =\n (_existingCacheData, options) => {\n const nodeId = options.args!.id?.toString();\n invariant(nodeId, \"Expected an `id` argument\");\n return options.toReference(nodeId);\n };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uBAAsB;AAYf,MAAM,2DACX,CAAC,oBAAoB,YAAY;AAC/B,QAAM,SAAS,QAAQ,KAAM;AAC7B,uBAAAA,SAAU,QAAQ,2BAA2B;AAE7C,QAAM,gBACJ,QAAQ,MAAO,aAAc,WAAW;AAAA,IACtC,CAAC,QAAQ,IAAI,SAAS;AAAA,EACxB,EACA,IAAI,CAAC,uBAAuB,mBAAmB,KAAK,KAAK;AAC3D,uBAAAA;AAAA,IACE,cAAc,WAAW;AAAA,IACzB;AAAA,IACA,cAAc;AAAA,EAChB;AACA,QAAM,eAAe,cAAc,CAAC;AAEpC,QAAM,WAAW,QAAQ,MAAM,YAAY;AAAA,IACzC,CAAC,YACC,QAAQ,SAAS,wBACjB,QAAQ,KAAK,UAAU;AAAA,EAC3B;AACA,uBAAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO,QAAQ,YAAY;AAAA,IACzB,YAAY,SAAS,cAAc,KAAK;AAAA,IACxC,IAAI;AAAA,EACN,CAAC;AACH;AA2BK,MAAM,sDACX,CAAC,oBAAoB,YAAY;AA1EnC;AA2EI,QAAM,UAAS,aAAQ,KAAM,OAAd,mBAAkB;AACjC,uBAAAA,SAAU,QAAQ,2BAA2B;AAC7C,SAAO,QAAQ,YAAY,MAAM;AACnC;",
4
+ "sourcesContent": ["import { FieldReadFunction } from \"@apollo/client\";\nimport { FragmentSpreadNode, FragmentDefinitionNode } from \"graphql\";\nimport invariant from \"invariant\";\n\n/**\n * Use this as the field policy function for the node root field, which is what\n * gets invoked when using relay-compiler's refetch query. Queries that use a\n * cache-only cache-policy will read the data from the store, which is expected\n * to be populated by a different query beforehand.\n *\n * This specific version is for when you're using Apollo Client's default\n * configuration, which prefixes the `id` value with the typename for its store\n * keys.\n */\nexport const nodeFromCacheFieldPolicyWithDefaultApolloClientStoreKeys: FieldReadFunction =\n (_existingCacheData, options) => {\n const nodeId = options.args?.id;\n invariant(nodeId, \"Expected an `id` argument\");\n\n const fragmentNames = (\n options.field?.selectionSet?.selections.filter(\n (sel) => sel.kind === \"FragmentSpread\",\n ) as FragmentSpreadNode[]\n ).map((fragmentSpreadNode) => fragmentSpreadNode.name.value);\n invariant(\n fragmentNames.length === 1,\n \"Expected a single fragment spread in the watch node query, instead got `%s`\",\n fragmentNames.length,\n );\n const fragmentName = fragmentNames[0];\n\n const fragment = options.query.definitions.find(\n (defNode) =>\n defNode.kind === \"FragmentDefinition\" &&\n defNode.name.value === fragmentName,\n ) as FragmentDefinitionNode;\n invariant(\n fragment,\n \"Expected document to contain a fragment by name `%s`\",\n fragmentName,\n );\n\n return options.toReference({\n __typename: fragment.typeCondition.name.value,\n id: nodeId,\n });\n };\n\n/**\n * Use this as the field policy function for the node root field, which is what\n * gets invoked when using relay-compiler's refetch query. Queries that use a\n * cache-only cache-policy will read the data from the store, which is expected\n * to be populated by a different query beforehand.\n *\n * This specific version is for when your Apollo Client instance is configured\n * to strictly follow the Global Object Identification and there's no need for\n * Apollo Client to prefix the `id` value with the typename for its store keys.\n *\n * @example\n * \n ```ts\n new InMemoryCache({\n dataIdFromObject(responseObject) {\n return (\n responseObject.id?.toString() ||\n defaultDataIdFromObject(responseObject)\n );\n }\n })\n ```\n * \n * @see {https://www.apollographql.com/docs/react/caching/cache-configuration/}\n */\nexport const nodeFromCacheFieldPolicyWithGlobalObjectIdStoreKeys: FieldReadFunction =\n (_existingCacheData, options) => {\n const nodeId = options.args?.id?.toString();\n invariant(nodeId, \"Expected an `id` argument\");\n return options.toReference(nodeId);\n };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uBAAsB;AAYf,MAAM,2DACX,CAAC,oBAAoB,YAAY;AAfnC;AAgBI,QAAM,UAAS,aAAQ,SAAR,mBAAc;AAC7B,uBAAAA,SAAU,QAAQ,2BAA2B;AAE7C,QAAM,kBACJ,mBAAQ,UAAR,mBAAe,iBAAf,mBAA6B,WAAW;AAAA,IACtC,CAAC,QAAQ,IAAI,SAAS;AAAA,KAExB,IAAI,CAAC,uBAAuB,mBAAmB,KAAK,KAAK;AAC3D,uBAAAA;AAAA,IACE,cAAc,WAAW;AAAA,IACzB;AAAA,IACA,cAAc;AAAA,EAChB;AACA,QAAM,eAAe,cAAc,CAAC;AAEpC,QAAM,WAAW,QAAQ,MAAM,YAAY;AAAA,IACzC,CAAC,YACC,QAAQ,SAAS,wBACjB,QAAQ,KAAK,UAAU;AAAA,EAC3B;AACA,uBAAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO,QAAQ,YAAY;AAAA,IACzB,YAAY,SAAS,cAAc,KAAK;AAAA,IACxC,IAAI;AAAA,EACN,CAAC;AACH;AA2BK,MAAM,sDACX,CAAC,oBAAoB,YAAY;AA1EnC;AA2EI,QAAM,UAAS,mBAAQ,SAAR,mBAAc,OAAd,mBAAkB;AACjC,uBAAAA,SAAU,QAAQ,2BAA2B;AAC7C,SAAO,QAAQ,YAAY,MAAM;AACnC;",
6
6
  "names": ["invariant"]
7
7
  }
@@ -1,11 +1,12 @@
1
1
  // src/storeObservation/nodeFromCacheFieldPolicy.ts
2
2
  import invariant from "invariant";
3
3
  var nodeFromCacheFieldPolicyWithDefaultApolloClientStoreKeys = (_existingCacheData, options) => {
4
- const nodeId = options.args.id;
4
+ var _a, _b, _c;
5
+ const nodeId = (_a = options.args) == null ? void 0 : _a.id;
5
6
  invariant(nodeId, "Expected an `id` argument");
6
- const fragmentNames = options.field.selectionSet.selections.filter(
7
+ const fragmentNames = ((_c = (_b = options.field) == null ? void 0 : _b.selectionSet) == null ? void 0 : _c.selections.filter(
7
8
  (sel) => sel.kind === "FragmentSpread"
8
- ).map((fragmentSpreadNode) => fragmentSpreadNode.name.value);
9
+ )).map((fragmentSpreadNode) => fragmentSpreadNode.name.value);
9
10
  invariant(
10
11
  fragmentNames.length === 1,
11
12
  "Expected a single fragment spread in the watch node query, instead got `%s`",
@@ -26,8 +27,8 @@ var nodeFromCacheFieldPolicyWithDefaultApolloClientStoreKeys = (_existingCacheDa
26
27
  });
27
28
  };
28
29
  var nodeFromCacheFieldPolicyWithGlobalObjectIdStoreKeys = (_existingCacheData, options) => {
29
- var _a;
30
- const nodeId = (_a = options.args.id) == null ? void 0 : _a.toString();
30
+ var _a, _b;
31
+ const nodeId = (_b = (_a = options.args) == null ? void 0 : _a.id) == null ? void 0 : _b.toString();
31
32
  invariant(nodeId, "Expected an `id` argument");
32
33
  return options.toReference(nodeId);
33
34
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/storeObservation/nodeFromCacheFieldPolicy.ts"],
4
- "sourcesContent": ["import { FieldReadFunction } from \"@apollo/client\";\nimport { FragmentSpreadNode, FragmentDefinitionNode } from \"graphql\";\nimport invariant from \"invariant\";\n\n/**\n * Use this as the field policy function for the node root field, which is what\n * gets invoked when using relay-compiler's refetch query. Queries that use a\n * cache-only cache-policy will read the data from the store, which is expected\n * to be populated by a different query beforehand.\n *\n * This specific version is for when you're using Apollo Client's default\n * configuration, which prefixes the `id` value with the typename for its store\n * keys.\n */\nexport const nodeFromCacheFieldPolicyWithDefaultApolloClientStoreKeys: FieldReadFunction =\n (_existingCacheData, options) => {\n const nodeId = options.args!.id;\n invariant(nodeId, \"Expected an `id` argument\");\n\n const fragmentNames = (\n options.field!.selectionSet!.selections.filter(\n (sel) => sel.kind === \"FragmentSpread\",\n ) as FragmentSpreadNode[]\n ).map((fragmentSpreadNode) => fragmentSpreadNode.name.value);\n invariant(\n fragmentNames.length === 1,\n \"Expected a single fragment spread in the watch node query, instead got `%s`\",\n fragmentNames.length,\n );\n const fragmentName = fragmentNames[0];\n\n const fragment = options.query.definitions.find(\n (defNode) =>\n defNode.kind === \"FragmentDefinition\" &&\n defNode.name.value === fragmentName,\n ) as FragmentDefinitionNode;\n invariant(\n fragment,\n \"Expected document to contain a fragment by name `%s`\",\n fragmentName,\n );\n\n return options.toReference({\n __typename: fragment.typeCondition.name.value,\n id: nodeId,\n });\n };\n\n/**\n * Use this as the field policy function for the node root field, which is what\n * gets invoked when using relay-compiler's refetch query. Queries that use a\n * cache-only cache-policy will read the data from the store, which is expected\n * to be populated by a different query beforehand.\n *\n * This specific version is for when your Apollo Client instance is configured\n * to strictly follow the Global Object Identification and there's no need for\n * Apollo Client to prefix the `id` value with the typename for its store keys.\n *\n * @example\n * \n ```ts\n new InMemoryCache({\n dataIdFromObject(responseObject) {\n return (\n responseObject.id?.toString() ||\n defaultDataIdFromObject(responseObject)\n );\n }\n })\n ```\n * \n * @see {https://www.apollographql.com/docs/react/caching/cache-configuration/}\n */\nexport const nodeFromCacheFieldPolicyWithGlobalObjectIdStoreKeys: FieldReadFunction =\n (_existingCacheData, options) => {\n const nodeId = options.args!.id?.toString();\n invariant(nodeId, \"Expected an `id` argument\");\n return options.toReference(nodeId);\n };\n"],
5
- "mappings": ";AAEA,OAAO,eAAe;AAYf,IAAM,2DACX,CAAC,oBAAoB,YAAY;AAC/B,QAAM,SAAS,QAAQ,KAAM;AAC7B,YAAU,QAAQ,2BAA2B;AAE7C,QAAM,gBACJ,QAAQ,MAAO,aAAc,WAAW;AAAA,IACtC,CAAC,QAAQ,IAAI,SAAS;AAAA,EACxB,EACA,IAAI,CAAC,uBAAuB,mBAAmB,KAAK,KAAK;AAC3D;AAAA,IACE,cAAc,WAAW;AAAA,IACzB;AAAA,IACA,cAAc;AAAA,EAChB;AACA,QAAM,eAAe,cAAc,CAAC;AAEpC,QAAM,WAAW,QAAQ,MAAM,YAAY;AAAA,IACzC,CAAC,YACC,QAAQ,SAAS,wBACjB,QAAQ,KAAK,UAAU;AAAA,EAC3B;AACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO,QAAQ,YAAY;AAAA,IACzB,YAAY,SAAS,cAAc,KAAK;AAAA,IACxC,IAAI;AAAA,EACN,CAAC;AACH;AA2BK,IAAM,sDACX,CAAC,oBAAoB,YAAY;AA1EnC;AA2EI,QAAM,UAAS,aAAQ,KAAM,OAAd,mBAAkB;AACjC,YAAU,QAAQ,2BAA2B;AAC7C,SAAO,QAAQ,YAAY,MAAM;AACnC;",
4
+ "sourcesContent": ["import { FieldReadFunction } from \"@apollo/client\";\nimport { FragmentSpreadNode, FragmentDefinitionNode } from \"graphql\";\nimport invariant from \"invariant\";\n\n/**\n * Use this as the field policy function for the node root field, which is what\n * gets invoked when using relay-compiler's refetch query. Queries that use a\n * cache-only cache-policy will read the data from the store, which is expected\n * to be populated by a different query beforehand.\n *\n * This specific version is for when you're using Apollo Client's default\n * configuration, which prefixes the `id` value with the typename for its store\n * keys.\n */\nexport const nodeFromCacheFieldPolicyWithDefaultApolloClientStoreKeys: FieldReadFunction =\n (_existingCacheData, options) => {\n const nodeId = options.args?.id;\n invariant(nodeId, \"Expected an `id` argument\");\n\n const fragmentNames = (\n options.field?.selectionSet?.selections.filter(\n (sel) => sel.kind === \"FragmentSpread\",\n ) as FragmentSpreadNode[]\n ).map((fragmentSpreadNode) => fragmentSpreadNode.name.value);\n invariant(\n fragmentNames.length === 1,\n \"Expected a single fragment spread in the watch node query, instead got `%s`\",\n fragmentNames.length,\n );\n const fragmentName = fragmentNames[0];\n\n const fragment = options.query.definitions.find(\n (defNode) =>\n defNode.kind === \"FragmentDefinition\" &&\n defNode.name.value === fragmentName,\n ) as FragmentDefinitionNode;\n invariant(\n fragment,\n \"Expected document to contain a fragment by name `%s`\",\n fragmentName,\n );\n\n return options.toReference({\n __typename: fragment.typeCondition.name.value,\n id: nodeId,\n });\n };\n\n/**\n * Use this as the field policy function for the node root field, which is what\n * gets invoked when using relay-compiler's refetch query. Queries that use a\n * cache-only cache-policy will read the data from the store, which is expected\n * to be populated by a different query beforehand.\n *\n * This specific version is for when your Apollo Client instance is configured\n * to strictly follow the Global Object Identification and there's no need for\n * Apollo Client to prefix the `id` value with the typename for its store keys.\n *\n * @example\n * \n ```ts\n new InMemoryCache({\n dataIdFromObject(responseObject) {\n return (\n responseObject.id?.toString() ||\n defaultDataIdFromObject(responseObject)\n );\n }\n })\n ```\n * \n * @see {https://www.apollographql.com/docs/react/caching/cache-configuration/}\n */\nexport const nodeFromCacheFieldPolicyWithGlobalObjectIdStoreKeys: FieldReadFunction =\n (_existingCacheData, options) => {\n const nodeId = options.args?.id?.toString();\n invariant(nodeId, \"Expected an `id` argument\");\n return options.toReference(nodeId);\n };\n"],
5
+ "mappings": ";AAEA,OAAO,eAAe;AAYf,IAAM,2DACX,CAAC,oBAAoB,YAAY;AAfnC;AAgBI,QAAM,UAAS,aAAQ,SAAR,mBAAc;AAC7B,YAAU,QAAQ,2BAA2B;AAE7C,QAAM,kBACJ,mBAAQ,UAAR,mBAAe,iBAAf,mBAA6B,WAAW;AAAA,IACtC,CAAC,QAAQ,IAAI,SAAS;AAAA,KAExB,IAAI,CAAC,uBAAuB,mBAAmB,KAAK,KAAK;AAC3D;AAAA,IACE,cAAc,WAAW;AAAA,IACzB;AAAA,IACA,cAAc;AAAA,EAChB;AACA,QAAM,eAAe,cAAc,CAAC;AAEpC,QAAM,WAAW,QAAQ,MAAM,YAAY;AAAA,IACzC,CAAC,YACC,QAAQ,SAAS,wBACjB,QAAQ,KAAK,UAAU;AAAA,EAC3B;AACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO,QAAQ,YAAY;AAAA,IACzB,YAAY,SAAS,cAAc,KAAK;AAAA,IACxC,IAAI;AAAA,EACN,CAAC;AACH;AA2BK,IAAM,sDACX,CAAC,oBAAoB,YAAY;AA1EnC;AA2EI,QAAM,UAAS,mBAAQ,SAAR,mBAAc,OAAd,mBAAkB;AACjC,YAAU,QAAQ,2BAA2B;AAC7C,SAAO,QAAQ,YAAY,MAAM;AACnC;",
6
6
  "names": []
7
7
  }
@@ -19,5 +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, any>, nextProps: Record<K, any>) => boolean;
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;
23
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,eAEX,OAAO,CAAC,EAAE,GAAG,CAAC,aAAa,OAAO,CAAC,EAAE,GAAG,CAAC,aA0B7D"}
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"}
@@ -44,7 +44,7 @@ function shallowCompareFragmentReferences(...fragmentReferenceProps) {
44
44
  }
45
45
  for (let i = 0; i < keysPrev.length; i++) {
46
46
  const checkKey = keysPrev[i];
47
- if (!nextProps.hasOwnProperty(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(prevProps[checkKey], nextProps[checkKey]) : !Object.is(prevProps[checkKey], nextProps[checkKey])) {
48
48
  return false;
49
49
  }
50
50
  }
@@ -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 (prevProps: Record<K, any>, nextProps: Record<K, any>) => {\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 !nextProps.hasOwnProperty(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?: any }, objB: { id?: any }) {\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,CAAC,WAA2B,cAA8B;AAC/D,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,UAAU,eAAe,QAAQ,KAClC,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,MAAoB,MAAoB;AACxD,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<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;",
6
6
  "names": ["invariant"]
7
7
  }
@@ -12,7 +12,7 @@ function shallowCompareFragmentReferences(...fragmentReferenceProps) {
12
12
  }
13
13
  for (let i = 0; i < keysPrev.length; i++) {
14
14
  const checkKey = keysPrev[i];
15
- if (!nextProps.hasOwnProperty(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(prevProps[checkKey], nextProps[checkKey]) : !Object.is(prevProps[checkKey], nextProps[checkKey])) {
16
16
  return false;
17
17
  }
18
18
  }
@@ -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 (prevProps: Record<K, any>, nextProps: Record<K, any>) => {\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 !nextProps.hasOwnProperty(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?: any }, objB: { id?: any }) {\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,CAAC,WAA2B,cAA8B;AAC/D,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,UAAU,eAAe,QAAQ,KAClC,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,MAAoB,MAAoB;AACxD;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<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,OAA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,IAAI,aAAa,CAAC,OAAO,CAC/D,aAAa,CAAC,KAAK,CAAC,CACrB,GAAG,IAAI,CAAC,CAAC;AACV,oBAAY,gBAAgB,CAC1B,IAAI,SAAS,YAAY,CAAC,KAAK,CAAC,EAChC,KAAK,GAAG,OAAO,IACb,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC"}
package/lib/types.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/types.ts"],
4
- "sourcesContent": ["import type { DocumentNode } from \"graphql\";\n\nexport interface Variables {\n [name: string]: any;\n}\n\nexport interface Context {\n [name: string]: any;\n}\n\nexport interface OperationType {\n readonly variables: Variables;\n readonly context?: Context;\n readonly response: unknown;\n readonly rawResponse?: unknown;\n}\n\nexport type GraphQLTaggedNode =\n | (DocumentNode & { watchQueryDocument?: never })\n | { watchQueryDocument: DocumentNode; executeQueryDocument?: DocumentNode };\n\nexport type FetchPolicy =\n | \"store-or-network\"\n | \"store-and-network\"\n | \"network-only\"\n | \"store-only\";\n\n/**\n * relay-compiler-language-typescript support for fragment references\n */\n\nexport interface _RefType<Ref extends string> {\n \" $refType\": Ref;\n}\n\nexport interface _FragmentRefs<Refs extends string> {\n \" $fragmentRefs\": FragmentRefs<Refs>;\n}\n\n// This is used in the actual artifacts to define the various fragment references a container holds.\nexport type FragmentRefs<Refs extends string> = {\n [ref in Refs]: true;\n};\n\n// This is a utility type for converting from a data type to a fragment reference that will resolve to that data type.\nexport type FragmentRef<Fragment> = Fragment extends _RefType<infer U>\n ? _FragmentRefs<U>\n : never;\n\n/**\n * react-relay DT\n */\n\nexport type FragmentReference = unknown;\n\nexport type KeyType<TData = unknown> = Readonly<{\n \" $data\"?: TData;\n \" $fragmentRefs\": FragmentReference;\n}>;\n\nexport type KeyTypeData<\n TKey extends KeyType<TData>,\n TData = unknown,\n> = Required<TKey>[\" $data\"];\n\nexport type ArrayKeyType<TData = unknown> = ReadonlyArray<KeyType<\n ReadonlyArray<TData>\n> | null>;\nexport type ArrayKeyTypeData<\n TKey extends ArrayKeyType<TData>,\n TData = unknown,\n> = KeyTypeData<NonNullable<TKey[number]>>;\n"],
4
+ "sourcesContent": ["import type { DocumentNode } from \"graphql\";\n\nexport interface Variables {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [name: string]: any;\n}\n\nexport interface Context {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [name: string]: any;\n}\n\nexport interface OperationType {\n readonly variables: Variables;\n readonly context?: Context;\n readonly response: unknown;\n readonly rawResponse?: unknown;\n}\n\nexport type GraphQLTaggedNode =\n | (DocumentNode & { watchQueryDocument?: never })\n | { watchQueryDocument: DocumentNode; executeQueryDocument?: DocumentNode };\n\nexport type FetchPolicy =\n | \"store-or-network\"\n | \"store-and-network\"\n | \"network-only\"\n | \"store-only\";\n\n/**\n * relay-compiler-language-typescript support for fragment references\n */\n\nexport interface _RefType<Ref extends string> {\n \" $refType\": Ref;\n}\n\nexport interface _FragmentRefs<Refs extends string> {\n \" $fragmentRefs\": FragmentRefs<Refs>;\n}\n\n// This is used in the actual artifacts to define the various fragment references a container holds.\nexport type FragmentRefs<Refs extends string> = {\n [ref in Refs]: true;\n};\n\n// This is a utility type for converting from a data type to a fragment reference that will resolve to that data type.\nexport type FragmentRef<Fragment> = Fragment extends _RefType<infer U>\n ? _FragmentRefs<U>\n : never;\n\n/**\n * react-relay DT\n */\n\nexport type FragmentReference = unknown;\n\nexport type KeyType<TData = unknown> = Readonly<{\n \" $data\"?: TData;\n \" $fragmentRefs\": FragmentReference;\n}>;\n\nexport type KeyTypeData<\n TKey extends KeyType<TData>,\n TData = unknown,\n> = Required<TKey>[\" $data\"];\n\nexport type ArrayKeyType<TData = unknown> = ReadonlyArray<KeyType<\n ReadonlyArray<TData>\n> | null>;\nexport type ArrayKeyTypeData<\n TKey extends ArrayKeyType<TData>,\n TData = unknown,\n> = KeyTypeData<NonNullable<TKey[number]>>;\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -13,6 +13,6 @@ export declare function useOverridenOrDefaultApolloClient(): ApolloClient<any>;
13
13
  * different ApolloClient instance than the rest of the tree above and below it.
14
14
  */
15
15
  export declare const ApolloReactRelayDuctTapeProvider: React.FC<{
16
- client: ApolloClient<any>;
16
+ client: ApolloClient<unknown>;
17
17
  }>;
18
18
  //# sourceMappingURL=useOverridenOrDefaultApolloClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOverridenOrDefaultApolloClient.d.ts","sourceRoot":"","sources":["../src/useOverridenOrDefaultApolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEb,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,wBAAgB,iCAAiC,IAAI,YAAY,CAAC,GAAG,CAAC,CAMrE;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,EAAE,KAAK,CAAC,EAAE,CAAC;IACtD,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;CAC3B,CAUA,CAAC"}
1
+ {"version":3,"file":"useOverridenOrDefaultApolloClient.d.ts","sourceRoot":"","sources":["../src/useOverridenOrDefaultApolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEb,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,wBAAgB,iCAAiC,sBAOhD;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,EAAE,KAAK,CAAC,EAAE,CAAC;IACtD,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;CAC/B,CAUA,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/useOverridenOrDefaultApolloClient.ts"],
4
- "sourcesContent": ["import {\n ApolloClient,\n useApolloClient as useDefaultApolloClient,\n} from \"@apollo/client\";\nimport invariant from \"invariant\";\nimport React from \"react\";\n\n/**\n * @internal\n */\nexport function useOverridenOrDefaultApolloClient(): ApolloClient<any> {\n const client = React.useContext(ApolloReactRelayDuctTapeContext);\n if (client) {\n return client;\n }\n return useDefaultApolloClient();\n}\n\nconst ApolloReactRelayDuctTapeContext = React.createContext<\n ApolloClient<any> | undefined\n>(undefined);\n\n/**\n * A context provider that allows passing an explicit ApolloClient instance to\n * the apollo-react-relay-duct-tape hooks. If this provider is not used, the\n * hooks will default to one provided by @apollo/client's ApolloProvider.\n *\n * This allows a subset of a tree to use apollo-react-relay-duct-tape using a\n * different ApolloClient instance than the rest of the tree above and below it.\n */\nexport const ApolloReactRelayDuctTapeProvider: React.FC<{\n client: ApolloClient<any>;\n}> = (props) => {\n invariant(\n props.client,\n \"ApolloReactRelayDuctTapeProvider: client is required\",\n );\n return React.createElement(\n ApolloReactRelayDuctTapeContext.Provider,\n { value: props.client },\n props.children,\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAGO;AACP,uBAAsB;AACtB,mBAAkB;AAKX,SAAS,oCAAuD;AACrE,QAAM,SAAS,aAAAA,QAAM,WAAW,+BAA+B;AAC/D,MAAI,QAAQ;AACV,WAAO;AAAA,EACT;AACA,aAAO,cAAAC,iBAAuB;AAChC;AAEA,MAAM,kCAAkC,aAAAD,QAAM,cAE5C,MAAS;AAUJ,MAAM,mCAER,CAAC,UAAU;AACd,uBAAAE;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AACA,SAAO,aAAAF,QAAM;AAAA,IACX,gCAAgC;AAAA,IAChC,EAAE,OAAO,MAAM,OAAO;AAAA,IACtB,MAAM;AAAA,EACR;AACF;",
4
+ "sourcesContent": ["import {\n ApolloClient,\n useApolloClient as useDefaultApolloClient,\n} from \"@apollo/client\";\nimport invariant from \"invariant\";\nimport React from \"react\";\n\n/**\n * @internal\n */\nexport function useOverridenOrDefaultApolloClient() {\n const client = React.useContext(ApolloReactRelayDuctTapeContext);\n if (client) {\n return client;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return useDefaultApolloClient() as ApolloClient<any>;\n}\n\nconst ApolloReactRelayDuctTapeContext = React.createContext<\n ApolloClient<unknown> | undefined\n>(undefined);\n\n/**\n * A context provider that allows passing an explicit ApolloClient instance to\n * the apollo-react-relay-duct-tape hooks. If this provider is not used, the\n * hooks will default to one provided by @apollo/client's ApolloProvider.\n *\n * This allows a subset of a tree to use apollo-react-relay-duct-tape using a\n * different ApolloClient instance than the rest of the tree above and below it.\n */\nexport const ApolloReactRelayDuctTapeProvider: React.FC<{\n client: ApolloClient<unknown>;\n}> = (props) => {\n invariant(\n props.client,\n \"ApolloReactRelayDuctTapeProvider: client is required\",\n );\n return React.createElement(\n ApolloReactRelayDuctTapeContext.Provider,\n { value: props.client },\n props.children,\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAGO;AACP,uBAAsB;AACtB,mBAAkB;AAKX,SAAS,oCAAoC;AAClD,QAAM,SAAS,aAAAA,QAAM,WAAW,+BAA+B;AAC/D,MAAI,QAAQ;AACV,WAAO;AAAA,EACT;AAEA,aAAO,cAAAC,iBAAuB;AAChC;AAEA,MAAM,kCAAkC,aAAAD,QAAM,cAE5C,MAAS;AAUJ,MAAM,mCAER,CAAC,UAAU;AACd,uBAAAE;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AACA,SAAO,aAAAF,QAAM;AAAA,IACX,gCAAgC;AAAA,IAChC,EAAE,OAAO,MAAM,OAAO;AAAA,IACtB,MAAM;AAAA,EACR;AACF;",
6
6
  "names": ["React", "useDefaultApolloClient", "invariant"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/useOverridenOrDefaultApolloClient.ts"],
4
- "sourcesContent": ["import {\n ApolloClient,\n useApolloClient as useDefaultApolloClient,\n} from \"@apollo/client\";\nimport invariant from \"invariant\";\nimport React from \"react\";\n\n/**\n * @internal\n */\nexport function useOverridenOrDefaultApolloClient(): ApolloClient<any> {\n const client = React.useContext(ApolloReactRelayDuctTapeContext);\n if (client) {\n return client;\n }\n return useDefaultApolloClient();\n}\n\nconst ApolloReactRelayDuctTapeContext = React.createContext<\n ApolloClient<any> | undefined\n>(undefined);\n\n/**\n * A context provider that allows passing an explicit ApolloClient instance to\n * the apollo-react-relay-duct-tape hooks. If this provider is not used, the\n * hooks will default to one provided by @apollo/client's ApolloProvider.\n *\n * This allows a subset of a tree to use apollo-react-relay-duct-tape using a\n * different ApolloClient instance than the rest of the tree above and below it.\n */\nexport const ApolloReactRelayDuctTapeProvider: React.FC<{\n client: ApolloClient<any>;\n}> = (props) => {\n invariant(\n props.client,\n \"ApolloReactRelayDuctTapeProvider: client is required\",\n );\n return React.createElement(\n ApolloReactRelayDuctTapeContext.Provider,\n { value: props.client },\n props.children,\n );\n};\n"],
5
- "mappings": ";AAAA;AAAA,EAEE,mBAAmB;AAAA,OACd;AACP,OAAO,eAAe;AACtB,OAAO,WAAW;AAKX,SAAS,oCAAuD;AACrE,QAAM,SAAS,MAAM,WAAW,+BAA+B;AAC/D,MAAI,QAAQ;AACV,WAAO;AAAA,EACT;AACA,SAAO,uBAAuB;AAChC;AAEA,IAAM,kCAAkC,MAAM,cAE5C,MAAS;AAUJ,IAAM,mCAER,CAAC,UAAU;AACd;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AACA,SAAO,MAAM;AAAA,IACX,gCAAgC;AAAA,IAChC,EAAE,OAAO,MAAM,OAAO;AAAA,IACtB,MAAM;AAAA,EACR;AACF;",
4
+ "sourcesContent": ["import {\n ApolloClient,\n useApolloClient as useDefaultApolloClient,\n} from \"@apollo/client\";\nimport invariant from \"invariant\";\nimport React from \"react\";\n\n/**\n * @internal\n */\nexport function useOverridenOrDefaultApolloClient() {\n const client = React.useContext(ApolloReactRelayDuctTapeContext);\n if (client) {\n return client;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return useDefaultApolloClient() as ApolloClient<any>;\n}\n\nconst ApolloReactRelayDuctTapeContext = React.createContext<\n ApolloClient<unknown> | undefined\n>(undefined);\n\n/**\n * A context provider that allows passing an explicit ApolloClient instance to\n * the apollo-react-relay-duct-tape hooks. If this provider is not used, the\n * hooks will default to one provided by @apollo/client's ApolloProvider.\n *\n * This allows a subset of a tree to use apollo-react-relay-duct-tape using a\n * different ApolloClient instance than the rest of the tree above and below it.\n */\nexport const ApolloReactRelayDuctTapeProvider: React.FC<{\n client: ApolloClient<unknown>;\n}> = (props) => {\n invariant(\n props.client,\n \"ApolloReactRelayDuctTapeProvider: client is required\",\n );\n return React.createElement(\n ApolloReactRelayDuctTapeContext.Provider,\n { value: props.client },\n props.children,\n );\n};\n"],
5
+ "mappings": ";AAAA;AAAA,EAEE,mBAAmB;AAAA,OACd;AACP,OAAO,eAAe;AACtB,OAAO,WAAW;AAKX,SAAS,oCAAoC;AAClD,QAAM,SAAS,MAAM,WAAW,+BAA+B;AAC/D,MAAI,QAAQ;AACV,WAAO;AAAA,EACT;AAEA,SAAO,uBAAuB;AAChC;AAEA,IAAM,kCAAkC,MAAM,cAE5C,MAAS;AAUJ,IAAM,mCAER,CAAC,UAAU;AACd;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AACA,SAAO,MAAM;AAAA,IACX,gCAAgC;AAAA,IAChC,EAAE,OAAO,MAAM,OAAO;AAAA,IACtB,MAAM;AAAA,EACR;AACF;",
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.1",
5
+ "version": "1.0.3",
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.0.0-alpha.2",
33
+ "@graphitation/apollo-react-relay-duct-tape-compiler": "^1.1.0",
34
34
  "ts-expect": "^1.3.0"
35
35
  },
36
36
  "peerDependencies": {