@learnorama/mozaik-sdk 0.1.0 → 0.5.0-staging.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +14 -2
- package/dist/api/admin-tenants.js +38 -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} +922 -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 +68 -2
- package/dist/react/admin-tenants.js +87 -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":"tutoring-dispatch.js","names":[],"sources":["../../src/react/tutoring-dispatch/tutoring-dispatch.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 ListQueueParams,\n TutoringDispatchWrite,\n TutoringQueuePage,\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 getListQueueUrl = (params?: ListQueueParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n const explodeParameters = [\"status\"];\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 ? `/tutoring/queue?${stringifiedParams}` : `/tutoring/queue`\n}\n\n/**\n * What is waiting, oldest first.\n *\n * Scoped to the dispatcher's tenant. Defaults to the four open statuses, which\n * is what the partial index on the table is built for — pass ``?status=`` to\n * look at something else and the query stops using it, which is the honest\n * trade rather than a hidden one.\n * @summary List Queue\n */\nexport const listQueue = async (params?: ListQueueParams, options?: Parameters<typeof request>[1]): Promise<TutoringQueuePage> => {\n\n return request<TutoringQueuePage>(getListQueueUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListQueueQueryKey = (params?: ListQueueParams,) => {\n return [\n `/tutoring/queue`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListQueueQueryOptions = <TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListQueueParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListQueueQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listQueue>>> = ({ signal }) => listQueue(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListQueueQueryResult = NonNullable<Awaited<ReturnType<typeof listQueue>>>\nexport type ListQueueQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListQueue<TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListQueueParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listQueue>>,\n TError,\n Awaited<ReturnType<typeof listQueue>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListQueue<TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListQueueParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listQueue>>,\n TError,\n Awaited<ReturnType<typeof listQueue>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListQueue<TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListQueueParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Queue\n */\n\nexport function useListQueue<TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListQueueParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListQueueQueryOptions(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 getDispatchRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/dispatch`\n}\n\n/**\n * Route it — to somebody named, or to the open pool.\n *\n * Changing the channel here is deliberate and common: pupils pick a classroom\n * and turn out to have no microphone, and the dispatcher is the person who\n * finds that out.\n * @summary Dispatch Request\n */\nexport const dispatchRequest = async (requestId: number,\n tutoringDispatchWrite: TutoringDispatchWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getDispatchRequestUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringDispatchWrite)\n }\n);}\n\n\n\n\n\nexport const getDispatchRequestMutationKey = () => ['dispatchRequest'] as const;\n\nexport const getDispatchRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof dispatchRequest>>, TError,DispatchRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof dispatchRequest>>, TError,DispatchRequestMutationVariables, TContext> => {\n\nconst mutationKey = getDispatchRequestMutationKey();\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 dispatchRequest>>, DispatchRequestMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return dispatchRequest(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DispatchRequestMutationResult = NonNullable<Awaited<ReturnType<typeof dispatchRequest>>>\n export type DispatchRequestMutationBody = BodyType<TutoringDispatchWrite>\n export type DispatchRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type DispatchRequestMutationVariables = {requestId: number;data: BodyType<TutoringDispatchWrite>}\n\n /**\n * @summary Dispatch Request\n */\nexport const useDispatchRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof dispatchRequest>>, TError,DispatchRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof dispatchRequest>>,\n TError,\n DispatchRequestMutationVariables,\n TContext\n > => {\n return useMutation(getDispatchRequestMutationOptions(options), queryClient);\n }\n export const getTriageRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/triage`\n}\n\n/**\n * Take a request off the queue to look at it.\n *\n * Separate from dispatching because the legacy's own timestamps separate them —\n * ``picked_by_switchman_at`` then ``validated_at`` — and the gap between the\n * two is the figure that tells you whether the queue is staffed.\n * @summary Triage Request\n */\nexport const triageRequest = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getTriageRequestUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getTriageRequestMutationKey = () => ['triageRequest'] as const;\n\nexport const getTriageRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof triageRequest>>, TError,TriageRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof triageRequest>>, TError,TriageRequestMutationVariables, TContext> => {\n\nconst mutationKey = getTriageRequestMutationKey();\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 triageRequest>>, TriageRequestMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return triageRequest(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type TriageRequestMutationResult = NonNullable<Awaited<ReturnType<typeof triageRequest>>>\n\n export type TriageRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type TriageRequestMutationVariables = {requestId: number}\n\n /**\n * @summary Triage Request\n */\nexport const useTriageRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof triageRequest>>, TError,TriageRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof triageRequest>>,\n TError,\n TriageRequestMutationVariables,\n TContext\n > => {\n return useMutation(getTriageRequestMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA0CA,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;EAGrD,IAAI,MAAM,QAAQ,KAAK,KAAK,CAFD,QAEiB,CAAC,CAAC,SAAS,GAAG,GAAG;GAC3D,MAAM,SAAS,MAAM;IACnB,iBAAiB,OAAO,KAAK,MAAM,OAAO,SAAS,OAAO,CAAC,CAAC;GAC9D,CAAC;GACD;EACF;EAEA,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;;;;;;;;;;AAWA,MAAa,YAAY,OAAO,QAA0B,YAAwE;CAEhI,OAAO,QAA2B,gBAAgB,MAAM,GACxD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,wBAAwB,WAA8B;CAC/D,OAAO,CACP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|
1
|
+
{"version":3,"file":"tutoring-dispatch.js","names":[],"sources":["../../src/react/tutoring-dispatch/tutoring-dispatch.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.5.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ListQueueParams,\n TutoringDispatchWrite,\n TutoringQueuePage,\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 getListQueueUrl = (params?: ListQueueParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n const explodeParameters = [\"status\"];\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 ? `/tutoring/queue?${stringifiedParams}` : `/tutoring/queue`\n}\n\n/**\n * What is waiting, oldest first.\n *\n * Scoped to the dispatcher's tenant. Defaults to the four open statuses, which\n * is what the partial index on the table is built for — pass ``?status=`` to\n * look at something else and the query stops using it, which is the honest\n * trade rather than a hidden one.\n * @summary List Queue\n */\nexport const listQueue = async (params?: ListQueueParams, options?: Parameters<typeof request>[1]): Promise<TutoringQueuePage> => {\n\n return request<TutoringQueuePage>(getListQueueUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListQueueQueryKey = (params?: ListQueueParams,) => {\n return [\n `/tutoring/queue`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListQueueQueryOptions = <TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListQueueParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListQueueQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listQueue>>> = ({ signal }) => listQueue(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListQueueQueryResult = NonNullable<Awaited<ReturnType<typeof listQueue>>>\nexport type ListQueueQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListQueue<TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListQueueParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listQueue>>,\n TError,\n Awaited<ReturnType<typeof listQueue>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListQueue<TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListQueueParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listQueue>>,\n TError,\n Awaited<ReturnType<typeof listQueue>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListQueue<TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListQueueParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Queue\n */\n\nexport function useListQueue<TData = Awaited<ReturnType<typeof listQueue>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListQueueParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listQueue>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListQueueQueryOptions(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 getDispatchRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/dispatch`\n}\n\n/**\n * Route it — to somebody named, or to the open pool.\n *\n * Changing the channel here is deliberate and common: pupils pick a classroom\n * and turn out to have no microphone, and the dispatcher is the person who\n * finds that out.\n * @summary Dispatch Request\n */\nexport const dispatchRequest = async (requestId: number,\n tutoringDispatchWrite: TutoringDispatchWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getDispatchRequestUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringDispatchWrite)\n }\n);}\n\n\n\n\n\nexport const getDispatchRequestMutationKey = () => ['dispatchRequest'] as const;\n\nexport const getDispatchRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof dispatchRequest>>, TError,DispatchRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof dispatchRequest>>, TError,DispatchRequestMutationVariables, TContext> => {\n\nconst mutationKey = getDispatchRequestMutationKey();\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 dispatchRequest>>, DispatchRequestMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return dispatchRequest(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DispatchRequestMutationResult = NonNullable<Awaited<ReturnType<typeof dispatchRequest>>>\n export type DispatchRequestMutationBody = BodyType<TutoringDispatchWrite>\n export type DispatchRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type DispatchRequestMutationVariables = {requestId: number;data: BodyType<TutoringDispatchWrite>}\n\n /**\n * @summary Dispatch Request\n */\nexport const useDispatchRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof dispatchRequest>>, TError,DispatchRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof dispatchRequest>>,\n TError,\n DispatchRequestMutationVariables,\n TContext\n > => {\n return useMutation(getDispatchRequestMutationOptions(options), queryClient);\n }\n export const getTriageRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/triage`\n}\n\n/**\n * Take a request off the queue to look at it.\n *\n * Separate from dispatching because the legacy's own timestamps separate them —\n * ``picked_by_switchman_at`` then ``validated_at`` — and the gap between the\n * two is the figure that tells you whether the queue is staffed.\n * @summary Triage Request\n */\nexport const triageRequest = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getTriageRequestUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getTriageRequestMutationKey = () => ['triageRequest'] as const;\n\nexport const getTriageRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof triageRequest>>, TError,TriageRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof triageRequest>>, TError,TriageRequestMutationVariables, TContext> => {\n\nconst mutationKey = getTriageRequestMutationKey();\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 triageRequest>>, TriageRequestMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return triageRequest(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type TriageRequestMutationResult = NonNullable<Awaited<ReturnType<typeof triageRequest>>>\n\n export type TriageRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type TriageRequestMutationVariables = {requestId: number}\n\n /**\n * @summary Triage Request\n */\nexport const useTriageRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof triageRequest>>, TError,TriageRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof triageRequest>>,\n TError,\n TriageRequestMutationVariables,\n TContext\n > => {\n return useMutation(getTriageRequestMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA0CA,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;EAGrD,IAAI,MAAM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CAAoC,CAAC,eAAe;AAEjE,MAAa,mCACW,YAC6F;CAErH,MAAM,cAAc,4BAA4B;CAChD,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAA2G,UAAU;EACvH,MAAM,EAAC,cAAa,SAAS,CAAC;EAE9B,OAAQ,cAAc,WAAU,cAAc;CAChD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,oBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,gCAAgC,OAAO,GAAG,WAAW;AAC1E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { a as ErrorType, c as request, n as BodyType } from "../client
|
|
2
|
+
import { S as TutoringAnswerWrite, i as TutoringRoomRead, t as ValidationErrorResponse, wr as HTTPExceptionResponse, y as TutoringCloseWrite } from "../chunks/index.js";
|
|
3
|
+
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
4
|
import { QueryClient, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/tutoring-practitioner/tutoring-practitioner.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 } from "@tanstack/react-query";
|
|
4
4
|
//#region src/react/tutoring-practitioner/tutoring-practitioner.ts
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ import { useMutation } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
9
|
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
-
* OpenAPI spec version: 0.
|
|
10
|
+
* OpenAPI spec version: 0.5.0
|
|
11
11
|
*/
|
|
12
12
|
const getAnswerRequestUrl = (requestId) => {
|
|
13
13
|
return `/tutoring/requests/${requestId}/answer`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tutoring-practitioner.js","names":[],"sources":["../../src/react/tutoring-practitioner/tutoring-practitioner.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} from '@tanstack/react-query';\nimport type {\n MutationFunction,\n QueryClient,\n UseMutationOptions,\n UseMutationResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n TutoringAnswerWrite,\n TutoringCloseWrite,\n TutoringRoomRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nexport const getAnswerRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/answer`\n}\n\n/**\n * Deliver the answer.\n *\n * The body is stored as the answer and any named attachments are re-roled to\n * ``answer`` — they were uploaded against this request, so no id from another\n * request can be attached here.\n * @summary Answer Request\n */\nexport const answerRequest = async (requestId: number,\n tutoringAnswerWrite: TutoringAnswerWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getAnswerRequestUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringAnswerWrite)\n }\n);}\n\n\n\n\n\nexport const getAnswerRequestMutationKey = () => ['answerRequest'] as const;\n\nexport const getAnswerRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof answerRequest>>, TError,AnswerRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof answerRequest>>, TError,AnswerRequestMutationVariables, TContext> => {\n\nconst mutationKey = getAnswerRequestMutationKey();\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 answerRequest>>, AnswerRequestMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return answerRequest(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AnswerRequestMutationResult = NonNullable<Awaited<ReturnType<typeof answerRequest>>>\n export type AnswerRequestMutationBody = BodyType<TutoringAnswerWrite>\n export type AnswerRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type AnswerRequestMutationVariables = {requestId: number;data: BodyType<TutoringAnswerWrite>}\n\n /**\n * @summary Answer Request\n */\nexport const useAnswerRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof answerRequest>>, TError,AnswerRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof answerRequest>>,\n TError,\n AnswerRequestMutationVariables,\n TContext\n > => {\n return useMutation(getAnswerRequestMutationOptions(options), queryClient);\n }\n export const getClaimRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/claim`\n}\n\n/**\n * Take a dispatched request.\n *\n * ``409`` if somebody else already holds it. The check and the write are one\n * statement so that two practitioners hitting claim in the same instant cannot\n * both win — the legacy reads then writes, so both do.\n * @summary Claim Request\n */\nexport const claimRequest = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getClaimRequestUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getClaimRequestMutationKey = () => ['claimRequest'] as const;\n\nexport const getClaimRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof claimRequest>>, TError,ClaimRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof claimRequest>>, TError,ClaimRequestMutationVariables, TContext> => {\n\nconst mutationKey = getClaimRequestMutationKey();\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 claimRequest>>, ClaimRequestMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return claimRequest(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ClaimRequestMutationResult = NonNullable<Awaited<ReturnType<typeof claimRequest>>>\n\n export type ClaimRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ClaimRequestMutationVariables = {requestId: number}\n\n /**\n * @summary Claim Request\n */\nexport const useClaimRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof claimRequest>>, TError,ClaimRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof claimRequest>>,\n TError,\n ClaimRequestMutationVariables,\n TContext\n > => {\n return useMutation(getClaimRequestMutationOptions(options), queryClient);\n }\n export const getCloseRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/close`\n}\n\n/**\n * Close a request that will not be answered, with a reason.\n *\n * A dispatcher's job rather than a practitioner's: giving up on a request is a\n * decision about the queue, and the person who could not answer it is not the\n * person who should decide nobody will.\n * @summary Close Request\n */\nexport const closeRequest = async (requestId: number,\n tutoringCloseWrite: TutoringCloseWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getCloseRequestUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringCloseWrite)\n }\n);}\n\n\n\n\n\nexport const getCloseRequestMutationKey = () => ['closeRequest'] as const;\n\nexport const getCloseRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeRequest>>, TError,CloseRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof closeRequest>>, TError,CloseRequestMutationVariables, TContext> => {\n\nconst mutationKey = getCloseRequestMutationKey();\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 closeRequest>>, CloseRequestMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return closeRequest(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CloseRequestMutationResult = NonNullable<Awaited<ReturnType<typeof closeRequest>>>\n export type CloseRequestMutationBody = BodyType<TutoringCloseWrite>\n export type CloseRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CloseRequestMutationVariables = {requestId: number;data: BodyType<TutoringCloseWrite>}\n\n /**\n * @summary Close Request\n */\nexport const useCloseRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeRequest>>, TError,CloseRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof closeRequest>>,\n TError,\n CloseRequestMutationVariables,\n TContext\n > => {\n return useMutation(getCloseRequestMutationOptions(options), queryClient);\n }\n export const getOpenRoomUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/room`\n}\n\n/**\n * Open the room for a live request. The practitioner decides when.\n *\n * Deliberately an explicit action rather than a side effect of claiming, which\n * is what Prof Express does: the teacher presses a button in their own queue,\n * and ``createTeacherVedamoClasssroom`` refuses unless a teacher is assigned.\n * A room provisioned at dispatch is a room the pupil joins alone.\n *\n * Only the assigned practitioner may open it, and only once — a second call\n * returns the room that is already open rather than provisioning another. The\n * legacy has no such check, so pressing its button twice orphans a room the\n * pupil may already hold a link to.\n *\n * ``409`` for a channel with nothing to join, and for a request nobody has\n * claimed.\n * @summary Open Room\n */\nexport const openRoom = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<TutoringRoomRead> => {\n\n return request<TutoringRoomRead>(getOpenRoomUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getOpenRoomMutationKey = () => ['openRoom'] as const;\n\nexport const getOpenRoomMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openRoom>>, TError,OpenRoomMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof openRoom>>, TError,OpenRoomMutationVariables, TContext> => {\n\nconst mutationKey = getOpenRoomMutationKey();\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 openRoom>>, OpenRoomMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return openRoom(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OpenRoomMutationResult = NonNullable<Awaited<ReturnType<typeof openRoom>>>\n\n export type OpenRoomMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type OpenRoomMutationVariables = {requestId: number}\n\n /**\n * @summary Open Room\n */\nexport const useOpenRoom = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openRoom>>, TError,OpenRoomMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof openRoom>>,\n TError,\n OpenRoomMutationVariables,\n TContext\n > => {\n return useMutation(getOpenRoomMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AAiCA,MAAa,uBAAuB,cAAuB;CAKzD,OAAO,sBAAsB,UAAU;AACzC;;;;;;;;;AAUA,MAAa,gBAAgB,OAAO,WAChC,qBAA0C,YAA2D;CAErG,MAAM,cAAc,MAAwF;EAC5G,IAAI,CAAC,GAAG,OAAO,CAAC;EAChB,IAAI,aAAa,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;EAC/D,IAAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAc,oBAAoB,SAAS,GAChD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,mBAAmB;CAC1C,CACF;AAAE;AAMF,MAAa,oCAAoC,CAAC,eAAe;AAEjE,MAAa,mCACW,YAC6F;CAErH,MAAM,cAAc,4BAA4B;CAChD,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;E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AAEvD,MAAa,8BACW,YACmF;CAE3G,MAAM,cAAc,uBAAuB;CAC3C,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,cAAiG,UAAU;EAC7G,MAAM,EAAC,cAAa,SAAS,CAAC;EAE9B,OAAQ,SAAS,WAAU,cAAc;CAC3C;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,eACW,SACrB,gBAKQ;CACL,OAAO,YAAY,2BAA2B,OAAO,GAAG,WAAW;AACrE"}
|
|
1
|
+
{"version":3,"file":"tutoring-practitioner.js","names":[],"sources":["../../src/react/tutoring-practitioner/tutoring-practitioner.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.5.0\n */\nimport {\n useMutation\n} from '@tanstack/react-query';\nimport type {\n MutationFunction,\n QueryClient,\n UseMutationOptions,\n UseMutationResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n TutoringAnswerWrite,\n TutoringCloseWrite,\n TutoringRoomRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nexport const getAnswerRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/answer`\n}\n\n/**\n * Deliver the answer.\n *\n * The body is stored as the answer and any named attachments are re-roled to\n * ``answer`` — they were uploaded against this request, so no id from another\n * request can be attached here.\n * @summary Answer Request\n */\nexport const answerRequest = async (requestId: number,\n tutoringAnswerWrite: TutoringAnswerWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getAnswerRequestUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringAnswerWrite)\n }\n);}\n\n\n\n\n\nexport const getAnswerRequestMutationKey = () => ['answerRequest'] as const;\n\nexport const getAnswerRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof answerRequest>>, TError,AnswerRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof answerRequest>>, TError,AnswerRequestMutationVariables, TContext> => {\n\nconst mutationKey = getAnswerRequestMutationKey();\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 answerRequest>>, AnswerRequestMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return answerRequest(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AnswerRequestMutationResult = NonNullable<Awaited<ReturnType<typeof answerRequest>>>\n export type AnswerRequestMutationBody = BodyType<TutoringAnswerWrite>\n export type AnswerRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type AnswerRequestMutationVariables = {requestId: number;data: BodyType<TutoringAnswerWrite>}\n\n /**\n * @summary Answer Request\n */\nexport const useAnswerRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof answerRequest>>, TError,AnswerRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof answerRequest>>,\n TError,\n AnswerRequestMutationVariables,\n TContext\n > => {\n return useMutation(getAnswerRequestMutationOptions(options), queryClient);\n }\n export const getClaimRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/claim`\n}\n\n/**\n * Take a dispatched request.\n *\n * ``409`` if somebody else already holds it. The check and the write are one\n * statement so that two practitioners hitting claim in the same instant cannot\n * both win — the legacy reads then writes, so both do.\n * @summary Claim Request\n */\nexport const claimRequest = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getClaimRequestUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getClaimRequestMutationKey = () => ['claimRequest'] as const;\n\nexport const getClaimRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof claimRequest>>, TError,ClaimRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof claimRequest>>, TError,ClaimRequestMutationVariables, TContext> => {\n\nconst mutationKey = getClaimRequestMutationKey();\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 claimRequest>>, ClaimRequestMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return claimRequest(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ClaimRequestMutationResult = NonNullable<Awaited<ReturnType<typeof claimRequest>>>\n\n export type ClaimRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ClaimRequestMutationVariables = {requestId: number}\n\n /**\n * @summary Claim Request\n */\nexport const useClaimRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof claimRequest>>, TError,ClaimRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof claimRequest>>,\n TError,\n ClaimRequestMutationVariables,\n TContext\n > => {\n return useMutation(getClaimRequestMutationOptions(options), queryClient);\n }\n export const getCloseRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/close`\n}\n\n/**\n * Close a request that will not be answered, with a reason.\n *\n * A dispatcher's job rather than a practitioner's: giving up on a request is a\n * decision about the queue, and the person who could not answer it is not the\n * person who should decide nobody will.\n * @summary Close Request\n */\nexport const closeRequest = async (requestId: number,\n tutoringCloseWrite: TutoringCloseWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getCloseRequestUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringCloseWrite)\n }\n);}\n\n\n\n\n\nexport const getCloseRequestMutationKey = () => ['closeRequest'] as const;\n\nexport const getCloseRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeRequest>>, TError,CloseRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof closeRequest>>, TError,CloseRequestMutationVariables, TContext> => {\n\nconst mutationKey = getCloseRequestMutationKey();\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 closeRequest>>, CloseRequestMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return closeRequest(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CloseRequestMutationResult = NonNullable<Awaited<ReturnType<typeof closeRequest>>>\n export type CloseRequestMutationBody = BodyType<TutoringCloseWrite>\n export type CloseRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CloseRequestMutationVariables = {requestId: number;data: BodyType<TutoringCloseWrite>}\n\n /**\n * @summary Close Request\n */\nexport const useCloseRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeRequest>>, TError,CloseRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof closeRequest>>,\n TError,\n CloseRequestMutationVariables,\n TContext\n > => {\n return useMutation(getCloseRequestMutationOptions(options), queryClient);\n }\n export const getOpenRoomUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/room`\n}\n\n/**\n * Open the room for a live request. The practitioner decides when.\n *\n * Deliberately an explicit action rather than a side effect of claiming, which\n * is what Prof Express does: the teacher presses a button in their own queue,\n * and ``createTeacherVedamoClasssroom`` refuses unless a teacher is assigned.\n * A room provisioned at dispatch is a room the pupil joins alone.\n *\n * Only the assigned practitioner may open it, and only once — a second call\n * returns the room that is already open rather than provisioning another. The\n * legacy has no such check, so pressing its button twice orphans a room the\n * pupil may already hold a link to.\n *\n * ``409`` for a channel with nothing to join, and for a request nobody has\n * claimed.\n * @summary Open Room\n */\nexport const openRoom = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<TutoringRoomRead> => {\n\n return request<TutoringRoomRead>(getOpenRoomUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getOpenRoomMutationKey = () => ['openRoom'] as const;\n\nexport const getOpenRoomMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openRoom>>, TError,OpenRoomMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof openRoom>>, TError,OpenRoomMutationVariables, TContext> => {\n\nconst mutationKey = getOpenRoomMutationKey();\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 openRoom>>, OpenRoomMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return openRoom(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OpenRoomMutationResult = NonNullable<Awaited<ReturnType<typeof openRoom>>>\n\n export type OpenRoomMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type OpenRoomMutationVariables = {requestId: number}\n\n /**\n * @summary Open Room\n */\nexport const useOpenRoom = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openRoom>>, TError,OpenRoomMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof openRoom>>,\n TError,\n OpenRoomMutationVariables,\n TContext\n > => {\n return useMutation(getOpenRoomMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AAiCA,MAAa,uBAAuB,cAAuB;CAKzD,OAAO,sBAAsB,UAAU;AACzC;;;;;;;;;AAUA,MAAa,gBAAgB,OAAO,WAChC,qBAA0C,YAA2D;CAErG,MAAM,cAAc,MAAwF;EAC5G,IAAI,CAAC,GAAG,OAAO,CAAC;EAChB,IAAI,aAAa,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;EAC/D,IAAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAc,oBAAoB,SAAS,GAChD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,mBAAmB;CAC1C,CACF;AAAE;AAMF,MAAa,oCAAoC,CAAC,eAAe;AAEjE,MAAa,mCACW,YAC6F;CAErH,MAAM,cAAc,4BAA4B;CAChD,MAAM,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O,sBAAsB,UAAU;AACzC;;;;;;;;;;;;;;;;;;AAmBA,MAAa,WAAW,OAAO,WAAmB,YAAuE;CAEvH,OAAO,QAA0B,eAAe,SAAS,GACzD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,+BAA+B,CAAC,UAAU;AAEvD,MAAa,8BACW,YACmF;CAE3G,MAAM,cAAc,uBAAuB;CAC3C,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,cAAiG,UAAU;EAC7G,MAAM,EAAC,cAAa,SAAS,CAAC;EAE9B,OAAQ,SAAS,WAAU,cAAc;CAC3C;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,eACW,SACrB,gBAKQ;CACL,OAAO,YAAY,2BAA2B,OAAO,GAAG,WAAW;AACrE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { a as ErrorType, c as request, n as BodyType } from "../client
|
|
2
|
+
import { Ai as BodyUploadAttachment, a as TutoringRequestWrite, c as TutoringRequestRead, kn as ListMyRequestsParams, p as TutoringFeedbackWrite, s as TutoringRequestPage, t as ValidationErrorResponse, wr as HTTPExceptionResponse, x as TutoringAttachmentRead } 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-requests/tutoring-requests.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-requests/tutoring-requests.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.5.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tutoring-requests.js","names":[],"sources":["../../src/react/tutoring-requests/tutoring-requests.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 BodyUploadAttachment,\n HTTPExceptionResponse,\n ListMyRequestsParams,\n TutoringAttachmentRead,\n TutoringFeedbackWrite,\n TutoringRequestPage,\n TutoringRequestRead,\n TutoringRequestWrite,\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 getListMyRequestsUrl = (params?: ListMyRequestsParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n const explodeParameters = [\"status\"];\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 ? `/tutoring/requests?${stringifiedParams}` : `/tutoring/requests`\n}\n\n/**\n * The caller's own requests, newest first.\n *\n * Includes requests they submitted for a child profile, which is what the\n * ``requested_by_id`` half of the predicate is for — a parent's list should not\n * go empty the moment they ask on somebody else's behalf.\n * @summary List My Requests\n */\nexport const listMyRequests = async (params?: ListMyRequestsParams, options?: Parameters<typeof request>[1]): Promise<TutoringRequestPage> => {\n\n return request<TutoringRequestPage>(getListMyRequestsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListMyRequestsQueryKey = (params?: ListMyRequestsParams,) => {\n return [\n `/tutoring/requests`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListMyRequestsQueryOptions = <TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListMyRequestsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListMyRequestsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listMyRequests>>> = ({ signal }) => listMyRequests(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListMyRequestsQueryResult = NonNullable<Awaited<ReturnType<typeof listMyRequests>>>\nexport type ListMyRequestsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListMyRequests<TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListMyRequestsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMyRequests>>,\n TError,\n Awaited<ReturnType<typeof listMyRequests>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMyRequests<TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListMyRequestsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMyRequests>>,\n TError,\n Awaited<ReturnType<typeof listMyRequests>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMyRequests<TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListMyRequestsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List My Requests\n */\n\nexport function useListMyRequests<TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListMyRequestsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListMyRequestsQueryOptions(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 getSubmitRequestUrl = () => {\n\n\n\n\n return `/tutoring/requests`\n}\n\n/**\n * Ask for help.\n *\n * Debits the tenant's tutoring entitlement, which is what makes this a ``409``\n * when the allowance is spent rather than a queued request nobody may answer.\n * ``403`` from the entitlement layer is reported as ``404`` for the subject, per\n * the convention the loan routes already follow.\n *\n * ``onBehalfOfId`` must name a profile of the caller. Anything else is ``403``:\n * the legacy accepts a ``user_id`` in the body and trusts it, which is an\n * authorization decision made by whoever wrote the client.\n * @summary Submit Request\n */\nexport const submitRequest = async (tutoringRequestWrite: TutoringRequestWrite, options?: Parameters<typeof request>[1]): Promise<TutoringRequestRead> => {\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<TutoringRequestRead>(getSubmitRequestUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringRequestWrite)\n }\n);}\n\n\n\n\n\nexport const getSubmitRequestMutationKey = () => ['submitRequest'] as const;\n\nexport const getSubmitRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitRequest>>, TError,SubmitRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof submitRequest>>, TError,SubmitRequestMutationVariables, TContext> => {\n\nconst mutationKey = getSubmitRequestMutationKey();\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 submitRequest>>, SubmitRequestMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return submitRequest(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type SubmitRequestMutationResult = NonNullable<Awaited<ReturnType<typeof submitRequest>>>\n export type SubmitRequestMutationBody = BodyType<TutoringRequestWrite>\n export type SubmitRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type SubmitRequestMutationVariables = {data: BodyType<TutoringRequestWrite>}\n\n /**\n * @summary Submit Request\n */\nexport const useSubmitRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitRequest>>, TError,SubmitRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof submitRequest>>,\n TError,\n SubmitRequestMutationVariables,\n TContext\n > => {\n return useMutation(getSubmitRequestMutationOptions(options), queryClient);\n }\n export const getGetRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}`\n}\n\n/**\n * One of the caller's own requests, with signed links to its files.\n * @summary Get Request\n */\nexport const getRequest = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<TutoringRequestRead> => {\n\n return request<TutoringRequestRead>(getGetRequestUrl(requestId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getGetRequestQueryKey = (requestId: number,) => {\n return [\n `/tutoring/requests/${requestId}`\n ] as const;\n }\n\n\nexport const getGetRequestQueryOptions = <TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(requestId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetRequestQueryKey(requestId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getRequest>>> = ({ signal }) => getRequest(requestId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: requestId !== null && requestId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetRequestQueryResult = NonNullable<Awaited<ReturnType<typeof getRequest>>>\nexport type GetRequestQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useGetRequest<TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getRequest>>,\n TError,\n Awaited<ReturnType<typeof getRequest>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetRequest<TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getRequest>>,\n TError,\n Awaited<ReturnType<typeof getRequest>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetRequest<TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Get Request\n */\n\nexport function useGetRequest<TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetRequestQueryOptions(requestId,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 getUploadAttachmentUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/attachments`\n}\n\n/**\n * Attach a file to a request. One per call.\n *\n * One per call rather than an array, deliberately. A pupil photographing four\n * pages on a phone connection wants three of them to survive the fourth\n * timing out, and the legacy's ``documents[]`` array is all-or-nothing — with\n * no cap on how many, so a single request can be arbitrarily large.\n *\n * The role follows from who is asking: the pupil is attaching to a question,\n * the assigned practitioner to an answer. Nobody declares it, so nobody can\n * claim the wrong one.\n *\n * ``415`` for a format we do not accept, ``413`` for a file over the ceiling,\n * ``409`` once the per-request cap is reached, and ``404`` for a request that\n * is not the caller's.\n * @summary Upload Attachment\n */\nexport const uploadAttachment = async (requestId: number,\n bodyUploadAttachment: BodyUploadAttachment, options?: Parameters<typeof request>[1]): Promise<TutoringAttachmentRead> => {\n const formData = new FormData();\nformData.append(`file`, bodyUploadAttachment.file);\n\n return request<TutoringAttachmentRead>(getUploadAttachmentUrl(requestId),\n {\n ...options,\n method: 'POST'\n ,\n body: formData\n }\n);}\n\n\n\n\n\nexport const getUploadAttachmentMutationKey = () => ['uploadAttachment'] as const;\n\nexport const getUploadAttachmentMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof uploadAttachment>>, TError,UploadAttachmentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof uploadAttachment>>, TError,UploadAttachmentMutationVariables, TContext> => {\n\nconst mutationKey = getUploadAttachmentMutationKey();\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 uploadAttachment>>, UploadAttachmentMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return uploadAttachment(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type UploadAttachmentMutationResult = NonNullable<Awaited<ReturnType<typeof uploadAttachment>>>\n export type UploadAttachmentMutationBody = BodyType<BodyUploadAttachment>\n export type UploadAttachmentMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type UploadAttachmentMutationVariables = {requestId: number;data: BodyType<BodyUploadAttachment>}\n\n /**\n * @summary Upload Attachment\n */\nexport const useUploadAttachment = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof uploadAttachment>>, TError,UploadAttachmentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof uploadAttachment>>,\n TError,\n UploadAttachmentMutationVariables,\n TContext\n > => {\n return useMutation(getUploadAttachmentMutationOptions(options), queryClient);\n }\n export const getDeleteAttachmentUrl = (requestId: number,\n attachmentId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/attachments/${attachmentId}`\n}\n\n/**\n * Remove a file the caller uploaded.\n *\n * Only the uploader, and only while the request is still open — a file that\n * formed part of a delivered answer is part of the record.\n *\n * The object goes and the row goes with it: this is a mistaken upload being\n * withdrawn, not a retention event. Retention is the bucket's lifecycle rule,\n * which removes objects and leaves rows behind.\n * @summary Delete Attachment\n */\nexport const deleteAttachment = async (requestId: number,\n attachmentId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteAttachmentUrl(requestId,attachmentId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getDeleteAttachmentMutationKey = () => ['deleteAttachment'] as const;\n\nexport const getDeleteAttachmentMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAttachment>>, TError,DeleteAttachmentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteAttachment>>, TError,DeleteAttachmentMutationVariables, TContext> => {\n\nconst mutationKey = getDeleteAttachmentMutationKey();\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 deleteAttachment>>, DeleteAttachmentMutationVariables> = (props) => {\n const {requestId,attachmentId} = props ?? {};\n\n return deleteAttachment(requestId,attachmentId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteAttachmentMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAttachment>>>\n\n export type DeleteAttachmentMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type DeleteAttachmentMutationVariables = {requestId: number;attachmentId: number}\n\n /**\n * @summary Delete Attachment\n */\nexport const useDeleteAttachment = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAttachment>>, TError,DeleteAttachmentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof deleteAttachment>>,\n TError,\n DeleteAttachmentMutationVariables,\n TContext\n > => {\n return useMutation(getDeleteAttachmentMutationOptions(options), queryClient);\n }\n export const getCancelRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/cancel`\n}\n\n/**\n * Withdraw a request the caller asked.\n *\n * The debit is **not** reversed. A pupil who asks and withdraws has occupied a\n * dispatcher's attention, and refunding it would make cancel-and-resubmit a way\n * around the allowance. If a tenant should get the unit back, that is a credit\n * somebody grants, which is a different act with a different audit trail.\n * @summary Cancel Request\n */\nexport const cancelRequest = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<TutoringRequestRead> => {\n\n return request<TutoringRequestRead>(getCancelRequestUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getCancelRequestMutationKey = () => ['cancelRequest'] as const;\n\nexport const getCancelRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof cancelRequest>>, TError,CancelRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof cancelRequest>>, TError,CancelRequestMutationVariables, TContext> => {\n\nconst mutationKey = getCancelRequestMutationKey();\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 cancelRequest>>, CancelRequestMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return cancelRequest(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CancelRequestMutationResult = NonNullable<Awaited<ReturnType<typeof cancelRequest>>>\n\n export type CancelRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CancelRequestMutationVariables = {requestId: number}\n\n /**\n * @summary Cancel Request\n */\nexport const useCancelRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof cancelRequest>>, TError,CancelRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof cancelRequest>>,\n TError,\n CancelRequestMutationVariables,\n TContext\n > => {\n return useMutation(getCancelRequestMutationOptions(options), queryClient);\n }\n export const getRateRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/feedback`\n}\n\n/**\n * Rate the answer. One rating per request, enforced by the table.\n * @summary Rate Request\n */\nexport const rateRequest = async (requestId: number,\n tutoringFeedbackWrite: TutoringFeedbackWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getRateRequestUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringFeedbackWrite)\n }\n);}\n\n\n\n\n\nexport const getRateRequestMutationKey = () => ['rateRequest'] as const;\n\nexport const getRateRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof rateRequest>>, TError,RateRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof rateRequest>>, TError,RateRequestMutationVariables, TContext> => {\n\nconst mutationKey = getRateRequestMutationKey();\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 rateRequest>>, RateRequestMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return rateRequest(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type RateRequestMutationResult = NonNullable<Awaited<ReturnType<typeof rateRequest>>>\n export type RateRequestMutationBody = BodyType<TutoringFeedbackWrite>\n export type RateRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type RateRequestMutationVariables = {requestId: number;data: BodyType<TutoringFeedbackWrite>}\n\n /**\n * @summary Rate Request\n */\nexport const useRateRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof rateRequest>>, TError,RateRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof rateRequest>>,\n TError,\n RateRequestMutationVariables,\n TContext\n > => {\n return useMutation(getRateRequestMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA8CA,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,WAAmC;CACtE,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAGrD,IAAI,MAAM,QAAQ,KAAK,KAAK,CAFD,QAEiB,CAAC,CAAC,SAAS,GAAG,GAAG;GAC3D,MAAM,SAAS,MAAM;IACnB,iBAAiB,OAAO,KAAK,MAAM,OAAO,SAAS,OAAO,CAAC,CAAC;GAC9D,CAAC;GACD;EACF;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AC,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-requests.js","names":[],"sources":["../../src/react/tutoring-requests/tutoring-requests.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.5.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n BodyUploadAttachment,\n HTTPExceptionResponse,\n ListMyRequestsParams,\n TutoringAttachmentRead,\n TutoringFeedbackWrite,\n TutoringRequestPage,\n TutoringRequestRead,\n TutoringRequestWrite,\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 getListMyRequestsUrl = (params?: ListMyRequestsParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n const explodeParameters = [\"status\"];\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 ? `/tutoring/requests?${stringifiedParams}` : `/tutoring/requests`\n}\n\n/**\n * The caller's own requests, newest first.\n *\n * Includes requests they submitted for a child profile, which is what the\n * ``requested_by_id`` half of the predicate is for — a parent's list should not\n * go empty the moment they ask on somebody else's behalf.\n * @summary List My Requests\n */\nexport const listMyRequests = async (params?: ListMyRequestsParams, options?: Parameters<typeof request>[1]): Promise<TutoringRequestPage> => {\n\n return request<TutoringRequestPage>(getListMyRequestsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListMyRequestsQueryKey = (params?: ListMyRequestsParams,) => {\n return [\n `/tutoring/requests`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListMyRequestsQueryOptions = <TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListMyRequestsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListMyRequestsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listMyRequests>>> = ({ signal }) => listMyRequests(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListMyRequestsQueryResult = NonNullable<Awaited<ReturnType<typeof listMyRequests>>>\nexport type ListMyRequestsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListMyRequests<TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListMyRequestsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMyRequests>>,\n TError,\n Awaited<ReturnType<typeof listMyRequests>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMyRequests<TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListMyRequestsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMyRequests>>,\n TError,\n Awaited<ReturnType<typeof listMyRequests>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMyRequests<TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListMyRequestsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List My Requests\n */\n\nexport function useListMyRequests<TData = Awaited<ReturnType<typeof listMyRequests>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListMyRequestsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyRequests>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListMyRequestsQueryOptions(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 getSubmitRequestUrl = () => {\n\n\n\n\n return `/tutoring/requests`\n}\n\n/**\n * Ask for help.\n *\n * Debits the tenant's tutoring entitlement, which is what makes this a ``409``\n * when the allowance is spent rather than a queued request nobody may answer.\n * ``403`` from the entitlement layer is reported as ``404`` for the subject, per\n * the convention the loan routes already follow.\n *\n * ``onBehalfOfId`` must name a profile of the caller. Anything else is ``403``:\n * the legacy accepts a ``user_id`` in the body and trusts it, which is an\n * authorization decision made by whoever wrote the client.\n * @summary Submit Request\n */\nexport const submitRequest = async (tutoringRequestWrite: TutoringRequestWrite, options?: Parameters<typeof request>[1]): Promise<TutoringRequestRead> => {\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<TutoringRequestRead>(getSubmitRequestUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringRequestWrite)\n }\n);}\n\n\n\n\n\nexport const getSubmitRequestMutationKey = () => ['submitRequest'] as const;\n\nexport const getSubmitRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitRequest>>, TError,SubmitRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof submitRequest>>, TError,SubmitRequestMutationVariables, TContext> => {\n\nconst mutationKey = getSubmitRequestMutationKey();\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 submitRequest>>, SubmitRequestMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return submitRequest(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type SubmitRequestMutationResult = NonNullable<Awaited<ReturnType<typeof submitRequest>>>\n export type SubmitRequestMutationBody = BodyType<TutoringRequestWrite>\n export type SubmitRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type SubmitRequestMutationVariables = {data: BodyType<TutoringRequestWrite>}\n\n /**\n * @summary Submit Request\n */\nexport const useSubmitRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitRequest>>, TError,SubmitRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof submitRequest>>,\n TError,\n SubmitRequestMutationVariables,\n TContext\n > => {\n return useMutation(getSubmitRequestMutationOptions(options), queryClient);\n }\n export const getGetRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}`\n}\n\n/**\n * One of the caller's own requests, with signed links to its files.\n * @summary Get Request\n */\nexport const getRequest = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<TutoringRequestRead> => {\n\n return request<TutoringRequestRead>(getGetRequestUrl(requestId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getGetRequestQueryKey = (requestId: number,) => {\n return [\n `/tutoring/requests/${requestId}`\n ] as const;\n }\n\n\nexport const getGetRequestQueryOptions = <TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(requestId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetRequestQueryKey(requestId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getRequest>>> = ({ signal }) => getRequest(requestId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: requestId !== null && requestId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetRequestQueryResult = NonNullable<Awaited<ReturnType<typeof getRequest>>>\nexport type GetRequestQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useGetRequest<TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getRequest>>,\n TError,\n Awaited<ReturnType<typeof getRequest>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetRequest<TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getRequest>>,\n TError,\n Awaited<ReturnType<typeof getRequest>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetRequest<TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Get Request\n */\n\nexport function useGetRequest<TData = Awaited<ReturnType<typeof getRequest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getRequest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetRequestQueryOptions(requestId,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 getUploadAttachmentUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/attachments`\n}\n\n/**\n * Attach a file to a request. One per call.\n *\n * One per call rather than an array, deliberately. A pupil photographing four\n * pages on a phone connection wants three of them to survive the fourth\n * timing out, and the legacy's ``documents[]`` array is all-or-nothing — with\n * no cap on how many, so a single request can be arbitrarily large.\n *\n * The role follows from who is asking: the pupil is attaching to a question,\n * the assigned practitioner to an answer. Nobody declares it, so nobody can\n * claim the wrong one.\n *\n * ``415`` for a format we do not accept, ``413`` for a file over the ceiling,\n * ``409`` once the per-request cap is reached, and ``404`` for a request that\n * is not the caller's.\n * @summary Upload Attachment\n */\nexport const uploadAttachment = async (requestId: number,\n bodyUploadAttachment: BodyUploadAttachment, options?: Parameters<typeof request>[1]): Promise<TutoringAttachmentRead> => {\n const formData = new FormData();\nformData.append(`file`, bodyUploadAttachment.file);\n\n return request<TutoringAttachmentRead>(getUploadAttachmentUrl(requestId),\n {\n ...options,\n method: 'POST'\n ,\n body: formData\n }\n);}\n\n\n\n\n\nexport const getUploadAttachmentMutationKey = () => ['uploadAttachment'] as const;\n\nexport const getUploadAttachmentMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof uploadAttachment>>, TError,UploadAttachmentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof uploadAttachment>>, TError,UploadAttachmentMutationVariables, TContext> => {\n\nconst mutationKey = getUploadAttachmentMutationKey();\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 uploadAttachment>>, UploadAttachmentMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return uploadAttachment(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type UploadAttachmentMutationResult = NonNullable<Awaited<ReturnType<typeof uploadAttachment>>>\n export type UploadAttachmentMutationBody = BodyType<BodyUploadAttachment>\n export type UploadAttachmentMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type UploadAttachmentMutationVariables = {requestId: number;data: BodyType<BodyUploadAttachment>}\n\n /**\n * @summary Upload Attachment\n */\nexport const useUploadAttachment = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof uploadAttachment>>, TError,UploadAttachmentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof uploadAttachment>>,\n TError,\n UploadAttachmentMutationVariables,\n TContext\n > => {\n return useMutation(getUploadAttachmentMutationOptions(options), queryClient);\n }\n export const getDeleteAttachmentUrl = (requestId: number,\n attachmentId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/attachments/${attachmentId}`\n}\n\n/**\n * Remove a file the caller uploaded.\n *\n * Only the uploader, and only while the request is still open — a file that\n * formed part of a delivered answer is part of the record.\n *\n * The object goes and the row goes with it: this is a mistaken upload being\n * withdrawn, not a retention event. Retention is the bucket's lifecycle rule,\n * which removes objects and leaves rows behind.\n * @summary Delete Attachment\n */\nexport const deleteAttachment = async (requestId: number,\n attachmentId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteAttachmentUrl(requestId,attachmentId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getDeleteAttachmentMutationKey = () => ['deleteAttachment'] as const;\n\nexport const getDeleteAttachmentMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAttachment>>, TError,DeleteAttachmentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteAttachment>>, TError,DeleteAttachmentMutationVariables, TContext> => {\n\nconst mutationKey = getDeleteAttachmentMutationKey();\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 deleteAttachment>>, DeleteAttachmentMutationVariables> = (props) => {\n const {requestId,attachmentId} = props ?? {};\n\n return deleteAttachment(requestId,attachmentId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteAttachmentMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAttachment>>>\n\n export type DeleteAttachmentMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type DeleteAttachmentMutationVariables = {requestId: number;attachmentId: number}\n\n /**\n * @summary Delete Attachment\n */\nexport const useDeleteAttachment = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAttachment>>, TError,DeleteAttachmentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof deleteAttachment>>,\n TError,\n DeleteAttachmentMutationVariables,\n TContext\n > => {\n return useMutation(getDeleteAttachmentMutationOptions(options), queryClient);\n }\n export const getCancelRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/cancel`\n}\n\n/**\n * Withdraw a request the caller asked.\n *\n * The debit is **not** reversed. A pupil who asks and withdraws has occupied a\n * dispatcher's attention, and refunding it would make cancel-and-resubmit a way\n * around the allowance. If a tenant should get the unit back, that is a credit\n * somebody grants, which is a different act with a different audit trail.\n * @summary Cancel Request\n */\nexport const cancelRequest = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<TutoringRequestRead> => {\n\n return request<TutoringRequestRead>(getCancelRequestUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getCancelRequestMutationKey = () => ['cancelRequest'] as const;\n\nexport const getCancelRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof cancelRequest>>, TError,CancelRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof cancelRequest>>, TError,CancelRequestMutationVariables, TContext> => {\n\nconst mutationKey = getCancelRequestMutationKey();\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 cancelRequest>>, CancelRequestMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return cancelRequest(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CancelRequestMutationResult = NonNullable<Awaited<ReturnType<typeof cancelRequest>>>\n\n export type CancelRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CancelRequestMutationVariables = {requestId: number}\n\n /**\n * @summary Cancel Request\n */\nexport const useCancelRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof cancelRequest>>, TError,CancelRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof cancelRequest>>,\n TError,\n CancelRequestMutationVariables,\n TContext\n > => {\n return useMutation(getCancelRequestMutationOptions(options), queryClient);\n }\n export const getRateRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/feedback`\n}\n\n/**\n * Rate the answer. One rating per request, enforced by the table.\n * @summary Rate Request\n */\nexport const rateRequest = async (requestId: number,\n tutoringFeedbackWrite: TutoringFeedbackWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getRateRequestUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringFeedbackWrite)\n }\n);}\n\n\n\n\n\nexport const getRateRequestMutationKey = () => ['rateRequest'] as const;\n\nexport const getRateRequestMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof rateRequest>>, TError,RateRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof rateRequest>>, TError,RateRequestMutationVariables, TContext> => {\n\nconst mutationKey = getRateRequestMutationKey();\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 rateRequest>>, RateRequestMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return rateRequest(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type RateRequestMutationResult = NonNullable<Awaited<ReturnType<typeof rateRequest>>>\n export type RateRequestMutationBody = BodyType<TutoringFeedbackWrite>\n export type RateRequestMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type RateRequestMutationVariables = {requestId: number;data: BodyType<TutoringFeedbackWrite>}\n\n /**\n * @summary Rate Request\n */\nexport const useRateRequest = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof rateRequest>>, TError,RateRequestMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof rateRequest>>,\n TError,\n RateRequestMutationVariables,\n TContext\n > => {\n return useMutation(getRateRequestMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA8CA,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,WAAmC;CACtE,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAGrD,IAAI,MAAM,QAAQ,KAAK,KAAK,CAFD,QAEiB,CAAC,CAAC,SAAS,GAAG,GAAG;GAC3D,MAAM,SAAS,MAAM;IACnB,iBAAiB,OAAO,KAAK,MAAM,OAAO,SAAS,OAAO,CAAC,CAAC;GAC9D,CAAC;GACD;EACF;EAEA,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,sBAAsB,sBAAsB;AACpF;;;;;;;;;AAUA,MAAa,iBAAiB,OAAO,QAA+B,YAA0E;CAE5I,OAAO,QAA6B,qBAAqB,MAAM,GAC/D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,6BAA6B,WAAmC;CACzE,OAAO,CACP,sBAAsB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAC/C;AACA;AAGJ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Y,EAAE,QAAQ,CAAC;EAC/D,IAAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAc,kBAAkB,SAAS,GAC9C;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,qBAAqB;CAC5C,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learnorama/mozaik-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-staging.22.1",
|
|
4
4
|
"description": "Typed Mozaik API client and optional TanStack Query hooks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -23,6 +23,22 @@
|
|
|
23
23
|
"types": "./dist/models.d.ts",
|
|
24
24
|
"import": "./dist/models.js"
|
|
25
25
|
},
|
|
26
|
+
"./chat": {
|
|
27
|
+
"types": "./dist/chat.d.ts",
|
|
28
|
+
"import": "./dist/chat.js"
|
|
29
|
+
},
|
|
30
|
+
"./auth": {
|
|
31
|
+
"types": "./dist/auth.d.ts",
|
|
32
|
+
"import": "./dist/auth.js"
|
|
33
|
+
},
|
|
34
|
+
"./react/sso": {
|
|
35
|
+
"types": "./dist/react/sso.d.ts",
|
|
36
|
+
"import": "./dist/react/sso.js"
|
|
37
|
+
},
|
|
38
|
+
"./react/chat": {
|
|
39
|
+
"types": "./dist/react/chat.d.ts",
|
|
40
|
+
"import": "./dist/react/chat.js"
|
|
41
|
+
},
|
|
26
42
|
"./api/*": {
|
|
27
43
|
"types": "./dist/api/*.d.ts",
|
|
28
44
|
"import": "./dist/api/*.js"
|
|
@@ -54,5 +70,17 @@
|
|
|
54
70
|
"@tanstack/react-query": {
|
|
55
71
|
"optional": true
|
|
56
72
|
}
|
|
73
|
+
},
|
|
74
|
+
"mozaik": {
|
|
75
|
+
"apiVersion": "0.5.0",
|
|
76
|
+
"backendRevision": "0d2ed4db2df01c3bc1d98dedc9468340dae47ad6",
|
|
77
|
+
"schemaSha256": "c2b9b00e7c01f4f89bd1a08be4878af9d124c974c8c20f5a6acbdad292ab25c5",
|
|
78
|
+
"sdkFingerprintVersion": 2,
|
|
79
|
+
"sdkFingerprint": "431e99a27d23277ab0726614617607a49a0879abf643fbbc7d89a7615e4f5881",
|
|
80
|
+
"sdkContent": {
|
|
81
|
+
"runtime": "69ce3dad496f7eb2a7c2f9859b153284f576d31807036ef99f7a42180a79d2c5",
|
|
82
|
+
"types": "9802fb794e23c69806e11c3c646639c40fbf23cd23fb34c5b7642334d9d47d70",
|
|
83
|
+
"package": "99a714f26e86b40c6eabd5248366c7c0efb397f4a6e7cfb7adbca689382e2f11"
|
|
84
|
+
}
|
|
57
85
|
}
|
|
58
86
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-D3kMOcIr.js","names":[],"sources":["../src/client.ts"],"sourcesContent":["/** Configuration belongs to a client instance, never to global authentication state. */\nexport interface ClientOptions {\n baseUrl: string;\n getAccessToken?: () => string | null | undefined | Promise<string | null | undefined>;\n headers?: HeadersInit;\n fetch?: typeof globalThis.fetch;\n}\n\nexport interface Client extends Readonly<ClientOptions> {}\n\nexport interface RequestOptions extends RequestInit {\n client?: Client;\n}\n\nexport class ApiError<T = unknown> extends Error {\n readonly status: number;\n readonly data: T;\n readonly headers: Headers;\n\n constructor(response: Response, data: T) {\n super(`Mozaik API returned HTTP ${response.status}`);\n this.name = 'ApiError';\n this.status = response.status;\n this.data = data;\n this.headers = response.headers;\n }\n}\n\nexport function createClient(options: ClientOptions): Client {\n const url = new URL(options.baseUrl);\n if (!['https:', 'http:'].includes(url.protocol) || url.username || url.password || url.search || url.hash || url.pathname !== '/') {\n throw new TypeError('baseUrl must be an HTTP(S) origin without credentials, path, query or fragment');\n }\n return Object.freeze({ ...options, baseUrl: url.origin, headers: new Headers(options.headers) });\n}\n\n/** Orval transport: typed successful data, rejected HTTP errors, native cancellation. */\nexport async function request<T>(path: string, options: RequestOptions = {}): Promise<T> {\n const { client, headers: requestHeaders, ...init } = options;\n const headers = new Headers(client?.headers);\n new Headers(requestHeaders).forEach((value, key) => headers.set(key, value));\n const url = client ? new URL(path, client.baseUrl) : undefined;\n if (client && url?.origin !== client.baseUrl) {\n throw new TypeError('Refusing to send client credentials to another origin');\n }\n if (!headers.has('Authorization')) {\n const token = await client?.getAccessToken?.();\n if (token) headers.set('Authorization', `Bearer ${token}`);\n }\n if (init.body instanceof FormData) headers.delete('Content-Type');\n if (!headers.has('Accept')) headers.set('Accept', 'application/json');\n const response = await (client?.fetch ?? globalThis.fetch)(url?.href ?? path, {\n credentials: 'omit', ...init, headers,\n });\n let data: unknown;\n if (response.status !== 204 && response.status !== 205 && init.method !== 'HEAD') {\n const text = await response.text();\n if (text) {\n if (response.headers.get('Content-Type')?.includes('json')) {\n try { data = JSON.parse(text); }\n catch (error) { if (response.ok) throw error; data = text; }\n } else data = text;\n }\n }\n if (!response.ok) throw new ApiError(response, data);\n return data as T;\n}\n\n/** Used by generated React Query hooks for HTTP failures. */\nexport type ErrorType<T> = ApiError<T>;\nexport type BodyType<T> = T;\n"],"mappings":";;AAcA,IAAa,WAAb,cAA2C,MAAM;CAC/C;CACA;CACA;CAEA,YAAY,UAAoB,MAAS;EACvC,MAAM,4BAA4B,SAAS,QAAQ;EACnD,KAAK,OAAO;EACZ,KAAK,SAAS,SAAS;EACvB,KAAK,OAAO;EACZ,KAAK,UAAU,SAAS;CAC1B;AACF;AAEA,SAAgB,aAAa,SAAgC;CAC3D,MAAM,MAAM,IAAI,IAAI,QAAQ,OAAO;CACnC,IAAI,CAAC,CAAC,UAAU,OAAO,CAAC,CAAC,SAAS,IAAI,QAAQ,KAAK,IAAI,YAAY,IAAI,YAAY,IAAI,UAAU,IAAI,QAAQ,IAAI,aAAa,KAC5H,MAAM,IAAI,UAAU,gFAAgF;CAEtG,OAAO,OAAO,OAAO;EAAE,GAAG;EAAS,SAAS,IAAI;EAAQ,SAAS,IAAI,QAAQ,QAAQ,OAAO;CAAE,CAAC;AACjG;;AAGA,eAAsB,QAAW,MAAc,UAA0B,CAAC,GAAe;CACvF,MAAM,EAAE,QAAQ,SAAS,gBAAgB,GAAG,SAAS;CACrD,MAAM,UAAU,IAAI,QAAQ,QAAQ,OAAO;CAC3C,IAAI,QAAQ,cAAc,CAAC,CAAC,SAAS,OAAO,QAAQ,QAAQ,IAAI,KAAK,KAAK,CAAC;CAC3E,MAAM,MAAM,SAAS,IAAI,IAAI,MAAM,OAAO,OAAO,IAAI,KAAA;CACrD,IAAI,UAAU,KAAK,WAAW,OAAO,SACnC,MAAM,IAAI,UAAU,uDAAuD;CAE7E,IAAI,CAAC,QA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