@oxy.so/services 11.10.0 → 11.12.1

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 (153) hide show
  1. package/lib/commonjs/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
  2. package/lib/commonjs/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
  3. package/lib/commonjs/assets/assets/fonts/icons/manifest.json +5 -4
  4. package/lib/commonjs/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
  5. package/lib/commonjs/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
  6. package/lib/commonjs/assets/fonts/icons/manifest.json +5 -4
  7. package/lib/commonjs/index.js +17 -0
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/commonjs/ui/appAssertion/AppAssertionContext.js +79 -0
  10. package/lib/commonjs/ui/appAssertion/AppAssertionContext.js.map +1 -0
  11. package/lib/commonjs/ui/appAssertion/appAssertionManager.js +309 -0
  12. package/lib/commonjs/ui/appAssertion/appAssertionManager.js.map +1 -0
  13. package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.js +18 -0
  14. package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.js.map +1 -0
  15. package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.native.js +30 -0
  16. package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.native.js.map +1 -0
  17. package/lib/commonjs/ui/appAssertion/appIntegrityTypes.js +6 -0
  18. package/lib/commonjs/ui/appAssertion/appIntegrityTypes.js.map +1 -0
  19. package/lib/commonjs/ui/components/fileManagement/FileAppAccessSection.js +121 -0
  20. package/lib/commonjs/ui/components/fileManagement/FileAppAccessSection.js.map +1 -0
  21. package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +6 -2
  22. package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
  23. package/lib/commonjs/ui/context/OxyContext.js +10 -1
  24. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  25. package/lib/commonjs/ui/hooks/mutations/mutationKeys.js +4 -0
  26. package/lib/commonjs/ui/hooks/mutations/mutationKeys.js.map +1 -1
  27. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +49 -1
  28. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  29. package/lib/commonjs/ui/hooks/queries/queryKeys.js +6 -1
  30. package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
  31. package/lib/commonjs/ui/hooks/queries/useFileQueries.js +35 -1
  32. package/lib/commonjs/ui/hooks/queries/useFileQueries.js.map +1 -1
  33. package/lib/commonjs/ui/icons/subsetGlyphMaps.js +1 -0
  34. package/lib/commonjs/ui/icons/subsetGlyphMaps.js.map +1 -1
  35. package/lib/commonjs/ui/index.js +7 -0
  36. package/lib/commonjs/ui/index.js.map +1 -1
  37. package/lib/module/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
  38. package/lib/module/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
  39. package/lib/module/assets/assets/fonts/icons/manifest.json +5 -4
  40. package/lib/module/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
  41. package/lib/module/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
  42. package/lib/module/assets/fonts/icons/manifest.json +5 -4
  43. package/lib/module/index.js +4 -0
  44. package/lib/module/index.js.map +1 -1
  45. package/lib/module/ui/appAssertion/AppAssertionContext.js +72 -0
  46. package/lib/module/ui/appAssertion/AppAssertionContext.js.map +1 -0
  47. package/lib/module/ui/appAssertion/appAssertionManager.js +304 -0
  48. package/lib/module/ui/appAssertion/appAssertionManager.js.map +1 -0
  49. package/lib/module/ui/appAssertion/appIntegrityPlatform.js +14 -0
  50. package/lib/module/ui/appAssertion/appIntegrityPlatform.js.map +1 -0
  51. package/lib/module/ui/appAssertion/appIntegrityPlatform.native.js +26 -0
  52. package/lib/module/ui/appAssertion/appIntegrityPlatform.native.js.map +1 -0
  53. package/lib/module/ui/appAssertion/appIntegrityTypes.js +4 -0
  54. package/lib/module/ui/appAssertion/appIntegrityTypes.js.map +1 -0
  55. package/lib/module/ui/components/fileManagement/FileAppAccessSection.js +116 -0
  56. package/lib/module/ui/components/fileManagement/FileAppAccessSection.js.map +1 -0
  57. package/lib/module/ui/components/fileManagement/FileDetailsModal.js +6 -2
  58. package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
  59. package/lib/module/ui/context/OxyContext.js +10 -1
  60. package/lib/module/ui/context/OxyContext.js.map +1 -1
  61. package/lib/module/ui/hooks/mutations/mutationKeys.js +4 -0
  62. package/lib/module/ui/hooks/mutations/mutationKeys.js.map +1 -1
  63. package/lib/module/ui/hooks/mutations/useAccountMutations.js +47 -0
  64. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  65. package/lib/module/ui/hooks/queries/queryKeys.js +6 -1
  66. package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
  67. package/lib/module/ui/hooks/queries/useFileQueries.js +33 -1
  68. package/lib/module/ui/hooks/queries/useFileQueries.js.map +1 -1
  69. package/lib/module/ui/icons/subsetGlyphMaps.js +1 -0
  70. package/lib/module/ui/icons/subsetGlyphMaps.js.map +1 -1
  71. package/lib/module/ui/index.js +1 -0
  72. package/lib/module/ui/index.js.map +1 -1
  73. package/lib/typescript/commonjs/index.d.ts +3 -0
  74. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/ui/appAssertion/AppAssertionContext.d.ts +41 -0
  76. package/lib/typescript/commonjs/ui/appAssertion/AppAssertionContext.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/ui/appAssertion/appAssertionManager.d.ts +92 -0
  78. package/lib/typescript/commonjs/ui/appAssertion/appAssertionManager.d.ts.map +1 -0
  79. package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.d.ts +9 -0
  80. package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.native.d.ts +3 -0
  82. package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.native.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/ui/appAssertion/appIntegrityTypes.d.ts +22 -0
  84. package/lib/typescript/commonjs/ui/appAssertion/appIntegrityTypes.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/ui/components/fileManagement/FileAppAccessSection.d.ts +15 -0
  86. package/lib/typescript/commonjs/ui/components/fileManagement/FileAppAccessSection.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts +2 -1
  88. package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
  89. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts +3 -0
  91. package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +13 -1
  93. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  94. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +5 -0
  95. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  96. package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts +11 -1
  97. package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
  98. package/lib/typescript/commonjs/ui/icons/MaterialCommunityIcons.d.ts +1 -1
  99. package/lib/typescript/commonjs/ui/icons/MaterialCommunityIcons.d.ts.map +1 -1
  100. package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts +1 -0
  101. package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
  102. package/lib/typescript/commonjs/ui/index.d.ts +2 -0
  103. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  104. package/lib/typescript/module/index.d.ts +3 -0
  105. package/lib/typescript/module/index.d.ts.map +1 -1
  106. package/lib/typescript/module/ui/appAssertion/AppAssertionContext.d.ts +41 -0
  107. package/lib/typescript/module/ui/appAssertion/AppAssertionContext.d.ts.map +1 -0
  108. package/lib/typescript/module/ui/appAssertion/appAssertionManager.d.ts +92 -0
  109. package/lib/typescript/module/ui/appAssertion/appAssertionManager.d.ts.map +1 -0
  110. package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.d.ts +9 -0
  111. package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.d.ts.map +1 -0
  112. package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.native.d.ts +3 -0
  113. package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.native.d.ts.map +1 -0
  114. package/lib/typescript/module/ui/appAssertion/appIntegrityTypes.d.ts +22 -0
  115. package/lib/typescript/module/ui/appAssertion/appIntegrityTypes.d.ts.map +1 -0
  116. package/lib/typescript/module/ui/components/fileManagement/FileAppAccessSection.d.ts +15 -0
  117. package/lib/typescript/module/ui/components/fileManagement/FileAppAccessSection.d.ts.map +1 -0
  118. package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts +2 -1
  119. package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
  120. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  121. package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts +3 -0
  122. package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
  123. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +13 -1
  124. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  125. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +5 -0
  126. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  127. package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts +11 -1
  128. package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
  129. package/lib/typescript/module/ui/icons/MaterialCommunityIcons.d.ts +1 -1
  130. package/lib/typescript/module/ui/icons/MaterialCommunityIcons.d.ts.map +1 -1
  131. package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts +1 -0
  132. package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
  133. package/lib/typescript/module/ui/index.d.ts +2 -0
  134. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  135. package/package.json +8 -6
  136. package/src/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
  137. package/src/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
  138. package/src/assets/fonts/icons/manifest.json +5 -4
  139. package/src/index.ts +12 -0
  140. package/src/ui/appAssertion/AppAssertionContext.tsx +109 -0
  141. package/src/ui/appAssertion/appAssertionManager.ts +363 -0
  142. package/src/ui/appAssertion/appIntegrityPlatform.native.ts +27 -0
  143. package/src/ui/appAssertion/appIntegrityPlatform.ts +12 -0
  144. package/src/ui/appAssertion/appIntegrityTypes.ts +23 -0
  145. package/src/ui/components/fileManagement/FileAppAccessSection.tsx +111 -0
  146. package/src/ui/components/fileManagement/FileDetailsModal.tsx +5 -1
  147. package/src/ui/context/OxyContext.tsx +13 -1
  148. package/src/ui/hooks/mutations/mutationKeys.ts +5 -0
  149. package/src/ui/hooks/mutations/useAccountMutations.ts +33 -0
  150. package/src/ui/hooks/queries/queryKeys.ts +5 -0
  151. package/src/ui/hooks/queries/useFileQueries.ts +44 -2
  152. package/src/ui/icons/subsetGlyphMaps.ts +1 -0
  153. package/src/ui/index.ts +2 -0
