@oxy.so/services 14.19.3 → 14.21.0

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 (63) hide show
  1. package/lib/commonjs/index.js.map +1 -1
  2. package/lib/commonjs/ui/client.js.map +1 -1
  3. package/lib/commonjs/ui/hooks/accountQueryPersistence.js +8 -1
  4. package/lib/commonjs/ui/hooks/accountQueryPersistence.js.map +1 -1
  5. package/lib/commonjs/ui/hooks/persistedQueryCache.js +103 -8
  6. package/lib/commonjs/ui/hooks/persistedQueryCache.js.map +1 -1
  7. package/lib/commonjs/ui/hooks/queryClient.js +5 -1
  8. package/lib/commonjs/ui/hooks/queryClient.js.map +1 -1
  9. package/lib/commonjs/ui/index.js.map +1 -1
  10. package/lib/commonjs/ui/utils/persistedDataVersion.js +16 -0
  11. package/lib/commonjs/ui/utils/persistedDataVersion.js.map +1 -0
  12. package/lib/module/index.js.map +1 -1
  13. package/lib/module/ui/client.js +3 -0
  14. package/lib/module/ui/client.js.map +1 -1
  15. package/lib/module/ui/hooks/accountQueryPersistence.js +9 -2
  16. package/lib/module/ui/hooks/accountQueryPersistence.js.map +1 -1
  17. package/lib/module/ui/hooks/persistedQueryCache.js +101 -8
  18. package/lib/module/ui/hooks/persistedQueryCache.js.map +1 -1
  19. package/lib/module/ui/hooks/queryClient.js +6 -2
  20. package/lib/module/ui/hooks/queryClient.js.map +1 -1
  21. package/lib/module/ui/index.js.map +1 -1
  22. package/lib/module/ui/utils/persistedDataVersion.js +12 -0
  23. package/lib/module/ui/utils/persistedDataVersion.js.map +1 -0
  24. package/lib/typescript/commonjs/index.d.ts +1 -0
  25. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/ui/client.d.ts +2 -0
  27. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/ui/hooks/accountQueryPersistence.d.ts +17 -0
  29. package/lib/typescript/commonjs/ui/hooks/accountQueryPersistence.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/ui/hooks/persistedQueryCache.d.ts +39 -3
  31. package/lib/typescript/commonjs/ui/hooks/persistedQueryCache.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/ui/hooks/queryClient.d.ts +2 -1
  33. package/lib/typescript/commonjs/ui/hooks/queryClient.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/ui/icons/Ionicons.d.ts +1 -1
  35. package/lib/typescript/commonjs/ui/icons/MaterialCommunityIcons.d.ts +1 -1
  36. package/lib/typescript/commonjs/ui/index.d.ts +1 -0
  37. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  38. package/lib/typescript/commonjs/ui/utils/persistedDataVersion.d.ts +10 -0
  39. package/lib/typescript/commonjs/ui/utils/persistedDataVersion.d.ts.map +1 -0
  40. package/lib/typescript/module/index.d.ts +1 -0
  41. package/lib/typescript/module/index.d.ts.map +1 -1
  42. package/lib/typescript/module/ui/client.d.ts +2 -0
  43. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  44. package/lib/typescript/module/ui/hooks/accountQueryPersistence.d.ts +17 -0
  45. package/lib/typescript/module/ui/hooks/accountQueryPersistence.d.ts.map +1 -1
  46. package/lib/typescript/module/ui/hooks/persistedQueryCache.d.ts +39 -3
  47. package/lib/typescript/module/ui/hooks/persistedQueryCache.d.ts.map +1 -1
  48. package/lib/typescript/module/ui/hooks/queryClient.d.ts +2 -1
  49. package/lib/typescript/module/ui/hooks/queryClient.d.ts.map +1 -1
  50. package/lib/typescript/module/ui/icons/Ionicons.d.ts +1 -1
  51. package/lib/typescript/module/ui/icons/MaterialCommunityIcons.d.ts +1 -1
  52. package/lib/typescript/module/ui/index.d.ts +1 -0
  53. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  54. package/lib/typescript/module/ui/utils/persistedDataVersion.d.ts +10 -0
  55. package/lib/typescript/module/ui/utils/persistedDataVersion.d.ts.map +1 -0
  56. package/package.json +3 -3
  57. package/src/index.ts +1 -0
  58. package/src/ui/client.ts +3 -0
  59. package/src/ui/hooks/accountQueryPersistence.ts +26 -0
  60. package/src/ui/hooks/persistedQueryCache.ts +132 -13
  61. package/src/ui/hooks/queryClient.ts +6 -1
  62. package/src/ui/index.ts +1 -0
  63. package/src/ui/utils/persistedDataVersion.ts +9 -0
