@learnorama/mozaik-sdk 0.1.0 → 0.3.2-staging.19.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/README.md +186 -5
- package/dist/api/account.d.ts +2 -2
- package/dist/api/account.js +1 -1
- package/dist/api/account.js.map +1 -1
- package/dist/api/admin-catalogue.d.ts +2 -2
- package/dist/api/admin-catalogue.js +1 -1
- package/dist/api/admin-catalogue.js.map +1 -1
- package/dist/api/admin-consumption.d.ts +7 -2
- package/dist/api/admin-consumption.js +6 -1
- package/dist/api/admin-consumption.js.map +1 -1
- package/dist/api/admin-licenses.d.ts +2 -2
- package/dist/api/admin-licenses.js +1 -1
- package/dist/api/admin-licenses.js.map +1 -1
- package/dist/api/admin-patrons.d.ts +3 -3
- package/dist/api/admin-patrons.js +2 -2
- package/dist/api/admin-patrons.js.map +1 -1
- package/dist/api/admin-reviews.d.ts +2 -2
- package/dist/api/admin-reviews.js +1 -1
- package/dist/api/admin-reviews.js.map +1 -1
- package/dist/api/admin-roles.d.ts +3 -3
- package/dist/api/admin-roles.js +2 -2
- package/dist/api/admin-roles.js.map +1 -1
- package/dist/api/admin-support.d.ts +2 -2
- package/dist/api/admin-support.js +1 -1
- package/dist/api/admin-support.js.map +1 -1
- package/dist/api/admin-tenants.d.ts +8 -2
- package/dist/api/admin-tenants.js +20 -2
- package/dist/api/admin-tenants.js.map +1 -1
- package/dist/api/admin-tutoring.d.ts +2 -2
- package/dist/api/admin-tutoring.js +1 -1
- package/dist/api/admin-tutoring.js.map +1 -1
- package/dist/api/auth.d.ts +2 -2
- package/dist/api/auth.js +1 -1
- package/dist/api/auth.js.map +1 -1
- package/dist/api/biblio-catalogue.d.ts +2 -2
- package/dist/api/biblio-catalogue.js +1 -1
- package/dist/api/biblio-catalogue.js.map +1 -1
- package/dist/api/biblio-home.d.ts +2 -2
- package/dist/api/biblio-home.js +1 -1
- package/dist/api/biblio-home.js.map +1 -1
- package/dist/api/biblio-library.d.ts +2 -2
- package/dist/api/biblio-library.js +1 -1
- package/dist/api/biblio-library.js.map +1 -1
- package/dist/api/biblio-nextory.d.ts +2 -2
- package/dist/api/biblio-nextory.js +1 -1
- package/dist/api/biblio-nextory.js.map +1 -1
- package/dist/api/biblio-press.d.ts +2 -2
- package/dist/api/biblio-press.js +1 -1
- package/dist/api/biblio-press.js.map +1 -1
- package/dist/api/biblio-search.d.ts +2 -2
- package/dist/api/biblio-search.js +1 -1
- package/dist/api/biblio-search.js.map +1 -1
- package/dist/api/biblio-telemetry.d.ts +2 -2
- package/dist/api/biblio-telemetry.js +1 -1
- package/dist/api/biblio-telemetry.js.map +1 -1
- package/dist/api/consumption.d.ts +2 -2
- package/dist/api/consumption.js +1 -1
- package/dist/api/consumption.js.map +1 -1
- package/dist/api/cvs-app.d.ts +2 -2
- package/dist/api/cvs-app.js +1 -1
- package/dist/api/cvs-app.js.map +1 -1
- package/dist/api/cvs-documents.d.ts +16 -4
- package/dist/api/cvs-documents.js +22 -5
- package/dist/api/cvs-documents.js.map +1 -1
- package/dist/api/cvs-favorites.d.ts +2 -2
- package/dist/api/cvs-favorites.js +1 -1
- package/dist/api/cvs-favorites.js.map +1 -1
- package/dist/api/cvs-ils.d.ts +167 -0
- package/dist/api/cvs-ils.js +362 -0
- package/dist/api/cvs-ils.js.map +1 -0
- package/dist/api/cvs-loans.d.ts +2 -2
- package/dist/api/cvs-loans.js +1 -1
- package/dist/api/cvs-loans.js.map +1 -1
- package/dist/api/cvs-payments.d.ts +49 -0
- package/dist/api/cvs-payments.js +84 -0
- package/dist/api/cvs-payments.js.map +1 -0
- package/dist/api/cvs-streaming.d.ts +2 -2
- package/dist/api/cvs-streaming.js +1 -1
- package/dist/api/cvs-streaming.js.map +1 -1
- package/dist/api/index.d.ts +5 -2
- package/dist/api/index.js +7 -4
- package/dist/api/partner-catalogue.d.ts +2 -2
- package/dist/api/partner-catalogue.js +1 -1
- package/dist/api/partner-catalogue.js.map +1 -1
- package/dist/api/partner-reader.d.ts +2 -2
- package/dist/api/partner-reader.js +1 -1
- package/dist/api/partner-reader.js.map +1 -1
- package/dist/api/profiles.d.ts +2 -2
- package/dist/api/profiles.js +1 -1
- package/dist/api/profiles.js.map +1 -1
- package/dist/api/search.d.ts +18 -0
- package/dist/api/search.js +37 -0
- package/dist/api/search.js.map +1 -0
- package/dist/api/tutoring-catalogue.d.ts +2 -2
- package/dist/api/tutoring-catalogue.js +1 -1
- package/dist/api/tutoring-catalogue.js.map +1 -1
- package/dist/api/tutoring-chat.d.ts +2 -2
- package/dist/api/tutoring-chat.js +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 +2 -2
- package/dist/api/tutoring-practitioner.js +1 -1
- package/dist/api/tutoring-practitioner.js.map +1 -1
- package/dist/api/tutoring-requests.d.ts +2 -2
- package/dist/api/tutoring-requests.js +1 -1
- package/dist/api/tutoring-requests.js.map +1 -1
- package/dist/auth.d.ts +10 -0
- package/dist/auth.js +451 -0
- package/dist/auth.js.map +1 -0
- package/dist/chat.d.ts +3 -0
- package/dist/chat.js +3 -0
- package/dist/{client-BDwBZYB0.d.ts → chunks/client.d.ts} +1 -1
- package/dist/{client-D3kMOcIr.js → chunks/client.js} +1 -1
- package/dist/chunks/client.js.map +1 -0
- package/dist/chunks/client2.d.ts +53 -0
- package/dist/chunks/connection.d.ts +28 -0
- package/dist/chunks/connection.js +141 -0
- package/dist/chunks/connection.js.map +1 -0
- package/dist/{index-wL_20vR8.d.ts → chunks/index.d.ts} +901 -128
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +2 -2
- package/dist/models.js +44 -1
- package/dist/models.js.map +1 -1
- package/dist/react/account.d.ts +2 -2
- package/dist/react/account.js +2 -2
- package/dist/react/account.js.map +1 -1
- package/dist/react/admin-catalogue.d.ts +2 -2
- package/dist/react/admin-catalogue.js +2 -2
- package/dist/react/admin-catalogue.js.map +1 -1
- package/dist/react/admin-consumption.d.ts +7 -2
- package/dist/react/admin-consumption.js +7 -2
- package/dist/react/admin-consumption.js.map +1 -1
- package/dist/react/admin-licenses.d.ts +2 -2
- package/dist/react/admin-licenses.js +2 -2
- package/dist/react/admin-licenses.js.map +1 -1
- package/dist/react/admin-patrons.d.ts +3 -3
- package/dist/react/admin-patrons.js +3 -3
- package/dist/react/admin-patrons.js.map +1 -1
- package/dist/react/admin-reviews.d.ts +2 -2
- package/dist/react/admin-reviews.js +2 -2
- package/dist/react/admin-reviews.js.map +1 -1
- package/dist/react/admin-roles.d.ts +3 -3
- package/dist/react/admin-roles.js +3 -3
- package/dist/react/admin-roles.js.map +1 -1
- package/dist/react/admin-support.d.ts +2 -2
- package/dist/react/admin-support.js +2 -2
- package/dist/react/admin-support.js.map +1 -1
- package/dist/react/admin-tenants.d.ts +35 -2
- package/dist/react/admin-tenants.js +45 -3
- package/dist/react/admin-tenants.js.map +1 -1
- package/dist/react/admin-tutoring.d.ts +2 -2
- package/dist/react/admin-tutoring.js +2 -2
- package/dist/react/admin-tutoring.js.map +1 -1
- package/dist/react/auth.d.ts +2 -2
- package/dist/react/auth.js +2 -2
- package/dist/react/auth.js.map +1 -1
- package/dist/react/biblio-catalogue.d.ts +2 -2
- package/dist/react/biblio-catalogue.js +2 -2
- package/dist/react/biblio-catalogue.js.map +1 -1
- package/dist/react/biblio-home.d.ts +2 -2
- package/dist/react/biblio-home.js +2 -2
- package/dist/react/biblio-home.js.map +1 -1
- package/dist/react/biblio-library.d.ts +2 -2
- package/dist/react/biblio-library.js +2 -2
- package/dist/react/biblio-library.js.map +1 -1
- package/dist/react/biblio-nextory.d.ts +2 -2
- package/dist/react/biblio-nextory.js +2 -2
- package/dist/react/biblio-nextory.js.map +1 -1
- package/dist/react/biblio-press.d.ts +2 -2
- package/dist/react/biblio-press.js +2 -2
- package/dist/react/biblio-press.js.map +1 -1
- package/dist/react/biblio-search.d.ts +2 -2
- package/dist/react/biblio-search.js +2 -2
- package/dist/react/biblio-search.js.map +1 -1
- package/dist/react/biblio-telemetry.d.ts +2 -2
- package/dist/react/biblio-telemetry.js +2 -2
- package/dist/react/biblio-telemetry.js.map +1 -1
- package/dist/react/chat.d.ts +36 -0
- package/dist/react/chat.js +234 -0
- package/dist/react/chat.js.map +1 -0
- package/dist/react/consumption.d.ts +2 -2
- package/dist/react/consumption.js +2 -2
- package/dist/react/consumption.js.map +1 -1
- package/dist/react/cvs-app.d.ts +2 -2
- package/dist/react/cvs-app.js +2 -2
- package/dist/react/cvs-app.js.map +1 -1
- package/dist/react/cvs-documents.d.ts +17 -4
- package/dist/react/cvs-documents.js +25 -8
- package/dist/react/cvs-documents.js.map +1 -1
- package/dist/react/cvs-favorites.d.ts +2 -2
- package/dist/react/cvs-favorites.js +2 -2
- package/dist/react/cvs-favorites.js.map +1 -1
- package/dist/react/cvs-ils.d.ts +552 -0
- package/dist/react/cvs-ils.js +822 -0
- package/dist/react/cvs-ils.js.map +1 -0
- package/dist/react/cvs-loans.d.ts +2 -2
- package/dist/react/cvs-loans.js +2 -2
- package/dist/react/cvs-loans.js.map +1 -1
- package/dist/react/cvs-payments.d.ts +123 -0
- package/dist/react/cvs-payments.js +181 -0
- package/dist/react/cvs-payments.js.map +1 -0
- package/dist/react/cvs-streaming.d.ts +2 -2
- package/dist/react/cvs-streaming.js +2 -2
- package/dist/react/cvs-streaming.js.map +1 -1
- package/dist/react/index.d.ts +5 -2
- package/dist/react/index.js +5 -2
- package/dist/react/partner-catalogue.d.ts +2 -2
- package/dist/react/partner-catalogue.js +2 -2
- package/dist/react/partner-catalogue.js.map +1 -1
- package/dist/react/partner-reader.d.ts +2 -2
- package/dist/react/partner-reader.js +2 -2
- package/dist/react/partner-reader.js.map +1 -1
- package/dist/react/profiles.d.ts +2 -2
- package/dist/react/profiles.js +2 -2
- package/dist/react/profiles.js.map +1 -1
- package/dist/react/search.d.ts +47 -0
- package/dist/react/search.js +81 -0
- package/dist/react/search.js.map +1 -0
- package/dist/react/sso.d.ts +15 -0
- package/dist/react/sso.js +48 -0
- package/dist/react/sso.js.map +1 -0
- package/dist/react/tutoring-catalogue.d.ts +2 -2
- package/dist/react/tutoring-catalogue.js +2 -2
- package/dist/react/tutoring-catalogue.js.map +1 -1
- package/dist/react/tutoring-chat.d.ts +2 -2
- package/dist/react/tutoring-chat.js +2 -2
- 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 +2 -2
- package/dist/react/tutoring-practitioner.js +2 -2
- package/dist/react/tutoring-practitioner.js.map +1 -1
- package/dist/react/tutoring-requests.d.ts +2 -2
- package/dist/react/tutoring-requests.js +2 -2
- package/dist/react/tutoring-requests.js.map +1 -1
- package/package.json +29 -1
- package/dist/client-D3kMOcIr.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","names":[],"sources":["../../src/react/profiles/profiles.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ProfileCreateWrite,\n ProfileListRead,\n ProfileRead,\n ProfileUpdateWrite,\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 getListProfilesUrl = () => {\n\n\n\n\n return `/me/profiles`\n}\n\n/**\n * Every profile on this account, the holder included (E20).\n *\n * Unpaginated: the cap is :data:`PROFILE_LIMIT`, so there is no page to turn.\n * One endpoint replaces two legacy routes that rendered the same collection\n * differently — the difference was presentation, which is the client's problem.\n * @summary List Profiles\n */\nexport const listProfiles = async ( options?: Parameters<typeof request>[1]): Promise<ProfileListRead> => {\n\n return request<ProfileListRead>(getListProfilesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListProfilesQueryKey = () => {\n return [\n `/me/profiles`\n ] as const;\n }\n\n\nexport const getListProfilesQueryOptions = <TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListProfilesQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listProfiles>>> = ({ signal }) => listProfiles({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListProfilesQueryResult = NonNullable<Awaited<ReturnType<typeof listProfiles>>>\nexport type ListProfilesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listProfiles>>,\n TError,\n Awaited<ReturnType<typeof listProfiles>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listProfiles>>,\n TError,\n Awaited<ReturnType<typeof listProfiles>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Profiles\n */\n\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListProfilesQueryOptions(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 getCreateProfileUrl = () => {\n\n\n\n\n return `/me/profiles`\n}\n\n/**\n * Add a profile to this account (E21).\n *\n * The new row inherits ``tenant_id`` from the holder rather than accepting one:\n * a profile belongs to the same company as the account it hangs off, and\n * letting that be supplied would be a way into another tenant.\n *\n * A profile has no credential of its own. It has no ``login``, no ``email`` and\n * no password — it is reached by switching within an authenticated session, so\n * there is nothing for it to authenticate *with*.\n * @summary Create Profile\n */\nexport const createProfile = async (profileCreateWrite: ProfileCreateWrite, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\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<ProfileRead>(getCreateProfileUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(profileCreateWrite)\n }\n);}\n\n\n\n\n\nexport const getCreateProfileMutationKey = () => ['createProfile'] as const;\n\nexport const getCreateProfileMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProfile>>, TError,CreateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof createProfile>>, TError,CreateProfileMutationVariables, TContext> => {\n\nconst mutationKey = getCreateProfileMutationKey();\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 createProfile>>, CreateProfileMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return createProfile(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateProfileMutationResult = NonNullable<Awaited<ReturnType<typeof createProfile>>>\n export type CreateProfileMutationBody = BodyType<ProfileCreateWrite>\n export type CreateProfileMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CreateProfileMutationVariables = {data: BodyType<ProfileCreateWrite>}\n\n /**\n * @summary Create Profile\n */\nexport const useCreateProfile = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProfile>>, TError,CreateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof createProfile>>,\n TError,\n CreateProfileMutationVariables,\n TContext\n > => {\n return useMutation(getCreateProfileMutationOptions(options), queryClient);\n }\n export const getDeleteProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * Remove a profile (E24). Idempotent.\n *\n * Deleting a profile that is already gone is ``204``, not ``404``: the caller\n * asked for it to be absent and it is absent. A retried delete after a timeout\n * must not read as a failure.\n *\n * The account holder cannot be deleted this way — that is E17, which anonymises\n * the whole account and is a different decision with different consequences.\n * @summary Delete Profile\n */\nexport const deleteProfile = async (profileId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteProfileUrl(profileId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getDeleteProfileMutationKey = () => ['deleteProfile'] as const;\n\nexport const getDeleteProfileMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProfile>>, TError,DeleteProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteProfile>>, TError,DeleteProfileMutationVariables, TContext> => {\n\nconst mutationKey = getDeleteProfileMutationKey();\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 deleteProfile>>, DeleteProfileMutationVariables> = (props) => {\n const {profileId} = props ?? {};\n\n return deleteProfile(profileId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteProfileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProfile>>>\n\n export type DeleteProfileMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type DeleteProfileMutationVariables = {profileId: number}\n\n /**\n * @summary Delete Profile\n */\nexport const useDeleteProfile = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProfile>>, TError,DeleteProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof deleteProfile>>,\n TError,\n DeleteProfileMutationVariables,\n TContext\n > => {\n return useMutation(getDeleteProfileMutationOptions(options), queryClient);\n }\n export const getReadProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * One profile (E22). Returns the resource; the legacy rendered an edit form.\n * @summary Read Profile\n */\nexport const readProfile = async (profileId: number, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\n\n return request<ProfileRead>(getReadProfileUrl(profileId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadProfileQueryKey = (profileId: number,) => {\n return [\n `/me/profiles/${profileId}`\n ] as const;\n }\n\n\nexport const getReadProfileQueryOptions = <TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadProfileQueryKey(profileId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readProfile>>> = ({ signal }) => readProfile(profileId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: profileId !== null && profileId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadProfileQueryResult = NonNullable<Awaited<ReturnType<typeof readProfile>>>\nexport type ReadProfileQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readProfile>>,\n TError,\n Awaited<ReturnType<typeof readProfile>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readProfile>>,\n TError,\n Awaited<ReturnType<typeof readProfile>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Profile\n */\n\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadProfileQueryOptions(profileId,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 getUpdateProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * Partially update a profile (E23).\n *\n * The target comes from the path and the row is re-read from the database\n * before anything is written, so nothing in the body can retarget the write.\n * That is the one habit worth keeping from the legacy handler, which overwrote\n * the identity fields from the trusted record for exactly this reason.\n *\n * ``exclude_unset`` is what makes this a PATCH rather than a PUT wearing the\n * wrong verb: a field the client did not send is untouched, which is not the\n * same as a field it sent as null.\n * @summary Update Profile\n */\nexport const updateProfile = async (profileId: number,\n profileUpdateWrite: ProfileUpdateWrite, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\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<ProfileRead>(getUpdateProfileUrl(profileId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(profileUpdateWrite)\n }\n);}\n\n\n\n\n\nexport const getUpdateProfileMutationKey = () => ['updateProfile'] as const;\n\nexport const getUpdateProfileMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProfile>>, TError,UpdateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof updateProfile>>, TError,UpdateProfileMutationVariables, TContext> => {\n\nconst mutationKey = getUpdateProfileMutationKey();\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 updateProfile>>, UpdateProfileMutationVariables> = (props) => {\n const {profileId,data} = props ?? {};\n\n return updateProfile(profileId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type UpdateProfileMutationResult = NonNullable<Awaited<ReturnType<typeof updateProfile>>>\n export type UpdateProfileMutationBody = BodyType<ProfileUpdateWrite>\n export type UpdateProfileMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type UpdateProfileMutationVariables = {profileId: number;data: BodyType<ProfileUpdateWrite>}\n\n /**\n * @summary Update Profile\n */\nexport const useUpdateProfile = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProfile>>, TError,UpdateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof updateProfile>>,\n TError,\n UpdateProfileMutationVariables,\n TContext\n > => {\n return useMutation(getUpdateProfileMutationOptions(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,2BAA2B;CAKtC,OAAO;AACT;;;;;;;;;AAUA,MAAa,eAAe,OAAQ,YAAsE;CAExG,OAAO,QAAyB,mBAAmB,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,gCAAgC;CACzC,OAAO,CACP,cACA;AACA;AAGJ,MAAa,+BAAuJ,YAC/J;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,wBAAwB;CAIlE,MAAM,WAAoE,EAAE,aAAa,aAAa;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMpI,OAAQ;EAAE;EAAU;EAAS,GAA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GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAA2G,UAAU;EACvH,MAAM,EAAC,WAAU,SAAQ,SAAS,CAAC;EAEnC,OAAQ,cAAc,WAAU,MAAK,cAAc;CACrD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,oBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,gCAAgC,OAAO,GAAG,WAAW;AAC1E"}
|
|
1
|
+
{"version":3,"file":"profiles.js","names":[],"sources":["../../src/react/profiles/profiles.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 ProfileCreateWrite,\n ProfileListRead,\n ProfileRead,\n ProfileUpdateWrite,\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 getListProfilesUrl = () => {\n\n\n\n\n return `/me/profiles`\n}\n\n/**\n * Every profile on this account, the holder included (E20).\n *\n * Unpaginated: the cap is :data:`PROFILE_LIMIT`, so there is no page to turn.\n * One endpoint replaces two legacy routes that rendered the same collection\n * differently — the difference was presentation, which is the client's problem.\n * @summary List Profiles\n */\nexport const listProfiles = async ( options?: Parameters<typeof request>[1]): Promise<ProfileListRead> => {\n\n return request<ProfileListRead>(getListProfilesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListProfilesQueryKey = () => {\n return [\n `/me/profiles`\n ] as const;\n }\n\n\nexport const getListProfilesQueryOptions = <TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListProfilesQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listProfiles>>> = ({ signal }) => listProfiles({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListProfilesQueryResult = NonNullable<Awaited<ReturnType<typeof listProfiles>>>\nexport type ListProfilesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listProfiles>>,\n TError,\n Awaited<ReturnType<typeof listProfiles>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listProfiles>>,\n TError,\n Awaited<ReturnType<typeof listProfiles>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Profiles\n */\n\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListProfilesQueryOptions(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 getCreateProfileUrl = () => {\n\n\n\n\n return `/me/profiles`\n}\n\n/**\n * Add a profile to this account (E21).\n *\n * The new row inherits ``tenant_id`` from the holder rather than accepting one:\n * a profile belongs to the same company as the account it hangs off, and\n * letting that be supplied would be a way into another tenant.\n *\n * A profile has no credential of its own. It has no ``login``, no ``email`` and\n * no password — it is reached by switching within an authenticated session, so\n * there is nothing for it to authenticate *with*.\n * @summary Create Profile\n */\nexport const createProfile = async (profileCreateWrite: ProfileCreateWrite, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\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<ProfileRead>(getCreateProfileUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(profileCreateWrite)\n }\n);}\n\n\n\n\n\nexport const getCreateProfileMutationKey = () => ['createProfile'] as const;\n\nexport const getCreateProfileMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProfile>>, TError,CreateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof createProfile>>, TError,CreateProfileMutationVariables, TContext> => {\n\nconst mutationKey = getCreateProfileMutationKey();\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 createProfile>>, CreateProfileMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return createProfile(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateProfileMutationResult = NonNullable<Awaited<ReturnType<typeof createProfile>>>\n export type CreateProfileMutationBody = BodyType<ProfileCreateWrite>\n export type CreateProfileMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CreateProfileMutationVariables = {data: BodyType<ProfileCreateWrite>}\n\n /**\n * @summary Create Profile\n */\nexport const useCreateProfile = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProfile>>, TError,CreateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof createProfile>>,\n TError,\n CreateProfileMutationVariables,\n TContext\n > => {\n return useMutation(getCreateProfileMutationOptions(options), queryClient);\n }\n export const getDeleteProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * Remove a profile (E24). Idempotent.\n *\n * Deleting a profile that is already gone is ``204``, not ``404``: the caller\n * asked for it to be absent and it is absent. A retried delete after a timeout\n * must not read as a failure.\n *\n * The account holder cannot be deleted this way — that is E17, which anonymises\n * the whole account and is a different decision with different consequences.\n * @summary Delete Profile\n */\nexport const deleteProfile = async (profileId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteProfileUrl(profileId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getDeleteProfileMutationKey = () => ['deleteProfile'] as const;\n\nexport const getDeleteProfileMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProfile>>, TError,DeleteProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteProfile>>, TError,DeleteProfileMutationVariables, TContext> => {\n\nconst mutationKey = getDeleteProfileMutationKey();\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 deleteProfile>>, DeleteProfileMutationVariables> = (props) => {\n const {profileId} = props ?? {};\n\n return deleteProfile(profileId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteProfileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProfile>>>\n\n export type DeleteProfileMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type DeleteProfileMutationVariables = {profileId: number}\n\n /**\n * @summary Delete Profile\n */\nexport const useDeleteProfile = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProfile>>, TError,DeleteProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof deleteProfile>>,\n TError,\n DeleteProfileMutationVariables,\n TContext\n > => {\n return useMutation(getDeleteProfileMutationOptions(options), queryClient);\n }\n export const getReadProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * One profile (E22). Returns the resource; the legacy rendered an edit form.\n * @summary Read Profile\n */\nexport const readProfile = async (profileId: number, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\n\n return request<ProfileRead>(getReadProfileUrl(profileId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadProfileQueryKey = (profileId: number,) => {\n return [\n `/me/profiles/${profileId}`\n ] as const;\n }\n\n\nexport const getReadProfileQueryOptions = <TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadProfileQueryKey(profileId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readProfile>>> = ({ signal }) => readProfile(profileId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: profileId !== null && profileId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadProfileQueryResult = NonNullable<Awaited<ReturnType<typeof readProfile>>>\nexport type ReadProfileQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readProfile>>,\n TError,\n Awaited<ReturnType<typeof readProfile>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readProfile>>,\n TError,\n Awaited<ReturnType<typeof readProfile>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Profile\n */\n\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadProfileQueryOptions(profileId,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 getUpdateProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * Partially update a profile (E23).\n *\n * The target comes from the path and the row is re-read from the database\n * before anything is written, so nothing in the body can retarget the write.\n * That is the one habit worth keeping from the legacy handler, which overwrote\n * the identity fields from the trusted record for exactly this reason.\n *\n * ``exclude_unset`` is what makes this a PATCH rather than a PUT wearing the\n * wrong verb: a field the client did not send is untouched, which is not the\n * same as a field it sent as null.\n * @summary Update Profile\n */\nexport const updateProfile = async (profileId: number,\n profileUpdateWrite: ProfileUpdateWrite, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\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<ProfileRead>(getUpdateProfileUrl(profileId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(profileUpdateWrite)\n }\n);}\n\n\n\n\n\nexport const getUpdateProfileMutationKey = () => ['updateProfile'] as const;\n\nexport const getUpdateProfileMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProfile>>, TError,UpdateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof updateProfile>>, TError,UpdateProfileMutationVariables, TContext> => {\n\nconst mutationKey = getUpdateProfileMutationKey();\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 updateProfile>>, UpdateProfileMutationVariables> = (props) => {\n const {profileId,data} = props ?? {};\n\n return updateProfile(profileId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type UpdateProfileMutationResult = NonNullable<Awaited<ReturnType<typeof updateProfile>>>\n export type UpdateProfileMutationBody = BodyType<ProfileUpdateWrite>\n export type UpdateProfileMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type UpdateProfileMutationVariables = {profileId: number;data: BodyType<ProfileUpdateWrite>}\n\n /**\n * @summary Update Profile\n */\nexport const useUpdateProfile = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProfile>>, TError,UpdateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof updateProfile>>,\n TError,\n UpdateProfileMutationVariables,\n TContext\n > => {\n return useMutation(getUpdateProfileMutationOptions(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,2BAA2B;CAKtC,OAAO;AACT;;;;;;;;;AAUA,MAAa,eAAe,OAAQ,YAAsE;CAExG,OAAO,QAAyB,mBAAmB,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,gCAAgC;CACzC,OAAO,CACP,cACA;AACA;AAGJ,MAAa,+BAAuJ,YAC/J;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,wBAAwB;CAIlE,MAAM,WAAoE,EAAE,aAAa,aAAa;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMpI,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,gBACd,SACC,aACiF;CAElF,MAAM,eAAe,4BAA4B,OAAO;CAExD,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD;AAOA,MAAa,4BAA4B;CAKvC,OAAO;AACT;;;;;;;;;;;;;AAcA,MAAa,gBAAgB,OAAO,oBAAwC,YAAkE;CAE1I,MAAM,cAAc,MAAwF;EAC5G,IAAI,CAAC,GAAG,OAAO,CAAC;EAChB,IAAI,aAAa,SAAS,OAAO,OAAO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
|
|
1
|
+
|
|
2
|
+
import { Cr as HTTPExceptionResponse, J as SearchEverythingParams, gi as CatalogueSearchRead, t as ValidationErrorResponse } from "../chunks/index.js";
|
|
3
|
+
import { a as ErrorType, c as request } from "../chunks/client.js";
|
|
4
|
+
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/search/search.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getSearchEverythingUrl: (params?: SearchEverythingParams) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Search every catalogue the caller can reach.
|
|
10
|
+
*
|
|
11
|
+
* Results are one blended list ordered by relevance, with ``popularity`` as
|
|
12
|
+
* the tie-break. ``sources`` and ``kinds`` carry the same result set counted by
|
|
13
|
+
* family, so a client can render tabs instead of a blend without asking twice.
|
|
14
|
+
*
|
|
15
|
+
* A query shorter than two characters returns an empty page with ``200``.
|
|
16
|
+
* @summary Search Everything
|
|
17
|
+
*/
|
|
18
|
+
export declare const searchEverything: (params?: SearchEverythingParams, options?: Parameters<typeof request>[1]) => Promise<CatalogueSearchRead>;
|
|
19
|
+
export declare const getSearchEverythingQueryKey: (params?: SearchEverythingParams) => readonly ["/search", ...SearchEverythingParams[]];
|
|
20
|
+
export declare const getSearchEverythingQueryOptions: <TData = Awaited<ReturnType<typeof searchEverything>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: SearchEverythingParams, options?: {
|
|
21
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData>>;
|
|
22
|
+
request?: SecondParameter<typeof request>;
|
|
23
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData> & {
|
|
24
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
25
|
+
};
|
|
26
|
+
export type SearchEverythingQueryResult = NonNullable<Awaited<ReturnType<typeof searchEverything>>>;
|
|
27
|
+
export type SearchEverythingQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
28
|
+
export declare function useSearchEverything<TData = Awaited<ReturnType<typeof searchEverything>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: undefined | SearchEverythingParams, options: {
|
|
29
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof searchEverything>>, TError, Awaited<ReturnType<typeof searchEverything>>>, 'initialData'>;
|
|
30
|
+
request?: SecondParameter<typeof request>;
|
|
31
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
32
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
33
|
+
};
|
|
34
|
+
export declare function useSearchEverything<TData = Awaited<ReturnType<typeof searchEverything>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: SearchEverythingParams, options?: {
|
|
35
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof searchEverything>>, TError, Awaited<ReturnType<typeof searchEverything>>>, 'initialData'>;
|
|
36
|
+
request?: SecondParameter<typeof request>;
|
|
37
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
38
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
39
|
+
};
|
|
40
|
+
export declare function useSearchEverything<TData = Awaited<ReturnType<typeof searchEverything>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: SearchEverythingParams, options?: {
|
|
41
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData>>;
|
|
42
|
+
request?: SecondParameter<typeof request>;
|
|
43
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
44
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../chunks/client.js";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/search/search.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
+
* OpenAPI spec version: 0.3.2
|
|
11
|
+
*/
|
|
12
|
+
const withQueryKey = (query, queryKey) => {
|
|
13
|
+
const result = { queryKey };
|
|
14
|
+
for (const key of Object.keys(query)) {
|
|
15
|
+
if (key === "queryKey") continue;
|
|
16
|
+
Object.defineProperty(result, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get: () => query[key]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const getSearchEverythingUrl = (params) => {
|
|
25
|
+
const normalizedParams = new URLSearchParams();
|
|
26
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
27
|
+
if (Array.isArray(value) && ["source", "kind"].includes(key)) {
|
|
28
|
+
value.forEach((v) => {
|
|
29
|
+
normalizedParams.append(key, v === null ? "null" : String(v));
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
34
|
+
});
|
|
35
|
+
const stringifiedParams = normalizedParams.toString();
|
|
36
|
+
return stringifiedParams.length > 0 ? `/search?${stringifiedParams}` : `/search`;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Search every catalogue the caller can reach.
|
|
40
|
+
*
|
|
41
|
+
* Results are one blended list ordered by relevance, with ``popularity`` as
|
|
42
|
+
* the tie-break. ``sources`` and ``kinds`` carry the same result set counted by
|
|
43
|
+
* family, so a client can render tabs instead of a blend without asking twice.
|
|
44
|
+
*
|
|
45
|
+
* A query shorter than two characters returns an empty page with ``200``.
|
|
46
|
+
* @summary Search Everything
|
|
47
|
+
*/
|
|
48
|
+
const searchEverything = async (params, options) => {
|
|
49
|
+
return request(getSearchEverythingUrl(params), {
|
|
50
|
+
...options,
|
|
51
|
+
method: "GET"
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const getSearchEverythingQueryKey = (params) => {
|
|
55
|
+
return [`/search`, ...params ? [params] : []];
|
|
56
|
+
};
|
|
57
|
+
const getSearchEverythingQueryOptions = (params, options) => {
|
|
58
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
59
|
+
const queryKey = queryOptions?.queryKey ?? getSearchEverythingQueryKey(params);
|
|
60
|
+
const queryFn = ({ signal }) => searchEverything(params, {
|
|
61
|
+
signal,
|
|
62
|
+
...requestOptions
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
queryKey,
|
|
66
|
+
queryFn,
|
|
67
|
+
...queryOptions
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* @summary Search Everything
|
|
72
|
+
*/
|
|
73
|
+
function useSearchEverything(params, options, queryClient) {
|
|
74
|
+
const queryOptions = getSearchEverythingQueryOptions(params, options);
|
|
75
|
+
const query = useQuery(queryOptions, queryClient);
|
|
76
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { getSearchEverythingQueryKey, getSearchEverythingQueryOptions, getSearchEverythingUrl, searchEverything, useSearchEverything };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","names":[],"sources":["../../src/react/search/search.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 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 CatalogueSearchRead,\n HTTPExceptionResponse,\n SearchEverythingParams,\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 getSearchEverythingUrl = (params?: SearchEverythingParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n const explodeParameters = [\"source\",\"kind\"];\n\n if (Array.isArray(value) && explodeParameters.includes(key)) {\n value.forEach((v) => {\n normalizedParams.append(key, v === null ? 'null' : String(v));\n });\n return;\n }\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 ? `/search?${stringifiedParams}` : `/search`\n}\n\n/**\n * Search every catalogue the caller can reach.\n *\n * Results are one blended list ordered by relevance, with ``popularity`` as\n * the tie-break. ``sources`` and ``kinds`` carry the same result set counted by\n * family, so a client can render tabs instead of a blend without asking twice.\n *\n * A query shorter than two characters returns an empty page with ``200``.\n * @summary Search Everything\n */\nexport const searchEverything = async (params?: SearchEverythingParams, options?: Parameters<typeof request>[1]): Promise<CatalogueSearchRead> => {\n\n return request<CatalogueSearchRead>(getSearchEverythingUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getSearchEverythingQueryKey = (params?: SearchEverythingParams,) => {\n return [\n `/search`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getSearchEverythingQueryOptions = <TData = Awaited<ReturnType<typeof searchEverything>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: SearchEverythingParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getSearchEverythingQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof searchEverything>>> = ({ signal }) => searchEverything(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type SearchEverythingQueryResult = NonNullable<Awaited<ReturnType<typeof searchEverything>>>\nexport type SearchEverythingQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useSearchEverything<TData = Awaited<ReturnType<typeof searchEverything>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | SearchEverythingParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof searchEverything>>,\n TError,\n Awaited<ReturnType<typeof searchEverything>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useSearchEverything<TData = Awaited<ReturnType<typeof searchEverything>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: SearchEverythingParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof searchEverything>>,\n TError,\n Awaited<ReturnType<typeof searchEverything>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useSearchEverything<TData = Awaited<ReturnType<typeof searchEverything>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: SearchEverythingParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Search Everything\n */\n\nexport function useSearchEverything<TData = Awaited<ReturnType<typeof searchEverything>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: SearchEverythingParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof searchEverything>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getSearchEverythingQueryOptions(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;CACx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C;;;;AAkCA,SAAgB,oBACf,QAAiC,SAC/B,aACiF;CAElF,MAAM,eAAe,gCAAgC,QAAO,OAAO;CAEnE,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { r as MozaikAuth, t as AuthSnapshot } from "../chunks/client2.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
//#region src/auth/react.d.ts
|
|
5
|
+
export type MozaikAuthContext = AuthSnapshot & Pick<MozaikAuth, 'prepareInternalSso' | 'prepareProviderSso' | 'prepareSso' | 'completeSso' | 'refresh' | 'logout'>;
|
|
6
|
+
export interface MozaikAuthProviderProps {
|
|
7
|
+
/** Create once per application (or per SSR request), outside component renders. */
|
|
8
|
+
auth: MozaikAuth;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/** Provides auth and a TanStack Query cache isolated to the current session. */
|
|
12
|
+
export declare function MozaikAuthProvider({ auth, children }: MozaikAuthProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<MozaikAuthContext | null>>;
|
|
13
|
+
export declare function useMozaikAuth(): MozaikAuthContext;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=sso.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, createElement, useContext, useEffect, useMemo, useSyncExternalStore } from "react";
|
|
3
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
4
|
+
//#region src/auth/react.ts
|
|
5
|
+
const Context = createContext(null);
|
|
6
|
+
let cacheSequence = 0;
|
|
7
|
+
/** Provides auth and a TanStack Query cache isolated to the current session. */
|
|
8
|
+
function MozaikAuthProvider({ auth, children }) {
|
|
9
|
+
const snapshot = useSyncExternalStore(auth.subscribe, auth.getSnapshot, auth.getSnapshot);
|
|
10
|
+
const cache = useMemo(() => ({
|
|
11
|
+
queryClient: new QueryClient(),
|
|
12
|
+
key: ++cacheSequence,
|
|
13
|
+
lifetime: 0
|
|
14
|
+
}), [auth, snapshot.client]);
|
|
15
|
+
const { queryClient, key } = cache;
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const lifetime = ++cache.lifetime;
|
|
18
|
+
return () => {
|
|
19
|
+
queueMicrotask(() => {
|
|
20
|
+
if (cache.lifetime !== lifetime) return;
|
|
21
|
+
queryClient.cancelQueries();
|
|
22
|
+
queryClient.clear();
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
}, [cache, queryClient]);
|
|
26
|
+
const value = useMemo(() => ({
|
|
27
|
+
...snapshot,
|
|
28
|
+
prepareInternalSso: auth.prepareInternalSso,
|
|
29
|
+
prepareProviderSso: auth.prepareProviderSso,
|
|
30
|
+
prepareSso: auth.prepareSso,
|
|
31
|
+
completeSso: auth.completeSso,
|
|
32
|
+
refresh: auth.refresh,
|
|
33
|
+
logout: auth.logout
|
|
34
|
+
}), [auth, snapshot]);
|
|
35
|
+
return createElement(Context.Provider, { value }, createElement(QueryClientProvider, {
|
|
36
|
+
client: queryClient,
|
|
37
|
+
key
|
|
38
|
+
}, children));
|
|
39
|
+
}
|
|
40
|
+
function useMozaikAuth() {
|
|
41
|
+
const value = useContext(Context);
|
|
42
|
+
if (!value) throw new Error("useMozaikAuth must be used inside MozaikAuthProvider");
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { MozaikAuthProvider, useMozaikAuth };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=sso.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sso.js","names":[],"sources":["../../src/auth/react.ts"],"sourcesContent":["import { createContext, createElement, useContext, useEffect, useMemo, useSyncExternalStore, type ReactNode } from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { AuthSnapshot, MozaikAuth } from './client';\n\nexport type MozaikAuthContext = AuthSnapshot & Pick<MozaikAuth,\n 'prepareInternalSso' | 'prepareProviderSso' | 'prepareSso' | 'completeSso' | 'refresh' | 'logout'>;\nconst Context = createContext<MozaikAuthContext | null>(null);\nlet cacheSequence = 0;\n\nexport interface MozaikAuthProviderProps {\n /** Create once per application (or per SSR request), outside component renders. */\n auth: MozaikAuth;\n children?: ReactNode;\n}\n\n/** Provides auth and a TanStack Query cache isolated to the current session. */\nexport function MozaikAuthProvider({ auth, children }: MozaikAuthProviderProps) {\n const snapshot = useSyncExternalStore(auth.subscribe, auth.getSnapshot, auth.getSnapshot);\n // New account/anonymous state gets a new cache before children render. An\n // effect clearing a shared cache would permit one render of the old account.\n const cache = useMemo(() => ({ queryClient: new QueryClient(), key: ++cacheSequence, lifetime: 0 }), [auth, snapshot.client]);\n const { queryClient, key } = cache;\n useEffect(() => {\n const lifetime = ++cache.lifetime;\n return () => {\n // Child observers unsubscribe during cleanup and may schedule GC timers.\n // Clear afterwards; Strict Mode's immediate re-setup keeps its cache.\n queueMicrotask(() => {\n if (cache.lifetime !== lifetime) return;\n void queryClient.cancelQueries(); queryClient.clear();\n });\n };\n }, [cache, queryClient]);\n const value = useMemo<MozaikAuthContext>(() => ({\n ...snapshot,\n prepareInternalSso: auth.prepareInternalSso, prepareProviderSso: auth.prepareProviderSso,\n prepareSso: auth.prepareSso, completeSso: auth.completeSso, refresh: auth.refresh, logout: auth.logout,\n }), [auth, snapshot]);\n // Query observers bind to their initial QueryClient. Remount the session\n // subtree too, so an existing observer cannot retain the previous cache.\n return createElement(Context.Provider, { value }, createElement(QueryClientProvider, { client: queryClient, key }, children));\n}\n\nexport function useMozaikAuth(): MozaikAuthContext {\n const value = useContext(Context);\n if (!value) throw new Error('useMozaikAuth must be used inside MozaikAuthProvider');\n return value;\n}\n"],"mappings":";;;;AAMA,MAAM,UAAU,cAAwC,IAAI;AAC5D,IAAI,gBAAgB;;AASpB,SAAgB,mBAAmB,EAAE,MAAM,YAAqC;CAC9E,MAAM,WAAW,qBAAqB,KAAK,WAAW,KAAK,aAAa,KAAK,WAAW;CAGxF,MAAM,QAAQ,eAAe;EAAE,aAAa,IAAI,YAAY;EAAG,KAAK,EAAE;EAAe,UAAU;CAAE,IAAI,CAAC,MAAM,SAAS,MAAM,CAAC;CAC5H,MAAM,EAAE,aAAa,QAAQ;CAC7B,gBAAgB;EACd,MAAM,WAAW,EAAE,MAAM;EACzB,aAAa;GAGX,qBAAqB;IACnB,IAAI,MAAM,aAAa,UAAU;IACjC,YAAiB,cAAc;IAAG,YAAY,MAAM;GACtD,CAAC;EACH;CACF,GAAG,CAAC,OAAO,WAAW,CAAC;CACvB,MAAM,QAAQ,eAAkC;EAC9C,GAAG;EACH,oBAAoB,KAAK;EAAoB,oBAAoB,KAAK;EACtE,YAAY,KAAK;EAAY,aAAa,KAAK;EAAa,SAAS,KAAK;EAAS,QAAQ,KAAK;CAClG,IAAI,CAAC,MAAM,QAAQ,CAAC;CAGpB,OAAO,cAAc,QAAQ,UAAU,EAAE,MAAM,GAAG,cAAc,qBAAqB;EAAE,QAAQ;EAAa;CAAI,GAAG,QAAQ,CAAC;AAC9H;AAEA,SAAgB,gBAAmC;CACjD,MAAM,QAAQ,WAAW,OAAO;CAChC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,sDAAsD;CAClF,OAAO;AACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { a as ErrorType, c as request } from "../client
|
|
2
|
+
import { Br as EducationalGoalListRead, Cr as HTTPExceptionResponse, Fn as ListGoalsParams, I as SubjectListRead, Yn as LevelListRead, t as ValidationErrorResponse } from "../chunks/index.js";
|
|
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/tutoring-catalogue/tutoring-catalogue.d.ts
|
|
6
6
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { r as request } from "../client
|
|
2
|
+
import { r as request } from "../chunks/client.js";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
//#region src/react/tutoring-catalogue/tutoring-catalogue.ts
|
|
5
5
|
/**
|
|
@@ -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.3.2
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tutoring-catalogue.js","names":[],"sources":["../../src/react/tutoring-catalogue/tutoring-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.1.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 EducationalGoalListRead,\n HTTPExceptionResponse,\n LevelListRead,\n ListGoalsParams,\n SubjectListRead,\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 getListGoalsUrl = (params?: ListGoalsParams,) => {\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 ? `/tutoring/goals?${stringifiedParams}` : `/tutoring/goals`\n}\n\n/**\n * Goals on offer, optionally narrowed to one request kind.\n *\n * The filter is a containment test against ``applies_to``, which is what the\n * GIN index on that column is for. The legacy asks the same question with four\n * boolean columns and a different ``WHERE`` per surface.\n * @summary List Goals\n */\nexport const listGoals = async (params?: ListGoalsParams, options?: Parameters<typeof request>[1]): Promise<EducationalGoalListRead> => {\n\n return request<EducationalGoalListRead>(getListGoalsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListGoalsQueryKey = (params?: ListGoalsParams,) => {\n return [\n `/tutoring/goals`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListGoalsQueryOptions = <TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListGoalsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listGoals>>> = ({ signal }) => listGoals(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListGoalsQueryResult = NonNullable<Awaited<ReturnType<typeof listGoals>>>\nexport type ListGoalsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListGoalsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Goals\n */\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListGoalsQueryOptions(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 getListLevelsUrl = () => {\n\n\n\n\n return `/tutoring/levels`\n}\n\n/**\n * Every school level, in teaching order rather than alphabetical.\n * @summary List Levels\n */\nexport const listLevels = async ( options?: Parameters<typeof request>[1]): Promise<LevelListRead> => {\n\n return request<LevelListRead>(getListLevelsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLevelsQueryKey = () => {\n return [\n `/tutoring/levels`\n ] as const;\n }\n\n\nexport const getListLevelsQueryOptions = <TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLevelsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLevels>>> = ({ signal }) => listLevels({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLevelsQueryResult = NonNullable<Awaited<ReturnType<typeof listLevels>>>\nexport type ListLevelsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Levels\n */\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLevelsQueryOptions(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 getListSubjectsUrl = () => {\n\n\n\n\n return `/tutoring/subjects`\n}\n\n/**\n * Every subject a pupil may ask about, in display order.\n *\n * Authenticated, though the data is not secret: the list differs by nothing\n * today, and leaving it open would make it the one tutoring endpoint that does\n * not establish a tenant. Cheap to relax later, expensive to tighten.\n * @summary List Subjects\n */\nexport const listSubjects = async ( options?: Parameters<typeof request>[1]): Promise<SubjectListRead> => {\n\n return request<SubjectListRead>(getListSubjectsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListSubjectsQueryKey = () => {\n return [\n `/tutoring/subjects`\n ] as const;\n }\n\n\nexport const getListSubjectsQueryOptions = <TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListSubjectsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listSubjects>>> = ({ signal }) => listSubjects({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListSubjectsQueryResult = NonNullable<Awaited<ReturnType<typeof listSubjects>>>\nexport type ListSubjectsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Subjects\n */\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListSubjectsQueryOptions(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\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ClD"}
|
|
1
|
+
{"version":3,"file":"tutoring-catalogue.js","names":[],"sources":["../../src/react/tutoring-catalogue/tutoring-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.3.2\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 EducationalGoalListRead,\n HTTPExceptionResponse,\n LevelListRead,\n ListGoalsParams,\n SubjectListRead,\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 getListGoalsUrl = (params?: ListGoalsParams,) => {\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 ? `/tutoring/goals?${stringifiedParams}` : `/tutoring/goals`\n}\n\n/**\n * Goals on offer, optionally narrowed to one request kind.\n *\n * The filter is a containment test against ``applies_to``, which is what the\n * GIN index on that column is for. The legacy asks the same question with four\n * boolean columns and a different ``WHERE`` per surface.\n * @summary List Goals\n */\nexport const listGoals = async (params?: ListGoalsParams, options?: Parameters<typeof request>[1]): Promise<EducationalGoalListRead> => {\n\n return request<EducationalGoalListRead>(getListGoalsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListGoalsQueryKey = (params?: ListGoalsParams,) => {\n return [\n `/tutoring/goals`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListGoalsQueryOptions = <TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListGoalsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listGoals>>> = ({ signal }) => listGoals(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListGoalsQueryResult = NonNullable<Awaited<ReturnType<typeof listGoals>>>\nexport type ListGoalsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListGoalsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Goals\n */\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListGoalsQueryOptions(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 getListLevelsUrl = () => {\n\n\n\n\n return `/tutoring/levels`\n}\n\n/**\n * Every school level, in teaching order rather than alphabetical.\n * @summary List Levels\n */\nexport const listLevels = async ( options?: Parameters<typeof request>[1]): Promise<LevelListRead> => {\n\n return request<LevelListRead>(getListLevelsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLevelsQueryKey = () => {\n return [\n `/tutoring/levels`\n ] as const;\n }\n\n\nexport const getListLevelsQueryOptions = <TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLevelsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLevels>>> = ({ signal }) => listLevels({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLevelsQueryResult = NonNullable<Awaited<ReturnType<typeof listLevels>>>\nexport type ListLevelsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Levels\n */\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLevelsQueryOptions(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 getListSubjectsUrl = () => {\n\n\n\n\n return `/tutoring/subjects`\n}\n\n/**\n * Every subject a pupil may ask about, in display order.\n *\n * Authenticated, though the data is not secret: the list differs by nothing\n * today, and leaving it open would make it the one tutoring endpoint that does\n * not establish a tenant. Cheap to relax later, expensive to tighten.\n * @summary List Subjects\n */\nexport const listSubjects = async ( options?: Parameters<typeof request>[1]): Promise<SubjectListRead> => {\n\n return request<SubjectListRead>(getListSubjectsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListSubjectsQueryKey = () => {\n return [\n `/tutoring/subjects`\n ] as const;\n }\n\n\nexport const getListSubjectsQueryOptions = <TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListSubjectsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listSubjects>>> = ({ signal }) => listSubjects({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListSubjectsQueryResult = NonNullable<Awaited<ReturnType<typeof listSubjects>>>\nexport type ListSubjectsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Subjects\n */\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListSubjectsQueryOptions(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":";;;;;;;;;;;AAuCA,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,mBAAmB,WAA8B;CAC5D,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,mBAAmB,sBAAsB;AACjF;;;;;;;;;AAUA,MAAa,YAAY,OAAO,QAA0B,Y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AA2B;CAKtC,OAAO;AACT;;;;;;;;;AAUA,MAAa,eAAe,OAAQ,YAAsE;CAExG,OAAO,QAAyB,mBAAmB,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,gCAAgC;CACzC,OAAO,CACP,oBACA;AACA;AAGJ,MAAa,+BAAuJ,YAC/J;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,wBAAwB;CAIlE,MAAM,WAAoE,EAAE,aAAa,aAAa;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMpI,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,gBACd,SACC,aACiF;CAElF,MAAM,eAAe,4BAA4B,OAAO;CAExD,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { a as ErrorType, c as request, n as BodyType } from "../client
|
|
2
|
+
import { Cr as HTTPExceptionResponse, cn as MessageWrite, fi as ChatTicketRead, kn as ListMessagesParams, ln as MessagePage, t as ValidationErrorResponse, un as MessageRead } from "../chunks/index.js";
|
|
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/tutoring-chat/tutoring-chat.d.ts
|
|
6
6
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { r as request } from "../client
|
|
2
|
+
import { r as request } from "../chunks/client.js";
|
|
3
3
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
4
|
//#region src/react/tutoring-chat/tutoring-chat.ts
|
|
5
5
|
/**
|
|
@@ -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.3.2
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tutoring-chat.js","names":[],"sources":["../../src/react/tutoring-chat/tutoring-chat.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n ChatTicketRead,\n HTTPExceptionResponse,\n ListMessagesParams,\n MessagePage,\n MessageRead,\n MessageWrite,\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 getMintChatTicketUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/chat/ticket`\n}\n\n/**\n * A single-use credential for opening the socket from a browser.\n *\n * Authenticated the ordinary way, with the ordinary bearer token, because this\n * is an ordinary HTTP request. What it returns is what goes in the socket URL.\n * @summary Mint Chat Ticket\n */\nexport const mintChatTicket = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<ChatTicketRead> => {\n\n return request<ChatTicketRead>(getMintChatTicketUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getMintChatTicketMutationKey = () => ['mintChatTicket'] as const;\n\nexport const getMintChatTicketMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext> => {\n\nconst mutationKey = getMintChatTicketMutationKey();\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 mintChatTicket>>, MintChatTicketMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return mintChatTicket(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type MintChatTicketMutationResult = NonNullable<Awaited<ReturnType<typeof mintChatTicket>>>\n\n export type MintChatTicketMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type MintChatTicketMutationVariables = {requestId: number}\n\n /**\n * @summary Mint Chat Ticket\n */\nexport const useMintChatTicket = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof mintChatTicket>>,\n TError,\n MintChatTicketMutationVariables,\n TContext\n > => {\n return useMutation(getMintChatTicketMutationOptions(options), queryClient);\n }\n export const getListMessagesUrl = (requestId: number,\n params?: ListMessagesParams,) => {\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 ? `/tutoring/requests/${requestId}/messages?${stringifiedParams}` : `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * The conversation so far, newest first.\n *\n * One extra row is fetched to answer ``hasMore`` without a second count. A\n * ``COUNT(*)`` over a thread on every scroll is a table scan for a number no\n * interface displays.\n * @summary List Messages\n */\nexport const listMessages = async (requestId: number,\n params?: ListMessagesParams, options?: Parameters<typeof request>[1]): Promise<MessagePage> => {\n\n return request<MessagePage>(getListMessagesUrl(requestId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListMessagesQueryKey = (requestId: number,\n params?: ListMessagesParams,) => {\n return [\n `/tutoring/requests/${requestId}/messages`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListMessagesQueryOptions = <TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListMessagesQueryKey(requestId,params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listMessages>>> = ({ signal }) => listMessages(requestId,params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: requestId !== null && requestId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListMessagesQueryResult = NonNullable<Awaited<ReturnType<typeof listMessages>>>\nexport type ListMessagesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params: undefined | ListMessagesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMessages>>,\n TError,\n Awaited<ReturnType<typeof listMessages>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMessages>>,\n TError,\n Awaited<ReturnType<typeof listMessages>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Messages\n */\n\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListMessagesQueryOptions(requestId,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 getSendMessageUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * Say something, without holding a socket open.\n * @summary Send Message\n */\nexport const sendMessage = async (requestId: number,\n messageWrite: MessageWrite, options?: Parameters<typeof request>[1]): Promise<MessageRead> => {\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<MessageRead>(getSendMessageUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(messageWrite)\n }\n);}\n\n\n\n\n\nexport const getSendMessageMutationKey = () => ['sendMessage'] as const;\n\nexport const getSendMessageMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext> => {\n\nconst mutationKey = getSendMessageMutationKey();\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 sendMessage>>, SendMessageMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return sendMessage(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type SendMessageMutationResult = NonNullable<Awaited<ReturnType<typeof sendMessage>>>\n export type SendMessageMutationBody = BodyType<MessageWrite>\n export type SendMessageMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type SendMessageMutationVariables = {requestId: number;data: BodyType<MessageWrite>}\n\n /**\n * @summary Send Message\n */\nexport const useSendMessage = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof sendMessage>>,\n TError,\n SendMessageMutationVariables,\n TContext\n > => {\n return useMutation(getSendMessageMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA4CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MA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M,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAqB,kBAAkB,SAAS,GACrD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,YAAY;CACnC,CACF;AAAE;AAMF,MAAa,kCAAkC,CAAC,aAAa;AAE7D,MAAa,iCACW,YACyF;CAEjH,MAAM,cAAc,0BAA0B;CAC9C,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,cAAuG,UAAU;EACnH,MAAM,EAAC,WAAU,SAAQ,SAAS,CAAC;EAEnC,OAAQ,YAAY,WAAU,MAAK,cAAc;CACnD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,kBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,8BAA8B,OAAO,GAAG,WAAW;AACxE"}
|
|
1
|
+
{"version":3,"file":"tutoring-chat.js","names":[],"sources":["../../src/react/tutoring-chat/tutoring-chat.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 ChatTicketRead,\n HTTPExceptionResponse,\n ListMessagesParams,\n MessagePage,\n MessageRead,\n MessageWrite,\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 getMintChatTicketUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/chat/ticket`\n}\n\n/**\n * A single-use credential for opening the socket from a browser.\n *\n * Authenticated the ordinary way, with the ordinary bearer token, because this\n * is an ordinary HTTP request. What it returns is what goes in the socket URL.\n * @summary Mint Chat Ticket\n */\nexport const mintChatTicket = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<ChatTicketRead> => {\n\n return request<ChatTicketRead>(getMintChatTicketUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getMintChatTicketMutationKey = () => ['mintChatTicket'] as const;\n\nexport const getMintChatTicketMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext> => {\n\nconst mutationKey = getMintChatTicketMutationKey();\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 mintChatTicket>>, MintChatTicketMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return mintChatTicket(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type MintChatTicketMutationResult = NonNullable<Awaited<ReturnType<typeof mintChatTicket>>>\n\n export type MintChatTicketMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type MintChatTicketMutationVariables = {requestId: number}\n\n /**\n * @summary Mint Chat Ticket\n */\nexport const useMintChatTicket = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof mintChatTicket>>,\n TError,\n MintChatTicketMutationVariables,\n TContext\n > => {\n return useMutation(getMintChatTicketMutationOptions(options), queryClient);\n }\n export const getListMessagesUrl = (requestId: number,\n params?: ListMessagesParams,) => {\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 ? `/tutoring/requests/${requestId}/messages?${stringifiedParams}` : `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * The conversation so far, newest first.\n *\n * One extra row is fetched to answer ``hasMore`` without a second count. A\n * ``COUNT(*)`` over a thread on every scroll is a table scan for a number no\n * interface displays.\n * @summary List Messages\n */\nexport const listMessages = async (requestId: number,\n params?: ListMessagesParams, options?: Parameters<typeof request>[1]): Promise<MessagePage> => {\n\n return request<MessagePage>(getListMessagesUrl(requestId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListMessagesQueryKey = (requestId: number,\n params?: ListMessagesParams,) => {\n return [\n `/tutoring/requests/${requestId}/messages`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListMessagesQueryOptions = <TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListMessagesQueryKey(requestId,params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listMessages>>> = ({ signal }) => listMessages(requestId,params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: requestId !== null && requestId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListMessagesQueryResult = NonNullable<Awaited<ReturnType<typeof listMessages>>>\nexport type ListMessagesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params: undefined | ListMessagesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMessages>>,\n TError,\n Awaited<ReturnType<typeof listMessages>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMessages>>,\n TError,\n Awaited<ReturnType<typeof listMessages>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Messages\n */\n\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListMessagesQueryOptions(requestId,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 getSendMessageUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * Say something, without holding a socket open.\n * @summary Send Message\n */\nexport const sendMessage = async (requestId: number,\n messageWrite: MessageWrite, options?: Parameters<typeof request>[1]): Promise<MessageRead> => {\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<MessageRead>(getSendMessageUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(messageWrite)\n }\n);}\n\n\n\n\n\nexport const getSendMessageMutationKey = () => ['sendMessage'] as const;\n\nexport const getSendMessageMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext> => {\n\nconst mutationKey = getSendMessageMutationKey();\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 sendMessage>>, SendMessageMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return sendMessage(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type SendMessageMutationResult = NonNullable<Awaited<ReturnType<typeof sendMessage>>>\n export type SendMessageMutationBody = BodyType<MessageWrite>\n export type SendMessageMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type SendMessageMutationVariables = {requestId: number;data: BodyType<MessageWrite>}\n\n /**\n * @summary Send Message\n */\nexport const useSendMessage = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof sendMessage>>,\n TError,\n SendMessageMutationVariables,\n TContext\n > => {\n return useMutation(getSendMessageMutationOptions(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,wBAAwB,cAAuB;CAK1D,OAAO,sBAAsB,UAAU;AACzC;;;;;;;;AASA,MAAa,iBAAiB,OAAO,WAAmB,YAAqE;CAE3H,OAAO,QAAwB,qBAAqB,SAAS,GAC7D;EACE,GAAG;EACH,QAAQ;CAGV,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,cAAa,SAAS,CAAC;EAE9B,OAAQ,eAAe,WAAU,cAAc;CACjD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5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|
2
|
-
import {
|
|
3
|
-
import { a as ErrorType, c as request, n as BodyType } from "../client
|
|
2
|
+
import { Cn as ListQueueParams, Cr as HTTPExceptionResponse, _ as TutoringDispatchWrite, d as TutoringQueuePage, t as ValidationErrorResponse } from "../chunks/index.js";
|
|
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/tutoring-dispatch/tutoring-dispatch.d.ts
|
|
6
6
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { r as request } from "../client
|
|
2
|
+
import { r as request } from "../chunks/client.js";
|
|
3
3
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
4
|
//#region src/react/tutoring-dispatch/tutoring-dispatch.ts
|
|
5
5
|
/**
|
|
@@ -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.3.2
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|