@learnorama/mozaik-sdk 0.7.0-staging.26.1 → 0.8.2-staging.31.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-desk.d.ts +86 -1
- package/dist/api/admin-desk.js +280 -1
- package/dist/api/admin-desk.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 +2 -7
- package/dist/api/admin-patrons.js +1 -6
- 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 +2 -2
- package/dist/api/admin-tenants.js +1 -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 +2 -2
- package/dist/api/tutoring-dispatch.js +1 -1
- package/dist/api/tutoring-dispatch.js.map +1 -1
- package/dist/api/tutoring-practitioner.d.ts +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 +789 -223
- 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 +15 -1
- 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-desk.d.ts +545 -1
- package/dist/react/admin-desk.js +689 -2
- package/dist/react/admin-desk.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 +2 -7
- package/dist/react/admin-patrons.js +2 -7
- 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 +2 -2
- package/dist/react/admin-tenants.js +2 -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 +2 -2
- package/dist/react/tutoring-dispatch.js +2 -2
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-catalogue.js","names":[],"sources":["../../src/react/admin-catalogue/admin-catalogue.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.7.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 ListThemesParams,\n ThemeListRead,\n ThemeOrderWrite,\n ThemeRead,\n ThemeWrite,\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 getListThemesUrl = (params?: ListThemesParams,) => {\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/themes?${stringifiedParams}` : `/admin/themes`\n}\n\n/**\n * Every theme, or one pillar's, in display order.\n *\n * Not paginated. There are 27 of them, and a client that has to page through\n * a list it is about to reorder cannot reorder it.\n * @summary List Themes\n */\nexport const listThemes = async (params?: ListThemesParams, options?: Parameters<typeof request>[1]): Promise<ThemeListRead> => {\n\n return request<ThemeListRead>(getListThemesUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListThemesQueryKey = (params?: ListThemesParams,) => {\n return [\n `/admin/themes`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListThemesQueryOptions = <TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListThemesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListThemesQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listThemes>>> = ({ signal }) => listThemes(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListThemesQueryResult = NonNullable<Awaited<ReturnType<typeof listThemes>>>\nexport type ListThemesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListThemesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listThemes>>,\n TError,\n Awaited<ReturnType<typeof listThemes>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListThemesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listThemes>>,\n TError,\n Awaited<ReturnType<typeof listThemes>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListThemesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Themes\n */\n\nexport function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListThemesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListThemesQueryOptions(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 getCreateThemeUrl = () => {\n\n\n\n\n return `/admin/themes`\n}\n\n/**\n * Add a theme.\n *\n * ``409`` on a duplicate ``(pillar, title)``: that pair is unique in the\n * schema, and two themes with the same name in the same pillar are\n * indistinguishable to everyone downstream.\n *\n * With no ``sortOrder`` it goes last, which is what the legacy's form does by\n * defaulting the field to the current maximum plus one.\n * @summary Create Theme\n */\nexport const createTheme = async (themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]): Promise<ThemeRead> => {\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<ThemeRead>(getCreateThemeUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(themeWrite)\n }\n);}\n\n\n\n\n\nexport const getCreateThemeMutationKey = () => ['createTheme'] as const;\n\nexport const getCreateThemeMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createTheme>>, TError,CreateThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof createTheme>>, TError,CreateThemeMutationVariables, TContext> => {\n\nconst mutationKey = getCreateThemeMutationKey();\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 createTheme>>, CreateThemeMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return createTheme(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateThemeMutationResult = NonNullable<Awaited<ReturnType<typeof createTheme>>>\n export type CreateThemeMutationBody = BodyType<ThemeWrite>\n export type CreateThemeMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CreateThemeMutationVariables = {data: BodyType<ThemeWrite>}\n\n /**\n * @summary Create Theme\n */\nexport const useCreateTheme = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createTheme>>, TError,CreateThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof createTheme>>,\n TError,\n CreateThemeMutationVariables,\n TContext\n > => {\n return useMutation(getCreateThemeMutationOptions(options), queryClient);\n }\n export const getReorderThemesUrl = () => {\n\n\n\n\n return `/admin/themes/order`\n}\n\n/**\n * Set the display order for a set of themes, in one transaction.\n *\n * The legacy renumbers one theme per request, so dragging an item in a list of\n * thirty was thirty requests — and closing the tab halfway left the order\n * half-applied, with two themes claiming the same position and the listing\n * silently choosing between them.\n *\n * Ids not named keep their relative order after the ones that are, so a client\n * may send only what moved. An unknown id is ``404`` and nothing is written:\n * a partially applied reorder is the failure this endpoint exists to prevent.\n * @summary Reorder Themes\n */\nexport const reorderThemes = async (themeOrderWrite: ThemeOrderWrite, 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>(getReorderThemesUrl(),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(themeOrderWrite)\n }\n);}\n\n\n\n\n\nexport const getReorderThemesMutationKey = () => ['reorderThemes'] as const;\n\nexport const getReorderThemesMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof reorderThemes>>, TError,ReorderThemesMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof reorderThemes>>, TError,ReorderThemesMutationVariables, TContext> => {\n\nconst mutationKey = getReorderThemesMutationKey();\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 reorderThemes>>, ReorderThemesMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return reorderThemes(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ReorderThemesMutationResult = NonNullable<Awaited<ReturnType<typeof reorderThemes>>>\n export type ReorderThemesMutationBody = BodyType<ThemeOrderWrite>\n export type ReorderThemesMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ReorderThemesMutationVariables = {data: BodyType<ThemeOrderWrite>}\n\n /**\n * @summary Reorder Themes\n */\nexport const useReorderThemes = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof reorderThemes>>, TError,ReorderThemesMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof reorderThemes>>,\n TError,\n ReorderThemesMutationVariables,\n TContext\n > => {\n return useMutation(getReorderThemesMutationOptions(options), queryClient);\n }\n export const getDeleteThemeUrl = (themeId: number,) => {\n\n\n\n\n return `/admin/themes/${themeId}`\n}\n\n/**\n * Remove a theme.\n *\n * ``409`` when works still carry it. The legacy deletes and leaves the\n * references dangling, which is how a catalogue ends up with items filed under\n * a theme that no longer exists and no screen that can find them.\n *\n * Idempotent otherwise: deleting something already gone is ``204``, because\n * the caller wanted it gone and it is gone.\n * @summary Delete Theme\n */\nexport const deleteTheme = async (themeId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteThemeUrl(themeId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getDeleteThemeMutationKey = () => ['deleteTheme'] as const;\n\nexport const getDeleteThemeMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteTheme>>, TError,DeleteThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteTheme>>, TError,DeleteThemeMutationVariables, TContext> => {\n\nconst mutationKey = getDeleteThemeMutationKey();\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 deleteTheme>>, DeleteThemeMutationVariables> = (props) => {\n const {themeId} = props ?? {};\n\n return deleteTheme(themeId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteThemeMutationResult = NonNullable<Awaited<ReturnType<typeof deleteTheme>>>\n\n export type DeleteThemeMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type DeleteThemeMutationVariables = {themeId: number}\n\n /**\n * @summary Delete Theme\n */\nexport const useDeleteTheme = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteTheme>>, TError,DeleteThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof deleteTheme>>,\n TError,\n DeleteThemeMutationVariables,\n TContext\n > => {\n return useMutation(getDeleteThemeMutationOptions(options), queryClient);\n }\n export const getReadThemeUrl = (themeId: number,) => {\n\n\n\n\n return `/admin/themes/${themeId}`\n}\n\n/**\n * One theme.\n * @summary Read Theme\n */\nexport const readTheme = async (themeId: number, options?: Parameters<typeof request>[1]): Promise<ThemeRead> => {\n\n return request<ThemeRead>(getReadThemeUrl(themeId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadThemeQueryKey = (themeId: number,) => {\n return [\n `/admin/themes/${themeId}`\n ] as const;\n }\n\n\nexport const getReadThemeQueryOptions = <TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(themeId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadThemeQueryKey(themeId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readTheme>>> = ({ signal }) => readTheme(themeId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: themeId !== null && themeId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadThemeQueryResult = NonNullable<Awaited<ReturnType<typeof readTheme>>>\nexport type ReadThemeQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n themeId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readTheme>>,\n TError,\n Awaited<ReturnType<typeof readTheme>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n themeId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readTheme>>,\n TError,\n Awaited<ReturnType<typeof readTheme>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n themeId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Theme\n */\n\nexport function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n themeId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadThemeQueryOptions(themeId,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 getAmendThemeUrl = (themeId: number,) => {\n\n\n\n\n return `/admin/themes/${themeId}`\n}\n\n/**\n * Amend a theme. Same uniqueness rule as creating one.\n * @summary Amend Theme\n */\nexport const amendTheme = async (themeId: number,\n themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]): Promise<ThemeRead> => {\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<ThemeRead>(getAmendThemeUrl(themeId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(themeWrite)\n }\n);}\n\n\n\n\n\nexport const getAmendThemeMutationKey = () => ['amendTheme'] as const;\n\nexport const getAmendThemeMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof amendTheme>>, TError,AmendThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof amendTheme>>, TError,AmendThemeMutationVariables, TContext> => {\n\nconst mutationKey = getAmendThemeMutationKey();\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 amendTheme>>, AmendThemeMutationVariables> = (props) => {\n const {themeId,data} = props ?? {};\n\n return amendTheme(themeId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AmendThemeMutationResult = NonNullable<Awaited<ReturnType<typeof amendTheme>>>\n export type AmendThemeMutationBody = BodyType<ThemeWrite>\n export type AmendThemeMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type AmendThemeMutationVariables = {themeId: number;data: BodyType<ThemeWrite>}\n\n /**\n * @summary Amend Theme\n */\nexport const useAmendTheme = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof amendTheme>>, TError,AmendThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof amendTheme>>,\n TError,\n AmendThemeMut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AC;EAEjC,OAAQ,WAAW,SAAQ,MAAK,cAAc;CAChD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,iBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,6BAA6B,OAAO,GAAG,WAAW;AACvE"}
|
|
1
|
+
{"version":3,"file":"admin-catalogue.js","names":[],"sources":["../../src/react/admin-catalogue/admin-catalogue.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.8.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 ListThemesParams,\n ThemeListRead,\n ThemeOrderWrite,\n ThemeRead,\n ThemeWrite,\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 getListThemesUrl = (params?: ListThemesParams,) => {\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/themes?${stringifiedParams}` : `/admin/themes`\n}\n\n/**\n * Every theme, or one pillar's, in display order.\n *\n * Not paginated. There are 27 of them, and a client that has to page through\n * a list it is about to reorder cannot reorder it.\n * @summary List Themes\n */\nexport const listThemes = async (params?: ListThemesParams, options?: Parameters<typeof request>[1]): Promise<ThemeListRead> => {\n\n return request<ThemeListRead>(getListThemesUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListThemesQueryKey = (params?: ListThemesParams,) => {\n return [\n `/admin/themes`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListThemesQueryOptions = <TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListThemesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListThemesQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listThemes>>> = ({ signal }) => listThemes(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListThemesQueryResult = NonNullable<Awaited<ReturnType<typeof listThemes>>>\nexport type ListThemesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListThemesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listThemes>>,\n TError,\n Awaited<ReturnType<typeof listThemes>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListThemesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listThemes>>,\n TError,\n Awaited<ReturnType<typeof listThemes>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListThemesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Themes\n */\n\nexport function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListThemesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListThemesQueryOptions(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 getCreateThemeUrl = () => {\n\n\n\n\n return `/admin/themes`\n}\n\n/**\n * Add a theme.\n *\n * ``409`` on a duplicate ``(pillar, title)``: that pair is unique in the\n * schema, and two themes with the same name in the same pillar are\n * indistinguishable to everyone downstream.\n *\n * With no ``sortOrder`` it goes last, which is what the legacy's form does by\n * defaulting the field to the current maximum plus one.\n * @summary Create Theme\n */\nexport const createTheme = async (themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]): Promise<ThemeRead> => {\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<ThemeRead>(getCreateThemeUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(themeWrite)\n }\n);}\n\n\n\n\n\nexport const getCreateThemeMutationKey = () => ['createTheme'] as const;\n\nexport const getCreateThemeMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createTheme>>, TError,CreateThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof createTheme>>, TError,CreateThemeMutationVariables, TContext> => {\n\nconst mutationKey = getCreateThemeMutationKey();\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 createTheme>>, CreateThemeMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return createTheme(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateThemeMutationResult = NonNullable<Awaited<ReturnType<typeof createTheme>>>\n export type CreateThemeMutationBody = BodyType<ThemeWrite>\n export type CreateThemeMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CreateThemeMutationVariables = {data: BodyType<ThemeWrite>}\n\n /**\n * @summary Create Theme\n */\nexport const useCreateTheme = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createTheme>>, TError,CreateThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof createTheme>>,\n TError,\n CreateThemeMutationVariables,\n TContext\n > => {\n return useMutation(getCreateThemeMutationOptions(options), queryClient);\n }\n export const getReorderThemesUrl = () => {\n\n\n\n\n return `/admin/themes/order`\n}\n\n/**\n * Set the display order for a set of themes, in one transaction.\n *\n * The legacy renumbers one theme per request, so dragging an item in a list of\n * thirty was thirty requests — and closing the tab halfway left the order\n * half-applied, with two themes claiming the same position and the listing\n * silently choosing between them.\n *\n * Ids not named keep their relative order after the ones that are, so a client\n * may send only what moved. An unknown id is ``404`` and nothing is written:\n * a partially applied reorder is the failure this endpoint exists to prevent.\n * @summary Reorder Themes\n */\nexport const reorderThemes = async (themeOrderWrite: ThemeOrderWrite, 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>(getReorderThemesUrl(),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(themeOrderWrite)\n }\n);}\n\n\n\n\n\nexport const getReorderThemesMutationKey = () => ['reorderThemes'] as const;\n\nexport const getReorderThemesMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof reorderThemes>>, TError,ReorderThemesMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof reorderThemes>>, TError,ReorderThemesMutationVariables, TContext> => {\n\nconst mutationKey = getReorderThemesMutationKey();\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 reorderThemes>>, ReorderThemesMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return reorderThemes(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ReorderThemesMutationResult = NonNullable<Awaited<ReturnType<typeof reorderThemes>>>\n export type ReorderThemesMutationBody = BodyType<ThemeOrderWrite>\n export type ReorderThemesMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ReorderThemesMutationVariables = {data: BodyType<ThemeOrderWrite>}\n\n /**\n * @summary Reorder Themes\n */\nexport const useReorderThemes = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof reorderThemes>>, TError,ReorderThemesMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof reorderThemes>>,\n TError,\n ReorderThemesMutationVariables,\n TContext\n > => {\n return useMutation(getReorderThemesMutationOptions(options), queryClient);\n }\n export const getDeleteThemeUrl = (themeId: number,) => {\n\n\n\n\n return `/admin/themes/${themeId}`\n}\n\n/**\n * Remove a theme.\n *\n * ``409`` when works still carry it. The legacy deletes and leaves the\n * references dangling, which is how a catalogue ends up with items filed under\n * a theme that no longer exists and no screen that can find them.\n *\n * Idempotent otherwise: deleting something already gone is ``204``, because\n * the caller wanted it gone and it is gone.\n * @summary Delete Theme\n */\nexport const deleteTheme = async (themeId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteThemeUrl(themeId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getDeleteThemeMutationKey = () => ['deleteTheme'] as const;\n\nexport const getDeleteThemeMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteTheme>>, TError,DeleteThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteTheme>>, TError,DeleteThemeMutationVariables, TContext> => {\n\nconst mutationKey = getDeleteThemeMutationKey();\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 deleteTheme>>, DeleteThemeMutationVariables> = (props) => {\n const {themeId} = props ?? {};\n\n return deleteTheme(themeId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteThemeMutationResult = NonNullable<Awaited<ReturnType<typeof deleteTheme>>>\n\n export type DeleteThemeMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type DeleteThemeMutationVariables = {themeId: number}\n\n /**\n * @summary Delete Theme\n */\nexport const useDeleteTheme = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteTheme>>, TError,DeleteThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof deleteTheme>>,\n TError,\n DeleteThemeMutationVariables,\n TContext\n > => {\n return useMutation(getDeleteThemeMutationOptions(options), queryClient);\n }\n export const getReadThemeUrl = (themeId: number,) => {\n\n\n\n\n return `/admin/themes/${themeId}`\n}\n\n/**\n * One theme.\n * @summary Read Theme\n */\nexport const readTheme = async (themeId: number, options?: Parameters<typeof request>[1]): Promise<ThemeRead> => {\n\n return request<ThemeRead>(getReadThemeUrl(themeId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadThemeQueryKey = (themeId: number,) => {\n return [\n `/admin/themes/${themeId}`\n ] as const;\n }\n\n\nexport const getReadThemeQueryOptions = <TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(themeId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadThemeQueryKey(themeId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readTheme>>> = ({ signal }) => readTheme(themeId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: themeId !== null && themeId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadThemeQueryResult = NonNullable<Awaited<ReturnType<typeof readTheme>>>\nexport type ReadThemeQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n themeId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readTheme>>,\n TError,\n Awaited<ReturnType<typeof readTheme>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n themeId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readTheme>>,\n TError,\n Awaited<ReturnType<typeof readTheme>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n themeId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Theme\n */\n\nexport function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n themeId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadThemeQueryOptions(themeId,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 getAmendThemeUrl = (themeId: number,) => {\n\n\n\n\n return `/admin/themes/${themeId}`\n}\n\n/**\n * Amend a theme. Same uniqueness rule as creating one.\n * @summary Amend Theme\n */\nexport const amendTheme = async (themeId: number,\n themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]): Promise<ThemeRead> => {\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<ThemeRead>(getAmendThemeUrl(themeId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(themeWrite)\n }\n);}\n\n\n\n\n\nexport const getAmendThemeMutationKey = () => ['amendTheme'] as const;\n\nexport const getAmendThemeMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof amendTheme>>, TError,AmendThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof amendTheme>>, TError,AmendThemeMutationVariables, TContext> => {\n\nconst mutationKey = getAmendThemeMutationKey();\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 amendTheme>>, AmendThemeMutationVariables> = (props) => {\n const {themeId,data} = props ?? {};\n\n return amendTheme(themeId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AmendThemeMutationResult = NonNullable<Awaited<ReturnType<typeof amendTheme>>>\n export type AmendThemeMutationBody = BodyType<ThemeWrite>\n export type AmendThemeMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type AmendThemeMutationVariables = {themeId: number;data: BodyType<ThemeWrite>}\n\n /**\n * @summary Amend Theme\n */\nexport const useAmendTheme = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof amendTheme>>, TError,AmendThemeMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof amendTheme>>,\n TError,\n AmendThemeMutationVariables,\n TContext\n > => {\n return useMutation(getAmendThemeMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA4CA,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,WAA+B;CAC9D,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,I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UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAmB,iBAAiB,OAAO,GAChD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,UAAU;CACjC,CACF;AAAE;AAMF,MAAa,iCAAiC,CAAC,YAAY;AAE3D,MAAa,gCACW,YACuF;CAE/G,MAAM,cAAc,yBAAyB;CAC7C,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,cAAqG,UAAU;EACjH,MAAM,EAAC,SAAQ,SAAQ,SAAS,CAAC;EAEjC,OAAQ,WAAW,SAAQ,MAAK,cAAc;CAChD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,iBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,6BAA6B,OAAO,GAAG,WAAW;AACvE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Dn as LiveLeaseListRead, Dr as HTTPExceptionResponse, rr as LeaseCloseWrite, t as ValidationErrorResponse } 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-consumption/admin-consumption.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.8.2
|
|
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.7.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,QAA2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AAM,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.8.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,Y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