@scm-manager/ui-api 3.7.5 → 3.8.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.
- package/build/index.d.ts +15 -1
- package/build/index.js +144 -116
- package/build/index.mjs +73 -46
- package/package.json +2 -2
package/build/index.d.ts
CHANGED
|
@@ -422,6 +422,20 @@ declare const changesetQueryKey: (repository: NamespaceAndName, id: string) => u
|
|
|
422
422
|
declare const useChangesets: (repository: Repository, request?: UseChangesetsRequest) => ApiResultWithFetching<ChangesetCollection>;
|
|
423
423
|
declare const useChangeset: (repository: Repository, id: string) => ApiResult<Changeset>;
|
|
424
424
|
|
|
425
|
+
declare type RevertRequest = {
|
|
426
|
+
branch: string;
|
|
427
|
+
message: string;
|
|
428
|
+
};
|
|
429
|
+
declare type RevertResponse = {
|
|
430
|
+
revision: string;
|
|
431
|
+
};
|
|
432
|
+
declare const useRevert: (changeset: Changeset) => {
|
|
433
|
+
revert: react_query.UseMutateFunction<RevertResponse, Error, RevertRequest, unknown>;
|
|
434
|
+
isLoading: boolean;
|
|
435
|
+
error: Error | null;
|
|
436
|
+
revision: RevertResponse | undefined;
|
|
437
|
+
};
|
|
438
|
+
|
|
425
439
|
declare const useTags: (repository: Repository) => ApiResult<TagCollection>;
|
|
426
440
|
declare const useContainedInTags: (changeset: Changeset, repository: Repository) => ApiResult<TagCollection>;
|
|
427
441
|
declare const useTag: (repository: Repository, name: string) => ApiResult<Tag>;
|
|
@@ -811,4 +825,4 @@ declare const RepositoryRevisionContextProvider: FC<{
|
|
|
811
825
|
revision?: string;
|
|
812
826
|
}>;
|
|
813
827
|
|
|
814
|
-
export { AdditionalMessage, ApiProvider, Props as ApiProviderProps, ApiResult, ApiResultWithFetching, BackendError, BackendErrorContent, BadGatewayError, BaseContext, CONTENT_TYPE_PUBLIC_KEY, CancelablePromise, ConflictError, ConvertToInternalRequest, DeleteFunction, ForbiddenError, LegacyContext, LegacyContextProvider, MissingLinkError, NamespaceAndNameContext, NamespaceAndNameContextProvider, NotFoundError, RepositoryContextProvider, RepositoryRevisionContextProvider, SearchOptions, TOKEN_EXPIRED_ERROR_CODE, TokenExpiredError, UnauthorizedError, UseAvailablePluginsOptions, UseDeleteRepositoryOptions, UseGroupsRequest, UseHistoryRequest, UseInstalledPluginsOptions, UseRepositoriesRequest, UseRepositoryRolesRequest, UseSourcesOptions, UseUsersRequest, Violation, apiClient, changesetQueryKey, clearCache, createBackendError, createChangesetUrl, createDiffUrl, createQueryString, createUrl, createUrlWithIdentifiers, extractXsrfTokenFromCookie, fetchResourceFromLocationHeader, getResponseJson, isBackendError, makeCancelable, objectLink, requiredLink, urls, useAlerts, useAnnotations, useApiKeys, useArchiveRepository, useAvailableGlobalPermissions, useAvailablePermissions, useAvailablePlugins, useBranch, useBranchDetails, useBranchDetailsCollection, useBranches, useCancelPendingPlugins, useCancellablePromise, useChangeUserPassword, useChangeset, useChangesets, useClearNotifications, useConfig, useConfigLink, useContainedInTags, useContentType, useConvertToExternal, useConvertToInternal, useCreateApiKey, useCreateBranch, useCreateGroup, useCreatePermission, useCreatePublicKey, useCreateRepository, useCreateRepositoryRole, useCreateTag, useCreateUser, useDefaultBranch, useDeleteApiKey, useDeleteBranch, useDeleteGroup, useDeletePermission, useDeletePublicKey, useDeleteRepository, useDeleteRepositoryRole, useDeleteTag, useDeleteUser, useDiff, useDismissNotification, useExecutePendingPlugins, useExportInfo, useExportRepository, useFileContent, useGroup, useGroupOptions, useGroupPermissions, useGroupSuggestions, useGroups, useHistory, useImportFullRepository, useImportLog, useImportRepositoryFromBundle, useImportRepositoryFromUrl, useIncomingChangesets, useIndex, useIndexJsonResource, useIndexLink, useIndexLinks, useInstallPlugin, useInstalledPlugins, useInvalidateAllCaches, useInvalidateSearchIndices, useJsonResource, useLegacyContext, useLocalStorage, useLogin, useLoginInfo, useLogout, useMe, useNamespace, useNamespaceAndNameContext, useNamespaceOptions, useNamespaceStrategies, useNamespaceSuggestions, useNamespaces, useNotificationSubscription, useNotifications, useOmniSearch, usePaths, usePendingPlugins, usePermissions, usePluginCenterAuthInfo, usePluginCenterLogout, usePublicKeys, useReindexRepository, useRenameRepository, useRepositories, useRepository, useRepositoryContext, useRepositoryRevisionContext, useRepositoryRole, useRepositoryRoles, useRepositoryTypes, useRepositoryVerbs, useRequiredIndexLink, useRequiredMe, useRunHealthCheck, useSearch, useSearchCounts, useSearchHelpContent, useSearchSyntaxContent, useSearchTypes, useSearchableTypes, useSetGroupPermissions, useSetUserPassword, useSetUserPermissions, useSources, useSubject, useSuggestions, useTag, useTags, useUnarchiveRepository, useUninstallPlugin, useUpdateConfig, useUpdateGroup, useUpdateInfo, useUpdatePermission, useUpdatePlugins, useUpdateRepository, useUpdateRepositoryRole, useUpdateUser, useUser, useUserOptions, useUserPermissionOverview, useUserPermissions, useUserSuggestions, useUsers, useVersion, waitForRestartAfter };
|
|
828
|
+
export { AdditionalMessage, ApiProvider, Props as ApiProviderProps, ApiResult, ApiResultWithFetching, BackendError, BackendErrorContent, BadGatewayError, BaseContext, CONTENT_TYPE_PUBLIC_KEY, CancelablePromise, ConflictError, ConvertToInternalRequest, DeleteFunction, ForbiddenError, LegacyContext, LegacyContextProvider, MissingLinkError, NamespaceAndNameContext, NamespaceAndNameContextProvider, NotFoundError, RepositoryContextProvider, RepositoryRevisionContextProvider, RevertRequest, RevertResponse, SearchOptions, TOKEN_EXPIRED_ERROR_CODE, TokenExpiredError, UnauthorizedError, UseAvailablePluginsOptions, UseDeleteRepositoryOptions, UseGroupsRequest, UseHistoryRequest, UseInstalledPluginsOptions, UseRepositoriesRequest, UseRepositoryRolesRequest, UseSourcesOptions, UseUsersRequest, Violation, apiClient, changesetQueryKey, clearCache, createBackendError, createChangesetUrl, createDiffUrl, createQueryString, createUrl, createUrlWithIdentifiers, extractXsrfTokenFromCookie, fetchResourceFromLocationHeader, getResponseJson, isBackendError, makeCancelable, objectLink, requiredLink, urls, useAlerts, useAnnotations, useApiKeys, useArchiveRepository, useAvailableGlobalPermissions, useAvailablePermissions, useAvailablePlugins, useBranch, useBranchDetails, useBranchDetailsCollection, useBranches, useCancelPendingPlugins, useCancellablePromise, useChangeUserPassword, useChangeset, useChangesets, useClearNotifications, useConfig, useConfigLink, useContainedInTags, useContentType, useConvertToExternal, useConvertToInternal, useCreateApiKey, useCreateBranch, useCreateGroup, useCreatePermission, useCreatePublicKey, useCreateRepository, useCreateRepositoryRole, useCreateTag, useCreateUser, useDefaultBranch, useDeleteApiKey, useDeleteBranch, useDeleteGroup, useDeletePermission, useDeletePublicKey, useDeleteRepository, useDeleteRepositoryRole, useDeleteTag, useDeleteUser, useDiff, useDismissNotification, useExecutePendingPlugins, useExportInfo, useExportRepository, useFileContent, useGroup, useGroupOptions, useGroupPermissions, useGroupSuggestions, useGroups, useHistory, useImportFullRepository, useImportLog, useImportRepositoryFromBundle, useImportRepositoryFromUrl, useIncomingChangesets, useIndex, useIndexJsonResource, useIndexLink, useIndexLinks, useInstallPlugin, useInstalledPlugins, useInvalidateAllCaches, useInvalidateSearchIndices, useJsonResource, useLegacyContext, useLocalStorage, useLogin, useLoginInfo, useLogout, useMe, useNamespace, useNamespaceAndNameContext, useNamespaceOptions, useNamespaceStrategies, useNamespaceSuggestions, useNamespaces, useNotificationSubscription, useNotifications, useOmniSearch, usePaths, usePendingPlugins, usePermissions, usePluginCenterAuthInfo, usePluginCenterLogout, usePublicKeys, useReindexRepository, useRenameRepository, useRepositories, useRepository, useRepositoryContext, useRepositoryRevisionContext, useRepositoryRole, useRepositoryRoles, useRepositoryTypes, useRepositoryVerbs, useRequiredIndexLink, useRequiredMe, useRevert, useRunHealthCheck, useSearch, useSearchCounts, useSearchHelpContent, useSearchSyntaxContent, useSearchTypes, useSearchableTypes, useSetGroupPermissions, useSetUserPassword, useSetUserPermissions, useSources, useSubject, useSuggestions, useTag, useTags, useUnarchiveRepository, useUninstallPlugin, useUpdateConfig, useUpdateGroup, useUpdateInfo, useUpdatePermission, useUpdatePlugins, useUpdateRepository, useUpdateRepositoryRole, useUpdateUser, useUser, useUserOptions, useUserPermissionOverview, useUserPermissions, useUserSuggestions, useUsers, useVersion, waitForRestartAfter };
|
package/build/index.js
CHANGED
|
@@ -159,6 +159,7 @@ __export(src_exports, {
|
|
|
159
159
|
useRepositoryVerbs: () => useRepositoryVerbs,
|
|
160
160
|
useRequiredIndexLink: () => useRequiredIndexLink,
|
|
161
161
|
useRequiredMe: () => useRequiredMe,
|
|
162
|
+
useRevert: () => useRevert,
|
|
162
163
|
useRunHealthCheck: () => useRunHealthCheck,
|
|
163
164
|
useSearch: () => useSearch,
|
|
164
165
|
useSearchCounts: () => useSearchCounts,
|
|
@@ -1701,21 +1702,39 @@ var useChangeset = (repository, id) => {
|
|
|
1701
1702
|
);
|
|
1702
1703
|
};
|
|
1703
1704
|
|
|
1704
|
-
// src/
|
|
1705
|
+
// src/revert.ts
|
|
1705
1706
|
var import_react_query11 = require("react-query");
|
|
1707
|
+
var useRevert = (changeset) => {
|
|
1708
|
+
const link = requiredLink(changeset, "revert");
|
|
1709
|
+
const { isLoading, error, mutate, data } = (0, import_react_query11.useMutation)({
|
|
1710
|
+
mutationFn: async (request) => {
|
|
1711
|
+
const response = await apiClient.post(link, request, "application/vnd.scmm-revert+json;v=2");
|
|
1712
|
+
return await response.json();
|
|
1713
|
+
}
|
|
1714
|
+
});
|
|
1715
|
+
return {
|
|
1716
|
+
revert: mutate,
|
|
1717
|
+
isLoading,
|
|
1718
|
+
error,
|
|
1719
|
+
revision: data
|
|
1720
|
+
};
|
|
1721
|
+
};
|
|
1722
|
+
|
|
1723
|
+
// src/tags.ts
|
|
1724
|
+
var import_react_query12 = require("react-query");
|
|
1706
1725
|
var tagQueryKey = (repository, tag) => {
|
|
1707
1726
|
return repoQueryKey(repository, "tag", tag);
|
|
1708
1727
|
};
|
|
1709
1728
|
var useTags = (repository) => {
|
|
1710
1729
|
const link = requiredLink(repository, "tags");
|
|
1711
|
-
return (0,
|
|
1730
|
+
return (0, import_react_query12.useQuery)(
|
|
1712
1731
|
repoQueryKey(repository, "tags"),
|
|
1713
1732
|
() => apiClient.get(link).then((response) => response.json())
|
|
1714
1733
|
);
|
|
1715
1734
|
};
|
|
1716
1735
|
var useContainedInTags = (changeset, repository) => {
|
|
1717
1736
|
const link = objectLink(changeset, "containedInTags");
|
|
1718
|
-
return (0,
|
|
1737
|
+
return (0, import_react_query12.useQuery)(repoQueryKey(repository, "tags", changeset.id), () => {
|
|
1719
1738
|
if (link === null) {
|
|
1720
1739
|
return {
|
|
1721
1740
|
_embedded: {
|
|
@@ -1729,7 +1748,7 @@ var useContainedInTags = (changeset, repository) => {
|
|
|
1729
1748
|
};
|
|
1730
1749
|
var useTag = (repository, name) => {
|
|
1731
1750
|
const link = requiredLink(repository, "tags");
|
|
1732
|
-
return (0,
|
|
1751
|
+
return (0, import_react_query12.useQuery)(
|
|
1733
1752
|
tagQueryKey(repository, name),
|
|
1734
1753
|
() => apiClient.get(concat(link, name)).then((response) => response.json())
|
|
1735
1754
|
);
|
|
@@ -1760,9 +1779,9 @@ var createTag = (changeset, link) => {
|
|
|
1760
1779
|
};
|
|
1761
1780
|
};
|
|
1762
1781
|
var useCreateTag = (repository, changeset) => {
|
|
1763
|
-
const queryClient2 = (0,
|
|
1782
|
+
const queryClient2 = (0, import_react_query12.useQueryClient)();
|
|
1764
1783
|
const link = requiredLink(changeset, "tag");
|
|
1765
|
-
const { isLoading, error, mutate, data } = (0,
|
|
1784
|
+
const { isLoading, error, mutate, data } = (0, import_react_query12.useMutation)(createTag(changeset, link), {
|
|
1766
1785
|
onSuccess: async (tag) => {
|
|
1767
1786
|
queryClient2.setQueryData(tagQueryKey(repository, tag.name), tag);
|
|
1768
1787
|
await queryClient2.invalidateQueries(tagQueryKey(repository, tag.name));
|
|
@@ -1777,8 +1796,8 @@ var useCreateTag = (repository, changeset) => {
|
|
|
1777
1796
|
};
|
|
1778
1797
|
};
|
|
1779
1798
|
var useDeleteTag = (repository) => {
|
|
1780
|
-
const queryClient2 = (0,
|
|
1781
|
-
const { mutate, isLoading, error, data } = (0,
|
|
1799
|
+
const queryClient2 = (0, import_react_query12.useQueryClient)();
|
|
1800
|
+
const { mutate, isLoading, error, data } = (0, import_react_query12.useMutation)(
|
|
1782
1801
|
(tag) => {
|
|
1783
1802
|
const deleteUrl = tag._links.delete.href;
|
|
1784
1803
|
return apiClient.delete(deleteUrl);
|
|
@@ -1799,16 +1818,16 @@ var useDeleteTag = (repository) => {
|
|
|
1799
1818
|
};
|
|
1800
1819
|
|
|
1801
1820
|
// src/config.ts
|
|
1802
|
-
var
|
|
1821
|
+
var import_react_query13 = require("react-query");
|
|
1803
1822
|
var useConfig = () => {
|
|
1804
1823
|
const indexLink = useIndexLink("config");
|
|
1805
|
-
return (0,
|
|
1824
|
+
return (0, import_react_query13.useQuery)("config", () => apiClient.get(indexLink).then((response) => response.json()), {
|
|
1806
1825
|
enabled: !!indexLink
|
|
1807
1826
|
});
|
|
1808
1827
|
};
|
|
1809
1828
|
var useUpdateConfig = () => {
|
|
1810
|
-
const queryClient2 = (0,
|
|
1811
|
-
const { mutate, isLoading, error, data, reset: reset2 } = (0,
|
|
1829
|
+
const queryClient2 = (0, import_react_query13.useQueryClient)();
|
|
1830
|
+
const { mutate, isLoading, error, data, reset: reset2 } = (0, import_react_query13.useMutation)(
|
|
1812
1831
|
(config) => {
|
|
1813
1832
|
const updateUrl = requiredLink(config, "update");
|
|
1814
1833
|
return apiClient.put(updateUrl, config, "application/vnd.scmm-config+json;v=2");
|
|
@@ -1831,10 +1850,10 @@ var useUpdateConfig = () => {
|
|
|
1831
1850
|
};
|
|
1832
1851
|
|
|
1833
1852
|
// src/admin.ts
|
|
1834
|
-
var
|
|
1853
|
+
var import_react_query14 = require("react-query");
|
|
1835
1854
|
var useUpdateInfo = () => {
|
|
1836
1855
|
const indexLink = useIndexLink("updateInfo");
|
|
1837
|
-
return (0,
|
|
1856
|
+
return (0, import_react_query14.useQuery)(
|
|
1838
1857
|
"updateInfo",
|
|
1839
1858
|
() => {
|
|
1840
1859
|
if (!indexLink) {
|
|
@@ -1847,7 +1866,7 @@ var useUpdateInfo = () => {
|
|
|
1847
1866
|
};
|
|
1848
1867
|
|
|
1849
1868
|
// src/plugins.ts
|
|
1850
|
-
var
|
|
1869
|
+
var import_react_query15 = require("react-query");
|
|
1851
1870
|
var isPluginCollection = (input) => input._embedded ? "plugins" in input._embedded : false;
|
|
1852
1871
|
var waitForRestartAfter = (promise, { initialDelay = 1e3, timeout = 500 } = {}) => {
|
|
1853
1872
|
const endTime = Number(new Date()) + 4 * 60 * 1e3;
|
|
@@ -1875,7 +1894,7 @@ var waitForRestartAfter = (promise, { initialDelay = 1e3, timeout = 500 } = {})
|
|
|
1875
1894
|
};
|
|
1876
1895
|
var useAvailablePlugins = ({ enabled } = {}) => {
|
|
1877
1896
|
const indexLink = useRequiredIndexLink("availablePlugins");
|
|
1878
|
-
return (0,
|
|
1897
|
+
return (0, import_react_query15.useQuery)(
|
|
1879
1898
|
["plugins", "available"],
|
|
1880
1899
|
() => apiClient.get(indexLink).then((response) => response.json()),
|
|
1881
1900
|
{
|
|
@@ -1886,7 +1905,7 @@ var useAvailablePlugins = ({ enabled } = {}) => {
|
|
|
1886
1905
|
};
|
|
1887
1906
|
var useInstalledPlugins = ({ enabled } = {}) => {
|
|
1888
1907
|
const indexLink = useRequiredIndexLink("installedPlugins");
|
|
1889
|
-
return (0,
|
|
1908
|
+
return (0, import_react_query15.useQuery)(
|
|
1890
1909
|
["plugins", "installed"],
|
|
1891
1910
|
() => apiClient.get(indexLink).then((response) => response.json()),
|
|
1892
1911
|
{
|
|
@@ -1897,7 +1916,7 @@ var useInstalledPlugins = ({ enabled } = {}) => {
|
|
|
1897
1916
|
};
|
|
1898
1917
|
var usePendingPlugins = () => {
|
|
1899
1918
|
const indexLink = useIndexLink("pendingPlugins");
|
|
1900
|
-
return (0,
|
|
1919
|
+
return (0, import_react_query15.useQuery)(
|
|
1901
1920
|
["plugins", "pending"],
|
|
1902
1921
|
() => apiClient.get(indexLink).then((response) => response.json()),
|
|
1903
1922
|
{
|
|
@@ -1913,8 +1932,8 @@ var linkWithRestart = (link, restart) => {
|
|
|
1913
1932
|
return link;
|
|
1914
1933
|
};
|
|
1915
1934
|
var useInstallPlugin = () => {
|
|
1916
|
-
const queryClient2 = (0,
|
|
1917
|
-
const { mutate, isLoading, error, data } = (0,
|
|
1935
|
+
const queryClient2 = (0, import_react_query15.useQueryClient)();
|
|
1936
|
+
const { mutate, isLoading, error, data } = (0, import_react_query15.useMutation)(
|
|
1918
1937
|
({ plugin, restartOptions: { restart, ...waitForRestartOptions } }) => {
|
|
1919
1938
|
const promise = apiClient.post(requiredLink(plugin, linkWithRestart("install", restart)));
|
|
1920
1939
|
if (restart) {
|
|
@@ -1938,8 +1957,8 @@ var useInstallPlugin = () => {
|
|
|
1938
1957
|
};
|
|
1939
1958
|
};
|
|
1940
1959
|
var useUninstallPlugin = () => {
|
|
1941
|
-
const queryClient2 = (0,
|
|
1942
|
-
const { mutate, isLoading, error, data } = (0,
|
|
1960
|
+
const queryClient2 = (0, import_react_query15.useQueryClient)();
|
|
1961
|
+
const { mutate, isLoading, error, data } = (0, import_react_query15.useMutation)(
|
|
1943
1962
|
({ plugin, restartOptions: { restart, ...waitForRestartOptions } }) => {
|
|
1944
1963
|
const promise = apiClient.post(requiredLink(plugin, linkWithRestart("uninstall", restart)));
|
|
1945
1964
|
if (restart) {
|
|
@@ -1962,8 +1981,8 @@ var useUninstallPlugin = () => {
|
|
|
1962
1981
|
};
|
|
1963
1982
|
};
|
|
1964
1983
|
var useUpdatePlugins = () => {
|
|
1965
|
-
const queryClient2 = (0,
|
|
1966
|
-
const { mutate, isLoading, error, data } = (0,
|
|
1984
|
+
const queryClient2 = (0, import_react_query15.useQueryClient)();
|
|
1985
|
+
const { mutate, isLoading, error, data } = (0, import_react_query15.useMutation)(
|
|
1967
1986
|
({ plugins, restartOptions: { restart, ...waitForRestartOptions } }) => {
|
|
1968
1987
|
const isCollection = isPluginCollection(plugins);
|
|
1969
1988
|
const promise = apiClient.post(
|
|
@@ -1989,8 +2008,8 @@ var useUpdatePlugins = () => {
|
|
|
1989
2008
|
};
|
|
1990
2009
|
};
|
|
1991
2010
|
var useExecutePendingPlugins = () => {
|
|
1992
|
-
const queryClient2 = (0,
|
|
1993
|
-
const { mutate, isLoading, error, data } = (0,
|
|
2011
|
+
const queryClient2 = (0, import_react_query15.useQueryClient)();
|
|
2012
|
+
const { mutate, isLoading, error, data } = (0, import_react_query15.useMutation)(
|
|
1994
2013
|
({ pending, restartOptions }) => waitForRestartAfter(apiClient.post(requiredLink(pending, "execute")), restartOptions),
|
|
1995
2014
|
{
|
|
1996
2015
|
onSuccess: () => queryClient2.invalidateQueries("plugins")
|
|
@@ -2004,8 +2023,8 @@ var useExecutePendingPlugins = () => {
|
|
|
2004
2023
|
};
|
|
2005
2024
|
};
|
|
2006
2025
|
var useCancelPendingPlugins = () => {
|
|
2007
|
-
const queryClient2 = (0,
|
|
2008
|
-
const { mutate, isLoading, error, data } = (0,
|
|
2026
|
+
const queryClient2 = (0, import_react_query15.useQueryClient)();
|
|
2027
|
+
const { mutate, isLoading, error, data } = (0, import_react_query15.useMutation)(
|
|
2009
2028
|
(pending) => apiClient.post(requiredLink(pending, "cancel")),
|
|
2010
2029
|
{
|
|
2011
2030
|
onSuccess: () => queryClient2.invalidateQueries("plugins")
|
|
@@ -2020,15 +2039,15 @@ var useCancelPendingPlugins = () => {
|
|
|
2020
2039
|
};
|
|
2021
2040
|
|
|
2022
2041
|
// src/repository-roles.ts
|
|
2023
|
-
var
|
|
2042
|
+
var import_react_query16 = require("react-query");
|
|
2024
2043
|
var useRepositoryRoles = (request) => {
|
|
2025
|
-
const queryClient2 = (0,
|
|
2044
|
+
const queryClient2 = (0, import_react_query16.useQueryClient)();
|
|
2026
2045
|
const indexLink = useRequiredIndexLink("repositoryRoles");
|
|
2027
2046
|
const queryParams = {};
|
|
2028
2047
|
if (request == null ? void 0 : request.page) {
|
|
2029
2048
|
queryParams.page = request.page.toString();
|
|
2030
2049
|
}
|
|
2031
|
-
return (0,
|
|
2050
|
+
return (0, import_react_query16.useQuery)(
|
|
2032
2051
|
["repositoryRoles", (request == null ? void 0 : request.page) || 0],
|
|
2033
2052
|
() => apiClient.get(`${indexLink}?${createQueryString(queryParams)}`).then((response) => response.json()),
|
|
2034
2053
|
{
|
|
@@ -2043,7 +2062,7 @@ var useRepositoryRoles = (request) => {
|
|
|
2043
2062
|
};
|
|
2044
2063
|
var useRepositoryRole = (name) => {
|
|
2045
2064
|
const indexLink = useRequiredIndexLink("repositoryRoles");
|
|
2046
|
-
return (0,
|
|
2065
|
+
return (0, import_react_query16.useQuery)(
|
|
2047
2066
|
["repositoryRole", name],
|
|
2048
2067
|
() => apiClient.get(concat(indexLink, name)).then((response) => response.json())
|
|
2049
2068
|
);
|
|
@@ -2060,9 +2079,9 @@ var createRepositoryRole = (link) => {
|
|
|
2060
2079
|
};
|
|
2061
2080
|
};
|
|
2062
2081
|
var useCreateRepositoryRole = () => {
|
|
2063
|
-
const queryClient2 = (0,
|
|
2082
|
+
const queryClient2 = (0, import_react_query16.useQueryClient)();
|
|
2064
2083
|
const link = useRequiredIndexLink("repositoryRoles");
|
|
2065
|
-
const { mutate, data, isLoading, error } = (0,
|
|
2084
|
+
const { mutate, data, isLoading, error } = (0, import_react_query16.useMutation)(
|
|
2066
2085
|
createRepositoryRole(link),
|
|
2067
2086
|
{
|
|
2068
2087
|
onSuccess: (repositoryRole) => {
|
|
@@ -2079,8 +2098,8 @@ var useCreateRepositoryRole = () => {
|
|
|
2079
2098
|
};
|
|
2080
2099
|
};
|
|
2081
2100
|
var useUpdateRepositoryRole = () => {
|
|
2082
|
-
const queryClient2 = (0,
|
|
2083
|
-
const { mutate, isLoading, error, data } = (0,
|
|
2101
|
+
const queryClient2 = (0, import_react_query16.useQueryClient)();
|
|
2102
|
+
const { mutate, isLoading, error, data } = (0, import_react_query16.useMutation)(
|
|
2084
2103
|
(repositoryRole) => {
|
|
2085
2104
|
const updateUrl = requiredLink(repositoryRole, "update");
|
|
2086
2105
|
return apiClient.put(updateUrl, repositoryRole, "application/vnd.scmm-repositoryRole+json;v=2");
|
|
@@ -2100,8 +2119,8 @@ var useUpdateRepositoryRole = () => {
|
|
|
2100
2119
|
};
|
|
2101
2120
|
};
|
|
2102
2121
|
var useDeleteRepositoryRole = () => {
|
|
2103
|
-
const queryClient2 = (0,
|
|
2104
|
-
const { mutate, isLoading, error, data } = (0,
|
|
2122
|
+
const queryClient2 = (0, import_react_query16.useQueryClient)();
|
|
2123
|
+
const { mutate, isLoading, error, data } = (0, import_react_query16.useMutation)(
|
|
2105
2124
|
(repositoryRole) => {
|
|
2106
2125
|
const deleteUrl = requiredLink(repositoryRole, "delete");
|
|
2107
2126
|
return apiClient.delete(deleteUrl);
|
|
@@ -2122,7 +2141,7 @@ var useDeleteRepositoryRole = () => {
|
|
|
2122
2141
|
};
|
|
2123
2142
|
|
|
2124
2143
|
// src/permissions.ts
|
|
2125
|
-
var
|
|
2144
|
+
var import_react_query17 = require("react-query");
|
|
2126
2145
|
var useRepositoryVerbs = () => {
|
|
2127
2146
|
return useIndexJsonResource("repositoryVerbs");
|
|
2128
2147
|
};
|
|
@@ -2156,7 +2175,7 @@ var createQueryKey = (namespaceOrRepository) => {
|
|
|
2156
2175
|
var usePermissions = (namespaceOrRepository) => {
|
|
2157
2176
|
const link = requiredLink(namespaceOrRepository, "permissions");
|
|
2158
2177
|
const queryKey = createQueryKey(namespaceOrRepository);
|
|
2159
|
-
return (0,
|
|
2178
|
+
return (0, import_react_query17.useQuery)(queryKey, () => apiClient.get(link).then((response) => response.json()));
|
|
2160
2179
|
};
|
|
2161
2180
|
var createPermission = (link) => {
|
|
2162
2181
|
return (permission) => {
|
|
@@ -2170,9 +2189,9 @@ var createPermission = (link) => {
|
|
|
2170
2189
|
};
|
|
2171
2190
|
};
|
|
2172
2191
|
var useCreatePermission = (namespaceOrRepository) => {
|
|
2173
|
-
const queryClient2 = (0,
|
|
2192
|
+
const queryClient2 = (0, import_react_query17.useQueryClient)();
|
|
2174
2193
|
const link = requiredLink(namespaceOrRepository, "permissions");
|
|
2175
|
-
const { isLoading, error, mutate, data } = (0,
|
|
2194
|
+
const { isLoading, error, mutate, data } = (0, import_react_query17.useMutation)(
|
|
2176
2195
|
createPermission(link),
|
|
2177
2196
|
{
|
|
2178
2197
|
onSuccess: () => {
|
|
@@ -2189,8 +2208,8 @@ var useCreatePermission = (namespaceOrRepository) => {
|
|
|
2189
2208
|
};
|
|
2190
2209
|
};
|
|
2191
2210
|
var useUpdatePermission = (namespaceOrRepository) => {
|
|
2192
|
-
const queryClient2 = (0,
|
|
2193
|
-
const { isLoading, error, mutate, data } = (0,
|
|
2211
|
+
const queryClient2 = (0, import_react_query17.useQueryClient)();
|
|
2212
|
+
const { isLoading, error, mutate, data } = (0, import_react_query17.useMutation)(
|
|
2194
2213
|
(permission) => {
|
|
2195
2214
|
const link = requiredLink(permission, "update");
|
|
2196
2215
|
return apiClient.put(link, permission, "application/vnd.scmm-repositoryPermission+json");
|
|
@@ -2210,8 +2229,8 @@ var useUpdatePermission = (namespaceOrRepository) => {
|
|
|
2210
2229
|
};
|
|
2211
2230
|
};
|
|
2212
2231
|
var useDeletePermission = (namespaceOrRepository) => {
|
|
2213
|
-
const queryClient2 = (0,
|
|
2214
|
-
const { isLoading, error, mutate, data } = (0,
|
|
2232
|
+
const queryClient2 = (0, import_react_query17.useQueryClient)();
|
|
2233
|
+
const { isLoading, error, mutate, data } = (0, import_react_query17.useMutation)(
|
|
2215
2234
|
(permission) => {
|
|
2216
2235
|
const link = requiredLink(permission, "delete");
|
|
2217
2236
|
return apiClient.delete(link);
|
|
@@ -2236,9 +2255,9 @@ var useGroupPermissions = (group) => useJsonResource(group, "permissions", group
|
|
|
2236
2255
|
var useUserPermissions = (user) => useJsonResource(user, "permissions", userPermissionsKey(user));
|
|
2237
2256
|
var useAvailableGlobalPermissions = () => useIndexJsonResource("permissions");
|
|
2238
2257
|
var useSetEntityPermissions = (permissionCollection, key) => {
|
|
2239
|
-
const queryClient2 = (0,
|
|
2258
|
+
const queryClient2 = (0, import_react_query17.useQueryClient)();
|
|
2240
2259
|
const url = permissionCollection ? objectLink(permissionCollection, "overwrite") : null;
|
|
2241
|
-
const { isLoading, error, mutate, data } = (0,
|
|
2260
|
+
const { isLoading, error, mutate, data } = (0, import_react_query17.useMutation)(
|
|
2242
2261
|
(permissions) => apiClient.put(
|
|
2243
2262
|
url,
|
|
2244
2263
|
{
|
|
@@ -2262,7 +2281,7 @@ var useSetUserPermissions = (user, permissions) => useSetEntityPermissions(permi
|
|
|
2262
2281
|
var useSetGroupPermissions = (group, permissions) => useSetEntityPermissions(permissions, groupPermissionsKey(group));
|
|
2263
2282
|
|
|
2264
2283
|
// src/sources.ts
|
|
2265
|
-
var
|
|
2284
|
+
var import_react_query18 = require("react-query");
|
|
2266
2285
|
var import_react6 = require("react");
|
|
2267
2286
|
var UseSourcesDefaultOptions = {
|
|
2268
2287
|
enabled: true,
|
|
@@ -2275,7 +2294,7 @@ var useSources = (repository, opts = UseSourcesDefaultOptions) => {
|
|
|
2275
2294
|
...opts
|
|
2276
2295
|
};
|
|
2277
2296
|
const link = createSourcesLink(repository, options);
|
|
2278
|
-
const { isLoading, error, data, isFetchingNextPage, fetchNextPage, refetch } = (0,
|
|
2297
|
+
const { isLoading, error, data, isFetchingNextPage, fetchNextPage, refetch } = (0, import_react_query18.useInfiniteQuery)(
|
|
2279
2298
|
repoQueryKey(repository, "sources", options.revision || "", options.path || "", options.collapse ? "collapse" : ""),
|
|
2280
2299
|
({ pageParam }) => {
|
|
2281
2300
|
return apiClient.get(pageParam || link).then((response) => response.json());
|
|
@@ -2361,14 +2380,14 @@ var isPartial = (file) => {
|
|
|
2361
2380
|
};
|
|
2362
2381
|
|
|
2363
2382
|
// src/import.ts
|
|
2364
|
-
var
|
|
2383
|
+
var import_react_query19 = require("react-query");
|
|
2365
2384
|
var useImportLog = (logId) => {
|
|
2366
2385
|
const link = useRequiredIndexLink("importLog").replace("{logId}", logId);
|
|
2367
|
-
return (0,
|
|
2386
|
+
return (0, import_react_query19.useQuery)(["importLog", logId], () => apiClient.get(link).then((response) => response.text()));
|
|
2368
2387
|
};
|
|
2369
2388
|
var useImportRepositoryFromUrl = (repositoryType) => {
|
|
2370
2389
|
const url = requiredLink(repositoryType, "import", "url");
|
|
2371
|
-
const { isLoading, error, data, mutate } = (0,
|
|
2390
|
+
const { isLoading, error, data, mutate } = (0, import_react_query19.useMutation)(
|
|
2372
2391
|
(repo) => apiClient.post(url, repo, "application/vnd.scmm-repository+json;v=2").then(fetchResourceFromLocationHeader).then(getResponseJson)
|
|
2373
2392
|
);
|
|
2374
2393
|
return {
|
|
@@ -2386,7 +2405,7 @@ var importRepository = (url, repository, file, password) => {
|
|
|
2386
2405
|
};
|
|
2387
2406
|
var useImportRepositoryFromBundle = (repositoryType) => {
|
|
2388
2407
|
const url = requiredLink(repositoryType, "import", "bundle");
|
|
2389
|
-
const { isLoading, error, data, mutate } = (0,
|
|
2408
|
+
const { isLoading, error, data, mutate } = (0, import_react_query19.useMutation)(
|
|
2390
2409
|
({ repository, file, compressed, password }) => importRepository(compressed ? url + "?compressed=true" : url, repository, file, password)
|
|
2391
2410
|
);
|
|
2392
2411
|
return {
|
|
@@ -2402,7 +2421,7 @@ var useImportRepositoryFromBundle = (repositoryType) => {
|
|
|
2402
2421
|
};
|
|
2403
2422
|
};
|
|
2404
2423
|
var useImportFullRepository = (repositoryType) => {
|
|
2405
|
-
const { isLoading, error, data, mutate } = (0,
|
|
2424
|
+
const { isLoading, error, data, mutate } = (0, import_react_query19.useMutation)(
|
|
2406
2425
|
({ repository, file, password }) => importRepository(requiredLink(repositoryType, "import", "fullImport"), repository, file, password)
|
|
2407
2426
|
);
|
|
2408
2427
|
return {
|
|
@@ -2419,7 +2438,7 @@ var useImportFullRepository = (repositoryType) => {
|
|
|
2419
2438
|
|
|
2420
2439
|
// src/diff.ts
|
|
2421
2440
|
var import_gitdiff_parser = __toESM(require("gitdiff-parser"));
|
|
2422
|
-
var
|
|
2441
|
+
var import_react_query20 = require("react-query");
|
|
2423
2442
|
var defaultOptions = {
|
|
2424
2443
|
refetchOnWindowFocus: true
|
|
2425
2444
|
};
|
|
@@ -2429,7 +2448,7 @@ var useDiff = (link, options = defaultOptions) => {
|
|
|
2429
2448
|
const separator = initialLink.includes("?") ? "&" : "?";
|
|
2430
2449
|
initialLink = `${initialLink}${separator}limit=${options.limit}&ignoreWhitespace=${options.ignoreWhitespace}`;
|
|
2431
2450
|
}
|
|
2432
|
-
const { isLoading, error, data, isFetchingNextPage, fetchNextPage } = (0,
|
|
2451
|
+
const { isLoading, error, data, isFetchingNextPage, fetchNextPage } = (0, import_react_query20.useInfiniteQuery)(
|
|
2433
2452
|
["link", link, options.ignoreWhitespace],
|
|
2434
2453
|
({ pageParam }) => {
|
|
2435
2454
|
return apiClient.get(pageParam || initialLink).then((response) => {
|
|
@@ -2477,13 +2496,13 @@ var merge2 = (diffs) => {
|
|
|
2477
2496
|
};
|
|
2478
2497
|
|
|
2479
2498
|
// src/notifications.ts
|
|
2480
|
-
var
|
|
2499
|
+
var import_react_query21 = require("react-query");
|
|
2481
2500
|
var import_react7 = require("react");
|
|
2482
2501
|
var useNotifications = () => {
|
|
2483
2502
|
var _a;
|
|
2484
2503
|
const { data: me } = useMe();
|
|
2485
2504
|
const link = (_a = me == null ? void 0 : me._links["notifications"]) == null ? void 0 : _a.href;
|
|
2486
|
-
const { data, error, isLoading, refetch } = (0,
|
|
2505
|
+
const { data, error, isLoading, refetch } = (0, import_react_query21.useQuery)(
|
|
2487
2506
|
"notifications",
|
|
2488
2507
|
() => apiClient.get(link).then((response) => response.json()),
|
|
2489
2508
|
{
|
|
@@ -2501,9 +2520,9 @@ var useNotifications = () => {
|
|
|
2501
2520
|
};
|
|
2502
2521
|
};
|
|
2503
2522
|
var useDismissNotification = (notification) => {
|
|
2504
|
-
const queryClient2 = (0,
|
|
2523
|
+
const queryClient2 = (0, import_react_query21.useQueryClient)();
|
|
2505
2524
|
const link = requiredLink(notification, "dismiss");
|
|
2506
|
-
const { data, isLoading, error, mutate } = (0,
|
|
2525
|
+
const { data, isLoading, error, mutate } = (0, import_react_query21.useMutation)(() => apiClient.delete(link), {
|
|
2507
2526
|
onSuccess: () => {
|
|
2508
2527
|
queryClient2.invalidateQueries("notifications");
|
|
2509
2528
|
}
|
|
@@ -2516,9 +2535,9 @@ var useDismissNotification = (notification) => {
|
|
|
2516
2535
|
};
|
|
2517
2536
|
};
|
|
2518
2537
|
var useClearNotifications = (notificationCollection) => {
|
|
2519
|
-
const queryClient2 = (0,
|
|
2538
|
+
const queryClient2 = (0, import_react_query21.useQueryClient)();
|
|
2520
2539
|
const link = requiredLink(notificationCollection, "clear");
|
|
2521
|
-
const { data, isLoading, error, mutate } = (0,
|
|
2540
|
+
const { data, isLoading, error, mutate } = (0, import_react_query21.useMutation)(() => apiClient.delete(link), {
|
|
2522
2541
|
onSuccess: () => {
|
|
2523
2542
|
queryClient2.invalidateQueries("notifications");
|
|
2524
2543
|
}
|
|
@@ -2620,7 +2639,7 @@ var useNotificationSubscription = (refetch, notificationCollection) => {
|
|
|
2620
2639
|
};
|
|
2621
2640
|
|
|
2622
2641
|
// src/alerts.ts
|
|
2623
|
-
var
|
|
2642
|
+
var import_react_query22 = require("react-query");
|
|
2624
2643
|
var alertsFromStorage = () => {
|
|
2625
2644
|
const item = localStorage.getItem("alerts");
|
|
2626
2645
|
if (item) {
|
|
@@ -2662,7 +2681,7 @@ var restoreOrFetch = (request) => {
|
|
|
2662
2681
|
};
|
|
2663
2682
|
var useAlerts = () => {
|
|
2664
2683
|
const link = useIndexLink("alerts");
|
|
2665
|
-
const { data, error, isLoading } = (0,
|
|
2684
|
+
const { data, error, isLoading } = (0, import_react_query22.useQuery)(
|
|
2666
2685
|
"alerts",
|
|
2667
2686
|
() => {
|
|
2668
2687
|
if (!link) {
|
|
@@ -2683,12 +2702,12 @@ var useAlerts = () => {
|
|
|
2683
2702
|
};
|
|
2684
2703
|
|
|
2685
2704
|
// src/configLink.ts
|
|
2686
|
-
var
|
|
2705
|
+
var import_react_query23 = require("react-query");
|
|
2687
2706
|
var import_react8 = require("react");
|
|
2688
2707
|
var useConfigLink = (link) => {
|
|
2689
|
-
const queryClient2 = (0,
|
|
2708
|
+
const queryClient2 = (0, import_react_query23.useQueryClient)();
|
|
2690
2709
|
const queryKey = ["configLink", link];
|
|
2691
|
-
const { isLoading, error, data } = (0,
|
|
2710
|
+
const { isLoading, error, data } = (0, import_react_query23.useQuery)(
|
|
2692
2711
|
queryKey,
|
|
2693
2712
|
() => apiClient.get(link).then((response) => {
|
|
2694
2713
|
const contentType = response.headers.get("Content-Type") || "application/json";
|
|
@@ -2700,7 +2719,7 @@ var useConfigLink = (link) => {
|
|
|
2700
2719
|
error: mutationError,
|
|
2701
2720
|
mutateAsync,
|
|
2702
2721
|
data: updateResponse
|
|
2703
|
-
} = (0,
|
|
2722
|
+
} = (0, import_react_query23.useMutation)(
|
|
2704
2723
|
(vars) => apiClient.put(vars.link, vars.configuration, vars.contentType),
|
|
2705
2724
|
{
|
|
2706
2725
|
onSuccess: async () => {
|
|
@@ -2733,9 +2752,9 @@ var useConfigLink = (link) => {
|
|
|
2733
2752
|
};
|
|
2734
2753
|
|
|
2735
2754
|
// src/apiKeys.ts
|
|
2736
|
-
var
|
|
2755
|
+
var import_react_query24 = require("react-query");
|
|
2737
2756
|
var CONTENT_TYPE_API_KEY = "application/vnd.scmm-apiKey+json;v=2";
|
|
2738
|
-
var useApiKeys = (user) => (0,
|
|
2757
|
+
var useApiKeys = (user) => (0, import_react_query24.useQuery)(["user", user.name, "apiKeys"], () => apiClient.get(requiredLink(user, "apiKeys")).then((r) => r.json()));
|
|
2739
2758
|
var createApiKey = (link) => async (key) => {
|
|
2740
2759
|
const creationResponse = await apiClient.post(link, key, CONTENT_TYPE_API_KEY);
|
|
2741
2760
|
const location = creationResponse.headers.get("Location");
|
|
@@ -2747,8 +2766,8 @@ var createApiKey = (link) => async (key) => {
|
|
|
2747
2766
|
return { ...apiKey, token };
|
|
2748
2767
|
};
|
|
2749
2768
|
var useCreateApiKey = (user, apiKeys) => {
|
|
2750
|
-
const queryClient2 = (0,
|
|
2751
|
-
const { mutate, data, isLoading, error, reset: reset2 } = (0,
|
|
2769
|
+
const queryClient2 = (0, import_react_query24.useQueryClient)();
|
|
2770
|
+
const { mutate, data, isLoading, error, reset: reset2 } = (0, import_react_query24.useMutation)(
|
|
2752
2771
|
createApiKey(requiredLink(apiKeys, "create")),
|
|
2753
2772
|
{
|
|
2754
2773
|
onSuccess: () => queryClient2.invalidateQueries(["user", user.name, "apiKeys"])
|
|
@@ -2763,8 +2782,8 @@ var useCreateApiKey = (user, apiKeys) => {
|
|
|
2763
2782
|
};
|
|
2764
2783
|
};
|
|
2765
2784
|
var useDeleteApiKey = (user) => {
|
|
2766
|
-
const queryClient2 = (0,
|
|
2767
|
-
const { mutate, isLoading, error, data } = (0,
|
|
2785
|
+
const queryClient2 = (0, import_react_query24.useQueryClient)();
|
|
2786
|
+
const { mutate, isLoading, error, data } = (0, import_react_query24.useMutation)(
|
|
2768
2787
|
(apiKey) => {
|
|
2769
2788
|
const deleteUrl = requiredLink(apiKey, "delete");
|
|
2770
2789
|
return apiClient.delete(deleteUrl);
|
|
@@ -2782,9 +2801,9 @@ var useDeleteApiKey = (user) => {
|
|
|
2782
2801
|
};
|
|
2783
2802
|
|
|
2784
2803
|
// src/publicKeys.ts
|
|
2785
|
-
var
|
|
2804
|
+
var import_react_query25 = require("react-query");
|
|
2786
2805
|
var CONTENT_TYPE_PUBLIC_KEY = "application/vnd.scmm-publicKey+json;v=2";
|
|
2787
|
-
var usePublicKeys = (user) => (0,
|
|
2806
|
+
var usePublicKeys = (user) => (0, import_react_query25.useQuery)(
|
|
2788
2807
|
["user", user.name, "publicKeys"],
|
|
2789
2808
|
() => apiClient.get(requiredLink(user, "publicKeys")).then((r) => r.json())
|
|
2790
2809
|
);
|
|
@@ -2798,8 +2817,8 @@ var createPublicKey = (link) => async (key) => {
|
|
|
2798
2817
|
return apiKeyResponse.json();
|
|
2799
2818
|
};
|
|
2800
2819
|
var useCreatePublicKey = (user, publicKeys) => {
|
|
2801
|
-
const queryClient2 = (0,
|
|
2802
|
-
const { mutate, data, isLoading, error, reset: reset2 } = (0,
|
|
2820
|
+
const queryClient2 = (0, import_react_query25.useQueryClient)();
|
|
2821
|
+
const { mutate, data, isLoading, error, reset: reset2 } = (0, import_react_query25.useMutation)(
|
|
2803
2822
|
createPublicKey(requiredLink(publicKeys, "create")),
|
|
2804
2823
|
{
|
|
2805
2824
|
onSuccess: () => queryClient2.invalidateQueries(["user", user.name, "publicKeys"])
|
|
@@ -2814,8 +2833,8 @@ var useCreatePublicKey = (user, publicKeys) => {
|
|
|
2814
2833
|
};
|
|
2815
2834
|
};
|
|
2816
2835
|
var useDeletePublicKey = (user) => {
|
|
2817
|
-
const queryClient2 = (0,
|
|
2818
|
-
const { mutate, isLoading, error, data } = (0,
|
|
2836
|
+
const queryClient2 = (0, import_react_query25.useQueryClient)();
|
|
2837
|
+
const { mutate, isLoading, error, data } = (0, import_react_query25.useMutation)(
|
|
2819
2838
|
(publicKey) => {
|
|
2820
2839
|
const deleteUrl = requiredLink(publicKey, "delete");
|
|
2821
2840
|
return apiClient.delete(deleteUrl);
|
|
@@ -2833,22 +2852,22 @@ var useDeletePublicKey = (user) => {
|
|
|
2833
2852
|
};
|
|
2834
2853
|
|
|
2835
2854
|
// src/fileContent.ts
|
|
2836
|
-
var
|
|
2855
|
+
var import_react_query26 = require("react-query");
|
|
2837
2856
|
var useFileContent = (file) => {
|
|
2838
2857
|
const selfLink = requiredLink(file, "self");
|
|
2839
|
-
return (0,
|
|
2858
|
+
return (0, import_react_query26.useQuery)(["fileContent", selfLink], () => apiClient.get(selfLink).then((response) => response.text()));
|
|
2840
2859
|
};
|
|
2841
2860
|
|
|
2842
2861
|
// src/history.ts
|
|
2843
|
-
var
|
|
2862
|
+
var import_react_query27 = require("react-query");
|
|
2844
2863
|
var useHistory = (repository, revision, file, request) => {
|
|
2845
|
-
const queryClient2 = (0,
|
|
2864
|
+
const queryClient2 = (0, import_react_query27.useQueryClient)();
|
|
2846
2865
|
const link = file._links.history.href;
|
|
2847
2866
|
const queryParams = {};
|
|
2848
2867
|
if (request == null ? void 0 : request.page) {
|
|
2849
2868
|
queryParams.page = request.page.toString();
|
|
2850
2869
|
}
|
|
2851
|
-
return (0,
|
|
2870
|
+
return (0, import_react_query27.useQuery)(
|
|
2852
2871
|
repoQueryKey(repository, "history", revision, file.path, (request == null ? void 0 : request.page) || 0),
|
|
2853
2872
|
() => apiClient.get(`${link}?${createQueryString(queryParams)}`).then((response) => response.json()),
|
|
2854
2873
|
{
|
|
@@ -2864,7 +2883,7 @@ var useHistory = (repository, revision, file, request) => {
|
|
|
2864
2883
|
};
|
|
2865
2884
|
|
|
2866
2885
|
// src/contentType.ts
|
|
2867
|
-
var
|
|
2886
|
+
var import_react_query28 = require("react-query");
|
|
2868
2887
|
function getContentType(url) {
|
|
2869
2888
|
return apiClient.head(url).then((response) => {
|
|
2870
2889
|
return {
|
|
@@ -2877,7 +2896,7 @@ function getContentType(url) {
|
|
|
2877
2896
|
});
|
|
2878
2897
|
}
|
|
2879
2898
|
var useContentType = (url, options = {}) => {
|
|
2880
|
-
const { isLoading, isFetching, error, data } = (0,
|
|
2899
|
+
const { isLoading, isFetching, error, data } = (0, import_react_query28.useQuery)(
|
|
2881
2900
|
["contentType", url],
|
|
2882
2901
|
() => getContentType(url),
|
|
2883
2902
|
options
|
|
@@ -2891,9 +2910,9 @@ var useContentType = (url, options = {}) => {
|
|
|
2891
2910
|
};
|
|
2892
2911
|
|
|
2893
2912
|
// src/annotations.ts
|
|
2894
|
-
var
|
|
2913
|
+
var import_react_query29 = require("react-query");
|
|
2895
2914
|
var useAnnotations = (repository, revision, file) => {
|
|
2896
|
-
const { isLoading, isFetching, error, data } = (0,
|
|
2915
|
+
const { isLoading, isFetching, error, data } = (0, import_react_query29.useQuery)(
|
|
2897
2916
|
repoQueryKey(repository, "annotations", revision, file.path),
|
|
2898
2917
|
() => apiClient.get(file._links.annotate.href).then((response) => response.json())
|
|
2899
2918
|
);
|
|
@@ -2906,7 +2925,7 @@ var useAnnotations = (repository, revision, file) => {
|
|
|
2906
2925
|
};
|
|
2907
2926
|
|
|
2908
2927
|
// src/search.ts
|
|
2909
|
-
var
|
|
2928
|
+
var import_react_query30 = require("react-query");
|
|
2910
2929
|
var import_react9 = require("react");
|
|
2911
2930
|
|
|
2912
2931
|
// src/help/search/syntax.en.ts
|
|
@@ -3116,7 +3135,7 @@ var useSearchableTypes = () => useIndexJsonResource("searchableTypes");
|
|
|
3116
3135
|
var useSearchCounts = (types, query, options) => {
|
|
3117
3136
|
const { links, isLoading } = useSearchLinks(options);
|
|
3118
3137
|
const result = {};
|
|
3119
|
-
const queries = (0,
|
|
3138
|
+
const queries = (0, import_react_query30.useQueries)(
|
|
3120
3139
|
types.map((type) => ({
|
|
3121
3140
|
queryKey: ["search", type, query, "count"],
|
|
3122
3141
|
queryFn: () => apiClient.get(`${findLink(links, type)}?q=${encodeURIComponent(query)}&countOnly=true`).then((response) => response.json()),
|
|
@@ -3189,7 +3208,7 @@ var useInternalSearch = (query, options, link) => {
|
|
|
3189
3208
|
if (options.pageSize) {
|
|
3190
3209
|
queryParams.pageSize = options.pageSize.toString();
|
|
3191
3210
|
}
|
|
3192
|
-
return (0,
|
|
3211
|
+
return (0, import_react_query30.useQuery)(
|
|
3193
3212
|
["search", options.type, queryParams],
|
|
3194
3213
|
() => apiClient.get(`${link}?${createQueryString(queryParams)}`).then((response) => response.json()),
|
|
3195
3214
|
{
|
|
@@ -3226,10 +3245,10 @@ var useSearchSyntaxContent = (language) => useObserveAsync(
|
|
|
3226
3245
|
);
|
|
3227
3246
|
|
|
3228
3247
|
// src/loginInfo.ts
|
|
3229
|
-
var
|
|
3248
|
+
var import_react_query31 = require("react-query");
|
|
3230
3249
|
var useLoginInfo = (disabled = false) => {
|
|
3231
3250
|
const loginInfoLink = useIndexLink("loginInfo");
|
|
3232
|
-
const { error, isLoading, data } = (0,
|
|
3251
|
+
const { error, isLoading, data } = (0, import_react_query31.useQuery)(
|
|
3233
3252
|
["loginInfo"],
|
|
3234
3253
|
() => fetch(loginInfoLink).then((response) => response.json()),
|
|
3235
3254
|
{
|
|
@@ -3245,9 +3264,9 @@ var useLoginInfo = (disabled = false) => {
|
|
|
3245
3264
|
};
|
|
3246
3265
|
|
|
3247
3266
|
// src/useInvalidation.tsx
|
|
3248
|
-
var
|
|
3267
|
+
var import_react_query32 = require("react-query");
|
|
3249
3268
|
var useInvalidation = (link) => {
|
|
3250
|
-
const { mutate, isLoading, error, isSuccess } = (0,
|
|
3269
|
+
const { mutate, isLoading, error, isSuccess } = (0, import_react_query32.useMutation)(
|
|
3251
3270
|
(link2) => apiClient.post(link2, {})
|
|
3252
3271
|
);
|
|
3253
3272
|
return {
|
|
@@ -3267,7 +3286,7 @@ var useInvalidateSearchIndices = () => {
|
|
|
3267
3286
|
};
|
|
3268
3287
|
|
|
3269
3288
|
// src/usePluginCenterAuthInfo.ts
|
|
3270
|
-
var
|
|
3289
|
+
var import_react_query33 = require("react-query");
|
|
3271
3290
|
var import_react_router_dom = require("react-router-dom");
|
|
3272
3291
|
var appendQueryParam = (link, name, value) => {
|
|
3273
3292
|
let href = link.href;
|
|
@@ -3281,7 +3300,7 @@ var appendQueryParam = (link, name, value) => {
|
|
|
3281
3300
|
var usePluginCenterAuthInfo = () => {
|
|
3282
3301
|
const link = useIndexLink("pluginCenterAuth");
|
|
3283
3302
|
const location = (0, import_react_router_dom.useLocation)();
|
|
3284
|
-
return (0,
|
|
3303
|
+
return (0, import_react_query33.useQuery)(
|
|
3285
3304
|
["pluginCenterAuth"],
|
|
3286
3305
|
() => {
|
|
3287
3306
|
if (!link) {
|
|
@@ -3304,8 +3323,8 @@ var usePluginCenterAuthInfo = () => {
|
|
|
3304
3323
|
);
|
|
3305
3324
|
};
|
|
3306
3325
|
var usePluginCenterLogout = (authenticationInfo) => {
|
|
3307
|
-
const queryClient2 = (0,
|
|
3308
|
-
const { mutate, isLoading, error } = (0,
|
|
3326
|
+
const queryClient2 = (0, import_react_query33.useQueryClient)();
|
|
3327
|
+
const { mutate, isLoading, error } = (0, import_react_query33.useMutation)(
|
|
3309
3328
|
() => {
|
|
3310
3329
|
if (!authenticationInfo._links.logout) {
|
|
3311
3330
|
throw new Error("authenticationInfo has no logout link");
|
|
@@ -3327,7 +3346,7 @@ var usePluginCenterLogout = (authenticationInfo) => {
|
|
|
3327
3346
|
};
|
|
3328
3347
|
|
|
3329
3348
|
// src/compare.ts
|
|
3330
|
-
var
|
|
3349
|
+
var import_react_query34 = require("react-query");
|
|
3331
3350
|
function createIncomingUrl(repository, linkName, source, target) {
|
|
3332
3351
|
const link = repository._links[linkName];
|
|
3333
3352
|
if (link == null ? void 0 : link.templated) {
|
|
@@ -3347,7 +3366,7 @@ function createDiffUrl(repository, source, target) {
|
|
|
3347
3366
|
}
|
|
3348
3367
|
}
|
|
3349
3368
|
var useIncomingChangesets = (repository, source, target, request) => {
|
|
3350
|
-
const queryClient2 = (0,
|
|
3369
|
+
const queryClient2 = (0, import_react_query34.useQueryClient)();
|
|
3351
3370
|
let link = createChangesetUrl(repository, source, target);
|
|
3352
3371
|
if ((request == null ? void 0 : request.page) || (request == null ? void 0 : request.limit)) {
|
|
3353
3372
|
if ((request == null ? void 0 : request.page) && (request == null ? void 0 : request.limit)) {
|
|
@@ -3358,7 +3377,7 @@ var useIncomingChangesets = (repository, source, target, request) => {
|
|
|
3358
3377
|
link = `${link}?pageSize=${request.limit}`;
|
|
3359
3378
|
}
|
|
3360
3379
|
}
|
|
3361
|
-
return (0,
|
|
3380
|
+
return (0, import_react_query34.useQuery)(
|
|
3362
3381
|
["repository", repository.namespace, repository.name, "compare", source, target, "changesets", (request == null ? void 0 : request.page) || 0],
|
|
3363
3382
|
() => apiClient.get(link).then((response) => response.json()),
|
|
3364
3383
|
{
|
|
@@ -3396,24 +3415,32 @@ function useLocalStorage(key, initialValue) {
|
|
|
3396
3415
|
return () => window.removeEventListener("storage", listener);
|
|
3397
3416
|
}, [key, initialValue]);
|
|
3398
3417
|
const setValue = (newValue) => {
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3418
|
+
setItem((oldValue) => {
|
|
3419
|
+
const computedNewValue = newValue instanceof Function ? newValue(oldValue) : newValue;
|
|
3420
|
+
setItem(computedNewValue);
|
|
3421
|
+
const json = JSON.stringify(computedNewValue);
|
|
3422
|
+
localStorage.setItem(key, json);
|
|
3423
|
+
window.dispatchEvent(
|
|
3424
|
+
new StorageEvent("storage", {
|
|
3425
|
+
key,
|
|
3426
|
+
oldValue: JSON.stringify(oldValue),
|
|
3427
|
+
newValue: json,
|
|
3428
|
+
storageArea: localStorage
|
|
3429
|
+
})
|
|
3430
|
+
);
|
|
3431
|
+
return computedNewValue;
|
|
3432
|
+
});
|
|
3406
3433
|
};
|
|
3407
3434
|
return [item, setValue];
|
|
3408
3435
|
}
|
|
3409
3436
|
|
|
3410
3437
|
// src/useAutocompleteOptions.ts
|
|
3411
|
-
var
|
|
3438
|
+
var import_react_query35 = require("react-query");
|
|
3412
3439
|
var import_react_i18next = require("react-i18next");
|
|
3413
3440
|
var defaultLabelFactory = (element) => element.displayName ? `${element.displayName} (${element.id})` : element.id;
|
|
3414
3441
|
function useAutocompleteOptions(query = "", link, options = {}) {
|
|
3415
3442
|
const [t] = (0, import_react_i18next.useTranslation)("commons");
|
|
3416
|
-
return (0,
|
|
3443
|
+
return (0, import_react_query35.useQuery)(
|
|
3417
3444
|
["options", link, query],
|
|
3418
3445
|
() => apiClient.get(link + "?q=" + query).then((r) => r.json()).then((json) => {
|
|
3419
3446
|
const result = json.map((element) => ({
|
|
@@ -3464,9 +3491,9 @@ var useUserOptions = (query) => {
|
|
|
3464
3491
|
|
|
3465
3492
|
// src/ApiProvider.tsx
|
|
3466
3493
|
var import_react11 = __toESM(require("react"));
|
|
3467
|
-
var
|
|
3494
|
+
var import_react_query36 = require("react-query");
|
|
3468
3495
|
var import_devtools = require("react-query/devtools");
|
|
3469
|
-
var queryClient = new
|
|
3496
|
+
var queryClient = new import_react_query36.QueryClient({
|
|
3470
3497
|
defaultOptions: {
|
|
3471
3498
|
queries: {
|
|
3472
3499
|
retry: false
|
|
@@ -3490,7 +3517,7 @@ var ApiProvider = ({ children, index, me, onMeFetched, onIndexFetched, devtools
|
|
|
3490
3517
|
}
|
|
3491
3518
|
}
|
|
3492
3519
|
}, [me, onMeFetched]);
|
|
3493
|
-
return /* @__PURE__ */ import_react11.default.createElement(
|
|
3520
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react_query36.QueryClientProvider, {
|
|
3494
3521
|
client: queryClient
|
|
3495
3522
|
}, /* @__PURE__ */ import_react11.default.createElement(LegacyContextProvider, {
|
|
3496
3523
|
onIndexFetched,
|
|
@@ -3672,6 +3699,7 @@ var RepositoryRevisionContextProvider = ({ revision, children }) => /* @__PURE__
|
|
|
3672
3699
|
useRepositoryVerbs,
|
|
3673
3700
|
useRequiredIndexLink,
|
|
3674
3701
|
useRequiredMe,
|
|
3702
|
+
useRevert,
|
|
3675
3703
|
useRunHealthCheck,
|
|
3676
3704
|
useSearch,
|
|
3677
3705
|
useSearchCounts,
|
package/build/index.mjs
CHANGED
|
@@ -1510,8 +1510,26 @@ var useChangeset = (repository, id) => {
|
|
|
1510
1510
|
);
|
|
1511
1511
|
};
|
|
1512
1512
|
|
|
1513
|
+
// src/revert.ts
|
|
1514
|
+
import { useMutation as useMutation6 } from "react-query";
|
|
1515
|
+
var useRevert = (changeset) => {
|
|
1516
|
+
const link = requiredLink(changeset, "revert");
|
|
1517
|
+
const { isLoading, error, mutate, data } = useMutation6({
|
|
1518
|
+
mutationFn: async (request) => {
|
|
1519
|
+
const response = await apiClient.post(link, request, "application/vnd.scmm-revert+json;v=2");
|
|
1520
|
+
return await response.json();
|
|
1521
|
+
}
|
|
1522
|
+
});
|
|
1523
|
+
return {
|
|
1524
|
+
revert: mutate,
|
|
1525
|
+
isLoading,
|
|
1526
|
+
error,
|
|
1527
|
+
revision: data
|
|
1528
|
+
};
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1513
1531
|
// src/tags.ts
|
|
1514
|
-
import { useMutation as
|
|
1532
|
+
import { useMutation as useMutation7, useQuery as useQuery9, useQueryClient as useQueryClient8 } from "react-query";
|
|
1515
1533
|
var tagQueryKey = (repository, tag) => {
|
|
1516
1534
|
return repoQueryKey(repository, "tag", tag);
|
|
1517
1535
|
};
|
|
@@ -1571,7 +1589,7 @@ var createTag = (changeset, link) => {
|
|
|
1571
1589
|
var useCreateTag = (repository, changeset) => {
|
|
1572
1590
|
const queryClient2 = useQueryClient8();
|
|
1573
1591
|
const link = requiredLink(changeset, "tag");
|
|
1574
|
-
const { isLoading, error, mutate, data } =
|
|
1592
|
+
const { isLoading, error, mutate, data } = useMutation7(createTag(changeset, link), {
|
|
1575
1593
|
onSuccess: async (tag) => {
|
|
1576
1594
|
queryClient2.setQueryData(tagQueryKey(repository, tag.name), tag);
|
|
1577
1595
|
await queryClient2.invalidateQueries(tagQueryKey(repository, tag.name));
|
|
@@ -1587,7 +1605,7 @@ var useCreateTag = (repository, changeset) => {
|
|
|
1587
1605
|
};
|
|
1588
1606
|
var useDeleteTag = (repository) => {
|
|
1589
1607
|
const queryClient2 = useQueryClient8();
|
|
1590
|
-
const { mutate, isLoading, error, data } =
|
|
1608
|
+
const { mutate, isLoading, error, data } = useMutation7(
|
|
1591
1609
|
(tag) => {
|
|
1592
1610
|
const deleteUrl = tag._links.delete.href;
|
|
1593
1611
|
return apiClient.delete(deleteUrl);
|
|
@@ -1608,7 +1626,7 @@ var useDeleteTag = (repository) => {
|
|
|
1608
1626
|
};
|
|
1609
1627
|
|
|
1610
1628
|
// src/config.ts
|
|
1611
|
-
import { useMutation as
|
|
1629
|
+
import { useMutation as useMutation8, useQuery as useQuery10, useQueryClient as useQueryClient9 } from "react-query";
|
|
1612
1630
|
var useConfig = () => {
|
|
1613
1631
|
const indexLink = useIndexLink("config");
|
|
1614
1632
|
return useQuery10("config", () => apiClient.get(indexLink).then((response) => response.json()), {
|
|
@@ -1617,7 +1635,7 @@ var useConfig = () => {
|
|
|
1617
1635
|
};
|
|
1618
1636
|
var useUpdateConfig = () => {
|
|
1619
1637
|
const queryClient2 = useQueryClient9();
|
|
1620
|
-
const { mutate, isLoading, error, data, reset: reset2 } =
|
|
1638
|
+
const { mutate, isLoading, error, data, reset: reset2 } = useMutation8(
|
|
1621
1639
|
(config) => {
|
|
1622
1640
|
const updateUrl = requiredLink(config, "update");
|
|
1623
1641
|
return apiClient.put(updateUrl, config, "application/vnd.scmm-config+json;v=2");
|
|
@@ -1656,7 +1674,7 @@ var useUpdateInfo = () => {
|
|
|
1656
1674
|
};
|
|
1657
1675
|
|
|
1658
1676
|
// src/plugins.ts
|
|
1659
|
-
import { useMutation as
|
|
1677
|
+
import { useMutation as useMutation9, useQuery as useQuery12, useQueryClient as useQueryClient10 } from "react-query";
|
|
1660
1678
|
var isPluginCollection = (input) => input._embedded ? "plugins" in input._embedded : false;
|
|
1661
1679
|
var waitForRestartAfter = (promise, { initialDelay = 1e3, timeout = 500 } = {}) => {
|
|
1662
1680
|
const endTime = Number(new Date()) + 4 * 60 * 1e3;
|
|
@@ -1723,7 +1741,7 @@ var linkWithRestart = (link, restart) => {
|
|
|
1723
1741
|
};
|
|
1724
1742
|
var useInstallPlugin = () => {
|
|
1725
1743
|
const queryClient2 = useQueryClient10();
|
|
1726
|
-
const { mutate, isLoading, error, data } =
|
|
1744
|
+
const { mutate, isLoading, error, data } = useMutation9(
|
|
1727
1745
|
({ plugin, restartOptions: { restart, ...waitForRestartOptions } }) => {
|
|
1728
1746
|
const promise = apiClient.post(requiredLink(plugin, linkWithRestart("install", restart)));
|
|
1729
1747
|
if (restart) {
|
|
@@ -1748,7 +1766,7 @@ var useInstallPlugin = () => {
|
|
|
1748
1766
|
};
|
|
1749
1767
|
var useUninstallPlugin = () => {
|
|
1750
1768
|
const queryClient2 = useQueryClient10();
|
|
1751
|
-
const { mutate, isLoading, error, data } =
|
|
1769
|
+
const { mutate, isLoading, error, data } = useMutation9(
|
|
1752
1770
|
({ plugin, restartOptions: { restart, ...waitForRestartOptions } }) => {
|
|
1753
1771
|
const promise = apiClient.post(requiredLink(plugin, linkWithRestart("uninstall", restart)));
|
|
1754
1772
|
if (restart) {
|
|
@@ -1772,7 +1790,7 @@ var useUninstallPlugin = () => {
|
|
|
1772
1790
|
};
|
|
1773
1791
|
var useUpdatePlugins = () => {
|
|
1774
1792
|
const queryClient2 = useQueryClient10();
|
|
1775
|
-
const { mutate, isLoading, error, data } =
|
|
1793
|
+
const { mutate, isLoading, error, data } = useMutation9(
|
|
1776
1794
|
({ plugins, restartOptions: { restart, ...waitForRestartOptions } }) => {
|
|
1777
1795
|
const isCollection = isPluginCollection(plugins);
|
|
1778
1796
|
const promise = apiClient.post(
|
|
@@ -1799,7 +1817,7 @@ var useUpdatePlugins = () => {
|
|
|
1799
1817
|
};
|
|
1800
1818
|
var useExecutePendingPlugins = () => {
|
|
1801
1819
|
const queryClient2 = useQueryClient10();
|
|
1802
|
-
const { mutate, isLoading, error, data } =
|
|
1820
|
+
const { mutate, isLoading, error, data } = useMutation9(
|
|
1803
1821
|
({ pending, restartOptions }) => waitForRestartAfter(apiClient.post(requiredLink(pending, "execute")), restartOptions),
|
|
1804
1822
|
{
|
|
1805
1823
|
onSuccess: () => queryClient2.invalidateQueries("plugins")
|
|
@@ -1814,7 +1832,7 @@ var useExecutePendingPlugins = () => {
|
|
|
1814
1832
|
};
|
|
1815
1833
|
var useCancelPendingPlugins = () => {
|
|
1816
1834
|
const queryClient2 = useQueryClient10();
|
|
1817
|
-
const { mutate, isLoading, error, data } =
|
|
1835
|
+
const { mutate, isLoading, error, data } = useMutation9(
|
|
1818
1836
|
(pending) => apiClient.post(requiredLink(pending, "cancel")),
|
|
1819
1837
|
{
|
|
1820
1838
|
onSuccess: () => queryClient2.invalidateQueries("plugins")
|
|
@@ -1829,7 +1847,7 @@ var useCancelPendingPlugins = () => {
|
|
|
1829
1847
|
};
|
|
1830
1848
|
|
|
1831
1849
|
// src/repository-roles.ts
|
|
1832
|
-
import { useMutation as
|
|
1850
|
+
import { useMutation as useMutation10, useQuery as useQuery13, useQueryClient as useQueryClient11 } from "react-query";
|
|
1833
1851
|
var useRepositoryRoles = (request) => {
|
|
1834
1852
|
const queryClient2 = useQueryClient11();
|
|
1835
1853
|
const indexLink = useRequiredIndexLink("repositoryRoles");
|
|
@@ -1871,7 +1889,7 @@ var createRepositoryRole = (link) => {
|
|
|
1871
1889
|
var useCreateRepositoryRole = () => {
|
|
1872
1890
|
const queryClient2 = useQueryClient11();
|
|
1873
1891
|
const link = useRequiredIndexLink("repositoryRoles");
|
|
1874
|
-
const { mutate, data, isLoading, error } =
|
|
1892
|
+
const { mutate, data, isLoading, error } = useMutation10(
|
|
1875
1893
|
createRepositoryRole(link),
|
|
1876
1894
|
{
|
|
1877
1895
|
onSuccess: (repositoryRole) => {
|
|
@@ -1889,7 +1907,7 @@ var useCreateRepositoryRole = () => {
|
|
|
1889
1907
|
};
|
|
1890
1908
|
var useUpdateRepositoryRole = () => {
|
|
1891
1909
|
const queryClient2 = useQueryClient11();
|
|
1892
|
-
const { mutate, isLoading, error, data } =
|
|
1910
|
+
const { mutate, isLoading, error, data } = useMutation10(
|
|
1893
1911
|
(repositoryRole) => {
|
|
1894
1912
|
const updateUrl = requiredLink(repositoryRole, "update");
|
|
1895
1913
|
return apiClient.put(updateUrl, repositoryRole, "application/vnd.scmm-repositoryRole+json;v=2");
|
|
@@ -1910,7 +1928,7 @@ var useUpdateRepositoryRole = () => {
|
|
|
1910
1928
|
};
|
|
1911
1929
|
var useDeleteRepositoryRole = () => {
|
|
1912
1930
|
const queryClient2 = useQueryClient11();
|
|
1913
|
-
const { mutate, isLoading, error, data } =
|
|
1931
|
+
const { mutate, isLoading, error, data } = useMutation10(
|
|
1914
1932
|
(repositoryRole) => {
|
|
1915
1933
|
const deleteUrl = requiredLink(repositoryRole, "delete");
|
|
1916
1934
|
return apiClient.delete(deleteUrl);
|
|
@@ -1931,7 +1949,7 @@ var useDeleteRepositoryRole = () => {
|
|
|
1931
1949
|
};
|
|
1932
1950
|
|
|
1933
1951
|
// src/permissions.ts
|
|
1934
|
-
import { useMutation as
|
|
1952
|
+
import { useMutation as useMutation11, useQuery as useQuery14, useQueryClient as useQueryClient12 } from "react-query";
|
|
1935
1953
|
var useRepositoryVerbs = () => {
|
|
1936
1954
|
return useIndexJsonResource("repositoryVerbs");
|
|
1937
1955
|
};
|
|
@@ -1981,7 +1999,7 @@ var createPermission = (link) => {
|
|
|
1981
1999
|
var useCreatePermission = (namespaceOrRepository) => {
|
|
1982
2000
|
const queryClient2 = useQueryClient12();
|
|
1983
2001
|
const link = requiredLink(namespaceOrRepository, "permissions");
|
|
1984
|
-
const { isLoading, error, mutate, data } =
|
|
2002
|
+
const { isLoading, error, mutate, data } = useMutation11(
|
|
1985
2003
|
createPermission(link),
|
|
1986
2004
|
{
|
|
1987
2005
|
onSuccess: () => {
|
|
@@ -1999,7 +2017,7 @@ var useCreatePermission = (namespaceOrRepository) => {
|
|
|
1999
2017
|
};
|
|
2000
2018
|
var useUpdatePermission = (namespaceOrRepository) => {
|
|
2001
2019
|
const queryClient2 = useQueryClient12();
|
|
2002
|
-
const { isLoading, error, mutate, data } =
|
|
2020
|
+
const { isLoading, error, mutate, data } = useMutation11(
|
|
2003
2021
|
(permission) => {
|
|
2004
2022
|
const link = requiredLink(permission, "update");
|
|
2005
2023
|
return apiClient.put(link, permission, "application/vnd.scmm-repositoryPermission+json");
|
|
@@ -2020,7 +2038,7 @@ var useUpdatePermission = (namespaceOrRepository) => {
|
|
|
2020
2038
|
};
|
|
2021
2039
|
var useDeletePermission = (namespaceOrRepository) => {
|
|
2022
2040
|
const queryClient2 = useQueryClient12();
|
|
2023
|
-
const { isLoading, error, mutate, data } =
|
|
2041
|
+
const { isLoading, error, mutate, data } = useMutation11(
|
|
2024
2042
|
(permission) => {
|
|
2025
2043
|
const link = requiredLink(permission, "delete");
|
|
2026
2044
|
return apiClient.delete(link);
|
|
@@ -2047,7 +2065,7 @@ var useAvailableGlobalPermissions = () => useIndexJsonResource("permissions");
|
|
|
2047
2065
|
var useSetEntityPermissions = (permissionCollection, key) => {
|
|
2048
2066
|
const queryClient2 = useQueryClient12();
|
|
2049
2067
|
const url = permissionCollection ? objectLink(permissionCollection, "overwrite") : null;
|
|
2050
|
-
const { isLoading, error, mutate, data } =
|
|
2068
|
+
const { isLoading, error, mutate, data } = useMutation11(
|
|
2051
2069
|
(permissions) => apiClient.put(
|
|
2052
2070
|
url,
|
|
2053
2071
|
{
|
|
@@ -2170,14 +2188,14 @@ var isPartial = (file) => {
|
|
|
2170
2188
|
};
|
|
2171
2189
|
|
|
2172
2190
|
// src/import.ts
|
|
2173
|
-
import { useMutation as
|
|
2191
|
+
import { useMutation as useMutation12, useQuery as useQuery15 } from "react-query";
|
|
2174
2192
|
var useImportLog = (logId) => {
|
|
2175
2193
|
const link = useRequiredIndexLink("importLog").replace("{logId}", logId);
|
|
2176
2194
|
return useQuery15(["importLog", logId], () => apiClient.get(link).then((response) => response.text()));
|
|
2177
2195
|
};
|
|
2178
2196
|
var useImportRepositoryFromUrl = (repositoryType) => {
|
|
2179
2197
|
const url = requiredLink(repositoryType, "import", "url");
|
|
2180
|
-
const { isLoading, error, data, mutate } =
|
|
2198
|
+
const { isLoading, error, data, mutate } = useMutation12(
|
|
2181
2199
|
(repo) => apiClient.post(url, repo, "application/vnd.scmm-repository+json;v=2").then(fetchResourceFromLocationHeader).then(getResponseJson)
|
|
2182
2200
|
);
|
|
2183
2201
|
return {
|
|
@@ -2195,7 +2213,7 @@ var importRepository = (url, repository, file, password) => {
|
|
|
2195
2213
|
};
|
|
2196
2214
|
var useImportRepositoryFromBundle = (repositoryType) => {
|
|
2197
2215
|
const url = requiredLink(repositoryType, "import", "bundle");
|
|
2198
|
-
const { isLoading, error, data, mutate } =
|
|
2216
|
+
const { isLoading, error, data, mutate } = useMutation12(
|
|
2199
2217
|
({ repository, file, compressed, password }) => importRepository(compressed ? url + "?compressed=true" : url, repository, file, password)
|
|
2200
2218
|
);
|
|
2201
2219
|
return {
|
|
@@ -2211,7 +2229,7 @@ var useImportRepositoryFromBundle = (repositoryType) => {
|
|
|
2211
2229
|
};
|
|
2212
2230
|
};
|
|
2213
2231
|
var useImportFullRepository = (repositoryType) => {
|
|
2214
|
-
const { isLoading, error, data, mutate } =
|
|
2232
|
+
const { isLoading, error, data, mutate } = useMutation12(
|
|
2215
2233
|
({ repository, file, password }) => importRepository(requiredLink(repositoryType, "import", "fullImport"), repository, file, password)
|
|
2216
2234
|
);
|
|
2217
2235
|
return {
|
|
@@ -2286,7 +2304,7 @@ var merge2 = (diffs) => {
|
|
|
2286
2304
|
};
|
|
2287
2305
|
|
|
2288
2306
|
// src/notifications.ts
|
|
2289
|
-
import { useMutation as
|
|
2307
|
+
import { useMutation as useMutation13, useQuery as useQuery16, useQueryClient as useQueryClient13 } from "react-query";
|
|
2290
2308
|
import { useCallback as useCallback3, useEffect as useEffect5, useState as useState2 } from "react";
|
|
2291
2309
|
var useNotifications = () => {
|
|
2292
2310
|
var _a;
|
|
@@ -2312,7 +2330,7 @@ var useNotifications = () => {
|
|
|
2312
2330
|
var useDismissNotification = (notification) => {
|
|
2313
2331
|
const queryClient2 = useQueryClient13();
|
|
2314
2332
|
const link = requiredLink(notification, "dismiss");
|
|
2315
|
-
const { data, isLoading, error, mutate } =
|
|
2333
|
+
const { data, isLoading, error, mutate } = useMutation13(() => apiClient.delete(link), {
|
|
2316
2334
|
onSuccess: () => {
|
|
2317
2335
|
queryClient2.invalidateQueries("notifications");
|
|
2318
2336
|
}
|
|
@@ -2327,7 +2345,7 @@ var useDismissNotification = (notification) => {
|
|
|
2327
2345
|
var useClearNotifications = (notificationCollection) => {
|
|
2328
2346
|
const queryClient2 = useQueryClient13();
|
|
2329
2347
|
const link = requiredLink(notificationCollection, "clear");
|
|
2330
|
-
const { data, isLoading, error, mutate } =
|
|
2348
|
+
const { data, isLoading, error, mutate } = useMutation13(() => apiClient.delete(link), {
|
|
2331
2349
|
onSuccess: () => {
|
|
2332
2350
|
queryClient2.invalidateQueries("notifications");
|
|
2333
2351
|
}
|
|
@@ -2492,7 +2510,7 @@ var useAlerts = () => {
|
|
|
2492
2510
|
};
|
|
2493
2511
|
|
|
2494
2512
|
// src/configLink.ts
|
|
2495
|
-
import { useMutation as
|
|
2513
|
+
import { useMutation as useMutation14, useQuery as useQuery18, useQueryClient as useQueryClient14 } from "react-query";
|
|
2496
2514
|
import { useCallback as useCallback4 } from "react";
|
|
2497
2515
|
var useConfigLink = (link) => {
|
|
2498
2516
|
const queryClient2 = useQueryClient14();
|
|
@@ -2509,7 +2527,7 @@ var useConfigLink = (link) => {
|
|
|
2509
2527
|
error: mutationError,
|
|
2510
2528
|
mutateAsync,
|
|
2511
2529
|
data: updateResponse
|
|
2512
|
-
} =
|
|
2530
|
+
} = useMutation14(
|
|
2513
2531
|
(vars) => apiClient.put(vars.link, vars.configuration, vars.contentType),
|
|
2514
2532
|
{
|
|
2515
2533
|
onSuccess: async () => {
|
|
@@ -2542,7 +2560,7 @@ var useConfigLink = (link) => {
|
|
|
2542
2560
|
};
|
|
2543
2561
|
|
|
2544
2562
|
// src/apiKeys.ts
|
|
2545
|
-
import { useMutation as
|
|
2563
|
+
import { useMutation as useMutation15, useQuery as useQuery19, useQueryClient as useQueryClient15 } from "react-query";
|
|
2546
2564
|
var CONTENT_TYPE_API_KEY = "application/vnd.scmm-apiKey+json;v=2";
|
|
2547
2565
|
var useApiKeys = (user) => useQuery19(["user", user.name, "apiKeys"], () => apiClient.get(requiredLink(user, "apiKeys")).then((r) => r.json()));
|
|
2548
2566
|
var createApiKey = (link) => async (key) => {
|
|
@@ -2557,7 +2575,7 @@ var createApiKey = (link) => async (key) => {
|
|
|
2557
2575
|
};
|
|
2558
2576
|
var useCreateApiKey = (user, apiKeys) => {
|
|
2559
2577
|
const queryClient2 = useQueryClient15();
|
|
2560
|
-
const { mutate, data, isLoading, error, reset: reset2 } =
|
|
2578
|
+
const { mutate, data, isLoading, error, reset: reset2 } = useMutation15(
|
|
2561
2579
|
createApiKey(requiredLink(apiKeys, "create")),
|
|
2562
2580
|
{
|
|
2563
2581
|
onSuccess: () => queryClient2.invalidateQueries(["user", user.name, "apiKeys"])
|
|
@@ -2573,7 +2591,7 @@ var useCreateApiKey = (user, apiKeys) => {
|
|
|
2573
2591
|
};
|
|
2574
2592
|
var useDeleteApiKey = (user) => {
|
|
2575
2593
|
const queryClient2 = useQueryClient15();
|
|
2576
|
-
const { mutate, isLoading, error, data } =
|
|
2594
|
+
const { mutate, isLoading, error, data } = useMutation15(
|
|
2577
2595
|
(apiKey) => {
|
|
2578
2596
|
const deleteUrl = requiredLink(apiKey, "delete");
|
|
2579
2597
|
return apiClient.delete(deleteUrl);
|
|
@@ -2591,7 +2609,7 @@ var useDeleteApiKey = (user) => {
|
|
|
2591
2609
|
};
|
|
2592
2610
|
|
|
2593
2611
|
// src/publicKeys.ts
|
|
2594
|
-
import { useMutation as
|
|
2612
|
+
import { useMutation as useMutation16, useQuery as useQuery20, useQueryClient as useQueryClient16 } from "react-query";
|
|
2595
2613
|
var CONTENT_TYPE_PUBLIC_KEY = "application/vnd.scmm-publicKey+json;v=2";
|
|
2596
2614
|
var usePublicKeys = (user) => useQuery20(
|
|
2597
2615
|
["user", user.name, "publicKeys"],
|
|
@@ -2608,7 +2626,7 @@ var createPublicKey = (link) => async (key) => {
|
|
|
2608
2626
|
};
|
|
2609
2627
|
var useCreatePublicKey = (user, publicKeys) => {
|
|
2610
2628
|
const queryClient2 = useQueryClient16();
|
|
2611
|
-
const { mutate, data, isLoading, error, reset: reset2 } =
|
|
2629
|
+
const { mutate, data, isLoading, error, reset: reset2 } = useMutation16(
|
|
2612
2630
|
createPublicKey(requiredLink(publicKeys, "create")),
|
|
2613
2631
|
{
|
|
2614
2632
|
onSuccess: () => queryClient2.invalidateQueries(["user", user.name, "publicKeys"])
|
|
@@ -2624,7 +2642,7 @@ var useCreatePublicKey = (user, publicKeys) => {
|
|
|
2624
2642
|
};
|
|
2625
2643
|
var useDeletePublicKey = (user) => {
|
|
2626
2644
|
const queryClient2 = useQueryClient16();
|
|
2627
|
-
const { mutate, isLoading, error, data } =
|
|
2645
|
+
const { mutate, isLoading, error, data } = useMutation16(
|
|
2628
2646
|
(publicKey) => {
|
|
2629
2647
|
const deleteUrl = requiredLink(publicKey, "delete");
|
|
2630
2648
|
return apiClient.delete(deleteUrl);
|
|
@@ -3054,9 +3072,9 @@ var useLoginInfo = (disabled = false) => {
|
|
|
3054
3072
|
};
|
|
3055
3073
|
|
|
3056
3074
|
// src/useInvalidation.tsx
|
|
3057
|
-
import { useMutation as
|
|
3075
|
+
import { useMutation as useMutation17 } from "react-query";
|
|
3058
3076
|
var useInvalidation = (link) => {
|
|
3059
|
-
const { mutate, isLoading, error, isSuccess } =
|
|
3077
|
+
const { mutate, isLoading, error, isSuccess } = useMutation17(
|
|
3060
3078
|
(link2) => apiClient.post(link2, {})
|
|
3061
3079
|
);
|
|
3062
3080
|
return {
|
|
@@ -3076,7 +3094,7 @@ var useInvalidateSearchIndices = () => {
|
|
|
3076
3094
|
};
|
|
3077
3095
|
|
|
3078
3096
|
// src/usePluginCenterAuthInfo.ts
|
|
3079
|
-
import { useMutation as
|
|
3097
|
+
import { useMutation as useMutation18, useQuery as useQuery27, useQueryClient as useQueryClient18 } from "react-query";
|
|
3080
3098
|
import { useLocation } from "react-router-dom";
|
|
3081
3099
|
var appendQueryParam = (link, name, value) => {
|
|
3082
3100
|
let href = link.href;
|
|
@@ -3114,7 +3132,7 @@ var usePluginCenterAuthInfo = () => {
|
|
|
3114
3132
|
};
|
|
3115
3133
|
var usePluginCenterLogout = (authenticationInfo) => {
|
|
3116
3134
|
const queryClient2 = useQueryClient18();
|
|
3117
|
-
const { mutate, isLoading, error } =
|
|
3135
|
+
const { mutate, isLoading, error } = useMutation18(
|
|
3118
3136
|
() => {
|
|
3119
3137
|
if (!authenticationInfo._links.logout) {
|
|
3120
3138
|
throw new Error("authenticationInfo has no logout link");
|
|
@@ -3205,13 +3223,21 @@ function useLocalStorage(key, initialValue) {
|
|
|
3205
3223
|
return () => window.removeEventListener("storage", listener);
|
|
3206
3224
|
}, [key, initialValue]);
|
|
3207
3225
|
const setValue = (newValue) => {
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3226
|
+
setItem((oldValue) => {
|
|
3227
|
+
const computedNewValue = newValue instanceof Function ? newValue(oldValue) : newValue;
|
|
3228
|
+
setItem(computedNewValue);
|
|
3229
|
+
const json = JSON.stringify(computedNewValue);
|
|
3230
|
+
localStorage.setItem(key, json);
|
|
3231
|
+
window.dispatchEvent(
|
|
3232
|
+
new StorageEvent("storage", {
|
|
3233
|
+
key,
|
|
3234
|
+
oldValue: JSON.stringify(oldValue),
|
|
3235
|
+
newValue: json,
|
|
3236
|
+
storageArea: localStorage
|
|
3237
|
+
})
|
|
3238
|
+
);
|
|
3239
|
+
return computedNewValue;
|
|
3240
|
+
});
|
|
3215
3241
|
};
|
|
3216
3242
|
return [item, setValue];
|
|
3217
3243
|
}
|
|
@@ -3480,6 +3506,7 @@ export {
|
|
|
3480
3506
|
useRepositoryVerbs,
|
|
3481
3507
|
useRequiredIndexLink,
|
|
3482
3508
|
useRequiredMe,
|
|
3509
|
+
useRevert,
|
|
3483
3510
|
useRunHealthCheck,
|
|
3484
3511
|
useSearch,
|
|
3485
3512
|
useSearchCounts,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scm-manager/ui-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "React hook api for the SCM-Manager backend",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"module": "build/index.mjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-i18next": "11"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@scm-manager/ui-types": "3.
|
|
29
|
+
"@scm-manager/ui-types": "3.8.0",
|
|
30
30
|
"tsup": "^5.12.6",
|
|
31
31
|
"@types/react-test-renderer": "^17.0.1",
|
|
32
32
|
"@scm-manager/babel-preset": "^2.13.1",
|