@learnorama/mozaik-sdk 0.3.2-staging.19.1 → 0.5.0-staging.22.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.
- package/dist/api/account.d.ts +1 -1
- package/dist/api/account.js.map +1 -1
- package/dist/api/admin-catalogue.d.ts +1 -1
- package/dist/api/admin-catalogue.js.map +1 -1
- package/dist/api/admin-consumption.d.ts +1 -1
- package/dist/api/admin-consumption.js.map +1 -1
- package/dist/api/admin-licenses.d.ts +1 -1
- package/dist/api/admin-licenses.js.map +1 -1
- package/dist/api/admin-patrons.d.ts +1 -1
- package/dist/api/admin-patrons.js.map +1 -1
- package/dist/api/admin-reviews.d.ts +1 -1
- package/dist/api/admin-reviews.js.map +1 -1
- package/dist/api/admin-roles.d.ts +1 -1
- package/dist/api/admin-roles.js.map +1 -1
- package/dist/api/admin-support.d.ts +1 -1
- package/dist/api/admin-support.js.map +1 -1
- package/dist/api/admin-tenants.d.ts +7 -1
- package/dist/api/admin-tenants.js +19 -1
- package/dist/api/admin-tenants.js.map +1 -1
- package/dist/api/admin-tutoring.d.ts +1 -1
- package/dist/api/admin-tutoring.js.map +1 -1
- package/dist/api/auth.d.ts +1 -1
- package/dist/api/auth.js.map +1 -1
- package/dist/api/biblio-catalogue.d.ts +1 -1
- package/dist/api/biblio-catalogue.js.map +1 -1
- package/dist/api/biblio-home.d.ts +1 -1
- package/dist/api/biblio-home.js.map +1 -1
- package/dist/api/biblio-library.d.ts +1 -1
- package/dist/api/biblio-library.js.map +1 -1
- package/dist/api/biblio-nextory.d.ts +1 -1
- package/dist/api/biblio-nextory.js.map +1 -1
- package/dist/api/biblio-press.d.ts +1 -1
- package/dist/api/biblio-press.js.map +1 -1
- package/dist/api/biblio-search.d.ts +1 -1
- package/dist/api/biblio-search.js.map +1 -1
- package/dist/api/biblio-telemetry.d.ts +1 -1
- package/dist/api/biblio-telemetry.js.map +1 -1
- package/dist/api/consumption.d.ts +1 -1
- package/dist/api/consumption.js.map +1 -1
- package/dist/api/cvs-app.d.ts +1 -1
- package/dist/api/cvs-app.js.map +1 -1
- package/dist/api/cvs-documents.d.ts +1 -1
- package/dist/api/cvs-documents.js.map +1 -1
- package/dist/api/cvs-favorites.d.ts +1 -1
- package/dist/api/cvs-favorites.js.map +1 -1
- package/dist/api/cvs-ils.d.ts +1 -1
- package/dist/api/cvs-ils.js.map +1 -1
- package/dist/api/cvs-loans.d.ts +1 -1
- package/dist/api/cvs-loans.js.map +1 -1
- package/dist/api/cvs-payments.d.ts +1 -1
- package/dist/api/cvs-payments.js.map +1 -1
- package/dist/api/cvs-streaming.d.ts +1 -1
- package/dist/api/cvs-streaming.js.map +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +2 -2
- package/dist/api/partner-catalogue.d.ts +1 -1
- package/dist/api/partner-catalogue.js.map +1 -1
- package/dist/api/partner-reader.d.ts +1 -1
- package/dist/api/partner-reader.js.map +1 -1
- package/dist/api/profiles.d.ts +1 -1
- package/dist/api/profiles.js.map +1 -1
- package/dist/api/search.d.ts +1 -1
- package/dist/api/search.js.map +1 -1
- package/dist/api/tutoring-catalogue.d.ts +1 -1
- package/dist/api/tutoring-catalogue.js.map +1 -1
- package/dist/api/tutoring-chat.d.ts +1 -1
- package/dist/api/tutoring-chat.js.map +1 -1
- package/dist/api/tutoring-dispatch.d.ts +1 -1
- package/dist/api/tutoring-dispatch.js.map +1 -1
- package/dist/api/tutoring-practitioner.js.map +1 -1
- package/dist/api/tutoring-requests.d.ts +1 -1
- package/dist/api/tutoring-requests.js.map +1 -1
- package/dist/chunks/client2.d.ts +1 -1
- package/dist/chunks/connection.d.ts +1 -1
- package/dist/chunks/index.d.ts +176 -155
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +2 -2
- package/dist/models.js.map +1 -1
- package/dist/react/account.d.ts +1 -1
- package/dist/react/account.js +1 -1
- package/dist/react/account.js.map +1 -1
- package/dist/react/admin-catalogue.d.ts +1 -1
- package/dist/react/admin-catalogue.js +1 -1
- package/dist/react/admin-catalogue.js.map +1 -1
- package/dist/react/admin-consumption.d.ts +1 -1
- package/dist/react/admin-consumption.js +1 -1
- package/dist/react/admin-consumption.js.map +1 -1
- package/dist/react/admin-licenses.d.ts +1 -1
- package/dist/react/admin-licenses.js +1 -1
- package/dist/react/admin-licenses.js.map +1 -1
- package/dist/react/admin-patrons.d.ts +1 -1
- package/dist/react/admin-patrons.js +1 -1
- package/dist/react/admin-patrons.js.map +1 -1
- package/dist/react/admin-reviews.d.ts +1 -1
- package/dist/react/admin-reviews.js +1 -1
- package/dist/react/admin-reviews.js.map +1 -1
- package/dist/react/admin-roles.d.ts +1 -1
- package/dist/react/admin-roles.js +1 -1
- package/dist/react/admin-roles.js.map +1 -1
- package/dist/react/admin-support.d.ts +1 -1
- package/dist/react/admin-support.js +1 -1
- package/dist/react/admin-support.js.map +1 -1
- package/dist/react/admin-tenants.d.ts +34 -1
- package/dist/react/admin-tenants.js +44 -2
- package/dist/react/admin-tenants.js.map +1 -1
- package/dist/react/admin-tutoring.d.ts +1 -1
- package/dist/react/admin-tutoring.js +1 -1
- package/dist/react/admin-tutoring.js.map +1 -1
- package/dist/react/auth.d.ts +1 -1
- package/dist/react/auth.js +1 -1
- package/dist/react/auth.js.map +1 -1
- package/dist/react/biblio-catalogue.d.ts +1 -1
- package/dist/react/biblio-catalogue.js +1 -1
- package/dist/react/biblio-catalogue.js.map +1 -1
- package/dist/react/biblio-home.d.ts +1 -1
- package/dist/react/biblio-home.js +1 -1
- package/dist/react/biblio-home.js.map +1 -1
- package/dist/react/biblio-library.d.ts +1 -1
- package/dist/react/biblio-library.js +1 -1
- package/dist/react/biblio-library.js.map +1 -1
- package/dist/react/biblio-nextory.d.ts +1 -1
- package/dist/react/biblio-nextory.js +1 -1
- package/dist/react/biblio-nextory.js.map +1 -1
- package/dist/react/biblio-press.d.ts +1 -1
- package/dist/react/biblio-press.js +1 -1
- package/dist/react/biblio-press.js.map +1 -1
- package/dist/react/biblio-search.d.ts +1 -1
- package/dist/react/biblio-search.js +1 -1
- package/dist/react/biblio-search.js.map +1 -1
- package/dist/react/biblio-telemetry.d.ts +1 -1
- package/dist/react/biblio-telemetry.js +1 -1
- package/dist/react/biblio-telemetry.js.map +1 -1
- package/dist/react/chat.d.ts +1 -1
- package/dist/react/consumption.d.ts +1 -1
- package/dist/react/consumption.js +1 -1
- package/dist/react/consumption.js.map +1 -1
- package/dist/react/cvs-app.d.ts +1 -1
- package/dist/react/cvs-app.js +1 -1
- package/dist/react/cvs-app.js.map +1 -1
- package/dist/react/cvs-documents.d.ts +1 -1
- package/dist/react/cvs-documents.js +1 -1
- package/dist/react/cvs-documents.js.map +1 -1
- package/dist/react/cvs-favorites.d.ts +1 -1
- package/dist/react/cvs-favorites.js +1 -1
- package/dist/react/cvs-favorites.js.map +1 -1
- package/dist/react/cvs-ils.d.ts +1 -1
- package/dist/react/cvs-ils.js +1 -1
- package/dist/react/cvs-ils.js.map +1 -1
- package/dist/react/cvs-loans.d.ts +1 -1
- package/dist/react/cvs-loans.js +1 -1
- package/dist/react/cvs-loans.js.map +1 -1
- package/dist/react/cvs-payments.d.ts +1 -1
- package/dist/react/cvs-payments.js +1 -1
- package/dist/react/cvs-payments.js.map +1 -1
- package/dist/react/cvs-streaming.d.ts +1 -1
- package/dist/react/cvs-streaming.js +1 -1
- package/dist/react/cvs-streaming.js.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/react/partner-catalogue.d.ts +1 -1
- package/dist/react/partner-catalogue.js +1 -1
- package/dist/react/partner-catalogue.js.map +1 -1
- package/dist/react/partner-reader.d.ts +1 -1
- package/dist/react/partner-reader.js +1 -1
- package/dist/react/partner-reader.js.map +1 -1
- package/dist/react/profiles.d.ts +1 -1
- package/dist/react/profiles.js +1 -1
- package/dist/react/profiles.js.map +1 -1
- package/dist/react/search.d.ts +1 -1
- package/dist/react/search.js +1 -1
- package/dist/react/search.js.map +1 -1
- package/dist/react/tutoring-catalogue.d.ts +1 -1
- package/dist/react/tutoring-catalogue.js +1 -1
- package/dist/react/tutoring-catalogue.js.map +1 -1
- package/dist/react/tutoring-chat.d.ts +1 -1
- package/dist/react/tutoring-chat.js +1 -1
- package/dist/react/tutoring-chat.js.map +1 -1
- package/dist/react/tutoring-dispatch.d.ts +1 -1
- package/dist/react/tutoring-dispatch.js +1 -1
- package/dist/react/tutoring-dispatch.js.map +1 -1
- package/dist/react/tutoring-practitioner.d.ts +1 -1
- package/dist/react/tutoring-practitioner.js +1 -1
- package/dist/react/tutoring-practitioner.js.map +1 -1
- package/dist/react/tutoring-requests.d.ts +1 -1
- package/dist/react/tutoring-requests.js +1 -1
- package/dist/react/tutoring-requests.js.map +1 -1
- package/package.json +7 -7
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
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.
|
|
10
|
+
* OpenAPI spec version: 0.5.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-consumption.js","names":[],"sources":["../../src/react/admin-consumption/admin-consumption.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.3.2\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 LeaseCloseWrite,\n LiveLeaseListRead,\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 getListLiveLeasesUrl = () => {\n\n\n\n\n return `/admin/consumption/live`\n}\n\n/**\n * What is open right now, within the caller's tenant scope.\n *\n * Read from the ledger rather than the Redis live set: this is a diagnostic and\n * must show the truth even when the cache is cold, and it runs once when\n * somebody opens a screen rather than on every read.\n *\n * Shares :func:`~app.services.entitlement.is_live` with the two seat counts.\n * An earlier version of this route filtered on ``returned_at`` alone and so\n * listed every lapsed-but-unreaped lease as live — which made the screen look\n * exactly like a stuck reaper even when the reaper was fine.\n * @summary List Live Leases\n */\nexport const listLiveLeases = async ( options?: Parameters<typeof request>[1]): Promise<LiveLeaseListRead> => {\n\n return request<LiveLeaseListRead>(getListLiveLeasesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLiveLeasesQueryKey = () => {\n return [\n `/admin/consumption/live`\n ] as const;\n }\n\n\nexport const getListLiveLeasesQueryOptions = <TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLiveLeasesQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLiveLeases>>> = ({ signal }) => listLiveLeases({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLiveLeasesQueryResult = NonNullable<Awaited<ReturnType<typeof listLiveLeases>>>\nexport type ListLiveLeasesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLiveLeases<TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLiveLeases>>,\n TError,\n Awaited<ReturnType<typeof listLiveLeases>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLiveLeases<TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLiveLeases>>,\n TError,\n Awaited<ReturnType<typeof listLiveLeases>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLiveLeases<TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Live Leases\n */\n\nexport function useListLiveLeases<TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLiveLeasesQueryOptions(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 getForceCloseLeaseUrl = (eventId: number,) => {\n\n\n\n\n return `/admin/consumption/${eventId}`\n}\n\n/**\n * Force-close somebody else's lease. The legacy's ``FermeSessionAdherent``.\n *\n * Audited, which the legacy's was not: a button that ends a stranger's reading\n * session and leaves no trace is indistinguishable from abuse of the same\n * button. Tenant-scoped like every staff action, so a lease outside the\n * caller's scope is ``404`` rather than ``403``.\n * @summary Force Close Lease\n */\nexport const forceCloseLease = async (eventId: number,\n leaseCloseWrite: LeaseCloseWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\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<void>(getForceCloseLeaseUrl(eventId),\n {\n ...options,\n method: 'DELETE',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(leaseCloseWrite)\n }\n);}\n\n\n\n\n\nexport const getForceCloseLeaseMutationKey = () => ['forceCloseLease'] as const;\n\nexport const getForceCloseLeaseMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof forceCloseLease>>, TError,ForceCloseLeaseMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof forceCloseLease>>, TError,ForceCloseLeaseMutationVariables, TContext> => {\n\nconst mutationKey = getForceCloseLeaseMutationKey();\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 forceCloseLease>>, ForceCloseLeaseMutationVariables> = (props) => {\n const {eventId,data} = props ?? {};\n\n return forceCloseLease(eventId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ForceCloseLeaseMutationResult = NonNullable<Awaited<ReturnType<typeof forceCloseLease>>>\n export type ForceCloseLeaseMutationBody = BodyType<LeaseCloseWrite>\n export type ForceCloseLeaseMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ForceCloseLeaseMutationVariables = {eventId: number;data: BodyType<LeaseCloseWrite>}\n\n /**\n * @summary Force Close Lease\n */\nexport const useForceCloseLease = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof forceCloseLease>>, TError,ForceCloseLeaseMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof forceCloseLease>>,\n TError,\n ForceCloseLeaseMutationVariables,\n TContext\n > => {\n return useMutation(getForceCloseLeaseMutationOptions(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,6BAA6B;CAKxC,OAAO;AACT;;;;;;;;;;;;;;AAeA,MAAa,iBAAiB,OAAQ,YAAwE;CAE5G,OAAO,QAA2B,qBAAqB,GACvD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,kCAAkC;CAC3C,OAAO,CACP,yBACA;AACA;AAGJ,MAAa,iCAA2J,YACnK;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,0BAA0B;CAIpE,MAAM,WAAsE,EAAE,aAAa,eAAe;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMxI,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,kBACd,SACC,aACiF;CAElF,MAAM,eAAe,8BAA8B,OAAO;CAE1D,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD;AAOA,MAAa,yBAAyB,YAAqB;CAKzD,OAAO,sBAAsB;AAC/B;;;;;;;;;;AAWA,MAAa,kBAAkB,OAAO,SAClC,iBAAkC,YAA2D;CAE7F,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,QAAc,sBAAsB,OAAO,GAChD;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,sCAAsC,CAAC,iBAAiB;AAErE,MAAa,qCACW,YACiG;CAEzH,MAAM,cAAc,8BAA8B;CAClD,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,cAA+G,UAAU;EAC3H,MAAM,EAAC,SAAQ,SAAQ,SAAS,CAAC;EAEjC,OAAQ,gBAAgB,SAAQ,MAAK,cAAc;CACrD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,sBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,kCAAkC,OAAO,GAAG,WAAW;AAC5E"}
|
|
1
|
+
{"version":3,"file":"admin-consumption.js","names":[],"sources":["../../src/react/admin-consumption/admin-consumption.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.5.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 LeaseCloseWrite,\n LiveLeaseListRead,\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 getListLiveLeasesUrl = () => {\n\n\n\n\n return `/admin/consumption/live`\n}\n\n/**\n * What is open right now, within the caller's tenant scope.\n *\n * Read from the ledger rather than the Redis live set: this is a diagnostic and\n * must show the truth even when the cache is cold, and it runs once when\n * somebody opens a screen rather than on every read.\n *\n * Shares :func:`~app.services.entitlement.is_live` with the two seat counts.\n * An earlier version of this route filtered on ``returned_at`` alone and so\n * listed every lapsed-but-unreaped lease as live — which made the screen look\n * exactly like a stuck reaper even when the reaper was fine.\n * @summary List Live Leases\n */\nexport const listLiveLeases = async ( options?: Parameters<typeof request>[1]): Promise<LiveLeaseListRead> => {\n\n return request<LiveLeaseListRead>(getListLiveLeasesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLiveLeasesQueryKey = () => {\n return [\n `/admin/consumption/live`\n ] as const;\n }\n\n\nexport const getListLiveLeasesQueryOptions = <TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLiveLeasesQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLiveLeases>>> = ({ signal }) => listLiveLeases({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLiveLeasesQueryResult = NonNullable<Awaited<ReturnType<typeof listLiveLeases>>>\nexport type ListLiveLeasesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLiveLeases<TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLiveLeases>>,\n TError,\n Awaited<ReturnType<typeof listLiveLeases>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLiveLeases<TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLiveLeases>>,\n TError,\n Awaited<ReturnType<typeof listLiveLeases>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLiveLeases<TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Live Leases\n */\n\nexport function useListLiveLeases<TData = Awaited<ReturnType<typeof listLiveLeases>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLiveLeases>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLiveLeasesQueryOptions(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 getForceCloseLeaseUrl = (eventId: number,) => {\n\n\n\n\n return `/admin/consumption/${eventId}`\n}\n\n/**\n * Force-close somebody else's lease. The legacy's ``FermeSessionAdherent``.\n *\n * Audited, which the legacy's was not: a button that ends a stranger's reading\n * session and leaves no trace is indistinguishable from abuse of the same\n * button. Tenant-scoped like every staff action, so a lease outside the\n * caller's scope is ``404`` rather than ``403``.\n * @summary Force Close Lease\n */\nexport const forceCloseLease = async (eventId: number,\n leaseCloseWrite: LeaseCloseWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\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<void>(getForceCloseLeaseUrl(eventId),\n {\n ...options,\n method: 'DELETE',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(leaseCloseWrite)\n }\n);}\n\n\n\n\n\nexport const getForceCloseLeaseMutationKey = () => ['forceCloseLease'] as const;\n\nexport const getForceCloseLeaseMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof forceCloseLease>>, TError,ForceCloseLeaseMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof forceCloseLease>>, TError,ForceCloseLeaseMutationVariables, TContext> => {\n\nconst mutationKey = getForceCloseLeaseMutationKey();\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 forceCloseLease>>, ForceCloseLeaseMutationVariables> = (props) => {\n const {eventId,data} = props ?? {};\n\n return forceCloseLease(eventId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ForceCloseLeaseMutationResult = NonNullable<Awaited<ReturnType<typeof forceCloseLease>>>\n export type ForceCloseLeaseMutationBody = BodyType<LeaseCloseWrite>\n export type ForceCloseLeaseMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ForceCloseLeaseMutationVariables = {eventId: number;data: BodyType<LeaseCloseWrite>}\n\n /**\n * @summary Force Close Lease\n */\nexport const useForceCloseLease = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof forceCloseLease>>, TError,ForceCloseLeaseMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof forceCloseLease>>,\n TError,\n ForceCloseLeaseMutationVariables,\n TContext\n > => {\n return useMutation(getForceCloseLeaseMutationOptions(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,6BAA6B;CAKxC,OAAO;AACT;;;;;;;;;;;;;;AAeA,MAAa,iBAAiB,OAAQ,YAAwE;CAE5G,OAAO,QAA2B,qBAAqB,GACvD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,kCAAkC;CAC3C,OAAO,CACP,yBACA;AACA;AAGJ,MAAa,iCAA2J,YACnK;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,0BAA0B;CAIpE,MAAM,WAAsE,EAAE,aAAa,eAAe;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMxI,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,kBACd,SACC,aACiF;CAElF,MAAM,eAAe,8BAA8B,OAAO;CAE1D,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,a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G,WAAW;AAC5E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { V as StaffLicenseRead, it as ReadPatronLicenseParams, t as ValidationErrorResponse, wr as HTTPExceptionResponse } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request } from "../chunks/client.js";
|
|
4
4
|
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/admin-licenses/admin-licenses.d.ts
|
|
@@ -7,7 +7,7 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
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.
|
|
10
|
+
* OpenAPI spec version: 0.5.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-licenses.js","names":[],"sources":["../../src/react/admin-licenses/admin-licenses.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
|
+
{"version":3,"file":"admin-licenses.js","names":[],"sources":["../../src/react/admin-licenses/admin-licenses.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.5.0\n */\nimport {\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ReadPatronLicenseParams,\n StaffLicenseRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType } 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 getReadPatronLicenseUrl = (params: ReadPatronLicenseParams,) => {\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/nextory-licenses?${stringifiedParams}` : `/admin/nextory-licenses`\n}\n\n/**\n * Report one account's licence state. Never allocates, never repairs.\n *\n * Scoped like every other staff read: an agent who cannot see the account gets\n * ``404``, the same answer as for an address nobody holds, so the endpoint\n * cannot be used to test whether a member exists elsewhere.\n *\n * ``partner_active`` is ``None`` when the partner could not be reached. That is\n * deliberately distinct from ``False`` — \"we could not ask\" and \"they said the\n * subscription is closed\" lead a support agent to different actions, and\n * collapsing them is how a working account gets re-provisioned.\n * @summary Read Patron License\n */\nexport const readPatronLicense = async (params: ReadPatronLicenseParams, options?: Parameters<typeof request>[1]): Promise<StaffLicenseRead> => {\n\n return request<StaffLicenseRead>(getReadPatronLicenseUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPatronLicenseQueryKey = (params?: ReadPatronLicenseParams,) => {\n return [\n `/admin/nextory-licenses`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getReadPatronLicenseQueryOptions = <TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: ReadPatronLicenseParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPatronLicenseQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPatronLicense>>> = ({ signal }) => readPatronLicense(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPatronLicenseQueryResult = NonNullable<Awaited<ReturnType<typeof readPatronLicense>>>\nexport type ReadPatronLicenseQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: ReadPatronLicenseParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatronLicense>>,\n TError,\n Awaited<ReturnType<typeof readPatronLicense>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: ReadPatronLicenseParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatronLicense>>,\n TError,\n Awaited<ReturnType<typeof readPatronLicense>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: ReadPatronLicenseParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Patron License\n */\n\nexport function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: ReadPatronLicenseParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPatronLicenseQueryOptions(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\n"],"mappings":";;;;;;;;;;;AAqCA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,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Jt as PatronDetailRead, Kt as PatronPage, t as ValidationErrorResponse, wr as HTTPExceptionResponse } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
4
|
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/admin-patrons/admin-patrons.d.ts
|
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
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.
|
|
10
|
+
* OpenAPI spec version: 0.5.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-patrons.js","names":[],"sources":["../../src/react/admin-patrons/admin-patrons.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.3.2\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 ListPatronsParams,\n PatronDetailRead,\n PatronPage,\n PatronUpdateWrite,\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 getListPatronsUrl = (params?: ListPatronsParams,) => {\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/patrons?${stringifiedParams}` : `/admin/patrons`\n}\n\n/**\n * Patrons of the libraries this caller administers.\n *\n * ``q`` matches login, name and email as a literal case-insensitive substring.\n * Deliberately not a full-text search: an operator looking somebody up has a\n * surname or a card number, and ranking would only make the exact match harder\n * to find.\n * @summary List Patrons\n */\nexport const listPatrons = async (params?: ListPatronsParams, options?: Parameters<typeof request>[1]): Promise<PatronPage> => {\n\n return request<PatronPage>(getListPatronsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListPatronsQueryKey = (params?: ListPatronsParams,) => {\n return [\n `/admin/patrons`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListPatronsQueryOptions = <TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListPatronsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listPatrons>>> = ({ signal }) => listPatrons(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListPatronsQueryResult = NonNullable<Awaited<ReturnType<typeof listPatrons>>>\nexport type ListPatronsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListPatronsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPatrons>>,\n TError,\n Awaited<ReturnType<typeof listPatrons>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPatrons>>,\n TError,\n Awaited<ReturnType<typeof listPatrons>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Patrons\n */\n\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListPatronsQueryOptions(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 getReadPatronUrl = (patronId: number,) => {\n\n\n\n\n return `/admin/patrons/${patronId}`\n}\n\n/**\n * One patron, including the email the listing withholds.\n * @summary Read Patron\n */\nexport const readPatron = async (patronId: number, options?: Parameters<typeof request>[1]): Promise<PatronDetailRead> => {\n\n return request<PatronDetailRead>(getReadPatronUrl(patronId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPatronQueryKey = (patronId: number,) => {\n return [\n `/admin/patrons/${patronId}`\n ] as const;\n }\n\n\nexport const getReadPatronQueryOptions = <TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPatronQueryKey(patronId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPatron>>> = ({ signal }) => readPatron(patronId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: patronId !== null && patronId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPatronQueryResult = NonNullable<Awaited<ReturnType<typeof readPatron>>>\nexport type ReadPatronQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatron>>,\n TError,\n Awaited<ReturnType<typeof readPatron>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatron>>,\n TError,\n Awaited<ReturnType<typeof readPatron>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Patron\n */\n\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPatronQueryOptions(patronId,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 getUpdatePatronUrl = (patronId: number,) => {\n\n\n\n\n return `/admin/patrons/${patronId}`\n}\n\n/**\n * Change what staff may change about a patron.\n *\n * Audited, because these are the changes somebody may have to account for:\n * suspending an account, raising an access level, extending a subscription past\n * what was paid for. The legacy records none of them.\n *\n * Nothing here can move a patron between tenants — see\n * :class:`~app.datamodels.admin.patrons.PatronUpdateWrite`.\n * @summary Update Patron\n */\nexport const updatePatron = async (patronId: number,\n patronUpdateWrite: PatronUpdateWrite, options?: Parameters<typeof request>[1]): Promise<PatronDetailRead> => {\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<PatronDetailRead>(getUpdatePatronUrl(patronId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(patronUpdateWrite)\n }\n);}\n\n\n\n\n\nexport const getUpdatePatronMutationKey = () => ['updatePatron'] as const;\n\nexport const getUpdatePatronMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError,UpdatePatronMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError,UpdatePatronMutationVariables, TContext> => {\n\nconst mutationKey = getUpdatePatronMutationKey();\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 updatePatron>>, UpdatePatronMutationVariables> = (props) => {\n const {patronId,data} = props ?? {};\n\n return updatePatron(patronId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type UpdatePatronMutationResult = NonNullable<Awaited<ReturnType<typeof updatePatron>>>\n export type UpdatePatronMutationBody = BodyType<PatronUpdateWrite>\n export type UpdatePatronMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type UpdatePatronMutationVariables = {patronId: number;data: BodyType<PatronUpdateWrite>}\n\n /**\n * @summary Update Patron\n */\nexport const useUpdatePatron = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError,UpdatePatronMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof updatePatron>>,\n TError,\n UpdatePatronMutationVariables,\n TContext\n > => {\n return useMutation(getUpdatePatronMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK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C/E,MAAM,KAAK,UAAU,iBAAiB;CACxC,CACF;AAAE;AAMF,MAAa,mCAAmC,CAAC,cAAc;AAE/D,MAAa,kCACW,YAC2F;CAEnH,MAAM,cAAc,2BAA2B;CAC/C,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,cAAyG,UAAU;EACrH,MAAM,EAAC,UAAS,SAAQ,SAAS,CAAC;EAElC,OAAQ,aAAa,UAAS,MAAK,cAAc;CACnD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,mBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,+BAA+B,OAAO,GAAG,WAAW;AACzE"}
|
|
1
|
+
{"version":3,"file":"admin-patrons.js","names":[],"sources":["../../src/react/admin-patrons/admin-patrons.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.5.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 ListPatronsParams,\n PatronDetailRead,\n PatronPage,\n PatronUpdateWrite,\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 getListPatronsUrl = (params?: ListPatronsParams,) => {\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/patrons?${stringifiedParams}` : `/admin/patrons`\n}\n\n/**\n * Patrons of the libraries this caller administers.\n *\n * ``q`` matches login, name and email as a literal case-insensitive substring.\n * Deliberately not a full-text search: an operator looking somebody up has a\n * surname or a card number, and ranking would only make the exact match harder\n * to find.\n * @summary List Patrons\n */\nexport const listPatrons = async (params?: ListPatronsParams, options?: Parameters<typeof request>[1]): Promise<PatronPage> => {\n\n return request<PatronPage>(getListPatronsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListPatronsQueryKey = (params?: ListPatronsParams,) => {\n return [\n `/admin/patrons`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListPatronsQueryOptions = <TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListPatronsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listPatrons>>> = ({ signal }) => listPatrons(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListPatronsQueryResult = NonNullable<Awaited<ReturnType<typeof listPatrons>>>\nexport type ListPatronsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListPatronsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPatrons>>,\n TError,\n Awaited<ReturnType<typeof listPatrons>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPatrons>>,\n TError,\n Awaited<ReturnType<typeof listPatrons>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Patrons\n */\n\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListPatronsQueryOptions(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 getReadPatronUrl = (patronId: number,) => {\n\n\n\n\n return `/admin/patrons/${patronId}`\n}\n\n/**\n * One patron, including the email the listing withholds.\n * @summary Read Patron\n */\nexport const readPatron = async (patronId: number, options?: Parameters<typeof request>[1]): Promise<PatronDetailRead> => {\n\n return request<PatronDetailRead>(getReadPatronUrl(patronId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPatronQueryKey = (patronId: number,) => {\n return [\n `/admin/patrons/${patronId}`\n ] as const;\n }\n\n\nexport const getReadPatronQueryOptions = <TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPatronQueryKey(patronId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPatron>>> = ({ signal }) => readPatron(patronId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: patronId !== null && patronId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPatronQueryResult = NonNullable<Awaited<ReturnType<typeof readPatron>>>\nexport type ReadPatronQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatron>>,\n TError,\n Awaited<ReturnType<typeof readPatron>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatron>>,\n TError,\n Awaited<ReturnType<typeof readPatron>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Patron\n */\n\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPatronQueryOptions(patronId,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 getUpdatePatronUrl = (patronId: number,) => {\n\n\n\n\n return `/admin/patrons/${patronId}`\n}\n\n/**\n * Change what staff may change about a patron.\n *\n * Audited, because these are the changes somebody may have to account for:\n * suspending an account, raising an access level, extending a subscription past\n * what was paid for. The legacy records none of them.\n *\n * Nothing here can move a patron between tenants — see\n * :class:`~app.datamodels.admin.patrons.PatronUpdateWrite`.\n * @summary Update Patron\n */\nexport const updatePatron = async (patronId: number,\n patronUpdateWrite: PatronUpdateWrite, options?: Parameters<typeof request>[1]): Promise<PatronDetailRead> => {\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<PatronDetailRead>(getUpdatePatronUrl(patronId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(patronUpdateWrite)\n }\n);}\n\n\n\n\n\nexport const getUpdatePatronMutationKey = () => ['updatePatron'] as const;\n\nexport const getUpdatePatronMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError,UpdatePatronMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError,UpdatePatronMutationVariables, TContext> => {\n\nconst mutationKey = getUpdatePatronMutationKey();\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 updatePatron>>, UpdatePatronMutationVariables> = (props) => {\n const {patronId,data} = props ?? {};\n\n return updatePatron(patronId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type UpdatePatronMutationResult = NonNullable<Awaited<ReturnType<typeof updatePatron>>>\n export type UpdatePatronMutationBody = BodyType<PatronUpdateWrite>\n export type UpdatePatronMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type UpdatePatronMutationVariables = {patronId: number;data: BodyType<PatronUpdateWrite>}\n\n /**\n * @summary Update Patron\n */\nexport const useUpdatePatron = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError,UpdatePatronMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof updatePatron>>,\n TError,\n UpdatePatronMutationVariables,\n TContext\n > => {\n return useMutation(getUpdatePatronMutationOptions(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,cA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D,MAAa,kCACW,YAC2F;CAEnH,MAAM,cAAc,2BAA2B;CAC/C,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,cAAyG,UAAU;EACrH,MAAM,EAAC,UAAS,SAAQ,SAAS,CAAC;EAElC,OAAQ,aAAa,UAAS,MAAK,cAAc;CACnD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,mBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,+BAA+B,OAAO,GAAG,WAAW;AACzE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { $ as ReviewModerationRead, Q as ReviewPage, Sn as ListReviewsParams, cn as ModerationWrite, t as ValidationErrorResponse, wr as HTTPExceptionResponse } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
4
|
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/admin-reviews/admin-reviews.d.ts
|
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
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.
|
|
10
|
+
* OpenAPI spec version: 0.5.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +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.3.2\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;;;;;;;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E,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"}
|
|
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.5.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":";;;;;;;;;;;AA2C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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Ct as ProductGrantWrite, t as ValidationErrorResponse, wr as HTTPExceptionResponse, wt as ProductGrantListRead } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
4
|
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/admin-roles/admin-roles.d.ts
|
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
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.
|
|
10
|
+
* OpenAPI spec version: 0.5.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +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.3.2\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 * This account's grants within the caller's organisation scope.\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(getReplaceGrantsMutationOpt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O,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"}
|
|
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.5.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 * This account's grants within the caller's organisation scope.\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,a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,YAAY,gCAAgC,OAAO,GAAG,WAAW;AAC1E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { P as SupportSessionRead, ar as ImpersonationWrite, ii as DemoUserRead, ri as DemoUserWrite, t as ValidationErrorResponse, wr as HTTPExceptionResponse } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
4
|
import { QueryClient, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/admin-support/admin-support.d.ts
|
|
@@ -7,7 +7,7 @@ import { useMutation } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
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.
|
|
10
|
+
* OpenAPI spec version: 0.5.0
|
|
11
11
|
*/
|
|
12
12
|
const getCreateDemoUserUrl = () => {
|
|
13
13
|
return `/admin/demo-users`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-support.js","names":[],"sources":["../../src/react/admin-support/admin-support.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.3.2\n */\nimport {\n useMutation\n} from '@tanstack/react-query';\nimport type {\n MutationFunction,\n QueryClient,\n UseMutationOptions,\n UseMutationResult\n} from '@tanstack/react-query';\n\nimport type {\n DemoUserRead,\n DemoUserWrite,\n HTTPExceptionResponse,\n ImpersonationWrite,\n SupportSessionRead,\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\nexport const getCreateDemoUserUrl = () => {\n\n\n\n\n return `/admin/demo-users`\n}\n\n/**\n * Create, or return, a demonstration account for an establishment (E57).\n *\n * ``RequireAdmin`` rather than ``RequireStaff``: this creates an account inside\n * a customer's tenant, which is a change to what the customer has, not an\n * assistance to one of their members.\n *\n * **The account has no password and cannot be signed into directly.** The\n * legacy derived one from the establishment id alone — ``Etab{id padded}$``,\n * at ``etab_{id}@ta.com`` — and then redirected into the impersonation route\n * (defect D15). Anyone who noticed the pattern held a working credential for\n * every establishment. Here the row is created without a credential and is\n * reached through E56, which is audited.\n *\n * ``201`` when created, ``200`` when it already existed. Idempotent, because a\n * salesperson clicking twice should not end up with two demo accounts.\n * @summary Create Demo User\n */\nexport const createDemoUser = async (demoUserWrite: DemoUserWrite, options?: Parameters<typeof request>[1]): Promise<DemoUserRead> => {\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<DemoUserRead>(getCreateDemoUserUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(demoUserWrite)\n }\n);}\n\n\n\n\n\nexport const getCreateDemoUserMutationKey = () => ['createDemoUser'] as const;\n\nexport const getCreateDemoUserMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDemoUser>>, TError,CreateDemoUserMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof createDemoUser>>, TError,CreateDemoUserMutationVariables, TContext> => {\n\nconst mutationKey = getCreateDemoUserMutationKey();\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 createDemoUser>>, CreateDemoUserMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return createDemoUser(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateDemoUserMutationResult = NonNullable<Awaited<ReturnType<typeof createDemoUser>>>\n export type CreateDemoUserMutationBody = BodyType<DemoUserWrite>\n export type CreateDemoUserMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CreateDemoUserMutationVariables = {data: BodyType<DemoUserWrite>}\n\n /**\n * @summary Create Demo User\n */\nexport const useCreateDemoUser = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDemoUser>>, TError,CreateDemoUserMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof createDemoUser>>,\n TError,\n CreateDemoUserMutationVariables,\n TContext\n > => {\n return useMutation(getCreateDemoUserMutationOptions(options), queryClient);\n }\n export const getOpenSupportSessionUrl = () => {\n\n\n\n\n return `/admin/impersonations`\n}\n\n/**\n * Open a support session acting as another account (E56).\n *\n * ``reason`` is mandatory and exists to be logged. A support action with no\n * stated reason cannot be told apart from an abuse of the same endpoint.\n *\n * **This returns no tokens.** It used to: a Keycloak token-exchange session for\n * the subject, on the reasoning that the platform should mint no credentials and\n * that the subject's own assurance level would keep privileged operations out of\n * reach. Both halves turned out to be wrong. The exchanged token carried no\n * actor claim, so it was indistinguishable from the patron's own and the trail\n * stopped at this row; and it carried no ``assurance`` claim either, which\n * ``clamp_assurance`` reads as *unconstrained* — so the operator resolved to\n * ``HIGH`` and could close the account, the single thing the design promised to\n * prevent. Keycloak 26 also rejects the grant outright.\n *\n * So the operator keeps their own token and sends ``X-Acting-As`` with the id\n * returned here. Nothing is minted, the authenticated identity stays the\n * operator, and the session is clamped to the lowest assurance by\n * :func:`app.core.security.acting_as` — which makes E14 and E17 unreachable\n * through the guard that already exists rather than through a special case.\n *\n * Ending it early is ``DELETE /admin/impersonations/{id}``, which must be sent\n * *without* the header: a support session holds no staff roles.\n * @summary Open Support Session\n */\nexport const openSupportSession = async (impersonationWrite: ImpersonationWrite, options?: Parameters<typeof request>[1]): Promise<SupportSessionRead> => {\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<SupportSessionRead>(getOpenSupportSessionUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(impersonationWrite)\n }\n);}\n\n\n\n\n\nexport const getOpenSupportSessionMutationKey = () => ['openSupportSession'] as const;\n\nexport const getOpenSupportSessionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openSupportSession>>, TError,OpenSupportSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof openSupportSession>>, TError,OpenSupportSessionMutationVariables, TContext> => {\n\nconst mutationKey = getOpenSupportSessionMutationKey();\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 openSupportSession>>, OpenSupportSessionMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return openSupportSession(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OpenSupportSessionMutationResult = NonNullable<Awaited<ReturnType<typeof openSupportSession>>>\n export type OpenSupportSessionMutationBody = BodyType<ImpersonationWrite>\n export type OpenSupportSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type OpenSupportSessionMutationVariables = {data: BodyType<ImpersonationWrite>}\n\n /**\n * @summary Open Support Session\n */\nexport const useOpenSupportSession = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openSupportSession>>, TError,OpenSupportSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof openSupportSession>>,\n TError,\n OpenSupportSessionMutationVariables,\n TContext\n > => {\n return useMutation(getOpenSupportSessionMutationOptions(options), queryClient);\n }\n export const getCloseSupportSessionUrl = (supportSessionId: number,) => {\n\n\n\n\n return `/admin/impersonations/${supportSessionId}`\n}\n\n/**\n * End a support session early. Idempotent.\n *\n * Must be called *without* ``X-Acting-As``: a session in progress carries no\n * staff roles, so a request made through one cannot reach this endpoint. That\n * is deliberate — the operator steps out before they can close it, and simply\n * dropping the header ends the session's effect immediately either way.\n *\n * ``204`` whether or not the row was still open, and whether or not it was\n * theirs. A support session id is a bare integer and must not be an oracle.\n * @summary Close Support Session\n */\nexport const closeSupportSession = async (supportSessionId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getCloseSupportSessionUrl(supportSessionId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getCloseSupportSessionMutationKey = () => ['closeSupportSession'] as const;\n\nexport const getCloseSupportSessionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeSupportSession>>, TError,CloseSupportSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof closeSupportSession>>, TError,CloseSupportSessionMutationVariables, TContext> => {\n\nconst mutationKey = getCloseSupportSessionMutationKey();\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 closeSupportSession>>, CloseSupportSessionMutationVariables> = (props) => {\n const {supportSessionId} = props ?? {};\n\n return closeSupportSession(supportSessionId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CloseSupportSessionMutationResult = NonNullable<Awaited<ReturnType<typeof closeSupportSession>>>\n\n export type CloseSupportSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CloseSupportSessionMutationVariables = {supportSessionId: number}\n\n /**\n * @summary Close Support Session\n */\nexport const useCloseSupportSession = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeSupportSession>>, TError,CloseSupportSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof closeSupportSession>>,\n TError,\n CloseSupportSessionMutationVariables,\n TContext\n > => {\n return useM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C/E;AACA,MAAa,6BAA6B,qBAA8B;CAK1E,OAAO,yBAAyB;AAClC;;;;;;;;;;;;;AAcA,MAAa,sBAAsB,OAAO,kBAA0B,YAA2D;CAE7H,OAAO,QAAc,0BAA0B,gBAAgB,GAC/D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,0CAA0C,CAAC,qBAAqB;AAE7E,MAAa,yCACW,YACyG;CAEjI,MAAM,cAAc,kCAAkC;CACtD,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,cAAuH,UAAU;EACnI,MAAM,EAAC,qBAAoB,SAAS,CAAC;EAErC,OAAQ,oBAAoB,kBAAiB,cAAc;CAC7D;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,0BACW,SACrB,gBAKQ;CACL,OAAO,YAAY,sCAAsC,OAAO,GAAG,WAAW;AAChF"}
|
|
1
|
+
{"version":3,"file":"admin-support.js","names":[],"sources":["../../src/react/admin-support/admin-support.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.5.0\n */\nimport {\n useMutation\n} from '@tanstack/react-query';\nimport type {\n MutationFunction,\n QueryClient,\n UseMutationOptions,\n UseMutationResult\n} from '@tanstack/react-query';\n\nimport type {\n DemoUserRead,\n DemoUserWrite,\n HTTPExceptionResponse,\n ImpersonationWrite,\n SupportSessionRead,\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\nexport const getCreateDemoUserUrl = () => {\n\n\n\n\n return `/admin/demo-users`\n}\n\n/**\n * Create, or return, a demonstration account for an establishment (E57).\n *\n * ``RequireAdmin`` rather than ``RequireStaff``: this creates an account inside\n * a customer's tenant, which is a change to what the customer has, not an\n * assistance to one of their members.\n *\n * **The account has no password and cannot be signed into directly.** The\n * legacy derived one from the establishment id alone — ``Etab{id padded}$``,\n * at ``etab_{id}@ta.com`` — and then redirected into the impersonation route\n * (defect D15). Anyone who noticed the pattern held a working credential for\n * every establishment. Here the row is created without a credential and is\n * reached through E56, which is audited.\n *\n * ``201`` when created, ``200`` when it already existed. Idempotent, because a\n * salesperson clicking twice should not end up with two demo accounts.\n * @summary Create Demo User\n */\nexport const createDemoUser = async (demoUserWrite: DemoUserWrite, options?: Parameters<typeof request>[1]): Promise<DemoUserRead> => {\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<DemoUserRead>(getCreateDemoUserUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(demoUserWrite)\n }\n);}\n\n\n\n\n\nexport const getCreateDemoUserMutationKey = () => ['createDemoUser'] as const;\n\nexport const getCreateDemoUserMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDemoUser>>, TError,CreateDemoUserMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof createDemoUser>>, TError,CreateDemoUserMutationVariables, TContext> => {\n\nconst mutationKey = getCreateDemoUserMutationKey();\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 createDemoUser>>, CreateDemoUserMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return createDemoUser(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateDemoUserMutationResult = NonNullable<Awaited<ReturnType<typeof createDemoUser>>>\n export type CreateDemoUserMutationBody = BodyType<DemoUserWrite>\n export type CreateDemoUserMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CreateDemoUserMutationVariables = {data: BodyType<DemoUserWrite>}\n\n /**\n * @summary Create Demo User\n */\nexport const useCreateDemoUser = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDemoUser>>, TError,CreateDemoUserMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof createDemoUser>>,\n TError,\n CreateDemoUserMutationVariables,\n TContext\n > => {\n return useMutation(getCreateDemoUserMutationOptions(options), queryClient);\n }\n export const getOpenSupportSessionUrl = () => {\n\n\n\n\n return `/admin/impersonations`\n}\n\n/**\n * Open a support session acting as another account (E56).\n *\n * ``reason`` is mandatory and exists to be logged. A support action with no\n * stated reason cannot be told apart from an abuse of the same endpoint.\n *\n * **This returns no tokens.** It used to: a Keycloak token-exchange session for\n * the subject, on the reasoning that the platform should mint no credentials and\n * that the subject's own assurance level would keep privileged operations out of\n * reach. Both halves turned out to be wrong. The exchanged token carried no\n * actor claim, so it was indistinguishable from the patron's own and the trail\n * stopped at this row; and it carried no ``assurance`` claim either, which\n * ``clamp_assurance`` reads as *unconstrained* — so the operator resolved to\n * ``HIGH`` and could close the account, the single thing the design promised to\n * prevent. Keycloak 26 also rejects the grant outright.\n *\n * So the operator keeps their own token and sends ``X-Acting-As`` with the id\n * returned here. Nothing is minted, the authenticated identity stays the\n * operator, and the session is clamped to the lowest assurance by\n * :func:`app.core.security.acting_as` — which makes E14 and E17 unreachable\n * through the guard that already exists rather than through a special case.\n *\n * Ending it early is ``DELETE /admin/impersonations/{id}``, which must be sent\n * *without* the header: a support session holds no staff roles.\n * @summary Open Support Session\n */\nexport const openSupportSession = async (impersonationWrite: ImpersonationWrite, options?: Parameters<typeof request>[1]): Promise<SupportSessionRead> => {\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<SupportSessionRead>(getOpenSupportSessionUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(impersonationWrite)\n }\n);}\n\n\n\n\n\nexport const getOpenSupportSessionMutationKey = () => ['openSupportSession'] as const;\n\nexport const getOpenSupportSessionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openSupportSession>>, TError,OpenSupportSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof openSupportSession>>, TError,OpenSupportSessionMutationVariables, TContext> => {\n\nconst mutationKey = getOpenSupportSessionMutationKey();\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 openSupportSession>>, OpenSupportSessionMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return openSupportSession(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OpenSupportSessionMutationResult = NonNullable<Awaited<ReturnType<typeof openSupportSession>>>\n export type OpenSupportSessionMutationBody = BodyType<ImpersonationWrite>\n export type OpenSupportSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type OpenSupportSessionMutationVariables = {data: BodyType<ImpersonationWrite>}\n\n /**\n * @summary Open Support Session\n */\nexport const useOpenSupportSession = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openSupportSession>>, TError,OpenSupportSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof openSupportSession>>,\n TError,\n OpenSupportSessionMutationVariables,\n TContext\n > => {\n return useMutation(getOpenSupportSessionMutationOptions(options), queryClient);\n }\n export const getCloseSupportSessionUrl = (supportSessionId: number,) => {\n\n\n\n\n return `/admin/impersonations/${supportSessionId}`\n}\n\n/**\n * End a support session early. Idempotent.\n *\n * Must be called *without* ``X-Acting-As``: a session in progress carries no\n * staff roles, so a request made through one cannot reach this endpoint. That\n * is deliberate — the operator steps out before they can close it, and simply\n * dropping the header ends the session's effect immediately either way.\n *\n * ``204`` whether or not the row was still open, and whether or not it was\n * theirs. A support session id is a bare integer and must not be an oracle.\n * @summary Close Support Session\n */\nexport const closeSupportSession = async (supportSessionId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getCloseSupportSessionUrl(supportSessionId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getCloseSupportSessionMutationKey = () => ['closeSupportSession'] as const;\n\nexport const getCloseSupportSessionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeSupportSession>>, TError,CloseSupportSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof closeSupportSession>>, TError,CloseSupportSessionMutationVariables, TContext> => {\n\nconst mutationKey = getCloseSupportSessionMutationKey();\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 closeSupportSession>>, CloseSupportSessionMutationVariables> = (props) => {\n const {supportSessionId} = props ?? {};\n\n return closeSupportSession(supportSessionId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CloseSupportSessionMutationResult = NonNullable<Awaited<ReturnType<typeof closeSupportSession>>>\n\n export type CloseSupportSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CloseSupportSessionMutationVariables = {supportSessionId: number}\n\n /**\n * @summary Close Support Session\n */\nexport const useCloseSupportSession = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeSupportSession>>, TError,CloseSupportSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof closeSupportSession>>,\n TError,\n CloseSupportSessionMutationVariables,\n TContext\n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,WAAW;AAC/E;AACA,MAAa,6BAA6B,qBAA8B;CAK1E,OAAO,yBAAyB;AAClC;;;;;;;;;;;;;AAcA,MAAa,sBAAsB,OAAO,kBAA0B,YAA2D;CAE7H,OAAO,QAAc,0BAA0B,gBAAgB,GAC/D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,0CAA0C,CAAC,qBAAqB;AAE7E,MAAa,yCACW,YACyG;CAEjI,MAAM,cAAc,kCAAkC;CACtD,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,cAAuH,UAAU;EACnI,MAAM,EAAC,qBAAoB,SAAS,CAAC;EAErC,OAAQ,oBAAoB,kBAAiB,cAAc;CAC7D;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,0BACW,SACrB,gBAKQ;CACL,OAAO,YAAY,sCAAsC,OAAO,GAAG,WAAW;AAChF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { D as TenantSettingsUpdateWrite, G as SearchTenantsParams, N as TenantDirectoryParams, j as TenantSearchPage, k as TenantSettingsRead, t as ValidationErrorResponse, wr as HTTPExceptionResponse } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
4
|
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/admin-tenants/admin-tenants.d.ts
|
|
@@ -41,6 +41,39 @@ export declare function useListTenants<TData = Awaited<ReturnType<typeof listTen
|
|
|
41
41
|
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
42
42
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
43
43
|
};
|
|
44
|
+
export declare const getTenantDirectoryUrl: (params?: TenantDirectoryParams) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Browse tenant summaries within the employee's scope, one bounded page.
|
|
47
|
+
* @summary Tenant Directory
|
|
48
|
+
*/
|
|
49
|
+
export declare const tenantDirectory: (params?: TenantDirectoryParams, options?: Parameters<typeof request>[1]) => Promise<TenantSearchPage>;
|
|
50
|
+
export declare const getTenantDirectoryQueryKey: (params?: TenantDirectoryParams) => readonly ["/admin/tenants/directory", ...TenantDirectoryParams[]];
|
|
51
|
+
export declare const getTenantDirectoryQueryOptions: <TData = Awaited<ReturnType<typeof tenantDirectory>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: TenantDirectoryParams, options?: {
|
|
52
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof tenantDirectory>>, TError, TData>>;
|
|
53
|
+
request?: SecondParameter<typeof request>;
|
|
54
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof tenantDirectory>>, TError, TData> & {
|
|
55
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
56
|
+
};
|
|
57
|
+
export type TenantDirectoryQueryResult = NonNullable<Awaited<ReturnType<typeof tenantDirectory>>>;
|
|
58
|
+
export type TenantDirectoryQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
59
|
+
export declare function useTenantDirectory<TData = Awaited<ReturnType<typeof tenantDirectory>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: undefined | TenantDirectoryParams, options: {
|
|
60
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof tenantDirectory>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof tenantDirectory>>, TError, Awaited<ReturnType<typeof tenantDirectory>>>, 'initialData'>;
|
|
61
|
+
request?: SecondParameter<typeof request>;
|
|
62
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
63
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
64
|
+
};
|
|
65
|
+
export declare function useTenantDirectory<TData = Awaited<ReturnType<typeof tenantDirectory>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: TenantDirectoryParams, options?: {
|
|
66
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof tenantDirectory>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof tenantDirectory>>, TError, Awaited<ReturnType<typeof tenantDirectory>>>, 'initialData'>;
|
|
67
|
+
request?: SecondParameter<typeof request>;
|
|
68
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
69
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
70
|
+
};
|
|
71
|
+
export declare function useTenantDirectory<TData = Awaited<ReturnType<typeof tenantDirectory>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: TenantDirectoryParams, options?: {
|
|
72
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof tenantDirectory>>, TError, TData>>;
|
|
73
|
+
request?: SecondParameter<typeof request>;
|
|
74
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
75
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
76
|
+
};
|
|
44
77
|
export declare const getSearchTenantsUrl: (params: SearchTenantsParams) => string;
|
|
45
78
|
/**
|
|
46
79
|
* Find tenants by literal name within the employee's tenant scope.
|