@learnorama/mozaik-sdk 0.1.0-staging.11.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.
Files changed (208) hide show
  1. package/README.md +94 -0
  2. package/dist/api/account.d.ts +75 -0
  3. package/dist/api/account.js +117 -0
  4. package/dist/api/account.js.map +1 -0
  5. package/dist/api/admin-catalogue.d.ts +68 -0
  6. package/dist/api/admin-catalogue.js +155 -0
  7. package/dist/api/admin-catalogue.js.map +1 -0
  8. package/dist/api/admin-consumption.d.ts +27 -0
  9. package/dist/api/admin-consumption.js +55 -0
  10. package/dist/api/admin-consumption.js.map +1 -0
  11. package/dist/api/admin-licenses.d.ts +21 -0
  12. package/dist/api/admin-licenses.js +34 -0
  13. package/dist/api/admin-licenses.js.map +1 -0
  14. package/dist/api/admin-patrons.d.ts +36 -0
  15. package/dist/api/admin-patrons.js +76 -0
  16. package/dist/api/admin-patrons.js.map +1 -0
  17. package/dist/api/admin-reviews.d.ts +30 -0
  18. package/dist/api/admin-reviews.js +63 -0
  19. package/dist/api/admin-reviews.js.map +1 -0
  20. package/dist/api/admin-roles.d.ts +34 -0
  21. package/dist/api/admin-roles.js +62 -0
  22. package/dist/api/admin-roles.js.map +1 -0
  23. package/dist/api/admin-support.d.ts +68 -0
  24. package/dist/api/admin-support.js +116 -0
  25. package/dist/api/admin-support.js.map +1 -0
  26. package/dist/api/admin-tenants.d.ts +33 -0
  27. package/dist/api/admin-tenants.js +68 -0
  28. package/dist/api/admin-tenants.js.map +1 -0
  29. package/dist/api/admin-tutoring.d.ts +159 -0
  30. package/dist/api/admin-tutoring.js +455 -0
  31. package/dist/api/admin-tutoring.js.map +1 -0
  32. package/dist/api/auth.d.ts +92 -0
  33. package/dist/api/auth.js +192 -0
  34. package/dist/api/auth.js.map +1 -0
  35. package/dist/api/biblio-catalogue.d.ts +122 -0
  36. package/dist/api/biblio-catalogue.js +223 -0
  37. package/dist/api/biblio-catalogue.js.map +1 -0
  38. package/dist/api/biblio-home.d.ts +18 -0
  39. package/dist/api/biblio-home.js +31 -0
  40. package/dist/api/biblio-home.js.map +1 -0
  41. package/dist/api/biblio-library.d.ts +94 -0
  42. package/dist/api/biblio-library.js +187 -0
  43. package/dist/api/biblio-library.js.map +1 -0
  44. package/dist/api/biblio-nextory.d.ts +43 -0
  45. package/dist/api/biblio-nextory.js +65 -0
  46. package/dist/api/biblio-nextory.js.map +1 -0
  47. package/dist/api/biblio-press.d.ts +38 -0
  48. package/dist/api/biblio-press.js +70 -0
  49. package/dist/api/biblio-press.js.map +1 -0
  50. package/dist/api/biblio-search.d.ts +17 -0
  51. package/dist/api/biblio-search.js +30 -0
  52. package/dist/api/biblio-search.js.map +1 -0
  53. package/dist/api/biblio-telemetry.d.ts +28 -0
  54. package/dist/api/biblio-telemetry.js +49 -0
  55. package/dist/api/biblio-telemetry.js.map +1 -0
  56. package/dist/api/consumption.d.ts +30 -0
  57. package/dist/api/consumption.js +45 -0
  58. package/dist/api/consumption.js.map +1 -0
  59. package/dist/api/cvs-app.d.ts +39 -0
  60. package/dist/api/cvs-app.js +72 -0
  61. package/dist/api/cvs-app.js.map +1 -0
  62. package/dist/api/cvs-documents.d.ts +106 -0
  63. package/dist/api/cvs-documents.js +208 -0
  64. package/dist/api/cvs-documents.js.map +1 -0
  65. package/dist/api/cvs-favorites.d.ts +53 -0
  66. package/dist/api/cvs-favorites.js +82 -0
  67. package/dist/api/cvs-favorites.js.map +1 -0
  68. package/dist/api/cvs-loans.d.ts +59 -0
  69. package/dist/api/cvs-loans.js +106 -0
  70. package/dist/api/cvs-loans.js.map +1 -0
  71. package/dist/api/cvs-streaming.d.ts +40 -0
  72. package/dist/api/cvs-streaming.js +68 -0
  73. package/dist/api/cvs-streaming.js.map +1 -0
  74. package/dist/api/index.d.ts +34 -0
  75. package/dist/api/index.js +34 -0
  76. package/dist/api/partner-catalogue.d.ts +77 -0
  77. package/dist/api/partner-catalogue.js +125 -0
  78. package/dist/api/partner-catalogue.js.map +1 -0
  79. package/dist/api/partner-reader.d.ts +56 -0
  80. package/dist/api/partner-reader.js +103 -0
  81. package/dist/api/partner-reader.js.map +1 -0
  82. package/dist/api/profiles.d.ts +64 -0
  83. package/dist/api/profiles.js +126 -0
  84. package/dist/api/profiles.js.map +1 -0
  85. package/dist/api/tutoring-catalogue.d.ts +32 -0
  86. package/dist/api/tutoring-catalogue.js +59 -0
  87. package/dist/api/tutoring-catalogue.js.map +1 -0
  88. package/dist/api/tutoring-chat.d.ts +31 -0
  89. package/dist/api/tutoring-chat.js +71 -0
  90. package/dist/api/tutoring-chat.js.map +1 -0
  91. package/dist/api/tutoring-dispatch.d.ts +37 -0
  92. package/dist/api/tutoring-dispatch.js +83 -0
  93. package/dist/api/tutoring-dispatch.js.map +1 -0
  94. package/dist/api/tutoring-practitioner.d.ts +55 -0
  95. package/dist/api/tutoring-practitioner.js +110 -0
  96. package/dist/api/tutoring-practitioner.js.map +1 -0
  97. package/dist/api/tutoring-requests.d.ts +86 -0
  98. package/dist/api/tutoring-requests.js +176 -0
  99. package/dist/api/tutoring-requests.js.map +1 -0
  100. package/dist/chunks/client.d.ts +28 -0
  101. package/dist/chunks/client.js +61 -0
  102. package/dist/chunks/client.js.map +1 -0
  103. package/dist/chunks/index.d.ts +4566 -0
  104. package/dist/index.d.ts +9 -0
  105. package/dist/index.js +10 -0
  106. package/dist/index.js.map +1 -0
  107. package/dist/models.d.ts +3 -0
  108. package/dist/models.js +175 -0
  109. package/dist/models.js.map +1 -0
  110. package/dist/react/account.d.ts +163 -0
  111. package/dist/react/account.js +240 -0
  112. package/dist/react/account.js.map +1 -0
  113. package/dist/react/admin-catalogue.d.ts +196 -0
  114. package/dist/react/admin-catalogue.js +336 -0
  115. package/dist/react/admin-catalogue.js.map +1 -0
  116. package/dist/react/admin-consumption.d.ts +75 -0
  117. package/dist/react/admin-consumption.js +127 -0
  118. package/dist/react/admin-consumption.js.map +1 -0
  119. package/dist/react/admin-licenses.d.ts +50 -0
  120. package/dist/react/admin-licenses.js +78 -0
  121. package/dist/react/admin-licenses.js.map +1 -0
  122. package/dist/react/admin-patrons.d.ts +111 -0
  123. package/dist/react/admin-patrons.js +173 -0
  124. package/dist/react/admin-patrons.js.map +1 -0
  125. package/dist/react/admin-reviews.d.ts +78 -0
  126. package/dist/react/admin-reviews.js +135 -0
  127. package/dist/react/admin-reviews.js.map +1 -0
  128. package/dist/react/admin-roles.d.ts +82 -0
  129. package/dist/react/admin-roles.js +135 -0
  130. package/dist/react/admin-roles.js.map +1 -0
  131. package/dist/react/admin-support.d.ts +123 -0
  132. package/dist/react/admin-support.js +208 -0
  133. package/dist/react/admin-support.js.map +1 -0
  134. package/dist/react/admin-tenants.d.ts +108 -0
  135. package/dist/react/admin-tenants.js +165 -0
  136. package/dist/react/admin-tenants.js.map +1 -0
  137. package/dist/react/admin-tutoring.d.ts +556 -0
  138. package/dist/react/admin-tutoring.js +954 -0
  139. package/dist/react/admin-tutoring.js.map +1 -0
  140. package/dist/react/auth.d.ts +220 -0
  141. package/dist/react/auth.js +372 -0
  142. package/dist/react/auth.js.map +1 -0
  143. package/dist/react/biblio-catalogue.d.ts +374 -0
  144. package/dist/react/biblio-catalogue.js +498 -0
  145. package/dist/react/biblio-catalogue.js.map +1 -0
  146. package/dist/react/biblio-home.d.ts +47 -0
  147. package/dist/react/biblio-home.js +75 -0
  148. package/dist/react/biblio-home.js.map +1 -0
  149. package/dist/react/biblio-library.d.ts +285 -0
  150. package/dist/react/biblio-library.js +411 -0
  151. package/dist/react/biblio-library.js.map +1 -0
  152. package/dist/react/biblio-nextory.d.ts +100 -0
  153. package/dist/react/biblio-nextory.js +163 -0
  154. package/dist/react/biblio-nextory.js.map +1 -0
  155. package/dist/react/biblio-press.d.ts +121 -0
  156. package/dist/react/biblio-press.js +163 -0
  157. package/dist/react/biblio-press.js.map +1 -0
  158. package/dist/react/biblio-search.d.ts +46 -0
  159. package/dist/react/biblio-search.js +74 -0
  160. package/dist/react/biblio-search.js.map +1 -0
  161. package/dist/react/biblio-telemetry.d.ts +49 -0
  162. package/dist/react/biblio-telemetry.js +85 -0
  163. package/dist/react/biblio-telemetry.js.map +1 -0
  164. package/dist/react/consumption.d.ts +66 -0
  165. package/dist/react/consumption.js +109 -0
  166. package/dist/react/consumption.js.map +1 -0
  167. package/dist/react/cvs-app.d.ts +86 -0
  168. package/dist/react/cvs-app.js +144 -0
  169. package/dist/react/cvs-app.js.map +1 -0
  170. package/dist/react/cvs-documents.d.ts +254 -0
  171. package/dist/react/cvs-documents.js +418 -0
  172. package/dist/react/cvs-documents.js.map +1 -0
  173. package/dist/react/cvs-favorites.d.ts +143 -0
  174. package/dist/react/cvs-favorites.js +206 -0
  175. package/dist/react/cvs-favorites.js.map +1 -0
  176. package/dist/react/cvs-loans.d.ts +140 -0
  177. package/dist/react/cvs-loans.js +234 -0
  178. package/dist/react/cvs-loans.js.map +1 -0
  179. package/dist/react/cvs-streaming.d.ts +87 -0
  180. package/dist/react/cvs-streaming.js +141 -0
  181. package/dist/react/cvs-streaming.js.map +1 -0
  182. package/dist/react/index.d.ts +34 -0
  183. package/dist/react/index.js +34 -0
  184. package/dist/react/partner-catalogue.d.ts +223 -0
  185. package/dist/react/partner-catalogue.js +301 -0
  186. package/dist/react/partner-catalogue.js.map +1 -0
  187. package/dist/react/partner-reader.d.ts +159 -0
  188. package/dist/react/partner-reader.js +226 -0
  189. package/dist/react/partner-reader.js.map +1 -0
  190. package/dist/react/profiles.d.ts +174 -0
  191. package/dist/react/profiles.js +279 -0
  192. package/dist/react/profiles.js.map +1 -0
  193. package/dist/react/tutoring-catalogue.d.ts +115 -0
  194. package/dist/react/tutoring-catalogue.js +151 -0
  195. package/dist/react/tutoring-catalogue.js.map +1 -0
  196. package/dist/react/tutoring-chat.d.ts +96 -0
  197. package/dist/react/tutoring-chat.js +172 -0
  198. package/dist/react/tutoring-chat.js.map +1 -0
  199. package/dist/react/tutoring-dispatch.d.ts +102 -0
  200. package/dist/react/tutoring-dispatch.js +183 -0
  201. package/dist/react/tutoring-dispatch.js.map +1 -0
  202. package/dist/react/tutoring-practitioner.d.ts +129 -0
  203. package/dist/react/tutoring-practitioner.js +230 -0
  204. package/dist/react/tutoring-practitioner.js.map +1 -0
  205. package/dist/react/tutoring-requests.d.ts +233 -0
  206. package/dist/react/tutoring-requests.js +385 -0
  207. package/dist/react/tutoring-requests.js.map +1 -0
  208. package/package.json +70 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cvs-documents.js","names":[],"sources":["../../src/react/cvs-documents/cvs-documents.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n DocumentPage,\n DocumentRead,\n DocumentSearchWrite,\n HTTPExceptionResponse,\n LastPositionWrite,\n RatingUpdateWrite,\n ReviewRead,\n ReviewUpdateWrite,\n SupplierGrantRead,\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 getSearchDocumentsUrl = () => {\n\n\n\n\n return `/cvs/documents/search`\n}\n\n/**\n * Search the CVS catalogue.\n *\n * ``POST`` because the legacy put the query in the body and the mobile clients\n * send it that way. It is a read, so it stays safe: nothing here writes.\n *\n * Same division as ``/search``: the index ranks, PostgreSQL authorises. An\n * index outage degrades to no results rather than to an unfiltered catalogue.\n * @summary Search Documents\n */\nexport const searchDocuments = async (documentSearchWrite: DocumentSearchWrite, options?: Parameters<typeof request>[1]): Promise<DocumentPage> => {\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<DocumentPage>(getSearchDocumentsUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(documentSearchWrite)\n }\n);}\n\n\n\n\n\nexport const getSearchDocumentsMutationKey = () => ['searchDocuments'] as const;\n\nexport const getSearchDocumentsMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof searchDocuments>>, TError,SearchDocumentsMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof searchDocuments>>, TError,SearchDocumentsMutationVariables, TContext> => {\n\nconst mutationKey = getSearchDocumentsMutationKey();\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 searchDocuments>>, SearchDocumentsMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return searchDocuments(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type SearchDocumentsMutationResult = NonNullable<Awaited<ReturnType<typeof searchDocuments>>>\n export type SearchDocumentsMutationBody = BodyType<DocumentSearchWrite>\n export type SearchDocumentsMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type SearchDocumentsMutationVariables = {data: BodyType<DocumentSearchWrite>}\n\n /**\n * @summary Search Documents\n */\nexport const useSearchDocuments = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof searchDocuments>>, TError,SearchDocumentsMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof searchDocuments>>,\n TError,\n SearchDocumentsMutationVariables,\n TContext\n > => {\n return useMutation(getSearchDocumentsMutationOptions(options), queryClient);\n }\n export const getReadDocumentUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}`\n}\n\n/**\n * One work, if this caller's contract reaches it.\n *\n * Missing until now, which was an oversight rather than a decision: search,\n * rating, review and position all existed and there was no way to fetch the\n * thing they act on. The legacy has no equivalent either — the app assembles a\n * document sheet from whatever the menu endpoint already returned, which is why\n * a deep link into a title has never worked properly.\n * @summary Read Document\n */\nexport const readDocument = async (docId: number, options?: Parameters<typeof request>[1]): Promise<DocumentRead> => {\n\n return request<DocumentRead>(getReadDocumentUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadDocumentQueryKey = (docId: number,) => {\n return [\n `/cvs/documents/${docId}`\n ] as const;\n }\n\n\nexport const getReadDocumentQueryOptions = <TData = Awaited<ReturnType<typeof readDocument>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDocument>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadDocumentQueryKey(docId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readDocument>>> = ({ signal }) => readDocument(docId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: docId !== null && docId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readDocument>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadDocumentQueryResult = NonNullable<Awaited<ReturnType<typeof readDocument>>>\nexport type ReadDocumentQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadDocument<TData = Awaited<ReturnType<typeof readDocument>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDocument>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readDocument>>,\n TError,\n Awaited<ReturnType<typeof readDocument>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadDocument<TData = Awaited<ReturnType<typeof readDocument>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDocument>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readDocument>>,\n TError,\n Awaited<ReturnType<typeof readDocument>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadDocument<TData = Awaited<ReturnType<typeof readDocument>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDocument>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Document\n */\n\nexport function useReadDocument<TData = Awaited<ReturnType<typeof readDocument>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readDocument>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadDocumentQueryOptions(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 getOpenAtSupplierUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/grant`\n}\n\n/**\n * Authorise this patron to open one title at the supplier hosting it.\n *\n * Replaces the legacy ``wstoken``: 4,878 lines dispatching on\n * ``frn.plate_forme`` through 57 near-identical arms. The signing schemes\n * reduce to eight (:class:`~app.models.enums.TokenFormula`) and the platform\n * map to a table, so what is left here is the order of operations.\n *\n * **Entitle, seat, then sign** — the same order the streaming route uses, and\n * for the same reason. A signature is cheap to produce and impossible to\n * recall once it has left; a seat can be released. Signing first would mean a\n * refused request had already handed a patron something that works.\n *\n * ``404`` when the caller is not entitled or the title does not exist — the\n * two are deliberately indistinguishable, as everywhere else in this API.\n * ``409`` when every seat is taken: the caller *is* entitled and should be\n * offered \"try later\", not \"buy a subscription\". ``409`` too when the supplier\n * sits on a platform nobody implemented — four do, and the legacy cannot serve\n * them either, so the honest answer is that this title is not openable rather\n * than a 500 from a missing branch.\n *\n * The returned token is for the *supplier*, not for us. See\n * :class:`~app.datamodels.cvs.downloads.SupplierGrantRead`.\n * @summary Open At Supplier\n */\nexport const openAtSupplier = async (docId: number, options?: Parameters<typeof request>[1]): Promise<SupplierGrantRead> => {\n\n return request<SupplierGrantRead>(getOpenAtSupplierUrl(docId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getOpenAtSupplierMutationKey = () => ['openAtSupplier'] as const;\n\nexport const getOpenAtSupplierMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openAtSupplier>>, TError,OpenAtSupplierMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof openAtSupplier>>, TError,OpenAtSupplierMutationVariables, TContext> => {\n\nconst mutationKey = getOpenAtSupplierMutationKey();\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 openAtSupplier>>, OpenAtSupplierMutationVariables> = (props) => {\n const {docId} = props ?? {};\n\n return openAtSupplier(docId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OpenAtSupplierMutationResult = NonNullable<Awaited<ReturnType<typeof openAtSupplier>>>\n\n export type OpenAtSupplierMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type OpenAtSupplierMutationVariables = {docId: number}\n\n /**\n * @summary Open At Supplier\n */\nexport const useOpenAtSupplier = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openAtSupplier>>, TError,OpenAtSupplierMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof openAtSupplier>>,\n TError,\n OpenAtSupplierMutationVariables,\n TContext\n > => {\n return useMutation(getOpenAtSupplierMutationOptions(options), queryClient);\n }\n export const getReadLastPositionUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/position`\n}\n\n/**\n * Where this patron got to, or ``0`` if they have not started.\n *\n * New: the legacy has no way to read the position back, so a client that lost\n * its local state could never resume. Absent means not started, which is why\n * the row is not created on read.\n * @summary Read Last Position\n */\nexport const readLastPosition = async (docId: number, options?: Parameters<typeof request>[1]): Promise<LastPositionWrite> => {\n\n return request<LastPositionWrite>(getReadLastPositionUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadLastPositionQueryKey = (docId: number,) => {\n return [\n `/cvs/documents/${docId}/position`\n ] as const;\n }\n\n\nexport const getReadLastPositionQueryOptions = <TData = Awaited<ReturnType<typeof readLastPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readLastPosition>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadLastPositionQueryKey(docId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readLastPosition>>> = ({ signal }) => readLastPosition(docId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: docId !== null && docId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readLastPosition>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadLastPositionQueryResult = NonNullable<Awaited<ReturnType<typeof readLastPosition>>>\nexport type ReadLastPositionQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadLastPosition<TData = Awaited<ReturnType<typeof readLastPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readLastPosition>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readLastPosition>>,\n TError,\n Awaited<ReturnType<typeof readLastPosition>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadLastPosition<TData = Awaited<ReturnType<typeof readLastPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readLastPosition>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readLastPosition>>,\n TError,\n Awaited<ReturnType<typeof readLastPosition>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadLastPosition<TData = Awaited<ReturnType<typeof readLastPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readLastPosition>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Last Position\n */\n\nexport function useReadLastPosition<TData = Awaited<ReturnType<typeof readLastPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readLastPosition>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadLastPositionQueryOptions(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 getSetLastPositionUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/position`\n}\n\n/**\n * Record where this patron got to.\n *\n * A write, and the legacy declares it ``GET`` with the position in the query\n * string — which makes resuming a book a cacheable idempotent read that mutates\n * state, and puts it outside the CSRF layer for free.\n *\n * Stored in :class:`~app.models.activity.ReadingPosition`, which the products\n * share — CVS and the partner reader today — so a member who reads across them\n * keeps their place in one shape.\n * @summary Set Last Position\n */\nexport const setLastPosition = async (docId: number,\n lastPositionWrite: LastPositionWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getSetLastPositionUrl(docId),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(lastPositionWrite)\n }\n);}\n\n\n\n\n\nexport const getSetLastPositionMutationKey = () => ['setLastPosition'] as const;\n\nexport const getSetLastPositionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setLastPosition>>, TError,SetLastPositionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof setLastPosition>>, TError,SetLastPositionMutationVariables, TContext> => {\n\nconst mutationKey = getSetLastPositionMutationKey();\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 setLastPosition>>, SetLastPositionMutationVariables> = (props) => {\n const {docId,data} = props ?? {};\n\n return setLastPosition(docId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type SetLastPositionMutationResult = NonNullable<Awaited<ReturnType<typeof setLastPosition>>>\n export type SetLastPositionMutationBody = BodyType<LastPositionWrite>\n export type SetLastPositionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type SetLastPositionMutationVariables = {docId: number;data: BodyType<LastPositionWrite>}\n\n /**\n * @summary Set Last Position\n */\nexport const useSetLastPosition = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setLastPosition>>, TError,SetLastPositionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof setLastPosition>>,\n TError,\n SetLastPositionMutationVariables,\n TContext\n > => {\n return useMutation(getSetLastPositionMutationOptions(options), queryClient);\n }\n export const getRateDocumentUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/rating`\n}\n\n/**\n * Rate a document. Idempotent — rating again replaces the earlier score.\n *\n * ``PUT`` on the rating sub-resource rather than the legacy\n * ``POST /document/rating/update`` with the id in the body: the identifier\n * belongs in the path, and \"update\" in a path names an operation in a position\n * reserved for a resource.\n * @summary Rate Document\n */\nexport const rateDocument = async (docId: number,\n ratingUpdateWrite: RatingUpdateWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getRateDocumentUrl(docId),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(ratingUpdateWrite)\n }\n);}\n\n\n\n\n\nexport const getRateDocumentMutationKey = () => ['rateDocument'] as const;\n\nexport const getRateDocumentMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof rateDocument>>, TError,RateDocumentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof rateDocument>>, TError,RateDocumentMutationVariables, TContext> => {\n\nconst mutationKey = getRateDocumentMutationKey();\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 rateDocument>>, RateDocumentMutationVariables> = (props) => {\n const {docId,data} = props ?? {};\n\n return rateDocument(docId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type RateDocumentMutationResult = NonNullable<Awaited<ReturnType<typeof rateDocument>>>\n export type RateDocumentMutationBody = BodyType<RatingUpdateWrite>\n export type RateDocumentMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type RateDocumentMutationVariables = {docId: number;data: BodyType<RatingUpdateWrite>}\n\n /**\n * @summary Rate Document\n */\nexport const useRateDocument = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof rateDocument>>, TError,RateDocumentMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof rateDocument>>,\n TError,\n RateDocumentMutationVariables,\n TContext\n > => {\n return useMutation(getRateDocumentMutationOptions(options), queryClient);\n }\n export const getWriteReviewUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/review`\n}\n\n/**\n * Write or replace this patron's review of a document.\n *\n * One review per person per document, so this is a ``PUT`` on a singular\n * sub-resource rather than a ``POST`` to a collection. The legacy had two routes\n * — with and without an ``avisId`` — for what is one row.\n *\n * Every write resets the review to unpublished. An edit after moderation is a\n * new thing to moderate, and carrying the old approval forward is how an\n * approved review becomes a different text.\n * @summary Write Review\n */\nexport const writeReview = async (docId: number,\n reviewUpdateWrite: ReviewUpdateWrite, options?: Parameters<typeof request>[1]): Promise<ReviewRead> => {\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<ReviewRead>(getWriteReviewUrl(docId),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(reviewUpdateWrite)\n }\n);}\n\n\n\n\n\nexport const getWriteReviewMutationKey = () => ['writeReview'] as const;\n\nexport const getWriteReviewMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof writeReview>>, TError,WriteReviewMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof writeReview>>, TError,WriteReviewMutationVariables, TContext> => {\n\nconst mutationKey = getWriteReviewMutationKey();\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 writeReview>>, WriteReviewMutationVariables> = (props) => {\n const {docId,data} = props ?? {};\n\n return writeReview(docId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type WriteReviewMutationResult = NonNullable<Awaited<ReturnType<typeof writeReview>>>\n export type WriteReviewMutationBody = BodyType<ReviewUpdateWrite>\n export type WriteReviewMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type WriteReviewMutationVariables = {docId: number;data: BodyType<ReviewUpdateWrite>}\n\n /**\n * @summary Write Review\n */\nexport const useWriteReview = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof writeReview>>, TError,WriteReviewMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof writeReview>>,\n TError,\n WriteReviewMutationVariables,\n TContext\n > => {\n return useMutation(getWriteReviewMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA+CA,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,MAA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AAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAoB,kBAAkB,KAAK,GAChD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,iBAAiB;CACxC,CACF;AAAE;AAMF,MAAa,kCAAkC,CAAC,aAAa;AAE7D,MAAa,iCACW,YACyF;CAEjH,MAAM,cAAc,0BAA0B;CAC9C,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAAuG,UAAU;EACnH,MAAM,EAAC,OAAM,SAAQ,SAAS,CAAC;EAE/B,OAAQ,YAAY,OAAM,MAAK,cAAc;CAC/C;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,kBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,8BAA8B,OAAO,GAAG,WAAW;AACxE"}
@@ -0,0 +1,143 @@
1
+
2
+ import { Gn as HTTPExceptionResponse, rr as SelectionRead, t as ValidationErrorResponse, tr as FavoriteListRead } from "../chunks/index.js";
3
+ import { a as ErrorType, c as request } from "../chunks/client.js";
4
+ import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
5
+ //#region src/react/cvs-favorites/cvs-favorites.d.ts
6
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
7
+ export declare const getListCvsFavoritesUrl: () => string;
8
+ /**
9
+ * The caller's favourites.
10
+ *
11
+ * Entitlement-filtered. A title the library has stopped licensing stays in the
12
+ * list — removing it silently would lose the patron's own curation over a
13
+ * contract change they had nothing to do with — but it is not returned here,
14
+ * because a client cannot open it. When the licence comes back, so does the
15
+ * entry.
16
+ * @summary List Cvs Favorites
17
+ */
18
+ export declare const listCvsFavorites: (options?: Parameters<typeof request>[1]) => Promise<FavoriteListRead>;
19
+ export declare const getListCvsFavoritesQueryKey: () => readonly [`/cvs/favorites`];
20
+ export declare const getListCvsFavoritesQueryOptions: <TData = Awaited<ReturnType<typeof listCvsFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
21
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData>>;
22
+ request?: SecondParameter<typeof request>;
23
+ }) => UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData> & {
24
+ queryKey: DataTag<QueryKey, TData, TError>;
25
+ };
26
+ export type ListCvsFavoritesQueryResult = NonNullable<Awaited<ReturnType<typeof listCvsFavorites>>>;
27
+ export type ListCvsFavoritesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
28
+ export declare function useListCvsFavorites<TData = Awaited<ReturnType<typeof listCvsFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options: {
29
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, Awaited<ReturnType<typeof listCvsFavorites>>>, 'initialData'>;
30
+ request?: SecondParameter<typeof request>;
31
+ }, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
32
+ queryKey: DataTag<QueryKey, TData, TError>;
33
+ };
34
+ export declare function useListCvsFavorites<TData = Awaited<ReturnType<typeof listCvsFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
35
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, Awaited<ReturnType<typeof listCvsFavorites>>>, 'initialData'>;
36
+ request?: SecondParameter<typeof request>;
37
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
38
+ queryKey: DataTag<QueryKey, TData, TError>;
39
+ };
40
+ export declare function useListCvsFavorites<TData = Awaited<ReturnType<typeof listCvsFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
41
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData>>;
42
+ request?: SecondParameter<typeof request>;
43
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
44
+ queryKey: DataTag<QueryKey, TData, TError>;
45
+ };
46
+ export declare const getRemoveCvsFavoriteUrl: (docId: number) => string;
47
+ /**
48
+ * Remove a work from the caller's list. Idempotent.
49
+ *
50
+ * Scoped to ``kind = 8`` through the list lookup, so this can never delete a
51
+ * line out of the patron's loans or reservations — which live in the same two
52
+ * tables and would look identical to a query that only matched on
53
+ * ``(user_id, doc_id)``.
54
+ * @summary Remove Cvs Favorite
55
+ */
56
+ export declare const removeCvsFavorite: (docId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
57
+ export declare const getRemoveCvsFavoriteMutationKey: () => readonly ['removeCvsFavorite'];
58
+ export declare const getRemoveCvsFavoriteMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
59
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof removeCvsFavorite>>, TError, RemoveCvsFavoriteMutationVariables, TContext>;
60
+ request?: SecondParameter<typeof request>;
61
+ }) => UseMutationOptions<Awaited<ReturnType<typeof removeCvsFavorite>>, TError, RemoveCvsFavoriteMutationVariables, TContext>;
62
+ export type RemoveCvsFavoriteMutationResult = NonNullable<Awaited<ReturnType<typeof removeCvsFavorite>>>;
63
+ export type RemoveCvsFavoriteMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
64
+ export type RemoveCvsFavoriteMutationVariables = {
65
+ docId: number;
66
+ };
67
+ /**
68
+ * @summary Remove Cvs Favorite
69
+ */
70
+ export declare const useRemoveCvsFavorite: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
71
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof removeCvsFavorite>>, TError, RemoveCvsFavoriteMutationVariables, TContext>;
72
+ request?: SecondParameter<typeof request>;
73
+ }, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof removeCvsFavorite>>, TError, RemoveCvsFavoriteMutationVariables, TContext>;
74
+ export declare const getAddCvsFavoriteUrl: (docId: number) => string;
75
+ /**
76
+ * Add a work to the caller's list. Idempotent.
77
+ *
78
+ * ``PUT`` and ``DELETE`` on the item, rather than the legacy's single route
79
+ * answering both ``POST`` and ``DELETE`` on a path with a required
80
+ * ``{selectionId}`` its own handler declares optional.
81
+ *
82
+ * Not entitlement-gated. A patron may bookmark something their library has not
83
+ * licensed yet — that is a signal worth having, and it is what an acquisitions
84
+ * request is made of. Reaching the work is gated, at the point of reaching it.
85
+ * @summary Add Cvs Favorite
86
+ */
87
+ export declare const addCvsFavorite: (docId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
88
+ export declare const getAddCvsFavoriteMutationKey: () => readonly ['addCvsFavorite'];
89
+ export declare const getAddCvsFavoriteMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
90
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addCvsFavorite>>, TError, AddCvsFavoriteMutationVariables, TContext>;
91
+ request?: SecondParameter<typeof request>;
92
+ }) => UseMutationOptions<Awaited<ReturnType<typeof addCvsFavorite>>, TError, AddCvsFavoriteMutationVariables, TContext>;
93
+ export type AddCvsFavoriteMutationResult = NonNullable<Awaited<ReturnType<typeof addCvsFavorite>>>;
94
+ export type AddCvsFavoriteMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
95
+ export type AddCvsFavoriteMutationVariables = {
96
+ docId: number;
97
+ };
98
+ /**
99
+ * @summary Add Cvs Favorite
100
+ */
101
+ export declare const useAddCvsFavorite: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
102
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addCvsFavorite>>, TError, AddCvsFavoriteMutationVariables, TContext>;
103
+ request?: SecondParameter<typeof request>;
104
+ }, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof addCvsFavorite>>, TError, AddCvsFavoriteMutationVariables, TContext>;
105
+ export declare const getListSelectionsUrl: () => string;
106
+ /**
107
+ * Every list this patron holds, of every kind.
108
+ *
109
+ * Read-only and deliberately unfiltered: a client showing "my loans" and "my
110
+ * list" side by side needs to know which is which, and hiding the ILS-mirrored
111
+ * kinds would only make it guess.
112
+ * @summary List Selections
113
+ */
114
+ export declare const listSelections: (options?: Parameters<typeof request>[1]) => Promise<SelectionRead[]>;
115
+ export declare const getListSelectionsQueryKey: () => readonly [`/cvs/lists`];
116
+ export declare const getListSelectionsQueryOptions: <TData = Awaited<ReturnType<typeof listSelections>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
117
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData>>;
118
+ request?: SecondParameter<typeof request>;
119
+ }) => UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData> & {
120
+ queryKey: DataTag<QueryKey, TData, TError>;
121
+ };
122
+ export type ListSelectionsQueryResult = NonNullable<Awaited<ReturnType<typeof listSelections>>>;
123
+ export type ListSelectionsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
124
+ export declare function useListSelections<TData = Awaited<ReturnType<typeof listSelections>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options: {
125
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listSelections>>, TError, Awaited<ReturnType<typeof listSelections>>>, 'initialData'>;
126
+ request?: SecondParameter<typeof request>;
127
+ }, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
128
+ queryKey: DataTag<QueryKey, TData, TError>;
129
+ };
130
+ export declare function useListSelections<TData = Awaited<ReturnType<typeof listSelections>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
131
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listSelections>>, TError, Awaited<ReturnType<typeof listSelections>>>, 'initialData'>;
132
+ request?: SecondParameter<typeof request>;
133
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
134
+ queryKey: DataTag<QueryKey, TData, TError>;
135
+ };
136
+ export declare function useListSelections<TData = Awaited<ReturnType<typeof listSelections>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
137
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData>>;
138
+ request?: SecondParameter<typeof request>;
139
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
140
+ queryKey: DataTag<QueryKey, TData, TError>;
141
+ };
142
+ //#endregion
143
+ //# sourceMappingURL=cvs-favorites.d.ts.map
@@ -0,0 +1,206 @@
1
+ "use client";
2
+ import { r as request } from "../chunks/client.js";
3
+ import { useMutation, useQuery } from "@tanstack/react-query";
4
+ //#region src/react/cvs-favorites/cvs-favorites.ts
5
+ /**
6
+ * Generated by orval 🍺
7
+ * Do not edit manually.
8
+ * Mozaik backend
9
+ * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
10
+ * OpenAPI spec version: 0.1.0
11
+ */
12
+ const withQueryKey = (query, queryKey) => {
13
+ const result = { queryKey };
14
+ for (const key of Object.keys(query)) {
15
+ if (key === "queryKey") continue;
16
+ Object.defineProperty(result, key, {
17
+ enumerable: true,
18
+ configurable: true,
19
+ get: () => query[key]
20
+ });
21
+ }
22
+ return result;
23
+ };
24
+ const getListCvsFavoritesUrl = () => {
25
+ return `/cvs/favorites`;
26
+ };
27
+ /**
28
+ * The caller's favourites.
29
+ *
30
+ * Entitlement-filtered. A title the library has stopped licensing stays in the
31
+ * list — removing it silently would lose the patron's own curation over a
32
+ * contract change they had nothing to do with — but it is not returned here,
33
+ * because a client cannot open it. When the licence comes back, so does the
34
+ * entry.
35
+ * @summary List Cvs Favorites
36
+ */
37
+ const listCvsFavorites = async (options) => {
38
+ return request(getListCvsFavoritesUrl(), {
39
+ ...options,
40
+ method: "GET"
41
+ });
42
+ };
43
+ const getListCvsFavoritesQueryKey = () => {
44
+ return [`/cvs/favorites`];
45
+ };
46
+ const getListCvsFavoritesQueryOptions = (options) => {
47
+ const { query: queryOptions, request: requestOptions } = options ?? {};
48
+ const queryKey = queryOptions?.queryKey ?? getListCvsFavoritesQueryKey();
49
+ const queryFn = ({ signal }) => listCvsFavorites({
50
+ signal,
51
+ ...requestOptions
52
+ });
53
+ return {
54
+ queryKey,
55
+ queryFn,
56
+ ...queryOptions
57
+ };
58
+ };
59
+ /**
60
+ * @summary List Cvs Favorites
61
+ */
62
+ function useListCvsFavorites(options, queryClient) {
63
+ const queryOptions = getListCvsFavoritesQueryOptions(options);
64
+ const query = useQuery(queryOptions, queryClient);
65
+ return withQueryKey(query, queryOptions.queryKey);
66
+ }
67
+ const getRemoveCvsFavoriteUrl = (docId) => {
68
+ return `/cvs/favorites/${docId}`;
69
+ };
70
+ /**
71
+ * Remove a work from the caller's list. Idempotent.
72
+ *
73
+ * Scoped to ``kind = 8`` through the list lookup, so this can never delete a
74
+ * line out of the patron's loans or reservations — which live in the same two
75
+ * tables and would look identical to a query that only matched on
76
+ * ``(user_id, doc_id)``.
77
+ * @summary Remove Cvs Favorite
78
+ */
79
+ const removeCvsFavorite = async (docId, options) => {
80
+ return request(getRemoveCvsFavoriteUrl(docId), {
81
+ ...options,
82
+ method: "DELETE"
83
+ });
84
+ };
85
+ const getRemoveCvsFavoriteMutationKey = () => ["removeCvsFavorite"];
86
+ const getRemoveCvsFavoriteMutationOptions = (options) => {
87
+ const mutationKey = getRemoveCvsFavoriteMutationKey();
88
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
89
+ ...options,
90
+ mutation: {
91
+ ...options.mutation,
92
+ mutationKey
93
+ }
94
+ } : {
95
+ mutation: { mutationKey },
96
+ request: void 0
97
+ };
98
+ const mutationFn = (props) => {
99
+ const { docId } = props ?? {};
100
+ return removeCvsFavorite(docId, requestOptions);
101
+ };
102
+ return {
103
+ mutationFn,
104
+ ...mutationOptions
105
+ };
106
+ };
107
+ /**
108
+ * @summary Remove Cvs Favorite
109
+ */
110
+ const useRemoveCvsFavorite = (options, queryClient) => {
111
+ return useMutation(getRemoveCvsFavoriteMutationOptions(options), queryClient);
112
+ };
113
+ const getAddCvsFavoriteUrl = (docId) => {
114
+ return `/cvs/favorites/${docId}`;
115
+ };
116
+ /**
117
+ * Add a work to the caller's list. Idempotent.
118
+ *
119
+ * ``PUT`` and ``DELETE`` on the item, rather than the legacy's single route
120
+ * answering both ``POST`` and ``DELETE`` on a path with a required
121
+ * ``{selectionId}`` its own handler declares optional.
122
+ *
123
+ * Not entitlement-gated. A patron may bookmark something their library has not
124
+ * licensed yet — that is a signal worth having, and it is what an acquisitions
125
+ * request is made of. Reaching the work is gated, at the point of reaching it.
126
+ * @summary Add Cvs Favorite
127
+ */
128
+ const addCvsFavorite = async (docId, options) => {
129
+ return request(getAddCvsFavoriteUrl(docId), {
130
+ ...options,
131
+ method: "PUT"
132
+ });
133
+ };
134
+ const getAddCvsFavoriteMutationKey = () => ["addCvsFavorite"];
135
+ const getAddCvsFavoriteMutationOptions = (options) => {
136
+ const mutationKey = getAddCvsFavoriteMutationKey();
137
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
138
+ ...options,
139
+ mutation: {
140
+ ...options.mutation,
141
+ mutationKey
142
+ }
143
+ } : {
144
+ mutation: { mutationKey },
145
+ request: void 0
146
+ };
147
+ const mutationFn = (props) => {
148
+ const { docId } = props ?? {};
149
+ return addCvsFavorite(docId, requestOptions);
150
+ };
151
+ return {
152
+ mutationFn,
153
+ ...mutationOptions
154
+ };
155
+ };
156
+ /**
157
+ * @summary Add Cvs Favorite
158
+ */
159
+ const useAddCvsFavorite = (options, queryClient) => {
160
+ return useMutation(getAddCvsFavoriteMutationOptions(options), queryClient);
161
+ };
162
+ const getListSelectionsUrl = () => {
163
+ return `/cvs/lists`;
164
+ };
165
+ /**
166
+ * Every list this patron holds, of every kind.
167
+ *
168
+ * Read-only and deliberately unfiltered: a client showing "my loans" and "my
169
+ * list" side by side needs to know which is which, and hiding the ILS-mirrored
170
+ * kinds would only make it guess.
171
+ * @summary List Selections
172
+ */
173
+ const listSelections = async (options) => {
174
+ return request(getListSelectionsUrl(), {
175
+ ...options,
176
+ method: "GET"
177
+ });
178
+ };
179
+ const getListSelectionsQueryKey = () => {
180
+ return [`/cvs/lists`];
181
+ };
182
+ const getListSelectionsQueryOptions = (options) => {
183
+ const { query: queryOptions, request: requestOptions } = options ?? {};
184
+ const queryKey = queryOptions?.queryKey ?? getListSelectionsQueryKey();
185
+ const queryFn = ({ signal }) => listSelections({
186
+ signal,
187
+ ...requestOptions
188
+ });
189
+ return {
190
+ queryKey,
191
+ queryFn,
192
+ ...queryOptions
193
+ };
194
+ };
195
+ /**
196
+ * @summary List Selections
197
+ */
198
+ function useListSelections(options, queryClient) {
199
+ const queryOptions = getListSelectionsQueryOptions(options);
200
+ const query = useQuery(queryOptions, queryClient);
201
+ return withQueryKey(query, queryOptions.queryKey);
202
+ }
203
+ //#endregion
204
+ export { addCvsFavorite, getAddCvsFavoriteMutationKey, getAddCvsFavoriteMutationOptions, getAddCvsFavoriteUrl, getListCvsFavoritesQueryKey, getListCvsFavoritesQueryOptions, getListCvsFavoritesUrl, getListSelectionsQueryKey, getListSelectionsQueryOptions, getListSelectionsUrl, getRemoveCvsFavoriteMutationKey, getRemoveCvsFavoriteMutationOptions, getRemoveCvsFavoriteUrl, listCvsFavorites, listSelections, removeCvsFavorite, useAddCvsFavorite, useListCvsFavorites, useListSelections, useRemoveCvsFavorite };
205
+
206
+ //# sourceMappingURL=cvs-favorites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cvs-favorites.js","names":[],"sources":["../../src/react/cvs-favorites/cvs-favorites.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n FavoriteListRead,\n HTTPExceptionResponse,\n SelectionRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListCvsFavoritesUrl = () => {\n\n\n\n\n return `/cvs/favorites`\n}\n\n/**\n * The caller's favourites.\n *\n * Entitlement-filtered. A title the library has stopped licensing stays in the\n * list — removing it silently would lose the patron's own curation over a\n * contract change they had nothing to do with — but it is not returned here,\n * because a client cannot open it. When the licence comes back, so does the\n * entry.\n * @summary List Cvs Favorites\n */\nexport const listCvsFavorites = async ( options?: Parameters<typeof request>[1]): Promise<FavoriteListRead> => {\n\n return request<FavoriteListRead>(getListCvsFavoritesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListCvsFavoritesQueryKey = () => {\n return [\n `/cvs/favorites`\n ] as const;\n }\n\n\nexport const getListCvsFavoritesQueryOptions = <TData = Awaited<ReturnType<typeof listCvsFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListCvsFavoritesQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listCvsFavorites>>> = ({ signal }) => listCvsFavorites({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListCvsFavoritesQueryResult = NonNullable<Awaited<ReturnType<typeof listCvsFavorites>>>\nexport type ListCvsFavoritesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListCvsFavorites<TData = Awaited<ReturnType<typeof listCvsFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listCvsFavorites>>,\n TError,\n Awaited<ReturnType<typeof listCvsFavorites>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListCvsFavorites<TData = Awaited<ReturnType<typeof listCvsFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listCvsFavorites>>,\n TError,\n Awaited<ReturnType<typeof listCvsFavorites>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListCvsFavorites<TData = Awaited<ReturnType<typeof listCvsFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Cvs Favorites\n */\n\nexport function useListCvsFavorites<TData = Awaited<ReturnType<typeof listCvsFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCvsFavorites>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListCvsFavoritesQueryOptions(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 getRemoveCvsFavoriteUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/favorites/${docId}`\n}\n\n/**\n * Remove a work from the caller's list. Idempotent.\n *\n * Scoped to ``kind = 8`` through the list lookup, so this can never delete a\n * line out of the patron's loans or reservations — which live in the same two\n * tables and would look identical to a query that only matched on\n * ``(user_id, doc_id)``.\n * @summary Remove Cvs Favorite\n */\nexport const removeCvsFavorite = async (docId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getRemoveCvsFavoriteUrl(docId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getRemoveCvsFavoriteMutationKey = () => ['removeCvsFavorite'] as const;\n\nexport const getRemoveCvsFavoriteMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removeCvsFavorite>>, TError,RemoveCvsFavoriteMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof removeCvsFavorite>>, TError,RemoveCvsFavoriteMutationVariables, TContext> => {\n\nconst mutationKey = getRemoveCvsFavoriteMutationKey();\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 removeCvsFavorite>>, RemoveCvsFavoriteMutationVariables> = (props) => {\n const {docId} = props ?? {};\n\n return removeCvsFavorite(docId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type RemoveCvsFavoriteMutationResult = NonNullable<Awaited<ReturnType<typeof removeCvsFavorite>>>\n\n export type RemoveCvsFavoriteMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type RemoveCvsFavoriteMutationVariables = {docId: number}\n\n /**\n * @summary Remove Cvs Favorite\n */\nexport const useRemoveCvsFavorite = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removeCvsFavorite>>, TError,RemoveCvsFavoriteMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof removeCvsFavorite>>,\n TError,\n RemoveCvsFavoriteMutationVariables,\n TContext\n > => {\n return useMutation(getRemoveCvsFavoriteMutationOptions(options), queryClient);\n }\n export const getAddCvsFavoriteUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/favorites/${docId}`\n}\n\n/**\n * Add a work to the caller's list. Idempotent.\n *\n * ``PUT`` and ``DELETE`` on the item, rather than the legacy's single route\n * answering both ``POST`` and ``DELETE`` on a path with a required\n * ``{selectionId}`` its own handler declares optional.\n *\n * Not entitlement-gated. A patron may bookmark something their library has not\n * licensed yet — that is a signal worth having, and it is what an acquisitions\n * request is made of. Reaching the work is gated, at the point of reaching it.\n * @summary Add Cvs Favorite\n */\nexport const addCvsFavorite = async (docId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getAddCvsFavoriteUrl(docId),\n {\n ...options,\n method: 'PUT'\n\n\n }\n);}\n\n\n\n\n\nexport const getAddCvsFavoriteMutationKey = () => ['addCvsFavorite'] as const;\n\nexport const getAddCvsFavoriteMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addCvsFavorite>>, TError,AddCvsFavoriteMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof addCvsFavorite>>, TError,AddCvsFavoriteMutationVariables, TContext> => {\n\nconst mutationKey = getAddCvsFavoriteMutationKey();\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 addCvsFavorite>>, AddCvsFavoriteMutationVariables> = (props) => {\n const {docId} = props ?? {};\n\n return addCvsFavorite(docId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AddCvsFavoriteMutationResult = NonNullable<Awaited<ReturnType<typeof addCvsFavorite>>>\n\n export type AddCvsFavoriteMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type AddCvsFavoriteMutationVariables = {docId: number}\n\n /**\n * @summary Add Cvs Favorite\n */\nexport const useAddCvsFavorite = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addCvsFavorite>>, TError,AddCvsFavoriteMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof addCvsFavorite>>,\n TError,\n AddCvsFavoriteMutationVariables,\n TContext\n > => {\n return useMutation(getAddCvsFavoriteMutationOptions(options), queryClient);\n }\n export const getListSelectionsUrl = () => {\n\n\n\n\n return `/cvs/lists`\n}\n\n/**\n * Every list this patron holds, of every kind.\n *\n * Read-only and deliberately unfiltered: a client showing \"my loans\" and \"my\n * list\" side by side needs to know which is which, and hiding the ILS-mirrored\n * kinds would only make it guess.\n * @summary List Selections\n */\nexport const listSelections = async ( options?: Parameters<typeof request>[1]): Promise<SelectionRead[]> => {\n\n return request<SelectionRead[]>(getListSelectionsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListSelectionsQueryKey = () => {\n return [\n `/cvs/lists`\n ] as const;\n }\n\n\nexport const getListSelectionsQueryOptions = <TData = Awaited<ReturnType<typeof listSelections>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListSelectionsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listSelections>>> = ({ signal }) => listSelections({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListSelectionsQueryResult = NonNullable<Awaited<ReturnType<typeof listSelections>>>\nexport type ListSelectionsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListSelections<TData = Awaited<ReturnType<typeof listSelections>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSelections>>,\n TError,\n Awaited<ReturnType<typeof listSelections>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSelections<TData = Awaited<ReturnType<typeof listSelections>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSelections>>,\n TError,\n Awaited<ReturnType<typeof listSelections>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSelections<TData = Awaited<ReturnType<typeof listSelections>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Selections\n */\n\nexport function useListSelections<TData = Awaited<ReturnType<typeof listSelections>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSelections>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListSelectionsQueryOptions(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":";;;;;;;;;;;AAyCA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,+BAA+B;CAK1C,OAAO;AACT;;;;;;;;;;;AAYA,MAAa,mBAAmB,OAAQ,YAAuE;CAE7G,OAAO,QAA0B,uBAAuB,GACxD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,oCAAoC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AEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD"}
@@ -0,0 +1,140 @@
1
+
2
+ import { Gn as HTTPExceptionResponse, Ur as BorrowWrite, nn as LoanPage, rn as LoanRead, t as ValidationErrorResponse, yn as ListLoansParams } from "../chunks/index.js";
3
+ import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
4
+ import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
5
+ //#region src/react/cvs-loans/cvs-loans.d.ts
6
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
7
+ export declare const getListLoansUrl: (params?: ListLoansParams) => string;
8
+ /**
9
+ * What this caller currently holds (and optionally what they have returned).
10
+ *
11
+ * Replaces ``/download/details``, which took a ``downloadid`` and answered about
12
+ * one loan at a time — so a client rebuilding its shelf after reinstalling made
13
+ * one request per title, and had no way to discover the ids in the first place.
14
+ * @summary List Loans
15
+ */
16
+ export declare const listLoans: (params?: ListLoansParams, options?: Parameters<typeof request>[1]) => Promise<LoanPage>;
17
+ export declare const getListLoansQueryKey: (params?: ListLoansParams) => readonly ["/cvs/loans", ...ListLoansParams[]];
18
+ export declare const getListLoansQueryOptions: <TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListLoansParams, options?: {
19
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>;
20
+ request?: SecondParameter<typeof request>;
21
+ }) => UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData> & {
22
+ queryKey: DataTag<QueryKey, TData, TError>;
23
+ };
24
+ export type ListLoansQueryResult = NonNullable<Awaited<ReturnType<typeof listLoans>>>;
25
+ export type ListLoansQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
26
+ export declare function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: undefined | ListLoansParams, options: {
27
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listLoans>>, TError, Awaited<ReturnType<typeof listLoans>>>, 'initialData'>;
28
+ request?: SecondParameter<typeof request>;
29
+ }, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
30
+ queryKey: DataTag<QueryKey, TData, TError>;
31
+ };
32
+ export declare function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListLoansParams, options?: {
33
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listLoans>>, TError, Awaited<ReturnType<typeof listLoans>>>, 'initialData'>;
34
+ request?: SecondParameter<typeof request>;
35
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
36
+ queryKey: DataTag<QueryKey, TData, TError>;
37
+ };
38
+ export declare function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListLoansParams, options?: {
39
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>;
40
+ request?: SecondParameter<typeof request>;
41
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
42
+ queryKey: DataTag<QueryKey, TData, TError>;
43
+ };
44
+ export declare const getBorrowUrl: () => string;
45
+ /**
46
+ * Borrow a work.
47
+ *
48
+ * The order matters and is the whole point of the entitlement model:
49
+ *
50
+ * 1. **Entitled?** — is this act permitted on this work under a live contract.
51
+ * 2. **A seat free?** — ``max_concurrent`` counted from unreturned loans.
52
+ * 3. **Units left?** — reserved in Redis *before* the row is written, so a
53
+ * refusal costs no database work.
54
+ * 4. **Append.** The ledger row is the loan.
55
+ *
56
+ * Idempotent on ``request_key``: a retried borrow returns the loan the first
57
+ * attempt created rather than taking a second copy of the same title.
58
+ * @summary Borrow
59
+ */
60
+ export declare const borrow: (borrowWrite: BorrowWrite, options?: Parameters<typeof request>[1]) => Promise<LoanRead>;
61
+ export declare const getBorrowMutationKey: () => readonly ['borrow'];
62
+ export declare const getBorrowMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
63
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError, BorrowMutationVariables, TContext>;
64
+ request?: SecondParameter<typeof request>;
65
+ }) => UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError, BorrowMutationVariables, TContext>;
66
+ export type BorrowMutationResult = NonNullable<Awaited<ReturnType<typeof borrow>>>;
67
+ export type BorrowMutationBody = BodyType<BorrowWrite>;
68
+ export type BorrowMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
69
+ export type BorrowMutationVariables = {
70
+ data: BodyType<BorrowWrite>;
71
+ };
72
+ /**
73
+ * @summary Borrow
74
+ */
75
+ export declare const useBorrow: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
76
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError, BorrowMutationVariables, TContext>;
77
+ request?: SecondParameter<typeof request>;
78
+ }, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof borrow>>, TError, BorrowMutationVariables, TContext>;
79
+ export declare const getReturnLoanUrl: (loanId: number) => string;
80
+ /**
81
+ * Give a loan back early, freeing its seat. Idempotent.
82
+ *
83
+ * Returning something already returned is ``204``: the caller wanted it back on
84
+ * the shelf and it is on the shelf. The legacy answered an error, which meant a
85
+ * retried return looked like a failure and clients stopped retrying.
86
+ *
87
+ * The unit stays spent — see the module docstring. Only the seat comes back.
88
+ * @summary Return Loan
89
+ */
90
+ export declare const returnLoan: (loanId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
91
+ export declare const getReturnLoanMutationKey: () => readonly ['returnLoan'];
92
+ export declare const getReturnLoanMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
93
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError, ReturnLoanMutationVariables, TContext>;
94
+ request?: SecondParameter<typeof request>;
95
+ }) => UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError, ReturnLoanMutationVariables, TContext>;
96
+ export type ReturnLoanMutationResult = NonNullable<Awaited<ReturnType<typeof returnLoan>>>;
97
+ export type ReturnLoanMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
98
+ export type ReturnLoanMutationVariables = {
99
+ loanId: number;
100
+ };
101
+ /**
102
+ * @summary Return Loan
103
+ */
104
+ export declare const useReturnLoan: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
105
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError, ReturnLoanMutationVariables, TContext>;
106
+ request?: SecondParameter<typeof request>;
107
+ }, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof returnLoan>>, TError, ReturnLoanMutationVariables, TContext>;
108
+ export declare const getExtendLoanUrl: (loanId: number) => string;
109
+ /**
110
+ * Prolong a loan.
111
+ *
112
+ * Bounded by the grant's ``max_extensions`` — the legacy's ``nb_extend`` — and
113
+ * refused once the loan has been returned or has lapsed. Extending something
114
+ * that already expired is not an extension, it is a new loan, and it should
115
+ * spend a new unit rather than quietly avoid one.
116
+ *
117
+ * Not idempotent, deliberately: two extension requests mean two extensions, and
118
+ * a client that wants exactly one should not send two.
119
+ * @summary Extend Loan
120
+ */
121
+ export declare const extendLoan: (loanId: number, options?: Parameters<typeof request>[1]) => Promise<LoanRead>;
122
+ export declare const getExtendLoanMutationKey: () => readonly ['extendLoan'];
123
+ export declare const getExtendLoanMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
124
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError, ExtendLoanMutationVariables, TContext>;
125
+ request?: SecondParameter<typeof request>;
126
+ }) => UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError, ExtendLoanMutationVariables, TContext>;
127
+ export type ExtendLoanMutationResult = NonNullable<Awaited<ReturnType<typeof extendLoan>>>;
128
+ export type ExtendLoanMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
129
+ export type ExtendLoanMutationVariables = {
130
+ loanId: number;
131
+ };
132
+ /**
133
+ * @summary Extend Loan
134
+ */
135
+ export declare const useExtendLoan: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
136
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError, ExtendLoanMutationVariables, TContext>;
137
+ request?: SecondParameter<typeof request>;
138
+ }, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof extendLoan>>, TError, ExtendLoanMutationVariables, TContext>;
139
+ //#endregion
140
+ //# sourceMappingURL=cvs-loans.d.ts.map