@learnorama/mozaik-sdk 0.1.0

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/client-BDwBZYB0.d.ts +28 -0
  101. package/dist/client-D3kMOcIr.js +61 -0
  102. package/dist/client-D3kMOcIr.js.map +1 -0
  103. package/dist/index-wL_20vR8.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 +58 -0
@@ -0,0 +1,301 @@
1
+ "use client";
2
+ import { r as request } from "../client-D3kMOcIr.js";
3
+ import { useMutation, useQuery } from "@tanstack/react-query";
4
+ //#region src/react/partner-catalogue/partner-catalogue.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 getListPartnerCategoriesUrl = (provider) => {
25
+ return `/partners/${provider}/categories`;
26
+ };
27
+ /**
28
+ * The provider's taxonomy, with a count per node for this caller's slice.
29
+ *
30
+ * Counts come from ``partner_category_total`` and are summed across languages,
31
+ * because the menu shows one number and the rollup is keyed per language. A
32
+ * node with no matching rollup row reports ``0`` rather than being hidden: the
33
+ * tree shape is stable, and a branch that vanishes because today's import found
34
+ * nothing in it is harder to reason about than one that reads zero.
35
+ * @summary List Partner Categories
36
+ */
37
+ const listPartnerCategories = async (provider, options) => {
38
+ return request(getListPartnerCategoriesUrl(provider), {
39
+ ...options,
40
+ method: "GET"
41
+ });
42
+ };
43
+ const getListPartnerCategoriesQueryKey = (provider) => {
44
+ return [`/partners/${provider}/categories`];
45
+ };
46
+ const getListPartnerCategoriesQueryOptions = (provider, options) => {
47
+ const { query: queryOptions, request: requestOptions } = options ?? {};
48
+ const queryKey = queryOptions?.queryKey ?? getListPartnerCategoriesQueryKey(provider);
49
+ const queryFn = ({ signal }) => listPartnerCategories(provider, {
50
+ signal,
51
+ ...requestOptions
52
+ });
53
+ return {
54
+ queryKey,
55
+ queryFn,
56
+ enabled: provider !== null && provider !== void 0,
57
+ ...queryOptions
58
+ };
59
+ };
60
+ /**
61
+ * @summary List Partner Categories
62
+ */
63
+ function useListPartnerCategories(provider, options, queryClient) {
64
+ const queryOptions = getListPartnerCategoriesQueryOptions(provider, options);
65
+ const query = useQuery(queryOptions, queryClient);
66
+ return withQueryKey(query, queryOptions.queryKey);
67
+ }
68
+ const getListPartnerFavoritesUrl = (provider) => {
69
+ return `/partners/${provider}/favorites`;
70
+ };
71
+ /**
72
+ * This reader's bookmarks, filtered to what they may still see.
73
+ *
74
+ * The filter matters: a title can become adult-only, or leave the plan, between
75
+ * being bookmarked and being listed. The legacy joined favourites to media with
76
+ * no visibility predicate at all.
77
+ * @summary List Partner Favorites
78
+ */
79
+ const listPartnerFavorites = async (provider, options) => {
80
+ return request(getListPartnerFavoritesUrl(provider), {
81
+ ...options,
82
+ method: "GET"
83
+ });
84
+ };
85
+ const getListPartnerFavoritesQueryKey = (provider) => {
86
+ return [`/partners/${provider}/favorites`];
87
+ };
88
+ const getListPartnerFavoritesQueryOptions = (provider, options) => {
89
+ const { query: queryOptions, request: requestOptions } = options ?? {};
90
+ const queryKey = queryOptions?.queryKey ?? getListPartnerFavoritesQueryKey(provider);
91
+ const queryFn = ({ signal }) => listPartnerFavorites(provider, {
92
+ signal,
93
+ ...requestOptions
94
+ });
95
+ return {
96
+ queryKey,
97
+ queryFn,
98
+ enabled: provider !== null && provider !== void 0,
99
+ ...queryOptions
100
+ };
101
+ };
102
+ /**
103
+ * @summary List Partner Favorites
104
+ */
105
+ function useListPartnerFavorites(provider, options, queryClient) {
106
+ const queryOptions = getListPartnerFavoritesQueryOptions(provider, options);
107
+ const query = useQuery(queryOptions, queryClient);
108
+ return withQueryKey(query, queryOptions.queryKey);
109
+ }
110
+ const getRemovePartnerFavoriteUrl = (provider, mediaId) => {
111
+ return `/partners/${provider}/favorites/${mediaId}`;
112
+ };
113
+ /**
114
+ * Remove a bookmark. Idempotent, and deliberately not visibility-filtered.
115
+ *
116
+ * A reader must be able to unbookmark a title they can no longer see —
117
+ * otherwise a media leaving their plan strands a row they have no way to
118
+ * remove.
119
+ * @summary Remove Partner Favorite
120
+ */
121
+ const removePartnerFavorite = async (provider, mediaId, options) => {
122
+ return request(getRemovePartnerFavoriteUrl(provider, mediaId), {
123
+ ...options,
124
+ method: "DELETE"
125
+ });
126
+ };
127
+ const getRemovePartnerFavoriteMutationKey = () => ["removePartnerFavorite"];
128
+ const getRemovePartnerFavoriteMutationOptions = (options) => {
129
+ const mutationKey = getRemovePartnerFavoriteMutationKey();
130
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
131
+ ...options,
132
+ mutation: {
133
+ ...options.mutation,
134
+ mutationKey
135
+ }
136
+ } : {
137
+ mutation: { mutationKey },
138
+ request: void 0
139
+ };
140
+ const mutationFn = (props) => {
141
+ const { provider, mediaId } = props ?? {};
142
+ return removePartnerFavorite(provider, mediaId, requestOptions);
143
+ };
144
+ return {
145
+ mutationFn,
146
+ ...mutationOptions
147
+ };
148
+ };
149
+ /**
150
+ * @summary Remove Partner Favorite
151
+ */
152
+ const useRemovePartnerFavorite = (options, queryClient) => {
153
+ return useMutation(getRemovePartnerFavoriteMutationOptions(options), queryClient);
154
+ };
155
+ const getAddPartnerFavoriteUrl = (provider, mediaId) => {
156
+ return `/partners/${provider}/favorites/${mediaId}`;
157
+ };
158
+ /**
159
+ * Bookmark a title. Idempotent.
160
+ *
161
+ * ``PUT``/``DELETE`` rather than the legacy's ``POST /toggle-favorite.json``. A
162
+ * toggle is not idempotent, and the legacy's had no uniqueness behind it: two
163
+ * tabs toggling at once left two rows, and un-toggling then removed one of
164
+ * them, so the title stayed bookmarked.
165
+ * @summary Add Partner Favorite
166
+ */
167
+ const addPartnerFavorite = async (provider, mediaId, options) => {
168
+ return request(getAddPartnerFavoriteUrl(provider, mediaId), {
169
+ ...options,
170
+ method: "PUT"
171
+ });
172
+ };
173
+ const getAddPartnerFavoriteMutationKey = () => ["addPartnerFavorite"];
174
+ const getAddPartnerFavoriteMutationOptions = (options) => {
175
+ const mutationKey = getAddPartnerFavoriteMutationKey();
176
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
177
+ ...options,
178
+ mutation: {
179
+ ...options.mutation,
180
+ mutationKey
181
+ }
182
+ } : {
183
+ mutation: { mutationKey },
184
+ request: void 0
185
+ };
186
+ const mutationFn = (props) => {
187
+ const { provider, mediaId } = props ?? {};
188
+ return addPartnerFavorite(provider, mediaId, requestOptions);
189
+ };
190
+ return {
191
+ mutationFn,
192
+ ...mutationOptions
193
+ };
194
+ };
195
+ /**
196
+ * @summary Add Partner Favorite
197
+ */
198
+ const useAddPartnerFavorite = (options, queryClient) => {
199
+ return useMutation(getAddPartnerFavoriteMutationOptions(options), queryClient);
200
+ };
201
+ const getListMediaUrl = (provider, params) => {
202
+ const normalizedParams = new URLSearchParams();
203
+ Object.entries(params || {}).forEach(([key, value]) => {
204
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
205
+ });
206
+ const stringifiedParams = normalizedParams.toString();
207
+ return stringifiedParams.length > 0 ? `/partners/${provider}/media?${stringifiedParams}` : `/partners/${provider}/media`;
208
+ };
209
+ /**
210
+ * A page of the catalogue.
211
+ *
212
+ * ``q`` ranks through Elasticsearch and then **intersects** with the same
213
+ * visibility subquery as an unfiltered listing — the index knows nothing about
214
+ * plans or ages, so authorisation happens here whatever the index returns. An
215
+ * index that is missing or unreachable yields no candidates, which reads as an
216
+ * empty page rather than an unfiltered one.
217
+ *
218
+ * A search result keeps the index's ranking rather than applying ``order``:
219
+ * re-sorting relevance by publication date discards the only thing the search
220
+ * contributed. That is why ``order`` is ignored when ``q`` is present, not
221
+ * silently combined with it.
222
+ * @summary List Media
223
+ */
224
+ const listMedia = async (provider, params, options) => {
225
+ return request(getListMediaUrl(provider, params), {
226
+ ...options,
227
+ method: "GET"
228
+ });
229
+ };
230
+ const getListMediaQueryKey = (provider, params) => {
231
+ return [`/partners/${provider}/media`, ...params ? [params] : []];
232
+ };
233
+ const getListMediaQueryOptions = (provider, params, options) => {
234
+ const { query: queryOptions, request: requestOptions } = options ?? {};
235
+ const queryKey = queryOptions?.queryKey ?? getListMediaQueryKey(provider, params);
236
+ const queryFn = ({ signal }) => listMedia(provider, params, {
237
+ signal,
238
+ ...requestOptions
239
+ });
240
+ return {
241
+ queryKey,
242
+ queryFn,
243
+ enabled: provider !== null && provider !== void 0,
244
+ ...queryOptions
245
+ };
246
+ };
247
+ /**
248
+ * @summary List Media
249
+ */
250
+ function useListMedia(provider, params, options, queryClient) {
251
+ const queryOptions = getListMediaQueryOptions(provider, params, options);
252
+ const query = useQuery(queryOptions, queryClient);
253
+ return withQueryKey(query, queryOptions.queryKey);
254
+ }
255
+ const getReadMediaUrl = (provider, mediaId) => {
256
+ return `/partners/${provider}/media/${mediaId}`;
257
+ };
258
+ /**
259
+ * One title.
260
+ *
261
+ * A media outside the caller's slice is ``404``, not ``403``: whether an adult
262
+ * title exists is itself something a minor's client should not be able to
263
+ * determine, and the legacy's detail page dereferenced an unknown id straight
264
+ * into a 500.
265
+ * @summary Read Media
266
+ */
267
+ const readMedia = async (provider, mediaId, options) => {
268
+ return request(getReadMediaUrl(provider, mediaId), {
269
+ ...options,
270
+ method: "GET"
271
+ });
272
+ };
273
+ const getReadMediaQueryKey = (provider, mediaId) => {
274
+ return [`/partners/${provider}/media/${mediaId}`];
275
+ };
276
+ const getReadMediaQueryOptions = (provider, mediaId, options) => {
277
+ const { query: queryOptions, request: requestOptions } = options ?? {};
278
+ const queryKey = queryOptions?.queryKey ?? getReadMediaQueryKey(provider, mediaId);
279
+ const queryFn = ({ signal }) => readMedia(provider, mediaId, {
280
+ signal,
281
+ ...requestOptions
282
+ });
283
+ return {
284
+ queryKey,
285
+ queryFn,
286
+ enabled: provider !== null && provider !== void 0 && mediaId !== null && mediaId !== void 0,
287
+ ...queryOptions
288
+ };
289
+ };
290
+ /**
291
+ * @summary Read Media
292
+ */
293
+ function useReadMedia(provider, mediaId, options, queryClient) {
294
+ const queryOptions = getReadMediaQueryOptions(provider, mediaId, options);
295
+ const query = useQuery(queryOptions, queryClient);
296
+ return withQueryKey(query, queryOptions.queryKey);
297
+ }
298
+ //#endregion
299
+ export { addPartnerFavorite, getAddPartnerFavoriteMutationKey, getAddPartnerFavoriteMutationOptions, getAddPartnerFavoriteUrl, getListMediaQueryKey, getListMediaQueryOptions, getListMediaUrl, getListPartnerCategoriesQueryKey, getListPartnerCategoriesQueryOptions, getListPartnerCategoriesUrl, getListPartnerFavoritesQueryKey, getListPartnerFavoritesQueryOptions, getListPartnerFavoritesUrl, getReadMediaQueryKey, getReadMediaQueryOptions, getReadMediaUrl, getRemovePartnerFavoriteMutationKey, getRemovePartnerFavoriteMutationOptions, getRemovePartnerFavoriteUrl, listMedia, listPartnerCategories, listPartnerFavorites, readMedia, removePartnerFavorite, useAddPartnerFavorite, useListMedia, useListPartnerCategories, useListPartnerFavorites, useReadMedia, useRemovePartnerFavorite };
300
+
301
+ //# sourceMappingURL=partner-catalogue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partner-catalogue.js","names":[],"sources":["../../src/react/partner-catalogue/partner-catalogue.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n 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 ListMediaParams,\n PartnerCategoryListRead,\n PartnerFavoriteListRead,\n PartnerMediaPage,\n PartnerMediaRead,\n PartnerProvider,\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 getListPartnerCategoriesUrl = (provider: PartnerProvider,) => {\n\n\n\n\n return `/partners/${provider}/categories`\n}\n\n/**\n * The provider's taxonomy, with a count per node for this caller's slice.\n *\n * Counts come from ``partner_category_total`` and are summed across languages,\n * because the menu shows one number and the rollup is keyed per language. A\n * node with no matching rollup row reports ``0`` rather than being hidden: the\n * tree shape is stable, and a branch that vanishes because today's import found\n * nothing in it is harder to reason about than one that reads zero.\n * @summary List Partner Categories\n */\nexport const listPartnerCategories = async (provider: PartnerProvider, options?: Parameters<typeof request>[1]): Promise<PartnerCategoryListRead> => {\n\n return request<PartnerCategoryListRead>(getListPartnerCategoriesUrl(provider),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListPartnerCategoriesQueryKey = (provider: PartnerProvider,) => {\n return [\n `/partners/${provider}/categories`\n ] as const;\n }\n\n\nexport const getListPartnerCategoriesQueryOptions = <TData = Awaited<ReturnType<typeof listPartnerCategories>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerCategories>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListPartnerCategoriesQueryKey(provider);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listPartnerCategories>>> = ({ signal }) => listPartnerCategories(provider, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: provider !== null && provider !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listPartnerCategories>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListPartnerCategoriesQueryResult = NonNullable<Awaited<ReturnType<typeof listPartnerCategories>>>\nexport type ListPartnerCategoriesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListPartnerCategories<TData = Awaited<ReturnType<typeof listPartnerCategories>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerCategories>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPartnerCategories>>,\n TError,\n Awaited<ReturnType<typeof listPartnerCategories>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPartnerCategories<TData = Awaited<ReturnType<typeof listPartnerCategories>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerCategories>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPartnerCategories>>,\n TError,\n Awaited<ReturnType<typeof listPartnerCategories>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPartnerCategories<TData = Awaited<ReturnType<typeof listPartnerCategories>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerCategories>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Partner Categories\n */\n\nexport function useListPartnerCategories<TData = Awaited<ReturnType<typeof listPartnerCategories>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerCategories>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListPartnerCategoriesQueryOptions(provider,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 getListPartnerFavoritesUrl = (provider: PartnerProvider,) => {\n\n\n\n\n return `/partners/${provider}/favorites`\n}\n\n/**\n * This reader's bookmarks, filtered to what they may still see.\n *\n * The filter matters: a title can become adult-only, or leave the plan, between\n * being bookmarked and being listed. The legacy joined favourites to media with\n * no visibility predicate at all.\n * @summary List Partner Favorites\n */\nexport const listPartnerFavorites = async (provider: PartnerProvider, options?: Parameters<typeof request>[1]): Promise<PartnerFavoriteListRead> => {\n\n return request<PartnerFavoriteListRead>(getListPartnerFavoritesUrl(provider),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListPartnerFavoritesQueryKey = (provider: PartnerProvider,) => {\n return [\n `/partners/${provider}/favorites`\n ] as const;\n }\n\n\nexport const getListPartnerFavoritesQueryOptions = <TData = Awaited<ReturnType<typeof listPartnerFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerFavorites>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListPartnerFavoritesQueryKey(provider);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listPartnerFavorites>>> = ({ signal }) => listPartnerFavorites(provider, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: provider !== null && provider !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listPartnerFavorites>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListPartnerFavoritesQueryResult = NonNullable<Awaited<ReturnType<typeof listPartnerFavorites>>>\nexport type ListPartnerFavoritesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListPartnerFavorites<TData = Awaited<ReturnType<typeof listPartnerFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerFavorites>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPartnerFavorites>>,\n TError,\n Awaited<ReturnType<typeof listPartnerFavorites>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPartnerFavorites<TData = Awaited<ReturnType<typeof listPartnerFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerFavorites>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPartnerFavorites>>,\n TError,\n Awaited<ReturnType<typeof listPartnerFavorites>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPartnerFavorites<TData = Awaited<ReturnType<typeof listPartnerFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerFavorites>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Partner Favorites\n */\n\nexport function useListPartnerFavorites<TData = Awaited<ReturnType<typeof listPartnerFavorites>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPartnerFavorites>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListPartnerFavoritesQueryOptions(provider,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 getRemovePartnerFavoriteUrl = (provider: PartnerProvider,\n mediaId: number,) => {\n\n\n\n\n return `/partners/${provider}/favorites/${mediaId}`\n}\n\n/**\n * Remove a bookmark. Idempotent, and deliberately not visibility-filtered.\n *\n * A reader must be able to unbookmark a title they can no longer see —\n * otherwise a media leaving their plan strands a row they have no way to\n * remove.\n * @summary Remove Partner Favorite\n */\nexport const removePartnerFavorite = async (provider: PartnerProvider,\n mediaId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getRemovePartnerFavoriteUrl(provider,mediaId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getRemovePartnerFavoriteMutationKey = () => ['removePartnerFavorite'] as const;\n\nexport const getRemovePartnerFavoriteMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removePartnerFavorite>>, TError,RemovePartnerFavoriteMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof removePartnerFavorite>>, TError,RemovePartnerFavoriteMutationVariables, TContext> => {\n\nconst mutationKey = getRemovePartnerFavoriteMutationKey();\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 removePartnerFavorite>>, RemovePartnerFavoriteMutationVariables> = (props) => {\n const {provider,mediaId} = props ?? {};\n\n return removePartnerFavorite(provider,mediaId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type RemovePartnerFavoriteMutationResult = NonNullable<Awaited<ReturnType<typeof removePartnerFavorite>>>\n\n export type RemovePartnerFavoriteMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type RemovePartnerFavoriteMutationVariables = {provider: PartnerProvider;mediaId: number}\n\n /**\n * @summary Remove Partner Favorite\n */\nexport const useRemovePartnerFavorite = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removePartnerFavorite>>, TError,RemovePartnerFavoriteMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof removePartnerFavorite>>,\n TError,\n RemovePartnerFavoriteMutationVariables,\n TContext\n > => {\n return useMutation(getRemovePartnerFavoriteMutationOptions(options), queryClient);\n }\n export const getAddPartnerFavoriteUrl = (provider: PartnerProvider,\n mediaId: number,) => {\n\n\n\n\n return `/partners/${provider}/favorites/${mediaId}`\n}\n\n/**\n * Bookmark a title. Idempotent.\n *\n * ``PUT``/``DELETE`` rather than the legacy's ``POST /toggle-favorite.json``. A\n * toggle is not idempotent, and the legacy's had no uniqueness behind it: two\n * tabs toggling at once left two rows, and un-toggling then removed one of\n * them, so the title stayed bookmarked.\n * @summary Add Partner Favorite\n */\nexport const addPartnerFavorite = async (provider: PartnerProvider,\n mediaId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getAddPartnerFavoriteUrl(provider,mediaId),\n {\n ...options,\n method: 'PUT'\n\n\n }\n);}\n\n\n\n\n\nexport const getAddPartnerFavoriteMutationKey = () => ['addPartnerFavorite'] as const;\n\nexport const getAddPartnerFavoriteMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addPartnerFavorite>>, TError,AddPartnerFavoriteMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof addPartnerFavorite>>, TError,AddPartnerFavoriteMutationVariables, TContext> => {\n\nconst mutationKey = getAddPartnerFavoriteMutationKey();\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 addPartnerFavorite>>, AddPartnerFavoriteMutationVariables> = (props) => {\n const {provider,mediaId} = props ?? {};\n\n return addPartnerFavorite(provider,mediaId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AddPartnerFavoriteMutationResult = NonNullable<Awaited<ReturnType<typeof addPartnerFavorite>>>\n\n export type AddPartnerFavoriteMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type AddPartnerFavoriteMutationVariables = {provider: PartnerProvider;mediaId: number}\n\n /**\n * @summary Add Partner Favorite\n */\nexport const useAddPartnerFavorite = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addPartnerFavorite>>, TError,AddPartnerFavoriteMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof addPartnerFavorite>>,\n TError,\n AddPartnerFavoriteMutationVariables,\n TContext\n > => {\n return useMutation(getAddPartnerFavoriteMutationOptions(options), queryClient);\n }\n export const getListMediaUrl = (provider: PartnerProvider,\n params?: ListMediaParams,) => {\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 ? `/partners/${provider}/media?${stringifiedParams}` : `/partners/${provider}/media`\n}\n\n/**\n * A page of the catalogue.\n *\n * ``q`` ranks through Elasticsearch and then **intersects** with the same\n * visibility subquery as an unfiltered listing — the index knows nothing about\n * plans or ages, so authorisation happens here whatever the index returns. An\n * index that is missing or unreachable yields no candidates, which reads as an\n * empty page rather than an unfiltered one.\n *\n * A search result keeps the index's ranking rather than applying ``order``:\n * re-sorting relevance by publication date discards the only thing the search\n * contributed. That is why ``order`` is ignored when ``q`` is present, not\n * silently combined with it.\n * @summary List Media\n */\nexport const listMedia = async (provider: PartnerProvider,\n params?: ListMediaParams, options?: Parameters<typeof request>[1]): Promise<PartnerMediaPage> => {\n\n return request<PartnerMediaPage>(getListMediaUrl(provider,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListMediaQueryKey = (provider: PartnerProvider,\n params?: ListMediaParams,) => {\n return [\n `/partners/${provider}/media`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListMediaQueryOptions = <TData = Awaited<ReturnType<typeof listMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider,\n params?: ListMediaParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMedia>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListMediaQueryKey(provider,params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listMedia>>> = ({ signal }) => listMedia(provider,params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: provider !== null && provider !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listMedia>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListMediaQueryResult = NonNullable<Awaited<ReturnType<typeof listMedia>>>\nexport type ListMediaQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListMedia<TData = Awaited<ReturnType<typeof listMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider,\n params: undefined | ListMediaParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMedia>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMedia>>,\n TError,\n Awaited<ReturnType<typeof listMedia>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMedia<TData = Awaited<ReturnType<typeof listMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider,\n params?: ListMediaParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMedia>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listMedia>>,\n TError,\n Awaited<ReturnType<typeof listMedia>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListMedia<TData = Awaited<ReturnType<typeof listMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider,\n params?: ListMediaParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMedia>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Media\n */\n\nexport function useListMedia<TData = Awaited<ReturnType<typeof listMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider,\n params?: ListMediaParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMedia>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListMediaQueryOptions(provider,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 getReadMediaUrl = (provider: PartnerProvider,\n mediaId: number,) => {\n\n\n\n\n return `/partners/${provider}/media/${mediaId}`\n}\n\n/**\n * One title.\n *\n * A media outside the caller's slice is ``404``, not ``403``: whether an adult\n * title exists is itself something a minor's client should not be able to\n * determine, and the legacy's detail page dereferenced an unknown id straight\n * into a 500.\n * @summary Read Media\n */\nexport const readMedia = async (provider: PartnerProvider,\n mediaId: number, options?: Parameters<typeof request>[1]): Promise<PartnerMediaRead> => {\n\n return request<PartnerMediaRead>(getReadMediaUrl(provider,mediaId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadMediaQueryKey = (provider: PartnerProvider,\n mediaId: number,) => {\n return [\n `/partners/${provider}/media/${mediaId}`\n ] as const;\n }\n\n\nexport const getReadMediaQueryOptions = <TData = Awaited<ReturnType<typeof readMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider,\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readMedia>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadMediaQueryKey(provider,mediaId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readMedia>>> = ({ signal }) => readMedia(provider,mediaId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: provider !== null && provider !== undefined && mediaId !== null && mediaId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readMedia>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadMediaQueryResult = NonNullable<Awaited<ReturnType<typeof readMedia>>>\nexport type ReadMediaQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadMedia<TData = Awaited<ReturnType<typeof readMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider,\n mediaId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readMedia>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readMedia>>,\n TError,\n Awaited<ReturnType<typeof readMedia>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadMedia<TData = Awaited<ReturnType<typeof readMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider,\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readMedia>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readMedia>>,\n TError,\n Awaited<ReturnType<typeof readMedia>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadMedia<TData = Awaited<ReturnType<typeof readMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider,\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readMedia>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Media\n */\n\nexport function useReadMedia<TData = Awaited<ReturnType<typeof readMedia>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n provider: PartnerProvider,\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readMedia>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadMediaQueryOptions(provider,mediaId,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\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CAAe,CAAC;CAMhJ,OAAQ;EAAE;EAAU;EAAS,SAAS,aAAa,QAAQ,aAAa,KAAA,KAAa,YAAY,QAAQ,YAAY,KAAA;EAAW,GAAG;CAAY;AAClJ;;;;AAqCA,SAAgB,aACf,UACG,SAAiB,SAClB,aACiF;CAElF,MAAM,eAAe,yBAAyB,UAAS,SAAQ,OAAO;CAEtE,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD"}
@@ -0,0 +1,159 @@
1
+
2
+ import { Gn as HTTPExceptionResponse, Nn as PartnerProvider, Tr as CurrentReadingListRead, ct as ReaderPackageRead, it as ReadingPositionWrite, ot as ReadingPositionRead, t as ValidationErrorResponse, tt as ReadPackageParams } from "../index-wL_20vR8.js";
3
+ import { a as ErrorType, c as request, n as BodyType } from "../client-BDwBZYB0.js";
4
+ import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
5
+ //#region src/react/partner-reader/partner-reader.d.ts
6
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
7
+ export declare const getReadPackageUrl: (provider: PartnerProvider, mediaId: number, params?: ReadPackageParams) => string;
8
+ /**
9
+ * Where to fetch the content itself.
10
+ *
11
+ * The returned URL is a short-lived DRM-wrapped credential. It is not cached
12
+ * here and should not be stored by the client.
13
+ *
14
+ * Opens a consumption lease, so the read appears in the ledger and counts
15
+ * against the establishment's live seats like any other. Its id comes back in
16
+ * ``lease``: keep it alive with ``PUT /consumption/{eventId}`` and drop it with
17
+ * ``DELETE`` when the reader closes. A client that does neither is not broken
18
+ * — the reaper closes the lease about a minute after the last heartbeat — but
19
+ * every such read is a seat held past the end of it.
20
+ *
21
+ * Re-opening the same title returns the lease already held rather than a
22
+ * second one, so a page reload does not leak a seat.
23
+ * @summary Read Package
24
+ */
25
+ export declare const readPackage: (provider: PartnerProvider, mediaId: number, params?: ReadPackageParams, options?: Parameters<typeof request>[1]) => Promise<ReaderPackageRead>;
26
+ export declare const getReadPackageQueryKey: (provider: PartnerProvider, mediaId: number, params?: ReadPackageParams) => readonly [`/partners/nextory/media/${number}/package` | `/partners/youscribe/media/${number}/package`, ...ReadPackageParams[]];
27
+ export declare const getReadPackageQueryOptions: <TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, params?: ReadPackageParams, options?: {
28
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>;
29
+ request?: SecondParameter<typeof request>;
30
+ }) => UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData> & {
31
+ queryKey: DataTag<QueryKey, TData, TError>;
32
+ };
33
+ export type ReadPackageQueryResult = NonNullable<Awaited<ReturnType<typeof readPackage>>>;
34
+ export type ReadPackageQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
35
+ export declare function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, params: undefined | ReadPackageParams, options: {
36
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readPackage>>, TError, Awaited<ReturnType<typeof readPackage>>>, 'initialData'>;
37
+ request?: SecondParameter<typeof request>;
38
+ }, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
39
+ queryKey: DataTag<QueryKey, TData, TError>;
40
+ };
41
+ export declare function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, params?: ReadPackageParams, options?: {
42
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readPackage>>, TError, Awaited<ReturnType<typeof readPackage>>>, 'initialData'>;
43
+ request?: SecondParameter<typeof request>;
44
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
45
+ queryKey: DataTag<QueryKey, TData, TError>;
46
+ };
47
+ export declare function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, params?: ReadPackageParams, options?: {
48
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>;
49
+ request?: SecondParameter<typeof request>;
50
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
51
+ queryKey: DataTag<QueryKey, TData, TError>;
52
+ };
53
+ export declare const getReadPositionUrl: (provider: PartnerProvider, mediaId: number) => string;
54
+ /**
55
+ * Where this reader last was, according to the partner.
56
+ *
57
+ * ``404`` when the partner holds no position — a book never opened has no
58
+ * place to return to, and reporting zero would make a client jump a reader who
59
+ * *is* mid-book back to the start if the call ever failed soft.
60
+ * @summary Read Position
61
+ */
62
+ export declare const readPosition: (provider: PartnerProvider, mediaId: number, options?: Parameters<typeof request>[1]) => Promise<ReadingPositionRead>;
63
+ export declare const getReadPositionQueryKey: (provider: PartnerProvider, mediaId: number) => readonly [`/partners/nextory/media/${number}/position` | `/partners/youscribe/media/${number}/position`];
64
+ export declare const getReadPositionQueryOptions: <TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, options?: {
65
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>;
66
+ request?: SecondParameter<typeof request>;
67
+ }) => UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData> & {
68
+ queryKey: DataTag<QueryKey, TData, TError>;
69
+ };
70
+ export type ReadPositionQueryResult = NonNullable<Awaited<ReturnType<typeof readPosition>>>;
71
+ export type ReadPositionQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
72
+ export declare function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, options: {
73
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readPosition>>, TError, Awaited<ReturnType<typeof readPosition>>>, 'initialData'>;
74
+ request?: SecondParameter<typeof request>;
75
+ }, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
76
+ queryKey: DataTag<QueryKey, TData, TError>;
77
+ };
78
+ export declare function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, options?: {
79
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readPosition>>, TError, Awaited<ReturnType<typeof readPosition>>>, 'initialData'>;
80
+ request?: SecondParameter<typeof request>;
81
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
82
+ queryKey: DataTag<QueryKey, TData, TError>;
83
+ };
84
+ export declare function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, options?: {
85
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>;
86
+ request?: SecondParameter<typeof request>;
87
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
88
+ queryKey: DataTag<QueryKey, TData, TError>;
89
+ };
90
+ export declare const getWritePositionUrl: (provider: PartnerProvider, mediaId: number) => string;
91
+ /**
92
+ * Record progress, and report the partner's own metering alongside it.
93
+ *
94
+ * ``usage_blocks`` is forwarded first when present, because the legacy did and
95
+ * the partner treats the two as one act: metering after a position update
96
+ * records consumption against a page the reader has already left.
97
+ * @summary Write Position
98
+ */
99
+ export declare const writePosition: (provider: PartnerProvider, mediaId: number, readingPositionWrite: ReadingPositionWrite, options?: Parameters<typeof request>[1]) => Promise<ReadingPositionRead>;
100
+ export declare const getWritePositionMutationKey: () => readonly ['writePosition'];
101
+ export declare const getWritePositionMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
102
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError, WritePositionMutationVariables, TContext>;
103
+ request?: SecondParameter<typeof request>;
104
+ }) => UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError, WritePositionMutationVariables, TContext>;
105
+ export type WritePositionMutationResult = NonNullable<Awaited<ReturnType<typeof writePosition>>>;
106
+ export type WritePositionMutationBody = BodyType<ReadingPositionWrite>;
107
+ export type WritePositionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
108
+ export type WritePositionMutationVariables = {
109
+ provider: PartnerProvider;
110
+ mediaId: number;
111
+ data: BodyType<ReadingPositionWrite>;
112
+ };
113
+ /**
114
+ * @summary Write Position
115
+ */
116
+ export declare const useWritePosition: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
117
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError, WritePositionMutationVariables, TContext>;
118
+ request?: SecondParameter<typeof request>;
119
+ }, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof writePosition>>, TError, WritePositionMutationVariables, TContext>;
120
+ export declare const getListCurrentReadingsUrl: (provider: PartnerProvider) => string;
121
+ /**
122
+ * The partner's own "continue reading" list, joined back to our catalogue.
123
+ *
124
+ * Entries the partner knows and our catalogue does not are dropped rather than
125
+ * surfaced with a null id: the import runs nightly and the partner's list is
126
+ * live, so a title added today is genuinely not browsable here yet, and a card
127
+ * that cannot be opened is worse than one that is absent.
128
+ * @summary List Current Readings
129
+ */
130
+ export declare const listCurrentReadings: (provider: PartnerProvider, options?: Parameters<typeof request>[1]) => Promise<CurrentReadingListRead>;
131
+ export declare const getListCurrentReadingsQueryKey: (provider: PartnerProvider) => readonly ["/partners/nextory/readings" | "/partners/youscribe/readings"];
132
+ export declare const getListCurrentReadingsQueryOptions: <TData = Awaited<ReturnType<typeof listCurrentReadings>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: {
133
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData>>;
134
+ request?: SecondParameter<typeof request>;
135
+ }) => UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData> & {
136
+ queryKey: DataTag<QueryKey, TData, TError>;
137
+ };
138
+ export type ListCurrentReadingsQueryResult = NonNullable<Awaited<ReturnType<typeof listCurrentReadings>>>;
139
+ export type ListCurrentReadingsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
140
+ export declare function useListCurrentReadings<TData = Awaited<ReturnType<typeof listCurrentReadings>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options: {
141
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, Awaited<ReturnType<typeof listCurrentReadings>>>, 'initialData'>;
142
+ request?: SecondParameter<typeof request>;
143
+ }, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
144
+ queryKey: DataTag<QueryKey, TData, TError>;
145
+ };
146
+ export declare function useListCurrentReadings<TData = Awaited<ReturnType<typeof listCurrentReadings>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: {
147
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, Awaited<ReturnType<typeof listCurrentReadings>>>, 'initialData'>;
148
+ request?: SecondParameter<typeof request>;
149
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
150
+ queryKey: DataTag<QueryKey, TData, TError>;
151
+ };
152
+ export declare function useListCurrentReadings<TData = Awaited<ReturnType<typeof listCurrentReadings>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: {
153
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData>>;
154
+ request?: SecondParameter<typeof request>;
155
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
156
+ queryKey: DataTag<QueryKey, TData, TError>;
157
+ };
158
+ //#endregion
159
+ //# sourceMappingURL=partner-reader.d.ts.map