@learnorama/mozaik-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -0
- package/dist/api/account.d.ts +75 -0
- package/dist/api/account.js +117 -0
- package/dist/api/account.js.map +1 -0
- package/dist/api/admin-catalogue.d.ts +68 -0
- package/dist/api/admin-catalogue.js +155 -0
- package/dist/api/admin-catalogue.js.map +1 -0
- package/dist/api/admin-consumption.d.ts +27 -0
- package/dist/api/admin-consumption.js +55 -0
- package/dist/api/admin-consumption.js.map +1 -0
- package/dist/api/admin-licenses.d.ts +21 -0
- package/dist/api/admin-licenses.js +34 -0
- package/dist/api/admin-licenses.js.map +1 -0
- package/dist/api/admin-patrons.d.ts +36 -0
- package/dist/api/admin-patrons.js +76 -0
- package/dist/api/admin-patrons.js.map +1 -0
- package/dist/api/admin-reviews.d.ts +30 -0
- package/dist/api/admin-reviews.js +63 -0
- package/dist/api/admin-reviews.js.map +1 -0
- package/dist/api/admin-roles.d.ts +34 -0
- package/dist/api/admin-roles.js +62 -0
- package/dist/api/admin-roles.js.map +1 -0
- package/dist/api/admin-support.d.ts +68 -0
- package/dist/api/admin-support.js +116 -0
- package/dist/api/admin-support.js.map +1 -0
- package/dist/api/admin-tenants.d.ts +33 -0
- package/dist/api/admin-tenants.js +68 -0
- package/dist/api/admin-tenants.js.map +1 -0
- package/dist/api/admin-tutoring.d.ts +159 -0
- package/dist/api/admin-tutoring.js +455 -0
- package/dist/api/admin-tutoring.js.map +1 -0
- package/dist/api/auth.d.ts +92 -0
- package/dist/api/auth.js +192 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/biblio-catalogue.d.ts +122 -0
- package/dist/api/biblio-catalogue.js +223 -0
- package/dist/api/biblio-catalogue.js.map +1 -0
- package/dist/api/biblio-home.d.ts +18 -0
- package/dist/api/biblio-home.js +31 -0
- package/dist/api/biblio-home.js.map +1 -0
- package/dist/api/biblio-library.d.ts +94 -0
- package/dist/api/biblio-library.js +187 -0
- package/dist/api/biblio-library.js.map +1 -0
- package/dist/api/biblio-nextory.d.ts +43 -0
- package/dist/api/biblio-nextory.js +65 -0
- package/dist/api/biblio-nextory.js.map +1 -0
- package/dist/api/biblio-press.d.ts +38 -0
- package/dist/api/biblio-press.js +70 -0
- package/dist/api/biblio-press.js.map +1 -0
- package/dist/api/biblio-search.d.ts +17 -0
- package/dist/api/biblio-search.js +30 -0
- package/dist/api/biblio-search.js.map +1 -0
- package/dist/api/biblio-telemetry.d.ts +28 -0
- package/dist/api/biblio-telemetry.js +49 -0
- package/dist/api/biblio-telemetry.js.map +1 -0
- package/dist/api/consumption.d.ts +30 -0
- package/dist/api/consumption.js +45 -0
- package/dist/api/consumption.js.map +1 -0
- package/dist/api/cvs-app.d.ts +39 -0
- package/dist/api/cvs-app.js +72 -0
- package/dist/api/cvs-app.js.map +1 -0
- package/dist/api/cvs-documents.d.ts +106 -0
- package/dist/api/cvs-documents.js +208 -0
- package/dist/api/cvs-documents.js.map +1 -0
- package/dist/api/cvs-favorites.d.ts +53 -0
- package/dist/api/cvs-favorites.js +82 -0
- package/dist/api/cvs-favorites.js.map +1 -0
- package/dist/api/cvs-loans.d.ts +59 -0
- package/dist/api/cvs-loans.js +106 -0
- package/dist/api/cvs-loans.js.map +1 -0
- package/dist/api/cvs-streaming.d.ts +40 -0
- package/dist/api/cvs-streaming.js +68 -0
- package/dist/api/cvs-streaming.js.map +1 -0
- package/dist/api/index.d.ts +34 -0
- package/dist/api/index.js +34 -0
- package/dist/api/partner-catalogue.d.ts +77 -0
- package/dist/api/partner-catalogue.js +125 -0
- package/dist/api/partner-catalogue.js.map +1 -0
- package/dist/api/partner-reader.d.ts +56 -0
- package/dist/api/partner-reader.js +103 -0
- package/dist/api/partner-reader.js.map +1 -0
- package/dist/api/profiles.d.ts +64 -0
- package/dist/api/profiles.js +126 -0
- package/dist/api/profiles.js.map +1 -0
- package/dist/api/tutoring-catalogue.d.ts +32 -0
- package/dist/api/tutoring-catalogue.js +59 -0
- package/dist/api/tutoring-catalogue.js.map +1 -0
- package/dist/api/tutoring-chat.d.ts +31 -0
- package/dist/api/tutoring-chat.js +71 -0
- package/dist/api/tutoring-chat.js.map +1 -0
- package/dist/api/tutoring-dispatch.d.ts +37 -0
- package/dist/api/tutoring-dispatch.js +83 -0
- package/dist/api/tutoring-dispatch.js.map +1 -0
- package/dist/api/tutoring-practitioner.d.ts +55 -0
- package/dist/api/tutoring-practitioner.js +110 -0
- package/dist/api/tutoring-practitioner.js.map +1 -0
- package/dist/api/tutoring-requests.d.ts +86 -0
- package/dist/api/tutoring-requests.js +176 -0
- package/dist/api/tutoring-requests.js.map +1 -0
- package/dist/client-BDwBZYB0.d.ts +28 -0
- package/dist/client-D3kMOcIr.js +61 -0
- package/dist/client-D3kMOcIr.js.map +1 -0
- package/dist/index-wL_20vR8.d.ts +4566 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +3 -0
- package/dist/models.js +175 -0
- package/dist/models.js.map +1 -0
- package/dist/react/account.d.ts +163 -0
- package/dist/react/account.js +240 -0
- package/dist/react/account.js.map +1 -0
- package/dist/react/admin-catalogue.d.ts +196 -0
- package/dist/react/admin-catalogue.js +336 -0
- package/dist/react/admin-catalogue.js.map +1 -0
- package/dist/react/admin-consumption.d.ts +75 -0
- package/dist/react/admin-consumption.js +127 -0
- package/dist/react/admin-consumption.js.map +1 -0
- package/dist/react/admin-licenses.d.ts +50 -0
- package/dist/react/admin-licenses.js +78 -0
- package/dist/react/admin-licenses.js.map +1 -0
- package/dist/react/admin-patrons.d.ts +111 -0
- package/dist/react/admin-patrons.js +173 -0
- package/dist/react/admin-patrons.js.map +1 -0
- package/dist/react/admin-reviews.d.ts +78 -0
- package/dist/react/admin-reviews.js +135 -0
- package/dist/react/admin-reviews.js.map +1 -0
- package/dist/react/admin-roles.d.ts +82 -0
- package/dist/react/admin-roles.js +135 -0
- package/dist/react/admin-roles.js.map +1 -0
- package/dist/react/admin-support.d.ts +123 -0
- package/dist/react/admin-support.js +208 -0
- package/dist/react/admin-support.js.map +1 -0
- package/dist/react/admin-tenants.d.ts +108 -0
- package/dist/react/admin-tenants.js +165 -0
- package/dist/react/admin-tenants.js.map +1 -0
- package/dist/react/admin-tutoring.d.ts +556 -0
- package/dist/react/admin-tutoring.js +954 -0
- package/dist/react/admin-tutoring.js.map +1 -0
- package/dist/react/auth.d.ts +220 -0
- package/dist/react/auth.js +372 -0
- package/dist/react/auth.js.map +1 -0
- package/dist/react/biblio-catalogue.d.ts +374 -0
- package/dist/react/biblio-catalogue.js +498 -0
- package/dist/react/biblio-catalogue.js.map +1 -0
- package/dist/react/biblio-home.d.ts +47 -0
- package/dist/react/biblio-home.js +75 -0
- package/dist/react/biblio-home.js.map +1 -0
- package/dist/react/biblio-library.d.ts +285 -0
- package/dist/react/biblio-library.js +411 -0
- package/dist/react/biblio-library.js.map +1 -0
- package/dist/react/biblio-nextory.d.ts +100 -0
- package/dist/react/biblio-nextory.js +163 -0
- package/dist/react/biblio-nextory.js.map +1 -0
- package/dist/react/biblio-press.d.ts +121 -0
- package/dist/react/biblio-press.js +163 -0
- package/dist/react/biblio-press.js.map +1 -0
- package/dist/react/biblio-search.d.ts +46 -0
- package/dist/react/biblio-search.js +74 -0
- package/dist/react/biblio-search.js.map +1 -0
- package/dist/react/biblio-telemetry.d.ts +49 -0
- package/dist/react/biblio-telemetry.js +85 -0
- package/dist/react/biblio-telemetry.js.map +1 -0
- package/dist/react/consumption.d.ts +66 -0
- package/dist/react/consumption.js +109 -0
- package/dist/react/consumption.js.map +1 -0
- package/dist/react/cvs-app.d.ts +86 -0
- package/dist/react/cvs-app.js +144 -0
- package/dist/react/cvs-app.js.map +1 -0
- package/dist/react/cvs-documents.d.ts +254 -0
- package/dist/react/cvs-documents.js +418 -0
- package/dist/react/cvs-documents.js.map +1 -0
- package/dist/react/cvs-favorites.d.ts +143 -0
- package/dist/react/cvs-favorites.js +206 -0
- package/dist/react/cvs-favorites.js.map +1 -0
- package/dist/react/cvs-loans.d.ts +140 -0
- package/dist/react/cvs-loans.js +234 -0
- package/dist/react/cvs-loans.js.map +1 -0
- package/dist/react/cvs-streaming.d.ts +87 -0
- package/dist/react/cvs-streaming.js +141 -0
- package/dist/react/cvs-streaming.js.map +1 -0
- package/dist/react/index.d.ts +34 -0
- package/dist/react/index.js +34 -0
- package/dist/react/partner-catalogue.d.ts +223 -0
- package/dist/react/partner-catalogue.js +301 -0
- package/dist/react/partner-catalogue.js.map +1 -0
- package/dist/react/partner-reader.d.ts +159 -0
- package/dist/react/partner-reader.js +226 -0
- package/dist/react/partner-reader.js.map +1 -0
- package/dist/react/profiles.d.ts +174 -0
- package/dist/react/profiles.js +279 -0
- package/dist/react/profiles.js.map +1 -0
- package/dist/react/tutoring-catalogue.d.ts +115 -0
- package/dist/react/tutoring-catalogue.js +151 -0
- package/dist/react/tutoring-catalogue.js.map +1 -0
- package/dist/react/tutoring-chat.d.ts +96 -0
- package/dist/react/tutoring-chat.js +172 -0
- package/dist/react/tutoring-chat.js.map +1 -0
- package/dist/react/tutoring-dispatch.d.ts +102 -0
- package/dist/react/tutoring-dispatch.js +183 -0
- package/dist/react/tutoring-dispatch.js.map +1 -0
- package/dist/react/tutoring-practitioner.d.ts +129 -0
- package/dist/react/tutoring-practitioner.js +230 -0
- package/dist/react/tutoring-practitioner.js.map +1 -0
- package/dist/react/tutoring-requests.d.ts +233 -0
- package/dist/react/tutoring-requests.js +385 -0
- package/dist/react/tutoring-requests.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/admin-reviews/admin-reviews.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const withQueryKey = (query, queryKey) => {
|
|
13
|
+
const result = { queryKey };
|
|
14
|
+
for (const key of Object.keys(query)) {
|
|
15
|
+
if (key === "queryKey") continue;
|
|
16
|
+
Object.defineProperty(result, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get: () => query[key]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const getListReviewsUrl = (params) => {
|
|
25
|
+
const normalizedParams = new URLSearchParams();
|
|
26
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
27
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
28
|
+
});
|
|
29
|
+
const stringifiedParams = normalizedParams.toString();
|
|
30
|
+
return stringifiedParams.length > 0 ? `/admin/reviews?${stringifiedParams}` : `/admin/reviews`;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Reviews awaiting a decision, oldest first.
|
|
34
|
+
*
|
|
35
|
+
* Oldest first on purpose: a moderation queue sorted newest-first starves its
|
|
36
|
+
* tail, and the review that has waited longest is the one whose author is
|
|
37
|
+
* wondering what happened.
|
|
38
|
+
* @summary List Reviews
|
|
39
|
+
*/
|
|
40
|
+
const listReviews = async (params, options) => {
|
|
41
|
+
return request(getListReviewsUrl(params), {
|
|
42
|
+
...options,
|
|
43
|
+
method: "GET"
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const getListReviewsQueryKey = (params) => {
|
|
47
|
+
return [`/admin/reviews`, ...params ? [params] : []];
|
|
48
|
+
};
|
|
49
|
+
const getListReviewsQueryOptions = (params, options) => {
|
|
50
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
51
|
+
const queryKey = queryOptions?.queryKey ?? getListReviewsQueryKey(params);
|
|
52
|
+
const queryFn = ({ signal }) => listReviews(params, {
|
|
53
|
+
signal,
|
|
54
|
+
...requestOptions
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
queryKey,
|
|
58
|
+
queryFn,
|
|
59
|
+
...queryOptions
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* @summary List Reviews
|
|
64
|
+
*/
|
|
65
|
+
function useListReviews(params, options, queryClient) {
|
|
66
|
+
const queryOptions = getListReviewsQueryOptions(params, options);
|
|
67
|
+
const query = useQuery(queryOptions, queryClient);
|
|
68
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
69
|
+
}
|
|
70
|
+
const getModerateReviewUrl = (reviewId) => {
|
|
71
|
+
return `/admin/reviews/${reviewId}/moderation`;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Publish or reject one review.
|
|
75
|
+
*
|
|
76
|
+
* ``PUT`` on a moderation sub-resource rather than ``POST /approve`` and
|
|
77
|
+
* ``POST /reject``: the outcome is a state the review is *in*, not two different
|
|
78
|
+
* events, and a repeated decision must be harmless.
|
|
79
|
+
*
|
|
80
|
+
* Rejecting requires a reason. The author is owed one, and the moderator is the
|
|
81
|
+
* only person who has it — the audit row is where it survives after the queue
|
|
82
|
+
* has moved on.
|
|
83
|
+
* @summary Moderate Review
|
|
84
|
+
*/
|
|
85
|
+
const moderateReview = async (reviewId, moderationWrite, options) => {
|
|
86
|
+
const getHeaders = (h) => {
|
|
87
|
+
if (!h) return {};
|
|
88
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
89
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
90
|
+
const headers = {};
|
|
91
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
92
|
+
return headers;
|
|
93
|
+
};
|
|
94
|
+
return request(getModerateReviewUrl(reviewId), {
|
|
95
|
+
...options,
|
|
96
|
+
method: "PUT",
|
|
97
|
+
headers: {
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
...getHeaders(options?.headers)
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify(moderationWrite)
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
const getModerateReviewMutationKey = () => ["moderateReview"];
|
|
105
|
+
const getModerateReviewMutationOptions = (options) => {
|
|
106
|
+
const mutationKey = getModerateReviewMutationKey();
|
|
107
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
108
|
+
...options,
|
|
109
|
+
mutation: {
|
|
110
|
+
...options.mutation,
|
|
111
|
+
mutationKey
|
|
112
|
+
}
|
|
113
|
+
} : {
|
|
114
|
+
mutation: { mutationKey },
|
|
115
|
+
request: void 0
|
|
116
|
+
};
|
|
117
|
+
const mutationFn = (props) => {
|
|
118
|
+
const { reviewId, data } = props ?? {};
|
|
119
|
+
return moderateReview(reviewId, data, requestOptions);
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
mutationFn,
|
|
123
|
+
...mutationOptions
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* @summary Moderate Review
|
|
128
|
+
*/
|
|
129
|
+
const useModerateReview = (options, queryClient) => {
|
|
130
|
+
return useMutation(getModerateReviewMutationOptions(options), queryClient);
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
export { getListReviewsQueryKey, getListReviewsQueryOptions, getListReviewsUrl, getModerateReviewMutationKey, getModerateReviewMutationOptions, getModerateReviewUrl, listReviews, moderateReview, useListReviews, useModerateReview };
|
|
134
|
+
|
|
135
|
+
//# sourceMappingURL=admin-reviews.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-reviews.js","names":[],"sources":["../../src/react/admin-reviews/admin-reviews.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ListReviewsParams,\n ModerationWrite,\n ReviewModerationRead,\n ReviewPage,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListReviewsUrl = (params?: ListReviewsParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/admin/reviews?${stringifiedParams}` : `/admin/reviews`\n}\n\n/**\n * Reviews awaiting a decision, oldest first.\n *\n * Oldest first on purpose: a moderation queue sorted newest-first starves its\n * tail, and the review that has waited longest is the one whose author is\n * wondering what happened.\n * @summary List Reviews\n */\nexport const listReviews = async (params?: ListReviewsParams, options?: Parameters<typeof request>[1]): Promise<ReviewPage> => {\n\n return request<ReviewPage>(getListReviewsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListReviewsQueryKey = (params?: ListReviewsParams,) => {\n return [\n `/admin/reviews`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListReviewsQueryOptions = <TData = Awaited<ReturnType<typeof listReviews>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListReviewsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListReviewsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listReviews>>> = ({ signal }) => listReviews(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListReviewsQueryResult = NonNullable<Awaited<ReturnType<typeof listReviews>>>\nexport type ListReviewsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListReviews<TData = Awaited<ReturnType<typeof listReviews>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListReviewsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listReviews>>,\n TError,\n Awaited<ReturnType<typeof listReviews>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListReviews<TData = Awaited<ReturnType<typeof listReviews>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListReviewsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listReviews>>,\n TError,\n Awaited<ReturnType<typeof listReviews>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListReviews<TData = Awaited<ReturnType<typeof listReviews>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListReviewsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Reviews\n */\n\nexport function useListReviews<TData = Awaited<ReturnType<typeof listReviews>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListReviewsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListReviewsQueryOptions(params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getModerateReviewUrl = (reviewId: number,) => {\n\n\n\n\n return `/admin/reviews/${reviewId}/moderation`\n}\n\n/**\n * Publish or reject one review.\n *\n * ``PUT`` on a moderation sub-resource rather than ``POST /approve`` and\n * ``POST /reject``: the outcome is a state the review is *in*, not two different\n * events, and a repeated decision must be harmless.\n *\n * Rejecting requires a reason. The author is owed one, and the moderator is the\n * only person who has it — the audit row is where it survives after the queue\n * has moved on.\n * @summary Moderate Review\n */\nexport const moderateReview = async (reviewId: number,\n moderationWrite: ModerationWrite, options?: Parameters<typeof request>[1]): Promise<ReviewModerationRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<ReviewModerationRead>(getModerateReviewUrl(reviewId),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(moderationWrite)\n }\n);}\n\n\n\n\n\nexport const getModerateReviewMutationKey = () => ['moderateReview'] as const;\n\nexport const getModerateReviewMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof moderateReview>>, TError,ModerateReviewMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof moderateReview>>, TError,ModerateReviewMutationVariables, TContext> => {\n\nconst mutationKey = getModerateReviewMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof moderateReview>>, ModerateReviewMutationVariables> = (props) => {\n const {reviewId,data} = props ?? {};\n\n return moderateReview(reviewId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ModerateReviewMutationResult = NonNullable<Awaited<ReturnType<typeof moderateReview>>>\n export type ModerateReviewMutationBody = BodyType<ModerationWrite>\n export type ModerateReviewMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ModerateReviewMutationVariables = {reviewId: number;data: BodyType<ModerationWrite>}\n\n /**\n * @summary Moderate Review\n */\nexport const useModerateReview = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof moderateReview>>, TError,ModerateReviewMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof moderateReview>>,\n TError,\n ModerateReviewMutationVariables,\n TContext\n > => {\n return useMutation(getModerateReviewMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,qBAAqB,WAAgC;CAChE,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAErD,IAAI,UAAU,KAAA,GACZ,iBAAiB,OAAO,KAAK,UAAU,OAAO,SAAS,OAAO,KAAK,CAAC;CAExE,CAAC;CAED,MAAM,oBAAoB,iBAAiB,SAAS;CAEpD,OAAO,kBAAkB,SAAS,IAAI,kBAAkB,sBAAsB;AAChF;;;;;;;;;AAUA,MAAa,cAAc,OAAO,QAA4B,YAAiE;CAE7H,OAAO,QAAoB,kBAAkB,MAAM,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,0BAA0B,WAAgC;CACnE,OAAO,CACP,kBAAkB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAC3C;AACA;AAGJ,MAAa,8BAAoJ,QAA4B,YACxL;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,uBAAuB,MAAM;CAIvE,MAAM,WAAmE,EAAE,aAAa,YAAY,QAAQ;EAAE;EAAQ,GAAG;CAAe,CAAC;CAM1I,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,eACf,QAA4B,SAC1B,aACiF;CAElF,MAAM,eAAe,2BAA2B,QAAO,OAAO;CAE9D,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD;AAOA,MAAa,wBAAwB,aAAsB;CAKzD,OAAO,kBAAkB,SAAS;AACpC;;;;;;;;;;;;;AAcA,MAAa,iBAAiB,OAAO,UACjC,iBAAkC,YAA2E;CAE7G,MAAM,cAAc,MAAwF;EAC5G,IAAI,CAAC,GAAG,OAAO,CAAC;EAChB,IAAI,aAAa,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;EAC/D,IAAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAA8B,qBAAqB,QAAQ,GAChE;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,eAAe;CACtC,CACF;AAAE;AAMF,MAAa,qCAAqC,CAAC,gBAAgB;AAEnE,MAAa,oCACW,YAC+F;CAEvH,MAAM,cAAc,6BAA6B;CACjD,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAA6G,UAAU;EACzH,MAAM,EAAC,UAAS,SAAQ,SAAS,CAAC;EAElC,OAAQ,eAAe,UAAS,MAAK,cAAc;CACrD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,qBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,iCAAiC,OAAO,GAAG,WAAW;AAC3E"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
import { Gn as HTTPExceptionResponse, _t as ProductGrantWrite, t as ValidationErrorResponse, vt as ProductGrantListRead } from "../index-wL_20vR8.js";
|
|
3
|
+
import { a as ErrorType, c as request, n as BodyType } from "../client-BDwBZYB0.js";
|
|
4
|
+
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/admin-roles/admin-roles.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getListGrantsUrl: (userId: number) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Everything this account is, across products and organisations.
|
|
10
|
+
*
|
|
11
|
+
* Readable by SUPPORT as well as ADMIN: knowing what somebody is, is part of
|
|
12
|
+
* helping them. Changing it is not.
|
|
13
|
+
* @summary List Grants
|
|
14
|
+
*/
|
|
15
|
+
export declare const listGrants: (userId: number, options?: Parameters<typeof request>[1]) => Promise<ProductGrantListRead>;
|
|
16
|
+
export declare const getListGrantsQueryKey: (userId: number) => readonly [`/admin/users/${number}/product-roles`];
|
|
17
|
+
export declare const getListGrantsQueryOptions: <TData = Awaited<ReturnType<typeof listGrants>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(userId: number, options?: {
|
|
18
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData>>;
|
|
19
|
+
request?: SecondParameter<typeof request>;
|
|
20
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData> & {
|
|
21
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
22
|
+
};
|
|
23
|
+
export type ListGrantsQueryResult = NonNullable<Awaited<ReturnType<typeof listGrants>>>;
|
|
24
|
+
export type ListGrantsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
25
|
+
export declare function useListGrants<TData = Awaited<ReturnType<typeof listGrants>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(userId: number, options: {
|
|
26
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listGrants>>, TError, Awaited<ReturnType<typeof listGrants>>>, 'initialData'>;
|
|
27
|
+
request?: SecondParameter<typeof request>;
|
|
28
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
29
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
30
|
+
};
|
|
31
|
+
export declare function useListGrants<TData = Awaited<ReturnType<typeof listGrants>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(userId: number, options?: {
|
|
32
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listGrants>>, TError, Awaited<ReturnType<typeof listGrants>>>, 'initialData'>;
|
|
33
|
+
request?: SecondParameter<typeof request>;
|
|
34
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
35
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
36
|
+
};
|
|
37
|
+
export declare function useListGrants<TData = Awaited<ReturnType<typeof listGrants>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(userId: number, options?: {
|
|
38
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData>>;
|
|
39
|
+
request?: SecondParameter<typeof request>;
|
|
40
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
41
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
42
|
+
};
|
|
43
|
+
export declare const getReplaceGrantsUrl: (userId: number) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Replace this account's roles for one product at one organisation.
|
|
46
|
+
*
|
|
47
|
+
* ``PUT`` because it is idempotent and the body is the whole desired state for
|
|
48
|
+
* that ``(tenant, product)`` slice — sending it twice leaves the same grants.
|
|
49
|
+
*
|
|
50
|
+
* Two scope checks, and both are needed. The *subject* must be an account the
|
|
51
|
+
* operator reaches, and the ``tenantId`` being granted at must be one they
|
|
52
|
+
* reach too: without the second, an operator could grant a remit at an
|
|
53
|
+
* organisation they have no authority over, which is how a scoped
|
|
54
|
+
* administrator becomes an unscoped one.
|
|
55
|
+
*
|
|
56
|
+
* ``422`` for a role the product does not recognise —
|
|
57
|
+
* :data:`~app.models.enums.PRODUCT_ROLES` decides, so ``student`` for biblio is
|
|
58
|
+
* refused rather than stored and puzzled over later.
|
|
59
|
+
* @summary Replace Grants
|
|
60
|
+
*/
|
|
61
|
+
export declare const replaceGrants: (userId: number, productGrantWrite: ProductGrantWrite, options?: Parameters<typeof request>[1]) => Promise<ProductGrantListRead>;
|
|
62
|
+
export declare const getReplaceGrantsMutationKey: () => readonly ['replaceGrants'];
|
|
63
|
+
export declare const getReplaceGrantsMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
64
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof replaceGrants>>, TError, ReplaceGrantsMutationVariables, TContext>;
|
|
65
|
+
request?: SecondParameter<typeof request>;
|
|
66
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof replaceGrants>>, TError, ReplaceGrantsMutationVariables, TContext>;
|
|
67
|
+
export type ReplaceGrantsMutationResult = NonNullable<Awaited<ReturnType<typeof replaceGrants>>>;
|
|
68
|
+
export type ReplaceGrantsMutationBody = BodyType<ProductGrantWrite>;
|
|
69
|
+
export type ReplaceGrantsMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
70
|
+
export type ReplaceGrantsMutationVariables = {
|
|
71
|
+
userId: number;
|
|
72
|
+
data: BodyType<ProductGrantWrite>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* @summary Replace Grants
|
|
76
|
+
*/
|
|
77
|
+
export declare const useReplaceGrants: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
78
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof replaceGrants>>, TError, ReplaceGrantsMutationVariables, TContext>;
|
|
79
|
+
request?: SecondParameter<typeof request>;
|
|
80
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof replaceGrants>>, TError, ReplaceGrantsMutationVariables, TContext>;
|
|
81
|
+
//#endregion
|
|
82
|
+
//# sourceMappingURL=admin-roles.d.ts.map
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/admin-roles/admin-roles.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const withQueryKey = (query, queryKey) => {
|
|
13
|
+
const result = { queryKey };
|
|
14
|
+
for (const key of Object.keys(query)) {
|
|
15
|
+
if (key === "queryKey") continue;
|
|
16
|
+
Object.defineProperty(result, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get: () => query[key]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const getListGrantsUrl = (userId) => {
|
|
25
|
+
return `/admin/users/${userId}/product-roles`;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Everything this account is, across products and organisations.
|
|
29
|
+
*
|
|
30
|
+
* Readable by SUPPORT as well as ADMIN: knowing what somebody is, is part of
|
|
31
|
+
* helping them. Changing it is not.
|
|
32
|
+
* @summary List Grants
|
|
33
|
+
*/
|
|
34
|
+
const listGrants = async (userId, options) => {
|
|
35
|
+
return request(getListGrantsUrl(userId), {
|
|
36
|
+
...options,
|
|
37
|
+
method: "GET"
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const getListGrantsQueryKey = (userId) => {
|
|
41
|
+
return [`/admin/users/${userId}/product-roles`];
|
|
42
|
+
};
|
|
43
|
+
const getListGrantsQueryOptions = (userId, options) => {
|
|
44
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
45
|
+
const queryKey = queryOptions?.queryKey ?? getListGrantsQueryKey(userId);
|
|
46
|
+
const queryFn = ({ signal }) => listGrants(userId, {
|
|
47
|
+
signal,
|
|
48
|
+
...requestOptions
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
queryKey,
|
|
52
|
+
queryFn,
|
|
53
|
+
enabled: userId !== null && userId !== void 0,
|
|
54
|
+
...queryOptions
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* @summary List Grants
|
|
59
|
+
*/
|
|
60
|
+
function useListGrants(userId, options, queryClient) {
|
|
61
|
+
const queryOptions = getListGrantsQueryOptions(userId, options);
|
|
62
|
+
const query = useQuery(queryOptions, queryClient);
|
|
63
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
64
|
+
}
|
|
65
|
+
const getReplaceGrantsUrl = (userId) => {
|
|
66
|
+
return `/admin/users/${userId}/product-roles`;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Replace this account's roles for one product at one organisation.
|
|
70
|
+
*
|
|
71
|
+
* ``PUT`` because it is idempotent and the body is the whole desired state for
|
|
72
|
+
* that ``(tenant, product)`` slice — sending it twice leaves the same grants.
|
|
73
|
+
*
|
|
74
|
+
* Two scope checks, and both are needed. The *subject* must be an account the
|
|
75
|
+
* operator reaches, and the ``tenantId`` being granted at must be one they
|
|
76
|
+
* reach too: without the second, an operator could grant a remit at an
|
|
77
|
+
* organisation they have no authority over, which is how a scoped
|
|
78
|
+
* administrator becomes an unscoped one.
|
|
79
|
+
*
|
|
80
|
+
* ``422`` for a role the product does not recognise —
|
|
81
|
+
* :data:`~app.models.enums.PRODUCT_ROLES` decides, so ``student`` for biblio is
|
|
82
|
+
* refused rather than stored and puzzled over later.
|
|
83
|
+
* @summary Replace Grants
|
|
84
|
+
*/
|
|
85
|
+
const replaceGrants = async (userId, productGrantWrite, options) => {
|
|
86
|
+
const getHeaders = (h) => {
|
|
87
|
+
if (!h) return {};
|
|
88
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
89
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
90
|
+
const headers = {};
|
|
91
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
92
|
+
return headers;
|
|
93
|
+
};
|
|
94
|
+
return request(getReplaceGrantsUrl(userId), {
|
|
95
|
+
...options,
|
|
96
|
+
method: "PUT",
|
|
97
|
+
headers: {
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
...getHeaders(options?.headers)
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify(productGrantWrite)
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
const getReplaceGrantsMutationKey = () => ["replaceGrants"];
|
|
105
|
+
const getReplaceGrantsMutationOptions = (options) => {
|
|
106
|
+
const mutationKey = getReplaceGrantsMutationKey();
|
|
107
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
108
|
+
...options,
|
|
109
|
+
mutation: {
|
|
110
|
+
...options.mutation,
|
|
111
|
+
mutationKey
|
|
112
|
+
}
|
|
113
|
+
} : {
|
|
114
|
+
mutation: { mutationKey },
|
|
115
|
+
request: void 0
|
|
116
|
+
};
|
|
117
|
+
const mutationFn = (props) => {
|
|
118
|
+
const { userId, data } = props ?? {};
|
|
119
|
+
return replaceGrants(userId, data, requestOptions);
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
mutationFn,
|
|
123
|
+
...mutationOptions
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* @summary Replace Grants
|
|
128
|
+
*/
|
|
129
|
+
const useReplaceGrants = (options, queryClient) => {
|
|
130
|
+
return useMutation(getReplaceGrantsMutationOptions(options), queryClient);
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
export { getListGrantsQueryKey, getListGrantsQueryOptions, getListGrantsUrl, getReplaceGrantsMutationKey, getReplaceGrantsMutationOptions, getReplaceGrantsUrl, listGrants, replaceGrants, useListGrants, useReplaceGrants };
|
|
134
|
+
|
|
135
|
+
//# sourceMappingURL=admin-roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-roles.js","names":[],"sources":["../../src/react/admin-roles/admin-roles.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ProductGrantListRead,\n ProductGrantWrite,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListGrantsUrl = (userId: number,) => {\n\n\n\n\n return `/admin/users/${userId}/product-roles`\n}\n\n/**\n * Everything this account is, across products and organisations.\n *\n * Readable by SUPPORT as well as ADMIN: knowing what somebody is, is part of\n * helping them. Changing it is not.\n * @summary List Grants\n */\nexport const listGrants = async (userId: number, options?: Parameters<typeof request>[1]): Promise<ProductGrantListRead> => {\n\n return request<ProductGrantListRead>(getListGrantsUrl(userId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListGrantsQueryKey = (userId: number,) => {\n return [\n `/admin/users/${userId}/product-roles`\n ] as const;\n }\n\n\nexport const getListGrantsQueryOptions = <TData = Awaited<ReturnType<typeof listGrants>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(userId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListGrantsQueryKey(userId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listGrants>>> = ({ signal }) => listGrants(userId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: userId !== null && userId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListGrantsQueryResult = NonNullable<Awaited<ReturnType<typeof listGrants>>>\nexport type ListGrantsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListGrants<TData = Awaited<ReturnType<typeof listGrants>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n userId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGrants>>,\n TError,\n Awaited<ReturnType<typeof listGrants>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGrants<TData = Awaited<ReturnType<typeof listGrants>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n userId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGrants>>,\n TError,\n Awaited<ReturnType<typeof listGrants>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGrants<TData = Awaited<ReturnType<typeof listGrants>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n userId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Grants\n */\n\nexport function useListGrants<TData = Awaited<ReturnType<typeof listGrants>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n userId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGrants>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListGrantsQueryOptions(userId,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getReplaceGrantsUrl = (userId: number,) => {\n\n\n\n\n return `/admin/users/${userId}/product-roles`\n}\n\n/**\n * Replace this account's roles for one product at one organisation.\n *\n * ``PUT`` because it is idempotent and the body is the whole desired state for\n * that ``(tenant, product)`` slice — sending it twice leaves the same grants.\n *\n * Two scope checks, and both are needed. The *subject* must be an account the\n * operator reaches, and the ``tenantId`` being granted at must be one they\n * reach too: without the second, an operator could grant a remit at an\n * organisation they have no authority over, which is how a scoped\n * administrator becomes an unscoped one.\n *\n * ``422`` for a role the product does not recognise —\n * :data:`~app.models.enums.PRODUCT_ROLES` decides, so ``student`` for biblio is\n * refused rather than stored and puzzled over later.\n * @summary Replace Grants\n */\nexport const replaceGrants = async (userId: number,\n productGrantWrite: ProductGrantWrite, options?: Parameters<typeof request>[1]): Promise<ProductGrantListRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<ProductGrantListRead>(getReplaceGrantsUrl(userId),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(productGrantWrite)\n }\n);}\n\n\n\n\n\nexport const getReplaceGrantsMutationKey = () => ['replaceGrants'] as const;\n\nexport const getReplaceGrantsMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof replaceGrants>>, TError,ReplaceGrantsMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof replaceGrants>>, TError,ReplaceGrantsMutationVariables, TContext> => {\n\nconst mutationKey = getReplaceGrantsMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof replaceGrants>>, ReplaceGrantsMutationVariables> = (props) => {\n const {userId,data} = props ?? {};\n\n return replaceGrants(userId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ReplaceGrantsMutationResult = NonNullable<Awaited<ReturnType<typeof replaceGrants>>>\n export type ReplaceGrantsMutationBody = BodyType<ProductGrantWrite>\n export type ReplaceGrantsMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ReplaceGrantsMutationVariables = {userId: number;data: BodyType<ProductGrantWrite>}\n\n /**\n * @summary Replace Grants\n */\nexport const useReplaceGrants = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof replaceGrants>>, TError,ReplaceGrantsMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof replaceGrants>>,\n TError,\n ReplaceGrantsMutationVariables,\n TContext\n > => {\n return useMutation(getReplaceGrantsMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AAyCA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,oBAAoB,WAAoB;CAKnD,OAAO,gBAAgB,OAAO;AAChC;;;;;;;;AASA,MAAa,aAAa,OAAO,QAAgB,YAA2E;CAE1H,OAAO,QAA8B,iBAAiB,MAAM,GAC5D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,yBAAyB,WAAoB;CACtD,OAAO,CACP,gBAAgB,OAAO,eACvB;AACA;AAGJ,MAAa,6BAAkJ,QAAgB,YAC1K;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,sBAAsB,MAAM;CAItE,MAAM,WAAkE,EAAE,aAAa,WAAW,QAAQ;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMxI,OAAQ;EAAE;EAAU;EAAS,SAAS,WAAW,QAAQ,WAAW,KAAA;EAAW,GAAG;CAAY;AACjG;;;;AAkCA,SAAgB,cACf,QAAgB,SACd,aACiF;CAElF,MAAM,eAAe,0BAA0B,QAAO,OAAO;CAE7D,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD;AAOA,MAAa,uBAAuB,WAAoB;CAKtD,OAAO,gBAAgB,OAAO;AAChC;;;;;;;;;;;;;;;;;;AAmBA,MAAa,gBAAgB,OAAO,QAChC,mBAAsC,YAA2E;CAEjH,MAAM,cAAc,MAAwF;EAC5G,IAAI,CAAC,GAAG,OAAO,CAAC;EAChB,IAAI,aAAa,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;EAC/D,IAAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAA8B,oBAAoB,MAAM,GAC7D;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,iBAAiB;CACxC,CACF;AAAE;AAMF,MAAa,oCAAoC,CAAC,eAAe;AAEjE,MAAa,mCACW,YAC6F;CAErH,MAAM,cAAc,4BAA4B;CAChD,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAA2G,UAAU;EACvH,MAAM,EAAC,QAAO,SAAQ,SAAS,CAAC;EAEhC,OAAQ,cAAc,QAAO,MAAK,cAAc;CAClD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,oBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,gCAAgC,OAAO,GAAG,WAAW;AAC1E"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
|
|
2
|
+
import { Cr as DemoUserWrite, Gn as HTTPExceptionResponse, Wn as ImpersonationWrite, j as SupportSessionRead, t as ValidationErrorResponse, wr as DemoUserRead } from "../index-wL_20vR8.js";
|
|
3
|
+
import { a as ErrorType, c as request, n as BodyType } from "../client-BDwBZYB0.js";
|
|
4
|
+
import { QueryClient, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/admin-support/admin-support.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getCreateDemoUserUrl: () => string;
|
|
8
|
+
/**
|
|
9
|
+
* Create, or return, a demonstration account for an establishment (E57).
|
|
10
|
+
*
|
|
11
|
+
* ``RequireAdmin`` rather than ``RequireStaff``: this creates an account inside
|
|
12
|
+
* a customer's tenant, which is a change to what the customer has, not an
|
|
13
|
+
* assistance to one of their members.
|
|
14
|
+
*
|
|
15
|
+
* **The account has no password and cannot be signed into directly.** The
|
|
16
|
+
* legacy derived one from the establishment id alone — ``Etab{id padded}$``,
|
|
17
|
+
* at ``etab_{id}@ta.com`` — and then redirected into the impersonation route
|
|
18
|
+
* (defect D15). Anyone who noticed the pattern held a working credential for
|
|
19
|
+
* every establishment. Here the row is created without a credential and is
|
|
20
|
+
* reached through E56, which is audited.
|
|
21
|
+
*
|
|
22
|
+
* ``201`` when created, ``200`` when it already existed. Idempotent, because a
|
|
23
|
+
* salesperson clicking twice should not end up with two demo accounts.
|
|
24
|
+
* @summary Create Demo User
|
|
25
|
+
*/
|
|
26
|
+
export declare const createDemoUser: (demoUserWrite: DemoUserWrite, options?: Parameters<typeof request>[1]) => Promise<DemoUserRead>;
|
|
27
|
+
export declare const getCreateDemoUserMutationKey: () => readonly ['createDemoUser'];
|
|
28
|
+
export declare const getCreateDemoUserMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
29
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof createDemoUser>>, TError, CreateDemoUserMutationVariables, TContext>;
|
|
30
|
+
request?: SecondParameter<typeof request>;
|
|
31
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof createDemoUser>>, TError, CreateDemoUserMutationVariables, TContext>;
|
|
32
|
+
export type CreateDemoUserMutationResult = NonNullable<Awaited<ReturnType<typeof createDemoUser>>>;
|
|
33
|
+
export type CreateDemoUserMutationBody = BodyType<DemoUserWrite>;
|
|
34
|
+
export type CreateDemoUserMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
35
|
+
export type CreateDemoUserMutationVariables = {
|
|
36
|
+
data: BodyType<DemoUserWrite>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @summary Create Demo User
|
|
40
|
+
*/
|
|
41
|
+
export declare const useCreateDemoUser: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
42
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof createDemoUser>>, TError, CreateDemoUserMutationVariables, TContext>;
|
|
43
|
+
request?: SecondParameter<typeof request>;
|
|
44
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof createDemoUser>>, TError, CreateDemoUserMutationVariables, TContext>;
|
|
45
|
+
export declare const getOpenSupportSessionUrl: () => string;
|
|
46
|
+
/**
|
|
47
|
+
* Open a support session acting as another account (E56).
|
|
48
|
+
*
|
|
49
|
+
* ``reason`` is mandatory and exists to be logged. A support action with no
|
|
50
|
+
* stated reason cannot be told apart from an abuse of the same endpoint.
|
|
51
|
+
*
|
|
52
|
+
* **This returns no tokens.** It used to: a Keycloak token-exchange session for
|
|
53
|
+
* the subject, on the reasoning that the platform should mint no credentials and
|
|
54
|
+
* that the subject's own assurance level would keep privileged operations out of
|
|
55
|
+
* reach. Both halves turned out to be wrong. The exchanged token carried no
|
|
56
|
+
* actor claim, so it was indistinguishable from the patron's own and the trail
|
|
57
|
+
* stopped at this row; and it carried no ``assurance`` claim either, which
|
|
58
|
+
* ``clamp_assurance`` reads as *unconstrained* — so the operator resolved to
|
|
59
|
+
* ``HIGH`` and could close the account, the single thing the design promised to
|
|
60
|
+
* prevent. Keycloak 26 also rejects the grant outright.
|
|
61
|
+
*
|
|
62
|
+
* So the operator keeps their own token and sends ``X-Acting-As`` with the id
|
|
63
|
+
* returned here. Nothing is minted, the authenticated identity stays the
|
|
64
|
+
* operator, and the session is clamped to the lowest assurance by
|
|
65
|
+
* :func:`app.core.security.acting_as` — which makes E14 and E17 unreachable
|
|
66
|
+
* through the guard that already exists rather than through a special case.
|
|
67
|
+
*
|
|
68
|
+
* Ending it early is ``DELETE /admin/impersonations/{id}``, which must be sent
|
|
69
|
+
* *without* the header: a support session holds no staff roles.
|
|
70
|
+
* @summary Open Support Session
|
|
71
|
+
*/
|
|
72
|
+
export declare const openSupportSession: (impersonationWrite: ImpersonationWrite, options?: Parameters<typeof request>[1]) => Promise<SupportSessionRead>;
|
|
73
|
+
export declare const getOpenSupportSessionMutationKey: () => readonly ['openSupportSession'];
|
|
74
|
+
export declare const getOpenSupportSessionMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
75
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof openSupportSession>>, TError, OpenSupportSessionMutationVariables, TContext>;
|
|
76
|
+
request?: SecondParameter<typeof request>;
|
|
77
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof openSupportSession>>, TError, OpenSupportSessionMutationVariables, TContext>;
|
|
78
|
+
export type OpenSupportSessionMutationResult = NonNullable<Awaited<ReturnType<typeof openSupportSession>>>;
|
|
79
|
+
export type OpenSupportSessionMutationBody = BodyType<ImpersonationWrite>;
|
|
80
|
+
export type OpenSupportSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
81
|
+
export type OpenSupportSessionMutationVariables = {
|
|
82
|
+
data: BodyType<ImpersonationWrite>;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* @summary Open Support Session
|
|
86
|
+
*/
|
|
87
|
+
export declare const useOpenSupportSession: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
88
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof openSupportSession>>, TError, OpenSupportSessionMutationVariables, TContext>;
|
|
89
|
+
request?: SecondParameter<typeof request>;
|
|
90
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof openSupportSession>>, TError, OpenSupportSessionMutationVariables, TContext>;
|
|
91
|
+
export declare const getCloseSupportSessionUrl: (supportSessionId: number) => string;
|
|
92
|
+
/**
|
|
93
|
+
* End a support session early. Idempotent.
|
|
94
|
+
*
|
|
95
|
+
* Must be called *without* ``X-Acting-As``: a session in progress carries no
|
|
96
|
+
* staff roles, so a request made through one cannot reach this endpoint. That
|
|
97
|
+
* is deliberate — the operator steps out before they can close it, and simply
|
|
98
|
+
* dropping the header ends the session's effect immediately either way.
|
|
99
|
+
*
|
|
100
|
+
* ``204`` whether or not the row was still open, and whether or not it was
|
|
101
|
+
* theirs. A support session id is a bare integer and must not be an oracle.
|
|
102
|
+
* @summary Close Support Session
|
|
103
|
+
*/
|
|
104
|
+
export declare const closeSupportSession: (supportSessionId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
105
|
+
export declare const getCloseSupportSessionMutationKey: () => readonly ['closeSupportSession'];
|
|
106
|
+
export declare const getCloseSupportSessionMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
107
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof closeSupportSession>>, TError, CloseSupportSessionMutationVariables, TContext>;
|
|
108
|
+
request?: SecondParameter<typeof request>;
|
|
109
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof closeSupportSession>>, TError, CloseSupportSessionMutationVariables, TContext>;
|
|
110
|
+
export type CloseSupportSessionMutationResult = NonNullable<Awaited<ReturnType<typeof closeSupportSession>>>;
|
|
111
|
+
export type CloseSupportSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
112
|
+
export type CloseSupportSessionMutationVariables = {
|
|
113
|
+
supportSessionId: number;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* @summary Close Support Session
|
|
117
|
+
*/
|
|
118
|
+
export declare const useCloseSupportSession: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
119
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof closeSupportSession>>, TError, CloseSupportSessionMutationVariables, TContext>;
|
|
120
|
+
request?: SecondParameter<typeof request>;
|
|
121
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof closeSupportSession>>, TError, CloseSupportSessionMutationVariables, TContext>;
|
|
122
|
+
//#endregion
|
|
123
|
+
//# sourceMappingURL=admin-support.d.ts.map
|