(type: string, account: string, container: string, filePath: string, enabled = true)
| 63 | }; |
| 64 | |
| 65 | export const getMeta = (type: string, account: string, container: string, filePath: string, enabled = true) => { |
| 66 | const { dataSourcesQuery, filesQuery } = useUserSettings(); |
| 67 | if (!dataSourcesQuery.data || !filesQuery.data) { |
| 68 | return useQuery(['invalidQuery'], () => null); |
| 69 | } |
| 70 | const { instance } = useMsal(); |
| 71 | const metadataClient = MetadataClientFactory(type, filesQuery.data, dataSourcesQuery.data, instance); |
| 72 | return useQuery( |
| 73 | ['datasource', type, account, container, filePath, 'meta'], |
| 74 | () => { |
| 75 | return fetchMeta(metadataClient, type, account, container, filePath); |
| 76 | }, |
| 77 | { |
| 78 | enabled: enabled && !!dataSourcesQuery.data && !!filesQuery.data, |
| 79 | staleTime: Infinity, |
| 80 | } |
| 81 | ); |
| 82 | }; |
| 83 | |
| 84 | export const useUpdateMeta = (meta: SigMFMetadata) => { |
| 85 | let client = useQueryClient(); |
no test coverage detected