@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.
- package/lib/commonjs/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/icons/manifest.json +5 -4
- package/lib/commonjs/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/commonjs/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/commonjs/assets/fonts/icons/manifest.json +5 -4
- package/lib/commonjs/index.js +17 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/appAssertion/AppAssertionContext.js +79 -0
- package/lib/commonjs/ui/appAssertion/AppAssertionContext.js.map +1 -0
- package/lib/commonjs/ui/appAssertion/appAssertionManager.js +309 -0
- package/lib/commonjs/ui/appAssertion/appAssertionManager.js.map +1 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.js +18 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.js.map +1 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.native.js +30 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.native.js.map +1 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityTypes.js +6 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityTypes.js.map +1 -0
- package/lib/commonjs/ui/components/fileManagement/FileAppAccessSection.js +121 -0
- package/lib/commonjs/ui/components/fileManagement/FileAppAccessSection.js.map +1 -0
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +6 -2
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +10 -1
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/mutationKeys.js +4 -0
- package/lib/commonjs/ui/hooks/mutations/mutationKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +49 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +6 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js +35 -1
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js.map +1 -1
- package/lib/commonjs/ui/icons/subsetGlyphMaps.js +1 -0
- package/lib/commonjs/ui/icons/subsetGlyphMaps.js.map +1 -1
- package/lib/commonjs/ui/index.js +7 -0
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/module/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/module/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/module/assets/assets/fonts/icons/manifest.json +5 -4
- package/lib/module/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/module/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/module/assets/fonts/icons/manifest.json +5 -4
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/appAssertion/AppAssertionContext.js +72 -0
- package/lib/module/ui/appAssertion/AppAssertionContext.js.map +1 -0
- package/lib/module/ui/appAssertion/appAssertionManager.js +304 -0
- package/lib/module/ui/appAssertion/appAssertionManager.js.map +1 -0
- package/lib/module/ui/appAssertion/appIntegrityPlatform.js +14 -0
- package/lib/module/ui/appAssertion/appIntegrityPlatform.js.map +1 -0
- package/lib/module/ui/appAssertion/appIntegrityPlatform.native.js +26 -0
- package/lib/module/ui/appAssertion/appIntegrityPlatform.native.js.map +1 -0
- package/lib/module/ui/appAssertion/appIntegrityTypes.js +4 -0
- package/lib/module/ui/appAssertion/appIntegrityTypes.js.map +1 -0
- package/lib/module/ui/components/fileManagement/FileAppAccessSection.js +116 -0
- package/lib/module/ui/components/fileManagement/FileAppAccessSection.js.map +1 -0
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +6 -2
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +10 -1
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/mutations/mutationKeys.js +4 -0
- package/lib/module/ui/hooks/mutations/mutationKeys.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +47 -0
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +6 -1
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useFileQueries.js +33 -1
- package/lib/module/ui/hooks/queries/useFileQueries.js.map +1 -1
- package/lib/module/ui/icons/subsetGlyphMaps.js +1 -0
- package/lib/module/ui/icons/subsetGlyphMaps.js.map +1 -1
- package/lib/module/ui/index.js +1 -0
- package/lib/module/ui/index.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +3 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/appAssertion/AppAssertionContext.d.ts +41 -0
- package/lib/typescript/commonjs/ui/appAssertion/AppAssertionContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/appAssertion/appAssertionManager.d.ts +92 -0
- package/lib/typescript/commonjs/ui/appAssertion/appAssertionManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.d.ts +9 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.native.d.ts +3 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityTypes.d.ts +22 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityTypes.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileAppAccessSection.d.ts +15 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileAppAccessSection.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts +3 -0
- package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +13 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +5 -0
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts +11 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/icons/MaterialCommunityIcons.d.ts +1 -1
- package/lib/typescript/commonjs/ui/icons/MaterialCommunityIcons.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts +1 -0
- package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +2 -0
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +3 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/appAssertion/AppAssertionContext.d.ts +41 -0
- package/lib/typescript/module/ui/appAssertion/AppAssertionContext.d.ts.map +1 -0
- package/lib/typescript/module/ui/appAssertion/appAssertionManager.d.ts +92 -0
- package/lib/typescript/module/ui/appAssertion/appAssertionManager.d.ts.map +1 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.d.ts +9 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.d.ts.map +1 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.native.d.ts +3 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.native.d.ts.map +1 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityTypes.d.ts +22 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityTypes.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/fileManagement/FileAppAccessSection.d.ts +15 -0
- package/lib/typescript/module/ui/components/fileManagement/FileAppAccessSection.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts +2 -1
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts +3 -0
- package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +13 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +5 -0
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts +11 -1
- package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/icons/MaterialCommunityIcons.d.ts +1 -1
- package/lib/typescript/module/ui/icons/MaterialCommunityIcons.d.ts.map +1 -1
- package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts +1 -0
- package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +2 -0
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/src/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/src/assets/fonts/icons/manifest.json +5 -4
- package/src/index.ts +12 -0
- package/src/ui/appAssertion/AppAssertionContext.tsx +109 -0
- package/src/ui/appAssertion/appAssertionManager.ts +363 -0
- package/src/ui/appAssertion/appIntegrityPlatform.native.ts +27 -0
- package/src/ui/appAssertion/appIntegrityPlatform.ts +12 -0
- package/src/ui/appAssertion/appIntegrityTypes.ts +23 -0
- package/src/ui/components/fileManagement/FileAppAccessSection.tsx +111 -0
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +5 -1
- package/src/ui/context/OxyContext.tsx +13 -1
- package/src/ui/hooks/mutations/mutationKeys.ts +5 -0
- package/src/ui/hooks/mutations/useAccountMutations.ts +33 -0
- package/src/ui/hooks/queries/queryKeys.ts +5 -0
- package/src/ui/hooks/queries/useFileQueries.ts +44 -2
- package/src/ui/icons/subsetGlyphMaps.ts +1 -0
- 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}>
|
|
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 {
|
|
13
|
-
|
|
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
|
+
}
|
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';
|