@scm-manager/ui-api 2.36.1 → 2.36.2-20220522-120507

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/build/index.d.ts +735 -0
  2. package/build/index.js +3200 -0
  3. package/build/index.mjs +3031 -0
  4. package/package.json +15 -10
  5. package/LICENSE.txt +0 -21
  6. package/src/ApiProvider.test.tsx +0 -60
  7. package/src/ApiProvider.tsx +0 -80
  8. package/src/LegacyContext.test.tsx +0 -52
  9. package/src/LegacyContext.tsx +0 -75
  10. package/src/admin.test.ts +0 -55
  11. package/src/admin.ts +0 -42
  12. package/src/alerts.ts +0 -107
  13. package/src/annotations.ts +0 -45
  14. package/src/apiKeys.ts +0 -82
  15. package/src/apiclient.test.ts +0 -126
  16. package/src/apiclient.ts +0 -336
  17. package/src/base.test.ts +0 -238
  18. package/src/base.ts +0 -120
  19. package/src/branches.test.ts +0 -234
  20. package/src/branches.ts +0 -201
  21. package/src/changesets.test.ts +0 -178
  22. package/src/changesets.ts +0 -82
  23. package/src/compare.ts +0 -90
  24. package/src/config.test.ts +0 -118
  25. package/src/config.ts +0 -60
  26. package/src/configLink.test.ts +0 -169
  27. package/src/configLink.ts +0 -89
  28. package/src/contentType.ts +0 -58
  29. package/src/diff.test.ts +0 -234
  30. package/src/diff.ts +0 -93
  31. package/src/errors.test.ts +0 -59
  32. package/src/errors.ts +0 -133
  33. package/src/fileContent.ts +0 -33
  34. package/src/groupSuggestions.ts +0 -32
  35. package/src/groups.test.ts +0 -241
  36. package/src/groups.ts +0 -141
  37. package/src/help/search/modal.de.ts +0 -33
  38. package/src/help/search/modal.en.ts +0 -33
  39. package/src/help/search/syntax.de.ts +0 -148
  40. package/src/help/search/syntax.en.ts +0 -145
  41. package/src/history.ts +0 -62
  42. package/src/import.ts +0 -114
  43. package/src/index.ts +0 -72
  44. package/src/keys.ts +0 -48
  45. package/src/links.test.ts +0 -99
  46. package/src/links.ts +0 -54
  47. package/src/login.test.ts +0 -240
  48. package/src/login.ts +0 -128
  49. package/src/loginInfo.ts +0 -43
  50. package/src/namespaceSuggestions.ts +0 -32
  51. package/src/namespaces.test.ts +0 -95
  52. package/src/namespaces.ts +0 -43
  53. package/src/notifications.ts +0 -183
  54. package/src/permissions.test.ts +0 -345
  55. package/src/permissions.ts +0 -202
  56. package/src/plugins.test.ts +0 -336
  57. package/src/plugins.ts +0 -259
  58. package/src/publicKeys.ts +0 -83
  59. package/src/repositories.test.ts +0 -508
  60. package/src/repositories.ts +0 -375
  61. package/src/repository-roles.test.ts +0 -229
  62. package/src/repository-roles.ts +0 -142
  63. package/src/reset.ts +0 -36
  64. package/src/search.ts +0 -153
  65. package/src/sources.test.ts +0 -233
  66. package/src/sources.ts +0 -136
  67. package/src/suggestions.ts +0 -47
  68. package/src/tags.test.ts +0 -272
  69. package/src/tags.ts +0 -118
  70. package/src/tests/createInfiniteCachingClient.ts +0 -37
  71. package/src/tests/createWrapper.tsx +0 -37
  72. package/src/tests/indexLinks.ts +0 -43
  73. package/src/urls.test.ts +0 -104
  74. package/src/urls.ts +0 -118
  75. package/src/usePluginCenterAuthInfo.ts +0 -91
  76. package/src/userSuggestions.ts +0 -32
  77. package/src/users.test.ts +0 -310
  78. package/src/users.ts +0 -240
  79. package/src/utils.ts +0 -29
