@learnorama/mozaik-sdk 0.19.0-staging.60.1 → 0.20.0-staging.61.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CUSTOMER-ADMIN.md +7 -0
- package/FRONTEND-REQUESTS.md +17 -2
- package/OFFLINE.md +78 -0
- package/PRESS.md +42 -2
- package/README.md +7 -4
- package/dist/api/account.d.ts +1 -1
- package/dist/api/account.js.map +1 -1
- package/dist/api/admin-catalogue.d.ts +2 -2
- package/dist/api/admin-catalogue.js +1 -1
- package/dist/api/admin-catalogue.js.map +1 -1
- package/dist/api/admin-consumption.d.ts +1 -1
- package/dist/api/admin-consumption.js.map +1 -1
- package/dist/api/admin-contracts.d.ts +1 -1
- package/dist/api/admin-contracts.js.map +1 -1
- package/dist/api/admin-customer.d.ts +19 -2
- package/dist/api/admin-customer.js +38 -2
- package/dist/api/admin-customer.js.map +1 -1
- package/dist/api/admin-desk.d.ts +91 -1
- package/dist/api/admin-desk.js +255 -1
- package/dist/api/admin-desk.js.map +1 -1
- package/dist/api/admin-licenses.d.ts +1 -1
- package/dist/api/admin-licenses.js.map +1 -1
- package/dist/api/admin-partner-selections.d.ts +1 -1
- package/dist/api/admin-partner-selections.js.map +1 -1
- package/dist/api/admin-patrons.d.ts +1 -1
- package/dist/api/admin-patrons.js.map +1 -1
- package/dist/api/admin-reviews.d.ts +1 -1
- package/dist/api/admin-reviews.js.map +1 -1
- package/dist/api/admin-roles.d.ts +1 -1
- package/dist/api/admin-roles.js.map +1 -1
- package/dist/api/admin-support.d.ts +1 -1
- package/dist/api/admin-support.js.map +1 -1
- package/dist/api/admin-tenants.d.ts +1 -1
- package/dist/api/admin-tenants.js.map +1 -1
- package/dist/api/admin-tutoring.d.ts +1 -1
- package/dist/api/admin-tutoring.js.map +1 -1
- package/dist/api/admin-vod.d.ts +1 -1
- package/dist/api/admin-vod.js.map +1 -1
- package/dist/api/auth-device.d.ts +1 -1
- package/dist/api/auth-device.js.map +1 -1
- package/dist/api/auth.d.ts +1 -1
- package/dist/api/auth.js.map +1 -1
- package/dist/api/biblio-billing-webhooks.d.ts +1 -1
- package/dist/api/biblio-billing-webhooks.js.map +1 -1
- package/dist/api/biblio-billing.d.ts +1 -1
- package/dist/api/biblio-billing.js.map +1 -1
- package/dist/api/biblio-catalogue.d.ts +1 -1
- package/dist/api/biblio-catalogue.js.map +1 -1
- package/dist/api/biblio-home.d.ts +1 -1
- package/dist/api/biblio-home.js.map +1 -1
- package/dist/api/biblio-learning-author-profiles.d.ts +1 -1
- package/dist/api/biblio-learning-author-profiles.js.map +1 -1
- package/dist/api/biblio-learning-authoring.d.ts +1 -1
- package/dist/api/biblio-learning-authoring.js.map +1 -1
- package/dist/api/biblio-learning-editorial.d.ts +1 -1
- package/dist/api/biblio-learning-editorial.js.map +1 -1
- package/dist/api/biblio-learning-feedback.d.ts +1 -1
- package/dist/api/biblio-learning-feedback.js.map +1 -1
- package/dist/api/biblio-learning-finance.d.ts +1 -1
- package/dist/api/biblio-learning-finance.js.map +1 -1
- package/dist/api/biblio-learning-integrations.d.ts +1 -1
- package/dist/api/biblio-learning-integrations.js.map +1 -1
- package/dist/api/biblio-learning-membership.d.ts +1 -1
- package/dist/api/biblio-learning-membership.js.map +1 -1
- package/dist/api/biblio-learning.d.ts +1 -1
- package/dist/api/biblio-learning.js.map +1 -1
- package/dist/api/biblio-library.d.ts +1 -1
- package/dist/api/biblio-library.js.map +1 -1
- package/dist/api/biblio-nextory.d.ts +1 -1
- package/dist/api/biblio-nextory.js.map +1 -1
- package/dist/api/biblio-press.d.ts +1 -1
- package/dist/api/biblio-press.js.map +1 -1
- package/dist/api/biblio-search.d.ts +1 -1
- package/dist/api/biblio-search.js.map +1 -1
- package/dist/api/biblio-telemetry.d.ts +1 -1
- package/dist/api/biblio-telemetry.js.map +1 -1
- package/dist/api/biblio-youscribe.d.ts +1 -1
- package/dist/api/biblio-youscribe.js.map +1 -1
- package/dist/api/consumption.d.ts +19 -1
- package/dist/api/consumption.js +53 -1
- package/dist/api/consumption.js.map +1 -1
- package/dist/api/cvs-app.d.ts +1 -1
- package/dist/api/cvs-app.js.map +1 -1
- package/dist/api/cvs-documents.d.ts +1 -1
- package/dist/api/cvs-documents.js.map +1 -1
- package/dist/api/cvs-favorites.d.ts +1 -1
- package/dist/api/cvs-favorites.js.map +1 -1
- package/dist/api/cvs-ils.d.ts +1 -1
- package/dist/api/cvs-ils.js.map +1 -1
- package/dist/api/cvs-loans.d.ts +7 -1
- package/dist/api/cvs-loans.js +27 -1
- package/dist/api/cvs-loans.js.map +1 -1
- package/dist/api/cvs-payments.d.ts +1 -1
- package/dist/api/cvs-payments.js.map +1 -1
- package/dist/api/cvs-streaming.d.ts +16 -1
- package/dist/api/cvs-streaming.js +43 -1
- package/dist/api/cvs-streaming.js.map +1 -1
- package/dist/api/index.d.ts +9 -9
- package/dist/api/index.js +9 -9
- package/dist/api/partner-catalogue.d.ts +39 -5
- package/dist/api/partner-catalogue.js +71 -6
- package/dist/api/partner-catalogue.js.map +1 -1
- package/dist/api/partner-reader-nextory.d.ts +30 -12
- package/dist/api/partner-reader-nextory.js +70 -12
- package/dist/api/partner-reader-nextory.js.map +1 -1
- package/dist/api/partner-reader-youscribe.d.ts +13 -1
- package/dist/api/partner-reader-youscribe.js +27 -1
- package/dist/api/partner-reader-youscribe.js.map +1 -1
- package/dist/api/partner-reading.d.ts +1 -1
- package/dist/api/partner-reading.js.map +1 -1
- package/dist/api/profiles.d.ts +1 -1
- package/dist/api/profiles.js.map +1 -1
- package/dist/api/search.d.ts +1 -1
- package/dist/api/search.js.map +1 -1
- package/dist/api/tutoring-catalogue.d.ts +1 -1
- package/dist/api/tutoring-catalogue.js.map +1 -1
- package/dist/api/tutoring-chat.d.ts +1 -1
- package/dist/api/tutoring-chat.js.map +1 -1
- package/dist/api/tutoring-dispatch.d.ts +1 -1
- package/dist/api/tutoring-dispatch.js.map +1 -1
- package/dist/api/tutoring-practitioner.d.ts +1 -1
- package/dist/api/tutoring-practitioner.js.map +1 -1
- package/dist/api/tutoring-requests.d.ts +1 -1
- package/dist/api/tutoring-requests.js.map +1 -1
- package/dist/auth.d.ts +2 -33
- package/dist/auth.js +8 -2
- package/dist/auth.js.map +1 -1
- package/dist/chunks/client2.d.ts +2 -2
- package/dist/chunks/connection.d.ts +1 -1
- package/dist/chunks/index.d.ts +1858 -676
- package/dist/chunks/index2.d.ts +34 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +2 -2
- package/dist/models.js +142 -3
- package/dist/models.js.map +1 -1
- package/dist/offline.d.ts +42 -0
- package/dist/offline.js +353 -0
- package/dist/offline.js.map +1 -0
- package/dist/react/account.d.ts +1 -1
- package/dist/react/account.js +1 -1
- package/dist/react/account.js.map +1 -1
- package/dist/react/admin-catalogue.d.ts +2 -2
- package/dist/react/admin-catalogue.js +2 -2
- package/dist/react/admin-catalogue.js.map +1 -1
- package/dist/react/admin-consumption.d.ts +1 -1
- package/dist/react/admin-consumption.js +1 -1
- package/dist/react/admin-consumption.js.map +1 -1
- package/dist/react/admin-contracts.d.ts +1 -1
- package/dist/react/admin-contracts.js +1 -1
- package/dist/react/admin-contracts.js.map +1 -1
- package/dist/react/admin-customer.d.ts +73 -2
- package/dist/react/admin-customer.js +87 -3
- package/dist/react/admin-customer.js.map +1 -1
- package/dist/react/admin-desk.d.ts +352 -1
- package/dist/react/admin-desk.js +536 -2
- package/dist/react/admin-desk.js.map +1 -1
- package/dist/react/admin-licenses.d.ts +1 -1
- package/dist/react/admin-licenses.js +1 -1
- package/dist/react/admin-licenses.js.map +1 -1
- package/dist/react/admin-partner-selections.d.ts +1 -1
- package/dist/react/admin-partner-selections.js +1 -1
- package/dist/react/admin-partner-selections.js.map +1 -1
- package/dist/react/admin-patrons.d.ts +1 -1
- package/dist/react/admin-patrons.js +1 -1
- package/dist/react/admin-patrons.js.map +1 -1
- package/dist/react/admin-reviews.d.ts +1 -1
- package/dist/react/admin-reviews.js +1 -1
- package/dist/react/admin-reviews.js.map +1 -1
- package/dist/react/admin-roles.d.ts +1 -1
- package/dist/react/admin-roles.js +1 -1
- package/dist/react/admin-roles.js.map +1 -1
- package/dist/react/admin-support.d.ts +1 -1
- package/dist/react/admin-support.js +1 -1
- package/dist/react/admin-support.js.map +1 -1
- package/dist/react/admin-tenants.d.ts +1 -1
- package/dist/react/admin-tenants.js +1 -1
- package/dist/react/admin-tenants.js.map +1 -1
- package/dist/react/admin-tutoring.d.ts +1 -1
- package/dist/react/admin-tutoring.js +1 -1
- package/dist/react/admin-tutoring.js.map +1 -1
- package/dist/react/admin-vod.d.ts +1 -1
- package/dist/react/admin-vod.js +1 -1
- package/dist/react/admin-vod.js.map +1 -1
- package/dist/react/auth-device.d.ts +1 -1
- package/dist/react/auth-device.js +1 -1
- package/dist/react/auth-device.js.map +1 -1
- package/dist/react/auth.d.ts +1 -1
- package/dist/react/auth.js +1 -1
- package/dist/react/auth.js.map +1 -1
- package/dist/react/biblio-billing-webhooks.d.ts +1 -1
- package/dist/react/biblio-billing-webhooks.js +1 -1
- package/dist/react/biblio-billing-webhooks.js.map +1 -1
- package/dist/react/biblio-billing.d.ts +1 -1
- package/dist/react/biblio-billing.js +1 -1
- package/dist/react/biblio-billing.js.map +1 -1
- package/dist/react/biblio-catalogue.d.ts +1 -1
- package/dist/react/biblio-catalogue.js +1 -1
- package/dist/react/biblio-catalogue.js.map +1 -1
- package/dist/react/biblio-home.d.ts +1 -1
- package/dist/react/biblio-home.js +1 -1
- package/dist/react/biblio-home.js.map +1 -1
- package/dist/react/biblio-learning-author-profiles.d.ts +1 -1
- package/dist/react/biblio-learning-author-profiles.js +1 -1
- package/dist/react/biblio-learning-author-profiles.js.map +1 -1
- package/dist/react/biblio-learning-authoring.d.ts +1 -1
- package/dist/react/biblio-learning-authoring.js +1 -1
- package/dist/react/biblio-learning-authoring.js.map +1 -1
- package/dist/react/biblio-learning-editorial.d.ts +1 -1
- package/dist/react/biblio-learning-editorial.js +1 -1
- package/dist/react/biblio-learning-editorial.js.map +1 -1
- package/dist/react/biblio-learning-feedback.d.ts +1 -1
- package/dist/react/biblio-learning-feedback.js +1 -1
- package/dist/react/biblio-learning-feedback.js.map +1 -1
- package/dist/react/biblio-learning-finance.d.ts +1 -1
- package/dist/react/biblio-learning-finance.js +1 -1
- package/dist/react/biblio-learning-finance.js.map +1 -1
- package/dist/react/biblio-learning-integrations.d.ts +1 -1
- package/dist/react/biblio-learning-integrations.js +1 -1
- package/dist/react/biblio-learning-integrations.js.map +1 -1
- package/dist/react/biblio-learning-membership.d.ts +1 -1
- package/dist/react/biblio-learning-membership.js +1 -1
- package/dist/react/biblio-learning-membership.js.map +1 -1
- package/dist/react/biblio-learning.d.ts +1 -1
- package/dist/react/biblio-learning.js +1 -1
- package/dist/react/biblio-learning.js.map +1 -1
- package/dist/react/biblio-library.d.ts +1 -1
- package/dist/react/biblio-library.js +1 -1
- package/dist/react/biblio-library.js.map +1 -1
- package/dist/react/biblio-nextory.d.ts +1 -1
- package/dist/react/biblio-nextory.js +1 -1
- package/dist/react/biblio-nextory.js.map +1 -1
- package/dist/react/biblio-press.d.ts +1 -1
- package/dist/react/biblio-press.js +1 -1
- package/dist/react/biblio-press.js.map +1 -1
- package/dist/react/biblio-search.d.ts +1 -1
- package/dist/react/biblio-search.js +1 -1
- package/dist/react/biblio-search.js.map +1 -1
- package/dist/react/biblio-telemetry.d.ts +1 -1
- package/dist/react/biblio-telemetry.js +1 -1
- package/dist/react/biblio-telemetry.js.map +1 -1
- package/dist/react/biblio-youscribe.d.ts +1 -1
- package/dist/react/biblio-youscribe.js +1 -1
- package/dist/react/biblio-youscribe.js.map +1 -1
- package/dist/react/chat.d.ts +1 -1
- package/dist/react/consumption.d.ts +85 -3
- package/dist/react/consumption.js +148 -3
- package/dist/react/consumption.js.map +1 -1
- package/dist/react/cvs-app.d.ts +1 -1
- package/dist/react/cvs-app.js +1 -1
- package/dist/react/cvs-app.js.map +1 -1
- package/dist/react/cvs-documents.d.ts +1 -1
- package/dist/react/cvs-documents.js +1 -1
- package/dist/react/cvs-documents.js.map +1 -1
- package/dist/react/cvs-favorites.d.ts +1 -1
- package/dist/react/cvs-favorites.js +1 -1
- package/dist/react/cvs-favorites.js.map +1 -1
- package/dist/react/cvs-ils.d.ts +1 -1
- package/dist/react/cvs-ils.js +1 -1
- package/dist/react/cvs-ils.js.map +1 -1
- package/dist/react/cvs-loans.d.ts +26 -1
- package/dist/react/cvs-loans.js +56 -2
- package/dist/react/cvs-loans.js.map +1 -1
- package/dist/react/cvs-payments.d.ts +1 -1
- package/dist/react/cvs-payments.js +1 -1
- package/dist/react/cvs-payments.js.map +1 -1
- package/dist/react/cvs-streaming.d.ts +62 -1
- package/dist/react/cvs-streaming.js +97 -2
- package/dist/react/cvs-streaming.js.map +1 -1
- package/dist/react/index.d.ts +9 -9
- package/dist/react/index.js +9 -9
- package/dist/react/partner-catalogue.d.ts +121 -6
- package/dist/react/partner-catalogue.js +147 -7
- package/dist/react/partner-catalogue.js.map +1 -1
- package/dist/react/partner-reader-nextory.d.ts +69 -12
- package/dist/react/partner-reader-nextory.js +128 -13
- package/dist/react/partner-reader-nextory.js.map +1 -1
- package/dist/react/partner-reader-youscribe.d.ts +57 -1
- package/dist/react/partner-reader-youscribe.js +80 -2
- package/dist/react/partner-reader-youscribe.js.map +1 -1
- package/dist/react/partner-reading.d.ts +1 -1
- package/dist/react/partner-reading.js +1 -1
- package/dist/react/partner-reading.js.map +1 -1
- package/dist/react/profiles.d.ts +1 -1
- package/dist/react/profiles.js +1 -1
- package/dist/react/profiles.js.map +1 -1
- package/dist/react/search.d.ts +1 -1
- package/dist/react/search.js +1 -1
- package/dist/react/search.js.map +1 -1
- package/dist/react/tutoring-catalogue.d.ts +1 -1
- package/dist/react/tutoring-catalogue.js +1 -1
- package/dist/react/tutoring-catalogue.js.map +1 -1
- package/dist/react/tutoring-chat.d.ts +1 -1
- package/dist/react/tutoring-chat.js +1 -1
- package/dist/react/tutoring-chat.js.map +1 -1
- package/dist/react/tutoring-dispatch.d.ts +1 -1
- package/dist/react/tutoring-dispatch.js +1 -1
- package/dist/react/tutoring-dispatch.js.map +1 -1
- package/dist/react/tutoring-practitioner.d.ts +1 -1
- package/dist/react/tutoring-practitioner.js +1 -1
- package/dist/react/tutoring-practitioner.js.map +1 -1
- package/dist/react/tutoring-requests.d.ts +1 -1
- package/dist/react/tutoring-requests.js +1 -1
- package/dist/react/tutoring-requests.js.map +1 -1
- package/package.json +13 -8
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
9
|
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
-
* OpenAPI spec version: 0.
|
|
10
|
+
* OpenAPI spec version: 0.20.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -119,18 +119,12 @@ const getWritePositionUrl = (mediaId) => {
|
|
|
119
119
|
return `/partners/nextory/media/${mediaId}/position`;
|
|
120
120
|
};
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
122
|
+
* 0.17's report: the legacy's ``patch-book-reading``, both kinds at once.
|
|
123
123
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* Only a strictly newer ``reached_at`` replaces the saved position. Stale or
|
|
129
|
-
* duplicate positions are not sent upstream again; usage blocks still are,
|
|
130
|
-
* including on retries, since the partner's deduplication contract is
|
|
131
|
-
* unknown. A different position at the same instant is a 409 before any
|
|
132
|
-
* outbound write. Progress is a resume point, not a measurement of time spent
|
|
133
|
-
* reading.
|
|
124
|
+
* Use ``PUT …/position`` and ``POST …/usage-blocks``; the legacy reader
|
|
125
|
+
* itself never sent both in one call. Usage blocks first, then the position,
|
|
126
|
+
* as before; answers the position now held.
|
|
127
|
+
* @deprecated
|
|
134
128
|
* @summary Write Position
|
|
135
129
|
*/
|
|
136
130
|
const writePosition = async (mediaId, readingPositionWrite, options) => {
|
|
@@ -175,12 +169,133 @@ const getWritePositionMutationOptions = (options) => {
|
|
|
175
169
|
};
|
|
176
170
|
};
|
|
177
171
|
/**
|
|
172
|
+
* @deprecated
|
|
178
173
|
* @summary Write Position
|
|
179
174
|
*/
|
|
180
175
|
const useWritePosition = (options, queryClient) => {
|
|
181
176
|
return useMutation(getWritePositionMutationOptions(options), queryClient);
|
|
182
177
|
};
|
|
178
|
+
const getSavePositionUrl = (mediaId) => {
|
|
179
|
+
return `/partners/nextory/media/${mediaId}/position`;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Where the reader is now: the legacy reader's ``book_reading.position``.
|
|
183
|
+
*
|
|
184
|
+
* Answers the position now held. Only a strictly newer ``reached_at``
|
|
185
|
+
* replaces the saved one and goes to Nextory, so sending the same position
|
|
186
|
+
* again changes nothing and calls nobody; an older one is ignored. A
|
|
187
|
+
* different position at the same instant is a 409 before any call. Progress
|
|
188
|
+
* is a resume point, not a measurement of time spent reading: that is what
|
|
189
|
+
* usage blocks are for.
|
|
190
|
+
* @summary Save Position
|
|
191
|
+
*/
|
|
192
|
+
const savePosition = async (mediaId, bookReadingPositionWrite, options) => {
|
|
193
|
+
const getHeaders = (h) => {
|
|
194
|
+
if (!h) return {};
|
|
195
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
196
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
197
|
+
const headers = {};
|
|
198
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
199
|
+
return headers;
|
|
200
|
+
};
|
|
201
|
+
return request(getSavePositionUrl(mediaId), {
|
|
202
|
+
...options,
|
|
203
|
+
method: "PUT",
|
|
204
|
+
headers: {
|
|
205
|
+
"Content-Type": "application/json",
|
|
206
|
+
...getHeaders(options?.headers)
|
|
207
|
+
},
|
|
208
|
+
body: JSON.stringify(bookReadingPositionWrite)
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
const getSavePositionMutationKey = () => ["savePosition"];
|
|
212
|
+
const getSavePositionMutationOptions = (options) => {
|
|
213
|
+
const mutationKey = getSavePositionMutationKey();
|
|
214
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
215
|
+
...options,
|
|
216
|
+
mutation: {
|
|
217
|
+
...options.mutation,
|
|
218
|
+
mutationKey
|
|
219
|
+
}
|
|
220
|
+
} : {
|
|
221
|
+
mutation: { mutationKey },
|
|
222
|
+
request: void 0
|
|
223
|
+
};
|
|
224
|
+
const mutationFn = (props) => {
|
|
225
|
+
const { mediaId, data } = props ?? {};
|
|
226
|
+
return savePosition(mediaId, data, requestOptions);
|
|
227
|
+
};
|
|
228
|
+
return {
|
|
229
|
+
mutationFn,
|
|
230
|
+
...mutationOptions
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* @summary Save Position
|
|
235
|
+
*/
|
|
236
|
+
const useSavePosition = (options, queryClient) => {
|
|
237
|
+
return useMutation(getSavePositionMutationOptions(options), queryClient);
|
|
238
|
+
};
|
|
239
|
+
const getReportUsageBlocksUrl = (mediaId) => {
|
|
240
|
+
return `/partners/nextory/media/${mediaId}/usage-blocks`;
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* What was read or heard: the legacy reader's ``book_reading.usage_blocks``.
|
|
244
|
+
*
|
|
245
|
+
* Nextory measures each patron's consumption with these. Forwarded every
|
|
246
|
+
* time, retries included, since Nextory's deduplication contract is unknown:
|
|
247
|
+
* send a batch once. Blocks ending at an integer 0 are dropped, as the legacy
|
|
248
|
+
* did, and a batch left empty calls nobody.
|
|
249
|
+
* @summary Report Usage Blocks
|
|
250
|
+
*/
|
|
251
|
+
const reportUsageBlocks = async (mediaId, nextoryUsageBlocksWrite, options) => {
|
|
252
|
+
const getHeaders = (h) => {
|
|
253
|
+
if (!h) return {};
|
|
254
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
255
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
256
|
+
const headers = {};
|
|
257
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
258
|
+
return headers;
|
|
259
|
+
};
|
|
260
|
+
return request(getReportUsageBlocksUrl(mediaId), {
|
|
261
|
+
...options,
|
|
262
|
+
method: "POST",
|
|
263
|
+
headers: {
|
|
264
|
+
"Content-Type": "application/json",
|
|
265
|
+
...getHeaders(options?.headers)
|
|
266
|
+
},
|
|
267
|
+
body: JSON.stringify(nextoryUsageBlocksWrite)
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
const getReportUsageBlocksMutationKey = () => ["reportUsageBlocks"];
|
|
271
|
+
const getReportUsageBlocksMutationOptions = (options) => {
|
|
272
|
+
const mutationKey = getReportUsageBlocksMutationKey();
|
|
273
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
274
|
+
...options,
|
|
275
|
+
mutation: {
|
|
276
|
+
...options.mutation,
|
|
277
|
+
mutationKey
|
|
278
|
+
}
|
|
279
|
+
} : {
|
|
280
|
+
mutation: { mutationKey },
|
|
281
|
+
request: void 0
|
|
282
|
+
};
|
|
283
|
+
const mutationFn = (props) => {
|
|
284
|
+
const { mediaId, data } = props ?? {};
|
|
285
|
+
return reportUsageBlocks(mediaId, data, requestOptions);
|
|
286
|
+
};
|
|
287
|
+
return {
|
|
288
|
+
mutationFn,
|
|
289
|
+
...mutationOptions
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* @summary Report Usage Blocks
|
|
294
|
+
*/
|
|
295
|
+
const useReportUsageBlocks = (options, queryClient) => {
|
|
296
|
+
return useMutation(getReportUsageBlocksMutationOptions(options), queryClient);
|
|
297
|
+
};
|
|
183
298
|
//#endregion
|
|
184
|
-
export { getReadPackageQueryKey, getReadPackageQueryOptions, getReadPackageUrl, getReadPositionQueryKey, getReadPositionQueryOptions, getReadPositionUrl, getWritePositionMutationKey, getWritePositionMutationOptions, getWritePositionUrl, readPackage, readPosition, useReadPackage, useReadPosition, useWritePosition, writePosition };
|
|
299
|
+
export { getReadPackageQueryKey, getReadPackageQueryOptions, getReadPackageUrl, getReadPositionQueryKey, getReadPositionQueryOptions, getReadPositionUrl, getReportUsageBlocksMutationKey, getReportUsageBlocksMutationOptions, getReportUsageBlocksUrl, getSavePositionMutationKey, getSavePositionMutationOptions, getSavePositionUrl, getWritePositionMutationKey, getWritePositionMutationOptions, getWritePositionUrl, readPackage, readPosition, reportUsageBlocks, savePosition, useReadPackage, useReadPosition, useReportUsageBlocks, useSavePosition, useWritePosition, writePosition };
|
|
185
300
|
|
|
186
301
|
//# sourceMappingURL=partner-reader-nextory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partner-reader-nextory.js","names":[],"sources":["../../src/react/partner-reader-nextory/partner-reader-nextory.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.19.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n NextoryPackageRead,\n ReadPackageParams,\n ReadingPositionRead,\n ReadingPositionWrite,\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 getReadPackageUrl = (mediaId: number,\n params?: ReadPackageParams,) => {\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/nextory/media/${mediaId}/package?${stringifiedParams}` : `/partners/nextory/media/${mediaId}/package`\n}\n\n/**\n * The package the local player opens, and the lease of this reading.\n *\n * The legacy's ``get-epub-package`` and ``get-audio-package``, by ``format``.\n * The package carries short-lived credentials: it is not cached here and\n * should not be stored by the client.\n *\n * The reading must have been opened through reader-access, which took the\n * lease: renew it with ``PUT /consumption/{eventId}`` and drop it with\n * ``DELETE`` when the reader closes. Fetching the package again returns the\n * lease already held, so a page reload does not leak a seat.\n * @summary Read Package\n */\nexport const readPackage = async (mediaId: number,\n params?: ReadPackageParams, options?: Parameters<typeof request>[1]): Promise<NextoryPackageRead> => {\n\n return request<NextoryPackageRead>(getReadPackageUrl(mediaId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPackageQueryKey = (mediaId: number,\n params?: ReadPackageParams,) => {\n return [\n `/partners/nextory/media/${mediaId}/package`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getReadPackageQueryOptions = <TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(mediaId: number,\n params?: ReadPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPackageQueryKey(mediaId,params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPackage>>> = ({ signal }) => readPackage(mediaId,params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: mediaId !== null && mediaId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPackageQueryResult = NonNullable<Awaited<ReturnType<typeof readPackage>>>\nexport type ReadPackageQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params: undefined | ReadPackageParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPackage>>,\n TError,\n Awaited<ReturnType<typeof readPackage>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPackage>>,\n TError,\n Awaited<ReturnType<typeof readPackage>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Package\n */\n\nexport function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPackageQueryOptions(mediaId,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 getReadPositionUrl = (mediaId: number,) => {\n\n\n\n\n return `/partners/nextory/media/${mediaId}/position`\n}\n\n/**\n * The last synchronized local position, or the partner's when none is saved.\n *\n * The legacy's ``fetchBookReading``: when the partner holds no position, the\n * empty one, as the legacy answered it — ``percentage`` 0, ``reachedAt``\n * null — so the player starts at the beginning.\n * @summary Read Position\n */\nexport const readPosition = async (mediaId: number, options?: Parameters<typeof request>[1]): Promise<ReadingPositionRead> => {\n\n return request<ReadingPositionRead>(getReadPositionUrl(mediaId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPositionQueryKey = (mediaId: number,) => {\n return [\n `/partners/nextory/media/${mediaId}/position`\n ] as const;\n }\n\n\nexport const getReadPositionQueryOptions = <TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPositionQueryKey(mediaId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPosition>>> = ({ signal }) => readPosition(mediaId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: mediaId !== null && mediaId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPositionQueryResult = NonNullable<Awaited<ReturnType<typeof readPosition>>>\nexport type ReadPositionQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPosition>>,\n TError,\n Awaited<ReturnType<typeof readPosition>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPosition>>,\n TError,\n Awaited<ReturnType<typeof readPosition>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Position\n */\n\nexport function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPositionQueryOptions(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\nexport const getWritePositionUrl = (mediaId: number,) => {\n\n\n\n\n return `/partners/nextory/media/${mediaId}/position`\n}\n\n/**\n * The legacy's ``patch-book-reading``: usage blocks, then the position.\n *\n * Takes the legacy reader's body as it is. ``book_reading.usage_blocks`` is\n * forwarded first, then ``book_reading.position``; either may come alone.\n * Answers the position now held, the empty one when there is none.\n *\n * Only a strictly newer ``reached_at`` replaces the saved position. Stale or\n * duplicate positions are not sent upstream again; usage blocks still are,\n * including on retries, since the partner's deduplication contract is\n * unknown. A different position at the same instant is a 409 before any\n * outbound write. Progress is a resume point, not a measurement of time spent\n * reading.\n * @summary Write Position\n */\nexport const writePosition = async (mediaId: number,\n readingPositionWrite: ReadingPositionWrite, options?: Parameters<typeof request>[1]): Promise<ReadingPositionRead> => {\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<ReadingPositionRead>(getWritePositionUrl(mediaId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(readingPositionWrite)\n }\n);}\n\n\n\n\n\nexport const getWritePositionMutationKey = () => ['writePosition'] as const;\n\nexport const getWritePositionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError,WritePositionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError,WritePositionMutationVariables, TContext> => {\n\nconst mutationKey = getWritePositionMutationKey();\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 writePosition>>, WritePositionMutationVariables> = (props) => {\n const {mediaId,data} = props ?? {};\n\n return writePosition(mediaId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type WritePositionMutationResult = NonNullable<Awaited<ReturnType<typeof writePosition>>>\n export type WritePositionMutationBody = BodyType<ReadingPositionWrite>\n export type WritePositionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type WritePositionMutationVariables = {mediaId: number;data: BodyType<ReadingPositionWrite>}\n\n /**\n * @summary Write Position\n */\nexport const useWritePosition = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError,WritePositionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof writePosition>>,\n TError,\n WritePositionMutationVariables,\n TContext\n > => {\n return useMutation(getWritePositionMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,qBAAqB,SAC9B,WAAgC;CAClC,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAErD,IAAI,UAAU,KAAA,GACZ,iBAAiB,OAAO,KAAK,UAAU,OAAO,SAAS,OAAO,KAAK,CAAC;CAExE,CAAC;CAED,MAAM,oBAAoB,iBAAiB,SAAS;CAEpD,OAAO,kBAAkB,SAAS,IAAI,2BAA2B,QAAQ,WAAW,sBAAsB,2BAA2B,QAAQ;AAC/I;;;;;;;;;;;;;;AAeA,MAAa,cAAc,OAAO,SAC9B,QAA4B,YAAyE;CAEvG,OAAO,QAA4B,kBAAkB,SAAQ,MAAM,GACnE;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,0BAA0B,SACnC,W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AY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,oBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,gCAAgC,OAAO,GAAG,WAAW;AAC1E"}
|
|
1
|
+
{"version":3,"file":"partner-reader-nextory.js","names":[],"sources":["../../src/react/partner-reader-nextory/partner-reader-nextory.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.20.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 BookReadingPositionWrite,\n HTTPExceptionResponse,\n NextoryPackageRead,\n NextoryUsageBlocksWrite,\n ReadPackageParams,\n ReadingPositionRead,\n ReadingPositionWrite,\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 getReadPackageUrl = (mediaId: number,\n params?: ReadPackageParams,) => {\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/nextory/media/${mediaId}/package?${stringifiedParams}` : `/partners/nextory/media/${mediaId}/package`\n}\n\n/**\n * The package the local player opens, and the lease of this reading.\n *\n * The legacy's ``get-epub-package`` and ``get-audio-package``, by ``format``.\n * The package carries short-lived credentials: it is not cached here and\n * should not be stored by the client.\n *\n * The reading must have been opened through reader-access, which took the\n * lease: renew it with ``PUT /consumption/{eventId}`` and drop it with\n * ``DELETE`` when the reader closes. Fetching the package again returns the\n * lease already held, so a page reload does not leak a seat.\n * @summary Read Package\n */\nexport const readPackage = async (mediaId: number,\n params?: ReadPackageParams, options?: Parameters<typeof request>[1]): Promise<NextoryPackageRead> => {\n\n return request<NextoryPackageRead>(getReadPackageUrl(mediaId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPackageQueryKey = (mediaId: number,\n params?: ReadPackageParams,) => {\n return [\n `/partners/nextory/media/${mediaId}/package`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getReadPackageQueryOptions = <TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(mediaId: number,\n params?: ReadPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPackageQueryKey(mediaId,params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPackage>>> = ({ signal }) => readPackage(mediaId,params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: mediaId !== null && mediaId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPackageQueryResult = NonNullable<Awaited<ReturnType<typeof readPackage>>>\nexport type ReadPackageQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params: undefined | ReadPackageParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPackage>>,\n TError,\n Awaited<ReturnType<typeof readPackage>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPackage>>,\n TError,\n Awaited<ReturnType<typeof readPackage>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Package\n */\n\nexport function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPackageQueryOptions(mediaId,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 getReadPositionUrl = (mediaId: number,) => {\n\n\n\n\n return `/partners/nextory/media/${mediaId}/position`\n}\n\n/**\n * The last synchronized local position, or the partner's when none is saved.\n *\n * The legacy's ``fetchBookReading``: when the partner holds no position, the\n * empty one, as the legacy answered it — ``percentage`` 0, ``reachedAt``\n * null — so the player starts at the beginning.\n * @summary Read Position\n */\nexport const readPosition = async (mediaId: number, options?: Parameters<typeof request>[1]): Promise<ReadingPositionRead> => {\n\n return request<ReadingPositionRead>(getReadPositionUrl(mediaId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPositionQueryKey = (mediaId: number,) => {\n return [\n `/partners/nextory/media/${mediaId}/position`\n ] as const;\n }\n\n\nexport const getReadPositionQueryOptions = <TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPositionQueryKey(mediaId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPosition>>> = ({ signal }) => readPosition(mediaId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: mediaId !== null && mediaId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPositionQueryResult = NonNullable<Awaited<ReturnType<typeof readPosition>>>\nexport type ReadPositionQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPosition>>,\n TError,\n Awaited<ReturnType<typeof readPosition>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPosition>>,\n TError,\n Awaited<ReturnType<typeof readPosition>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Position\n */\n\nexport function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPositionQueryOptions(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\nexport const getWritePositionUrl = (mediaId: number,) => {\n\n\n\n\n return `/partners/nextory/media/${mediaId}/position`\n}\n\n/**\n * 0.17's report: the legacy's ``patch-book-reading``, both kinds at once.\n *\n * Use ``PUT …/position`` and ``POST …/usage-blocks``; the legacy reader\n * itself never sent both in one call. Usage blocks first, then the position,\n * as before; answers the position now held.\n * @deprecated\n * @summary Write Position\n */\nexport const writePosition = async (mediaId: number,\n readingPositionWrite: ReadingPositionWrite, options?: Parameters<typeof request>[1]): Promise<ReadingPositionRead> => {\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<ReadingPositionRead>(getWritePositionUrl(mediaId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(readingPositionWrite)\n }\n);}\n\n\n\n\n\nexport const getWritePositionMutationKey = () => ['writePosition'] as const;\n\nexport const getWritePositionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError,WritePositionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError,WritePositionMutationVariables, TContext> => {\n\nconst mutationKey = getWritePositionMutationKey();\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 writePosition>>, WritePositionMutationVariables> = (props) => {\n const {mediaId,data} = props ?? {};\n\n return writePosition(mediaId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type WritePositionMutationResult = NonNullable<Awaited<ReturnType<typeof writePosition>>>\n export type WritePositionMutationBody = BodyType<ReadingPositionWrite>\n export type WritePositionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type WritePositionMutationVariables = {mediaId: number;data: BodyType<ReadingPositionWrite>}\n\n /**\n * @deprecated\n * @summary Write Position\n */\nexport const useWritePosition = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError,WritePositionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof writePosition>>,\n TError,\n WritePositionMutationVariables,\n TContext\n > => {\n return useMutation(getWritePositionMutationOptions(options), queryClient);\n }\n export const getSavePositionUrl = (mediaId: number,) => {\n\n\n\n\n return `/partners/nextory/media/${mediaId}/position`\n}\n\n/**\n * Where the reader is now: the legacy reader's ``book_reading.position``.\n *\n * Answers the position now held. Only a strictly newer ``reached_at``\n * replaces the saved one and goes to Nextory, so sending the same position\n * again changes nothing and calls nobody; an older one is ignored. A\n * different position at the same instant is a 409 before any call. Progress\n * is a resume point, not a measurement of time spent reading: that is what\n * usage blocks are for.\n * @summary Save Position\n */\nexport const savePosition = async (mediaId: number,\n bookReadingPositionWrite: BookReadingPositionWrite, options?: Parameters<typeof request>[1]): Promise<ReadingPositionRead> => {\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<ReadingPositionRead>(getSavePositionUrl(mediaId),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(bookReadingPositionWrite)\n }\n);}\n\n\n\n\n\nexport const getSavePositionMutationKey = () => ['savePosition'] as const;\n\nexport const getSavePositionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof savePosition>>, TError,SavePositionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof savePosition>>, TError,SavePositionMutationVariables, TContext> => {\n\nconst mutationKey = getSavePositionMutationKey();\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 savePosition>>, SavePositionMutationVariables> = (props) => {\n const {mediaId,data} = props ?? {};\n\n return savePosition(mediaId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type SavePositionMutationResult = NonNullable<Awaited<ReturnType<typeof savePosition>>>\n export type SavePositionMutationBody = BodyType<BookReadingPositionWrite>\n export type SavePositionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type SavePositionMutationVariables = {mediaId: number;data: BodyType<BookReadingPositionWrite>}\n\n /**\n * @summary Save Position\n */\nexport const useSavePosition = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof savePosition>>, TError,SavePositionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof savePosition>>,\n TError,\n SavePositionMutationVariables,\n TContext\n > => {\n return useMutation(getSavePositionMutationOptions(options), queryClient);\n }\n export const getReportUsageBlocksUrl = (mediaId: number,) => {\n\n\n\n\n return `/partners/nextory/media/${mediaId}/usage-blocks`\n}\n\n/**\n * What was read or heard: the legacy reader's ``book_reading.usage_blocks``.\n *\n * Nextory measures each patron's consumption with these. Forwarded every\n * time, retries included, since Nextory's deduplication contract is unknown:\n * send a batch once. Blocks ending at an integer 0 are dropped, as the legacy\n * did, and a batch left empty calls nobody.\n * @summary Report Usage Blocks\n */\nexport const reportUsageBlocks = async (mediaId: number,\n nextoryUsageBlocksWrite: NextoryUsageBlocksWrite, 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>(getReportUsageBlocksUrl(mediaId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(nextoryUsageBlocksWrite)\n }\n);}\n\n\n\n\n\nexport const getReportUsageBlocksMutationKey = () => ['reportUsageBlocks'] as const;\n\nexport const getReportUsageBlocksMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof reportUsageBlocks>>, TError,ReportUsageBlocksMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof reportUsageBlocks>>, TError,ReportUsageBlocksMutationVariables, TContext> => {\n\nconst mutationKey = getReportUsageBlocksMutationKey();\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 reportUsageBlocks>>, ReportUsageBlocksMutationVariables> = (props) => {\n const {mediaId,data} = props ?? {};\n\n return reportUsageBlocks(mediaId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ReportUsageBlocksMutationResult = NonNullable<Awaited<ReturnType<typeof reportUsageBlocks>>>\n export type ReportUsageBlocksMutationBody = BodyType<NextoryUsageBlocksWrite>\n export type ReportUsageBlocksMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ReportUsageBlocksMutationVariables = {mediaId: number;data: BodyType<NextoryUsageBlocksWrite>}\n\n /**\n * @summary Report Usage Blocks\n */\nexport const useReportUsageBlocks = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof reportUsageBlocks>>, TError,ReportUsageBlocksMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof reportUsageBlocks>>,\n TError,\n ReportUsageBlocksMutationVariables,\n TContext\n > => {\n return useMutation(getRe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AO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAc,wBAAwB,OAAO,GAClD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,uBAAuB;CAC9C,CACF;AAAE;AAMF,MAAa,wCAAwC,CAAC,mBAAmB;AAEzE,MAAa,uCACW,YACqG;CAE7H,MAAM,cAAc,gCAAgC;CACpD,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,cAAmH,UAAU;EAC/H,MAAM,EAAC,SAAQ,SAAQ,SAAS,CAAC;EAEjC,OAAQ,kBAAkB,SAAQ,MAAK,cAAc;CACvD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,wBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,oCAAoC,OAAO,GAAG,WAAW;AAC9E"}
|
|
@@ -1,9 +1,65 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Ju as HTTPExceptionResponse, dn as ReaderPackageRead, i as YouScribeAuthRead, n as YouScribeDownloadRead, oa as OfflineVerificationKeyRead, sn as ReadHostedPackageParams, t as YouScribeReaderRead, w as ValidationErrorResponse } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request } from "../chunks/client.js";
|
|
4
4
|
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/partner-reader-youscribe/partner-reader-youscribe.d.ts
|
|
6
6
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getReadYouscribeDownloadVerificationKeyUrl: () => string;
|
|
8
|
+
/**
|
|
9
|
+
* Fetch the current public verification key over the authenticated online channel.
|
|
10
|
+
* @summary Read Youscribe Download Verification Key
|
|
11
|
+
*/
|
|
12
|
+
export declare const readYouscribeDownloadVerificationKey: (options?: Parameters<typeof request>[1]) => Promise<OfflineVerificationKeyRead>;
|
|
13
|
+
export declare const getReadYouscribeDownloadVerificationKeyQueryKey: () => readonly [`/partners/youscribe/download-verification-key`];
|
|
14
|
+
export declare const getReadYouscribeDownloadVerificationKeyQueryOptions: <TData = Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
|
|
15
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData>>;
|
|
16
|
+
request?: SecondParameter<typeof request>;
|
|
17
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData> & {
|
|
18
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
19
|
+
};
|
|
20
|
+
export type ReadYouscribeDownloadVerificationKeyQueryResult = NonNullable<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>>;
|
|
21
|
+
export type ReadYouscribeDownloadVerificationKeyQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
22
|
+
export declare function useReadYouscribeDownloadVerificationKey<TData = Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options: {
|
|
23
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>>, 'initialData'>;
|
|
24
|
+
request?: SecondParameter<typeof request>;
|
|
25
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
26
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
27
|
+
};
|
|
28
|
+
export declare function useReadYouscribeDownloadVerificationKey<TData = Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
|
|
29
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>>, 'initialData'>;
|
|
30
|
+
request?: SecondParameter<typeof request>;
|
|
31
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
32
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
33
|
+
};
|
|
34
|
+
export declare function useReadYouscribeDownloadVerificationKey<TData = Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
|
|
35
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData>>;
|
|
36
|
+
request?: SecondParameter<typeof request>;
|
|
37
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
38
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
39
|
+
};
|
|
40
|
+
export declare const getAcquireYouscribeDownloadUrl: (mediaId: number) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Authorize SDK acquisition for an existing seat. Creates neither a subscription nor a reading event.
|
|
43
|
+
* @summary Acquire Youscribe Download
|
|
44
|
+
*/
|
|
45
|
+
export declare const acquireYouscribeDownload: (mediaId: number, options?: Parameters<typeof request>[1]) => Promise<YouScribeDownloadRead>;
|
|
46
|
+
export declare const getAcquireYouscribeDownloadMutationKey: () => readonly ['acquireYouscribeDownload'];
|
|
47
|
+
export declare const getAcquireYouscribeDownloadMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
48
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof acquireYouscribeDownload>>, TError, AcquireYouscribeDownloadMutationVariables, TContext>;
|
|
49
|
+
request?: SecondParameter<typeof request>;
|
|
50
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof acquireYouscribeDownload>>, TError, AcquireYouscribeDownloadMutationVariables, TContext>;
|
|
51
|
+
export type AcquireYouscribeDownloadMutationResult = NonNullable<Awaited<ReturnType<typeof acquireYouscribeDownload>>>;
|
|
52
|
+
export type AcquireYouscribeDownloadMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
53
|
+
export type AcquireYouscribeDownloadMutationVariables = {
|
|
54
|
+
mediaId: number;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @summary Acquire Youscribe Download
|
|
58
|
+
*/
|
|
59
|
+
export declare const useAcquireYouscribeDownload: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
60
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof acquireYouscribeDownload>>, TError, AcquireYouscribeDownloadMutationVariables, TContext>;
|
|
61
|
+
request?: SecondParameter<typeof request>;
|
|
62
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof acquireYouscribeDownload>>, TError, AcquireYouscribeDownloadMutationVariables, TContext>;
|
|
7
63
|
export declare const getReadHostedPackageUrl: (mediaId: number, params?: ReadHostedPackageParams) => string;
|
|
8
64
|
/**
|
|
9
65
|
* **Deprecated**: the hosted reader's address and a lease. As in 0.13.0.
|
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
9
|
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
-
* OpenAPI spec version: 0.
|
|
10
|
+
* OpenAPI spec version: 0.20.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -21,6 +21,84 @@ const withQueryKey = (query, queryKey) => {
|
|
|
21
21
|
}
|
|
22
22
|
return result;
|
|
23
23
|
};
|
|
24
|
+
const getReadYouscribeDownloadVerificationKeyUrl = () => {
|
|
25
|
+
return `/partners/youscribe/download-verification-key`;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Fetch the current public verification key over the authenticated online channel.
|
|
29
|
+
* @summary Read Youscribe Download Verification Key
|
|
30
|
+
*/
|
|
31
|
+
const readYouscribeDownloadVerificationKey = async (options) => {
|
|
32
|
+
return request(getReadYouscribeDownloadVerificationKeyUrl(), {
|
|
33
|
+
...options,
|
|
34
|
+
method: "GET"
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const getReadYouscribeDownloadVerificationKeyQueryKey = () => {
|
|
38
|
+
return [`/partners/youscribe/download-verification-key`];
|
|
39
|
+
};
|
|
40
|
+
const getReadYouscribeDownloadVerificationKeyQueryOptions = (options) => {
|
|
41
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
42
|
+
const queryKey = queryOptions?.queryKey ?? getReadYouscribeDownloadVerificationKeyQueryKey();
|
|
43
|
+
const queryFn = ({ signal }) => readYouscribeDownloadVerificationKey({
|
|
44
|
+
signal,
|
|
45
|
+
...requestOptions
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
queryKey,
|
|
49
|
+
queryFn,
|
|
50
|
+
...queryOptions
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* @summary Read Youscribe Download Verification Key
|
|
55
|
+
*/
|
|
56
|
+
function useReadYouscribeDownloadVerificationKey(options, queryClient) {
|
|
57
|
+
const queryOptions = getReadYouscribeDownloadVerificationKeyQueryOptions(options);
|
|
58
|
+
const query = useQuery(queryOptions, queryClient);
|
|
59
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
60
|
+
}
|
|
61
|
+
const getAcquireYouscribeDownloadUrl = (mediaId) => {
|
|
62
|
+
return `/partners/youscribe/media/${mediaId}/downloads`;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Authorize SDK acquisition for an existing seat. Creates neither a subscription nor a reading event.
|
|
66
|
+
* @summary Acquire Youscribe Download
|
|
67
|
+
*/
|
|
68
|
+
const acquireYouscribeDownload = async (mediaId, options) => {
|
|
69
|
+
return request(getAcquireYouscribeDownloadUrl(mediaId), {
|
|
70
|
+
...options,
|
|
71
|
+
method: "POST"
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const getAcquireYouscribeDownloadMutationKey = () => ["acquireYouscribeDownload"];
|
|
75
|
+
const getAcquireYouscribeDownloadMutationOptions = (options) => {
|
|
76
|
+
const mutationKey = getAcquireYouscribeDownloadMutationKey();
|
|
77
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
78
|
+
...options,
|
|
79
|
+
mutation: {
|
|
80
|
+
...options.mutation,
|
|
81
|
+
mutationKey
|
|
82
|
+
}
|
|
83
|
+
} : {
|
|
84
|
+
mutation: { mutationKey },
|
|
85
|
+
request: void 0
|
|
86
|
+
};
|
|
87
|
+
const mutationFn = (props) => {
|
|
88
|
+
const { mediaId } = props ?? {};
|
|
89
|
+
return acquireYouscribeDownload(mediaId, requestOptions);
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
mutationFn,
|
|
93
|
+
...mutationOptions
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @summary Acquire Youscribe Download
|
|
98
|
+
*/
|
|
99
|
+
const useAcquireYouscribeDownload = (options, queryClient) => {
|
|
100
|
+
return useMutation(getAcquireYouscribeDownloadMutationOptions(options), queryClient);
|
|
101
|
+
};
|
|
24
102
|
const getReadHostedPackageUrl = (mediaId, params) => {
|
|
25
103
|
const normalizedParams = new URLSearchParams();
|
|
26
104
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -226,6 +304,6 @@ const useOpenNativeAuth = (options, queryClient) => {
|
|
|
226
304
|
return useMutation(getOpenNativeAuthMutationOptions(options), queryClient);
|
|
227
305
|
};
|
|
228
306
|
//#endregion
|
|
229
|
-
export { getOpenNativeAuthMutationKey, getOpenNativeAuthMutationOptions, getOpenNativeAuthUrl, getOpenNativeReaderMutationKey, getOpenNativeReaderMutationOptions, getOpenNativeReaderUrl, getReadHostedPackageQueryKey, getReadHostedPackageQueryOptions, getReadHostedPackageUrl, getReadNativeAuthQueryKey, getReadNativeAuthQueryOptions, getReadNativeAuthUrl, openNativeAuth, openNativeReader, readHostedPackage, readNativeAuth, useOpenNativeAuth, useOpenNativeReader, useReadHostedPackage, useReadNativeAuth };
|
|
307
|
+
export { acquireYouscribeDownload, getAcquireYouscribeDownloadMutationKey, getAcquireYouscribeDownloadMutationOptions, getAcquireYouscribeDownloadUrl, getOpenNativeAuthMutationKey, getOpenNativeAuthMutationOptions, getOpenNativeAuthUrl, getOpenNativeReaderMutationKey, getOpenNativeReaderMutationOptions, getOpenNativeReaderUrl, getReadHostedPackageQueryKey, getReadHostedPackageQueryOptions, getReadHostedPackageUrl, getReadNativeAuthQueryKey, getReadNativeAuthQueryOptions, getReadNativeAuthUrl, getReadYouscribeDownloadVerificationKeyQueryKey, getReadYouscribeDownloadVerificationKeyQueryOptions, getReadYouscribeDownloadVerificationKeyUrl, openNativeAuth, openNativeReader, readHostedPackage, readNativeAuth, readYouscribeDownloadVerificationKey, useAcquireYouscribeDownload, useOpenNativeAuth, useOpenNativeReader, useReadHostedPackage, useReadNativeAuth, useReadYouscribeDownloadVerificationKey };
|
|
230
308
|
|
|
231
309
|
//# sourceMappingURL=partner-reader-youscribe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partner-reader-youscribe.js","names":[],"sources":["../../src/react/partner-reader-youscribe/partner-reader-youscribe.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.19.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ReadHostedPackageParams,\n ReaderPackageRead,\n ValidationErrorResponse,\n YouScribeAuthRead,\n YouScribeReaderRead\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 getReadHostedPackageUrl = (mediaId: number,\n params?: ReadHostedPackageParams,) => {\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/youscribe/media/${mediaId}/package?${stringifiedParams}` : `/partners/youscribe/media/${mediaId}/package`\n}\n\n/**\n * **Deprecated**: the hosted reader's address and a lease. As in 0.13.0.\n *\n * Requires a seat already taken and never takes one: a GET does not buy a\n * subscription.\n * @deprecated\n * @summary Read Hosted Package\n */\nexport const readHostedPackage = async (mediaId: number,\n params?: ReadHostedPackageParams, options?: Parameters<typeof request>[1]): Promise<ReaderPackageRead> => {\n\n return request<ReaderPackageRead>(getReadHostedPackageUrl(mediaId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadHostedPackageQueryKey = (mediaId: number,\n params?: ReadHostedPackageParams,) => {\n return [\n `/partners/youscribe/media/${mediaId}/package`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getReadHostedPackageQueryOptions = <TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(mediaId: number,\n params?: ReadHostedPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadHostedPackageQueryKey(mediaId,params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readHostedPackage>>> = ({ signal }) => readHostedPackage(mediaId,params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: mediaId !== null && mediaId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadHostedPackageQueryResult = NonNullable<Awaited<ReturnType<typeof readHostedPackage>>>\nexport type ReadHostedPackageQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadHostedPackage<TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params: undefined | ReadHostedPackageParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readHostedPackage>>,\n TError,\n Awaited<ReturnType<typeof readHostedPackage>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadHostedPackage<TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadHostedPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readHostedPackage>>,\n TError,\n Awaited<ReturnType<typeof readHostedPackage>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadHostedPackage<TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadHostedPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @deprecated\n * @summary Read Hosted Package\n */\n\nexport function useReadHostedPackage<TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadHostedPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadHostedPackageQueryOptions(mediaId,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 getOpenNativeReaderUrl = (mediaId: number,) => {\n\n\n\n\n return `/partners/youscribe/media/${mediaId}/reader-auth`\n}\n\n/**\n * **Deprecated**: ``POST …/reader-access/embedded``, which takes the seat too. As in 0.13.0.\n *\n * Credentials for one title, taking a seat on first use, and the consumption\n * lease that records the opening. Renew ``lease.eventId`` while the reader is\n * open and close it when it exits.\n * @deprecated\n * @summary Open Native Reader\n */\nexport const openNativeReader = async (mediaId: number, options?: Parameters<typeof request>[1]): Promise<YouScribeReaderRead> => {\n\n return request<YouScribeReaderRead>(getOpenNativeReaderUrl(mediaId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getOpenNativeReaderMutationKey = () => ['openNativeReader'] as const;\n\nexport const getOpenNativeReaderMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openNativeReader>>, TError,OpenNativeReaderMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof openNativeReader>>, TError,OpenNativeReaderMutationVariables, TContext> => {\n\nconst mutationKey = getOpenNativeReaderMutationKey();\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 openNativeReader>>, OpenNativeReaderMutationVariables> = (props) => {\n const {mediaId} = props ?? {};\n\n return openNativeReader(mediaId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OpenNativeReaderMutationResult = NonNullable<Awaited<ReturnType<typeof openNativeReader>>>\n\n export type OpenNativeReaderMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type OpenNativeReaderMutationVariables = {mediaId: number}\n\n /**\n * @deprecated\n * @summary Open Native Reader\n */\nexport const useOpenNativeReader = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openNativeReader>>, TError,OpenNativeReaderMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof openNativeReader>>,\n TError,\n OpenNativeReaderMutationVariables,\n TContext\n > => {\n return useMutation(getOpenNativeReaderMutationOptions(options), queryClient);\n }\n export const getReadNativeAuthUrl = () => {\n\n\n\n\n return `/partners/youscribe/user/auth`\n}\n\n/**\n * YouScribe native SDK credentials for the selected, authorized profile.\n *\n * **Deprecated.** ``POST /partners/youscribe/media/{id}/reader-access/embedded``\n * answers the same credentials with the opening, and records it. This stays\n * while the current mobile app migrates, then goes.\n *\n * The legacy's ``GET /api/v1/{catalog}/user/auth``, and the only YouScribe\n * credentials endpoint — because a YouScribe token is issued **per patron and\n * not per title**, so an authorization keyed by media was answering a question\n * nobody asked. ``POST /media/{id}/reader-auth`` and ``POST /user/auth`` were\n * both this endpoint again: the first added a ``mediaId`` the caller already\n * knew, the second provisioned a seat it no longer provisions.\n *\n * **This is an authentication, not a read.** It exchanges the patron's licence\n * for a session token on YouScribe's REST API, and nothing follows from it: a\n * caller may ask for a token and never open a title. So there is no licence to\n * create and no consumption to record here, not as a policy but because\n * nothing has been consumed.\n *\n * The reading itself happens in the partner's own player — hosted on the web,\n * through their SDK inside the mobile app — and that player reports its\n * consumption to YouScribe. Which is why the opening is recorded by\n * reader-access and not here: it is the one call a client makes on Read.\n *\n * The token is personal: never persist it, log it, or share it between\n * profiles.\n * @deprecated\n * @summary Read Native Auth\n */\nexport const readNativeAuth = async ( options?: Parameters<typeof request>[1]): Promise<YouScribeAuthRead> => {\n\n return request<YouScribeAuthRead>(getReadNativeAuthUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadNativeAuthQueryKey = () => {\n return [\n `/partners/youscribe/user/auth`\n ] as const;\n }\n\n\nexport const getReadNativeAuthQueryOptions = <TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadNativeAuthQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readNativeAuth>>> = ({ signal }) => readNativeAuth({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadNativeAuthQueryResult = NonNullable<Awaited<ReturnType<typeof readNativeAuth>>>\nexport type ReadNativeAuthQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readNativeAuth>>,\n TError,\n Awaited<ReturnType<typeof readNativeAuth>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readNativeAuth>>,\n TError,\n Awaited<ReturnType<typeof readNativeAuth>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @deprecated\n * @summary Read Native Auth\n */\n\nexport function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadNativeAuthQueryOptions(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 getOpenNativeAuthUrl = () => {\n\n\n\n\n return `/partners/youscribe/user/auth`\n}\n\n/**\n * **Deprecated**: ``POST …/reader-access/embedded``. As in 0.13.0.\n *\n * Credentials for this profile, taking a seat on first use. Call only on the\n * patron's explicit Read: it can create a paid subscription.\n * @deprecated\n * @summary Open Native Auth\n */\nexport const openNativeAuth = async ( options?: Parameters<typeof request>[1]): Promise<YouScribeAuthRead> => {\n\n return request<YouScribeAuthRead>(getOpenNativeAuthUrl(),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getOpenNativeAuthMutationKey = () => ['openNativeAuth'] as const;\n\nexport const getOpenNativeAuthMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openNativeAuth>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof openNativeAuth>>, TError,void, TContext> => {\n\nconst mutationKey = getOpenNativeAuthMutationKey();\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 openNativeAuth>>, void> = () => {\n\n\n return openNativeAuth(requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OpenNativeAuthMutationResult = NonNullable<Awaited<ReturnType<typeof openNativeAuth>>>\n\n export type OpenNativeAuthMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\n /**\n * @deprecated\n * @summary Open Native Auth\n */\nexport const useOpenNativeAuth = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openNativeAuth>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof openNativeAuth>>,\n TError,\n void,\n TContext\n > => {\n return useMutation(getOpenNativeAuthMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,2BAA2B,SACpC,WAAsC;CACxC,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAErD,IAAI,UAAU,KAAA,GACZ,iBAAiB,OAAO,KAAK,UAAU,OAAO,SAAS,OAAO,KAAK,CAAC;CAExE,CAAC;CAED,MAAM,oBAAoB,iBAAiB,SAAS;CAEpD,OAAO,kBAAkB,SAAS,IAAI,6BAA6B,QAAQ,WAAW,sBAAsB,6BAA6B,QAAQ;AACnJ;;;;;;;;;AAUA,MAAa,oBAAoB,OAAO,SACpC,QAAkC,YAAwE;CAE5G,OAAO,QAA2B,wBAAwB,SAAQ,MAAM,GACxE;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,gCAAgC,SACzC,WAAsC;CACtC,OAAO,CACP,6BAA6B,QAAQ,WAAW,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CACzE;AACA;AAGJ,MAAa,oCAAgK,SACzK,QAAkC,YACjC;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,6BAA6B,SAAQ,MAAM;C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e/partner-reader-youscribe.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.20.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 OfflineVerificationKeyRead,\n ReadHostedPackageParams,\n ReaderPackageRead,\n ValidationErrorResponse,\n YouScribeAuthRead,\n YouScribeDownloadRead,\n YouScribeReaderRead\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 getReadYouscribeDownloadVerificationKeyUrl = () => {\n\n\n\n\n return `/partners/youscribe/download-verification-key`\n}\n\n/**\n * Fetch the current public verification key over the authenticated online channel.\n * @summary Read Youscribe Download Verification Key\n */\nexport const readYouscribeDownloadVerificationKey = async ( options?: Parameters<typeof request>[1]): Promise<OfflineVerificationKeyRead> => {\n\n return request<OfflineVerificationKeyRead>(getReadYouscribeDownloadVerificationKeyUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadYouscribeDownloadVerificationKeyQueryKey = () => {\n return [\n `/partners/youscribe/download-verification-key`\n ] as const;\n }\n\n\nexport const getReadYouscribeDownloadVerificationKeyQueryOptions = <TData = Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadYouscribeDownloadVerificationKeyQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>> = ({ signal }) => readYouscribeDownloadVerificationKey({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadYouscribeDownloadVerificationKeyQueryResult = NonNullable<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>>\nexport type ReadYouscribeDownloadVerificationKeyQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadYouscribeDownloadVerificationKey<TData = Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>,\n TError,\n Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadYouscribeDownloadVerificationKey<TData = Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>,\n TError,\n Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadYouscribeDownloadVerificationKey<TData = Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Youscribe Download Verification Key\n */\n\nexport function useReadYouscribeDownloadVerificationKey<TData = Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readYouscribeDownloadVerificationKey>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadYouscribeDownloadVerificationKeyQueryOptions(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 getAcquireYouscribeDownloadUrl = (mediaId: number,) => {\n\n\n\n\n return `/partners/youscribe/media/${mediaId}/downloads`\n}\n\n/**\n * Authorize SDK acquisition for an existing seat. Creates neither a subscription nor a reading event.\n * @summary Acquire Youscribe Download\n */\nexport const acquireYouscribeDownload = async (mediaId: number, options?: Parameters<typeof request>[1]): Promise<YouScribeDownloadRead> => {\n\n return request<YouScribeDownloadRead>(getAcquireYouscribeDownloadUrl(mediaId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getAcquireYouscribeDownloadMutationKey = () => ['acquireYouscribeDownload'] as const;\n\nexport const getAcquireYouscribeDownloadMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof acquireYouscribeDownload>>, TError,AcquireYouscribeDownloadMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof acquireYouscribeDownload>>, TError,AcquireYouscribeDownloadMutationVariables, TContext> => {\n\nconst mutationKey = getAcquireYouscribeDownloadMutationKey();\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 acquireYouscribeDownload>>, AcquireYouscribeDownloadMutationVariables> = (props) => {\n const {mediaId} = props ?? {};\n\n return acquireYouscribeDownload(mediaId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AcquireYouscribeDownloadMutationResult = NonNullable<Awaited<ReturnType<typeof acquireYouscribeDownload>>>\n\n export type AcquireYouscribeDownloadMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type AcquireYouscribeDownloadMutationVariables = {mediaId: number}\n\n /**\n * @summary Acquire Youscribe Download\n */\nexport const useAcquireYouscribeDownload = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof acquireYouscribeDownload>>, TError,AcquireYouscribeDownloadMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof acquireYouscribeDownload>>,\n TError,\n AcquireYouscribeDownloadMutationVariables,\n TContext\n > => {\n return useMutation(getAcquireYouscribeDownloadMutationOptions(options), queryClient);\n }\n export const getReadHostedPackageUrl = (mediaId: number,\n params?: ReadHostedPackageParams,) => {\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/youscribe/media/${mediaId}/package?${stringifiedParams}` : `/partners/youscribe/media/${mediaId}/package`\n}\n\n/**\n * **Deprecated**: the hosted reader's address and a lease. As in 0.13.0.\n *\n * Requires a seat already taken and never takes one: a GET does not buy a\n * subscription.\n * @deprecated\n * @summary Read Hosted Package\n */\nexport const readHostedPackage = async (mediaId: number,\n params?: ReadHostedPackageParams, options?: Parameters<typeof request>[1]): Promise<ReaderPackageRead> => {\n\n return request<ReaderPackageRead>(getReadHostedPackageUrl(mediaId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadHostedPackageQueryKey = (mediaId: number,\n params?: ReadHostedPackageParams,) => {\n return [\n `/partners/youscribe/media/${mediaId}/package`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getReadHostedPackageQueryOptions = <TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(mediaId: number,\n params?: ReadHostedPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadHostedPackageQueryKey(mediaId,params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readHostedPackage>>> = ({ signal }) => readHostedPackage(mediaId,params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: mediaId !== null && mediaId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadHostedPackageQueryResult = NonNullable<Awaited<ReturnType<typeof readHostedPackage>>>\nexport type ReadHostedPackageQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadHostedPackage<TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params: undefined | ReadHostedPackageParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readHostedPackage>>,\n TError,\n Awaited<ReturnType<typeof readHostedPackage>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadHostedPackage<TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadHostedPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readHostedPackage>>,\n TError,\n Awaited<ReturnType<typeof readHostedPackage>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadHostedPackage<TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadHostedPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @deprecated\n * @summary Read Hosted Package\n */\n\nexport function useReadHostedPackage<TData = Awaited<ReturnType<typeof readHostedPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n mediaId: number,\n params?: ReadHostedPackageParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readHostedPackage>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadHostedPackageQueryOptions(mediaId,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 getOpenNativeReaderUrl = (mediaId: number,) => {\n\n\n\n\n return `/partners/youscribe/media/${mediaId}/reader-auth`\n}\n\n/**\n * **Deprecated**: ``POST …/reader-access/embedded``, which takes the seat too. As in 0.13.0.\n *\n * Credentials for one title, taking a seat on first use, and the consumption\n * lease that records the opening. Renew ``lease.eventId`` while the reader is\n * open and close it when it exits.\n * @deprecated\n * @summary Open Native Reader\n */\nexport const openNativeReader = async (mediaId: number, options?: Parameters<typeof request>[1]): Promise<YouScribeReaderRead> => {\n\n return request<YouScribeReaderRead>(getOpenNativeReaderUrl(mediaId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getOpenNativeReaderMutationKey = () => ['openNativeReader'] as const;\n\nexport const getOpenNativeReaderMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openNativeReader>>, TError,OpenNativeReaderMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof openNativeReader>>, TError,OpenNativeReaderMutationVariables, TContext> => {\n\nconst mutationKey = getOpenNativeReaderMutationKey();\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 openNativeReader>>, OpenNativeReaderMutationVariables> = (props) => {\n const {mediaId} = props ?? {};\n\n return openNativeReader(mediaId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OpenNativeReaderMutationResult = NonNullable<Awaited<ReturnType<typeof openNativeReader>>>\n\n export type OpenNativeReaderMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type OpenNativeReaderMutationVariables = {mediaId: number}\n\n /**\n * @deprecated\n * @summary Open Native Reader\n */\nexport const useOpenNativeReader = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openNativeReader>>, TError,OpenNativeReaderMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof openNativeReader>>,\n TError,\n OpenNativeReaderMutationVariables,\n TContext\n > => {\n return useMutation(getOpenNativeReaderMutationOptions(options), queryClient);\n }\n export const getReadNativeAuthUrl = () => {\n\n\n\n\n return `/partners/youscribe/user/auth`\n}\n\n/**\n * YouScribe native SDK credentials for the selected, authorized profile.\n *\n * **Deprecated.** ``POST /partners/youscribe/media/{id}/reader-access/embedded``\n * answers the same credentials with the opening, and records it. This stays\n * while the current mobile app migrates, then goes.\n *\n * The legacy's ``GET /api/v1/{catalog}/user/auth``, and the only YouScribe\n * credentials endpoint — because a YouScribe token is issued **per patron and\n * not per title**, so an authorization keyed by media was answering a question\n * nobody asked. ``POST /media/{id}/reader-auth`` and ``POST /user/auth`` were\n * both this endpoint again: the first added a ``mediaId`` the caller already\n * knew, the second provisioned a seat it no longer provisions.\n *\n * **This is an authentication, not a read.** It exchanges the patron's licence\n * for a session token on YouScribe's REST API, and nothing follows from it: a\n * caller may ask for a token and never open a title. So there is no licence to\n * create and no consumption to record here, not as a policy but because\n * nothing has been consumed.\n *\n * The reading itself happens in the partner's own player — hosted on the web,\n * through their SDK inside the mobile app — and that player reports its\n * consumption to YouScribe. Which is why the opening is recorded by\n * reader-access and not here: it is the one call a client makes on Read.\n *\n * The token is personal: never persist it, log it, or share it between\n * profiles.\n * @deprecated\n * @summary Read Native Auth\n */\nexport const readNativeAuth = async ( options?: Parameters<typeof request>[1]): Promise<YouScribeAuthRead> => {\n\n return request<YouScribeAuthRead>(getReadNativeAuthUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadNativeAuthQueryKey = () => {\n return [\n `/partners/youscribe/user/auth`\n ] as const;\n }\n\n\nexport const getReadNativeAuthQueryOptions = <TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadNativeAuthQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readNativeAuth>>> = ({ signal }) => readNativeAuth({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadNativeAuthQueryResult = NonNullable<Awaited<ReturnType<typeof readNativeAuth>>>\nexport type ReadNativeAuthQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readNativeAuth>>,\n TError,\n Awaited<ReturnType<typeof readNativeAuth>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readNativeAuth>>,\n TError,\n Awaited<ReturnType<typeof readNativeAuth>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @deprecated\n * @summary Read Native Auth\n */\n\nexport function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadNativeAuthQueryOptions(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 getOpenNativeAuthUrl = () => {\n\n\n\n\n return `/partners/youscribe/user/auth`\n}\n\n/**\n * **Deprecated**: ``POST …/reader-access/embedded``. As in 0.13.0.\n *\n * Credentials for this profile, taking a seat on first use. Call only on the\n * patron's explicit Read: it can create a paid subscription.\n * @deprecated\n * @summary Open Native Auth\n */\nexport const openNativeAuth = async ( options?: Parameters<typeof request>[1]): Promise<YouScribeAuthRead> => {\n\n return request<YouScribeAuthRead>(getOpenNativeAuthUrl(),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getOpenNativeAuthMutationKey = () => ['openNativeAuth'] as const;\n\nexport const getOpenNativeAuthMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openNativeAuth>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof openNativeAuth>>, TError,void, TContext> => {\n\nconst mutationKey = getOpenNativeAuthMutationKey();\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 openNativeAuth>>, void> = () => {\n\n\n return openNativeAuth(requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type OpenNativeAuthMutationResult = NonNullable<Awaited<ReturnType<typeof openNativeAuth>>>\n\n export type OpenNativeAuthMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\n /**\n * @deprecated\n * @summary Open Native Auth\n */\nexport const useOpenNativeAuth = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof openNativeAuth>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof openNativeAuth>>,\n TError,\n void,\n TContext\n > => {\n return useMutation(getOpenNativeAuthMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA6CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,mDAAmD;CAK9D,OAAO;AACT;;;;;AAMA,MAAa,uCAAuC,OAAQ,YAAiF;CAE3I,OAAO,QAAoC,2CAA2C,GACtF;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,wDAAwD;CACjE,OAAO,CACP,+CACA;AACA;AAGJ,MAAa,uDAAuM,YAC/M;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,gDAAgD;CAI1F,MAAM,WAA4F,EAAE,aAAa,qCAAqC;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMpL,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,wCACd,SACC,aACiF;CAElF,MAAM,eAAe,oDAAoD,OAAO;CAEhF,MAAM,QAAQ,SAAS,c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,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,mBAAuF;EAGzF,OAAQ,eAAe,cAAc;CACvC;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;;AAW5C,MAAa,qBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,iCAAiC,OAAO,GAAG,WAAW;AAC3E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Ju as HTTPExceptionResponse, _d as ReaderMode, ki as PartnerReaderAccessRead, w as ValidationErrorResponse, zx as PartnerProvider } from "../chunks/index.js";
|
|
3
3
|
import { a as ErrorType, c as request } from "../chunks/client.js";
|
|
4
4
|
import { QueryClient, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
5
5
|
//#region src/react/partner-reading/partner-reading.d.ts
|
|
@@ -7,7 +7,7 @@ import { useMutation } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
9
|
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
-
* OpenAPI spec version: 0.
|
|
10
|
+
* OpenAPI spec version: 0.20.0
|
|
11
11
|
*/
|
|
12
12
|
const getOpenReaderAccessUrl = (provider, mediaId, mode) => {
|
|
13
13
|
return `/partners/${provider}/media/${mediaId}/reader-access/${mode}`;
|