@squonk/data-manager-client 0.6.16-rc.2 → 0.6.20-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/admin/admin.cjs +168 -2
  2. package/admin/admin.cjs.map +3 -3
  3. package/admin/admin.d.ts +1 -1
  4. package/admin/admin.js +134 -2
  5. package/admin/admin.js.map +3 -3
  6. package/admin/package.json +2 -1
  7. package/application/application.cjs +102 -2
  8. package/application/application.cjs.map +3 -3
  9. package/application/application.d.ts +2 -2
  10. package/application/application.js +74 -2
  11. package/application/application.js.map +3 -3
  12. package/application/package.json +2 -1
  13. package/{custom-instance-c2586f3c.d.ts → custom-instance-1e09a452.d.ts} +15 -10
  14. package/dataset/dataset.cjs +352 -2
  15. package/dataset/dataset.cjs.map +3 -3
  16. package/dataset/dataset.d.ts +1 -1
  17. package/dataset/dataset.js +299 -2
  18. package/dataset/dataset.js.map +3 -3
  19. package/dataset/package.json +2 -1
  20. package/file/file.cjs +162 -2
  21. package/file/file.cjs.map +3 -3
  22. package/file/file.d.ts +1 -1
  23. package/file/file.js +129 -2
  24. package/file/file.js.map +3 -3
  25. package/file/package.json +2 -1
  26. package/index.cjs +195 -2
  27. package/index.cjs.map +3 -3
  28. package/index.d.ts +1 -1
  29. package/index.js +149 -2
  30. package/index.js.map +3 -3
  31. package/instance/instance.cjs +164 -2
  32. package/instance/instance.cjs.map +3 -3
  33. package/instance/instance.d.ts +1 -1
  34. package/instance/instance.js +131 -2
  35. package/instance/instance.js.map +3 -3
  36. package/instance/package.json +2 -1
  37. package/job/job.cjs +120 -2
  38. package/job/job.cjs.map +3 -3
  39. package/job/job.d.ts +1 -1
  40. package/job/job.js +91 -2
  41. package/job/job.js.map +3 -3
  42. package/job/package.json +2 -1
  43. package/package.json +7 -7
  44. package/project/package.json +2 -1
  45. package/project/project.cjs +219 -2
  46. package/project/project.cjs.map +3 -3
  47. package/project/project.d.ts +1 -1
  48. package/project/project.js +179 -2
  49. package/project/project.js.map +3 -3
  50. package/src/admin/admin.ts +347 -0
  51. package/src/application/application.ts +137 -0
  52. package/src/custom-instance.ts +52 -0
  53. package/src/data-manager-api.schemas.ts +1500 -0
  54. package/src/dataset/dataset.ts +829 -0
  55. package/src/file/file.ts +310 -0
  56. package/src/index.ts +6 -0
  57. package/src/instance/instance.ts +317 -0
  58. package/src/job/job.ts +189 -0
  59. package/src/project/project.ts +465 -0
  60. package/src/task/task.ts +207 -0
  61. package/src/type/type.ts +74 -0
  62. package/src/user/user.ts +254 -0
  63. package/task/package.json +2 -1
  64. package/task/task.cjs +121 -2
  65. package/task/task.cjs.map +3 -3
  66. package/task/task.d.ts +1 -1
  67. package/task/task.js +92 -2
  68. package/task/task.js.map +3 -3
  69. package/type/package.json +2 -1
  70. package/type/type.cjs +81 -2
  71. package/type/type.cjs.map +3 -3
  72. package/type/type.d.ts +2 -2
  73. package/type/type.js +56 -2
  74. package/type/type.js.map +3 -3
  75. package/user/package.json +2 -1
  76. package/user/user.cjs +153 -2
  77. package/user/user.cjs.map +3 -3
  78. package/user/user.d.ts +1 -1
  79. package/user/user.js +121 -2
  80. package/user/user.js.map +3 -3
  81. package/chunk-33VR3IML.js +0 -2
  82. package/chunk-33VR3IML.js.map +0 -7
  83. package/chunk-3KO3PKBX.cjs +0 -2
  84. package/chunk-3KO3PKBX.cjs.map +0 -7