package/build/index.js ADDED
@@ -0,0 +1,3200 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
36
+ var __export = (target, all) => {
37
+ for (var name in all)
38
+ __defProp(target, name, { get: all[name], enumerable: true });
39
+ };
40
+ var __copyProps = (to, from, except, desc) => {
41
+ if (from && typeof from === "object" || typeof from === "function") {
42
+ for (let key of __getOwnPropNames(from))
43
+ if (!__hasOwnProp.call(to, key) && key !== except)
44
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
45
+ }
46
+ return to;
47
+ };
48
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
49
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
50
+
51
+ // src/index.ts
52
+ var src_exports = {};
53
+ __export(src_exports, {
54
+ ApiProvider: () => ApiProvider_default,
55
+ BackendError: () => BackendError,
56
+ BadGatewayError: () => BadGatewayError,
57
+ CONTENT_TYPE_PUBLIC_KEY: () => CONTENT_TYPE_PUBLIC_KEY,
58
+ ConflictError: () => ConflictError,
59
+ ForbiddenError: () => ForbiddenError,
60
+ LegacyContextProvider: () => LegacyContextProvider,
61
+ MissingLinkError: () => MissingLinkError,
62
+ NotFoundError: () => NotFoundError,
63
+ TOKEN_EXPIRED_ERROR_CODE: () => TOKEN_EXPIRED_ERROR_CODE,
64
+ TokenExpiredError: () => TokenExpiredError,
65
+ UnauthorizedError: () => UnauthorizedError,
66
+ apiClient: () => apiClient,
67
+ changesetQueryKey: () => changesetQueryKey,
68
+ clearCache: () => clearCache,
69
+ createBackendError: () => createBackendError,
70
+ createChangesetUrl: () => createChangesetUrl,
71
+ createDiffUrl: () => createDiffUrl,
72
+ createQueryString: () => createQueryString,
73
+ createUrl: () => createUrl,
74
+ createUrlWithIdentifiers: () => createUrlWithIdentifiers,
75
+ extractXsrfTokenFromCookie: () => extractXsrfTokenFromCookie,
76
+ fetchResourceFromLocationHeader: () => fetchResourceFromLocationHeader,
77
+ getResponseJson: () => getResponseJson,
78
+ isBackendError: () => isBackendError,
79
+ objectLink: () => objectLink,
80
+ requiredLink: () => requiredLink,
81
+ urls: () => urls_exports,
82
+ useAlerts: () => useAlerts,
83
+ useAnnotations: () => useAnnotations,
84
+ useApiKeys: () => useApiKeys,
85
+ useArchiveRepository: () => useArchiveRepository,
86
+ useAvailableGlobalPermissions: () => useAvailableGlobalPermissions,
87
+ useAvailablePermissions: () => useAvailablePermissions,
88
+ useAvailablePlugins: () => useAvailablePlugins,
89
+ useBranch: () => useBranch,
90
+ useBranchDetails: () => useBranchDetails,
91
+ useBranchDetailsCollection: () => useBranchDetailsCollection,
92
+ useBranches: () => useBranches,
93
+ useCancelPendingPlugins: () => useCancelPendingPlugins,
94
+ useChangeUserPassword: () => useChangeUserPassword,
95
+ useChangeset: () => useChangeset,
96
+ useChangesets: () => useChangesets,
97
+ useClearNotifications: () => useClearNotifications,
98
+ useConfig: () => useConfig,
99
+ useConfigLink: () => useConfigLink,
100
+ useContentType: () => useContentType,
101
+ useConvertToExternal: () => useConvertToExternal,
102
+ useConvertToInternal: () => useConvertToInternal,
103
+ useCreateApiKey: () => useCreateApiKey,
104
+ useCreateBranch: () => useCreateBranch,
105
+ useCreateGroup: () => useCreateGroup,
106
+ useCreatePermission: () => useCreatePermission,
107
+ useCreatePublicKey: () => useCreatePublicKey,
108
+ useCreateRepository: () => useCreateRepository,
109
+ useCreateRepositoryRole: () => useCreateRepositoryRole,
110
+ useCreateTag: () => useCreateTag,
111
+ useCreateUser: () => useCreateUser,
112
+ useDefaultBranch: () => useDefaultBranch,
113
+ useDeleteApiKey: () => useDeleteApiKey,
114
+ useDeleteBranch: () => useDeleteBranch,
115
+ useDeleteGroup: () => useDeleteGroup,
116
+ useDeletePermission: () => useDeletePermission,
117
+ useDeletePublicKey: () => useDeletePublicKey,
118
+ useDeleteRepository: () => useDeleteRepository,
119
+ useDeleteRepositoryRole: () => useDeleteRepositoryRole,
120
+ useDeleteTag: () => useDeleteTag,
121
+ useDeleteUser: () => useDeleteUser,
122
+ useDiff: () => useDiff,
123
+ useDismissNotification: () => useDismissNotification,
124
+ useExecutePendingPlugins: () => useExecutePendingPlugins,
125
+ useExportInfo: () => useExportInfo,
126
+ useExportRepository: () => useExportRepository,
127
+ useFileContent: () => useFileContent,
128
+ useGroup: () => useGroup,
129
+ useGroupPermissions: () => useGroupPermissions,
130
+ useGroupSuggestions: () => useGroupSuggestions,
131
+ useGroups: () => useGroups,
132
+ useHistory: () => useHistory,
133
+ useImportFullRepository: () => useImportFullRepository,
134
+ useImportLog: () => useImportLog,
135
+ useImportRepositoryFromBundle: () => useImportRepositoryFromBundle,
136
+ useImportRepositoryFromUrl: () => useImportRepositoryFromUrl,
137
+ useIncomingChangesets: () => useIncomingChangesets,
138
+ useIndex: () => useIndex,
139
+ useIndexJsonResource: () => useIndexJsonResource,
140
+ useIndexLink: () => useIndexLink,
141
+ useIndexLinks: () => useIndexLinks,
142
+ useInstallPlugin: () => useInstallPlugin,
143
+ useInstalledPlugins: () => useInstalledPlugins,
144
+ useJsonResource: () => useJsonResource,
145
+ useLegacyContext: () => useLegacyContext,
146
+ useLogin: () => useLogin,
147
+ useLoginInfo: () => useLoginInfo,
148
+ useLogout: () => useLogout,
149
+ useMe: () => useMe,
150
+ useNamespace: () => useNamespace,
151
+ useNamespaceStrategies: () => useNamespaceStrategies,
152
+ useNamespaceSuggestions: () => useNamespaceSuggestions,
153
+ useNamespaces: () => useNamespaces,
154
+ useNotificationSubscription: () => useNotificationSubscription,
155
+ useNotifications: () => useNotifications,
156
+ usePaths: () => usePaths,
157
+ usePendingPlugins: () => usePendingPlugins,
158
+ usePermissions: () => usePermissions,
159
+ usePluginCenterAuthInfo: () => usePluginCenterAuthInfo,
160
+ usePluginCenterLogout: () => usePluginCenterLogout,
161
+ usePublicKeys: () => usePublicKeys,
162
+ useRenameRepository: () => useRenameRepository,
163
+ useRepositories: () => useRepositories,
164
+ useRepository: () => useRepository,
165
+ useRepositoryRole: () => useRepositoryRole,
166
+ useRepositoryRoles: () => useRepositoryRoles,
167
+ useRepositoryTypes: () => useRepositoryTypes,
168
+ useRepositoryVerbs: () => useRepositoryVerbs,
169
+ useRequiredIndexLink: () => useRequiredIndexLink,
170
+ useRequiredMe: () => useRequiredMe,
171
+ useRunHealthCheck: () => useRunHealthCheck,
172
+ useSearch: () => useSearch,
173
+ useSearchCounts: () => useSearchCounts,
174
+ useSearchHelpContent: () => useSearchHelpContent,
175
+ useSearchSyntaxContent: () => useSearchSyntaxContent,
176
+ useSearchTypes: () => useSearchTypes,
177
+ useSearchableTypes: () => useSearchableTypes,
178
+ useSetGroupPermissions: () => useSetGroupPermissions,
179
+ useSetUserPassword: () => useSetUserPassword,
180
+ useSetUserPermissions: () => useSetUserPermissions,
181
+ useSources: () => useSources,
182
+ useSubject: () => useSubject,
183
+ useSuggestions: () => useSuggestions,
184
+ useTag: () => useTag,
185
+ useTags: () => useTags,
186
+ useUnarchiveRepository: () => useUnarchiveRepository,
187
+ useUninstallPlugin: () => useUninstallPlugin,
188
+ useUpdateConfig: () => useUpdateConfig,
189
+ useUpdateGroup: () => useUpdateGroup,
190
+ useUpdateInfo: () => useUpdateInfo,
191
+ useUpdatePermission: () => useUpdatePermission,
192
+ useUpdatePlugins: () => useUpdatePlugins,
193
+ useUpdateRepository: () => useUpdateRepository,
194
+ useUpdateRepositoryRole: () => useUpdateRepositoryRole,
195
+ useUpdateUser: () => useUpdateUser,
196
+ useUser: () => useUser,
197
+ useUserPermissions: () => useUserPermissions,
198
+ useUserSuggestions: () => useUserSuggestions,
199
+ useUsers: () => useUsers,
200
+ useVersion: () => useVersion,
201
+ waitForRestartAfter: () => waitForRestartAfter
202
+ });
203
+ module.exports = __toCommonJS(src_exports);
204
+
205
+ // src/urls.ts
206
+ var urls_exports = {};
207
+ __export(urls_exports, {
208
+ concat: () => concat,
209
+ contextPath: () => contextPath,
210
+ escapeUrlForRoute: () => escapeUrlForRoute,
211
+ getNamespaceAndPageFromMatch: () => getNamespaceAndPageFromMatch,
212
+ getPageFromMatch: () => getPageFromMatch,
213
+ getQueryStringFromLocation: () => getQueryStringFromLocation,
214
+ matchedUrl: () => matchedUrl,
215
+ matchedUrlFromMatch: () => matchedUrlFromMatch,
216
+ stripEndingSlash: () => stripEndingSlash,
217
+ unescapeUrlForRoute: () => unescapeUrlForRoute,
218
+ withContextPath: () => withContextPath,
219
+ withEndingSlash: () => withEndingSlash,
220
+ withStartingSlash: () => withStartingSlash
221
+ });
222
+ var import_query_string = __toESM(require("query-string"));
223
+ var contextPath = window.ctxPath || "";
224
+ function withContextPath(path) {
225
+ return contextPath + path;
226
+ }
227
+ function withEndingSlash(url) {
228
+ if (url.endsWith("/")) {
229
+ return url;
230
+ }
231
+ return url + "/";
232
+ }
233
+ function withStartingSlash(url) {
234
+ if (url.startsWith("/")) {
235
+ return url;
236
+ }
237
+ return "/" + url;
238
+ }
239
+ function concat(base, ...parts) {
240
+ let url = base;
241
+ for (const p of parts) {
242
+ url = withEndingSlash(url) + p;
243
+ }
244
+ return url;
245
+ }
246
+ function getNamespaceAndPageFromMatch(match) {
247
+ const namespaceFromMatch = match.params.namespace;
248
+ const pageFromMatch = match.params.page;
249
+ if (!namespaceFromMatch && !pageFromMatch) {
250
+ return { namespace: void 0, page: 1 };
251
+ }
252
+ if (!pageFromMatch) {
253
+ if (namespaceFromMatch.match(/^\d{1,3}$/)) {
254
+ return { namespace: void 0, page: parsePageNumber(namespaceFromMatch) };
255
+ } else {
256
+ return { namespace: namespaceFromMatch, page: 1 };
257
+ }
258
+ }
259
+ return { namespace: namespaceFromMatch, page: parsePageNumber(pageFromMatch) };
260
+ }
261
+ function getPageFromMatch(match) {
262
+ return parsePageNumber(match.params.page);
263
+ }
264
+ function parsePageNumber(pageAsString) {
265
+ const page = parseInt(pageAsString, 10);
266
+ if (isNaN(page) || !page) {
267
+ return 1;
268
+ }
269
+ return page;
270
+ }
271
+ function getQueryStringFromLocation(location) {
272
+ if (location.search) {
273
+ const query = import_query_string.default.parse(location.search).q;
274
+ if (query && !Array.isArray(query)) {
275
+ return query;
276
+ }
277
+ }
278
+ }
279
+ function stripEndingSlash(url) {
280
+ if (url.endsWith("/")) {
281
+ return url.substring(0, url.length - 1);
282
+ }
283
+ return url;
284
+ }
285
+ function matchedUrlFromMatch(match) {
286
+ return stripEndingSlash(match.url);
287
+ }
288
+ function matchedUrl(props) {
289
+ const match = props.match;
290
+ return matchedUrlFromMatch(match);
291
+ }
292
+ function escapeUrlForRoute(url) {
293
+ return url.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
294
+ }
295
+ function unescapeUrlForRoute(url) {
296
+ return url.replace(/\\/g, "");
297
+ }
298
+
299
+ // src/errors.ts
300
+ var BackendError = class extends Error {
301
+ constructor(content, name, statusCode) {
302
+ super(content.message);
303
+ this.context = [];
304
+ this.name = name;
305
+ this.transactionId = content.transactionId;
306
+ this.errorCode = content.errorCode;
307
+ this.url = content.url;
308
+ this.context = content.context;
309
+ this.statusCode = statusCode;
310
+ this.violations = content.violations;
311
+ this.additionalMessages = content.additionalMessages;
312
+ }
313
+ };
314
+ var UnauthorizedError = class extends Error {
315
+ constructor(message, statusCode) {
316
+ super(message);
317
+ this.statusCode = statusCode;
318
+ }
319
+ };
320
+ var BadGatewayError = class extends Error {
321
+ constructor(message, statusCode) {
322
+ super(message);
323
+ this.statusCode = statusCode;
324
+ }
325
+ };
326
+ var TokenExpiredError = class extends UnauthorizedError {
327
+ };
328
+ var ForbiddenError = class extends Error {
329
+ constructor(message, statusCode) {
330
+ super(message);
331
+ this.statusCode = statusCode;
332
+ }
333
+ };
334
+ var NotFoundError = class extends BackendError {
335
+ constructor(content, statusCode) {
336
+ super(content, "NotFoundError", statusCode);
337
+ }
338
+ };
339
+ var ConflictError = class extends BackendError {
340
+ constructor(content, statusCode) {
341
+ super(content, "ConflictError", statusCode);
342
+ }
343
+ };
344
+ var MissingLinkError = class extends Error {
345
+ constructor() {
346
+ super(...arguments);
347
+ this.name = "MissingLinkError";
348
+ }
349
+ };
350
+ function createBackendError(content, statusCode) {
351
+ switch (statusCode) {
352
+ case 404:
353
+ return new NotFoundError(content, statusCode);
354
+ case 409:
355
+ return new ConflictError(content, statusCode);
356
+ default:
357
+ return new BackendError(content, "BackendError", statusCode);
358
+ }
359
+ }
360
+ function isBackendError(response) {
361
+ return response.headers.get("Content-Type") === "application/vnd.scmm-error+json;v=2";
362
+ }
363
+ var TOKEN_EXPIRED_ERROR_CODE = "DDS8D8unr1";
364
+
365
+ // src/apiclient.ts
366
+ var sessionId = (Date.now().toString(36) + Math.random().toString(36).substr(2, 5)).toUpperCase();
367
+ var extractXsrfTokenFromJwt = (jwt) => {
368
+ const parts = jwt.split(".");
369
+ if (parts.length === 3) {
370
+ return JSON.parse(atob(parts[1])).xsrf;
371
+ }
372
+ };
373
+ var extractXsrfTokenFromCookie = (cookieString) => {
374
+ if (cookieString) {
375
+ const cookies = cookieString.split(";");
376
+ for (const c of cookies) {
377
+ const parts = c.trim().split("=");
378
+ if (parts[0] === "X-Bearer-Token" || parts[0] === "X-SCM-Init-Token") {
379
+ return extractXsrfTokenFromJwt(parts[1]);
380
+ }
381
+ }
382
+ }
383
+ };
384
+ var extractXsrfToken = () => {
385
+ return extractXsrfTokenFromCookie(document.cookie);
386
+ };
387
+ var createRequestHeaders = () => {
388
+ const headers = {
389
+ Cache: "no-cache",
390
+ "X-Requested-With": "XMLHttpRequest",
391
+ "X-SCM-Client": "WUI",
392
+ "X-SCM-Session-ID": sessionId
393
+ };
394
+ const xsrf = extractXsrfToken();
395
+ if (xsrf) {
396
+ headers["X-XSRF-Token"] = xsrf;
397
+ }
398
+ return headers;
399
+ };
400
+ var applyFetchOptions = (o) => {
401
+ if (o.headers) {
402
+ o.headers = __spreadValues({}, createRequestHeaders());
403
+ } else {
404
+ o.headers = createRequestHeaders();
405
+ }
406
+ o.credentials = "same-origin";
407
+ return o;
408
+ };
409
+ function handleFailure(response) {
410
+ if (!response.ok) {
411
+ if (response.status === 401) {
412
+ if (isBackendError(response)) {
413
+ return response.json().then((content) => {
414
+ if (content.errorCode === TOKEN_EXPIRED_ERROR_CODE) {
415
+ throw new TokenExpiredError("Token expired", 401);
416
+ } else {
417
+ throw new UnauthorizedError("Unauthorized", 401);
418
+ }
419
+ });
420
+ }
421
+ throw new UnauthorizedError("Unauthorized", 401);
422
+ } else if (response.status === 403) {
423
+ throw new ForbiddenError("Forbidden", 403);
424
+ } else if (response.status === 502) {
425
+ throw new BadGatewayError("Bad Gateway", 502);
426
+ } else if (isBackendError(response)) {
427
+ return response.json().then((content) => {
428
+ throw createBackendError(content, response.status);
429
+ });
430
+ } else {
431
+ throw new Error("server returned status code " + response.status);
432
+ }
433
+ }
434
+ return response;
435
+ }
436
+ function createUrl(url) {
437
+ if (url.includes("://")) {
438
+ return url;
439
+ }
440
+ let urlWithStartingSlash = url;
441
+ if (url.indexOf("/") !== 0) {
442
+ urlWithStartingSlash = "/" + urlWithStartingSlash;
443
+ }
444
+ return `${contextPath}/api/v2${urlWithStartingSlash}`;
445
+ }
446
+ function createUrlWithIdentifiers(url) {
447
+ return createUrl(url) + "?X-SCM-Client=WUI&X-SCM-Session-ID=" + sessionId;
448
+ }
449
+ var ApiClient = class {
450
+ constructor() {
451
+ this.errorListeners = [];
452
+ this.requestListeners = [];
453
+ this.get = (url) => {
454
+ return this.request(url, applyFetchOptions({})).then(handleFailure).catch(this.notifyAndRethrow);
455
+ };
456
+ this.post = (url, payload, contentType = "application/json", additionalHeaders = {}) => {
457
+ return this.httpRequestWithJSONBody("POST", url, contentType, additionalHeaders, payload);
458
+ };
459
+ this.postText = (url, payload, additionalHeaders = {}) => {
460
+ return this.httpRequestWithTextBody("POST", url, additionalHeaders, payload);
461
+ };
462
+ this.putText = (url, payload, additionalHeaders = {}) => {
463
+ return this.httpRequestWithTextBody("PUT", url, additionalHeaders, payload);
464
+ };
465
+ this.postBinary = (url, fileAppender, additionalHeaders = {}) => {
466
+ const formData = new FormData();
467
+ fileAppender(formData);
468
+ const options = {
469
+ method: "POST",
470
+ body: formData,
471
+ headers: additionalHeaders
472
+ };
473
+ return this.httpRequestWithBinaryBody(options, url);
474
+ };
475
+ this.head = (url) => {
476
+ let options = {
477
+ method: "HEAD"
478
+ };
479
+ options = applyFetchOptions(options);
480
+ return this.request(url, options).then(handleFailure).catch(this.notifyAndRethrow);
481
+ };
482
+ this.delete = (url) => {
483
+ let options = {
484
+ method: "DELETE"
485
+ };
486
+ options = applyFetchOptions(options);
487
+ return this.request(url, options).then(handleFailure).catch(this.notifyAndRethrow);
488
+ };
489
+ this.httpRequestWithJSONBody = (method, url, contentType, additionalHeaders, payload) => {
490
+ const options = {
491
+ method,
492
+ headers: additionalHeaders
493
+ };
494
+ if (payload) {
495
+ options.body = JSON.stringify(payload);
496
+ }
497
+ return this.httpRequestWithBinaryBody(options, url, contentType);
498
+ };
499
+ this.httpRequestWithTextBody = (method, url, additionalHeaders = {}, payload) => {
500
+ const options = {
501
+ method,
502
+ headers: additionalHeaders
503
+ };
504
+ options.body = payload;
505
+ return this.httpRequestWithBinaryBody(options, url, "text/plain");
506
+ };
507
+ this.httpRequestWithBinaryBody = (options, url, contentType) => {
508
+ options = applyFetchOptions(options);
509
+ if (contentType) {
510
+ if (!options.headers) {
511
+ options.headers = {};
512
+ }
513
+ options.headers["Content-Type"] = contentType;
514
+ }
515
+ return this.request(url, options).then(handleFailure).catch(this.notifyAndRethrow);
516
+ };
517
+ this.onRequest = (requestListener) => {
518
+ this.requestListeners.push(requestListener);
519
+ };
520
+ this.onError = (errorListener) => {
521
+ this.errorListeners.push(errorListener);
522
+ };
523
+ this.request = (url, options) => {
524
+ this.notifyRequestListeners(url, options);
525
+ return fetch(createUrl(url), options);
526
+ };
527
+ this.notifyRequestListeners = (url, options) => {
528
+ this.requestListeners.forEach((requestListener) => requestListener(url, options));
529
+ };
530
+ this.notifyAndRethrow = (error) => {
531
+ this.errorListeners.forEach((errorListener) => errorListener(error));
532
+ throw error;
533
+ };
534
+ }
535
+ put(url, payload, contentType = "application/json", additionalHeaders = {}) {
536
+ return this.httpRequestWithJSONBody("PUT", url, contentType, additionalHeaders, payload);
537
+ }
538
+ subscribe(url, argument) {
539
+ const es = new EventSource(createUrlWithIdentifiers(url), {
540
+ withCredentials: true
541
+ });
542
+ let listeners;
543
+ if ("onMessage" in argument) {
544
+ listeners = argument.onMessage;
545
+ if (argument.onError) {
546
+ es.onerror = argument.onError;
547
+ }
548
+ if (argument.onOpen) {
549
+ es.onopen = argument.onOpen;
550
+ }
551
+ } else {
552
+ listeners = argument;
553
+ }
554
+ for (const type in listeners) {
555
+ es.addEventListener(type, listeners[type]);
556
+ }
557
+ return () => es.close();
558
+ }
559
+ };
560
+ var apiClient = new ApiClient();
561
+
562
+ // src/base.ts
563
+ var import_react_query2 = require("react-query");
564
+
565
+ // src/LegacyContext.tsx
566
+ var import_react = __toESM(require("react"));
567
+ var import_react_query = require("react-query");
568
+ var Context = (0, import_react.createContext)(void 0);
569
+ var useLegacyContext = () => {
570
+ const context = (0, import_react.useContext)(Context);
571
+ if (!context) {
572
+ throw new Error("useLegacyContext can't be used outside of ApiProvider");
573
+ }
574
+ return context;
575
+ };
576
+ var createInitialContext = (queryClient2, base) => {
577
+ const ctx = __spreadProps(__spreadValues({}, base), {
578
+ initialize: () => {
579
+ if (ctx.onIndexFetched) {
580
+ const index = queryClient2.getQueryData("index");
581
+ if (index) {
582
+ ctx.onIndexFetched(index);
583
+ }
584
+ }
585
+ if (ctx.onMeFetched) {
586
+ const me = queryClient2.getQueryData("me");
587
+ if (me) {
588
+ ctx.onMeFetched(me);
589
+ }
590
+ }
591
+ }
592
+ });
593
+ return ctx;
594
+ };
595
+ var LegacyContextProvider = ({ onIndexFetched, onMeFetched, children }) => {
596
+ const queryClient2 = (0, import_react_query.useQueryClient)();
597
+ const ctx = createInitialContext(queryClient2, { onIndexFetched, onMeFetched });
598
+ return /* @__PURE__ */ import_react.default.createElement(Context.Provider, {
599
+ value: ctx
600
+ }, children);
601
+ };
602
+
603
+ // src/links.ts
604
+ var requiredLink = (object, name, subName) => {
605
+ const link = object._links[name];
606
+ if (!link) {
607
+ throw new MissingLinkError(`could not find link with name ${name}`);
608
+ }
609
+ if (Array.isArray(link)) {
610
+ if (subName) {
611
+ const subLink = link.find((l) => l.name === subName);
612
+ if (subLink) {
613
+ return subLink.href;
614
+ }
615
+ throw new Error(`could not return href, sub-link ${subName} in ${name} does not exist`);
616
+ }
617
+ throw new Error(`could not return href, link ${name} is a multi link`);
618
+ }
619
+ return link.href;
620
+ };
621
+ var objectLink = (object, name) => {
622
+ const link = object._links[name];
623
+ if (!link) {
624
+ return null;
625
+ }
626
+ if (Array.isArray(link)) {
627
+ throw new Error(`could not return href, link ${name} is a multi link`);
628
+ }
629
+ return link.href;
630
+ };
631
+
632
+ // src/base.ts
633
+ var useIndex = () => {
634
+ const legacy = useLegacyContext();
635
+ return (0, import_react_query2.useQuery)("index", () => apiClient.get("/").then((response) => response.json()), {
636
+ onSuccess: (index) => {
637
+ if (legacy.onIndexFetched) {
638
+ legacy.onIndexFetched(index);
639
+ }
640
+ },
641
+ refetchOnMount: false,
642
+ retry: (failureCount, error) => {
643
+ return error instanceof UnauthorizedError && failureCount === 0;
644
+ }
645
+ });
646
+ };
647
+ var useIndexLink = (name) => {
648
+ const { data } = useIndex();
649
+ if (!data) {
650
+ throw new Error("could not find index data");
651
+ }
652
+ const linkObject = data._links[name];
653
+ if (linkObject && linkObject.href) {
654
+ return linkObject.href;
655
+ }
656
+ };
657
+ var useIndexLinks = () => {
658
+ const { data } = useIndex();
659
+ if (!data) {
660
+ throw new Error("could not find index data");
661
+ }
662
+ return data._links;
663
+ };
664
+ var useRequiredIndexLink = (name) => {
665
+ const link = useIndexLink(name);
666
+ if (!link) {
667
+ throw new MissingLinkError(`Could not find link ${name} in index resource`);
668
+ }
669
+ return link;
670
+ };
671
+ var useVersion = () => {
672
+ const { data } = useIndex();
673
+ if (!data) {
674
+ throw new Error("could not find index data");
675
+ }
676
+ const { version } = data;
677
+ if (!version) {
678
+ throw new Error("could not find version in index data");
679
+ }
680
+ return version;
681
+ };
682
+ var useIndexJsonResource = (name) => {
683
+ const link = useIndexLink(name);
684
+ return (0, import_react_query2.useQuery)(name, () => apiClient.get(link).then((response) => response.json()), {
685
+ enabled: !!link
686
+ });
687
+ };
688
+ var useJsonResource = (entity, name, key) => (0, import_react_query2.useQuery)(key, () => apiClient.get(requiredLink(entity, name)).then((response) => response.json()));
689
+ function fetchResourceFromLocationHeader(response) {
690
+ const location = response.headers.get("Location");
691
+ if (!location) {
692
+ throw new Error("Server does not return required Location header");
693
+ }
694
+ return apiClient.get(location);
695
+ }
696
+ var getResponseJson = (response) => response.json();
697
+
698
+ // src/login.ts
699
+ var import_react_query4 = require("react-query");
700
+
701
+ // src/reset.ts
702
+ var import_react_query3 = require("react-query");
703
+ var reset = (queryClient2) => {
704
+ queryClient2.removeQueries({
705
+ predicate: ({ queryKey }) => queryKey !== "index"
706
+ });
707
+ return queryClient2.invalidateQueries("index");
708
+ };
709
+ var useReset = () => {
710
+ const queryClient2 = (0, import_react_query3.useQueryClient)();
711
+ return () => reset(queryClient2);
712
+ };
713
+
714
+ // src/login.ts
715
+ var import_react2 = require("react");
716
+ var useMe = () => {
717
+ const legacy = useLegacyContext();
718
+ const link = useIndexLink("me");
719
+ return (0, import_react_query4.useQuery)("me", () => apiClient.get(link).then((response) => response.json()), {
720
+ enabled: !!link,
721
+ onSuccess: (me) => {
722
+ if (legacy.onMeFetched) {
723
+ legacy.onMeFetched(me);
724
+ }
725
+ }
726
+ });
727
+ };
728
+ var useRequiredMe = () => {
729
+ const { data } = useMe();
730
+ if (!data) {
731
+ throw new Error("Could not find 'me' in cache");
732
+ }
733
+ return data;
734
+ };
735
+ var useSubject = () => {
736
+ const link = useIndexLink("login");
737
+ const { isLoading, error, data: me } = useMe();
738
+ const isAnonymous = (me == null ? void 0 : me.name) === "_anonymous";
739
+ const isAuthenticated = !isAnonymous && !!me && !link;
740
+ return {
741
+ isAuthenticated,
742
+ isAnonymous,
743
+ isLoading,
744
+ error,
745
+ me
746
+ };
747
+ };
748
+ var useLogin = () => {
749
+ const link = useIndexLink("login");
750
+ const reset2 = useReset();
751
+ const { mutate, isLoading, error } = (0, import_react_query4.useMutation)((credentials) => apiClient.post(link, credentials), {
752
+ onSuccess: reset2
753
+ });
754
+ const login = (username, password) => {
755
+ mutate({ cookie: true, grant_type: "password", username, password });
756
+ };
757
+ return {
758
+ login: link ? login : void 0,
759
+ isLoading,
760
+ error
761
+ };
762
+ };
763
+ var useLogout = () => {
764
+ const link = useIndexLink("logout");
765
+ const reset2 = useReset();
766
+ const { mutate, isLoading, error, data } = (0, import_react_query4.useMutation)(() => apiClient.delete(link).then((r) => r.status === 200 ? r.json() : {}), {
767
+ onSuccess: (response) => {
768
+ if (response == null ? void 0 : response.logoutRedirect) {
769
+ window.location.assign(response.logoutRedirect);
770
+ }
771
+ return reset2();
772
+ }
773
+ });
774
+ const logout = (0, import_react2.useCallback)(() => {
775
+ mutate({});
776
+ }, [mutate]);
777
+ return {
778
+ logout: link && !data ? logout : void 0,
779
+ isLoading,
780
+ error
781
+ };
782
+ };
783
+
784
+ // src/groups.ts
785
+ var import_react_query5 = require("react-query");
786
+
787
+ // src/utils.ts
788
+ var createQueryString = (params) => {
789
+ return Object.keys(params).map((k) => encodeURIComponent(k) + "=" + encodeURIComponent(params[k])).join("&");
790
+ };
791
+
792
+ // src/groups.ts
793
+ var useGroups = (request) => {
794
+ const queryClient2 = (0, import_react_query5.useQueryClient)();
795
+ const indexLink = useRequiredIndexLink("groups");
796
+ const queryParams = {};
797
+ if (request == null ? void 0 : request.search) {
798
+ queryParams.q = request.search;
799
+ }
800
+ if (request == null ? void 0 : request.page) {
801
+ queryParams.page = request.page.toString();
802
+ }
803
+ return (0, import_react_query5.useQuery)(["groups", (request == null ? void 0 : request.search) || "", (request == null ? void 0 : request.page) || 0], () => apiClient.get(`${indexLink}?${createQueryString(queryParams)}`).then((response) => response.json()), {
804
+ onSuccess: (groups) => {
805
+ groups._embedded.groups.forEach((group) => queryClient2.setQueryData(["group", group.name], group));
806
+ }
807
+ });
808
+ };
809
+ var useGroup = (name) => {
810
+ const indexLink = useRequiredIndexLink("groups");
811
+ return (0, import_react_query5.useQuery)(["group", name], () => apiClient.get(concat(indexLink, name)).then((response) => response.json()));
812
+ };
813
+ var createGroup = (link) => {
814
+ return (group) => {
815
+ return apiClient.post(link, group, "application/vnd.scmm-group+json;v=2").then((response) => {
816
+ const location = response.headers.get("Location");
817
+ if (!location) {
818
+ throw new Error("Server does not return required Location header");
819
+ }
820
+ return apiClient.get(location);
821
+ }).then((response) => response.json());
822
+ };
823
+ };
824
+ var useCreateGroup = () => {
825
+ const queryClient2 = (0, import_react_query5.useQueryClient)();
826
+ const link = useRequiredIndexLink("groups");
827
+ const { mutate, data, isLoading, error } = (0, import_react_query5.useMutation)(createGroup(link), {
828
+ onSuccess: (group) => {
829
+ queryClient2.setQueryData(["group", group.name], group);
830
+ return queryClient2.invalidateQueries(["groups"]);
831
+ }
832
+ });
833
+ return {
834
+ create: (group) => mutate(group),
835
+ isLoading,
836
+ error,
837
+ group: data
838
+ };
839
+ };
840
+ var useUpdateGroup = () => {
841
+ const queryClient2 = (0, import_react_query5.useQueryClient)();
842
+ const { mutate, isLoading, error, data } = (0, import_react_query5.useMutation)((group) => {
843
+ const updateUrl = group._links.update.href;
844
+ return apiClient.put(updateUrl, group, "application/vnd.scmm-group+json;v=2");
845
+ }, {
846
+ onSuccess: async (_, group) => {
847
+ await queryClient2.invalidateQueries(["group", group.name]);
848
+ await queryClient2.invalidateQueries(["groups"]);
849
+ }
850
+ });
851
+ return {
852
+ update: (group) => mutate(group),
853
+ isLoading,
854
+ error,
855
+ isUpdated: !!data
856
+ };
857
+ };
858
+ var useDeleteGroup = () => {
859
+ const queryClient2 = (0, import_react_query5.useQueryClient)();
860
+ const { mutate, isLoading, error, data } = (0, import_react_query5.useMutation)((group) => {
861
+ const deleteUrl = group._links.delete.href;
862
+ return apiClient.delete(deleteUrl);
863
+ }, {
864
+ onSuccess: async (_, name) => {
865
+ await queryClient2.removeQueries(["group", name]);
866
+ await queryClient2.invalidateQueries(["groups"]);
867
+ }
868
+ });
869
+ return {
870
+ remove: (group) => mutate(group),
871
+ isLoading,
872
+ error,
873
+ isDeleted: !!data
874
+ };
875
+ };
876
+
877
+ // src/users.ts
878
+ var import_react_query6 = require("react-query");
879
+ var useUsers = (request) => {
880
+ const queryClient2 = (0, import_react_query6.useQueryClient)();
881
+ const indexLink = useRequiredIndexLink("users");
882
+ const queryParams = {};
883
+ if (request == null ? void 0 : request.search) {
884
+ queryParams.q = request.search;
885
+ }
886
+ if (request == null ? void 0 : request.page) {
887
+ queryParams.page = request.page.toString();
888
+ }
889
+ return (0, import_react_query6.useQuery)(["users", (request == null ? void 0 : request.search) || "", (request == null ? void 0 : request.page) || 0], () => apiClient.get(`${indexLink}?${createQueryString(queryParams)}`).then((response) => response.json()), {
890
+ onSuccess: (users) => {
891
+ var _a;
892
+ (_a = users._embedded) == null ? void 0 : _a.users.forEach((user) => queryClient2.setQueryData(["user", user.name], user));
893
+ }
894
+ });
895
+ };
896
+ var useUser = (name) => {
897
+ const indexLink = useRequiredIndexLink("users");
898
+ return (0, import_react_query6.useQuery)(["user", name], () => apiClient.get(concat(indexLink, name)).then((response) => response.json()));
899
+ };
900
+ var createUser = (link) => {
901
+ return (user) => {
902
+ return apiClient.post(link, user, "application/vnd.scmm-user+json;v=2").then((response) => {
903
+ const location = response.headers.get("Location");
904
+ if (!location) {
905
+ throw new Error("Server does not return required Location header");
906
+ }
907
+ return apiClient.get(location);
908
+ }).then((response) => response.json());
909
+ };
910
+ };
911
+ var useCreateUser = () => {
912
+ const queryClient2 = (0, import_react_query6.useQueryClient)();
913
+ const link = useRequiredIndexLink("users");
914
+ const { mutate, data, isLoading, error } = (0, import_react_query6.useMutation)(createUser(link), {
915
+ onSuccess: (user) => {
916
+ queryClient2.setQueryData(["user", user.name], user);
917
+ return queryClient2.invalidateQueries(["users"]);
918
+ }
919
+ });
920
+ return {
921
+ create: (user) => mutate(user),
922
+ isLoading,
923
+ error,
924
+ user: data
925
+ };
926
+ };
927
+ var useUpdateUser = () => {
928
+ const queryClient2 = (0, import_react_query6.useQueryClient)();
929
+ const { mutate, isLoading, error, data } = (0, import_react_query6.useMutation)((user) => {
930
+ const updateUrl = user._links.update.href;
931
+ return apiClient.put(updateUrl, user, "application/vnd.scmm-user+json;v=2");
932
+ }, {
933
+ onSuccess: async (_, user) => {
934
+ await queryClient2.invalidateQueries(["user", user.name]);
935
+ await queryClient2.invalidateQueries(["users"]);
936
+ }
937
+ });
938
+ return {
939
+ update: (user) => mutate(user),
940
+ isLoading,
941
+ error,
942
+ isUpdated: !!data
943
+ };
944
+ };
945
+ var useDeleteUser = () => {
946
+ const queryClient2 = (0, import_react_query6.useQueryClient)();
947
+ const { mutate, isLoading, error, data } = (0, import_react_query6.useMutation)((user) => {
948
+ const deleteUrl = user._links.delete.href;
949
+ return apiClient.delete(deleteUrl);
950
+ }, {
951
+ onSuccess: async (_, name) => {
952
+ await queryClient2.removeQueries(["user", name]);
953
+ await queryClient2.invalidateQueries(["users"]);
954
+ }
955
+ });
956
+ return {
957
+ remove: (user) => mutate(user),
958
+ isLoading,
959
+ error,
960
+ isDeleted: !!data
961
+ };
962
+ };
963
+ var convertToInternal = (url, newPassword) => {
964
+ return apiClient.put(url, {
965
+ newPassword
966
+ }, "application/vnd.scmm-user+json;v=2");
967
+ };
968
+ var convertToExternal = (url) => {
969
+ return apiClient.put(url, {}, "application/vnd.scmm-user+json;v=2");
970
+ };
971
+ var useConvertToInternal = () => {
972
+ const queryClient2 = (0, import_react_query6.useQueryClient)();
973
+ const { mutate, isLoading, error, data } = (0, import_react_query6.useMutation)(({ user, password }) => convertToInternal(user._links.convertToInternal.href, password), {
974
+ onSuccess: async (_, { user }) => {
975
+ await queryClient2.invalidateQueries(["user", user.name]);
976
+ await queryClient2.invalidateQueries(["users"]);
977
+ }
978
+ });
979
+ return {
980
+ convertToInternal: (user, password) => mutate({ user, password }),
981
+ isLoading,
982
+ error,
983
+ isConverted: !!data
984
+ };
985
+ };
986
+ var useConvertToExternal = () => {
987
+ const queryClient2 = (0, import_react_query6.useQueryClient)();
988
+ const { mutate, isLoading, error, data } = (0, import_react_query6.useMutation)((user) => convertToExternal(user._links.convertToExternal.href), {
989
+ onSuccess: async (_, user) => {
990
+ await queryClient2.invalidateQueries(["user", user.name]);
991
+ await queryClient2.invalidateQueries(["users"]);
992
+ }
993
+ });
994
+ return {
995
+ convertToExternal: (user) => mutate(user),
996
+ isLoading,
997
+ error,
998
+ isConverted: !!data
999
+ };
1000
+ };
1001
+ var CONTENT_TYPE_PASSWORD_OVERWRITE = "application/vnd.scmm-passwordOverwrite+json;v=2";
1002
+ var useSetUserPassword = (user) => {
1003
+ const { data, isLoading, error, mutate, reset: reset2 } = (0, import_react_query6.useMutation)((password) => apiClient.put(requiredLink(user, "password"), {
1004
+ newPassword: password
1005
+ }, CONTENT_TYPE_PASSWORD_OVERWRITE));
1006
+ return {
1007
+ setPassword: (newPassword) => mutate(newPassword),
1008
+ passwordOverwritten: !!data,
1009
+ isLoading,
1010
+ error,
1011
+ reset: reset2
1012
+ };
1013
+ };
1014
+ var CONTENT_TYPE_PASSWORD_CHANGE = "application/vnd.scmm-passwordChange+json;v=2";
1015
+ var useChangeUserPassword = (user) => {
1016
+ const { data, isLoading, error, mutate, reset: reset2 } = (0, import_react_query6.useMutation)((request) => apiClient.put(requiredLink(user, "password"), request, CONTENT_TYPE_PASSWORD_CHANGE));
1017
+ return {
1018
+ changePassword: (oldPassword, newPassword) => mutate({ oldPassword, newPassword }),
1019
+ passwordChanged: !!data,
1020
+ isLoading,
1021
+ error,
1022
+ reset: reset2
1023
+ };
1024
+ };
1025
+
1026
+ // src/suggestions.ts
1027
+ var useSuggestions = (link) => {
1028
+ if (!link) {
1029
+ return () => Promise.resolve([]);
1030
+ }
1031
+ const url = link + "?q=";
1032
+ return (inputValue) => {
1033
+ if (inputValue.length < 2) {
1034
+ return Promise.resolve([]);
1035
+ }
1036
+ return apiClient.get(url + inputValue).then((response) => response.json()).then((json) => json.map((element) => ({
1037
+ value: element,
1038
+ label: element.displayName ? `${element.displayName} (${element.id})` : element.id
1039
+ })));
1040
+ };
1041
+ };
1042
+
1043
+ // src/userSuggestions.ts
1044
+ var useUserSuggestions = () => {
1045
+ const indexLinks = useIndexLinks();
1046
+ const autocompleteLink = indexLinks.autocomplete.find((i) => i.name === "users");
1047
+ return useSuggestions(autocompleteLink == null ? void 0 : autocompleteLink.href);
1048
+ };
1049
+
1050
+ // src/groupSuggestions.ts
1051
+ var useGroupSuggestions = () => {
1052
+ const indexLinks = useIndexLinks();
1053
+ const autocompleteLink = indexLinks.autocomplete.find((i) => i.name === "groups");
1054
+ return useSuggestions(autocompleteLink == null ? void 0 : autocompleteLink.href);
1055
+ };
1056
+
1057
+ // src/namespaceSuggestions.ts
1058
+ var useNamespaceSuggestions = () => {
1059
+ const indexLinks = useIndexLinks();
1060
+ const autocompleteLink = indexLinks.autocomplete.find((i) => i.name === "namespaces");
1061
+ return useSuggestions(autocompleteLink == null ? void 0 : autocompleteLink.href);
1062
+ };
1063
+
1064
+ // src/repositories.ts
1065
+ var import_react_query7 = require("react-query");
1066
+
1067
+ // src/keys.ts
1068
+ var repoQueryKey = (repository, ...values) => {
1069
+ return ["repository", repository.namespace, repository.name, ...values];
1070
+ };
1071
+ var isBranch = (branch) => {
1072
+ return branch.name !== void 0;
1073
+ };
1074
+ var branchQueryKey = (repository, branch, ...values) => {
1075
+ let branchName;
1076
+ if (!branch) {
1077
+ branchName = "_";
1078
+ } else if (isBranch(branch)) {
1079
+ branchName = branch.name;
1080
+ } else {
1081
+ branchName = branch;
1082
+ }
1083
+ return [...repoQueryKey(repository), "branch", branchName, ...values];
1084
+ };
1085
+
1086
+ // src/repositories.ts
1087
+ var import_react3 = require("react");
1088
+ var useRepositories = (request) => {
1089
+ var _a, _b, _c;
1090
+ const queryClient2 = (0, import_react_query7.useQueryClient)();
1091
+ const indexLink = useRequiredIndexLink("repositories");
1092
+ const namespaceLink = (_b = (_a = request == null ? void 0 : request.namespace) == null ? void 0 : _a._links.repositories) == null ? void 0 : _b.href;
1093
+ const link = namespaceLink || indexLink;
1094
+ const queryParams = {};
1095
+ if (request == null ? void 0 : request.search) {
1096
+ queryParams.q = request.search;
1097
+ }
1098
+ if (request == null ? void 0 : request.page) {
1099
+ queryParams.page = request.page.toString();
1100
+ }
1101
+ return (0, import_react_query7.useQuery)(["repositories", (_c = request == null ? void 0 : request.namespace) == null ? void 0 : _c.namespace, (request == null ? void 0 : request.search) || "", (request == null ? void 0 : request.page) || 0], () => apiClient.get(`${link}?${createQueryString(queryParams)}`).then((response) => response.json()), {
1102
+ enabled: !(request == null ? void 0 : request.disabled),
1103
+ onSuccess: (repositories) => {
1104
+ var _a2;
1105
+ (_a2 = repositories._embedded) == null ? void 0 : _a2.repositories.forEach((repository) => {
1106
+ queryClient2.setQueryData(["repository", repository.namespace, repository.name], repository);
1107
+ });
1108
+ }
1109
+ });
1110
+ };
1111
+ var createRepository = (link) => {
1112
+ return (request) => {
1113
+ let createLink = link;
1114
+ if (request.initialize) {
1115
+ createLink += "?initialize=true";
1116
+ }
1117
+ return apiClient.post(createLink, request.repository, "application/vnd.scmm-repository+json;v=2").then((response) => {
1118
+ const location = response.headers.get("Location");
1119
+ if (!location) {
1120
+ throw new Error("Server does not return required Location header");
1121
+ }
1122
+ return apiClient.get(location);
1123
+ }).then((response) => response.json());
1124
+ };
1125
+ };
1126
+ var useCreateRepository = () => {
1127
+ const queryClient2 = (0, import_react_query7.useQueryClient)();
1128
+ const link = useRequiredIndexLink("repositories");
1129
+ const { mutate, data, isLoading, error } = (0, import_react_query7.useMutation)(createRepository(link), {
1130
+ onSuccess: (repository) => {
1131
+ queryClient2.setQueryData(["repository", repository.namespace, repository.name], repository);
1132
+ return queryClient2.invalidateQueries(["repositories"]);
1133
+ }
1134
+ });
1135
+ return {
1136
+ create: (repository, initialize) => {
1137
+ mutate({ repository, initialize });
1138
+ },
1139
+ isLoading,
1140
+ error,
1141
+ repository: data
1142
+ };
1143
+ };
1144
+ var useRepositoryTypes = () => useIndexJsonResource("repositoryTypes");
1145
+ var useRepository = (namespace, name) => {
1146
+ const link = useRequiredIndexLink("repositories");
1147
+ return (0, import_react_query7.useQuery)(["repository", namespace, name], () => apiClient.get(concat(link, namespace, name)).then((response) => response.json()));
1148
+ };
1149
+ var useDeleteRepository = (options) => {
1150
+ const queryClient2 = (0, import_react_query7.useQueryClient)();
1151
+ const { mutate, isLoading, error, data } = (0, import_react_query7.useMutation)((repository) => {
1152
+ const link = requiredLink(repository, "delete");
1153
+ return apiClient.delete(link);
1154
+ }, {
1155
+ onSuccess: async (_, repository) => {
1156
+ if (options == null ? void 0 : options.onSuccess) {
1157
+ options.onSuccess(repository);
1158
+ }
1159
+ queryClient2.removeQueries(repoQueryKey(repository));
1160
+ await queryClient2.invalidateQueries(["repositories"]);
1161
+ }
1162
+ });
1163
+ return {
1164
+ remove: (repository) => mutate(repository),
1165
+ isLoading,
1166
+ error,
1167
+ isDeleted: !!data
1168
+ };
1169
+ };
1170
+ var useUpdateRepository = () => {
1171
+ const queryClient2 = (0, import_react_query7.useQueryClient)();
1172
+ const { mutate, isLoading, error, data } = (0, import_react_query7.useMutation)((repository) => {
1173
+ const link = requiredLink(repository, "update");
1174
+ return apiClient.put(link, repository, "application/vnd.scmm-repository+json;v=2");
1175
+ }, {
1176
+ onSuccess: async (_, repository) => {
1177
+ await queryClient2.invalidateQueries(repoQueryKey(repository));
1178
+ await queryClient2.invalidateQueries(["repositories"]);
1179
+ }
1180
+ });
1181
+ return {
1182
+ update: (repository) => mutate(repository),
1183
+ isLoading,
1184
+ error,
1185
+ isUpdated: !!data
1186
+ };
1187
+ };
1188
+ var useArchiveRepository = () => {
1189
+ const queryClient2 = (0, import_react_query7.useQueryClient)();
1190
+ const { mutate, isLoading, error, data } = (0, import_react_query7.useMutation)((repository) => {
1191
+ const link = requiredLink(repository, "archive");
1192
+ return apiClient.post(link);
1193
+ }, {
1194
+ onSuccess: async (_, repository) => {
1195
+ await queryClient2.invalidateQueries(repoQueryKey(repository));
1196
+ await queryClient2.invalidateQueries(["repositories"]);
1197
+ }
1198
+ });
1199
+ return {
1200
+ archive: (repository) => mutate(repository),
1201
+ isLoading,
1202
+ error,
1203
+ isArchived: !!data
1204
+ };
1205
+ };
1206
+ var useUnarchiveRepository = () => {
1207
+ const queryClient2 = (0, import_react_query7.useQueryClient)();
1208
+ const { mutate, isLoading, error, data } = (0, import_react_query7.useMutation)((repository) => {
1209
+ const link = requiredLink(repository, "unarchive");
1210
+ return apiClient.post(link);
1211
+ }, {
1212
+ onSuccess: async (_, repository) => {
1213
+ await queryClient2.invalidateQueries(repoQueryKey(repository));
1214
+ await queryClient2.invalidateQueries(["repositories"]);
1215
+ }
1216
+ });
1217
+ return {
1218
+ unarchive: (repository) => mutate(repository),
1219
+ isLoading,
1220
+ error,
1221
+ isUnarchived: !!data
1222
+ };
1223
+ };
1224
+ var useRunHealthCheck = () => {
1225
+ const queryClient2 = (0, import_react_query7.useQueryClient)();
1226
+ const { mutate, isLoading, error, data } = (0, import_react_query7.useMutation)((repository) => {
1227
+ const link = requiredLink(repository, "runHealthCheck");
1228
+ return apiClient.post(link);
1229
+ }, {
1230
+ onSuccess: async (_, repository) => {
1231
+ await queryClient2.invalidateQueries(repoQueryKey(repository));
1232
+ }
1233
+ });
1234
+ return {
1235
+ runHealthCheck: (repository) => mutate(repository),
1236
+ isLoading,
1237
+ error,
1238
+ isRunning: !!data
1239
+ };
1240
+ };
1241
+ var useExportInfo = (repository) => {
1242
+ const link = requiredLink(repository, "exportInfo");
1243
+ const { isLoading, isFetching, error, data } = (0, import_react_query7.useQuery)(["repository", repository.namespace, repository.name, "exportInfo"], () => apiClient.get(link).then((response) => response.json()), {});
1244
+ return {
1245
+ isLoading,
1246
+ isFetching,
1247
+ error: error instanceof NotFoundError ? null : error,
1248
+ data
1249
+ };
1250
+ };
1251
+ var EXPORT_MEDIA_TYPE = "application/vnd.scmm-repositoryExport+json;v=2";
1252
+ var useExportRepository = () => {
1253
+ const queryClient2 = (0, import_react_query7.useQueryClient)();
1254
+ const [intervalId, setIntervalId] = (0, import_react3.useState)();
1255
+ (0, import_react3.useEffect)(() => {
1256
+ return () => {
1257
+ if (intervalId) {
1258
+ clearInterval(intervalId);
1259
+ }
1260
+ };
1261
+ }, [intervalId]);
1262
+ const { mutate, isLoading, error, data } = (0, import_react_query7.useMutation)(({ repository, options }) => {
1263
+ const infolink = requiredLink(repository, "exportInfo");
1264
+ let link = requiredLink(repository, options.withMetadata ? "fullExport" : "export");
1265
+ if (options.compressed) {
1266
+ link += "?compressed=true";
1267
+ }
1268
+ return apiClient.post(link, { password: options.password, async: true }, EXPORT_MEDIA_TYPE).then(() => queryClient2.invalidateQueries(repoQueryKey(repository))).then(() => queryClient2.invalidateQueries(["repositories"])).then(() => {
1269
+ return new Promise((resolve, reject) => {
1270
+ const id = setInterval(() => {
1271
+ apiClient.get(infolink).then((r) => r.json()).then((info) => {
1272
+ if (info._links.download) {
1273
+ clearInterval(id);
1274
+ resolve(info);
1275
+ }
1276
+ }).catch((e) => {
1277
+ clearInterval(id);
1278
+ reject(e);
1279
+ });
1280
+ }, 1e3);
1281
+ setIntervalId(id);
1282
+ });
1283
+ });
1284
+ }, {
1285
+ onSuccess: async (_, { repository }) => {
1286
+ await queryClient2.invalidateQueries(repoQueryKey(repository));
1287
+ await queryClient2.invalidateQueries(["repositories"]);
1288
+ }
1289
+ });
1290
+ return {
1291
+ exportRepository: (repository, options) => mutate({ repository, options }),
1292
+ isLoading,
1293
+ error,
1294
+ data
1295
+ };
1296
+ };
1297
+ var usePaths = (repository, revision) => {
1298
+ const link = requiredLink(repository, "paths").replace("{revision}", revision);
1299
+ return (0, import_react_query7.useQuery)(repoQueryKey(repository, "paths", revision), () => apiClient.get(link).then((response) => response.json()));
1300
+ };
1301
+ var useRenameRepository = (repository) => {
1302
+ const queryClient2 = (0, import_react_query7.useQueryClient)();
1303
+ const url = objectLink(repository, "renameWithNamespace") || objectLink(repository, "rename");
1304
+ if (!url) {
1305
+ throw new MissingLinkError(`could not find rename link on repository ${repository.namespace}/${repository.name}`);
1306
+ }
1307
+ const { mutate, isLoading, error, data } = (0, import_react_query7.useMutation)(({ name, namespace }) => apiClient.post(url, { namespace, name }, "application/vnd.scmm-repository+json;v=2"), {
1308
+ onSuccess: () => queryClient2.removeQueries(repoQueryKey(repository))
1309
+ });
1310
+ return {
1311
+ renameRepository: (namespace, name) => mutate({ namespace, name }),
1312
+ isLoading,
1313
+ error,
1314
+ isRenamed: !!data
1315
+ };
1316
+ };
1317
+
1318
+ // src/namespaces.ts
1319
+ var import_react_query8 = require("react-query");
1320
+ var useNamespaces = () => {
1321
+ return useIndexJsonResource("namespaces");
1322
+ };
1323
+ var useNamespace = (name) => {
1324
+ const namespacesLink = useRequiredIndexLink("namespaces");
1325
+ return (0, import_react_query8.useQuery)(["namespace", name], () => apiClient.get(concat(namespacesLink, name)).then((response) => response.json()));
1326
+ };
1327
+ var useNamespaceStrategies = () => {
1328
+ return useIndexJsonResource("namespaceStrategies");
1329
+ };
1330
+
1331
+ // src/branches.ts
1332
+ var import_react_query9 = require("react-query");
1333
+ var import_react4 = require("react");
1334
+ var useBranches = (repository) => {
1335
+ const queryClient2 = (0, import_react_query9.useQueryClient)();
1336
+ const link = requiredLink(repository, "branches");
1337
+ return (0, import_react_query9.useQuery)(repoQueryKey(repository, "branches"), () => apiClient.get(link).then((response) => response.json()), {
1338
+ onSuccess: () => {
1339
+ return queryClient2.invalidateQueries(branchDetailsQueryKey(repository));
1340
+ }
1341
+ });
1342
+ };
1343
+ var useBranch = (repository, name) => {
1344
+ const link = requiredLink(repository, "branches");
1345
+ return (0, import_react_query9.useQuery)(branchQueryKey(repository, name), () => apiClient.get(concat(link, encodeURIComponent(name))).then((response) => response.json()));
1346
+ };
1347
+ function chunkBranches(branches) {
1348
+ const chunks = [];
1349
+ const chunkSize = 5;
1350
+ let chunkIndex = 0;
1351
+ for (const branch of branches) {
1352
+ if (!chunks[chunkIndex]) {
1353
+ chunks[chunkIndex] = [];
1354
+ }
1355
+ chunks[chunkIndex].push(branch);
1356
+ if (chunks[chunkIndex].length >= chunkSize) {
1357
+ chunkIndex = chunkIndex + 1;
1358
+ }
1359
+ }
1360
+ return chunks;
1361
+ }
1362
+ var branchDetailsQueryKey = (repository, branch = void 0) => {
1363
+ let branchName;
1364
+ if (!branch) {
1365
+ branchName = "_";
1366
+ } else {
1367
+ branchName = branch;
1368
+ }
1369
+ return [...repoQueryKey(repository), "branch-details", branchName];
1370
+ };
1371
+ var useBranchDetailsCollection = (repository, branches) => {
1372
+ var _a;
1373
+ const link = requiredLink(repository, "branchDetailsCollection");
1374
+ const chunks = chunkBranches(branches);
1375
+ const queryClient2 = (0, import_react_query9.useQueryClient)();
1376
+ const { data, isLoading, error, fetchNextPage } = (0, import_react_query9.useInfiniteQuery)(branchDetailsQueryKey(repository), ({ pageParam = 0 }) => {
1377
+ var _a2;
1378
+ const encodedBranches = (_a2 = chunks[pageParam]) == null ? void 0 : _a2.map((b) => encodeURIComponent(b.name)).join("&branches=");
1379
+ return apiClient.get(concat(link, `?branches=${encodedBranches}`)).then((response) => response.json());
1380
+ }, {
1381
+ getNextPageParam: (lastPage, allPages) => {
1382
+ if (allPages.length >= chunks.length) {
1383
+ return void 0;
1384
+ }
1385
+ return allPages.length;
1386
+ },
1387
+ onSuccess: (newData) => {
1388
+ newData.pages.flatMap((d) => {
1389
+ var _a2;
1390
+ return (_a2 = d._embedded) == null ? void 0 : _a2.branchDetails;
1391
+ }).filter((d) => !!d).forEach((d) => queryClient2.setQueryData(branchDetailsQueryKey(repository, d.branchName), () => d));
1392
+ }
1393
+ });
1394
+ (0, import_react4.useEffect)(() => {
1395
+ fetchNextPage();
1396
+ }, [data, fetchNextPage]);
1397
+ return {
1398
+ data: (_a = data == null ? void 0 : data.pages) == null ? void 0 : _a.map((d) => {
1399
+ var _a2;
1400
+ return (_a2 = d._embedded) == null ? void 0 : _a2.branchDetails;
1401
+ }).flat(1),
1402
+ isLoading,
1403
+ error
1404
+ };
1405
+ };
1406
+ var useBranchDetails = (repository, branch) => {
1407
+ const link = branch._links.details.href;
1408
+ const queryKey = branchDetailsQueryKey(repository, branch.name);
1409
+ return (0, import_react_query9.useQuery)(queryKey, () => apiClient.get(link).then((response) => response.json()));
1410
+ };
1411
+ var createBranch = (link) => {
1412
+ return (branch) => {
1413
+ return apiClient.post(link, branch, "application/vnd.scmm-branchRequest+json;v=2").then((response) => {
1414
+ const location = response.headers.get("Location");
1415
+ if (!location) {
1416
+ throw new Error("Server does not return required Location header");
1417
+ }
1418
+ return apiClient.get(location);
1419
+ }).then((response) => response.json());
1420
+ };
1421
+ };
1422
+ var useCreateBranch = (repository) => {
1423
+ const queryClient2 = (0, import_react_query9.useQueryClient)();
1424
+ const link = requiredLink(repository, "branches");
1425
+ const { mutate, isLoading, error, data } = (0, import_react_query9.useMutation)(createBranch(link), {
1426
+ onSuccess: async (branch) => {
1427
+ queryClient2.setQueryData(branchQueryKey(repository, branch), branch);
1428
+ await queryClient2.invalidateQueries(repoQueryKey(repository, "branches"));
1429
+ }
1430
+ });
1431
+ return {
1432
+ create: (branch) => mutate(branch),
1433
+ isLoading,
1434
+ error,
1435
+ branch: data
1436
+ };
1437
+ };
1438
+ var useDeleteBranch = (repository) => {
1439
+ const queryClient2 = (0, import_react_query9.useQueryClient)();
1440
+ const { mutate, isLoading, error, data } = (0, import_react_query9.useMutation)((branch) => {
1441
+ const deleteUrl = branch._links.delete.href;
1442
+ return apiClient.delete(deleteUrl);
1443
+ }, {
1444
+ onSuccess: async (_, branch) => {
1445
+ queryClient2.removeQueries(branchQueryKey(repository, branch));
1446
+ await queryClient2.invalidateQueries(repoQueryKey(repository, "branches"));
1447
+ }
1448
+ });
1449
+ return {
1450
+ remove: (branch) => mutate(branch),
1451
+ isLoading,
1452
+ error,
1453
+ isDeleted: !!data
1454
+ };
1455
+ };
1456
+ var useDefaultBranch = (repository) => {
1457
+ const link = requiredLink(repository, "defaultBranch");
1458
+ return (0, import_react_query9.useQuery)(branchQueryKey(repository, "__default-branch"), () => apiClient.get(link).then((response) => response.json()));
1459
+ };
1460
+
1461
+ // src/changesets.ts
1462
+ var import_react_query10 = require("react-query");
1463
+ var changesetQueryKey = (repository, id) => {
1464
+ return repoQueryKey(repository, "changeset", id);
1465
+ };
1466
+ var useChangesets = (repository, request) => {
1467
+ const queryClient2 = (0, import_react_query10.useQueryClient)();
1468
+ let link;
1469
+ let branch = "_";
1470
+ if (request == null ? void 0 : request.branch) {
1471
+ link = requiredLink(request.branch, "history");
1472
+ branch = request.branch.name;
1473
+ } else {
1474
+ link = requiredLink(repository, "changesets");
1475
+ }
1476
+ if ((request == null ? void 0 : request.page) || (request == null ? void 0 : request.limit)) {
1477
+ if ((request == null ? void 0 : request.page) && (request == null ? void 0 : request.limit)) {
1478
+ link = `${link}?page=${request.page}&pageSize=${request.limit}`;
1479
+ } else if (request.page) {
1480
+ link = `${link}?page=${request.page}`;
1481
+ } else if (request.limit) {
1482
+ link = `${link}?pageSize=${request.limit}`;
1483
+ }
1484
+ }
1485
+ const key = branchQueryKey(repository, branch, "changesets", (request == null ? void 0 : request.page) || 0);
1486
+ return (0, import_react_query10.useQuery)(key, () => apiClient.get(link).then((response) => response.json()), {
1487
+ onSuccess: (changesetCollection) => {
1488
+ var _a;
1489
+ (_a = changesetCollection._embedded) == null ? void 0 : _a.changesets.forEach((changeset) => {
1490
+ queryClient2.setQueryData(changesetQueryKey(repository, changeset.id), changeset);
1491
+ });
1492
+ }
1493
+ });
1494
+ };
1495
+ var useChangeset = (repository, id) => {
1496
+ const changesetsLink = requiredLink(repository, "changesets");
1497
+ return (0, import_react_query10.useQuery)(changesetQueryKey(repository, id), () => apiClient.get(concat(changesetsLink, id)).then((response) => response.json()));
1498
+ };
1499
+
1500
+ // src/tags.ts
1501
+ var import_react_query11 = require("react-query");
1502
+ var tagQueryKey = (repository, tag) => {
1503
+ return repoQueryKey(repository, "tag", tag);
1504
+ };
1505
+ var useTags = (repository) => {
1506
+ const link = requiredLink(repository, "tags");
1507
+ return (0, import_react_query11.useQuery)(repoQueryKey(repository, "tags"), () => apiClient.get(link).then((response) => response.json()));
1508
+ };
1509
+ var useTag = (repository, name) => {
1510
+ const link = requiredLink(repository, "tags");
1511
+ return (0, import_react_query11.useQuery)(tagQueryKey(repository, name), () => apiClient.get(concat(link, name)).then((response) => response.json()));
1512
+ };
1513
+ var invalidateCacheForTag = (queryClient2, repository, tag) => {
1514
+ return Promise.all([
1515
+ queryClient2.invalidateQueries(repoQueryKey(repository, "tags")),
1516
+ queryClient2.invalidateQueries(repoQueryKey(repository, "changesets")),
1517
+ queryClient2.invalidateQueries(repoQueryKey(repository, "changeset", tag.revision))
1518
+ ]);
1519
+ };
1520
+ var createTag = (changeset, link) => {
1521
+ return (name) => {
1522
+ return apiClient.post(link, {
1523
+ name,
1524
+ revision: changeset.id
1525
+ }).then((response) => {
1526
+ const location = response.headers.get("Location");
1527
+ if (!location) {
1528
+ throw new Error("Server does not return required Location header");
1529
+ }
1530
+ return apiClient.get(location);
1531
+ }).then((response) => response.json());
1532
+ };
1533
+ };
1534
+ var useCreateTag = (repository, changeset) => {
1535
+ const queryClient2 = (0, import_react_query11.useQueryClient)();
1536
+ const link = requiredLink(changeset, "tag");
1537
+ const { isLoading, error, mutate, data } = (0, import_react_query11.useMutation)(createTag(changeset, link), {
1538
+ onSuccess: async (tag) => {
1539
+ queryClient2.setQueryData(tagQueryKey(repository, tag.name), tag);
1540
+ await queryClient2.invalidateQueries(tagQueryKey(repository, tag.name));
1541
+ await invalidateCacheForTag(queryClient2, repository, tag);
1542
+ }
1543
+ });
1544
+ return {
1545
+ isLoading,
1546
+ error,
1547
+ create: (name) => mutate(name),
1548
+ tag: data
1549
+ };
1550
+ };
1551
+ var useDeleteTag = (repository) => {
1552
+ const queryClient2 = (0, import_react_query11.useQueryClient)();
1553
+ const { mutate, isLoading, error, data } = (0, import_react_query11.useMutation)((tag) => {
1554
+ const deleteUrl = tag._links.delete.href;
1555
+ return apiClient.delete(deleteUrl);
1556
+ }, {
1557
+ onSuccess: async (_, tag) => {
1558
+ queryClient2.removeQueries(tagQueryKey(repository, tag.name));
1559
+ await invalidateCacheForTag(queryClient2, repository, tag);
1560
+ }
1561
+ });
1562
+ return {
1563
+ remove: (tag) => mutate(tag),
1564
+ isLoading,
1565
+ error,
1566
+ isDeleted: !!data
1567
+ };
1568
+ };
1569
+
1570
+ // src/config.ts
1571
+ var import_react_query12 = require("react-query");
1572
+ var useConfig = () => {
1573
+ const indexLink = useIndexLink("config");
1574
+ return (0, import_react_query12.useQuery)("config", () => apiClient.get(indexLink).then((response) => response.json()), {
1575
+ enabled: !!indexLink
1576
+ });
1577
+ };
1578
+ var useUpdateConfig = () => {
1579
+ const queryClient2 = (0, import_react_query12.useQueryClient)();
1580
+ const { mutate, isLoading, error, data, reset: reset2 } = (0, import_react_query12.useMutation)((config) => {
1581
+ const updateUrl = requiredLink(config, "update");
1582
+ return apiClient.put(updateUrl, config, "application/vnd.scmm-config+json;v=2");
1583
+ }, {
1584
+ onSuccess: async () => {
1585
+ await queryClient2.invalidateQueries("config");
1586
+ await queryClient2.invalidateQueries("index");
1587
+ await queryClient2.invalidateQueries("pluginCenterAuth");
1588
+ }
1589
+ });
1590
+ return {
1591
+ update: (config) => mutate(config),
1592
+ isLoading,
1593
+ error,
1594
+ isUpdated: !!data,
1595
+ reset: reset2
1596
+ };
1597
+ };
1598
+
1599
+ // src/admin.ts
1600
+ var import_react_query13 = require("react-query");
1601
+ var useUpdateInfo = () => {
1602
+ const indexLink = useIndexLink("updateInfo");
1603
+ return (0, import_react_query13.useQuery)("updateInfo", () => {
1604
+ if (!indexLink) {
1605
+ throw new Error("could not find index data");
1606
+ }
1607
+ return apiClient.get(indexLink).then((response) => response.status === 204 ? null : response.json());
1608
+ }, { enabled: !!indexLink });
1609
+ };
1610
+
1611
+ // src/plugins.ts
1612
+ var import_ui_types = require("@scm-manager/ui-types");
1613
+ var import_react_query14 = require("react-query");
1614
+ var waitForRestartAfter = (promise, { initialDelay = 1e3, timeout = 500 } = {}) => {
1615
+ const endTime = Number(new Date()) + 4 * 60 * 1e3;
1616
+ let started = false;
1617
+ const executor = (data) => (resolve, reject) => {
1618
+ if (!started) {
1619
+ started = true;
1620
+ setTimeout(executor(data), initialDelay, resolve, reject);
1621
+ } else {
1622
+ apiClient.get("").then(() => resolve(data)).catch(() => {
1623
+ if (Number(new Date()) < endTime) {
1624
+ setTimeout(executor(data), timeout, resolve, reject);
1625
+ } else {
1626
+ reject(new Error("timeout reached"));
1627
+ }
1628
+ });
1629
+ }
1630
+ };
1631
+ return promise.catch((err) => {
1632
+ if (err instanceof BadGatewayError) {
1633
+ return "ok";
1634
+ }
1635
+ throw err;
1636
+ }).then((data) => new Promise(executor(data)));
1637
+ };
1638
+ var useAvailablePlugins = ({ enabled } = {}) => {
1639
+ const indexLink = useRequiredIndexLink("availablePlugins");
1640
+ return (0, import_react_query14.useQuery)(["plugins", "available"], () => apiClient.get(indexLink).then((response) => response.json()), {
1641
+ enabled,
1642
+ retry: 3
1643
+ });
1644
+ };
1645
+ var useInstalledPlugins = ({ enabled } = {}) => {
1646
+ const indexLink = useRequiredIndexLink("installedPlugins");
1647
+ return (0, import_react_query14.useQuery)(["plugins", "installed"], () => apiClient.get(indexLink).then((response) => response.json()), {
1648
+ enabled,
1649
+ retry: 3
1650
+ });
1651
+ };
1652
+ var usePendingPlugins = () => {
1653
+ const indexLink = useIndexLink("pendingPlugins");
1654
+ return (0, import_react_query14.useQuery)(["plugins", "pending"], () => apiClient.get(indexLink).then((response) => response.json()), {
1655
+ enabled: !!indexLink,
1656
+ retry: 3
1657
+ });
1658
+ };
1659
+ var linkWithRestart = (link, restart) => {
1660
+ if (restart) {
1661
+ return link + "WithRestart";
1662
+ }
1663
+ return link;
1664
+ };
1665
+ var useInstallPlugin = () => {
1666
+ const queryClient2 = (0, import_react_query14.useQueryClient)();
1667
+ const { mutate, isLoading, error, data } = (0, import_react_query14.useMutation)((_a) => {
1668
+ var { plugin, restartOptions: _b } = _a, _c = _b, { restart } = _c, waitForRestartOptions = __objRest(_c, ["restart"]);
1669
+ const promise = apiClient.post(requiredLink(plugin, linkWithRestart("install", restart)));
1670
+ if (restart) {
1671
+ return waitForRestartAfter(promise, waitForRestartOptions);
1672
+ }
1673
+ return promise;
1674
+ }, {
1675
+ onSuccess: () => queryClient2.invalidateQueries("plugins")
1676
+ });
1677
+ return {
1678
+ install: (plugin, restartOptions = {}) => mutate({
1679
+ plugin,
1680
+ restartOptions
1681
+ }),
1682
+ isLoading,
1683
+ error,
1684
+ data,
1685
+ isInstalled: !!data
1686
+ };
1687
+ };
1688
+ var useUninstallPlugin = () => {
1689
+ const queryClient2 = (0, import_react_query14.useQueryClient)();
1690
+ const { mutate, isLoading, error, data } = (0, import_react_query14.useMutation)((_a) => {
1691
+ var { plugin, restartOptions: _b } = _a, _c = _b, { restart } = _c, waitForRestartOptions = __objRest(_c, ["restart"]);
1692
+ const promise = apiClient.post(requiredLink(plugin, linkWithRestart("uninstall", restart)));
1693
+ if (restart) {
1694
+ return waitForRestartAfter(promise, waitForRestartOptions);
1695
+ }
1696
+ return promise;
1697
+ }, {
1698
+ onSuccess: () => queryClient2.invalidateQueries("plugins")
1699
+ });
1700
+ return {
1701
+ uninstall: (plugin, restartOptions = {}) => mutate({
1702
+ plugin,
1703
+ restartOptions
1704
+ }),
1705
+ isLoading,
1706
+ error,
1707
+ isUninstalled: !!data
1708
+ };
1709
+ };
1710
+ var useUpdatePlugins = () => {
1711
+ const queryClient2 = (0, import_react_query14.useQueryClient)();
1712
+ const { mutate, isLoading, error, data } = (0, import_react_query14.useMutation)((_a) => {
1713
+ var { plugins, restartOptions: _b } = _a, _c = _b, { restart } = _c, waitForRestartOptions = __objRest(_c, ["restart"]);
1714
+ const isCollection = (0, import_ui_types.isPluginCollection)(plugins);
1715
+ const promise = apiClient.post(requiredLink(plugins, isCollection ? "update" : linkWithRestart("update", restart)));
1716
+ if (restart && !isCollection) {
1717
+ return waitForRestartAfter(promise, waitForRestartOptions);
1718
+ }
1719
+ return promise;
1720
+ }, {
1721
+ onSuccess: () => queryClient2.invalidateQueries("plugins")
1722
+ });
1723
+ return {
1724
+ update: (plugin, restartOptions = {}) => mutate({
1725
+ plugins: plugin,
1726
+ restartOptions
1727
+ }),
1728
+ isLoading,
1729
+ error,
1730
+ isUpdated: !!data
1731
+ };
1732
+ };
1733
+ var useExecutePendingPlugins = () => {
1734
+ const queryClient2 = (0, import_react_query14.useQueryClient)();
1735
+ const { mutate, isLoading, error, data } = (0, import_react_query14.useMutation)(({ pending, restartOptions }) => waitForRestartAfter(apiClient.post(requiredLink(pending, "execute")), restartOptions), {
1736
+ onSuccess: () => queryClient2.invalidateQueries("plugins")
1737
+ });
1738
+ return {
1739
+ update: (pending, restartOptions = {}) => mutate({ pending, restartOptions }),
1740
+ isLoading,
1741
+ error,
1742
+ isExecuted: !!data
1743
+ };
1744
+ };
1745
+ var useCancelPendingPlugins = () => {
1746
+ const queryClient2 = (0, import_react_query14.useQueryClient)();
1747
+ const { mutate, isLoading, error, data } = (0, import_react_query14.useMutation)((pending) => apiClient.post(requiredLink(pending, "cancel")), {
1748
+ onSuccess: () => queryClient2.invalidateQueries("plugins")
1749
+ });
1750
+ return {
1751
+ update: (pending) => mutate(pending),
1752
+ isLoading,
1753
+ error,
1754
+ isCancelled: !!data
1755
+ };
1756
+ };
1757
+
1758
+ // src/repository-roles.ts
1759
+ var import_react_query15 = require("react-query");
1760
+ var useRepositoryRoles = (request) => {
1761
+ const queryClient2 = (0, import_react_query15.useQueryClient)();
1762
+ const indexLink = useRequiredIndexLink("repositoryRoles");
1763
+ const queryParams = {};
1764
+ if (request == null ? void 0 : request.page) {
1765
+ queryParams.page = request.page.toString();
1766
+ }
1767
+ return (0, import_react_query15.useQuery)(["repositoryRoles", (request == null ? void 0 : request.page) || 0], () => apiClient.get(`${indexLink}?${createQueryString(queryParams)}`).then((response) => response.json()), {
1768
+ onSuccess: (repositoryRoles) => {
1769
+ var _a;
1770
+ (_a = repositoryRoles._embedded) == null ? void 0 : _a.repositoryRoles.forEach((repositoryRole) => queryClient2.setQueryData(["repositoryRole", repositoryRole.name], repositoryRole));
1771
+ }
1772
+ });
1773
+ };
1774
+ var useRepositoryRole = (name) => {
1775
+ const indexLink = useRequiredIndexLink("repositoryRoles");
1776
+ return (0, import_react_query15.useQuery)(["repositoryRole", name], () => apiClient.get(concat(indexLink, name)).then((response) => response.json()));
1777
+ };
1778
+ var createRepositoryRole = (link) => {
1779
+ return (repositoryRole) => {
1780
+ return apiClient.post(link, repositoryRole, "application/vnd.scmm-repositoryRole+json;v=2").then((response) => {
1781
+ const location = response.headers.get("Location");
1782
+ if (!location) {
1783
+ throw new Error("Server does not return required Location header");
1784
+ }
1785
+ return apiClient.get(location);
1786
+ }).then((response) => response.json());
1787
+ };
1788
+ };
1789
+ var useCreateRepositoryRole = () => {
1790
+ const queryClient2 = (0, import_react_query15.useQueryClient)();
1791
+ const link = useRequiredIndexLink("repositoryRoles");
1792
+ const { mutate, data, isLoading, error } = (0, import_react_query15.useMutation)(createRepositoryRole(link), {
1793
+ onSuccess: (repositoryRole) => {
1794
+ queryClient2.setQueryData(["repositoryRole", repositoryRole.name], repositoryRole);
1795
+ return queryClient2.invalidateQueries(["repositoryRoles"]);
1796
+ }
1797
+ });
1798
+ return {
1799
+ create: (repositoryRole) => mutate(repositoryRole),
1800
+ isLoading,
1801
+ error,
1802
+ repositoryRole: data
1803
+ };
1804
+ };
1805
+ var useUpdateRepositoryRole = () => {
1806
+ const queryClient2 = (0, import_react_query15.useQueryClient)();
1807
+ const { mutate, isLoading, error, data } = (0, import_react_query15.useMutation)((repositoryRole) => {
1808
+ const updateUrl = requiredLink(repositoryRole, "update");
1809
+ return apiClient.put(updateUrl, repositoryRole, "application/vnd.scmm-repositoryRole+json;v=2");
1810
+ }, {
1811
+ onSuccess: async (_, repositoryRole) => {
1812
+ await queryClient2.invalidateQueries(["repositoryRole", repositoryRole.name]);
1813
+ await queryClient2.invalidateQueries(["repositoryRoles"]);
1814
+ }
1815
+ });
1816
+ return {
1817
+ update: (repositoryRole) => mutate(repositoryRole),
1818
+ isLoading,
1819
+ error,
1820
+ isUpdated: !!data
1821
+ };
1822
+ };
1823
+ var useDeleteRepositoryRole = () => {
1824
+ const queryClient2 = (0, import_react_query15.useQueryClient)();
1825
+ const { mutate, isLoading, error, data } = (0, import_react_query15.useMutation)((repositoryRole) => {
1826
+ const deleteUrl = requiredLink(repositoryRole, "delete");
1827
+ return apiClient.delete(deleteUrl);
1828
+ }, {
1829
+ onSuccess: async (_, name) => {
1830
+ await queryClient2.removeQueries(["repositoryRole", name]);
1831
+ await queryClient2.invalidateQueries(["repositoryRoles"]);
1832
+ }
1833
+ });
1834
+ return {
1835
+ remove: (repositoryRole) => mutate(repositoryRole),
1836
+ isLoading,
1837
+ error,
1838
+ isDeleted: !!data
1839
+ };
1840
+ };
1841
+
1842
+ // src/permissions.ts
1843
+ var import_react_query16 = require("react-query");
1844
+ var useRepositoryVerbs = () => {
1845
+ return useIndexJsonResource("repositoryVerbs");
1846
+ };
1847
+ var useAvailablePermissions = () => {
1848
+ var _a;
1849
+ const roles = useRepositoryRoles();
1850
+ const verbs = useRepositoryVerbs();
1851
+ let data;
1852
+ if (roles.data && verbs.data) {
1853
+ data = {
1854
+ repositoryVerbs: verbs.data.verbs,
1855
+ repositoryRoles: ((_a = roles.data._embedded) == null ? void 0 : _a.repositoryRoles) || []
1856
+ };
1857
+ }
1858
+ return {
1859
+ isLoading: roles.isLoading || verbs.isLoading,
1860
+ error: roles.error || verbs.error,
1861
+ data
1862
+ };
1863
+ };
1864
+ var isRepository = (namespaceOrRepository) => {
1865
+ return namespaceOrRepository.name !== void 0;
1866
+ };
1867
+ var createQueryKey = (namespaceOrRepository) => {
1868
+ if (isRepository(namespaceOrRepository)) {
1869
+ return repoQueryKey(namespaceOrRepository, "permissions");
1870
+ } else {
1871
+ return ["namespace", namespaceOrRepository.namespace, "permissions"];
1872
+ }
1873
+ };
1874
+ var usePermissions = (namespaceOrRepository) => {
1875
+ const link = requiredLink(namespaceOrRepository, "permissions");
1876
+ const queryKey = createQueryKey(namespaceOrRepository);
1877
+ return (0, import_react_query16.useQuery)(queryKey, () => apiClient.get(link).then((response) => response.json()));
1878
+ };
1879
+ var createPermission = (link) => {
1880
+ return (permission) => {
1881
+ return apiClient.post(link, permission, "application/vnd.scmm-repositoryPermission+json").then((response) => {
1882
+ const location = response.headers.get("Location");
1883
+ if (!location) {
1884
+ throw new Error("Server does not return required Location header");
1885
+ }
1886
+ return apiClient.get(location);
1887
+ }).then((response) => response.json());
1888
+ };
1889
+ };
1890
+ var useCreatePermission = (namespaceOrRepository) => {
1891
+ const queryClient2 = (0, import_react_query16.useQueryClient)();
1892
+ const link = requiredLink(namespaceOrRepository, "permissions");
1893
+ const { isLoading, error, mutate, data } = (0, import_react_query16.useMutation)(createPermission(link), {
1894
+ onSuccess: () => {
1895
+ const queryKey = createQueryKey(namespaceOrRepository);
1896
+ return queryClient2.invalidateQueries(queryKey);
1897
+ }
1898
+ });
1899
+ return {
1900
+ isLoading,
1901
+ error,
1902
+ create: (permission) => mutate(permission),
1903
+ permission: data
1904
+ };
1905
+ };
1906
+ var useUpdatePermission = (namespaceOrRepository) => {
1907
+ const queryClient2 = (0, import_react_query16.useQueryClient)();
1908
+ const { isLoading, error, mutate, data } = (0, import_react_query16.useMutation)((permission) => {
1909
+ const link = requiredLink(permission, "update");
1910
+ return apiClient.put(link, permission, "application/vnd.scmm-repositoryPermission+json");
1911
+ }, {
1912
+ onSuccess: () => {
1913
+ const queryKey = createQueryKey(namespaceOrRepository);
1914
+ return queryClient2.invalidateQueries(queryKey);
1915
+ }
1916
+ });
1917
+ return {
1918
+ isLoading,
1919
+ error,
1920
+ update: (permission) => mutate(permission),
1921
+ isUpdated: !!data
1922
+ };
1923
+ };
1924
+ var useDeletePermission = (namespaceOrRepository) => {
1925
+ const queryClient2 = (0, import_react_query16.useQueryClient)();
1926
+ const { isLoading, error, mutate, data } = (0, import_react_query16.useMutation)((permission) => {
1927
+ const link = requiredLink(permission, "delete");
1928
+ return apiClient.delete(link);
1929
+ }, {
1930
+ onSuccess: () => {
1931
+ const queryKey = createQueryKey(namespaceOrRepository);
1932
+ return queryClient2.invalidateQueries(queryKey);
1933
+ }
1934
+ });
1935
+ return {
1936
+ isLoading,
1937
+ error,
1938
+ remove: (permission) => mutate(permission),
1939
+ isDeleted: !!data
1940
+ };
1941
+ };
1942
+ var userPermissionsKey = (user) => ["user", user.name, "permissions"];
1943
+ var groupPermissionsKey = (group) => ["group", group.name, "permissions"];
1944
+ var useGroupPermissions = (group) => useJsonResource(group, "permissions", groupPermissionsKey(group));
1945
+ var useUserPermissions = (user) => useJsonResource(user, "permissions", userPermissionsKey(user));
1946
+ var useAvailableGlobalPermissions = () => useIndexJsonResource("permissions");
1947
+ var useSetEntityPermissions = (permissionCollection, key) => {
1948
+ const queryClient2 = (0, import_react_query16.useQueryClient)();
1949
+ const url = permissionCollection ? objectLink(permissionCollection, "overwrite") : null;
1950
+ const { isLoading, error, mutate, data } = (0, import_react_query16.useMutation)((permissions) => apiClient.put(url, {
1951
+ permissions
1952
+ }, "application/vnd.scmm-permissionCollection+json;v=2"), {
1953
+ onSuccess: () => queryClient2.invalidateQueries(key)
1954
+ });
1955
+ const setPermissions = (permissions) => mutate(permissions);
1956
+ return {
1957
+ isLoading,
1958
+ error,
1959
+ setPermissions: url ? setPermissions : void 0,
1960
+ isUpdated: !!data
1961
+ };
1962
+ };
1963
+ var useSetUserPermissions = (user, permissions) => useSetEntityPermissions(permissions, userPermissionsKey(user));
1964
+ var useSetGroupPermissions = (group, permissions) => useSetEntityPermissions(permissions, groupPermissionsKey(group));
1965
+
1966
+ // src/sources.ts
1967
+ var import_react_query17 = require("react-query");
1968
+ var import_react5 = require("react");
1969
+ var UseSourcesDefaultOptions = {
1970
+ enabled: true,
1971
+ refetchPartialInterval: 3e3,
1972
+ collapse: true
1973
+ };
1974
+ var useSources = (repository, opts = UseSourcesDefaultOptions) => {
1975
+ const options = __spreadValues(__spreadValues({}, UseSourcesDefaultOptions), opts);
1976
+ const link = createSourcesLink(repository, options);
1977
+ const { isLoading, error, data, isFetchingNextPage, fetchNextPage, refetch } = (0, import_react_query17.useInfiniteQuery)(repoQueryKey(repository, "sources", options.revision || "", options.path || "", options.collapse ? "collapse" : ""), ({ pageParam }) => {
1978
+ return apiClient.get(pageParam || link).then((response) => response.json());
1979
+ }, {
1980
+ enabled: options.enabled,
1981
+ getNextPageParam: (lastPage) => {
1982
+ var _a;
1983
+ return (_a = lastPage._links.proceed) == null ? void 0 : _a.href;
1984
+ }
1985
+ });
1986
+ const file = merge(data == null ? void 0 : data.pages);
1987
+ (0, import_react5.useEffect)(() => {
1988
+ const intervalId = setInterval(() => {
1989
+ if (isPartial(file)) {
1990
+ refetch({
1991
+ throwOnError: true
1992
+ });
1993
+ }
1994
+ }, options.refetchPartialInterval);
1995
+ return () => clearInterval(intervalId);
1996
+ }, [options.refetchPartialInterval, file, refetch]);
1997
+ return {
1998
+ isLoading,
1999
+ error,
2000
+ data: file,
2001
+ isFetchingNextPage,
2002
+ fetchNextPage: () => {
2003
+ fetchNextPage();
2004
+ }
2005
+ };
2006
+ };
2007
+ var createSourcesLink = (repository, options) => {
2008
+ let link = requiredLink(repository, "sources");
2009
+ if (options.revision) {
2010
+ link = concat(link, encodeURIComponent(options.revision));
2011
+ if (options.path) {
2012
+ link = concat(link, options.path);
2013
+ }
2014
+ }
2015
+ if (options.collapse) {
2016
+ return `${link}?${createQueryString({ collapse: "true" })}`;
2017
+ }
2018
+ return link;
2019
+ };
2020
+ var merge = (files) => {
2021
+ var _a;
2022
+ if (!files || files.length === 0) {
2023
+ return;
2024
+ }
2025
+ const children = [];
2026
+ for (const page of files) {
2027
+ children.push(...((_a = page._embedded) == null ? void 0 : _a.children) || []);
2028
+ }
2029
+ const lastPage = files[files.length - 1];
2030
+ return __spreadProps(__spreadValues({}, lastPage), {
2031
+ _embedded: __spreadProps(__spreadValues({}, lastPage._embedded), {
2032
+ children
2033
+ })
2034
+ });
2035
+ };
2036
+ var isFilePartial = (f) => {
2037
+ return f.partialResult && !f.computationAborted;
2038
+ };
2039
+ var isPartial = (file) => {
2040
+ var _a, _b;
2041
+ if (!file) {
2042
+ return false;
2043
+ }
2044
+ if (isFilePartial(file)) {
2045
+ return true;
2046
+ }
2047
+ return (_b = (_a = file._embedded) == null ? void 0 : _a.children) == null ? void 0 : _b.some(isFilePartial);
2048
+ };
2049
+
2050
+ // src/import.ts
2051
+ var import_react_query18 = require("react-query");
2052
+ var useImportLog = (logId) => {
2053
+ const link = useRequiredIndexLink("importLog").replace("{logId}", logId);
2054
+ return (0, import_react_query18.useQuery)(["importLog", logId], () => apiClient.get(link).then((response) => response.text()));
2055
+ };
2056
+ var useImportRepositoryFromUrl = (repositoryType) => {
2057
+ const url = requiredLink(repositoryType, "import", "url");
2058
+ const { isLoading, error, data, mutate } = (0, import_react_query18.useMutation)((repo) => apiClient.post(url, repo, "application/vnd.scmm-repository+json;v=2").then(fetchResourceFromLocationHeader).then(getResponseJson));
2059
+ return {
2060
+ isLoading,
2061
+ error,
2062
+ importRepositoryFromUrl: (repository) => mutate(repository),
2063
+ importedRepository: data
2064
+ };
2065
+ };
2066
+ var importRepository = (url, repository, file, password) => {
2067
+ return apiClient.postBinary(url, (formData) => {
2068
+ formData.append("bundle", file, file.name);
2069
+ formData.append("repository", JSON.stringify(__spreadProps(__spreadValues({}, repository), { password })));
2070
+ }).then(fetchResourceFromLocationHeader).then(getResponseJson);
2071
+ };
2072
+ var useImportRepositoryFromBundle = (repositoryType) => {
2073
+ const url = requiredLink(repositoryType, "import", "bundle");
2074
+ const { isLoading, error, data, mutate } = (0, import_react_query18.useMutation)(({ repository, file, compressed, password }) => importRepository(compressed ? url + "?compressed=true" : url, repository, file, password));
2075
+ return {
2076
+ isLoading,
2077
+ error,
2078
+ importRepositoryFromBundle: (repository, file, compressed, password) => mutate({
2079
+ repository,
2080
+ file,
2081
+ compressed,
2082
+ password
2083
+ }),
2084
+ importedRepository: data
2085
+ };
2086
+ };
2087
+ var useImportFullRepository = (repositoryType) => {
2088
+ const { isLoading, error, data, mutate } = (0, import_react_query18.useMutation)(({ repository, file, password }) => importRepository(requiredLink(repositoryType, "import", "fullImport"), repository, file, password));
2089
+ return {
2090
+ isLoading,
2091
+ error,
2092
+ importFullRepository: (repository, file, password) => mutate({
2093
+ repository,
2094
+ file,
2095
+ password
2096
+ }),
2097
+ importedRepository: data
2098
+ };
2099
+ };
2100
+
2101
+ // src/diff.ts
2102
+ var import_gitdiff_parser = __toESM(require("gitdiff-parser"));
2103
+ var import_react_query19 = require("react-query");
2104
+ var defaultOptions = {
2105
+ refetchOnWindowFocus: true
2106
+ };
2107
+ var useDiff = (link, options = defaultOptions) => {
2108
+ let initialLink = link;
2109
+ if (options.limit) {
2110
+ const separator = initialLink.includes("?") ? "&" : "?";
2111
+ initialLink = `${initialLink}${separator}limit=${options.limit}`;
2112
+ }
2113
+ const { isLoading, error, data, isFetchingNextPage, fetchNextPage } = (0, import_react_query19.useInfiniteQuery)(["link", link], ({ pageParam }) => {
2114
+ return apiClient.get(pageParam || initialLink).then((response) => {
2115
+ const contentType = response.headers.get("Content-Type");
2116
+ if (contentType && contentType.toLowerCase() === "application/vnd.scmm-diffparsed+json;v=2") {
2117
+ return response.json();
2118
+ } else {
2119
+ return response.text().then(import_gitdiff_parser.default.parse).then((parsedGit) => {
2120
+ return {
2121
+ files: parsedGit,
2122
+ partial: false,
2123
+ _links: {}
2124
+ };
2125
+ });
2126
+ }
2127
+ });
2128
+ }, {
2129
+ getNextPageParam: (lastPage) => {
2130
+ var _a;
2131
+ return (_a = lastPage._links.next) == null ? void 0 : _a.href;
2132
+ },
2133
+ refetchOnWindowFocus: options.refetchOnWindowFocus
2134
+ });
2135
+ return {
2136
+ isLoading,
2137
+ error,
2138
+ isFetchingNextPage,
2139
+ fetchNextPage: () => {
2140
+ fetchNextPage();
2141
+ },
2142
+ data: merge2(data == null ? void 0 : data.pages)
2143
+ };
2144
+ };
2145
+ var merge2 = (diffs) => {
2146
+ if (!diffs || diffs.length === 0) {
2147
+ return;
2148
+ }
2149
+ const joinedFiles = diffs.flatMap((diff) => diff.files);
2150
+ return __spreadProps(__spreadValues({}, diffs[diffs.length - 1]), {
2151
+ files: joinedFiles
2152
+ });
2153
+ };
2154
+
2155
+ // src/notifications.ts
2156
+ var import_react_query20 = require("react-query");
2157
+ var import_react6 = require("react");
2158
+ var useNotifications = () => {
2159
+ var _a;
2160
+ const { data: me } = useMe();
2161
+ const link = (_a = me == null ? void 0 : me._links["notifications"]) == null ? void 0 : _a.href;
2162
+ const { data, error, isLoading, refetch } = (0, import_react_query20.useQuery)("notifications", () => apiClient.get(link).then((response) => response.json()), {
2163
+ enabled: !!link
2164
+ });
2165
+ const memoizedRefetch = (0, import_react6.useCallback)(() => {
2166
+ return refetch().then((r) => r.data);
2167
+ }, [refetch]);
2168
+ return {
2169
+ data,
2170
+ error,
2171
+ isLoading,
2172
+ refetch: memoizedRefetch
2173
+ };
2174
+ };
2175
+ var useDismissNotification = (notification) => {
2176
+ const queryClient2 = (0, import_react_query20.useQueryClient)();
2177
+ const link = requiredLink(notification, "dismiss");
2178
+ const { data, isLoading, error, mutate } = (0, import_react_query20.useMutation)(() => apiClient.delete(link), {
2179
+ onSuccess: () => {
2180
+ queryClient2.invalidateQueries("notifications");
2181
+ }
2182
+ });
2183
+ return {
2184
+ isLoading,
2185
+ error,
2186
+ dismiss: () => mutate(),
2187
+ isCleared: !!data
2188
+ };
2189
+ };
2190
+ var useClearNotifications = (notificationCollection) => {
2191
+ const queryClient2 = (0, import_react_query20.useQueryClient)();
2192
+ const link = requiredLink(notificationCollection, "clear");
2193
+ const { data, isLoading, error, mutate } = (0, import_react_query20.useMutation)(() => apiClient.delete(link), {
2194
+ onSuccess: () => {
2195
+ queryClient2.invalidateQueries("notifications");
2196
+ }
2197
+ });
2198
+ return {
2199
+ isLoading,
2200
+ error,
2201
+ clear: () => mutate(),
2202
+ isCleared: !!data
2203
+ };
2204
+ };
2205
+ var isEqual = (left, right) => {
2206
+ return left === right || left.message === right.message && left.createdAt === right.createdAt;
2207
+ };
2208
+ var useNotificationSubscription = (refetch, notificationCollection) => {
2209
+ var _a;
2210
+ const [notifications, setNotifications] = (0, import_react6.useState)([]);
2211
+ const [disconnectedAt, setDisconnectedAt] = (0, import_react6.useState)();
2212
+ const link = (_a = notificationCollection == null ? void 0 : notificationCollection._links.subscribe) == null ? void 0 : _a.href;
2213
+ const onVisible = (0, import_react6.useCallback)(() => {
2214
+ refetch().then((collection) => {
2215
+ var _a2;
2216
+ if (collection) {
2217
+ const newNotifications = (_a2 = collection._embedded) == null ? void 0 : _a2.notifications.filter((n) => {
2218
+ return disconnectedAt && disconnectedAt < new Date(n.createdAt);
2219
+ });
2220
+ if (newNotifications && newNotifications.length > 0) {
2221
+ setNotifications((previous) => [...previous, ...newNotifications]);
2222
+ }
2223
+ setDisconnectedAt(void 0);
2224
+ }
2225
+ });
2226
+ }, [disconnectedAt, refetch]);
2227
+ const onHide = (0, import_react6.useCallback)(() => {
2228
+ setDisconnectedAt(new Date());
2229
+ }, []);
2230
+ const received = (0, import_react6.useCallback)((notification) => {
2231
+ setNotifications((previous) => [...previous, notification]);
2232
+ refetch();
2233
+ }, [refetch]);
2234
+ (0, import_react6.useEffect)(() => {
2235
+ if (link) {
2236
+ let cancel;
2237
+ const disconnect = () => {
2238
+ if (cancel) {
2239
+ cancel();
2240
+ }
2241
+ };
2242
+ const connect = () => {
2243
+ disconnect();
2244
+ cancel = apiClient.subscribe(link, {
2245
+ notification: (event) => {
2246
+ received(JSON.parse(event.data));
2247
+ }
2248
+ });
2249
+ };
2250
+ const handleVisibilityChange = () => {
2251
+ if (document.visibilityState === "visible") {
2252
+ onVisible();
2253
+ } else {
2254
+ onHide();
2255
+ }
2256
+ };
2257
+ if (document.visibilityState === "visible") {
2258
+ connect();
2259
+ }
2260
+ document.addEventListener("visibilitychange", handleVisibilityChange);
2261
+ return () => {
2262
+ disconnect();
2263
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
2264
+ };
2265
+ }
2266
+ }, [link, onVisible, onHide, received]);
2267
+ const remove = (0, import_react6.useCallback)((notification) => {
2268
+ setNotifications((oldNotifications) => [...oldNotifications.filter((n) => !isEqual(n, notification))]);
2269
+ }, [setNotifications]);
2270
+ const clear = (0, import_react6.useCallback)(() => {
2271
+ setNotifications([]);
2272
+ }, [setNotifications]);
2273
+ return {
2274
+ notifications,
2275
+ remove,
2276
+ clear
2277
+ };
2278
+ };
2279
+
2280
+ // src/alerts.ts
2281
+ var import_react_query21 = require("react-query");
2282
+ var alertsFromStorage = () => {
2283
+ const item = localStorage.getItem("alerts");
2284
+ if (item) {
2285
+ return JSON.parse(item);
2286
+ }
2287
+ };
2288
+ var fetchAlerts = (request) => {
2289
+ var _a;
2290
+ const url = (_a = request._links["alerts"]) == null ? void 0 : _a.href;
2291
+ if (!url) {
2292
+ throw new Error("no alerts link defined");
2293
+ }
2294
+ return fetch(url, {
2295
+ method: "POST",
2296
+ headers: {
2297
+ "Content-Type": "application/json"
2298
+ },
2299
+ body: JSON.stringify(request.body)
2300
+ }).then((response) => {
2301
+ if (!response.ok) {
2302
+ throw new Error("Failed to fetch alerts");
2303
+ }
2304
+ return response;
2305
+ }).then((response) => response.json()).then((data) => {
2306
+ const storageItem = __spreadProps(__spreadValues({}, data), {
2307
+ checksum: request.checksum
2308
+ });
2309
+ localStorage.setItem("alerts", JSON.stringify(storageItem));
2310
+ return data;
2311
+ });
2312
+ };
2313
+ var restoreOrFetch = (request) => {
2314
+ const storedAlerts = alertsFromStorage();
2315
+ if (!storedAlerts || storedAlerts.checksum !== request.checksum) {
2316
+ return fetchAlerts(request);
2317
+ }
2318
+ return Promise.resolve(storedAlerts);
2319
+ };
2320
+ var useAlerts = () => {
2321
+ const link = useIndexLink("alerts");
2322
+ const { data, error, isLoading } = (0, import_react_query21.useQuery)("alerts", () => {
2323
+ if (!link) {
2324
+ throw new Error("Could not find alert link");
2325
+ }
2326
+ return apiClient.get(link).then((response) => response.json()).then(restoreOrFetch);
2327
+ }, {
2328
+ enabled: !!link,
2329
+ staleTime: Infinity
2330
+ });
2331
+ return {
2332
+ data,
2333
+ error,
2334
+ isLoading
2335
+ };
2336
+ };
2337
+
2338
+ // src/configLink.ts
2339
+ var import_react_query22 = require("react-query");
2340
+ var import_react7 = require("react");
2341
+ var useConfigLink = (link) => {
2342
+ const queryClient2 = (0, import_react_query22.useQueryClient)();
2343
+ const queryKey = ["configLink", link];
2344
+ const { isLoading, error, data } = (0, import_react_query22.useQuery)(queryKey, () => apiClient.get(link).then((response) => {
2345
+ const contentType = response.headers.get("Content-Type") || "application/json";
2346
+ return response.json().then((configuration) => ({ configuration, contentType }));
2347
+ }));
2348
+ const {
2349
+ isLoading: isUpdating,
2350
+ error: mutationError,
2351
+ mutate,
2352
+ data: updateResponse
2353
+ } = (0, import_react_query22.useMutation)((vars) => apiClient.put(vars.link, vars.configuration, vars.contentType), {
2354
+ onSuccess: async () => {
2355
+ await queryClient2.invalidateQueries(queryKey);
2356
+ }
2357
+ });
2358
+ const isReadOnly = !(data == null ? void 0 : data.configuration._links.update);
2359
+ const update = (0, import_react7.useCallback)((configuration) => {
2360
+ if (data && !isReadOnly) {
2361
+ mutate({
2362
+ configuration,
2363
+ contentType: data.contentType,
2364
+ link: data.configuration._links.update.href
2365
+ });
2366
+ }
2367
+ }, [mutate, data, isReadOnly]);
2368
+ return {
2369
+ isLoading,
2370
+ isUpdating,
2371
+ isReadOnly,
2372
+ error: error || mutationError,
2373
+ initialConfiguration: data == null ? void 0 : data.configuration,
2374
+ update,
2375
+ isUpdated: !!updateResponse
2376
+ };
2377
+ };
2378
+
2379
+ // src/apiKeys.ts
2380
+ var import_react_query23 = require("react-query");
2381
+ var CONTENT_TYPE_API_KEY = "application/vnd.scmm-apiKey+json;v=2";
2382
+ var useApiKeys = (user) => (0, import_react_query23.useQuery)(["user", user.name, "apiKeys"], () => apiClient.get(requiredLink(user, "apiKeys")).then((r) => r.json()));
2383
+ var createApiKey = (link) => async (key) => {
2384
+ const creationResponse = await apiClient.post(link, key, CONTENT_TYPE_API_KEY);
2385
+ const location = creationResponse.headers.get("Location");
2386
+ if (!location) {
2387
+ throw new Error("Server does not return required Location header");
2388
+ }
2389
+ const locationResponse = await apiClient.get(location);
2390
+ const [apiKey, token] = await Promise.all([locationResponse.json(), creationResponse.text()]);
2391
+ return __spreadProps(__spreadValues({}, apiKey), { token });
2392
+ };
2393
+ var useCreateApiKey = (user, apiKeys) => {
2394
+ const queryClient2 = (0, import_react_query23.useQueryClient)();
2395
+ const { mutate, data, isLoading, error, reset: reset2 } = (0, import_react_query23.useMutation)(createApiKey(requiredLink(apiKeys, "create")), {
2396
+ onSuccess: () => queryClient2.invalidateQueries(["user", user.name, "apiKeys"])
2397
+ });
2398
+ return {
2399
+ create: (key) => mutate(key),
2400
+ isLoading,
2401
+ error,
2402
+ apiKey: data,
2403
+ reset: reset2
2404
+ };
2405
+ };
2406
+ var useDeleteApiKey = (user) => {
2407
+ const queryClient2 = (0, import_react_query23.useQueryClient)();
2408
+ const { mutate, isLoading, error, data } = (0, import_react_query23.useMutation)((apiKey) => {
2409
+ const deleteUrl = requiredLink(apiKey, "delete");
2410
+ return apiClient.delete(deleteUrl);
2411
+ }, {
2412
+ onSuccess: () => queryClient2.invalidateQueries(["user", user.name, "apiKeys"])
2413
+ });
2414
+ return {
2415
+ remove: (apiKey) => mutate(apiKey),
2416
+ isLoading,
2417
+ error,
2418
+ isDeleted: !!data
2419
+ };
2420
+ };
2421
+
2422
+ // src/publicKeys.ts
2423
+ var import_react_query24 = require("react-query");
2424
+ var CONTENT_TYPE_PUBLIC_KEY = "application/vnd.scmm-publicKey+json;v=2";
2425
+ var usePublicKeys = (user) => (0, import_react_query24.useQuery)(["user", user.name, "publicKeys"], () => apiClient.get(requiredLink(user, "publicKeys")).then((r) => r.json()));
2426
+ var createPublicKey = (link) => async (key) => {
2427
+ const creationResponse = await apiClient.post(link, key, CONTENT_TYPE_PUBLIC_KEY);
2428
+ const location = creationResponse.headers.get("Location");
2429
+ if (!location) {
2430
+ throw new Error("Server does not return required Location header");
2431
+ }
2432
+ const apiKeyResponse = await apiClient.get(location);
2433
+ return apiKeyResponse.json();
2434
+ };
2435
+ var useCreatePublicKey = (user, publicKeys) => {
2436
+ const queryClient2 = (0, import_react_query24.useQueryClient)();
2437
+ const { mutate, data, isLoading, error, reset: reset2 } = (0, import_react_query24.useMutation)(createPublicKey(requiredLink(publicKeys, "create")), {
2438
+ onSuccess: () => queryClient2.invalidateQueries(["user", user.name, "publicKeys"])
2439
+ });
2440
+ return {
2441
+ create: (key) => mutate(key),
2442
+ isLoading,
2443
+ error,
2444
+ apiKey: data,
2445
+ reset: reset2
2446
+ };
2447
+ };
2448
+ var useDeletePublicKey = (user) => {
2449
+ const queryClient2 = (0, import_react_query24.useQueryClient)();
2450
+ const { mutate, isLoading, error, data } = (0, import_react_query24.useMutation)((publicKey) => {
2451
+ const deleteUrl = requiredLink(publicKey, "delete");
2452
+ return apiClient.delete(deleteUrl);
2453
+ }, {
2454
+ onSuccess: () => queryClient2.invalidateQueries(["user", user.name, "publicKeys"])
2455
+ });
2456
+ return {
2457
+ remove: (publicKey) => mutate(publicKey),
2458
+ isLoading,
2459
+ error,
2460
+ isDeleted: !!data
2461
+ };
2462
+ };
2463
+
2464
+ // src/fileContent.ts
2465
+ var import_react_query25 = require("react-query");
2466
+ var useFileContent = (file) => {
2467
+ const selfLink = requiredLink(file, "self");
2468
+ return (0, import_react_query25.useQuery)(["fileContent", selfLink], () => apiClient.get(selfLink).then((response) => response.text()));
2469
+ };
2470
+
2471
+ // src/history.ts
2472
+ var import_react_query26 = require("react-query");
2473
+ var useHistory = (repository, revision, file, request) => {
2474
+ const queryClient2 = (0, import_react_query26.useQueryClient)();
2475
+ const link = file._links.history.href;
2476
+ const queryParams = {};
2477
+ if (request == null ? void 0 : request.page) {
2478
+ queryParams.page = request.page.toString();
2479
+ }
2480
+ return (0, import_react_query26.useQuery)(repoQueryKey(repository, "history", revision, file.path, (request == null ? void 0 : request.page) || 0), () => apiClient.get(`${link}?${createQueryString(queryParams)}`).then((response) => response.json()), {
2481
+ keepPreviousData: true,
2482
+ onSuccess: (changesets) => {
2483
+ var _a;
2484
+ (_a = changesets._embedded) == null ? void 0 : _a.changesets.forEach((changeset) => queryClient2.setQueryData(changesetQueryKey(repository, changeset.id), changeset));
2485
+ }
2486
+ });
2487
+ };
2488
+
2489
+ // src/contentType.ts
2490
+ var import_react_query27 = require("react-query");
2491
+ function getContentType(url) {
2492
+ return apiClient.head(url).then((response) => {
2493
+ return {
2494
+ type: response.headers.get("Content-Type") || "application/octet-stream",
2495
+ language: response.headers.get("X-Programming-Language") || void 0,
2496
+ aceMode: response.headers.get("X-Syntax-Mode-Ace") || void 0,
2497
+ codemirrorMode: response.headers.get("X-Syntax-Mode-Codemirror") || void 0,
2498
+ prismMode: response.headers.get("X-Syntax-Mode-Prism") || void 0
2499
+ };
2500
+ });
2501
+ }
2502
+ var useContentType = (url) => {
2503
+ const { isLoading, isFetching, error, data } = (0, import_react_query27.useQuery)(["contentType", url], () => getContentType(url));
2504
+ return {
2505
+ isLoading,
2506
+ isFetching,
2507
+ error,
2508
+ data
2509
+ };
2510
+ };
2511
+
2512
+ // src/annotations.ts
2513
+ var import_react_query28 = require("react-query");
2514
+ var useAnnotations = (repository, revision, file) => {
2515
+ const { isLoading, isFetching, error, data } = (0, import_react_query28.useQuery)(repoQueryKey(repository, "annotations", revision, file.path), () => apiClient.get(file._links.annotate.href).then((response) => response.json()));
2516
+ return {
2517
+ isLoading,
2518
+ isFetching,
2519
+ error,
2520
+ data
2521
+ };
2522
+ };
2523
+
2524
+ // src/search.ts
2525
+ var import_react_query29 = require("react-query");
2526
+ var import_react8 = require("react");
2527
+
2528
+ // src/help/search/syntax.en.ts
2529
+ var syntax_en_default = `### Modifiers
2530
+
2531
+ Note: You can not use wildcards as the first character of a search.
2532
+
2533
+ <table>
2534
+ <tr>
2535
+ <th>Definition</th>
2536
+ <th>Example</th>
2537
+ </tr>
2538
+ <tr>
2539
+ <td>? - single character Wildcard</td>
2540
+ <td>Ultimate?Repo \u2013 finds e.g. Ultimate-Repo, Ultimate Repo, Ultimate+Repo</td>
2541
+ </tr>
2542
+ <tr>
2543
+ <td>* - multiple character Wildcard</td>
2544
+ <td>Ultimat*y - finds e.g. Ultimate Repository, Ultimate-Special-Repository, Ultimately</td>
2545
+ </tr>
2546
+ </table>
2547
+
2548
+
2549
+ ### Ranges
2550
+
2551
+ Range Queries allow one to match documents whose field(s) values are between the lower and upper bound specified by the Range Query. Range Queries can be inclusive or exclusive of the upper and lower bounds. Sorting is done lexicographically.
2552
+
2553
+ Ranges are not reserved to numerical fields.
2554
+
2555
+ <table>
2556
+ <tr>
2557
+ <th>Definition</th>
2558
+ <th>Example</th>
2559
+ </tr>
2560
+ <tr>
2561
+ <td>[ \u2026 TO \u2026 ] - inclusive range</td>
2562
+ <td>creationDate:[1609459200000 TO 1612137600000] \u2013 finds e.G. repositories created between 2021-01-01 and 2021-02-01 </td>
2563
+ </tr>
2564
+ <tr>
2565
+ <td>{\u2026 TO \u2026} - exclusive range</td>
2566
+ <td>name:{Aida TO Carmen} \u2013 finds e.G. repositories with names between Aida and Carmen, excluding these to values.</td>
2567
+ </tr>
2568
+ </table>
2569
+
2570
+
2571
+ ### Boosting
2572
+
2573
+ Boosting allows you to control the relevance of a document by boosting its term.
2574
+
2575
+ <table>
2576
+ <tr>
2577
+ <th>Definition</th>
2578
+ <th>Example</th>
2579
+ </tr>
2580
+ <tr>
2581
+ <td>term^number</td>
2582
+ <td>ultimate^2 repository \u2013 makes the term "ultimate" more relevant. </td>
2583
+ </tr>
2584
+ </table>
2585
+
2586
+
2587
+ By default, the boost factor is 1. Although the boost factor must be positive, it can be less than 1 (e.g. 0.2)
2588
+
2589
+ By default Repository names are boosted by 1.5, namespace by 1.25.
2590
+
2591
+ ## Boolean Operators
2592
+
2593
+ Note: Logical Operators must be entered in upper case (e.g. "AND").
2594
+
2595
+ <table>
2596
+ <tr>
2597
+ <th>Definition</th>
2598
+ <th>Example</th>
2599
+ </tr>
2600
+ <tr>
2601
+ <td>AND \u2013 both terms must be included</td>
2602
+ <td>Ultimate AND Repository \u2013 finds e.g. Ultimate Repository, Ultimate Special Repository</td>
2603
+ </tr>
2604
+ <tr>
2605
+ <td>OR \u2013 at least one of the terms must be included</td>
2606
+ <td>Ultimate OR Repository \u2013 finds e.g. Ultimate Repository, Ultimate User, Special Repository</td>
2607
+ </tr>
2608
+ <tr>
2609
+ <td>NOT \u2013 following term may not be included, "!" may be used alternatively</td>
2610
+ <td>Ultimate NOT Repository \u2013 finds e.g. Ultimate user, excludes e.g. Ultimate Repository</td>
2611
+ </tr>
2612
+ <tr>
2613
+ <td>\u2013 excludes following term from search</td>
2614
+ <td>Ultimate Repository -Special \u2013 finds e.g. Ultimate Repository, excludes e.g. Ultimate Special Repository</td>
2615
+ </tr>
2616
+ <tr>
2617
+ <td>\u2013 following term must be included</td>
2618
+ <td>Ultimate +Repository \u2013 finds e.g. my Repository, Ultimate Repository</td>
2619
+ </tr>
2620
+ </table>
2621
+
2622
+
2623
+ ## Grouping
2624
+
2625
+ Search supports using parentheses to group clauses to form sub queries. This can be very useful if you want to control the boolean logic for a query.
2626
+
2627
+ <table>
2628
+ <tr>
2629
+ <th>Definition</th>
2630
+ <th>Example</th>
2631
+ </tr>
2632
+ <tr>
2633
+ <td>() \u2013 terms inside parentheses are grouped together</td>
2634
+ <td>(Ultimate OR my) AND Repository \u2013 finds e.g. Ultimate Repository, my Repository, excludes e.g. Super Repository. Either "Ultimate" or \u201CMy\u201D must exist, \u201CRepository\u201D must always exist.
2635
+ </td>
2636
+ </tr>
2637
+ </table>
2638
+
2639
+
2640
+ ## Escaping Special Characters
2641
+
2642
+ The search supports escaping special characters that are part of the query syntax. The current list special characters are
2643
+
2644
+ &plus; &minus; && || ! ( ) { } [ ] ^ " ~ * ? : &bsol; /
2645
+
2646
+ To escape these characters use the "&bsol;" before the character. For example to search for (1+1):2 use the query:
2647
+
2648
+ &bsol;(1&bsol;+1&bsol;)&bsol;:2
2649
+
2650
+ Source: [https://javadoc.io/static/org.apache.lucene/lucene-queryparser/8.9.0/org/apache/lucene/queryparser/classic/package-summary.html#package.description](https://javadoc.io/static/org.apache.lucene/lucene-queryparser/8.9.0/org/apache/lucene/queryparser/classic/package-summary.html#package.description)`;
2651
+
2652
+ // src/help/search/syntax.de.ts
2653
+ var syntax_de_default = `## Modifikatoren
2654
+
2655
+ Hinweis: Sie k\xF6nnen keine Wildcards als erstes Zeichen einer Suche verwenden.
2656
+
2657
+ <table>
2658
+ <tr>
2659
+ <th>Definition</th>
2660
+ <th>Beispiel</th>
2661
+ </tr>
2662
+ <tr>
2663
+ <td>? - Einzelzeichen-Wildcard</td>
2664
+ <td>Ultimate?Repo - findet z.B. Ultimate-Repo, Ultimate Repo, Ultimate+Repo</td>
2665
+ </tr>
2666
+ <tr>
2667
+ <td>* - mehrstelliger Platzhalter</td>
2668
+ <td>Ultimat*y - findet z.B. Ultimate Repository, Ultimates-Spezial-Repository, Ultimate</td>
2669
+ </tr>
2670
+ </table>
2671
+
2672
+
2673
+ ### Bereiche
2674
+
2675
+ Bereichsabfragen erm\xF6glichen den Abgleich von Dokumenten, deren Feldwerte zwischen der unteren und der oberen Grenze liegen, die in der Bereichsabfrage angegeben sind. Bereichsabfragen k\xF6nnen die obere und untere Grenze einschlie\xDFen oder ausschlie\xDFen. Die Sortierung erfolgt lexikografisch.
2676
+
2677
+ Bereiche sind nicht auf numerische Felder beschr\xE4nkt.
2678
+
2679
+ <table>
2680
+ <tr>
2681
+ <th>Definition</th>
2682
+ <th>Beispiel</th>
2683
+ </tr>
2684
+ <tr>
2685
+ <td>[ \u2026 TO \u2026 ] - inklusiver Bereich</td>
2686
+ <td>creationDate:[1609459200000 TO 1612137600000] \u2013 findet z.B. Repositories, die zwischen dem 01.01.2021 und dem 01.02.2021 angelegt wurden.</td>
2687
+ </tr>
2688
+ <tr>
2689
+ <td>{\u2026 TO \u2026} - ausschlie\xDFender Bereich</td>
2690
+ <td>name:{Aida TO Carmen} \u2013 findet Namen zwischen Aida und Carmen, jedoch ohne die beiden Namen einzuschlie\xDFen.</td>
2691
+ </tr>
2692
+ </table>
2693
+
2694
+
2695
+ ## Boosten
2696
+
2697
+ Mit dem Boosting k\xF6nnen Sie die Relevanz eines Dokuments steuern, indem Sie seinen Term verst\xE4rken.
2698
+
2699
+ <table>
2700
+ <tr>
2701
+ <th>Definition</th>
2702
+ <th>Beispiel</th>
2703
+ </tr>
2704
+ <tr>
2705
+ <td>term^Zahl</td>
2706
+ <td>ultimate^2 repository \u2013 erh\xF6ht die Relevanz von \u201Eultimate"</td>
2707
+ </tr>
2708
+ </table>
2709
+
2710
+
2711
+ Standardm\xE4\xDFig ist der Boost-Faktor 1. Obwohl der Boost-Faktor positiv sein muss, kann er kleiner als 1 sein (z. B. 0,2)
2712
+
2713
+ Standardm\xE4\xDFig werden Repository-Namen um 1,5 und Namespace-Namen um 1,25 geboostet.
2714
+
2715
+ ## Boolesche Operatoren
2716
+
2717
+ Hinweis: Logische Operatoren m\xFCssen in Gro\xDFbuchstaben eingegeben werden (z. B. \u201EAND").
2718
+
2719
+ <table>
2720
+ <tr>
2721
+ <th>Definition</th>
2722
+ <th>Beispiel</th>
2723
+ </tr>
2724
+ <tr>
2725
+ <td>AND \u2013 beide Terme m\xFCssen enthalten sein</td>
2726
+ <td>Ultimate AND Repository \u2013 findet z.B. Ultimate Repository, Ultimate Special Repository
2727
+ </td>
2728
+ </tr>
2729
+ <tr>
2730
+ <td>OR \u2013 mindestens einer der Terme muss enthalten sein</td>
2731
+ <td>Ultimate OR Repository \u2013 findet z.B.. Ultimate Repository, Ultimate User, Special Repository</td>
2732
+ </tr>
2733
+ <tr>
2734
+ <td>NOT \u2013 der nachfolgende Term darf nicht enthalten sein. \u201E!" kann alternativ verwendet werden.</td>
2735
+ <td>Ultimate NOT Repository \u2013 findet z.B.. Ultimate user, nicht jedoch z.B. Ultimate Repository</td>
2736
+ </tr>
2737
+ <tr>
2738
+ <td>\u2013 schlie\xDFt den folgenden Term von der Suche aus</td>
2739
+ <td>Ultimate Repository -Special \u2013 findet z.B. Ultimate Repository, schlie\xDFt z.B. Ultimate Special Repository aus</td>
2740
+ </tr>
2741
+ <tr>
2742
+ <td>\u2013 der folgende Term muss enthalten sein</td>
2743
+ <td>Ultimate +Repository \u2013 findet z.B. my Repository, Ultimate Repository</td>
2744
+ </tr>
2745
+ </table>
2746
+
2747
+
2748
+ ## Gruppieren
2749
+
2750
+ Die Suche unterst\xFCtzt die Verwendung von Klammern zur Gruppierung von Begriffen, um Teilabfragen zu bilden. Dies kann sehr n\xFCtzlich sein, wenn Sie die boolesche Logik f\xFCr eine Abfrage steuern m\xF6chten.
2751
+
2752
+ <table>
2753
+ <tr>
2754
+ <th>Definition</th>
2755
+ <th>Beispiel</th>
2756
+ </tr>
2757
+ <tr>
2758
+ <td>() \u2013 Terme zwischen den Klammern werden gruppiert</td>
2759
+ <td>(Ultimate OR my) AND Repository \u2013 findet z.B.. Ultimate Repository, my Repository, schlie\xDFt z.B. Super Repository. Entweder "Ultimate" oder \u201CMy\u201D m\xFCssen im Ergebnis existieren, \u201CRepository\u201D muss immer enthalten sein.
2760
+ </td>
2761
+ </tr>
2762
+ </table>
2763
+
2764
+
2765
+ ## Umgang mit Sonderzeichen
2766
+
2767
+ Die Suche unterst\xFCtzt Sonderzeichen, die Teil der Abfragesyntax sind. Die aktuellen Sonderzeichen der Liste sind
2768
+
2769
+ &plus; &minus; && || ! ( ) { } [ ] ^ " ~ * ? : &bsol; /
2770
+
2771
+ Um diese Zeichen zu nutzen, verwenden Sie \u201E&bsol;" vor dem jeweiligen Zeichen. Um zum Beispiel nach (1+1):2 zu suchen, verwenden Sie diese Abfrage:
2772
+
2773
+ &bsol;(1&bsol;+1&bsol;)&bsol;:2
2774
+
2775
+ Partiell \xFCbersetzt mit www.DeepL.com/Translator (kostenlose Version)
2776
+
2777
+ Quelle [https://javadoc.io/static/org.apache.lucene/lucene-queryparser/8.9.0/org/apache/lucene/queryparser/classic/package-summary.html#package.description](https://javadoc.io/static/org.apache.lucene/lucene-queryparser/8.9.0/org/apache/lucene/queryparser/classic/package-summary.html#package.description)`;
2778
+
2779
+ // src/help/search/syntax.ts
2780
+ var syntax_default = {
2781
+ de: syntax_de_default,
2782
+ en: syntax_en_default
2783
+ };
2784
+
2785
+ // src/help/search/modal.en.ts
2786
+ var modal_en_default = `Our search uses Lucene and you may use the [full syntax](http://lucene.apache.org/core/8_9_0/index.html).
2787
+
2788
+ To learn about advanced search read our [Expert Search Site](/help/search-syntax).
2789
+
2790
+ ### Basic Search
2791
+
2792
+ - The most relevant repositories are shown in the quick results.
2793
+ - Press "enter" or click the "Show all results" button to find more results for all entities like users or groups.
2794
+ - A multi-character wildcard (*) is added to your search by default.
2795
+ - Do not enter Wildcards in front of the search!`;
2796
+
2797
+ // src/help/search/modal.de.ts
2798
+ var modal_de_default = `Unsere Suche basiert auf Lucene. Sie k\xF6nnen die [vollst\xE4ndige Syntax](http://lucene.apache.org/core/8_9_0/index.html) nutzen.
2799
+
2800
+ Um mehr \xFCber die fortgeschrittene Suche zu erfahren, lesen sie unsere [Expertenseite](/help/search-syntax).
2801
+
2802
+ ### Einfache Suche
2803
+
2804
+ - Die relevantesten Repositories werden in den Quick Results angezeigt.
2805
+ - \xDCber die Eingabe-Taste oder den Button "Alle Ergebnisse anzeigen" bekommen Sie Ergebnisse aller durchsuchten Entit\xE4ten wie Nutzern oder Gruppen.
2806
+ - Eine Wildcard f\xFCr eine beliebige Anzahl an beliebigen Zeichen wird Ihrer Suche standardm\xE4\xDFig angeh\xE4ngt.
2807
+ - Geben Sie keine Wildcards vor dem Suchbegriff ein!`;
2808
+
2809
+ // src/help/search/modal.ts
2810
+ var modal_default = {
2811
+ de: modal_de_default,
2812
+ en: modal_en_default
2813
+ };
2814
+
2815
+ // src/search.ts
2816
+ var defaultSearchOptions = {
2817
+ type: "repository"
2818
+ };
2819
+ var isString = (str) => !!str;
2820
+ var useSearchTypes = () => {
2821
+ return useSearchLinks().map((link) => link.name).filter(isString);
2822
+ };
2823
+ var useSearchableTypes = () => useIndexJsonResource("searchableTypes");
2824
+ var useSearchCounts = (types, query) => {
2825
+ const searchLinks = useSearchLinks();
2826
+ const queries = (0, import_react_query29.useQueries)(types.map((type) => ({
2827
+ queryKey: ["search", type, query, "count"],
2828
+ queryFn: () => apiClient.get(`${findLink(searchLinks, type)}?q=${query}&countOnly=true`).then((response) => response.json())
2829
+ })));
2830
+ const result = {};
2831
+ queries.forEach((q, i) => {
2832
+ var _a;
2833
+ result[types[i]] = {
2834
+ isLoading: q.isLoading,
2835
+ isFetching: q.isFetching,
2836
+ error: q.error,
2837
+ data: (_a = q.data) == null ? void 0 : _a.totalHits
2838
+ };
2839
+ });
2840
+ return result;
2841
+ };
2842
+ var findLink = (links, name) => {
2843
+ for (const l of links) {
2844
+ if (l.name === name) {
2845
+ return l.href;
2846
+ }
2847
+ }
2848
+ throw new Error(`could not find search link for ${name}`);
2849
+ };
2850
+ var useSearchLinks = () => {
2851
+ const links = useIndexLinks();
2852
+ const searchLinks = links["search"];
2853
+ if (!searchLinks) {
2854
+ throw new Error("could not find search links in index");
2855
+ }
2856
+ if (!Array.isArray(searchLinks)) {
2857
+ throw new Error("search links returned in wrong format, array is expected");
2858
+ }
2859
+ return searchLinks;
2860
+ };
2861
+ var useSearchLink = (name) => {
2862
+ const searchLinks = useSearchLinks();
2863
+ return findLink(searchLinks, name);
2864
+ };
2865
+ var useSearch = (query, optionParam = defaultSearchOptions) => {
2866
+ const options = __spreadValues(__spreadValues({}, defaultSearchOptions), optionParam);
2867
+ const link = useSearchLink(options.type);
2868
+ const queryParams = {};
2869
+ queryParams.q = query;
2870
+ if (options.page) {
2871
+ queryParams.page = options.page.toString();
2872
+ }
2873
+ if (options.pageSize) {
2874
+ queryParams.pageSize = options.pageSize.toString();
2875
+ }
2876
+ return (0, import_react_query29.useQuery)(["search", options.type, queryParams], () => apiClient.get(`${link}?${createQueryString(queryParams)}`).then((response) => response.json()), {
2877
+ enabled: (query == null ? void 0 : query.length) > 1
2878
+ });
2879
+ };
2880
+ var useObserveAsync = (fn, deps) => {
2881
+ const [data, setData] = (0, import_react8.useState)();
2882
+ const [isLoading, setLoading] = (0, import_react8.useState)(false);
2883
+ const [error, setError] = (0, import_react8.useState)();
2884
+ (0, import_react8.useEffect)(() => {
2885
+ setLoading(true);
2886
+ fn(...deps).then(setData).catch(setError).finally(() => setLoading(false));
2887
+ }, deps);
2888
+ return { data, isLoading, error };
2889
+ };
2890
+ var getTypedKeys = (input) => Object.keys(input);
2891
+ var isSupportedLanguage = (input, supportedLanguages) => supportedLanguages.includes(input);
2892
+ var pickLang = (language, supportedLanguages, fallback) => isSupportedLanguage(language, supportedLanguages) ? language : fallback;
2893
+ var SUPPORTED_MODAL_LANGUAGES = getTypedKeys(modal_default);
2894
+ var SUPPORTED_SYNTAX_LANGUAGES = getTypedKeys(syntax_default);
2895
+ var FALLBACK_LANGUAGE = "en";
2896
+ var useSearchHelpContent = (language) => useObserveAsync((lang) => Promise.resolve(modal_default[pickLang(lang, SUPPORTED_MODAL_LANGUAGES, FALLBACK_LANGUAGE)]), [language]);
2897
+ var useSearchSyntaxContent = (language) => useObserveAsync((lang) => Promise.resolve(syntax_default[pickLang(lang, SUPPORTED_SYNTAX_LANGUAGES, FALLBACK_LANGUAGE)]), [language]);
2898
+
2899
+ // src/loginInfo.ts
2900
+ var import_react_query30 = require("react-query");
2901
+ var useLoginInfo = (disabled = false) => {
2902
+ const loginInfoLink = useIndexLink("loginInfo");
2903
+ const { error, isLoading, data } = (0, import_react_query30.useQuery)(["loginInfo"], () => fetch(loginInfoLink).then((response) => response.json()), {
2904
+ enabled: !disabled && !!loginInfoLink,
2905
+ refetchOnWindowFocus: false
2906
+ });
2907
+ return {
2908
+ data,
2909
+ error,
2910
+ isLoading
2911
+ };
2912
+ };
2913
+
2914
+ // src/usePluginCenterAuthInfo.ts
2915
+ var import_react_query31 = require("react-query");
2916
+ var import_react_router_dom = require("react-router-dom");
2917
+ var appendQueryParam = (link, name, value) => {
2918
+ let href = link.href;
2919
+ if (href.includes("?")) {
2920
+ href += "&";
2921
+ } else {
2922
+ href += "?";
2923
+ }
2924
+ link.href = href + name + "=" + value;
2925
+ };
2926
+ var usePluginCenterAuthInfo = () => {
2927
+ const link = useIndexLink("pluginCenterAuth");
2928
+ const location = (0, import_react_router_dom.useLocation)();
2929
+ return (0, import_react_query31.useQuery)(["pluginCenterAuth"], () => {
2930
+ if (!link) {
2931
+ throw new Error("no such plugin center auth link");
2932
+ }
2933
+ return apiClient.get(link).then((response) => response.json()).then((result) => {
2934
+ var _a, _b;
2935
+ if ((_a = result._links) == null ? void 0 : _a.login) {
2936
+ appendQueryParam(result._links.login, "source", location.pathname);
2937
+ }
2938
+ if ((_b = result._links) == null ? void 0 : _b.reconnect) {
2939
+ appendQueryParam(result._links.reconnect, "source", location.pathname);
2940
+ }
2941
+ return result;
2942
+ });
2943
+ }, {
2944
+ enabled: !!link
2945
+ });
2946
+ };
2947
+ var usePluginCenterLogout = (authenticationInfo) => {
2948
+ const queryClient2 = (0, import_react_query31.useQueryClient)();
2949
+ const { mutate, isLoading, error } = (0, import_react_query31.useMutation)(() => {
2950
+ if (!authenticationInfo._links.logout) {
2951
+ throw new Error("authenticationInfo has no logout link");
2952
+ }
2953
+ const logout = authenticationInfo._links.logout;
2954
+ return apiClient.delete(logout.href);
2955
+ }, {
2956
+ onSuccess: () => queryClient2.invalidateQueries("pluginCenterAuth")
2957
+ });
2958
+ return {
2959
+ logout: () => {
2960
+ mutate();
2961
+ },
2962
+ isLoading,
2963
+ error
2964
+ };
2965
+ };
2966
+
2967
+ // src/compare.ts
2968
+ var import_react_query32 = require("react-query");
2969
+ function createIncomingUrl(repository, linkName, source, target) {
2970
+ const link = repository._links[linkName];
2971
+ if (link == null ? void 0 : link.templated) {
2972
+ return link.href.replace("{source}", encodeURIComponent(source)).replace("{target}", encodeURIComponent(target));
2973
+ } else {
2974
+ return link.href;
2975
+ }
2976
+ }
2977
+ function createChangesetUrl(repository, source, target) {
2978
+ return createIncomingUrl(repository, "incomingChangesets", source, target);
2979
+ }
2980
+ function createDiffUrl(repository, source, target) {
2981
+ if (repository._links.incomingDiffParsed) {
2982
+ return createIncomingUrl(repository, "incomingDiffParsed", source, target);
2983
+ } else {
2984
+ return createIncomingUrl(repository, "incomingDiff", source, target);
2985
+ }
2986
+ }
2987
+ var useIncomingChangesets = (repository, source, target, request) => {
2988
+ const queryClient2 = (0, import_react_query32.useQueryClient)();
2989
+ let link = createChangesetUrl(repository, source, target);
2990
+ if ((request == null ? void 0 : request.page) || (request == null ? void 0 : request.limit)) {
2991
+ if ((request == null ? void 0 : request.page) && (request == null ? void 0 : request.limit)) {
2992
+ link = `${link}?page=${request.page}&pageSize=${request.limit}`;
2993
+ } else if (request.page) {
2994
+ link = `${link}?page=${request.page}`;
2995
+ } else if (request.limit) {
2996
+ link = `${link}?pageSize=${request.limit}`;
2997
+ }
2998
+ }
2999
+ return (0, import_react_query32.useQuery)(["repository", repository.namespace, repository.name, "compare", source, target, "changesets", (request == null ? void 0 : request.page) || 0], () => apiClient.get(link).then((response) => response.json()), {
3000
+ onSuccess: (changesetCollection) => {
3001
+ var _a;
3002
+ (_a = changesetCollection._embedded) == null ? void 0 : _a.changesets.forEach((changeset) => {
3003
+ queryClient2.setQueryData(changesetQueryKey(repository, changeset.id), changeset);
3004
+ });
3005
+ }
3006
+ });
3007
+ };
3008
+
3009
+ // src/ApiProvider.tsx
3010
+ var import_react9 = __toESM(require("react"));
3011
+ var import_react_query33 = require("react-query");
3012
+ var import_devtools = require("react-query/devtools");
3013
+ var queryClient = new import_react_query33.QueryClient({
3014
+ defaultOptions: {
3015
+ queries: {
3016
+ retry: false
3017
+ }
3018
+ }
3019
+ });
3020
+ var ApiProvider = ({ children, index, me, onMeFetched, onIndexFetched, devtools = true }) => {
3021
+ (0, import_react9.useEffect)(() => {
3022
+ if (index) {
3023
+ queryClient.setQueryData("index", index);
3024
+ if (onIndexFetched) {
3025
+ onIndexFetched(index);
3026
+ }
3027
+ }
3028
+ }, [index, onIndexFetched]);
3029
+ (0, import_react9.useEffect)(() => {
3030
+ if (me) {
3031
+ queryClient.setQueryData("me", me);
3032
+ if (onMeFetched) {
3033
+ onMeFetched(me);
3034
+ }
3035
+ }
3036
+ }, [me, onMeFetched]);
3037
+ return /* @__PURE__ */ import_react9.default.createElement(import_react_query33.QueryClientProvider, {
3038
+ client: queryClient
3039
+ }, /* @__PURE__ */ import_react9.default.createElement(LegacyContextProvider, {
3040
+ onIndexFetched,
3041
+ onMeFetched
3042
+ }, children), devtools ? /* @__PURE__ */ import_react9.default.createElement(import_devtools.ReactQueryDevtools, {
3043
+ initialIsOpen: false
3044
+ }) : null);
3045
+ };
3046
+ var clearCache = () => {
3047
+ return reset(queryClient);
3048
+ };
3049
+ var ApiProvider_default = ApiProvider;
3050
+ // Annotate the CommonJS export names for ESM import in node:
3051
+ 0 && (module.exports = {
3052
+ ApiProvider,
3053
+ BackendError,
3054
+ BadGatewayError,
3055
+ CONTENT_TYPE_PUBLIC_KEY,
3056
+ ConflictError,
3057
+ ForbiddenError,
3058
+ LegacyContextProvider,
3059
+ MissingLinkError,
3060
+ NotFoundError,
3061
+ TOKEN_EXPIRED_ERROR_CODE,
3062
+ TokenExpiredError,
3063
+ UnauthorizedError,
3064
+ apiClient,
3065
+ changesetQueryKey,
3066
+ clearCache,
3067
+ createBackendError,
3068
+ createChangesetUrl,
3069
+ createDiffUrl,
3070
+ createQueryString,
3071
+ createUrl,
3072
+ createUrlWithIdentifiers,
3073
+ extractXsrfTokenFromCookie,
3074
+ fetchResourceFromLocationHeader,
3075
+ getResponseJson,
3076
+ isBackendError,
3077
+ objectLink,
3078
+ requiredLink,
3079
+ urls,
3080
+ useAlerts,
3081
+ useAnnotations,
3082
+ useApiKeys,
3083
+ useArchiveRepository,
3084
+ useAvailableGlobalPermissions,
3085
+ useAvailablePermissions,
3086
+ useAvailablePlugins,
3087
+ useBranch,
3088
+ useBranchDetails,
3089
+ useBranchDetailsCollection,
3090
+ useBranches,
3091
+ useCancelPendingPlugins,
3092
+ useChangeUserPassword,
3093
+ useChangeset,
3094
+ useChangesets,
3095
+ useClearNotifications,
3096
+ useConfig,
3097
+ useConfigLink,
3098
+ useContentType,
3099
+ useConvertToExternal,
3100
+ useConvertToInternal,
3101
+ useCreateApiKey,
3102
+ useCreateBranch,
3103
+ useCreateGroup,
3104
+ useCreatePermission,
3105
+ useCreatePublicKey,
3106
+ useCreateRepository,
3107
+ useCreateRepositoryRole,
3108
+ useCreateTag,
3109
+ useCreateUser,
3110
+ useDefaultBranch,
3111
+ useDeleteApiKey,
3112
+ useDeleteBranch,
3113
+ useDeleteGroup,
3114
+ useDeletePermission,
3115
+ useDeletePublicKey,
3116
+ useDeleteRepository,
3117
+ useDeleteRepositoryRole,
3118
+ useDeleteTag,
3119
+ useDeleteUser,
3120
+ useDiff,
3121
+ useDismissNotification,
3122
+ useExecutePendingPlugins,
3123
+ useExportInfo,
3124
+ useExportRepository,
3125
+ useFileContent,
3126
+ useGroup,
3127
+ useGroupPermissions,
3128
+ useGroupSuggestions,
3129
+ useGroups,
3130
+ useHistory,
3131
+ useImportFullRepository,
3132
+ useImportLog,
3133
+ useImportRepositoryFromBundle,
3134
+ useImportRepositoryFromUrl,
3135
+ useIncomingChangesets,
3136
+ useIndex,
3137
+ useIndexJsonResource,
3138
+ useIndexLink,
3139
+ useIndexLinks,
3140
+ useInstallPlugin,
3141
+ useInstalledPlugins,
3142
+ useJsonResource,
3143
+ useLegacyContext,
3144
+ useLogin,
3145
+ useLoginInfo,
3146
+ useLogout,
3147
+ useMe,
3148
+ useNamespace,
3149
+ useNamespaceStrategies,
3150
+ useNamespaceSuggestions,
3151
+ useNamespaces,
3152
+ useNotificationSubscription,
3153
+ useNotifications,
3154
+ usePaths,
3155
+ usePendingPlugins,
3156
+ usePermissions,
3157
+ usePluginCenterAuthInfo,
3158
+ usePluginCenterLogout,
3159
+ usePublicKeys,
3160
+ useRenameRepository,
3161
+ useRepositories,
3162
+ useRepository,
3163
+ useRepositoryRole,
3164
+ useRepositoryRoles,
3165
+ useRepositoryTypes,
3166
+ useRepositoryVerbs,
3167
+ useRequiredIndexLink,
3168
+ useRequiredMe,
3169
+ useRunHealthCheck,
3170
+ useSearch,
3171
+ useSearchCounts,
3172
+ useSearchHelpContent,
3173
+ useSearchSyntaxContent,
3174
+ useSearchTypes,
3175
+ useSearchableTypes,
3176
+ useSetGroupPermissions,
3177
+ useSetUserPassword,
3178
+ useSetUserPermissions,
3179
+ useSources,
3180
+ useSubject,
3181
+ useSuggestions,
3182
+ useTag,
3183
+ useTags,
3184
+ useUnarchiveRepository,
3185
+ useUninstallPlugin,
3186
+ useUpdateConfig,
3187
+ useUpdateGroup,
3188
+ useUpdateInfo,
3189
+ useUpdatePermission,
3190
+ useUpdatePlugins,
3191
+ useUpdateRepository,
3192
+ useUpdateRepositoryRole,
3193
+ useUpdateUser,
3194
+ useUser,
3195
+ useUserPermissions,
3196
+ useUserSuggestions,
3197
+ useUsers,
3198
+ useVersion,
3199
+ waitForRestartAfter
3200
+ });