@learnorama/mozaik-sdk 0.19.0-staging.60.1 → 0.20.2-staging.63.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/COURSES.md +18 -1
- package/CUSTOMER-ADMIN.md +7 -0
- package/CVS-PLAYBACK.md +9 -1
- package/FRONTEND-REQUESTS.md +17 -2
- package/OFFLINE.md +90 -0
- package/PRESS.md +42 -2
- package/README.md +7 -4
- package/dist/api/account.d.ts +1 -1
- package/dist/api/account.js.map +1 -1
- package/dist/api/admin-catalogue.d.ts +2 -2
- package/dist/api/admin-catalogue.js +1 -1
- package/dist/api/admin-catalogue.js.map +1 -1
- package/dist/api/admin-consumption.d.ts +1 -1
- package/dist/api/admin-consumption.js.map +1 -1
- package/dist/api/admin-contracts.d.ts +1 -1
- package/dist/api/admin-contracts.js.map +1 -1
- package/dist/api/admin-customer.d.ts +19 -2
- package/dist/api/admin-customer.js +38 -2
- package/dist/api/admin-customer.js.map +1 -1
- package/dist/api/admin-desk.d.ts +91 -1
- package/dist/api/admin-desk.js +255 -1
- package/dist/api/admin-desk.js.map +1 -1
- package/dist/api/admin-licenses.d.ts +1 -1
- package/dist/api/admin-licenses.js.map +1 -1
- package/dist/api/admin-partner-selections.d.ts +1 -1
- package/dist/api/admin-partner-selections.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 +1 -1
- package/dist/api/admin-tenants.js.map +1 -1
- package/dist/api/admin-tutoring.d.ts +1 -1
- package/dist/api/admin-tutoring.js.map +1 -1
- package/dist/api/admin-vod.d.ts +1 -1
- package/dist/api/admin-vod.js.map +1 -1
- package/dist/api/auth-device.d.ts +1 -1
- package/dist/api/auth-device.js.map +1 -1
- package/dist/api/auth.d.ts +1 -1
- package/dist/api/auth.js.map +1 -1
- package/dist/api/biblio-billing-webhooks.d.ts +1 -1
- package/dist/api/biblio-billing-webhooks.js.map +1 -1
- package/dist/api/biblio-billing.d.ts +1 -1
- package/dist/api/biblio-billing.js.map +1 -1
- package/dist/api/biblio-catalogue.d.ts +7 -1
- package/dist/api/biblio-catalogue.js +14 -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-learning-author-profiles.d.ts +1 -1
- package/dist/api/biblio-learning-author-profiles.js.map +1 -1
- package/dist/api/biblio-learning-authoring.d.ts +1 -1
- package/dist/api/biblio-learning-authoring.js.map +1 -1
- package/dist/api/biblio-learning-editorial.d.ts +1 -1
- package/dist/api/biblio-learning-editorial.js.map +1 -1
- package/dist/api/biblio-learning-feedback.d.ts +1 -1
- package/dist/api/biblio-learning-feedback.js.map +1 -1
- package/dist/api/biblio-learning-finance.d.ts +1 -1
- package/dist/api/biblio-learning-finance.js.map +1 -1
- package/dist/api/biblio-learning-integrations.d.ts +1 -1
- package/dist/api/biblio-learning-integrations.js.map +1 -1
- package/dist/api/biblio-learning-membership.d.ts +1 -1
- package/dist/api/biblio-learning-membership.js.map +1 -1
- package/dist/api/biblio-learning.d.ts +1 -1
- package/dist/api/biblio-learning.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 +19 -1
- package/dist/api/biblio-press.js +40 -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/biblio-youscribe.d.ts +1 -1
- package/dist/api/biblio-youscribe.js.map +1 -1
- package/dist/api/consumption.d.ts +19 -1
- package/dist/api/consumption.js +53 -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 +7 -1
- package/dist/api/cvs-loans.js +27 -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 +16 -1
- package/dist/api/cvs-streaming.js +43 -1
- package/dist/api/cvs-streaming.js.map +1 -1
- package/dist/api/index.d.ts +11 -11
- package/dist/api/index.js +11 -11
- package/dist/api/partner-catalogue.d.ts +39 -5
- package/dist/api/partner-catalogue.js +71 -6
- package/dist/api/partner-catalogue.js.map +1 -1
- package/dist/api/partner-reader-nextory.d.ts +30 -12
- package/dist/api/partner-reader-nextory.js +70 -12
- package/dist/api/partner-reader-nextory.js.map +1 -1
- package/dist/api/partner-reader-youscribe.d.ts +13 -1
- package/dist/api/partner-reader-youscribe.js +27 -1
- package/dist/api/partner-reader-youscribe.js.map +1 -1
- package/dist/api/partner-reading.d.ts +1 -1
- package/dist/api/partner-reading.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.d.ts +1 -1
- package/dist/api/tutoring-practitioner.js.map +1 -1
- package/dist/api/tutoring-requests.d.ts +1 -1
- package/dist/api/tutoring-requests.js.map +1 -1
- package/dist/auth.d.ts +2 -33
- package/dist/auth.js +8 -2
- package/dist/auth.js.map +1 -1
- package/dist/chunks/client2.d.ts +2 -2
- package/dist/chunks/connection.d.ts +1 -1
- package/dist/chunks/index.d.ts +2005 -700
- package/dist/chunks/index2.d.ts +34 -0
- 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 +162 -3
- package/dist/models.js.map +1 -1
- package/dist/offline.d.ts +42 -0
- package/dist/offline.js +353 -0
- package/dist/offline.js.map +1 -0
- 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 +2 -2
- package/dist/react/admin-catalogue.js +2 -2
- package/dist/react/admin-catalogue.js.map +1 -1
- package/dist/react/admin-consumption.d.ts +1 -1
- package/dist/react/admin-consumption.js +1 -1
- package/dist/react/admin-consumption.js.map +1 -1
- package/dist/react/admin-contracts.d.ts +1 -1
- package/dist/react/admin-contracts.js +1 -1
- package/dist/react/admin-contracts.js.map +1 -1
- package/dist/react/admin-customer.d.ts +73 -2
- package/dist/react/admin-customer.js +87 -3
- package/dist/react/admin-customer.js.map +1 -1
- package/dist/react/admin-desk.d.ts +352 -1
- package/dist/react/admin-desk.js +536 -2
- package/dist/react/admin-desk.js.map +1 -1
- package/dist/react/admin-licenses.d.ts +1 -1
- package/dist/react/admin-licenses.js +1 -1
- package/dist/react/admin-licenses.js.map +1 -1
- package/dist/react/admin-partner-selections.d.ts +1 -1
- package/dist/react/admin-partner-selections.js +1 -1
- package/dist/react/admin-partner-selections.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 +1 -1
- package/dist/react/admin-tenants.js +1 -1
- 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/admin-vod.d.ts +1 -1
- package/dist/react/admin-vod.js +1 -1
- package/dist/react/admin-vod.js.map +1 -1
- package/dist/react/auth-device.d.ts +1 -1
- package/dist/react/auth-device.js +1 -1
- package/dist/react/auth-device.js.map +1 -1
- package/dist/react/auth.d.ts +1 -1
- package/dist/react/auth.js +1 -1
- package/dist/react/auth.js.map +1 -1
- package/dist/react/biblio-billing-webhooks.d.ts +1 -1
- package/dist/react/biblio-billing-webhooks.js +1 -1
- package/dist/react/biblio-billing-webhooks.js.map +1 -1
- package/dist/react/biblio-billing.d.ts +1 -1
- package/dist/react/biblio-billing.js +1 -1
- package/dist/react/biblio-billing.js.map +1 -1
- package/dist/react/biblio-catalogue.d.ts +24 -1
- package/dist/react/biblio-catalogue.js +43 -2
- 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-learning-author-profiles.d.ts +1 -1
- package/dist/react/biblio-learning-author-profiles.js +1 -1
- package/dist/react/biblio-learning-author-profiles.js.map +1 -1
- package/dist/react/biblio-learning-authoring.d.ts +1 -1
- package/dist/react/biblio-learning-authoring.js +1 -1
- package/dist/react/biblio-learning-authoring.js.map +1 -1
- package/dist/react/biblio-learning-editorial.d.ts +1 -1
- package/dist/react/biblio-learning-editorial.js +1 -1
- package/dist/react/biblio-learning-editorial.js.map +1 -1
- package/dist/react/biblio-learning-feedback.d.ts +1 -1
- package/dist/react/biblio-learning-feedback.js +1 -1
- package/dist/react/biblio-learning-feedback.js.map +1 -1
- package/dist/react/biblio-learning-finance.d.ts +1 -1
- package/dist/react/biblio-learning-finance.js +1 -1
- package/dist/react/biblio-learning-finance.js.map +1 -1
- package/dist/react/biblio-learning-integrations.d.ts +1 -1
- package/dist/react/biblio-learning-integrations.js +1 -1
- package/dist/react/biblio-learning-integrations.js.map +1 -1
- package/dist/react/biblio-learning-membership.d.ts +1 -1
- package/dist/react/biblio-learning-membership.js +1 -1
- package/dist/react/biblio-learning-membership.js.map +1 -1
- package/dist/react/biblio-learning.d.ts +1 -1
- package/dist/react/biblio-learning.js +1 -1
- package/dist/react/biblio-learning.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 +91 -1
- package/dist/react/biblio-press.js +118 -2
- 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/biblio-youscribe.d.ts +1 -1
- package/dist/react/biblio-youscribe.js +1 -1
- package/dist/react/biblio-youscribe.js.map +1 -1
- package/dist/react/chat.d.ts +1 -1
- package/dist/react/consumption.d.ts +85 -3
- package/dist/react/consumption.js +148 -3
- 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 +26 -1
- package/dist/react/cvs-loans.js +56 -2
- 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 +62 -1
- package/dist/react/cvs-streaming.js +97 -2
- package/dist/react/cvs-streaming.js.map +1 -1
- package/dist/react/index.d.ts +11 -11
- package/dist/react/index.js +11 -11
- package/dist/react/partner-catalogue.d.ts +121 -6
- package/dist/react/partner-catalogue.js +147 -7
- package/dist/react/partner-catalogue.js.map +1 -1
- package/dist/react/partner-reader-nextory.d.ts +69 -12
- package/dist/react/partner-reader-nextory.js +128 -13
- package/dist/react/partner-reader-nextory.js.map +1 -1
- package/dist/react/partner-reader-youscribe.d.ts +57 -1
- package/dist/react/partner-reader-youscribe.js +80 -2
- package/dist/react/partner-reader-youscribe.js.map +1 -1
- package/dist/react/partner-reading.d.ts +1 -1
- package/dist/react/partner-reading.js +1 -1
- package/dist/react/partner-reading.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 +13 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cvs-loans.js","names":[],"sources":["../../src/react/cvs-loans/cvs-loans.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.19.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 BorrowWrite,\n HTTPExceptionResponse,\n ListLoansParams,\n LoanPage,\n LoanRead,\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 getListLoansUrl = (params?: ListLoansParams,) => {\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 ? `/cvs/loans?${stringifiedParams}` : `/cvs/loans`\n}\n\n/**\n * What this caller currently holds (and optionally what they have returned).\n *\n * Replaces ``/download/details``, which took a ``downloadid`` and answered about\n * one loan at a time — so a client rebuilding its shelf after reinstalling made\n * one request per title, and had no way to discover the ids in the first place.\n * @summary List Loans\n */\nexport const listLoans = async (params?: ListLoansParams, options?: Parameters<typeof request>[1]): Promise<LoanPage> => {\n\n return request<LoanPage>(getListLoansUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLoansQueryKey = (params?: ListLoansParams,) => {\n return [\n `/cvs/loans`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListLoansQueryOptions = <TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLoansQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLoans>>> = ({ signal }) => listLoans(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLoansQueryResult = NonNullable<Awaited<ReturnType<typeof listLoans>>>\nexport type ListLoansQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListLoansParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLoans>>,\n TError,\n Awaited<ReturnType<typeof listLoans>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLoans>>,\n TError,\n Awaited<ReturnType<typeof listLoans>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Loans\n */\n\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLoansQueryOptions(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 getBorrowUrl = () => {\n\n\n\n\n return `/cvs/loans`\n}\n\n/**\n * Borrow a work.\n *\n * The order matters and is the whole point of the entitlement model:\n *\n * 1. **Entitled?** — is this act permitted on this work under a live contract.\n * 2. **A seat free?** — ``max_concurrent`` counted from unreturned loans.\n * 3. **Units left?** — reserved in Redis *before* the row is written, so a\n * refusal costs no database work.\n * 4. **Append.** The ledger row is the loan.\n *\n * Idempotent on ``request_key``: a retried borrow returns the loan the first\n * attempt created rather than taking a second copy of the same title.\n * @summary Borrow\n */\nexport const borrow = async (borrowWrite: BorrowWrite, options?: Parameters<typeof request>[1]): Promise<LoanRead> => {\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<LoanRead>(getBorrowUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(borrowWrite)\n }\n);}\n\n\n\n\n\nexport const getBorrowMutationKey = () => ['borrow'] as const;\n\nexport const getBorrowMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError,BorrowMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError,BorrowMutationVariables, TContext> => {\n\nconst mutationKey = getBorrowMutationKey();\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 borrow>>, BorrowMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return borrow(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type BorrowMutationResult = NonNullable<Awaited<ReturnType<typeof borrow>>>\n export type BorrowMutationBody = BodyType<BorrowWrite>\n export type BorrowMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type BorrowMutationVariables = {data: BodyType<BorrowWrite>}\n\n /**\n * @summary Borrow\n */\nexport const useBorrow = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError,BorrowMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof borrow>>,\n TError,\n BorrowMutationVariables,\n TContext\n > => {\n return useMutation(getBorrowMutationOptions(options), queryClient);\n }\n export const getReturnLoanUrl = (loanId: number,) => {\n\n\n\n\n return `/cvs/loans/${loanId}`\n}\n\n/**\n * Give a loan back early, freeing its seat. Idempotent.\n *\n * Returning something already returned is ``204``: the caller wanted it back on\n * the shelf and it is on the shelf. The legacy answered an error, which meant a\n * retried return looked like a failure and clients stopped retrying.\n *\n * The unit stays spent — see the module docstring. Only the seat comes back.\n * @summary Return Loan\n */\nexport const returnLoan = async (loanId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getReturnLoanUrl(loanId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getReturnLoanMutationKey = () => ['returnLoan'] as const;\n\nexport const getReturnLoanMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError,ReturnLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError,ReturnLoanMutationVariables, TContext> => {\n\nconst mutationKey = getReturnLoanMutationKey();\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 returnLoan>>, ReturnLoanMutationVariables> = (props) => {\n const {loanId} = props ?? {};\n\n return returnLoan(loanId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ReturnLoanMutationResult = NonNullable<Awaited<ReturnType<typeof returnLoan>>>\n\n export type ReturnLoanMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ReturnLoanMutationVariables = {loanId: number}\n\n /**\n * @summary Return Loan\n */\nexport const useReturnLoan = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError,ReturnLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof returnLoan>>,\n TError,\n ReturnLoanMutationVariables,\n TContext\n > => {\n return useMutation(getReturnLoanMutationOptions(options), queryClient);\n }\n export const getExtendLoanUrl = (loanId: number,) => {\n\n\n\n\n return `/cvs/loans/${loanId}/extensions`\n}\n\n/**\n * Prolong a loan.\n *\n * Bounded by the grant's ``max_extensions`` — the legacy's ``nb_extend`` — and\n * refused once the loan has been returned or has lapsed. Extending something\n * that already expired is not an extension, it is a new loan, and it should\n * spend a new unit rather than quietly avoid one.\n *\n * Not idempotent, deliberately: two extension requests mean two extensions, and\n * a client that wants exactly one should not send two.\n * @summary Extend Loan\n */\nexport const extendLoan = async (loanId: number, options?: Parameters<typeof request>[1]): Promise<LoanRead> => {\n\n return request<LoanRead>(getExtendLoanUrl(loanId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getExtendLoanMutationKey = () => ['extendLoan'] as const;\n\nexport const getExtendLoanMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError,ExtendLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError,ExtendLoanMutationVariables, TContext> => {\n\nconst mutationKey = getExtendLoanMutationKey();\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 extendLoan>>, ExtendLoanMutationVariables> = (props) => {\n const {loanId} = props ?? {};\n\n return extendLoan(loanId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ExtendLoanMutationResult = NonNullable<Awaited<ReturnType<typeof extendLoan>>>\n\n export type ExtendLoanMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ExtendLoanMutationVariables = {loanId: number}\n\n /**\n * @summary Extend Loan\n */\nexport const useExtendLoan = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError,ExtendLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof extendLoan>>,\n TError,\n ExtendLoanMutationVariables,\n TContext\n > => {\n return useMutation(getExtendLoanMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,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,cAAc,sBAAsB;AAC5E;;;;;;;;;AAUA,MAAa,YAAY,OAAO,QAA0B,YAA+D;CAEvH,OAAO,QAAkB,gBAAgB,MAAM,GAC/C;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,wBAAwB,WAA8B;CAC/D,OAAO,CACP,cAAc,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CACvC;AACA;AAGJ,MAAa,4BAAgJ,QAA0B,YAClL;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,qBAAqB,MAAM;CAIrE,MAAM,WAAiE,EAAE,aAAa,UAAU,QAAQ;EAAE;EAAQ,GAAG;CAAe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vD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAAqG,UAAU;EACjH,MAAM,EAAC,WAAU,SAAS,CAAC;EAE3B,OAAQ,WAAW,QAAO,cAAc;CAC1C;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,iBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,6BAA6B,OAAO,GAAG,WAAW;AACvE"}
|
|
1
|
+
{"version":3,"file":"cvs-loans.js","names":[],"sources":["../../src/react/cvs-loans/cvs-loans.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.20.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 BorrowWrite,\n FilmDownloadRead,\n FilmDownloadWrite,\n HTTPExceptionResponse,\n ListLoansParams,\n LoanPage,\n LoanRead,\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 getListLoansUrl = (params?: ListLoansParams,) => {\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 ? `/cvs/loans?${stringifiedParams}` : `/cvs/loans`\n}\n\n/**\n * What this caller currently holds (and optionally what they have returned).\n *\n * Replaces ``/download/details``, which took a ``downloadid`` and answered about\n * one loan at a time — so a client rebuilding its shelf after reinstalling made\n * one request per title, and had no way to discover the ids in the first place.\n * @summary List Loans\n */\nexport const listLoans = async (params?: ListLoansParams, options?: Parameters<typeof request>[1]): Promise<LoanPage> => {\n\n return request<LoanPage>(getListLoansUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLoansQueryKey = (params?: ListLoansParams,) => {\n return [\n `/cvs/loans`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListLoansQueryOptions = <TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLoansQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLoans>>> = ({ signal }) => listLoans(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLoansQueryResult = NonNullable<Awaited<ReturnType<typeof listLoans>>>\nexport type ListLoansQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListLoansParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLoans>>,\n TError,\n Awaited<ReturnType<typeof listLoans>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLoans>>,\n TError,\n Awaited<ReturnType<typeof listLoans>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Loans\n */\n\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLoansQueryOptions(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 getBorrowUrl = () => {\n\n\n\n\n return `/cvs/loans`\n}\n\n/**\n * Borrow a work.\n *\n * The order matters and is the whole point of the entitlement model:\n *\n * 1. **Entitled?** — is this act permitted on this work under a live contract.\n * 2. **A seat free?** — ``max_concurrent`` counted from unreturned loans.\n * 3. **Units left?** — reserved in Redis *before* the row is written, so a\n * refusal costs no database work.\n * 4. **Append.** The ledger row is the loan.\n *\n * Idempotent on ``request_key``: a retried borrow returns the loan the first\n * attempt created rather than taking a second copy of the same title.\n * @summary Borrow\n */\nexport const borrow = async (borrowWrite: BorrowWrite, options?: Parameters<typeof request>[1]): Promise<LoanRead> => {\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<LoanRead>(getBorrowUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(borrowWrite)\n }\n);}\n\n\n\n\n\nexport const getBorrowMutationKey = () => ['borrow'] as const;\n\nexport const getBorrowMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError,BorrowMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError,BorrowMutationVariables, TContext> => {\n\nconst mutationKey = getBorrowMutationKey();\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 borrow>>, BorrowMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return borrow(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type BorrowMutationResult = NonNullable<Awaited<ReturnType<typeof borrow>>>\n export type BorrowMutationBody = BodyType<BorrowWrite>\n export type BorrowMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type BorrowMutationVariables = {data: BodyType<BorrowWrite>}\n\n /**\n * @summary Borrow\n */\nexport const useBorrow = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError,BorrowMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof borrow>>,\n TError,\n BorrowMutationVariables,\n TContext\n > => {\n return useMutation(getBorrowMutationOptions(options), queryClient);\n }\n export const getReturnLoanUrl = (loanId: number,) => {\n\n\n\n\n return `/cvs/loans/${loanId}`\n}\n\n/**\n * Give a loan back early, freeing its seat. Idempotent.\n *\n * Returning something already returned is ``204``: the caller wanted it back on\n * the shelf and it is on the shelf. The legacy answered an error, which meant a\n * retried return looked like a failure and clients stopped retrying.\n *\n * The unit stays spent — see the module docstring. Only the seat comes back.\n * @summary Return Loan\n */\nexport const returnLoan = async (loanId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getReturnLoanUrl(loanId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getReturnLoanMutationKey = () => ['returnLoan'] as const;\n\nexport const getReturnLoanMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError,ReturnLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError,ReturnLoanMutationVariables, TContext> => {\n\nconst mutationKey = getReturnLoanMutationKey();\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 returnLoan>>, ReturnLoanMutationVariables> = (props) => {\n const {loanId} = props ?? {};\n\n return returnLoan(loanId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ReturnLoanMutationResult = NonNullable<Awaited<ReturnType<typeof returnLoan>>>\n\n export type ReturnLoanMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ReturnLoanMutationVariables = {loanId: number}\n\n /**\n * @summary Return Loan\n */\nexport const useReturnLoan = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError,ReturnLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof returnLoan>>,\n TError,\n ReturnLoanMutationVariables,\n TContext\n > => {\n return useMutation(getReturnLoanMutationOptions(options), queryClient);\n }\n export const getAcquireFilmDownloadUrl = (loanId: number,) => {\n\n\n\n\n return `/cvs/loans/${loanId}/downloads`\n}\n\n/**\n * Pin a single device and asset revision under a loan_download. Charges no additional credit.\n * @summary Acquire Film Download\n */\nexport const acquireFilmDownload = async (loanId: number,\n filmDownloadWrite: FilmDownloadWrite, options?: Parameters<typeof request>[1]): Promise<FilmDownloadRead> => {\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<FilmDownloadRead>(getAcquireFilmDownloadUrl(loanId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(filmDownloadWrite)\n }\n);}\n\n\n\n\n\nexport const getAcquireFilmDownloadMutationKey = () => ['acquireFilmDownload'] as const;\n\nexport const getAcquireFilmDownloadMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof acquireFilmDownload>>, TError,AcquireFilmDownloadMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof acquireFilmDownload>>, TError,AcquireFilmDownloadMutationVariables, TContext> => {\n\nconst mutationKey = getAcquireFilmDownloadMutationKey();\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 acquireFilmDownload>>, AcquireFilmDownloadMutationVariables> = (props) => {\n const {loanId,data} = props ?? {};\n\n return acquireFilmDownload(loanId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AcquireFilmDownloadMutationResult = NonNullable<Awaited<ReturnType<typeof acquireFilmDownload>>>\n export type AcquireFilmDownloadMutationBody = BodyType<FilmDownloadWrite>\n export type AcquireFilmDownloadMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type AcquireFilmDownloadMutationVariables = {loanId: number;data: BodyType<FilmDownloadWrite>}\n\n /**\n * @summary Acquire Film Download\n */\nexport const useAcquireFilmDownload = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof acquireFilmDownload>>, TError,AcquireFilmDownloadMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof acquireFilmDownload>>,\n TError,\n AcquireFilmDownloadMutationVariables,\n TContext\n > => {\n return useMutation(getAcquireFilmDownloadMutationOptions(options), queryClient);\n }\n export const getExtendLoanUrl = (loanId: number,) => {\n\n\n\n\n return `/cvs/loans/${loanId}/extensions`\n}\n\n/**\n * Prolong a loan.\n *\n * Bounded by the grant's ``max_extensions`` — the legacy's ``nb_extend`` — and\n * refused once the loan has been returned or has lapsed. Extending something\n * that already expired is not an extension, it is a new loan, and it should\n * spend a new unit rather than quietly avoid one.\n *\n * Not idempotent, deliberately: two extension requests mean two extensions, and\n * a client that wants exactly one should not send two.\n * @summary Extend Loan\n */\nexport const extendLoan = async (loanId: number, options?: Parameters<typeof request>[1]): Promise<LoanRead> => {\n\n return request<LoanRead>(getExtendLoanUrl(loanId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getExtendLoanMutationKey = () => ['extendLoan'] as const;\n\nexport const getExtendLoanMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError,ExtendLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError,ExtendLoanMutationVariables, TContext> => {\n\nconst mutationKey = getExtendLoanMutationKey();\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 extendLoan>>, ExtendLoanMutationVariables> = (props) => {\n const {loanId} = props ?? {};\n\n return extendLoan(loanId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ExtendLoanMutationResult = NonNullable<Awaited<ReturnType<typeof extendLoan>>>\n\n export type ExtendLoanMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ExtendLoanMutationVariables = {loanId: number}\n\n /**\n * @summary Extend Loan\n */\nexport const useExtendLoan = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError,ExtendLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof extendLoan>>,\n TError,\n ExtendLoanMutationVariables,\n TContext\n > => {\n return useMutation(getExtendLoanMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA6CA,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,IAA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, nd as HTTPExceptionResponse, wi as PaymentRead, xi as PaymentStartRead } 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/cvs-payments/cvs-payments.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.20.2
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cvs-payments.js","names":[],"sources":["../../src/react/cvs-payments/cvs-payments.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.19.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 PaymentListRead,\n PaymentRead,\n PaymentStartRead,\n PaymentStartWrite,\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 getListPaymentsUrl = () => {\n\n\n\n\n return `/cvs/payments`\n}\n\n/**\n * This patron's top-ups, newest first. The legacy's ``historyPayments()``.\n * @summary List Payments\n */\nexport const listPayments = async ( options?: Parameters<typeof request>[1]): Promise<PaymentListRead> => {\n\n return request<PaymentListRead>(getListPaymentsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListPaymentsQueryKey = () => {\n return [\n `/cvs/payments`\n ] as const;\n }\n\n\nexport const getListPaymentsQueryOptions = <TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListPaymentsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listPayments>>> = ({ signal }) => listPayments({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListPaymentsQueryResult = NonNullable<Awaited<ReturnType<typeof listPayments>>>\nexport type ListPaymentsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListPayments<TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPayments>>,\n TError,\n Awaited<ReturnType<typeof listPayments>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPayments<TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPayments>>,\n TError,\n Awaited<ReturnType<typeof listPayments>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPayments<TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Payments\n */\n\nexport function useListPayments<TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListPaymentsQueryOptions(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 getStartPaymentUrl = () => {\n\n\n\n\n return `/cvs/payments`\n}\n\n/**\n * Begin a top-up and get the hand-off to send the patron to.\n *\n * **Which provider answers is the library's setting**, not the client's\n * choice. PayPal returns ``approvalUrl``; Paybox returns ``form``, because\n * its hand-off is a signed POST and not a redirect. Read ``provider`` rather\n * than testing which field is null.\n *\n * ``409`` for an amount this library does not sell — the tariff is the\n * server's, because a client that may name its own price may name zero, and\n * it differs per provider (Paybox sells séances at 3 €, PayPal credits at\n * 5.90 €). ``503`` when the library sells nothing or its merchant account is\n * unconfigured, with nothing written.\n *\n * Nothing is charged here and nothing is credited. This opens a pending row\n * and the provider hand-off, and that is all.\n *\n * ``requestKey`` makes it idempotent: a retried start returns the hand-off the\n * first attempt opened rather than opening a second, because a patron who\n * then pays both has been charged twice for one intent.\n * @summary Start Payment\n */\nexport const startPayment = async (paymentStartWrite: PaymentStartWrite, options?: Parameters<typeof request>[1]): Promise<PaymentStartRead> => {\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<PaymentStartRead>(getStartPaymentUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(paymentStartWrite)\n }\n);}\n\n\n\n\n\nexport const getStartPaymentMutationKey = () => ['startPayment'] as const;\n\nexport const getStartPaymentMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startPayment>>, TError,StartPaymentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof startPayment>>, TError,StartPaymentMutationVariables, TContext> => {\n\nconst mutationKey = getStartPaymentMutationKey();\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 startPayment>>, StartPaymentMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return startPayment(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type StartPaymentMutationResult = NonNullable<Awaited<ReturnType<typeof startPayment>>>\n export type StartPaymentMutationBody = BodyType<PaymentStartWrite>\n export type StartPaymentMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type StartPaymentMutationVariables = {data: BodyType<PaymentStartWrite>}\n\n /**\n * @summary Start Payment\n */\nexport const useStartPayment = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startPayment>>, TError,StartPaymentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof startPayment>>,\n TError,\n StartPaymentMutationVariables,\n TContext\n > => {\n return useMutation(getStartPaymentMutationOptions(options), queryClient);\n }\n export const getReadPaymentUrl = (paymentId: number,) => {\n\n\n\n\n return `/cvs/payments/${paymentId}`\n}\n\n/**\n * One top-up, and what became of it.\n *\n * This is what a client reads after the provider sends the browser back. The\n * landing URL says what the patron *did*; this says what the *provider* told\n * us, which is the only version that credits anything.\n *\n * ``404`` for somebody else's payment, indistinguishable from one that does\n * not exist: a payment id is a bare integer.\n * @summary Read Payment\n */\nexport const readPayment = async (paymentId: number, options?: Parameters<typeof request>[1]): Promise<PaymentRead> => {\n\n return request<PaymentRead>(getReadPaymentUrl(paymentId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPaymentQueryKey = (paymentId: number,) => {\n return [\n `/cvs/payments/${paymentId}`\n ] as const;\n }\n\n\nexport const getReadPaymentQueryOptions = <TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(paymentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPaymentQueryKey(paymentId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPayment>>> = ({ signal }) => readPayment(paymentId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: paymentId !== null && paymentId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPaymentQueryResult = NonNullable<Awaited<ReturnType<typeof readPayment>>>\nexport type ReadPaymentQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPayment<TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n paymentId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPayment>>,\n TError,\n Awaited<ReturnType<typeof readPayment>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPayment<TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n paymentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPayment>>,\n TError,\n Awaited<ReturnType<typeof readPayment>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPayment<TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n paymentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Payment\n */\n\nexport function useReadPayment<TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n paymentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPaymentQueryOptions(paymentId,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 getPaymentCallbackUrl = () => {\n\n\n\n\n return `/webhooks/payments`\n}\n\n/**\n * Apply a payment provider's server-to-server notification.\n *\n * One route where the legacy has three. ``/callback``, ``/callback/preprod``\n * and ``/callback/test`` differ only in which environment answers them, which\n * is configuration — and a test callback reachable in production is a way to\n * credit an account without paying for anything.\n *\n * **Authenticated by shared secret**, like the encoding farm's callback and\n * unlike the legacy, which has no authentication here at all — anyone who\n * could reach ``/crediter/callback`` could settle any payment, and settling a\n * payment credits an account.\n *\n * Past the guard, an unknown reference is logged and answered ``204``.\n * Answering differently would turn an authenticated integration partner into\n * an oracle for which references exist.\n *\n * Always ``204``. A provider that receives anything else retries, and a\n * provider retrying against a payment we have already settled is exactly the\n * case :func:`app.services.payments.settle` locks for.\n *\n * **The notification is not the money.** PayPal's order is ``intent: CAPTURE``,\n * which means an approved order is a promise until somebody calls\n * ``/capture`` — so this captures before settling, and settles on the\n * capture's verdict rather than on what the notification claimed. The legacy\n * does the same and it is the difference between crediting a patron who paid\n * and crediting one who reached the approval page.\n *\n * Crediting runs only when :func:`~app.services.payments.settle` reports that\n * *this* call settled the row. A provider retry re-captures (answered\n * ``ORDER_ALREADY_CAPTURED``, read as completed) and credits nothing further.\n * @summary Payment Callback\n */\nexport const paymentCallback = async ( options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getPaymentCallbackUrl(),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getPaymentCallbackMutationKey = () => ['paymentCallback'] as const;\n\nexport const getPaymentCallbackMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof paymentCallback>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof paymentCallback>>, TError,void, TContext> => {\n\nconst mutationKey = getPaymentCallbackMutationKey();\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 paymentCallback>>, void> = () => {\n\n\n return paymentCallback(requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type PaymentCallbackMutationResult = NonNullable<Awaited<ReturnType<typeof paymentCallback>>>\n\n export type PaymentCallbackMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\n /**\n * @summary Payment Callback\n */\nexport const usePaymentCallback = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof paymentCallback>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof paymentCallback>>,\n TError,\n void,\n TContext\n > => {\n return useMutation(getPaymentCallbackMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,2BAA2B;CAKtC,OAAO;AACT;;;;;AAMA,MAAa,eAAe,OAAQ,YAAsE;CAExG,OAAO,QAAyB,mBAAmB,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,gCAAgC;CACzC,OAAO,CACP,eACA;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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AAS,KAAA;CAAS;CAKjD,MAAM,mBAAwF;EAG1F,OAAQ,gBAAgB,cAAc;CACxC;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,sBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,kCAAkC,OAAO,GAAG,WAAW;AAC5E"}
|
|
1
|
+
{"version":3,"file":"cvs-payments.js","names":[],"sources":["../../src/react/cvs-payments/cvs-payments.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.20.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 PaymentListRead,\n PaymentRead,\n PaymentStartRead,\n PaymentStartWrite,\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 getListPaymentsUrl = () => {\n\n\n\n\n return `/cvs/payments`\n}\n\n/**\n * This patron's top-ups, newest first. The legacy's ``historyPayments()``.\n * @summary List Payments\n */\nexport const listPayments = async ( options?: Parameters<typeof request>[1]): Promise<PaymentListRead> => {\n\n return request<PaymentListRead>(getListPaymentsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListPaymentsQueryKey = () => {\n return [\n `/cvs/payments`\n ] as const;\n }\n\n\nexport const getListPaymentsQueryOptions = <TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListPaymentsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listPayments>>> = ({ signal }) => listPayments({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListPaymentsQueryResult = NonNullable<Awaited<ReturnType<typeof listPayments>>>\nexport type ListPaymentsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListPayments<TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPayments>>,\n TError,\n Awaited<ReturnType<typeof listPayments>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPayments<TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPayments>>,\n TError,\n Awaited<ReturnType<typeof listPayments>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPayments<TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Payments\n */\n\nexport function useListPayments<TData = Awaited<ReturnType<typeof listPayments>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPayments>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListPaymentsQueryOptions(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 getStartPaymentUrl = () => {\n\n\n\n\n return `/cvs/payments`\n}\n\n/**\n * Begin a top-up and get the hand-off to send the patron to.\n *\n * **Which provider answers is the library's setting**, not the client's\n * choice. PayPal returns ``approvalUrl``; Paybox returns ``form``, because\n * its hand-off is a signed POST and not a redirect. Read ``provider`` rather\n * than testing which field is null.\n *\n * ``409`` for an amount this library does not sell — the tariff is the\n * server's, because a client that may name its own price may name zero, and\n * it differs per provider (Paybox sells séances at 3 €, PayPal credits at\n * 5.90 €). ``503`` when the library sells nothing or its merchant account is\n * unconfigured, with nothing written.\n *\n * Nothing is charged here and nothing is credited. This opens a pending row\n * and the provider hand-off, and that is all.\n *\n * ``requestKey`` makes it idempotent: a retried start returns the hand-off the\n * first attempt opened rather than opening a second, because a patron who\n * then pays both has been charged twice for one intent.\n * @summary Start Payment\n */\nexport const startPayment = async (paymentStartWrite: PaymentStartWrite, options?: Parameters<typeof request>[1]): Promise<PaymentStartRead> => {\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<PaymentStartRead>(getStartPaymentUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(paymentStartWrite)\n }\n);}\n\n\n\n\n\nexport const getStartPaymentMutationKey = () => ['startPayment'] as const;\n\nexport const getStartPaymentMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startPayment>>, TError,StartPaymentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof startPayment>>, TError,StartPaymentMutationVariables, TContext> => {\n\nconst mutationKey = getStartPaymentMutationKey();\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 startPayment>>, StartPaymentMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return startPayment(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type StartPaymentMutationResult = NonNullable<Awaited<ReturnType<typeof startPayment>>>\n export type StartPaymentMutationBody = BodyType<PaymentStartWrite>\n export type StartPaymentMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type StartPaymentMutationVariables = {data: BodyType<PaymentStartWrite>}\n\n /**\n * @summary Start Payment\n */\nexport const useStartPayment = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startPayment>>, TError,StartPaymentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof startPayment>>,\n TError,\n StartPaymentMutationVariables,\n TContext\n > => {\n return useMutation(getStartPaymentMutationOptions(options), queryClient);\n }\n export const getReadPaymentUrl = (paymentId: number,) => {\n\n\n\n\n return `/cvs/payments/${paymentId}`\n}\n\n/**\n * One top-up, and what became of it.\n *\n * This is what a client reads after the provider sends the browser back. The\n * landing URL says what the patron *did*; this says what the *provider* told\n * us, which is the only version that credits anything.\n *\n * ``404`` for somebody else's payment, indistinguishable from one that does\n * not exist: a payment id is a bare integer.\n * @summary Read Payment\n */\nexport const readPayment = async (paymentId: number, options?: Parameters<typeof request>[1]): Promise<PaymentRead> => {\n\n return request<PaymentRead>(getReadPaymentUrl(paymentId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPaymentQueryKey = (paymentId: number,) => {\n return [\n `/cvs/payments/${paymentId}`\n ] as const;\n }\n\n\nexport const getReadPaymentQueryOptions = <TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(paymentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPaymentQueryKey(paymentId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPayment>>> = ({ signal }) => readPayment(paymentId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: paymentId !== null && paymentId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPaymentQueryResult = NonNullable<Awaited<ReturnType<typeof readPayment>>>\nexport type ReadPaymentQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPayment<TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n paymentId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPayment>>,\n TError,\n Awaited<ReturnType<typeof readPayment>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPayment<TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n paymentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPayment>>,\n TError,\n Awaited<ReturnType<typeof readPayment>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPayment<TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n paymentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Payment\n */\n\nexport function useReadPayment<TData = Awaited<ReturnType<typeof readPayment>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n paymentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPayment>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPaymentQueryOptions(paymentId,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 getPaymentCallbackUrl = () => {\n\n\n\n\n return `/webhooks/payments`\n}\n\n/**\n * Apply a payment provider's server-to-server notification.\n *\n * One route where the legacy has three. ``/callback``, ``/callback/preprod``\n * and ``/callback/test`` differ only in which environment answers them, which\n * is configuration — and a test callback reachable in production is a way to\n * credit an account without paying for anything.\n *\n * **Authenticated by shared secret**, like the encoding farm's callback and\n * unlike the legacy, which has no authentication here at all — anyone who\n * could reach ``/crediter/callback`` could settle any payment, and settling a\n * payment credits an account.\n *\n * Past the guard, an unknown reference is logged and answered ``204``.\n * Answering differently would turn an authenticated integration partner into\n * an oracle for which references exist.\n *\n * Always ``204``. A provider that receives anything else retries, and a\n * provider retrying against a payment we have already settled is exactly the\n * case :func:`app.services.payments.settle` locks for.\n *\n * **The notification is not the money.** PayPal's order is ``intent: CAPTURE``,\n * which means an approved order is a promise until somebody calls\n * ``/capture`` — so this captures before settling, and settles on the\n * capture's verdict rather than on what the notification claimed. The legacy\n * does the same and it is the difference between crediting a patron who paid\n * and crediting one who reached the approval page.\n *\n * Crediting runs only when :func:`~app.services.payments.settle` reports that\n * *this* call settled the row. A provider retry re-captures (answered\n * ``ORDER_ALREADY_CAPTURED``, read as completed) and credits nothing further.\n * @summary Payment Callback\n */\nexport const paymentCallback = async ( options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getPaymentCallbackUrl(),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getPaymentCallbackMutationKey = () => ['paymentCallback'] as const;\n\nexport const getPaymentCallbackMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof paymentCallback>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof paymentCallback>>, TError,void, TContext> => {\n\nconst mutationKey = getPaymentCallbackMutationKey();\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 paymentCallback>>, void> = () => {\n\n\n return paymentCallback(requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type PaymentCallbackMutationResult = NonNullable<Awaited<ReturnType<typeof paymentCallback>>>\n\n export type PaymentCallbackMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\n /**\n * @summary Payment Callback\n */\nexport const usePaymentCallback = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof paymentCallback>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof paymentCallback>>,\n TError,\n void,\n TContext\n > => {\n return useMutation(getPaymentCallbackMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,O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,GAAG;CAAe,CAAC;CAM7I,OAAQ;EAAE;EAAU;EAAS,SAAS,cAAc,QAAQ,cAAc,KAAA;EAAW,GAAG;CAAY;AACvG;;;;AAkCA,SAAgB,eACf,WAAmB,SACjB,aACiF;CAElF,MAAM,eAAe,2BAA2B,WAAU,OAAO;CAEjE,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD;AAOA,MAAa,8BAA8B;CAKzC,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,kBAAkB,OAAQ,YAA2D;CAEhG,OAAO,QAAc,sBAAsB,GAC3C;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,sCAAsC,CAAC,iBAAiB;AAErE,MAAa,qCACW,YACqE;CAE7F,MAAM,cAAc,8BAA8B;CAClD,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,mBAAwF;EAG1F,OAAQ,gBAAgB,cAAc;CACxC;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,sBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,kCAAkC,OAAO,GAAG,WAAW;AAC5E"}
|
|
@@ -1,9 +1,70 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Fd as FilmDownloadAccessRead, T as ValidationErrorResponse, _t as StreamingStartQuery, nd as HTTPExceptionResponse, rf as VodDrmScheme, vt as StreamingStartedRead, yt as StreamingSessionRead } 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/cvs-streaming/cvs-streaming.d.ts
|
|
6
6
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getReadFilmDownloadAccessUrl: (docId: number) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Offline schemes supported for this profile and film. Taking a loan still checks its quota.
|
|
10
|
+
* @summary Read Film Download Access
|
|
11
|
+
*/
|
|
12
|
+
export declare const readFilmDownloadAccess: (docId: number, options?: Parameters<typeof request>[1]) => Promise<FilmDownloadAccessRead>;
|
|
13
|
+
export declare const getReadFilmDownloadAccessQueryKey: (docId: number) => readonly [`/cvs/documents/${number}/download-access`];
|
|
14
|
+
export declare const getReadFilmDownloadAccessQueryOptions: <TData = Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: {
|
|
15
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData>>;
|
|
16
|
+
request?: SecondParameter<typeof request>;
|
|
17
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData> & {
|
|
18
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
19
|
+
};
|
|
20
|
+
export type ReadFilmDownloadAccessQueryResult = NonNullable<Awaited<ReturnType<typeof readFilmDownloadAccess>>>;
|
|
21
|
+
export type ReadFilmDownloadAccessQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
22
|
+
export declare function useReadFilmDownloadAccess<TData = Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options: {
|
|
23
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, Awaited<ReturnType<typeof readFilmDownloadAccess>>>, 'initialData'>;
|
|
24
|
+
request?: SecondParameter<typeof request>;
|
|
25
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
26
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
27
|
+
};
|
|
28
|
+
export declare function useReadFilmDownloadAccess<TData = Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: {
|
|
29
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, Awaited<ReturnType<typeof readFilmDownloadAccess>>>, 'initialData'>;
|
|
30
|
+
request?: SecondParameter<typeof request>;
|
|
31
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
32
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
33
|
+
};
|
|
34
|
+
export declare function useReadFilmDownloadAccess<TData = Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: {
|
|
35
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData>>;
|
|
36
|
+
request?: SecondParameter<typeof request>;
|
|
37
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
38
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
39
|
+
};
|
|
40
|
+
export declare const getAcquireOfflineFilmLicenceUrl: (downloadId: string) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Issue a CDM-bound persistent licence with the original loan's hard deadline.
|
|
43
|
+
*
|
|
44
|
+
* Retry a lost response with the identical challenge. A different challenge
|
|
45
|
+
* cannot acquire a second persistent licence under the same loan.
|
|
46
|
+
* @summary Acquire Offline Film Licence
|
|
47
|
+
*/
|
|
48
|
+
export declare const acquireOfflineFilmLicence: (downloadId: string, acquireOfflineFilmLicenceBody: Blob, options?: Parameters<typeof request>[1]) => Promise<Blob>;
|
|
49
|
+
export declare const getAcquireOfflineFilmLicenceMutationKey: () => readonly ['acquireOfflineFilmLicence'];
|
|
50
|
+
export declare const getAcquireOfflineFilmLicenceMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
51
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof acquireOfflineFilmLicence>>, TError, AcquireOfflineFilmLicenceMutationVariables, TContext>;
|
|
52
|
+
request?: SecondParameter<typeof request>;
|
|
53
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof acquireOfflineFilmLicence>>, TError, AcquireOfflineFilmLicenceMutationVariables, TContext>;
|
|
54
|
+
export type AcquireOfflineFilmLicenceMutationResult = NonNullable<Awaited<ReturnType<typeof acquireOfflineFilmLicence>>>;
|
|
55
|
+
export type AcquireOfflineFilmLicenceMutationBody = BodyType<Blob>;
|
|
56
|
+
export type AcquireOfflineFilmLicenceMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
57
|
+
export type AcquireOfflineFilmLicenceMutationVariables = {
|
|
58
|
+
downloadId: string;
|
|
59
|
+
data: BodyType<Blob>;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @summary Acquire Offline Film Licence
|
|
63
|
+
*/
|
|
64
|
+
export declare const useAcquireOfflineFilmLicence: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
65
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof acquireOfflineFilmLicence>>, TError, AcquireOfflineFilmLicenceMutationVariables, TContext>;
|
|
66
|
+
request?: SecondParameter<typeof request>;
|
|
67
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof acquireOfflineFilmLicence>>, TError, AcquireOfflineFilmLicenceMutationVariables, TContext>;
|
|
7
68
|
export declare const getStartSessionUrl: () => string;
|
|
8
69
|
/**
|
|
9
70
|
* Authorize playback and open its lease before any DRM licence request.
|
|
@@ -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.20.2
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -21,6 +21,101 @@ const withQueryKey = (query, queryKey) => {
|
|
|
21
21
|
}
|
|
22
22
|
return result;
|
|
23
23
|
};
|
|
24
|
+
const getReadFilmDownloadAccessUrl = (docId) => {
|
|
25
|
+
return `/cvs/documents/${docId}/download-access`;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Offline schemes supported for this profile and film. Taking a loan still checks its quota.
|
|
29
|
+
* @summary Read Film Download Access
|
|
30
|
+
*/
|
|
31
|
+
const readFilmDownloadAccess = async (docId, options) => {
|
|
32
|
+
return request(getReadFilmDownloadAccessUrl(docId), {
|
|
33
|
+
...options,
|
|
34
|
+
method: "GET"
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const getReadFilmDownloadAccessQueryKey = (docId) => {
|
|
38
|
+
return [`/cvs/documents/${docId}/download-access`];
|
|
39
|
+
};
|
|
40
|
+
const getReadFilmDownloadAccessQueryOptions = (docId, options) => {
|
|
41
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
42
|
+
const queryKey = queryOptions?.queryKey ?? getReadFilmDownloadAccessQueryKey(docId);
|
|
43
|
+
const queryFn = ({ signal }) => readFilmDownloadAccess(docId, {
|
|
44
|
+
signal,
|
|
45
|
+
...requestOptions
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
queryKey,
|
|
49
|
+
queryFn,
|
|
50
|
+
enabled: docId !== null && docId !== void 0,
|
|
51
|
+
...queryOptions
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* @summary Read Film Download Access
|
|
56
|
+
*/
|
|
57
|
+
function useReadFilmDownloadAccess(docId, options, queryClient) {
|
|
58
|
+
const queryOptions = getReadFilmDownloadAccessQueryOptions(docId, options);
|
|
59
|
+
const query = useQuery(queryOptions, queryClient);
|
|
60
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
61
|
+
}
|
|
62
|
+
const getAcquireOfflineFilmLicenceUrl = (downloadId) => {
|
|
63
|
+
return `/streaming/downloads/${downloadId}/licence`;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Issue a CDM-bound persistent licence with the original loan's hard deadline.
|
|
67
|
+
*
|
|
68
|
+
* Retry a lost response with the identical challenge. A different challenge
|
|
69
|
+
* cannot acquire a second persistent licence under the same loan.
|
|
70
|
+
* @summary Acquire Offline Film Licence
|
|
71
|
+
*/
|
|
72
|
+
const acquireOfflineFilmLicence = async (downloadId, acquireOfflineFilmLicenceBody, options) => {
|
|
73
|
+
const getHeaders = (h) => {
|
|
74
|
+
if (!h) return {};
|
|
75
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
76
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
77
|
+
const headers = {};
|
|
78
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
79
|
+
return headers;
|
|
80
|
+
};
|
|
81
|
+
return request(getAcquireOfflineFilmLicenceUrl(downloadId), {
|
|
82
|
+
...options,
|
|
83
|
+
method: "POST",
|
|
84
|
+
headers: {
|
|
85
|
+
"Content-Type": "application/octet-stream",
|
|
86
|
+
...getHeaders(options?.headers)
|
|
87
|
+
},
|
|
88
|
+
body: acquireOfflineFilmLicenceBody
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const getAcquireOfflineFilmLicenceMutationKey = () => ["acquireOfflineFilmLicence"];
|
|
92
|
+
const getAcquireOfflineFilmLicenceMutationOptions = (options) => {
|
|
93
|
+
const mutationKey = getAcquireOfflineFilmLicenceMutationKey();
|
|
94
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
95
|
+
...options,
|
|
96
|
+
mutation: {
|
|
97
|
+
...options.mutation,
|
|
98
|
+
mutationKey
|
|
99
|
+
}
|
|
100
|
+
} : {
|
|
101
|
+
mutation: { mutationKey },
|
|
102
|
+
request: void 0
|
|
103
|
+
};
|
|
104
|
+
const mutationFn = (props) => {
|
|
105
|
+
const { downloadId, data } = props ?? {};
|
|
106
|
+
return acquireOfflineFilmLicence(downloadId, data, requestOptions);
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
mutationFn,
|
|
110
|
+
...mutationOptions
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* @summary Acquire Offline Film Licence
|
|
115
|
+
*/
|
|
116
|
+
const useAcquireOfflineFilmLicence = (options, queryClient) => {
|
|
117
|
+
return useMutation(getAcquireOfflineFilmLicenceMutationOptions(options), queryClient);
|
|
118
|
+
};
|
|
24
119
|
const getStartSessionUrl = () => {
|
|
25
120
|
return `/streaming/sessions`;
|
|
26
121
|
};
|
|
@@ -221,6 +316,6 @@ function useReadDashManifest(docId, options, queryClient) {
|
|
|
221
316
|
return withQueryKey(query, queryOptions.queryKey);
|
|
222
317
|
}
|
|
223
318
|
//#endregion
|
|
224
|
-
export { getOwnedVodLicenceMutationKey, getOwnedVodLicenceMutationOptions, getOwnedVodLicenceUrl, getReadDashManifestQueryKey, getReadDashManifestQueryOptions, getReadDashManifestUrl, getStartSessionMutationKey, getStartSessionMutationOptions, getStartSessionUrl, getStreamingDetailsQueryKey, getStreamingDetailsQueryOptions, getStreamingDetailsUrl, ownedVodLicence, readDashManifest, startSession, streamingDetails, useOwnedVodLicence, useReadDashManifest, useStartSession, useStreamingDetails };
|
|
319
|
+
export { acquireOfflineFilmLicence, getAcquireOfflineFilmLicenceMutationKey, getAcquireOfflineFilmLicenceMutationOptions, getAcquireOfflineFilmLicenceUrl, getOwnedVodLicenceMutationKey, getOwnedVodLicenceMutationOptions, getOwnedVodLicenceUrl, getReadDashManifestQueryKey, getReadDashManifestQueryOptions, getReadDashManifestUrl, getReadFilmDownloadAccessQueryKey, getReadFilmDownloadAccessQueryOptions, getReadFilmDownloadAccessUrl, getStartSessionMutationKey, getStartSessionMutationOptions, getStartSessionUrl, getStreamingDetailsQueryKey, getStreamingDetailsQueryOptions, getStreamingDetailsUrl, ownedVodLicence, readDashManifest, readFilmDownloadAccess, startSession, streamingDetails, useAcquireOfflineFilmLicence, useOwnedVodLicence, useReadDashManifest, useReadFilmDownloadAccess, useStartSession, useStreamingDetails };
|
|
225
320
|
|
|
226
321
|
//# sourceMappingURL=cvs-streaming.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cvs-streaming.js","names":[],"sources":["../../src/react/cvs-streaming/cvs-streaming.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.19.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 StreamingSessionRead,\n StreamingStartQuery,\n StreamingStartedRead,\n ValidationErrorResponse,\n VodDrmScheme\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 getStartSessionUrl = () => {\n\n\n\n\n return `/streaming/sessions`\n}\n\n/**\n * Authorize playback and open its lease before any DRM licence request.\n *\n * Returns the configured CDN manifests and authenticated licence-proxy URLs.\n * The player sends its CDM challenge separately. No KMS/DRM request is made\n * here. An existing loan is not charged a second time; Idempotency-Key reuses\n * its playback lease and pinned asset revision.\n *\n * 404 hides absent/unentitled works, 409 means quota/seat exhaustion, and 503\n * means required playback media or configuration is missing. Errors never\n * substitute another provider or a clear stream.\n * @summary Start Session\n */\nexport const startSession = async (streamingStartQuery: StreamingStartQuery, options?: Parameters<typeof request>[1]): Promise<StreamingStartedRead> => {\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<StreamingStartedRead>(getStartSessionUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(streamingStartQuery)\n }\n);}\n\n\n\n\n\nexport const getStartSessionMutationKey = () => ['startSession'] as const;\n\nexport const getStartSessionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError,StartSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError,StartSessionMutationVariables, TContext> => {\n\nconst mutationKey = getStartSessionMutationKey();\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 startSession>>, StartSessionMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return startSession(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type StartSessionMutationResult = NonNullable<Awaited<ReturnType<typeof startSession>>>\n export type StartSessionMutationBody = BodyType<StreamingStartQuery>\n export type StartSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type StartSessionMutationVariables = {data: BodyType<StreamingStartQuery>}\n\n /**\n * @summary Start Session\n */\nexport const useStartSession = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError,StartSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof startSession>>,\n TError,\n StartSessionMutationVariables,\n TContext\n > => {\n return useMutation(getStartSessionMutationOptions(options), queryClient);\n }\n export const getOwnedVodLicenceUrl = (eventId: number,\n scheme: VodDrmScheme,) => {\n\n\n\n\n return `/streaming/sessions/${eventId}/licences/${scheme}`\n}\n\n/**\n * Forward a CDM challenge only for the caller's live playback lease.\n *\n * Use the same authentication/profile/device headers as POST /streaming/sessions.\n * This does not open a new lease or spend another credit. The KID comes from\n * the pinned database asset, never from an arbitrary client-selected key.\n * KMS plaintext is held only while constructing the DRM request; no key cache\n * or key-bearing error response is created. Provider calls are not retried.\n * @summary Owned Vod Licence\n */\nexport const ownedVodLicence = async (eventId: number,\n scheme: VodDrmScheme,\n ownedVodLicenceBody: Blob, options?: Parameters<typeof request>[1]): Promise<Blob> => {\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<Blob>(getOwnedVodLicenceUrl(eventId,scheme),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/octet-stream', ...getHeaders(options?.headers) },\n body: ownedVodLicenceBody\n }\n);}\n\n\n\n\n\nexport const getOwnedVodLicenceMutationKey = () => ['ownedVodLicence'] as const;\n\nexport const getOwnedVodLicenceMutationOptions = <TError = ErrorType<HTTPExceptionResponse | void | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof ownedVodLicence>>, TError,OwnedVodLicenceMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof ownedVodLicence>>, TError,OwnedVodLicenceMutationVariables, TContext> => {\n\nconst mutationKey = getOwnedVodLicenceMutationKey();\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 ownedVodLicence>>, OwnedVodLicenceMutationVariables> = (props) => {\n const {eventId,scheme,data} = props ?? {};\n\n return ownedVodLicence(eventId,scheme,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OwnedVodLicenceMutationResult = NonNullable<Awaited<ReturnType<typeof ownedVodLicence>>>\n export type OwnedVodLicenceMutationBody = BodyType<Blob>\n export type OwnedVodLicenceMutationError = ErrorType<HTTPExceptionResponse | void | ValidationErrorResponse>\n export type OwnedVodLicenceMutationVariables = {eventId: number;scheme: VodDrmScheme;data: BodyType<Blob>}\n\n /**\n * @summary Owned Vod Licence\n */\nexport const useOwnedVodLicence = <TError = ErrorType<HTTPExceptionResponse | void | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof ownedVodLicence>>, TError,OwnedVodLicenceMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof ownedVodLicence>>,\n TError,\n OwnedVodLicenceMutationVariables,\n TContext\n > => {\n return useMutation(getOwnedVodLicenceMutationOptions(options), queryClient);\n }\n export const getStreamingDetailsUrl = (docId: number,) => {\n\n\n\n\n return `/streaming/${docId}/details`\n}\n\n/**\n * Read playback metadata without opening a lease or spending a credit.\n * @summary Streaming Details\n */\nexport const streamingDetails = async (docId: number, options?: Parameters<typeof request>[1]): Promise<StreamingSessionRead> => {\n\n return request<StreamingSessionRead>(getStreamingDetailsUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getStreamingDetailsQueryKey = (docId: number,) => {\n return [\n `/streaming/${docId}/details`\n ] as const;\n }\n\n\nexport const getStreamingDetailsQueryOptions = <TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getStreamingDetailsQueryKey(docId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof streamingDetails>>> = ({ signal }) => streamingDetails(docId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: docId !== null && docId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type StreamingDetailsQueryResult = NonNullable<Awaited<ReturnType<typeof streamingDetails>>>\nexport type StreamingDetailsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof streamingDetails>>,\n TError,\n Awaited<ReturnType<typeof streamingDetails>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof streamingDetails>>,\n TError,\n Awaited<ReturnType<typeof streamingDetails>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Streaming Details\n */\n\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getStreamingDetailsQueryOptions(docId,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 getReadDashManifestUrl = (docId: number,) => {\n\n\n\n\n return `/streaming/${docId}/manifest.mpd`\n}\n\n/**\n * Fetch the registered CDN's DASH manifest under normal catalogue authorization.\n * @summary Read Dash Manifest\n */\nexport const readDashManifest = async (docId: number, options?: Parameters<typeof request>[1]): Promise<string> => {\n\n return request<string>(getReadDashManifestUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadDashManifestQueryKey = (docId: number,) => {\n return [\n `/streaming/${docId}/manifest.mpd`\n ] as const;\n }\n\n\nexport const getReadDashManifestQueryOptions = <TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadDashManifestQueryKey(docId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readDashManifest>>> = ({ signal }) => readDashManifest(docId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: docId !== null && docId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadDashManifestQueryResult = NonNullable<Awaited<ReturnType<typeof readDashManifest>>>\nexport type ReadDashManifestQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadDashManifest<TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readDashManifest>>,\n TError,\n Awaited<ReturnType<typeof readDashManifest>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadDashManifest<TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readDashManifest>>,\n TError,\n Awaited<ReturnType<typeof readDashManifest>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadDashManifest<TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Dash Manifest\n */\n\nexport function useReadDashManifest<TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadDashManifestQueryOptions(docId,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":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,2BAA2B;CAKtC,OAAO;AACT;;;;;;;;;;;;;;AAeA,MAAa,eAAe,OAAO,qBAA0C,YAA2E;CAEpJ,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,M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WAAY,cAAc,YAAY,4BAA4B,KAAK;CAI3E,MAAM,WAAwE,EAAE,aAAa,iBAAiB,OAAO;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMnJ,OAAQ;EAAE;EAAU;EAAS,SAAS,UAAU,QAAQ,UAAU,KAAA;EAAW,GAAG;CAAY;AAC/F;;;;AAkCA,SAAgB,oBACf,OAAe,SACb,aACiF;CAElF,MAAM,eAAe,gCAAgC,OAAM,OAAO;CAElE,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD;AAOA,MAAa,0BAA0B,UAAmB;CAKxD,OAAO,cAAc,MAAM;AAC7B;;;;;AAMA,MAAa,mBAAmB,OAAO,OAAe,YAA6D;CAEjH,OAAO,QAAgB,uBAAuB,KAAK,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,+BAA+B,UAAmB;CAC3D,OAAO,CACP,cAAc,MAAM,cACpB;AACA;AAGJ,MAAa,mCAA8J,OAAe,YACrL;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,4BAA4B,KAAK;CAI3E,MAAM,WAAwE,EAAE,aAAa,iBAAiB,OAAO;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMnJ,OAAQ;EAAE;EAAU;EAAS,SAAS,UAAU,QAAQ,UAAU,KAAA;EAAW,GAAG;CAAY;AAC/F;;;;AAkCA,SAAgB,oBACf,OAAe,SACb,aACiF;CAElF,MAAM,eAAe,gCAAgC,OAAM,OAAO;CAElE,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD"}
|
|
1
|
+
{"version":3,"file":"cvs-streaming.js","names":[],"sources":["../../src/react/cvs-streaming/cvs-streaming.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.20.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 FilmDownloadAccessRead,\n HTTPExceptionResponse,\n StreamingSessionRead,\n StreamingStartQuery,\n StreamingStartedRead,\n ValidationErrorResponse,\n VodDrmScheme\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 getReadFilmDownloadAccessUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/download-access`\n}\n\n/**\n * Offline schemes supported for this profile and film. Taking a loan still checks its quota.\n * @summary Read Film Download Access\n */\nexport const readFilmDownloadAccess = async (docId: number, options?: Parameters<typeof request>[1]): Promise<FilmDownloadAccessRead> => {\n\n return request<FilmDownloadAccessRead>(getReadFilmDownloadAccessUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadFilmDownloadAccessQueryKey = (docId: number,) => {\n return [\n `/cvs/documents/${docId}/download-access`\n ] as const;\n }\n\n\nexport const getReadFilmDownloadAccessQueryOptions = <TData = Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadFilmDownloadAccessQueryKey(docId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readFilmDownloadAccess>>> = ({ signal }) => readFilmDownloadAccess(docId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: docId !== null && docId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadFilmDownloadAccessQueryResult = NonNullable<Awaited<ReturnType<typeof readFilmDownloadAccess>>>\nexport type ReadFilmDownloadAccessQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadFilmDownloadAccess<TData = Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readFilmDownloadAccess>>,\n TError,\n Awaited<ReturnType<typeof readFilmDownloadAccess>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadFilmDownloadAccess<TData = Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readFilmDownloadAccess>>,\n TError,\n Awaited<ReturnType<typeof readFilmDownloadAccess>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadFilmDownloadAccess<TData = Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Film Download Access\n */\n\nexport function useReadFilmDownloadAccess<TData = Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readFilmDownloadAccess>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadFilmDownloadAccessQueryOptions(docId,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 getAcquireOfflineFilmLicenceUrl = (downloadId: string,) => {\n\n\n\n\n return `/streaming/downloads/${downloadId}/licence`\n}\n\n/**\n * Issue a CDM-bound persistent licence with the original loan's hard deadline.\n *\n * Retry a lost response with the identical challenge. A different challenge\n * cannot acquire a second persistent licence under the same loan.\n * @summary Acquire Offline Film Licence\n */\nexport const acquireOfflineFilmLicence = async (downloadId: string,\n acquireOfflineFilmLicenceBody: Blob, options?: Parameters<typeof request>[1]): Promise<Blob> => {\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<Blob>(getAcquireOfflineFilmLicenceUrl(downloadId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/octet-stream', ...getHeaders(options?.headers) },\n body: acquireOfflineFilmLicenceBody\n }\n);}\n\n\n\n\n\nexport const getAcquireOfflineFilmLicenceMutationKey = () => ['acquireOfflineFilmLicence'] as const;\n\nexport const getAcquireOfflineFilmLicenceMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof acquireOfflineFilmLicence>>, TError,AcquireOfflineFilmLicenceMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof acquireOfflineFilmLicence>>, TError,AcquireOfflineFilmLicenceMutationVariables, TContext> => {\n\nconst mutationKey = getAcquireOfflineFilmLicenceMutationKey();\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 acquireOfflineFilmLicence>>, AcquireOfflineFilmLicenceMutationVariables> = (props) => {\n const {downloadId,data} = props ?? {};\n\n return acquireOfflineFilmLicence(downloadId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AcquireOfflineFilmLicenceMutationResult = NonNullable<Awaited<ReturnType<typeof acquireOfflineFilmLicence>>>\n export type AcquireOfflineFilmLicenceMutationBody = BodyType<Blob>\n export type AcquireOfflineFilmLicenceMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type AcquireOfflineFilmLicenceMutationVariables = {downloadId: string;data: BodyType<Blob>}\n\n /**\n * @summary Acquire Offline Film Licence\n */\nexport const useAcquireOfflineFilmLicence = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof acquireOfflineFilmLicence>>, TError,AcquireOfflineFilmLicenceMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof acquireOfflineFilmLicence>>,\n TError,\n AcquireOfflineFilmLicenceMutationVariables,\n TContext\n > => {\n return useMutation(getAcquireOfflineFilmLicenceMutationOptions(options), queryClient);\n }\n export const getStartSessionUrl = () => {\n\n\n\n\n return `/streaming/sessions`\n}\n\n/**\n * Authorize playback and open its lease before any DRM licence request.\n *\n * Returns the configured CDN manifests and authenticated licence-proxy URLs.\n * The player sends its CDM challenge separately. No KMS/DRM request is made\n * here. An existing loan is not charged a second time; Idempotency-Key reuses\n * its playback lease and pinned asset revision.\n *\n * 404 hides absent/unentitled works, 409 means quota/seat exhaustion, and 503\n * means required playback media or configuration is missing. Errors never\n * substitute another provider or a clear stream.\n * @summary Start Session\n */\nexport const startSession = async (streamingStartQuery: StreamingStartQuery, options?: Parameters<typeof request>[1]): Promise<StreamingStartedRead> => {\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<StreamingStartedRead>(getStartSessionUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(streamingStartQuery)\n }\n);}\n\n\n\n\n\nexport const getStartSessionMutationKey = () => ['startSession'] as const;\n\nexport const getStartSessionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError,StartSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError,StartSessionMutationVariables, TContext> => {\n\nconst mutationKey = getStartSessionMutationKey();\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 startSession>>, StartSessionMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return startSession(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type StartSessionMutationResult = NonNullable<Awaited<ReturnType<typeof startSession>>>\n export type StartSessionMutationBody = BodyType<StreamingStartQuery>\n export type StartSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type StartSessionMutationVariables = {data: BodyType<StreamingStartQuery>}\n\n /**\n * @summary Start Session\n */\nexport const useStartSession = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError,StartSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof startSession>>,\n TError,\n StartSessionMutationVariables,\n TContext\n > => {\n return useMutation(getStartSessionMutationOptions(options), queryClient);\n }\n export const getOwnedVodLicenceUrl = (eventId: number,\n scheme: VodDrmScheme,) => {\n\n\n\n\n return `/streaming/sessions/${eventId}/licences/${scheme}`\n}\n\n/**\n * Forward a CDM challenge only for the caller's live playback lease.\n *\n * Use the same authentication/profile/device headers as POST /streaming/sessions.\n * This does not open a new lease or spend another credit. The KID comes from\n * the pinned database asset, never from an arbitrary client-selected key.\n * KMS plaintext is held only while constructing the DRM request; no key cache\n * or key-bearing error response is created. Provider calls are not retried.\n * @summary Owned Vod Licence\n */\nexport const ownedVodLicence = async (eventId: number,\n scheme: VodDrmScheme,\n ownedVodLicenceBody: Blob, options?: Parameters<typeof request>[1]): Promise<Blob> => {\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<Blob>(getOwnedVodLicenceUrl(eventId,scheme),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/octet-stream', ...getHeaders(options?.headers) },\n body: ownedVodLicenceBody\n }\n);}\n\n\n\n\n\nexport const getOwnedVodLicenceMutationKey = () => ['ownedVodLicence'] as const;\n\nexport const getOwnedVodLicenceMutationOptions = <TError = ErrorType<HTTPExceptionResponse | void | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof ownedVodLicence>>, TError,OwnedVodLicenceMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof ownedVodLicence>>, TError,OwnedVodLicenceMutationVariables, TContext> => {\n\nconst mutationKey = getOwnedVodLicenceMutationKey();\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 ownedVodLicence>>, OwnedVodLicenceMutationVariables> = (props) => {\n const {eventId,scheme,data} = props ?? {};\n\n return ownedVodLicence(eventId,scheme,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OwnedVodLicenceMutationResult = NonNullable<Awaited<ReturnType<typeof ownedVodLicence>>>\n export type OwnedVodLicenceMutationBody = BodyType<Blob>\n export type OwnedVodLicenceMutationError = ErrorType<HTTPExceptionResponse | void | ValidationErrorResponse>\n export type OwnedVodLicenceMutationVariables = {eventId: number;scheme: VodDrmScheme;data: BodyType<Blob>}\n\n /**\n * @summary Owned Vod Licence\n */\nexport const useOwnedVodLicence = <TError = ErrorType<HTTPExceptionResponse | void | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof ownedVodLicence>>, TError,OwnedVodLicenceMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof ownedVodLicence>>,\n TError,\n OwnedVodLicenceMutationVariables,\n TContext\n > => {\n return useMutation(getOwnedVodLicenceMutationOptions(options), queryClient);\n }\n export const getStreamingDetailsUrl = (docId: number,) => {\n\n\n\n\n return `/streaming/${docId}/details`\n}\n\n/**\n * Read playback metadata without opening a lease or spending a credit.\n * @summary Streaming Details\n */\nexport const streamingDetails = async (docId: number, options?: Parameters<typeof request>[1]): Promise<StreamingSessionRead> => {\n\n return request<StreamingSessionRead>(getStreamingDetailsUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getStreamingDetailsQueryKey = (docId: number,) => {\n return [\n `/streaming/${docId}/details`\n ] as const;\n }\n\n\nexport const getStreamingDetailsQueryOptions = <TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getStreamingDetailsQueryKey(docId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof streamingDetails>>> = ({ signal }) => streamingDetails(docId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: docId !== null && docId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type StreamingDetailsQueryResult = NonNullable<Awaited<ReturnType<typeof streamingDetails>>>\nexport type StreamingDetailsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof streamingDetails>>,\n TError,\n Awaited<ReturnType<typeof streamingDetails>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof streamingDetails>>,\n TError,\n Awaited<ReturnType<typeof streamingDetails>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Streaming Details\n */\n\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getStreamingDetailsQueryOptions(docId,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 getReadDashManifestUrl = (docId: number,) => {\n\n\n\n\n return `/streaming/${docId}/manifest.mpd`\n}\n\n/**\n * Fetch the registered CDN's DASH manifest under normal catalogue authorization.\n * @summary Read Dash Manifest\n */\nexport const readDashManifest = async (docId: number, options?: Parameters<typeof request>[1]): Promise<string> => {\n\n return request<string>(getReadDashManifestUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadDashManifestQueryKey = (docId: number,) => {\n return [\n `/streaming/${docId}/manifest.mpd`\n ] as const;\n }\n\n\nexport const getReadDashManifestQueryOptions = <TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadDashManifestQueryKey(docId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readDashManifest>>> = ({ signal }) => readDashManifest(docId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: docId !== null && docId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadDashManifestQueryResult = NonNullable<Awaited<ReturnType<typeof readDashManifest>>>\nexport type ReadDashManifestQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadDashManifest<TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readDashManifest>>,\n TError,\n Awaited<ReturnType<typeof readDashManifest>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadDashManifest<TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readDashManifest>>,\n TError,\n Awaited<ReturnType<typeof readDashManifest>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadDashManifest<TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Dash Manifest\n */\n\nexport function useReadDashManifest<TData = Awaited<ReturnType<typeof readDashManifest>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDashManifest>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadDashManifestQueryOptions(docId,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":";;;;;;;;;;;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,gCAAgC,UAAmB;CAK9D,OAAO,kBAAkB,MAAM;AACjC;;;;;AAMA,MAAa,yBAAyB,OAAO,OAAe,YAA6E;CAEvI,OAAO,QAAgC,6BAA6B,KAAK,GACzE;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,qCAAqC,UAAmB;CACjE,OAAO,CACP,kBAA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