package/admin/admin.cjs CHANGED
@@ -1,2 +1,168 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3KO3PKBXcjs = require('../chunk-3KO3PKBX.cjs');var _reactquery = require('react-query');var y=(e,r)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:"/admin/service-error",method:"get",params:e},r),p= exports.getAdminGetServiceErrorsQueryKey =e=>["/admin/service-error",...e?[e]:[]],l= exports.useAdminGetServiceErrors =(e,r)=>{var c;let{query:t,request:s}=r||{},n=(c=t==null?void 0:t.queryKey)!=null?c:p(e),a=_reactquery.useQuery.call(void 0, n,()=>y(e,s),t);return _chunk3KO3PKBXcjs.a.call(void 0, {queryKey:n},a)},T= exports.adminPatchServiceError =(e,r)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/admin/service-error/${e}`,method:"patch",data:void 0},r),O= exports.useAdminPatchServiceError =e=>{let{mutation:r,request:t}=e||{};return _reactquery.useMutation.call(void 0, n=>{let{errorid:o}=n||{};return T(o,t)},r)},E= exports.adminDeleteServiceError =(e,r)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/admin/service-error/${e}`,method:"delete",data:void 0},r),C= exports.useAdminDeleteServiceError =e=>{let{mutation:r,request:t}=e||{};return _reactquery.useMutation.call(void 0, n=>{let{errorid:o}=n||{};return E(o,t)},r)},f= exports.adminPutUser =(e,r)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/admin/user/${e}`,method:"put",data:void 0},r),G= exports.useAdminPutUser =e=>{let{mutation:r,request:t}=e||{};return _reactquery.useMutation.call(void 0, n=>{let{userid:o}=n||{};return f(o,t)},r)},P= exports.adminDeleteUser =(e,r)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/admin/user/${e}`,method:"delete",data:void 0},r),I= exports.useAdminDeleteUser =e=>{let{mutation:r,request:t}=e||{};return _reactquery.useMutation.call(void 0, n=>{let{userid:o}=n||{};return P(o,t)},r)},S= exports.adminPatchUser =(e,r,t)=>{let s=new FormData;return r.suspend_message!==void 0&&s.append("suspend_message",r.suspend_message),_chunk3KO3PKBXcjs.e.call(void 0, {url:`/admin/user/${e}`,method:"patch",data:s},t)},M= exports.useAdminPatchUser =e=>{let{mutation:r,request:t}=e||{};return _reactquery.useMutation.call(void 0, n=>{let{userid:o,data:a}=n||{};return S(o,a,t)},r)};exports.adminDeleteServiceError = E; exports.adminDeleteUser = P; exports.adminGetServiceErrors = y; exports.adminPatchServiceError = T; exports.adminPatchUser = S; exports.adminPutUser = f; exports.getAdminGetServiceErrorsQueryKey = p; exports.useAdminDeleteServiceError = C; exports.useAdminDeleteUser = I; exports.useAdminGetServiceErrors = l; exports.useAdminPatchServiceError = O; exports.useAdminPatchUser = M; exports.useAdminPutUser = G;
2
- //# sourceMappingURL=admin.cjs.map
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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
+ var __export = (target, all) => {
26
+ __markAsModule(target);
27
+ for (var name in all)
28
+ __defProp(target, name, { get: all[name], enumerable: true });
29
+ };
30
+ var __reExport = (target, module2, desc) => {
31
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
32
+ for (let key of __getOwnPropNames(module2))
33
+ if (!__hasOwnProp.call(target, key) && key !== "default")
34
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
35
+ }
36
+ return target;
37
+ };
38
+ var __toModule = (module2) => {
39
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
40
+ };
41
+
42
+ // src/admin/admin.ts
43
+ __export(exports, {
44
+ adminDeleteServiceError: () => adminDeleteServiceError,
45
+ adminDeleteUser: () => adminDeleteUser,
46
+ adminGetServiceErrors: () => adminGetServiceErrors,
47
+ adminPatchServiceError: () => adminPatchServiceError,
48
+ adminPatchUser: () => adminPatchUser,
49
+ adminPutUser: () => adminPutUser,
50
+ getAdminGetServiceErrorsQueryKey: () => getAdminGetServiceErrorsQueryKey,
51
+ useAdminDeleteServiceError: () => useAdminDeleteServiceError,
52
+ useAdminDeleteUser: () => useAdminDeleteUser,
53
+ useAdminGetServiceErrors: () => useAdminGetServiceErrors,
54
+ useAdminPatchServiceError: () => useAdminPatchServiceError,
55
+ useAdminPatchUser: () => useAdminPatchUser,
56
+ useAdminPutUser: () => useAdminPutUser
57
+ });
58
+ var import_react_query = __toModule(require("react-query"));
59
+
60
+ // src/custom-instance.ts
61
+ var import_axios = __toModule(require("axios"));
62
+ var AXIOS_INSTANCE = import_axios.default.create({ baseURL: "" });
63
+ var customInstance = (config, options) => {
64
+ const source = import_axios.default.CancelToken.source();
65
+ const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
66
+ promise.cancel = () => {
67
+ source.cancel("Query was cancelled by React Query");
68
+ };
69
+ return promise;
70
+ };
71
+
72
+ // src/admin/admin.ts
73
+ var adminGetServiceErrors = (params, options) => {
74
+ return customInstance({ url: `/admin/service-error`, method: "get", params }, options);
75
+ };
76
+ var getAdminGetServiceErrorsQueryKey = (params) => [`/admin/service-error`, ...params ? [params] : []];
77
+ var useAdminGetServiceErrors = (params, options) => {
78
+ const { query: queryOptions, request: requestOptions } = options || {};
79
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAdminGetServiceErrorsQueryKey(params);
80
+ const queryFn = () => adminGetServiceErrors(params, requestOptions);
81
+ const query = (0, import_react_query.useQuery)(queryKey, queryFn, queryOptions);
82
+ return __spreadValues({
83
+ queryKey
84
+ }, query);
85
+ };
86
+ var adminPatchServiceError = (errorid, options) => {
87
+ return customInstance({
88
+ url: `/admin/service-error/${errorid}`,
89
+ method: "patch",
90
+ data: void 0
91
+ }, options);
92
+ };
93
+ var useAdminPatchServiceError = (options) => {
94
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
95
+ const mutationFn = (props) => {
96
+ const { errorid } = props || {};
97
+ return adminPatchServiceError(errorid, requestOptions);
98
+ };
99
+ return (0, import_react_query.useMutation)(mutationFn, mutationOptions);
100
+ };
101
+ var adminDeleteServiceError = (errorid, options) => {
102
+ return customInstance({
103
+ url: `/admin/service-error/${errorid}`,
104
+ method: "delete",
105
+ data: void 0
106
+ }, options);
107
+ };
108
+ var useAdminDeleteServiceError = (options) => {
109
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
110
+ const mutationFn = (props) => {
111
+ const { errorid } = props || {};
112
+ return adminDeleteServiceError(errorid, requestOptions);
113
+ };
114
+ return (0, import_react_query.useMutation)(mutationFn, mutationOptions);
115
+ };
116
+ var adminPutUser = (userid, options) => {
117
+ return customInstance({ url: `/admin/user/${userid}`, method: "put", data: void 0 }, options);
118
+ };
119
+ var useAdminPutUser = (options) => {
120
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
121
+ const mutationFn = (props) => {
122
+ const { userid } = props || {};
123
+ return adminPutUser(userid, requestOptions);
124
+ };
125
+ return (0, import_react_query.useMutation)(mutationFn, mutationOptions);
126
+ };
127
+ var adminDeleteUser = (userid, options) => {
128
+ return customInstance({ url: `/admin/user/${userid}`, method: "delete", data: void 0 }, options);
129
+ };
130
+ var useAdminDeleteUser = (options) => {
131
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
132
+ const mutationFn = (props) => {
133
+ const { userid } = props || {};
134
+ return adminDeleteUser(userid, requestOptions);
135
+ };
136
+ return (0, import_react_query.useMutation)(mutationFn, mutationOptions);
137
+ };
138
+ var adminPatchUser = (userid, userPatchBodyBody, options) => {
139
+ const formData = new FormData();
140
+ if (userPatchBodyBody.suspend_message !== void 0) {
141
+ formData.append("suspend_message", userPatchBodyBody.suspend_message);
142
+ }
143
+ return customInstance({ url: `/admin/user/${userid}`, method: "patch", data: formData }, options);
144
+ };
145
+ var useAdminPatchUser = (options) => {
146
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
147
+ const mutationFn = (props) => {
148
+ const { userid, data } = props || {};
149
+ return adminPatchUser(userid, data, requestOptions);
150
+ };
151
+ return (0, import_react_query.useMutation)(mutationFn, mutationOptions);
152
+ };
153
+ // Annotate the CommonJS export names for ESM import in node:
154
+ 0 && (module.exports = {
155
+ adminDeleteServiceError,
156
+ adminDeleteUser,
157
+ adminGetServiceErrors,
158
+ adminPatchServiceError,
159
+ adminPatchUser,
160
+ adminPutUser,
161
+ getAdminGetServiceErrorsQueryKey,
162
+ useAdminDeleteServiceError,
163
+ useAdminDeleteUser,
164
+ useAdminGetServiceErrors,
165
+ useAdminPatchServiceError,
166
+ useAdminPatchUser,
167
+ useAdminPutUser
168
+ });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/admin/admin.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.4.0 \uD83C\uDF7A\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.6\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServiceErrorsGetResponse,\n DmError,\n AdminGetServiceErrorsParams,\n AdminUserPutResponse,\n UserPatchBodyBody,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Displays the existing Service Errors, which can also include acnowledged errors, normally excluded from the list.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Gets Service Errors\n */\nexport const adminGetServiceErrors = (\n params?: AdminGetServiceErrorsParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceErrorsGetResponse>(\n { url: `/admin/service-error`, method: \"get\", params },\n options\n );\n};\n\nexport const getAdminGetServiceErrorsQueryKey = (\n params?: AdminGetServiceErrorsParams\n) => [`/admin/service-error`, ...(params ? [params] : [])];\n\nexport const useAdminGetServiceErrors = <\n TData = AsyncReturnType<typeof adminGetServiceErrors>,\n TError = ErrorType<void | DmError>\n>(\n params?: AdminGetServiceErrorsParams,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof adminGetServiceErrors>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAdminGetServiceErrorsQueryKey(params);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof adminGetServiceErrors>\n > = () => adminGetServiceErrors(params, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof adminGetServiceErrors>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Used primarily to 'Acknowledge' but not delete a Service Error.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Patches a Service Error\n */\nexport const adminPatchServiceError = (\n errorid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/admin/service-error/${errorid}`,\n method: \"patch\",\n data: undefined,\n },\n options\n );\n};\n\nexport const useAdminPatchServiceError = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPatchServiceError>,\n TError,\n { errorid: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPatchServiceError>,\n { errorid: number }\n > = (props) => {\n const { errorid } = props || {};\n\n return adminPatchServiceError(errorid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPatchServiceError>,\n TError,\n { errorid: number },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes an existing Service Error.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Deletes a Service Error\n */\nexport const adminDeleteServiceError = (\n errorid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/admin/service-error/${errorid}`,\n method: \"delete\",\n data: undefined,\n },\n options\n );\n};\n\nexport const useAdminDeleteServiceError = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminDeleteServiceError>,\n TError,\n { errorid: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminDeleteServiceError>,\n { errorid: number }\n > = (props) => {\n const { errorid } = props || {};\n\n return adminDeleteServiceError(errorid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminDeleteServiceError>,\n TError,\n { errorid: number },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * This method adds a user to the Data Manager service. The user is authenticated via a keycloak server but will need an initialised account before they can create Datasets or Projects.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Prepares a user account in the Data Manager service\n */\nexport const adminPutUser = (\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<AdminUserPutResponse>(\n { url: `/admin/user/${userid}`, method: \"put\", data: undefined },\n options\n );\n};\n\nexport const useAdminPutUser = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPutUser>,\n TError,\n { userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPutUser>,\n { userid: string }\n > = (props) => {\n const { userid } = props || {};\n\n return adminPutUser(userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPutUser>,\n TError,\n { userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a user account, along with all the user's Datasets\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Deletes a user account\n */\nexport const adminDeleteUser = (\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/admin/user/${userid}`, method: \"delete\", data: undefined },\n options\n );\n};\n\nexport const useAdminDeleteUser = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminDeleteUser>,\n TError,\n { userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminDeleteUser>,\n { userid: string }\n > = (props) => {\n const { userid } = props || {};\n\n return adminDeleteUser(userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminDeleteUser>,\n TError,\n { userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Patches a user record, typcially to suspend or re-enable a user account\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Patch a given user\n */\nexport const adminPatchUser = (\n userid: string,\n userPatchBodyBody: UserPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (userPatchBodyBody.suspend_message !== undefined) {\n formData.append(\"suspend_message\", userPatchBodyBody.suspend_message);\n }\n\n return customInstance<void>(\n { url: `/admin/user/${userid}`, method: \"patch\", data: formData },\n options\n );\n};\n\nexport const useAdminPatchUser = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPatchUser>,\n TError,\n { userid: string; data: UserPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPatchUser>,\n { userid: string; data: UserPatchBodyBody }\n > = (props) => {\n const { userid, data } = props || {};\n\n return adminPatchUser(userid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPatchUser>,\n TError,\n { userid: string; data: UserPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],
5
- "mappings": "iDAUA,wDAuCO,GAAM,GAAwB,CACnC,EACA,IAEO,EACL,CAAE,IAAK,uBAAwB,OAAQ,MAAO,UAC9C,GAIS,EAAmC,AAC9C,GACG,CAAC,uBAAwB,GAAI,EAAS,CAAC,GAAU,IAEzC,EAA2B,CAItC,EACA,IAQ2D,CA5E7D,MA6EE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EACJ,oBAAc,WAAd,OAA0B,EAAiC,GAMvD,EAAQ,EAIZ,EANE,IAAM,EAAsB,EAAQ,GAMnB,GAErB,MAAO,IACL,YACG,IAWM,EAAyB,CACpC,EACA,IAEO,EACL,CACE,IAAK,wBAAwB,IAC7B,OAAQ,QACR,KAAM,QAER,GAIS,EAA4B,AAGvC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,WAAY,GAAS,GAE7B,MAAO,GAAuB,EAAS,IAQ3B,IASH,EAA0B,CACrC,EACA,IAEO,EACL,CACE,IAAK,wBAAwB,IAC7B,OAAQ,SACR,KAAM,QAER,GAIS,EAA6B,AAGxC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,WAAY,GAAS,GAE7B,MAAO,GAAwB,EAAS,IAQ5B,IASH,EAAe,CAC1B,EACA,IAEO,EACL,CAAE,IAAK,eAAe,IAAU,OAAQ,MAAO,KAAM,QACrD,GAIS,EAAkB,AAG7B,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,UAAW,GAAS,GAE5B,MAAO,GAAa,EAAQ,IAQhB,IASH,EAAkB,CAC7B,EACA,IAEO,EACL,CAAE,IAAK,eAAe,IAAU,OAAQ,SAAU,KAAM,QACxD,GAIS,EAAqB,AAGhC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,UAAW,GAAS,GAE5B,MAAO,GAAgB,EAAQ,IAQnB,IASH,EAAiB,CAC5B,EACA,EACA,IACG,CACH,GAAM,GAAW,GAAI,UACrB,MAAI,GAAkB,kBAAoB,QACxC,EAAS,OAAO,kBAAmB,EAAkB,iBAGhD,EACL,CAAE,IAAK,eAAe,IAAU,OAAQ,QAAS,KAAM,GACvD,IAIS,EAAoB,AAG/B,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,SAAQ,QAAS,GAAS,GAElC,MAAO,GAAe,EAAQ,EAAM,IAQxB",
3
+ "sources": ["../../src/admin/admin.ts", "../../src/custom-instance.ts"],
4
+ "sourcesContent": ["/**\n * Generated by orval v6.4.2 \uD83C\uDF7A\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.6\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServiceErrorsGetResponse,\n DmError,\n AdminGetServiceErrorsParams,\n AdminUserPutResponse,\n UserPatchBodyBody,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Displays the existing Service Errors, which can also include acnowledged errors, normally excluded from the list.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Gets Service Errors\n */\nexport const adminGetServiceErrors = (\n params?: AdminGetServiceErrorsParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceErrorsGetResponse>(\n { url: `/admin/service-error`, method: \"get\", params },\n options\n );\n};\n\nexport const getAdminGetServiceErrorsQueryKey = (\n params?: AdminGetServiceErrorsParams\n) => [`/admin/service-error`, ...(params ? [params] : [])];\n\nexport const useAdminGetServiceErrors = <\n TData = AsyncReturnType<typeof adminGetServiceErrors>,\n TError = ErrorType<void | DmError>\n>(\n params?: AdminGetServiceErrorsParams,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof adminGetServiceErrors>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAdminGetServiceErrorsQueryKey(params);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof adminGetServiceErrors>\n > = () => adminGetServiceErrors(params, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof adminGetServiceErrors>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Used primarily to 'Acknowledge' but not delete a Service Error.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Patches a Service Error\n */\nexport const adminPatchServiceError = (\n errorid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/admin/service-error/${errorid}`,\n method: \"patch\",\n data: undefined,\n },\n options\n );\n};\n\nexport const useAdminPatchServiceError = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPatchServiceError>,\n TError,\n { errorid: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPatchServiceError>,\n { errorid: number }\n > = (props) => {\n const { errorid } = props || {};\n\n return adminPatchServiceError(errorid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPatchServiceError>,\n TError,\n { errorid: number },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes an existing Service Error.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Deletes a Service Error\n */\nexport const adminDeleteServiceError = (\n errorid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/admin/service-error/${errorid}`,\n method: \"delete\",\n data: undefined,\n },\n options\n );\n};\n\nexport const useAdminDeleteServiceError = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminDeleteServiceError>,\n TError,\n { errorid: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminDeleteServiceError>,\n { errorid: number }\n > = (props) => {\n const { errorid } = props || {};\n\n return adminDeleteServiceError(errorid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminDeleteServiceError>,\n TError,\n { errorid: number },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * This method adds a user to the Data Manager service. The user is authenticated via a keycloak server but will need an initialised account before they can create Datasets or Projects.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Prepares a user account in the Data Manager service\n */\nexport const adminPutUser = (\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<AdminUserPutResponse>(\n { url: `/admin/user/${userid}`, method: \"put\", data: undefined },\n options\n );\n};\n\nexport const useAdminPutUser = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPutUser>,\n TError,\n { userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPutUser>,\n { userid: string }\n > = (props) => {\n const { userid } = props || {};\n\n return adminPutUser(userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPutUser>,\n TError,\n { userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a user account, along with all the user's Datasets\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Deletes a user account\n */\nexport const adminDeleteUser = (\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/admin/user/${userid}`, method: \"delete\", data: undefined },\n options\n );\n};\n\nexport const useAdminDeleteUser = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminDeleteUser>,\n TError,\n { userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminDeleteUser>,\n { userid: string }\n > = (props) => {\n const { userid } = props || {};\n\n return adminDeleteUser(userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminDeleteUser>,\n TError,\n { userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Patches a user record, typcially to suspend or re-enable a user account\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Patch a given user\n */\nexport const adminPatchUser = (\n userid: string,\n userPatchBodyBody: UserPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (userPatchBodyBody.suspend_message !== undefined) {\n formData.append(\"suspend_message\", userPatchBodyBody.suspend_message);\n }\n\n return customInstance<void>(\n { url: `/admin/user/${userid}`, method: \"patch\", data: formData },\n options\n );\n};\n\nexport const useAdminPatchUser = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPatchUser>,\n TError,\n { userid: string; data: UserPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPatchUser>,\n { userid: string; data: UserPatchBodyBody }\n > = (props) => {\n const { userid, data } = props || {};\n\n return adminPatchUser(userid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPatchUser>,\n TError,\n { userid: string; data: UserPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n", "/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\n// ? Need the baseUrl or does it default to ''?\nexport const AXIOS_INSTANCE = Axios.create({ baseURL: '' });\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
package/admin/admin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as AdminGetServiceErrorsParams, b5 as customInstance, aB as ServiceErrorsGetResponse, b6 as ErrorType, b1 as DmError, T as UserAccountDetail, U as UserPatchBodyBody } from '../custom-instance-c2586f3c';
1
+ import { A as AdminGetServiceErrorsParams, b6 as customInstance, aC as ServiceErrorsGetResponse, b7 as ErrorType, b2 as DmError, V as UserAccountDetail, U as UserPatchBodyBody } from '../custom-instance-1e09a452';
2
2
  import * as react_query from 'react-query';
3
3
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
4
4
  import 'axios';
package/admin/admin.js CHANGED
@@ -1,2 +1,134 @@
1
- import{a as m,e as u}from"../chunk-33VR3IML.js";import{useQuery as d,useMutation as i}from"react-query";var y=(e,r)=>u({url:"/admin/service-error",method:"get",params:e},r),p=e=>["/admin/service-error",...e?[e]:[]],F=(e,r)=>{var c;let{query:t,request:s}=r||{},n=(c=t==null?void 0:t.queryKey)!=null?c:p(e),a=d(n,()=>y(e,s),t);return m({queryKey:n},a)},T=(e,r)=>u({url:`/admin/service-error/${e}`,method:"patch",data:void 0},r),l=e=>{let{mutation:r,request:t}=e||{};return i(n=>{let{errorid:o}=n||{};return T(o,t)},r)},E=(e,r)=>u({url:`/admin/service-error/${e}`,method:"delete",data:void 0},r),O=e=>{let{mutation:r,request:t}=e||{};return i(n=>{let{errorid:o}=n||{};return E(o,t)},r)},f=(e,r)=>u({url:`/admin/user/${e}`,method:"put",data:void 0},r),C=e=>{let{mutation:r,request:t}=e||{};return i(n=>{let{userid:o}=n||{};return f(o,t)},r)},P=(e,r)=>u({url:`/admin/user/${e}`,method:"delete",data:void 0},r),G=e=>{let{mutation:r,request:t}=e||{};return i(n=>{let{userid:o}=n||{};return P(o,t)},r)},S=(e,r,t)=>{let s=new FormData;return r.suspend_message!==void 0&&s.append("suspend_message",r.suspend_message),u({url:`/admin/user/${e}`,method:"patch",data:s},t)},I=e=>{let{mutation:r,request:t}=e||{};return i(n=>{let{userid:o,data:a}=n||{};return S(o,a,t)},r)};export{E as adminDeleteServiceError,P as adminDeleteUser,y as adminGetServiceErrors,T as adminPatchServiceError,S as adminPatchUser,f as adminPutUser,p as getAdminGetServiceErrorsQueryKey,O as useAdminDeleteServiceError,G as useAdminDeleteUser,F as useAdminGetServiceErrors,l as useAdminPatchServiceError,I as useAdminPatchUser,C as useAdminPutUser};
2
- //# sourceMappingURL=admin.js.map
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+ // src/admin/admin.ts
22
+ import {
23
+ useQuery,
24
+ useMutation
25
+ } from "react-query";
26
+
27
+ // src/custom-instance.ts
28
+ import Axios from "axios";
29
+ var AXIOS_INSTANCE = Axios.create({ baseURL: "" });
30
+ var customInstance = (config, options) => {
31
+ const source = Axios.CancelToken.source();
32
+ const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
33
+ promise.cancel = () => {
34
+ source.cancel("Query was cancelled by React Query");
35
+ };
36
+ return promise;
37
+ };
38
+
39
+ // src/admin/admin.ts
40
+ var adminGetServiceErrors = (params, options) => {
41
+ return customInstance({ url: `/admin/service-error`, method: "get", params }, options);
42
+ };
43
+ var getAdminGetServiceErrorsQueryKey = (params) => [`/admin/service-error`, ...params ? [params] : []];
44
+ var useAdminGetServiceErrors = (params, options) => {
45
+ const { query: queryOptions, request: requestOptions } = options || {};
46
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAdminGetServiceErrorsQueryKey(params);
47
+ const queryFn = () => adminGetServiceErrors(params, requestOptions);
48
+ const query = useQuery(queryKey, queryFn, queryOptions);
49
+ return __spreadValues({
50
+ queryKey
51
+ }, query);
52
+ };
53
+ var adminPatchServiceError = (errorid, options) => {
54
+ return customInstance({
55
+ url: `/admin/service-error/${errorid}`,
56
+ method: "patch",
57
+ data: void 0
58
+ }, options);
59
+ };
60
+ var useAdminPatchServiceError = (options) => {
61
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
62
+ const mutationFn = (props) => {
63
+ const { errorid } = props || {};
64
+ return adminPatchServiceError(errorid, requestOptions);
65
+ };
66
+ return useMutation(mutationFn, mutationOptions);
67
+ };
68
+ var adminDeleteServiceError = (errorid, options) => {
69
+ return customInstance({
70
+ url: `/admin/service-error/${errorid}`,
71
+ method: "delete",
72
+ data: void 0
73
+ }, options);
74
+ };
75
+ var useAdminDeleteServiceError = (options) => {
76
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
77
+ const mutationFn = (props) => {
78
+ const { errorid } = props || {};
79
+ return adminDeleteServiceError(errorid, requestOptions);
80
+ };
81
+ return useMutation(mutationFn, mutationOptions);
82
+ };
83
+ var adminPutUser = (userid, options) => {
84
+ return customInstance({ url: `/admin/user/${userid}`, method: "put", data: void 0 }, options);
85
+ };
86
+ var useAdminPutUser = (options) => {
87
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
88
+ const mutationFn = (props) => {
89
+ const { userid } = props || {};
90
+ return adminPutUser(userid, requestOptions);
91
+ };
92
+ return useMutation(mutationFn, mutationOptions);
93
+ };
94
+ var adminDeleteUser = (userid, options) => {
95
+ return customInstance({ url: `/admin/user/${userid}`, method: "delete", data: void 0 }, options);
96
+ };
97
+ var useAdminDeleteUser = (options) => {
98
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
99
+ const mutationFn = (props) => {
100
+ const { userid } = props || {};
101
+ return adminDeleteUser(userid, requestOptions);
102
+ };
103
+ return useMutation(mutationFn, mutationOptions);
104
+ };
105
+ var adminPatchUser = (userid, userPatchBodyBody, options) => {
106
+ const formData = new FormData();
107
+ if (userPatchBodyBody.suspend_message !== void 0) {
108
+ formData.append("suspend_message", userPatchBodyBody.suspend_message);
109
+ }
110
+ return customInstance({ url: `/admin/user/${userid}`, method: "patch", data: formData }, options);
111
+ };
112
+ var useAdminPatchUser = (options) => {
113
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
114
+ const mutationFn = (props) => {
115
+ const { userid, data } = props || {};
116
+ return adminPatchUser(userid, data, requestOptions);
117
+ };
118
+ return useMutation(mutationFn, mutationOptions);
119
+ };
120
+ export {
121
+ adminDeleteServiceError,
122
+ adminDeleteUser,
123
+ adminGetServiceErrors,
124
+ adminPatchServiceError,
125
+ adminPatchUser,
126
+ adminPutUser,
127
+ getAdminGetServiceErrorsQueryKey,
128
+ useAdminDeleteServiceError,
129
+ useAdminDeleteUser,
130
+ useAdminGetServiceErrors,
131
+ useAdminPatchServiceError,
132
+ useAdminPatchUser,
133
+ useAdminPutUser
134
+ };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/admin/admin.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.4.0 \uD83C\uDF7A\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.6\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServiceErrorsGetResponse,\n DmError,\n AdminGetServiceErrorsParams,\n AdminUserPutResponse,\n UserPatchBodyBody,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Displays the existing Service Errors, which can also include acnowledged errors, normally excluded from the list.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Gets Service Errors\n */\nexport const adminGetServiceErrors = (\n params?: AdminGetServiceErrorsParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceErrorsGetResponse>(\n { url: `/admin/service-error`, method: \"get\", params },\n options\n );\n};\n\nexport const getAdminGetServiceErrorsQueryKey = (\n params?: AdminGetServiceErrorsParams\n) => [`/admin/service-error`, ...(params ? [params] : [])];\n\nexport const useAdminGetServiceErrors = <\n TData = AsyncReturnType<typeof adminGetServiceErrors>,\n TError = ErrorType<void | DmError>\n>(\n params?: AdminGetServiceErrorsParams,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof adminGetServiceErrors>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAdminGetServiceErrorsQueryKey(params);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof adminGetServiceErrors>\n > = () => adminGetServiceErrors(params, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof adminGetServiceErrors>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Used primarily to 'Acknowledge' but not delete a Service Error.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Patches a Service Error\n */\nexport const adminPatchServiceError = (\n errorid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/admin/service-error/${errorid}`,\n method: \"patch\",\n data: undefined,\n },\n options\n );\n};\n\nexport const useAdminPatchServiceError = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPatchServiceError>,\n TError,\n { errorid: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPatchServiceError>,\n { errorid: number }\n > = (props) => {\n const { errorid } = props || {};\n\n return adminPatchServiceError(errorid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPatchServiceError>,\n TError,\n { errorid: number },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes an existing Service Error.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Deletes a Service Error\n */\nexport const adminDeleteServiceError = (\n errorid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/admin/service-error/${errorid}`,\n method: \"delete\",\n data: undefined,\n },\n options\n );\n};\n\nexport const useAdminDeleteServiceError = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminDeleteServiceError>,\n TError,\n { errorid: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminDeleteServiceError>,\n { errorid: number }\n > = (props) => {\n const { errorid } = props || {};\n\n return adminDeleteServiceError(errorid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminDeleteServiceError>,\n TError,\n { errorid: number },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * This method adds a user to the Data Manager service. The user is authenticated via a keycloak server but will need an initialised account before they can create Datasets or Projects.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Prepares a user account in the Data Manager service\n */\nexport const adminPutUser = (\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<AdminUserPutResponse>(\n { url: `/admin/user/${userid}`, method: \"put\", data: undefined },\n options\n );\n};\n\nexport const useAdminPutUser = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPutUser>,\n TError,\n { userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPutUser>,\n { userid: string }\n > = (props) => {\n const { userid } = props || {};\n\n return adminPutUser(userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPutUser>,\n TError,\n { userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a user account, along with all the user's Datasets\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Deletes a user account\n */\nexport const adminDeleteUser = (\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/admin/user/${userid}`, method: \"delete\", data: undefined },\n options\n );\n};\n\nexport const useAdminDeleteUser = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminDeleteUser>,\n TError,\n { userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminDeleteUser>,\n { userid: string }\n > = (props) => {\n const { userid } = props || {};\n\n return adminDeleteUser(userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminDeleteUser>,\n TError,\n { userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Patches a user record, typcially to suspend or re-enable a user account\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Patch a given user\n */\nexport const adminPatchUser = (\n userid: string,\n userPatchBodyBody: UserPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (userPatchBodyBody.suspend_message !== undefined) {\n formData.append(\"suspend_message\", userPatchBodyBody.suspend_message);\n }\n\n return customInstance<void>(\n { url: `/admin/user/${userid}`, method: \"patch\", data: formData },\n options\n );\n};\n\nexport const useAdminPatchUser = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPatchUser>,\n TError,\n { userid: string; data: UserPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPatchUser>,\n { userid: string; data: UserPatchBodyBody }\n > = (props) => {\n const { userid, data } = props || {};\n\n return adminPatchUser(userid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPatchUser>,\n TError,\n { userid: string; data: UserPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],
5
- "mappings": "gDAUA,wDAuCO,GAAM,GAAwB,CACnC,EACA,IAEO,EACL,CAAE,IAAK,uBAAwB,OAAQ,MAAO,UAC9C,GAIS,EAAmC,AAC9C,GACG,CAAC,uBAAwB,GAAI,EAAS,CAAC,GAAU,IAEzC,EAA2B,CAItC,EACA,IAQ2D,CA5E7D,MA6EE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EACJ,oBAAc,WAAd,OAA0B,EAAiC,GAMvD,EAAQ,EAIZ,EANE,IAAM,EAAsB,EAAQ,GAMnB,GAErB,MAAO,IACL,YACG,IAWM,EAAyB,CACpC,EACA,IAEO,EACL,CACE,IAAK,wBAAwB,IAC7B,OAAQ,QACR,KAAM,QAER,GAIS,EAA4B,AAGvC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,WAAY,GAAS,GAE7B,MAAO,GAAuB,EAAS,IAQ3B,IASH,EAA0B,CACrC,EACA,IAEO,EACL,CACE,IAAK,wBAAwB,IAC7B,OAAQ,SACR,KAAM,QAER,GAIS,EAA6B,AAGxC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,WAAY,GAAS,GAE7B,MAAO,GAAwB,EAAS,IAQ5B,IASH,EAAe,CAC1B,EACA,IAEO,EACL,CAAE,IAAK,eAAe,IAAU,OAAQ,MAAO,KAAM,QACrD,GAIS,EAAkB,AAG7B,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,UAAW,GAAS,GAE5B,MAAO,GAAa,EAAQ,IAQhB,IASH,EAAkB,CAC7B,EACA,IAEO,EACL,CAAE,IAAK,eAAe,IAAU,OAAQ,SAAU,KAAM,QACxD,GAIS,EAAqB,AAGhC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,UAAW,GAAS,GAE5B,MAAO,GAAgB,EAAQ,IAQnB,IASH,EAAiB,CAC5B,EACA,EACA,IACG,CACH,GAAM,GAAW,GAAI,UACrB,MAAI,GAAkB,kBAAoB,QACxC,EAAS,OAAO,kBAAmB,EAAkB,iBAGhD,EACL,CAAE,IAAK,eAAe,IAAU,OAAQ,QAAS,KAAM,GACvD,IAIS,EAAoB,AAG/B,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,SAAQ,QAAS,GAAS,GAElC,MAAO,GAAe,EAAQ,EAAM,IAQxB",
3
+ "sources": ["../../src/admin/admin.ts", "../../src/custom-instance.ts"],
4
+ "sourcesContent": ["/**\n * Generated by orval v6.4.2 \uD83C\uDF7A\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.6\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServiceErrorsGetResponse,\n DmError,\n AdminGetServiceErrorsParams,\n AdminUserPutResponse,\n UserPatchBodyBody,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Displays the existing Service Errors, which can also include acnowledged errors, normally excluded from the list.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Gets Service Errors\n */\nexport const adminGetServiceErrors = (\n params?: AdminGetServiceErrorsParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceErrorsGetResponse>(\n { url: `/admin/service-error`, method: \"get\", params },\n options\n );\n};\n\nexport const getAdminGetServiceErrorsQueryKey = (\n params?: AdminGetServiceErrorsParams\n) => [`/admin/service-error`, ...(params ? [params] : [])];\n\nexport const useAdminGetServiceErrors = <\n TData = AsyncReturnType<typeof adminGetServiceErrors>,\n TError = ErrorType<void | DmError>\n>(\n params?: AdminGetServiceErrorsParams,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof adminGetServiceErrors>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAdminGetServiceErrorsQueryKey(params);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof adminGetServiceErrors>\n > = () => adminGetServiceErrors(params, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof adminGetServiceErrors>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Used primarily to 'Acknowledge' but not delete a Service Error.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Patches a Service Error\n */\nexport const adminPatchServiceError = (\n errorid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/admin/service-error/${errorid}`,\n method: \"patch\",\n data: undefined,\n },\n options\n );\n};\n\nexport const useAdminPatchServiceError = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPatchServiceError>,\n TError,\n { errorid: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPatchServiceError>,\n { errorid: number }\n > = (props) => {\n const { errorid } = props || {};\n\n return adminPatchServiceError(errorid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPatchServiceError>,\n TError,\n { errorid: number },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes an existing Service Error.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Deletes a Service Error\n */\nexport const adminDeleteServiceError = (\n errorid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/admin/service-error/${errorid}`,\n method: \"delete\",\n data: undefined,\n },\n options\n );\n};\n\nexport const useAdminDeleteServiceError = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminDeleteServiceError>,\n TError,\n { errorid: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminDeleteServiceError>,\n { errorid: number }\n > = (props) => {\n const { errorid } = props || {};\n\n return adminDeleteServiceError(errorid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminDeleteServiceError>,\n TError,\n { errorid: number },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * This method adds a user to the Data Manager service. The user is authenticated via a keycloak server but will need an initialised account before they can create Datasets or Projects.\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Prepares a user account in the Data Manager service\n */\nexport const adminPutUser = (\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<AdminUserPutResponse>(\n { url: `/admin/user/${userid}`, method: \"put\", data: undefined },\n options\n );\n};\n\nexport const useAdminPutUser = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPutUser>,\n TError,\n { userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPutUser>,\n { userid: string }\n > = (props) => {\n const { userid } = props || {};\n\n return adminPutUser(userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPutUser>,\n TError,\n { userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a user account, along with all the user's Datasets\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Deletes a user account\n */\nexport const adminDeleteUser = (\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/admin/user/${userid}`, method: \"delete\", data: undefined },\n options\n );\n};\n\nexport const useAdminDeleteUser = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminDeleteUser>,\n TError,\n { userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminDeleteUser>,\n { userid: string }\n > = (props) => {\n const { userid } = props || {};\n\n return adminDeleteUser(userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminDeleteUser>,\n TError,\n { userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Patches a user record, typcially to suspend or re-enable a user account\n\nYou will need **admin** rights to use this endpoint\n\n * @summary Patch a given user\n */\nexport const adminPatchUser = (\n userid: string,\n userPatchBodyBody: UserPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (userPatchBodyBody.suspend_message !== undefined) {\n formData.append(\"suspend_message\", userPatchBodyBody.suspend_message);\n }\n\n return customInstance<void>(\n { url: `/admin/user/${userid}`, method: \"patch\", data: formData },\n options\n );\n};\n\nexport const useAdminPatchUser = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof adminPatchUser>,\n TError,\n { userid: string; data: UserPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof adminPatchUser>,\n { userid: string; data: UserPatchBodyBody }\n > = (props) => {\n const { userid, data } = props || {};\n\n return adminPatchUser(userid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof adminPatchUser>,\n TError,\n { userid: string; data: UserPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n", "/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\n// ? Need the baseUrl or does it default to ''?\nexport const AXIOS_INSTANCE = Axios.create({ baseURL: '' });\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
@@ -2,5 +2,6 @@
2
2
  "module": "./admin.js",
3
3
  "main": "./admin.cjs",
4
4
  "types": "./admin.d.ts",
5
- "sideEffects": false
5
+ "sideEffects": false,
6
+ "type": "module"
6
7
  }
@@ -1,2 +1,102 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3KO3PKBXcjs = require('../chunk-3KO3PKBX.cjs');var _reactquery = require('react-query');var i=e=>_chunk3KO3PKBXcjs.e.call(void 0, {url:"/application",method:"get"},e),T= exports.getGetApplicationsQueryKey =()=>["/application"],D= exports.useGetApplications =e=>{var o;let{query:t,request:r}=e||{},n=(o=t==null?void 0:t.queryKey)!=null?o:T(),a=_reactquery.useQuery.call(void 0, n,()=>i(r),t);return _chunk3KO3PKBXcjs.a.call(void 0, {queryKey:n},a)},A= exports.getApplication =(e,t)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/application/${e}`,method:"get"},t),l= exports.getGetApplicationQueryKey =e=>[`/application/${e}`],K= exports.useGetApplication =(e,t)=>{var c;let{query:r,request:n}=t||{},y=(c=r==null?void 0:r.queryKey)!=null?c:l(e),o=_reactquery.useQuery.call(void 0, y,()=>A(e,n),_chunk3KO3PKBXcjs.a.call(void 0, {enabled:!!e},r));return _chunk3KO3PKBXcjs.a.call(void 0, {queryKey:y},o)};exports.getApplication = A; exports.getApplications = i; exports.getGetApplicationQueryKey = l; exports.getGetApplicationsQueryKey = T; exports.useGetApplication = K; exports.useGetApplications = D;
2
- //# sourceMappingURL=application.cjs.map
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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
+ var __export = (target, all) => {
26
+ __markAsModule(target);
27
+ for (var name in all)
28
+ __defProp(target, name, { get: all[name], enumerable: true });
29
+ };
30
+ var __reExport = (target, module2, desc) => {
31
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
32
+ for (let key of __getOwnPropNames(module2))
33
+ if (!__hasOwnProp.call(target, key) && key !== "default")
34
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
35
+ }
36
+ return target;
37
+ };
38
+ var __toModule = (module2) => {
39
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
40
+ };
41
+
42
+ // src/application/application.ts
43
+ __export(exports, {
44
+ getApplication: () => getApplication,
45
+ getApplications: () => getApplications,
46
+ getGetApplicationQueryKey: () => getGetApplicationQueryKey,
47
+ getGetApplicationsQueryKey: () => getGetApplicationsQueryKey,
48
+ useGetApplication: () => useGetApplication,
49
+ useGetApplications: () => useGetApplications
50
+ });
51
+ var import_react_query = __toModule(require("react-query"));
52
+
53
+ // src/custom-instance.ts
54
+ var import_axios = __toModule(require("axios"));
55
+ var AXIOS_INSTANCE = import_axios.default.create({ baseURL: "" });
56
+ var customInstance = (config, options) => {
57
+ const source = import_axios.default.CancelToken.source();
58
+ const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
59
+ promise.cancel = () => {
60
+ source.cancel("Query was cancelled by React Query");
61
+ };
62
+ return promise;
63
+ };
64
+
65
+ // src/application/application.ts
66
+ var getApplications = (options) => {
67
+ return customInstance({ url: `/application`, method: "get" }, options);
68
+ };
69
+ var getGetApplicationsQueryKey = () => [`/application`];
70
+ var useGetApplications = (options) => {
71
+ const { query: queryOptions, request: requestOptions } = options || {};
72
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetApplicationsQueryKey();
73
+ const queryFn = () => getApplications(requestOptions);
74
+ const query = (0, import_react_query.useQuery)(queryKey, queryFn, queryOptions);
75
+ return __spreadValues({
76
+ queryKey
77
+ }, query);
78
+ };
79
+ var getApplication = (applicationid, options) => {
80
+ return customInstance({ url: `/application/${applicationid}`, method: "get" }, options);
81
+ };
82
+ var getGetApplicationQueryKey = (applicationid) => [
83
+ `/application/${applicationid}`
84
+ ];
85
+ var useGetApplication = (applicationid, options) => {
86
+ const { query: queryOptions, request: requestOptions } = options || {};
87
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetApplicationQueryKey(applicationid);
88
+ const queryFn = () => getApplication(applicationid, requestOptions);
89
+ const query = (0, import_react_query.useQuery)(queryKey, queryFn, __spreadValues({ enabled: !!applicationid }, queryOptions));
90
+ return __spreadValues({
91
+ queryKey
92
+ }, query);
93
+ };
94
+ // Annotate the CommonJS export names for ESM import in node:
95
+ 0 && (module.exports = {
96
+ getApplication,
97
+ getApplications,
98
+ getGetApplicationQueryKey,
99
+ getGetApplicationsQueryKey,
100
+ useGetApplication,
101
+ useGetApplications
102
+ });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/application/application.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.4.0 \uD83C\uDF7A\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.6\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ApplicationsGetResponse,\n DmError,\n ApplicationGetResponse,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Get a list of all applications available to you that can be instantiated via the `/instance` endpoint.\n\nApplication availability will vary as applications are added to the cluster.\n\n * @summary Get all Applications available to you\n */\nexport const getApplications = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ApplicationsGetResponse>(\n { url: `/application`, method: \"get\" },\n options\n );\n};\n\nexport const getGetApplicationsQueryKey = () => [`/application`];\n\nexport const useGetApplications = <\n TData = AsyncReturnType<typeof getApplications>,\n TError = ErrorType<DmError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getApplications>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetApplicationsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getApplications>> = () =>\n getApplications(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getApplications>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Get details of a specific application available to you that can be instantiated.\n\n * @summary Get details of a specific application\n */\nexport const getApplication = (\n applicationid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ApplicationGetResponse>(\n { url: `/application/${applicationid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetApplicationQueryKey = (applicationid: string) => [\n `/application/${applicationid}`,\n];\n\nexport const useGetApplication = <\n TData = AsyncReturnType<typeof getApplication>,\n TError = ErrorType<void | DmError>\n>(\n applicationid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getApplication>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetApplicationQueryKey(applicationid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getApplication>> = () =>\n getApplication(applicationid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getApplication>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!applicationid, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"],
5
- "mappings": "iDAUA,uCAkCO,GAAM,GAAkB,AAC7B,GAEO,EACL,CAAE,IAAK,eAAgB,OAAQ,OAC/B,GAIS,EAA6B,IAAM,CAAC,gBAEpC,EAAqB,AAGhC,GAO4D,CAjE9D,MAkEE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EAAW,oBAAc,WAAd,OAA0B,IAKrC,EAAQ,EAIZ,EAPsE,IACtE,EAAgB,GAMG,GAErB,MAAO,IACL,YACG,IASM,EAAiB,CAC5B,EACA,IAEO,EACL,CAAE,IAAK,gBAAgB,IAAiB,OAAQ,OAChD,GAIS,EAA4B,AAAC,GAA0B,CAClE,gBAAgB,KAGL,EAAoB,CAI/B,EACA,IAQ2D,CArH7D,MAsHE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EACJ,oBAAc,WAAd,OAA0B,EAA0B,GAKhD,EAAQ,EACZ,EAJqE,IACrE,EAAe,EAAe,GAK9B,GAAE,QAAS,CAAC,CAAC,GAAkB,IAGjC,MAAO,IACL,YACG",
3
+ "sources": ["../../src/application/application.ts", "../../src/custom-instance.ts"],
4
+ "sourcesContent": ["/**\n * Generated by orval v6.4.2 \uD83C\uDF7A\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.6\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ApplicationsGetResponse,\n DmError,\n ApplicationGetResponse,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Get a list of all applications available to you that can be instantiated via the `/instance` endpoint.\n\nApplication availability will vary as applications are added to the cluster.\n\n * @summary Get all Applications available to you\n */\nexport const getApplications = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ApplicationsGetResponse>(\n { url: `/application`, method: \"get\" },\n options\n );\n};\n\nexport const getGetApplicationsQueryKey = () => [`/application`];\n\nexport const useGetApplications = <\n TData = AsyncReturnType<typeof getApplications>,\n TError = ErrorType<DmError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getApplications>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetApplicationsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getApplications>> = () =>\n getApplications(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getApplications>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Get details of a specific application available to you that can be instantiated.\n\n * @summary Get details of a specific application\n */\nexport const getApplication = (\n applicationid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ApplicationGetResponse>(\n { url: `/application/${applicationid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetApplicationQueryKey = (applicationid: string) => [\n `/application/${applicationid}`,\n];\n\nexport const useGetApplication = <\n TData = AsyncReturnType<typeof getApplication>,\n TError = ErrorType<void | DmError>\n>(\n applicationid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getApplication>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetApplicationQueryKey(applicationid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getApplication>> = () =>\n getApplication(applicationid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getApplication>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!applicationid, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n", "/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\n// ? Need the baseUrl or does it default to ''?\nexport const AXIOS_INSTANCE = Axios.create({ baseURL: '' });\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,yBAMO;;;ACNP,mBAAsD;AAG/C,IAAM,iBAAiB,qBAAM,OAAO,EAAE,SAAS;AAmB/C,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,qBAAM,YAAY;AAEjC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,UAAS,KACnF,CAAC,EAAE,WAAW;AAKhB,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO;AAAA;AAGhB,SAAO;AAAA;;;ADJF,IAAM,kBAAkB,CAC7B,YACG;AACH,SAAO,eACL,EAAE,KAAK,gBAAgB,QAAQ,SAC/B;AAAA;AAIG,IAAM,6BAA6B,MAAM,CAAC;AAE1C,IAAM,qBAAqB,CAGhC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY;AAE3C,QAAM,UAAkE,MACtE,gBAAgB;AAElB,QAAM,QAAQ,iCAIZ,UAAU,SAAS;AAErB,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AASA,IAAM,iBAAiB,CAC5B,eACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,gBAAgB,iBAAiB,QAAQ,SAChD;AAAA;AAIG,IAAM,4BAA4B,CAAC,kBAA0B;AAAA,EAClE,gBAAgB;AAAA;AAGX,IAAM,oBAAoB,CAI/B,eACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WACJ,8CAAc,aAAY,0BAA0B;AAEtD,QAAM,UAAiE,MACrE,eAAe,eAAe;AAEhC,QAAM,QAAQ,iCACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,iBAAkB;AAGjC,SAAO;AAAA,IACL;AAAA,KACG;AAAA;",
6
6
  "names": []
7
7
  }