@@ -125,6 +125,7 @@ import { useFollow } from '../hooks/useFollow';
125
125
  import { commitDeviceSetAndResolve } from './commitSessionFlow';
126
126
  import { clearSignInFlows } from '../components/signIn/signInFlowStore';
127
127
  import { useOxyAccountGraph } from './useOxyAccountGraph';
128
+ import { AppAssertionProvider } from '../appAssertion/AppAssertionContext';
128
129
 
129
130
  export type { LogoutResult, OxyContextState, OxyRuntimeProviderProps } from './oxyContextTypes';
130
131
 
@@ -1742,7 +1743,18 @@ export const OxyRuntimeProvider: React.FC<OxyRuntimeProviderProps> = ({
1742
1743
  return (
1743
1744
  <OxyRuntimeHandleProvider value={runtime}>
1744
1745
  <OxyAuthActionsContext.Provider value={authActionsValue}>
1745
- <OxyRuntimeContext.Provider value={contextValue}>{children}</OxyRuntimeContext.Provider>
1746
+ <OxyRuntimeContext.Provider value={contextValue}>
1747
+ <AppAssertionProvider
1748
+ oxyServices={oxyServices}
1749
+ clientId={clientId}
1750
+ userId={canUsePrivateApi ? (user?.id ?? null) : null}
1751
+ sessionId={canUsePrivateApi ? activeSessionId : null}
1752
+ storage={storage}
1753
+ storageKeyPrefix={storageKeyPrefix}
1754
+ >
1755
+ {children}
1756
+ </AppAssertionProvider>
1757
+ </OxyRuntimeContext.Provider>
1746
1758
  </OxyAuthActionsContext.Provider>
1747
1759
  </OxyRuntimeHandleProvider>
1748
1760
  );
@@ -36,4 +36,9 @@ export const mutationKeys = {
36
36
  connectedApps: {
37
37
  revoke: ['mutation', 'connectedApps', 'revoke'] as const,
38
38
  },
39
+
40
+ // A file's applications with access (ADR 0043 stage 4c)
41
+ fileAppAccess: {
42
+ revoke: ['mutation', 'fileAppAccess', 'revoke'] as const,
43
+ },
39
44
  } as const;
@@ -3,6 +3,7 @@ import { authenticatedApiCall } from '@oxy.so/core';
3
3
  import type {
4
4
  AssetMetadata,
5
5
  AssetUploadInput,
6
+ FileApplicationAccessRevocation,
6
7
  NotificationPreferences,
7
8
  PrivacySettings,
8
9
  User,
@@ -21,6 +22,7 @@ import { useOxy } from '../../context/OxyContext';
21
22
  import { toast } from '@oxy.so/bloom/toast';
22
23
  import { useAuthStore } from '../../stores/authStore';
23
24
  import { clearedFieldsFromProfileUpdate, upsertCachedUser } from '../queries/userCache';
25
+ import { removeAppAccessFromCache } from '../queries/useFileQueries';
24
26
 
25
27
  /**
26
28
  * Update user profile with optimistic updates and offline queue support
@@ -708,3 +710,34 @@ export const useUploadFile = () => {
708
710
  },
709
711
  });
710
712
  };
713
+
714
+ /**
715
+ * Take an application's access to one of the person's files away (ADR 0043
716
+ * stage 4c): optimistic — the application leaves the cached list at once and
717
+ * comes back if the revoke fails — then the list is re-read either way. The
718
+ * caller shows its own toasts (it knows the application's name).
719
+ */
720
+ export const useRevokeFileAppAccess = () => {
721
+ const { oxyServices, activeSessionId } = useOxy();
722
+ const queryClient = useQueryClient();
723
+
724
+ return useMutation({
725
+ mutationKey: [...mutationKeys.fileAppAccess.revoke],
726
+ mutationFn: async ({ fileId, applicationId }: { fileId: string; applicationId: string }) =>
727
+ authenticatedApiCall<FileApplicationAccessRevocation>(oxyServices, activeSessionId, () =>
728
+ oxyServices.assets.revokeAppAccess(fileId, applicationId),
729
+ ),
730
+ onMutate: async ({ fileId, applicationId }) => {
731
+ await queryClient.cancelQueries({ queryKey: queryKeys.files.appAccess(fileId) });
732
+ return { previous: removeAppAccessFromCache(queryClient, fileId, applicationId) };
733
+ },
734
+ onError: (_error, { fileId }, context) => {
735
+ if (context?.previous) {
736
+ queryClient.setQueryData(queryKeys.files.appAccess(fileId), context.previous);
737
+ }
738
+ },
739
+ onSettled: (_data, _error, { fileId }) => {
740
+ void queryClient.invalidateQueries({ queryKey: queryKeys.files.appAccess(fileId) });
741
+ },
742
+ });
743
+ };
@@ -115,6 +115,11 @@ export const queryKeys = {
115
115
  list: (ownerId?: string) => [...queryKeys.files.all, 'list', ownerId || 'anonymous'] as const,
116
116
  /** The owner's trash (ADR 0043 D5) — under `files.all`, so one invalidation covers both. */
117
117
  trash: (ownerId?: string) => [...queryKeys.files.all, 'trash', ownerId || 'anonymous'] as const,
118
+ /**
119
+ * The applications that can read one file with their own token (ADR 0043
120
+ * stage 4c) — under `files.all`, so a library invalidation refreshes it too.
121
+ */
122
+ appAccess: (fileId: string) => [...queryKeys.files.all, 'appAccess', fileId] as const,
118
123
  },
119
124
 
120
125
  // Connected apps (OAuth grants the user has authorized)
@@ -9,8 +9,13 @@
9
9
  * infinite scroll, pull-to-refresh, and optimistic upload reconciliation.
10
10
  */
11
11
 
12
- import { useInfiniteQuery, type InfiniteData, type QueryClient } from '@tanstack/react-query';
13
- import type { FileMetadata } from '@oxy.so/core';
12
+ import {
13
+ useInfiniteQuery,
14
+ useQuery,
15
+ type InfiniteData,
16
+ type QueryClient,
17
+ } from '@tanstack/react-query';
18
+ import type { FileApplicationAccess, FileMetadata } from '@oxy.so/core';
14
19
  import { useOxy } from '../../context/OxyContext';
15
20
  import { queryKeys } from './queryKeys';
16
21
 
@@ -185,3 +190,40 @@ export function patchFileMetadataInCache(
185
190
  : data,
186
191
  );
187
192
  }
193
+
194
+ // --- Applications with access (ADR 0043 stage 4c) ---------------------------
195
+
196
+ /**
197
+ * The applications that can open one of the owner's files with their own
198
+ * token: one that stored it for the person, or one the person attached it to.
199
+ * Fetched when `enabled` (the owner's own file); `staleTime: 0` re-reads it
200
+ * every time the details open, since an application can gain access at any
201
+ * time (a new upload on the person's behalf).
202
+ */
203
+ export const useFileAppAccess = (fileId: string, enabled = true) => {
204
+ const { oxyServices } = useOxy();
205
+ return useQuery<FileApplicationAccess[], Error>({
206
+ queryKey: queryKeys.files.appAccess(fileId),
207
+ queryFn: () => oxyServices.assets.listAppAccess(fileId),
208
+ enabled: enabled && fileId.length > 0,
209
+ staleTime: 0,
210
+ refetchOnWindowFocus: false,
211
+ });
212
+ };
213
+
214
+ /** Drop one application from a file's cached access list (the optimistic half of a revoke). */
215
+ export function removeAppAccessFromCache(
216
+ queryClient: QueryClient,
217
+ fileId: string,
218
+ applicationId: string,
219
+ ): FileApplicationAccess[] | undefined {
220
+ const key = queryKeys.files.appAccess(fileId);
221
+ const previous = queryClient.getQueryData<FileApplicationAccess[]>(key);
222
+ if (previous) {
223
+ queryClient.setQueryData<FileApplicationAccess[]>(
224
+ key,
225
+ previous.filter((app) => app.applicationId !== applicationId),
226
+ );
227
+ }
228
+ return previous;
229
+ }
@@ -323,6 +323,7 @@ export const materialCommunityIconsGlyphMap = {
323
323
  "trophy": 984376,
324
324
  "trophy-outline": 984378,
325
325
  "update": 984752,
326
+ "upload": 984402,
326
327
  "video-outline": 986076,
327
328
  "volume-off": 984449,
328
329
  "wallet": 984452,
package/src/ui/index.ts CHANGED
@@ -37,6 +37,8 @@ export { default as ProfileButton } from './components/ProfileButton';
37
37
 
38
38
  // Context + hooks
39
39
  export { useOxy, useOptionalOxy, OxyProviderMissingError } from './context/OxyContext';
40
+ export { useAppAssertion } from './appAssertion/AppAssertionContext';
41
+ export type { UseAppAssertionResult } from './appAssertion/AppAssertionContext';
40
42
  export { useAuth } from './hooks/useAuth';
41
43
  export type { AuthActions, AuthState, SignInOutcome, UseAuthReturn } from './hooks/useAuth';
42
44
  export { useFollow, useSeedFollowStatuses } from './hooks/useFollow';