@learnorama/mozaik-sdk 0.3.2-staging.19.1 → 0.6.0-staging.24.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 +37 -0
- package/dist/api/account.d.ts +1 -1
- package/dist/api/account.js.map +1 -1
- package/dist/api/admin-catalogue.d.ts +1 -1
- package/dist/api/admin-catalogue.js.map +1 -1
- package/dist/api/admin-consumption.d.ts +1 -1
- package/dist/api/admin-consumption.js.map +1 -1
- package/dist/api/admin-licenses.d.ts +1 -1
- package/dist/api/admin-licenses.js.map +1 -1
- package/dist/api/admin-patrons.d.ts +1 -1
- package/dist/api/admin-patrons.js.map +1 -1
- package/dist/api/admin-reviews.d.ts +1 -1
- package/dist/api/admin-reviews.js.map +1 -1
- package/dist/api/admin-roles.d.ts +1 -1
- package/dist/api/admin-roles.js.map +1 -1
- package/dist/api/admin-support.d.ts +1 -1
- package/dist/api/admin-support.js.map +1 -1
- package/dist/api/admin-tenants.d.ts +7 -1
- package/dist/api/admin-tenants.js +19 -1
- package/dist/api/admin-tenants.js.map +1 -1
- package/dist/api/admin-tutoring.d.ts +1 -1
- package/dist/api/admin-tutoring.js.map +1 -1
- package/dist/api/auth.d.ts +7 -3
- package/dist/api/auth.js +6 -2
- package/dist/api/auth.js.map +1 -1
- package/dist/api/biblio-catalogue.d.ts +1 -1
- package/dist/api/biblio-catalogue.js.map +1 -1
- package/dist/api/biblio-home.d.ts +1 -1
- package/dist/api/biblio-home.js.map +1 -1
- package/dist/api/biblio-library.d.ts +1 -1
- package/dist/api/biblio-library.js.map +1 -1
- package/dist/api/biblio-nextory.d.ts +1 -1
- package/dist/api/biblio-nextory.js.map +1 -1
- package/dist/api/biblio-press.d.ts +1 -1
- package/dist/api/biblio-press.js.map +1 -1
- package/dist/api/biblio-search.d.ts +1 -1
- package/dist/api/biblio-search.js.map +1 -1
- package/dist/api/biblio-telemetry.d.ts +1 -1
- package/dist/api/biblio-telemetry.js.map +1 -1
- package/dist/api/consumption.d.ts +1 -1
- package/dist/api/consumption.js.map +1 -1
- package/dist/api/cvs-app.d.ts +1 -1
- package/dist/api/cvs-app.js.map +1 -1
- package/dist/api/cvs-documents.d.ts +1 -1
- package/dist/api/cvs-documents.js.map +1 -1
- package/dist/api/cvs-favorites.d.ts +1 -1
- package/dist/api/cvs-favorites.js.map +1 -1
- package/dist/api/cvs-ils.d.ts +1 -1
- package/dist/api/cvs-ils.js.map +1 -1
- package/dist/api/cvs-loans.d.ts +1 -1
- package/dist/api/cvs-loans.js.map +1 -1
- package/dist/api/cvs-payments.d.ts +1 -1
- package/dist/api/cvs-payments.js.map +1 -1
- package/dist/api/cvs-streaming.d.ts +1 -1
- package/dist/api/cvs-streaming.js.map +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +2 -2
- package/dist/api/partner-catalogue.d.ts +1 -1
- package/dist/api/partner-catalogue.js.map +1 -1
- package/dist/api/partner-reader.d.ts +1 -1
- package/dist/api/partner-reader.js.map +1 -1
- package/dist/api/profiles.d.ts +1 -1
- package/dist/api/profiles.js.map +1 -1
- package/dist/api/search.d.ts +1 -1
- package/dist/api/search.js.map +1 -1
- package/dist/api/tutoring-catalogue.d.ts +1 -1
- package/dist/api/tutoring-catalogue.js.map +1 -1
- package/dist/api/tutoring-chat.d.ts +1 -1
- package/dist/api/tutoring-chat.js.map +1 -1
- package/dist/api/tutoring-dispatch.d.ts +1 -1
- package/dist/api/tutoring-dispatch.js.map +1 -1
- package/dist/api/tutoring-practitioner.js.map +1 -1
- package/dist/api/tutoring-requests.d.ts +1 -1
- package/dist/api/tutoring-requests.js.map +1 -1
- package/dist/chunks/client2.d.ts +1 -1
- package/dist/chunks/connection.d.ts +1 -1
- package/dist/chunks/index.d.ts +184 -156
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +2 -2
- package/dist/models.js.map +1 -1
- package/dist/react/account.d.ts +1 -1
- package/dist/react/account.js +1 -1
- package/dist/react/account.js.map +1 -1
- package/dist/react/admin-catalogue.d.ts +1 -1
- package/dist/react/admin-catalogue.js +1 -1
- package/dist/react/admin-catalogue.js.map +1 -1
- package/dist/react/admin-consumption.d.ts +1 -1
- package/dist/react/admin-consumption.js +1 -1
- package/dist/react/admin-consumption.js.map +1 -1
- package/dist/react/admin-licenses.d.ts +1 -1
- package/dist/react/admin-licenses.js +1 -1
- package/dist/react/admin-licenses.js.map +1 -1
- package/dist/react/admin-patrons.d.ts +1 -1
- package/dist/react/admin-patrons.js +1 -1
- package/dist/react/admin-patrons.js.map +1 -1
- package/dist/react/admin-reviews.d.ts +1 -1
- package/dist/react/admin-reviews.js +1 -1
- package/dist/react/admin-reviews.js.map +1 -1
- package/dist/react/admin-roles.d.ts +1 -1
- package/dist/react/admin-roles.js +1 -1
- package/dist/react/admin-roles.js.map +1 -1
- package/dist/react/admin-support.d.ts +1 -1
- package/dist/react/admin-support.js +1 -1
- package/dist/react/admin-support.js.map +1 -1
- package/dist/react/admin-tenants.d.ts +34 -1
- package/dist/react/admin-tenants.js +44 -2
- package/dist/react/admin-tenants.js.map +1 -1
- package/dist/react/admin-tutoring.d.ts +1 -1
- package/dist/react/admin-tutoring.js +1 -1
- package/dist/react/admin-tutoring.js.map +1 -1
- package/dist/react/auth.d.ts +7 -3
- package/dist/react/auth.js +7 -3
- package/dist/react/auth.js.map +1 -1
- package/dist/react/biblio-catalogue.d.ts +1 -1
- package/dist/react/biblio-catalogue.js +1 -1
- package/dist/react/biblio-catalogue.js.map +1 -1
- package/dist/react/biblio-home.d.ts +1 -1
- package/dist/react/biblio-home.js +1 -1
- package/dist/react/biblio-home.js.map +1 -1
- package/dist/react/biblio-library.d.ts +1 -1
- package/dist/react/biblio-library.js +1 -1
- package/dist/react/biblio-library.js.map +1 -1
- package/dist/react/biblio-nextory.d.ts +1 -1
- package/dist/react/biblio-nextory.js +1 -1
- package/dist/react/biblio-nextory.js.map +1 -1
- package/dist/react/biblio-press.d.ts +1 -1
- package/dist/react/biblio-press.js +1 -1
- package/dist/react/biblio-press.js.map +1 -1
- package/dist/react/biblio-search.d.ts +1 -1
- package/dist/react/biblio-search.js +1 -1
- package/dist/react/biblio-search.js.map +1 -1
- package/dist/react/biblio-telemetry.d.ts +1 -1
- package/dist/react/biblio-telemetry.js +1 -1
- package/dist/react/biblio-telemetry.js.map +1 -1
- package/dist/react/chat.d.ts +1 -1
- package/dist/react/consumption.d.ts +1 -1
- package/dist/react/consumption.js +1 -1
- package/dist/react/consumption.js.map +1 -1
- package/dist/react/cvs-app.d.ts +1 -1
- package/dist/react/cvs-app.js +1 -1
- package/dist/react/cvs-app.js.map +1 -1
- package/dist/react/cvs-documents.d.ts +1 -1
- package/dist/react/cvs-documents.js +1 -1
- package/dist/react/cvs-documents.js.map +1 -1
- package/dist/react/cvs-favorites.d.ts +1 -1
- package/dist/react/cvs-favorites.js +1 -1
- package/dist/react/cvs-favorites.js.map +1 -1
- package/dist/react/cvs-ils.d.ts +1 -1
- package/dist/react/cvs-ils.js +1 -1
- package/dist/react/cvs-ils.js.map +1 -1
- package/dist/react/cvs-loans.d.ts +1 -1
- package/dist/react/cvs-loans.js +1 -1
- package/dist/react/cvs-loans.js.map +1 -1
- package/dist/react/cvs-payments.d.ts +1 -1
- package/dist/react/cvs-payments.js +1 -1
- package/dist/react/cvs-payments.js.map +1 -1
- package/dist/react/cvs-streaming.d.ts +1 -1
- package/dist/react/cvs-streaming.js +1 -1
- package/dist/react/cvs-streaming.js.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/react/partner-catalogue.d.ts +1 -1
- package/dist/react/partner-catalogue.js +1 -1
- package/dist/react/partner-catalogue.js.map +1 -1
- package/dist/react/partner-reader.d.ts +1 -1
- package/dist/react/partner-reader.js +1 -1
- package/dist/react/partner-reader.js.map +1 -1
- package/dist/react/profiles.d.ts +1 -1
- package/dist/react/profiles.js +1 -1
- package/dist/react/profiles.js.map +1 -1
- package/dist/react/search.d.ts +1 -1
- package/dist/react/search.js +1 -1
- package/dist/react/search.js.map +1 -1
- package/dist/react/tutoring-catalogue.d.ts +1 -1
- package/dist/react/tutoring-catalogue.js +1 -1
- package/dist/react/tutoring-catalogue.js.map +1 -1
- package/dist/react/tutoring-chat.d.ts +1 -1
- package/dist/react/tutoring-chat.js +1 -1
- package/dist/react/tutoring-chat.js.map +1 -1
- package/dist/react/tutoring-dispatch.d.ts +1 -1
- package/dist/react/tutoring-dispatch.js +1 -1
- package/dist/react/tutoring-dispatch.js.map +1 -1
- package/dist/react/tutoring-practitioner.d.ts +1 -1
- package/dist/react/tutoring-practitioner.js +1 -1
- package/dist/react/tutoring-practitioner.js.map +1 -1
- package/dist/react/tutoring-requests.d.ts +1 -1
- package/dist/react/tutoring-requests.js +1 -1
- package/dist/react/tutoring-requests.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tutoring-catalogue.js","names":[],"sources":["../../src/react/tutoring-catalogue/tutoring-catalogue.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.3.2\n */\nimport {\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n EducationalGoalListRead,\n HTTPExceptionResponse,\n LevelListRead,\n ListGoalsParams,\n SubjectListRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListGoalsUrl = (params?: ListGoalsParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/tutoring/goals?${stringifiedParams}` : `/tutoring/goals`\n}\n\n/**\n * Goals on offer, optionally narrowed to one request kind.\n *\n * The filter is a containment test against ``applies_to``, which is what the\n * GIN index on that column is for. The legacy asks the same question with four\n * boolean columns and a different ``WHERE`` per surface.\n * @summary List Goals\n */\nexport const listGoals = async (params?: ListGoalsParams, options?: Parameters<typeof request>[1]): Promise<EducationalGoalListRead> => {\n\n return request<EducationalGoalListRead>(getListGoalsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListGoalsQueryKey = (params?: ListGoalsParams,) => {\n return [\n `/tutoring/goals`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListGoalsQueryOptions = <TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListGoalsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listGoals>>> = ({ signal }) => listGoals(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListGoalsQueryResult = NonNullable<Awaited<ReturnType<typeof listGoals>>>\nexport type ListGoalsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListGoalsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Goals\n */\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListGoalsQueryOptions(params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getListLevelsUrl = () => {\n\n\n\n\n return `/tutoring/levels`\n}\n\n/**\n * Every school level, in teaching order rather than alphabetical.\n * @summary List Levels\n */\nexport const listLevels = async ( options?: Parameters<typeof request>[1]): Promise<LevelListRead> => {\n\n return request<LevelListRead>(getListLevelsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLevelsQueryKey = () => {\n return [\n `/tutoring/levels`\n ] as const;\n }\n\n\nexport const getListLevelsQueryOptions = <TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLevelsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLevels>>> = ({ signal }) => listLevels({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLevelsQueryResult = NonNullable<Awaited<ReturnType<typeof listLevels>>>\nexport type ListLevelsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Levels\n */\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLevelsQueryOptions(options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getListSubjectsUrl = () => {\n\n\n\n\n return `/tutoring/subjects`\n}\n\n/**\n * Every subject a pupil may ask about, in display order.\n *\n * Authenticated, though the data is not secret: the list differs by nothing\n * today, and leaving it open would make it the one tutoring endpoint that does\n * not establish a tenant. Cheap to relax later, expensive to tighten.\n * @summary List Subjects\n */\nexport const listSubjects = async ( options?: Parameters<typeof request>[1]): Promise<SubjectListRead> => {\n\n return request<SubjectListRead>(getListSubjectsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListSubjectsQueryKey = () => {\n return [\n `/tutoring/subjects`\n ] as const;\n }\n\n\nexport const getListSubjectsQueryOptions = <TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListSubjectsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listSubjects>>> = ({ signal }) => listSubjects({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListSubjectsQueryResult = NonNullable<Awaited<ReturnType<typeof listSubjects>>>\nexport type ListSubjectsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Subjects\n */\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListSubjectsQueryOptions(options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\n"],"mappings":";;;;;;;;;;;AAuCA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SA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ue.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.6.0\n */\nimport {\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n EducationalGoalListRead,\n HTTPExceptionResponse,\n LevelListRead,\n ListGoalsParams,\n SubjectListRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListGoalsUrl = (params?: ListGoalsParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/tutoring/goals?${stringifiedParams}` : `/tutoring/goals`\n}\n\n/**\n * Goals on offer, optionally narrowed to one request kind.\n *\n * The filter is a containment test against ``applies_to``, which is what the\n * GIN index on that column is for. The legacy asks the same question with four\n * boolean columns and a different ``WHERE`` per surface.\n * @summary List Goals\n */\nexport const listGoals = async (params?: ListGoalsParams, options?: Parameters<typeof request>[1]): Promise<EducationalGoalListRead> => {\n\n return request<EducationalGoalListRead>(getListGoalsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListGoalsQueryKey = (params?: ListGoalsParams,) => {\n return [\n `/tutoring/goals`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListGoalsQueryOptions = <TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListGoalsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listGoals>>> = ({ signal }) => listGoals(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListGoalsQueryResult = NonNullable<Awaited<ReturnType<typeof listGoals>>>\nexport type ListGoalsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListGoalsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Goals\n */\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListGoalsQueryOptions(params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getListLevelsUrl = () => {\n\n\n\n\n return `/tutoring/levels`\n}\n\n/**\n * Every school level, in teaching order rather than alphabetical.\n * @summary List Levels\n */\nexport const listLevels = async ( options?: Parameters<typeof request>[1]): Promise<LevelListRead> => {\n\n return request<LevelListRead>(getListLevelsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLevelsQueryKey = () => {\n return [\n `/tutoring/levels`\n ] as const;\n }\n\n\nexport const getListLevelsQueryOptions = <TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLevelsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLevels>>> = ({ signal }) => listLevels({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLevelsQueryResult = NonNullable<Awaited<ReturnType<typeof listLevels>>>\nexport type ListLevelsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Levels\n */\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLevelsQueryOptions(options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getListSubjectsUrl = () => {\n\n\n\n\n return `/tutoring/subjects`\n}\n\n/**\n * Every subject a pupil may ask about, in display order.\n *\n * Authenticated, though the data is not secret: the list differs by nothing\n * today, and leaving it open would make it the one tutoring endpoint that does\n * not establish a tenant. Cheap to relax later, expensive to tighten.\n * @summary List Subjects\n */\nexport const listSubjects = async ( options?: Parameters<typeof request>[1]): Promise<SubjectListRead> => {\n\n return request<SubjectListRead>(getListSubjectsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListSubjectsQueryKey = () => {\n return [\n `/tutoring/subjects`\n ] as const;\n }\n\n\nexport const getListSubjectsQueryOptions = <TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListSubjectsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listSubjects>>> = ({ signal }) => listSubjects({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListSubjectsQueryResult = NonNullable<Awaited<ReturnType<typeof listSubjects>>>\nexport type ListSubjectsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Subjects\n */\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListSubjectsQueryOptions(options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\n"],"mappings":";;;;;;;;;;;AAuCA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,mBAAmB,WAA8B;CAC5D,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAErD,IAAI,UAAU,KAAA,GACZ,iBAAiB,OAAO,KAAK,UAAU,OAAO,SAAS,OAAO,KAAK,CAAC;CAExE,CAAC;CAED,MAAM,oBAAoB,iBAAiB,SAAS;CAEpD,OAAO,kBAAkB,SAAS,IAAI,mBAAmB,sBAAsB;AACjF;;;;;;;;;AAUA,MAAa,YAAY,OAAO,QAA0B,YAA8E;CAEtI,OAAO,QAAiC,gBAAgB,MAAM,GAC9D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AA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,mBAAmB,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,gCAAgC;CACzC,OAAO,CACP,oBACA;AACA;AAGJ,MAAa,+BAAuJ,YAC/J;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,wBAAwB;CAIlE,MAAM,WAAoE,EAAE,aAAa,aAAa;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMpI,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,gBACd,SACC,aACiF;CAElF,MAAM,eAAe,4BAA4B,OAAO;CAExD,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { An as ListMessagesParams, dn as MessageRead, ln as MessageWrite, pi as ChatTicketRead, t as ValidationErrorResponse, un as MessagePage, wr as HTTPExceptionResponse } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
4
|
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/tutoring-chat/tutoring-chat.d.ts
|
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
9
|
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
-
* OpenAPI spec version: 0.
|
|
10
|
+
* OpenAPI spec version: 0.6.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tutoring-chat.js","names":[],"sources":["../../src/react/tutoring-chat/tutoring-chat.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.3.2\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n ChatTicketRead,\n HTTPExceptionResponse,\n ListMessagesParams,\n MessagePage,\n MessageRead,\n MessageWrite,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getMintChatTicketUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/chat/ticket`\n}\n\n/**\n * A single-use credential for opening the socket from a browser.\n *\n * Authenticated the ordinary way, with the ordinary bearer token, because this\n * is an ordinary HTTP request. What it returns is what goes in the socket URL.\n * @summary Mint Chat Ticket\n */\nexport const mintChatTicket = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<ChatTicketRead> => {\n\n return request<ChatTicketRead>(getMintChatTicketUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getMintChatTicketMutationKey = () => ['mintChatTicket'] as const;\n\nexport const getMintChatTicketMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext> => {\n\nconst mutationKey = getMintChatTicketMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof mintChatTicket>>, MintChatTicketMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return mintChatTicket(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type MintChatTicketMutationResult = NonNullable<Awaited<ReturnType<typeof mintChatTicket>>>\n\n export type MintChatTicketMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type MintChatTicketMutationVariables = {requestId: number}\n\n /**\n * @summary Mint Chat Ticket\n */\nexport const useMintChatTicket = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof mintChatTicket>>,\n TError,\n MintChatTicketMutationVariables,\n TContext\n > => {\n return useMutation(getMintChatTicketMutationOptions(options), queryClient);\n }\n export const getListMessagesUrl = (requestId: number,\n params?: ListMessagesParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/tutoring/requests/${requestId}/messages?${stringifiedParams}` : `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * The conversation so far, newest first.\n *\n * One extra row is fetched to answer ``hasMore`` without a second count. A\n * ``COUNT(*)`` over a thread on every scroll is a table scan for a number no\n * interface displays.\n * @summary List Messages\n */\nexport const listMessages = async (requestId: number,\n params?: ListMessagesParams, options?: Parameters<typeof request>[1]): Promise<MessagePage> => {\n\n return request<MessagePage>(getListMessagesUrl(requestId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListMessagesQueryKey = (requestId: number,\n params?: ListMessagesParams,) => {\n return [\n `/tutoring/requests/${requestId}/messages`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListMessagesQueryOptions = <TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListMessagesQueryKey(requestId,params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listMessages>>> = ({ signal }) => listMessages(requestId,params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: requestId !== null && requestId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListMessagesQueryResult = NonNullable<Awaited<ReturnType<typeof listMessages>>>\nexport type ListMessagesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params: undefined | ListMessagesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMessages>>,\n TError,\n Awaited<ReturnType<typeof listMessages>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMessages>>,\n TError,\n Awaited<ReturnType<typeof listMessages>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Messages\n */\n\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListMessagesQueryOptions(requestId,params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getSendMessageUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * Say something, without holding a socket open.\n * @summary Send Message\n */\nexport const sendMessage = async (requestId: number,\n messageWrite: MessageWrite, options?: Parameters<typeof request>[1]): Promise<MessageRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<MessageRead>(getSendMessageUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(messageWrite)\n }\n);}\n\n\n\n\n\nexport const getSendMessageMutationKey = () => ['sendMessage'] as const;\n\nexport const getSendMessageMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext> => {\n\nconst mutationKey = getSendMessageMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof sendMessage>>, SendMessageMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return sendMessage(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type SendMessageMutationResult = NonNullable<Awaited<ReturnType<typeof sendMessage>>>\n export type SendMessageMutationBody = BodyType<MessageWrite>\n export type SendMessageMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type SendMessageMutationVariables = {requestId: number;data: BodyType<MessageWrite>}\n\n /**\n * @summary Send Message\n */\nexport const useSendMessage = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof sendMessage>>,\n TError,\n SendMessageMutationVariables,\n TContext\n > => {\n return useMutation(getSendMessageMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA4CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,wBAAwB,cAAuB;CAK1D,OAAO,sBAAsB,UAAU;AACzC;;;;;;;;AASA,MAAa,iBAAiB,OAAO,WAAmB,YAAqE;CAE3H,OAAO,QAAwB,qBAAqB,SAAS,GAC7D;EACE,GAAG;EACH,QAAQ;CAGV,CACF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mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAAuG,UAAU;EACnH,MAAM,EAAC,WAAU,SAAQ,SAAS,CAAC;EAEnC,OAAQ,YAAY,WAAU,MAAK,cAAc;CACnD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,kBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,8BAA8B,OAAO,GAAG,WAAW;AACxE"}
|
|
1
|
+
{"version":3,"file":"tutoring-chat.js","names":[],"sources":["../../src/react/tutoring-chat/tutoring-chat.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.6.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n ChatTicketRead,\n HTTPExceptionResponse,\n ListMessagesParams,\n MessagePage,\n MessageRead,\n MessageWrite,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getMintChatTicketUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/chat/ticket`\n}\n\n/**\n * A single-use credential for opening the socket from a browser.\n *\n * Authenticated the ordinary way, with the ordinary bearer token, because this\n * is an ordinary HTTP request. What it returns is what goes in the socket URL.\n * @summary Mint Chat Ticket\n */\nexport const mintChatTicket = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<ChatTicketRead> => {\n\n return request<ChatTicketRead>(getMintChatTicketUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getMintChatTicketMutationKey = () => ['mintChatTicket'] as const;\n\nexport const getMintChatTicketMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext> => {\n\nconst mutationKey = getMintChatTicketMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof mintChatTicket>>, MintChatTicketMutationVariables> = (props) => {\n const {requestId} = props ?? {};\n\n return mintChatTicket(requestId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type MintChatTicketMutationResult = NonNullable<Awaited<ReturnType<typeof mintChatTicket>>>\n\n export type MintChatTicketMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type MintChatTicketMutationVariables = {requestId: number}\n\n /**\n * @summary Mint Chat Ticket\n */\nexport const useMintChatTicket = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof mintChatTicket>>, TError,MintChatTicketMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof mintChatTicket>>,\n TError,\n MintChatTicketMutationVariables,\n TContext\n > => {\n return useMutation(getMintChatTicketMutationOptions(options), queryClient);\n }\n export const getListMessagesUrl = (requestId: number,\n params?: ListMessagesParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/tutoring/requests/${requestId}/messages?${stringifiedParams}` : `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * The conversation so far, newest first.\n *\n * One extra row is fetched to answer ``hasMore`` without a second count. A\n * ``COUNT(*)`` over a thread on every scroll is a table scan for a number no\n * interface displays.\n * @summary List Messages\n */\nexport const listMessages = async (requestId: number,\n params?: ListMessagesParams, options?: Parameters<typeof request>[1]): Promise<MessagePage> => {\n\n return request<MessagePage>(getListMessagesUrl(requestId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListMessagesQueryKey = (requestId: number,\n params?: ListMessagesParams,) => {\n return [\n `/tutoring/requests/${requestId}/messages`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListMessagesQueryOptions = <TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListMessagesQueryKey(requestId,params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listMessages>>> = ({ signal }) => listMessages(requestId,params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: requestId !== null && requestId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListMessagesQueryResult = NonNullable<Awaited<ReturnType<typeof listMessages>>>\nexport type ListMessagesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params: undefined | ListMessagesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMessages>>,\n TError,\n Awaited<ReturnType<typeof listMessages>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMessages>>,\n TError,\n Awaited<ReturnType<typeof listMessages>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Messages\n */\n\nexport function useListMessages<TData = Awaited<ReturnType<typeof listMessages>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n requestId: number,\n params?: ListMessagesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMessages>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListMessagesQueryOptions(requestId,params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getSendMessageUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * Say something, without holding a socket open.\n * @summary Send Message\n */\nexport const sendMessage = async (requestId: number,\n messageWrite: MessageWrite, options?: Parameters<typeof request>[1]): Promise<MessageRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<MessageRead>(getSendMessageUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(messageWrite)\n }\n);}\n\n\n\n\n\nexport const getSendMessageMutationKey = () => ['sendMessage'] as const;\n\nexport const getSendMessageMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext> => {\n\nconst mutationKey = getSendMessageMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof sendMessage>>, SendMessageMutationVariables> = (props) => {\n const {requestId,data} = props ?? {};\n\n return sendMessage(requestId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type SendMessageMutationResult = NonNullable<Awaited<ReturnType<typeof sendMessage>>>\n export type SendMessageMutationBody = BodyType<MessageWrite>\n export type SendMessageMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type SendMessageMutationVariables = {requestId: number;data: BodyType<MessageWrite>}\n\n /**\n * @summary Send Message\n */\nexport const useSendMessage = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendMessage>>, TError,SendMessageMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof sendMessage>>,\n TError,\n SendMessageMutationVariables,\n TContext\n > => {\n return useMutation(getSendMessageMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA4CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS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,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAqB,kBAAkB,SAAS,GACrD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,YAAY;CACnC,CACF;AAAE;AAMF,MAAa,kCAAkC,CAAC,aAAa;AAE7D,MAAa,iCACW,YACyF;CAEjH,MAAM,cAAc,0BAA0B;CAC9C,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAAuG,UAAU;EACnH,MAAM,EAAC,WAAU,SAAQ,SAAS,CAAC;EAEnC,OAAQ,YAAY,WAAU,MAAK,cAAc;CACnD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,kBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,8BAA8B,OAAO,GAAG,WAAW;AACxE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { _ as TutoringDispatchWrite, d as TutoringQueuePage, t as ValidationErrorResponse, wn as ListQueueParams, wr as HTTPExceptionResponse } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
4
|
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/tutoring-dispatch/tutoring-dispatch.d.ts
|
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
9
|
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
-
* OpenAPI spec version: 0.
|
|
10
|
+
* OpenAPI spec version: 0.6.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -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.3.2\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n 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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AgB,WAAU,MAAK,cAAc;CACvD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,sBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,kCAAkC,OAAO,GAAG,WAAW;AAC5E;AACA,MAAa,uBAAuB,cAAuB;CAK7D,OAAO,sBAAsB,UAAU;AACzC;;;;;;;;;AAUA,MAAa,gBAAgB,OAAO,WAAmB,YAA2D;CAEhH,OAAO,QAAc,oBAAoB,SAAS,GAClD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,oCAAoC,CAAC,eAAe;AAEjE,MAAa,mCACW,YAC6F;CAErH,MAAM,cAAc,4BAA4B;CAChD,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAA2G,UAAU;EACvH,MAAM,EAAC,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
|
+
{"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.6.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,SA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H,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,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { S as TutoringAnswerWrite, i as TutoringRoomRead, t as ValidationErrorResponse, wr as HTTPExceptionResponse, y as TutoringCloseWrite } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
4
|
import { QueryClient, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/tutoring-practitioner/tutoring-practitioner.d.ts
|
|
@@ -7,7 +7,7 @@ import { useMutation } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
9
|
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
-
* OpenAPI spec version: 0.
|
|
10
|
+
* OpenAPI spec version: 0.6.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.3.2\n */\nimport {\n useMutation\n} from '@tanstack/react-query';\nimport type {\n MutationFunction,\n QueryClient,\n UseMutationOptions,\n UseMutationResult\n} from '@tanstack/react-query';\n\nimport type {\n 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,MA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AC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAAyG,UAAU;EACrH,MAAM,EAAC,WAAU,SAAQ,SAAS,CAAC;EAEnC,OAAQ,aAAa,WAAU,MAAK,cAAc;CACpD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,mBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,+BAA+B,OAAO,GAAG,WAAW;AACzE;AACA,MAAa,kBAAkB,cAAuB;CAKxD,OAAO,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
|
+
{"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.6.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,G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5C,MAAa,eACW,SACrB,gBAKQ;CACL,OAAO,YAAY,2BAA2B,OAAO,GAAG,WAAW;AACrE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
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
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
|
|
@@ -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.6.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|