@@ -30,6 +30,7 @@ import {
30
30
  PERSISTED_QUERY_PREFIXES,
31
31
  hydrateSnapshot,
32
32
  keepPersistedRootsInMemory,
33
+ persistedBuster,
33
34
  subscribeSnapshots,
34
35
  type PersistFilters,
35
36
  } from './persistedQueryCache';
@@ -147,7 +148,8 @@ export interface AttachPersistenceResult {
147
148
  /**
148
149
  * Restore, then keep writing, the account-agnostic cache.
149
150
  *
150
- * Queries written by another build are dropped; queued mutations are kept
151
+ * Queries written under another buster are dropped (the build, or the app's declared
152
+ * `dataVersion`); queued mutations are kept
151
153
  * (`persistedQueryCache.ts`). Whatever belongs to the account (`accountQueries`,
152
154
  * or a query marked `meta: { persist: 'account' }`) is left to
153
155
  * `createAccountQueryPersistence`, even under one of the SDK's prefixes, so
@@ -171,7 +173,9 @@ export const attachQueryPersistence = (
171
173
 
172
174
  const account = accountQueryOwnership(accountQueries);
173
175
  keepPersistedRootsInMemory(queryClient, PERSISTED_QUERY_PREFIXES);
176
+ const buster = persistedBuster(accountQueries?.dataVersion);
174
177
  const filters: PersistFilters = {
178
+ buster,
175
179
  persistsQuery: (query) => isSharedQuery(query) && !account.ownsQuery(query),
176
180
  // Every other mutation, whatever its status: paused ones are exactly the
177
181
  // ones that must survive a restart to replay when online.
@@ -185,6 +189,7 @@ export const attachQueryPersistence = (
185
189
  if (stopped) return;
186
190
  if (
187
191
  !hydrateSnapshot(queryClient, raw, QUERY_CACHE_MAX_AGE, {
192
+ buster,
188
193
  shouldRestoreQuery: (query) => !account.ownsQuery(query),
189
194
  restoreMutations: accountQueries?.clearUnregisteredMutations !== true,
190
195
  shouldRestoreMutation: (mutation) => !account.ownsMutationKey(mutation.mutationKey),
package/src/ui/index.ts CHANGED
@@ -39,6 +39,7 @@ export { RequireOxyAuth } from './components/RequireOxyAuth';
39
39
  export type { RequireOxyAuthProps, RequireOxyAuthPrompt } from './components/RequireOxyAuth';
40
40
  // `OxyProvider`'s `accountQueries`: the app's per-account offline cache.
41
41
  export type { AccountQueriesConfig, AccountQueryMeta } from './hooks/accountQueryPersistence';
42
+ export type { PersistedRootBound } from './hooks/persistedQueryCache';
42
43
  export { default as FollowButton } from './components/FollowButton';
43
44
  export { default as PeableButton } from './components/PeableButton';
44
45
  export type { PeableButtonProps } from './components/PeableButton';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This package's version, as part of every declared-version buster (`persistedBuster`).
3
+ *
4
+ * The SDK owns the shape of the shared roots (`accounts`, `users`, ...) and of the blob itself, so
5
+ * an app that declares its own data version still starts from the network after an SDK upgrade.
6
+ * `__tests__/hooks/persistedDataVersion.test.ts` keeps it equal to `package.json`'s `version`, so a
7
+ * release cannot forget it.
8
+ */
9
+ export const SERVICES_PERSISTED_DATA_VERSION = '14.21.0';