@tanstack/query-broadcast-client-experimental 4.0.11-beta.5 → 4.2.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 (32) hide show
  1. package/build/{lib → cjs}/index.js +0 -0
  2. package/build/{lib → cjs}/index.js.map +0 -0
  3. package/build/{lib/index.mjs → esm/index.js} +1 -1
  4. package/build/esm/index.js.map +1 -0
  5. package/build/stats-html.html +2689 -0
  6. package/build/stats.json +60 -0
  7. package/build/{lib → types/query-broadcast-client-experimental/src}/index.d.ts +0 -0
  8. package/build/types/query-core/src/focusManager.d.ts +16 -0
  9. package/build/types/query-core/src/hydration.d.ts +34 -0
  10. package/build/types/query-core/src/index.d.ts +20 -0
  11. package/build/types/query-core/src/infiniteQueryBehavior.d.ts +15 -0
  12. package/build/types/query-core/src/infiniteQueryObserver.d.ts +18 -0
  13. package/build/types/query-core/src/logger.d.ts +8 -0
  14. package/build/types/query-core/src/mutation.d.ts +70 -0
  15. package/build/types/query-core/src/mutationCache.d.ts +57 -0
  16. package/build/types/query-core/src/mutationObserver.d.ts +23 -0
  17. package/build/types/query-core/src/notifyManager.d.ts +18 -0
  18. package/build/types/query-core/src/onlineManager.d.ts +16 -0
  19. package/build/types/query-core/src/queriesObserver.d.ts +23 -0
  20. package/build/types/query-core/src/query.d.ts +119 -0
  21. package/build/types/query-core/src/queryCache.d.ts +64 -0
  22. package/build/types/query-core/src/queryClient.d.ts +65 -0
  23. package/build/types/query-core/src/queryObserver.d.ts +61 -0
  24. package/build/types/query-core/src/removable.d.ts +9 -0
  25. package/build/types/query-core/src/retryer.d.ts +33 -0
  26. package/build/types/query-core/src/subscribable.d.ts +10 -0
  27. package/build/types/query-core/src/types.d.ts +419 -0
  28. package/build/types/query-core/src/utils.d.ts +99 -0
  29. package/build/umd/index.development.js +1 -1
  30. package/build/umd/index.production.js +1 -1
  31. package/package.json +6 -16
  32. package/build/lib/index.mjs.map +0 -1
File without changes
File without changes
@@ -94,4 +94,4 @@ function broadcastQueryClient({
94
94
  }
95
95
 
96
96
  export { broadcastQueryClient };
97
- //# sourceMappingURL=index.mjs.map
97
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { BroadcastChannel } from 'broadcast-channel'\nimport type { QueryClient } from '@tanstack/query-core'\n\ninterface BroadcastQueryClientOptions {\n queryClient: QueryClient\n broadcastChannel?: string\n}\n\nexport function broadcastQueryClient({\n queryClient,\n broadcastChannel = 'tanstack-query',\n}: BroadcastQueryClientOptions) {\n let transaction = false\n const tx = (cb: () => void) => {\n transaction = true\n cb()\n transaction = false\n }\n\n const channel = new BroadcastChannel(broadcastChannel, {\n webWorkerSupport: false,\n })\n\n const queryCache = queryClient.getQueryCache()\n\n queryClient.getQueryCache().subscribe((queryEvent) => {\n if (transaction) {\n return\n }\n\n const {\n query: { queryHash, queryKey, state },\n } = queryEvent\n\n if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {\n channel.postMessage({\n type: 'updated',\n queryHash,\n queryKey,\n state,\n })\n }\n\n if (queryEvent.type === 'removed') {\n channel.postMessage({\n type: 'removed',\n queryHash,\n queryKey,\n })\n }\n })\n\n channel.onmessage = (action) => {\n if (!action?.type) {\n return\n }\n\n tx(() => {\n const { type, queryHash, queryKey, state } = action\n\n if (type === 'updated') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n query.setState(state)\n return\n }\n\n queryCache.build(\n queryClient,\n {\n queryKey,\n queryHash,\n },\n state,\n )\n } else if (type === 'removed') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n queryCache.remove(query)\n }\n }\n })\n }\n}\n"],"names":["broadcastQueryClient","queryClient","broadcastChannel","transaction","tx","cb","channel","BroadcastChannel","webWorkerSupport","queryCache","getQueryCache","subscribe","queryEvent","query","queryHash","queryKey","state","type","action","postMessage","onmessage","get","setState","build","remove"],"mappings":";;;;;;;;;;;;AAQO,SAASA,oBAAT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