@learnorama/mozaik-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -0
- package/dist/api/account.d.ts +75 -0
- package/dist/api/account.js +117 -0
- package/dist/api/account.js.map +1 -0
- package/dist/api/admin-catalogue.d.ts +68 -0
- package/dist/api/admin-catalogue.js +155 -0
- package/dist/api/admin-catalogue.js.map +1 -0
- package/dist/api/admin-consumption.d.ts +27 -0
- package/dist/api/admin-consumption.js +55 -0
- package/dist/api/admin-consumption.js.map +1 -0
- package/dist/api/admin-licenses.d.ts +21 -0
- package/dist/api/admin-licenses.js +34 -0
- package/dist/api/admin-licenses.js.map +1 -0
- package/dist/api/admin-patrons.d.ts +36 -0
- package/dist/api/admin-patrons.js +76 -0
- package/dist/api/admin-patrons.js.map +1 -0
- package/dist/api/admin-reviews.d.ts +30 -0
- package/dist/api/admin-reviews.js +63 -0
- package/dist/api/admin-reviews.js.map +1 -0
- package/dist/api/admin-roles.d.ts +34 -0
- package/dist/api/admin-roles.js +62 -0
- package/dist/api/admin-roles.js.map +1 -0
- package/dist/api/admin-support.d.ts +68 -0
- package/dist/api/admin-support.js +116 -0
- package/dist/api/admin-support.js.map +1 -0
- package/dist/api/admin-tenants.d.ts +33 -0
- package/dist/api/admin-tenants.js +68 -0
- package/dist/api/admin-tenants.js.map +1 -0
- package/dist/api/admin-tutoring.d.ts +159 -0
- package/dist/api/admin-tutoring.js +455 -0
- package/dist/api/admin-tutoring.js.map +1 -0
- package/dist/api/auth.d.ts +92 -0
- package/dist/api/auth.js +192 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/biblio-catalogue.d.ts +122 -0
- package/dist/api/biblio-catalogue.js +223 -0
- package/dist/api/biblio-catalogue.js.map +1 -0
- package/dist/api/biblio-home.d.ts +18 -0
- package/dist/api/biblio-home.js +31 -0
- package/dist/api/biblio-home.js.map +1 -0
- package/dist/api/biblio-library.d.ts +94 -0
- package/dist/api/biblio-library.js +187 -0
- package/dist/api/biblio-library.js.map +1 -0
- package/dist/api/biblio-nextory.d.ts +43 -0
- package/dist/api/biblio-nextory.js +65 -0
- package/dist/api/biblio-nextory.js.map +1 -0
- package/dist/api/biblio-press.d.ts +38 -0
- package/dist/api/biblio-press.js +70 -0
- package/dist/api/biblio-press.js.map +1 -0
- package/dist/api/biblio-search.d.ts +17 -0
- package/dist/api/biblio-search.js +30 -0
- package/dist/api/biblio-search.js.map +1 -0
- package/dist/api/biblio-telemetry.d.ts +28 -0
- package/dist/api/biblio-telemetry.js +49 -0
- package/dist/api/biblio-telemetry.js.map +1 -0
- package/dist/api/consumption.d.ts +30 -0
- package/dist/api/consumption.js +45 -0
- package/dist/api/consumption.js.map +1 -0
- package/dist/api/cvs-app.d.ts +39 -0
- package/dist/api/cvs-app.js +72 -0
- package/dist/api/cvs-app.js.map +1 -0
- package/dist/api/cvs-documents.d.ts +106 -0
- package/dist/api/cvs-documents.js +208 -0
- package/dist/api/cvs-documents.js.map +1 -0
- package/dist/api/cvs-favorites.d.ts +53 -0
- package/dist/api/cvs-favorites.js +82 -0
- package/dist/api/cvs-favorites.js.map +1 -0
- package/dist/api/cvs-loans.d.ts +59 -0
- package/dist/api/cvs-loans.js +106 -0
- package/dist/api/cvs-loans.js.map +1 -0
- package/dist/api/cvs-streaming.d.ts +40 -0
- package/dist/api/cvs-streaming.js +68 -0
- package/dist/api/cvs-streaming.js.map +1 -0
- package/dist/api/index.d.ts +34 -0
- package/dist/api/index.js +34 -0
- package/dist/api/partner-catalogue.d.ts +77 -0
- package/dist/api/partner-catalogue.js +125 -0
- package/dist/api/partner-catalogue.js.map +1 -0
- package/dist/api/partner-reader.d.ts +56 -0
- package/dist/api/partner-reader.js +103 -0
- package/dist/api/partner-reader.js.map +1 -0
- package/dist/api/profiles.d.ts +64 -0
- package/dist/api/profiles.js +126 -0
- package/dist/api/profiles.js.map +1 -0
- package/dist/api/tutoring-catalogue.d.ts +32 -0
- package/dist/api/tutoring-catalogue.js +59 -0
- package/dist/api/tutoring-catalogue.js.map +1 -0
- package/dist/api/tutoring-chat.d.ts +31 -0
- package/dist/api/tutoring-chat.js +71 -0
- package/dist/api/tutoring-chat.js.map +1 -0
- package/dist/api/tutoring-dispatch.d.ts +37 -0
- package/dist/api/tutoring-dispatch.js +83 -0
- package/dist/api/tutoring-dispatch.js.map +1 -0
- package/dist/api/tutoring-practitioner.d.ts +55 -0
- package/dist/api/tutoring-practitioner.js +110 -0
- package/dist/api/tutoring-practitioner.js.map +1 -0
- package/dist/api/tutoring-requests.d.ts +86 -0
- package/dist/api/tutoring-requests.js +176 -0
- package/dist/api/tutoring-requests.js.map +1 -0
- package/dist/client-BDwBZYB0.d.ts +28 -0
- package/dist/client-D3kMOcIr.js +61 -0
- package/dist/client-D3kMOcIr.js.map +1 -0
- package/dist/index-wL_20vR8.d.ts +4566 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +3 -0
- package/dist/models.js +175 -0
- package/dist/models.js.map +1 -0
- package/dist/react/account.d.ts +163 -0
- package/dist/react/account.js +240 -0
- package/dist/react/account.js.map +1 -0
- package/dist/react/admin-catalogue.d.ts +196 -0
- package/dist/react/admin-catalogue.js +336 -0
- package/dist/react/admin-catalogue.js.map +1 -0
- package/dist/react/admin-consumption.d.ts +75 -0
- package/dist/react/admin-consumption.js +127 -0
- package/dist/react/admin-consumption.js.map +1 -0
- package/dist/react/admin-licenses.d.ts +50 -0
- package/dist/react/admin-licenses.js +78 -0
- package/dist/react/admin-licenses.js.map +1 -0
- package/dist/react/admin-patrons.d.ts +111 -0
- package/dist/react/admin-patrons.js +173 -0
- package/dist/react/admin-patrons.js.map +1 -0
- package/dist/react/admin-reviews.d.ts +78 -0
- package/dist/react/admin-reviews.js +135 -0
- package/dist/react/admin-reviews.js.map +1 -0
- package/dist/react/admin-roles.d.ts +82 -0
- package/dist/react/admin-roles.js +135 -0
- package/dist/react/admin-roles.js.map +1 -0
- package/dist/react/admin-support.d.ts +123 -0
- package/dist/react/admin-support.js +208 -0
- package/dist/react/admin-support.js.map +1 -0
- package/dist/react/admin-tenants.d.ts +108 -0
- package/dist/react/admin-tenants.js +165 -0
- package/dist/react/admin-tenants.js.map +1 -0
- package/dist/react/admin-tutoring.d.ts +556 -0
- package/dist/react/admin-tutoring.js +954 -0
- package/dist/react/admin-tutoring.js.map +1 -0
- package/dist/react/auth.d.ts +220 -0
- package/dist/react/auth.js +372 -0
- package/dist/react/auth.js.map +1 -0
- package/dist/react/biblio-catalogue.d.ts +374 -0
- package/dist/react/biblio-catalogue.js +498 -0
- package/dist/react/biblio-catalogue.js.map +1 -0
- package/dist/react/biblio-home.d.ts +47 -0
- package/dist/react/biblio-home.js +75 -0
- package/dist/react/biblio-home.js.map +1 -0
- package/dist/react/biblio-library.d.ts +285 -0
- package/dist/react/biblio-library.js +411 -0
- package/dist/react/biblio-library.js.map +1 -0
- package/dist/react/biblio-nextory.d.ts +100 -0
- package/dist/react/biblio-nextory.js +163 -0
- package/dist/react/biblio-nextory.js.map +1 -0
- package/dist/react/biblio-press.d.ts +121 -0
- package/dist/react/biblio-press.js +163 -0
- package/dist/react/biblio-press.js.map +1 -0
- package/dist/react/biblio-search.d.ts +46 -0
- package/dist/react/biblio-search.js +74 -0
- package/dist/react/biblio-search.js.map +1 -0
- package/dist/react/biblio-telemetry.d.ts +49 -0
- package/dist/react/biblio-telemetry.js +85 -0
- package/dist/react/biblio-telemetry.js.map +1 -0
- package/dist/react/consumption.d.ts +66 -0
- package/dist/react/consumption.js +109 -0
- package/dist/react/consumption.js.map +1 -0
- package/dist/react/cvs-app.d.ts +86 -0
- package/dist/react/cvs-app.js +144 -0
- package/dist/react/cvs-app.js.map +1 -0
- package/dist/react/cvs-documents.d.ts +254 -0
- package/dist/react/cvs-documents.js +418 -0
- package/dist/react/cvs-documents.js.map +1 -0
- package/dist/react/cvs-favorites.d.ts +143 -0
- package/dist/react/cvs-favorites.js +206 -0
- package/dist/react/cvs-favorites.js.map +1 -0
- package/dist/react/cvs-loans.d.ts +140 -0
- package/dist/react/cvs-loans.js +234 -0
- package/dist/react/cvs-loans.js.map +1 -0
- package/dist/react/cvs-streaming.d.ts +87 -0
- package/dist/react/cvs-streaming.js +141 -0
- package/dist/react/cvs-streaming.js.map +1 -0
- package/dist/react/index.d.ts +34 -0
- package/dist/react/index.js +34 -0
- package/dist/react/partner-catalogue.d.ts +223 -0
- package/dist/react/partner-catalogue.js +301 -0
- package/dist/react/partner-catalogue.js.map +1 -0
- package/dist/react/partner-reader.d.ts +159 -0
- package/dist/react/partner-reader.js +226 -0
- package/dist/react/partner-reader.js.map +1 -0
- package/dist/react/profiles.d.ts +174 -0
- package/dist/react/profiles.js +279 -0
- package/dist/react/profiles.js.map +1 -0
- package/dist/react/tutoring-catalogue.d.ts +115 -0
- package/dist/react/tutoring-catalogue.js +151 -0
- package/dist/react/tutoring-catalogue.js.map +1 -0
- package/dist/react/tutoring-chat.d.ts +96 -0
- package/dist/react/tutoring-chat.js +172 -0
- package/dist/react/tutoring-chat.js.map +1 -0
- package/dist/react/tutoring-dispatch.d.ts +102 -0
- package/dist/react/tutoring-dispatch.js +183 -0
- package/dist/react/tutoring-dispatch.js.map +1 -0
- package/dist/react/tutoring-practitioner.d.ts +129 -0
- package/dist/react/tutoring-practitioner.js +230 -0
- package/dist/react/tutoring-practitioner.js.map +1 -0
- package/dist/react/tutoring-requests.d.ts +233 -0
- package/dist/react/tutoring-requests.js +385 -0
- package/dist/react/tutoring-requests.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/cvs-loans/cvs-loans.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const withQueryKey = (query, queryKey) => {
|
|
13
|
+
const result = { queryKey };
|
|
14
|
+
for (const key of Object.keys(query)) {
|
|
15
|
+
if (key === "queryKey") continue;
|
|
16
|
+
Object.defineProperty(result, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get: () => query[key]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const getListLoansUrl = (params) => {
|
|
25
|
+
const normalizedParams = new URLSearchParams();
|
|
26
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
27
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
28
|
+
});
|
|
29
|
+
const stringifiedParams = normalizedParams.toString();
|
|
30
|
+
return stringifiedParams.length > 0 ? `/cvs/loans?${stringifiedParams}` : `/cvs/loans`;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* What this caller currently holds (and optionally what they have returned).
|
|
34
|
+
*
|
|
35
|
+
* Replaces ``/download/details``, which took a ``downloadid`` and answered about
|
|
36
|
+
* one loan at a time — so a client rebuilding its shelf after reinstalling made
|
|
37
|
+
* one request per title, and had no way to discover the ids in the first place.
|
|
38
|
+
* @summary List Loans
|
|
39
|
+
*/
|
|
40
|
+
const listLoans = async (params, options) => {
|
|
41
|
+
return request(getListLoansUrl(params), {
|
|
42
|
+
...options,
|
|
43
|
+
method: "GET"
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const getListLoansQueryKey = (params) => {
|
|
47
|
+
return [`/cvs/loans`, ...params ? [params] : []];
|
|
48
|
+
};
|
|
49
|
+
const getListLoansQueryOptions = (params, options) => {
|
|
50
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
51
|
+
const queryKey = queryOptions?.queryKey ?? getListLoansQueryKey(params);
|
|
52
|
+
const queryFn = ({ signal }) => listLoans(params, {
|
|
53
|
+
signal,
|
|
54
|
+
...requestOptions
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
queryKey,
|
|
58
|
+
queryFn,
|
|
59
|
+
...queryOptions
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* @summary List Loans
|
|
64
|
+
*/
|
|
65
|
+
function useListLoans(params, options, queryClient) {
|
|
66
|
+
const queryOptions = getListLoansQueryOptions(params, options);
|
|
67
|
+
const query = useQuery(queryOptions, queryClient);
|
|
68
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
69
|
+
}
|
|
70
|
+
const getBorrowUrl = () => {
|
|
71
|
+
return `/cvs/loans`;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Borrow a work.
|
|
75
|
+
*
|
|
76
|
+
* The order matters and is the whole point of the entitlement model:
|
|
77
|
+
*
|
|
78
|
+
* 1. **Entitled?** — is this act permitted on this work under a live contract.
|
|
79
|
+
* 2. **A seat free?** — ``max_concurrent`` counted from unreturned loans.
|
|
80
|
+
* 3. **Units left?** — reserved in Redis *before* the row is written, so a
|
|
81
|
+
* refusal costs no database work.
|
|
82
|
+
* 4. **Append.** The ledger row is the loan.
|
|
83
|
+
*
|
|
84
|
+
* Idempotent on ``request_key``: a retried borrow returns the loan the first
|
|
85
|
+
* attempt created rather than taking a second copy of the same title.
|
|
86
|
+
* @summary Borrow
|
|
87
|
+
*/
|
|
88
|
+
const borrow = async (borrowWrite, options) => {
|
|
89
|
+
const getHeaders = (h) => {
|
|
90
|
+
if (!h) return {};
|
|
91
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
92
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
93
|
+
const headers = {};
|
|
94
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
95
|
+
return headers;
|
|
96
|
+
};
|
|
97
|
+
return request(getBorrowUrl(), {
|
|
98
|
+
...options,
|
|
99
|
+
method: "POST",
|
|
100
|
+
headers: {
|
|
101
|
+
"Content-Type": "application/json",
|
|
102
|
+
...getHeaders(options?.headers)
|
|
103
|
+
},
|
|
104
|
+
body: JSON.stringify(borrowWrite)
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const getBorrowMutationKey = () => ["borrow"];
|
|
108
|
+
const getBorrowMutationOptions = (options) => {
|
|
109
|
+
const mutationKey = getBorrowMutationKey();
|
|
110
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
111
|
+
...options,
|
|
112
|
+
mutation: {
|
|
113
|
+
...options.mutation,
|
|
114
|
+
mutationKey
|
|
115
|
+
}
|
|
116
|
+
} : {
|
|
117
|
+
mutation: { mutationKey },
|
|
118
|
+
request: void 0
|
|
119
|
+
};
|
|
120
|
+
const mutationFn = (props) => {
|
|
121
|
+
const { data } = props ?? {};
|
|
122
|
+
return borrow(data, requestOptions);
|
|
123
|
+
};
|
|
124
|
+
return {
|
|
125
|
+
mutationFn,
|
|
126
|
+
...mutationOptions
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* @summary Borrow
|
|
131
|
+
*/
|
|
132
|
+
const useBorrow = (options, queryClient) => {
|
|
133
|
+
return useMutation(getBorrowMutationOptions(options), queryClient);
|
|
134
|
+
};
|
|
135
|
+
const getReturnLoanUrl = (loanId) => {
|
|
136
|
+
return `/cvs/loans/${loanId}`;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Give a loan back early, freeing its seat. Idempotent.
|
|
140
|
+
*
|
|
141
|
+
* Returning something already returned is ``204``: the caller wanted it back on
|
|
142
|
+
* the shelf and it is on the shelf. The legacy answered an error, which meant a
|
|
143
|
+
* retried return looked like a failure and clients stopped retrying.
|
|
144
|
+
*
|
|
145
|
+
* The unit stays spent — see the module docstring. Only the seat comes back.
|
|
146
|
+
* @summary Return Loan
|
|
147
|
+
*/
|
|
148
|
+
const returnLoan = async (loanId, options) => {
|
|
149
|
+
return request(getReturnLoanUrl(loanId), {
|
|
150
|
+
...options,
|
|
151
|
+
method: "DELETE"
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
const getReturnLoanMutationKey = () => ["returnLoan"];
|
|
155
|
+
const getReturnLoanMutationOptions = (options) => {
|
|
156
|
+
const mutationKey = getReturnLoanMutationKey();
|
|
157
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
158
|
+
...options,
|
|
159
|
+
mutation: {
|
|
160
|
+
...options.mutation,
|
|
161
|
+
mutationKey
|
|
162
|
+
}
|
|
163
|
+
} : {
|
|
164
|
+
mutation: { mutationKey },
|
|
165
|
+
request: void 0
|
|
166
|
+
};
|
|
167
|
+
const mutationFn = (props) => {
|
|
168
|
+
const { loanId } = props ?? {};
|
|
169
|
+
return returnLoan(loanId, requestOptions);
|
|
170
|
+
};
|
|
171
|
+
return {
|
|
172
|
+
mutationFn,
|
|
173
|
+
...mutationOptions
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* @summary Return Loan
|
|
178
|
+
*/
|
|
179
|
+
const useReturnLoan = (options, queryClient) => {
|
|
180
|
+
return useMutation(getReturnLoanMutationOptions(options), queryClient);
|
|
181
|
+
};
|
|
182
|
+
const getExtendLoanUrl = (loanId) => {
|
|
183
|
+
return `/cvs/loans/${loanId}/extensions`;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Prolong a loan.
|
|
187
|
+
*
|
|
188
|
+
* Bounded by the grant's ``max_extensions`` — the legacy's ``nb_extend`` — and
|
|
189
|
+
* refused once the loan has been returned or has lapsed. Extending something
|
|
190
|
+
* that already expired is not an extension, it is a new loan, and it should
|
|
191
|
+
* spend a new unit rather than quietly avoid one.
|
|
192
|
+
*
|
|
193
|
+
* Not idempotent, deliberately: two extension requests mean two extensions, and
|
|
194
|
+
* a client that wants exactly one should not send two.
|
|
195
|
+
* @summary Extend Loan
|
|
196
|
+
*/
|
|
197
|
+
const extendLoan = async (loanId, options) => {
|
|
198
|
+
return request(getExtendLoanUrl(loanId), {
|
|
199
|
+
...options,
|
|
200
|
+
method: "POST"
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
const getExtendLoanMutationKey = () => ["extendLoan"];
|
|
204
|
+
const getExtendLoanMutationOptions = (options) => {
|
|
205
|
+
const mutationKey = getExtendLoanMutationKey();
|
|
206
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
207
|
+
...options,
|
|
208
|
+
mutation: {
|
|
209
|
+
...options.mutation,
|
|
210
|
+
mutationKey
|
|
211
|
+
}
|
|
212
|
+
} : {
|
|
213
|
+
mutation: { mutationKey },
|
|
214
|
+
request: void 0
|
|
215
|
+
};
|
|
216
|
+
const mutationFn = (props) => {
|
|
217
|
+
const { loanId } = props ?? {};
|
|
218
|
+
return extendLoan(loanId, requestOptions);
|
|
219
|
+
};
|
|
220
|
+
return {
|
|
221
|
+
mutationFn,
|
|
222
|
+
...mutationOptions
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* @summary Extend Loan
|
|
227
|
+
*/
|
|
228
|
+
const useExtendLoan = (options, queryClient) => {
|
|
229
|
+
return useMutation(getExtendLoanMutationOptions(options), queryClient);
|
|
230
|
+
};
|
|
231
|
+
//#endregion
|
|
232
|
+
export { borrow, extendLoan, getBorrowMutationKey, getBorrowMutationOptions, getBorrowUrl, getExtendLoanMutationKey, getExtendLoanMutationOptions, getExtendLoanUrl, getListLoansQueryKey, getListLoansQueryOptions, getListLoansUrl, getReturnLoanMutationKey, getReturnLoanMutationOptions, getReturnLoanUrl, listLoans, returnLoan, useBorrow, useExtendLoan, useListLoans, useReturnLoan };
|
|
233
|
+
|
|
234
|
+
//# sourceMappingURL=cvs-loans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cvs-loans.js","names":[],"sources":["../../src/react/cvs-loans/cvs-loans.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n BorrowWrite,\n HTTPExceptionResponse,\n ListLoansParams,\n LoanPage,\n LoanRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListLoansUrl = (params?: ListLoansParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/cvs/loans?${stringifiedParams}` : `/cvs/loans`\n}\n\n/**\n * What this caller currently holds (and optionally what they have returned).\n *\n * Replaces ``/download/details``, which took a ``downloadid`` and answered about\n * one loan at a time — so a client rebuilding its shelf after reinstalling made\n * one request per title, and had no way to discover the ids in the first place.\n * @summary List Loans\n */\nexport const listLoans = async (params?: ListLoansParams, options?: Parameters<typeof request>[1]): Promise<LoanPage> => {\n\n return request<LoanPage>(getListLoansUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLoansQueryKey = (params?: ListLoansParams,) => {\n return [\n `/cvs/loans`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListLoansQueryOptions = <TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLoansQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLoans>>> = ({ signal }) => listLoans(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLoansQueryResult = NonNullable<Awaited<ReturnType<typeof listLoans>>>\nexport type ListLoansQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListLoansParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLoans>>,\n TError,\n Awaited<ReturnType<typeof listLoans>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLoans>>,\n TError,\n Awaited<ReturnType<typeof listLoans>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Loans\n */\n\nexport function useListLoans<TData = Awaited<ReturnType<typeof listLoans>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListLoansParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLoans>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLoansQueryOptions(params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getBorrowUrl = () => {\n\n\n\n\n return `/cvs/loans`\n}\n\n/**\n * Borrow a work.\n *\n * The order matters and is the whole point of the entitlement model:\n *\n * 1. **Entitled?** — is this act permitted on this work under a live contract.\n * 2. **A seat free?** — ``max_concurrent`` counted from unreturned loans.\n * 3. **Units left?** — reserved in Redis *before* the row is written, so a\n * refusal costs no database work.\n * 4. **Append.** The ledger row is the loan.\n *\n * Idempotent on ``request_key``: a retried borrow returns the loan the first\n * attempt created rather than taking a second copy of the same title.\n * @summary Borrow\n */\nexport const borrow = async (borrowWrite: BorrowWrite, options?: Parameters<typeof request>[1]): Promise<LoanRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<LoanRead>(getBorrowUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(borrowWrite)\n }\n);}\n\n\n\n\n\nexport const getBorrowMutationKey = () => ['borrow'] as const;\n\nexport const getBorrowMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError,BorrowMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError,BorrowMutationVariables, TContext> => {\n\nconst mutationKey = getBorrowMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof borrow>>, BorrowMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return borrow(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type BorrowMutationResult = NonNullable<Awaited<ReturnType<typeof borrow>>>\n export type BorrowMutationBody = BodyType<BorrowWrite>\n export type BorrowMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type BorrowMutationVariables = {data: BodyType<BorrowWrite>}\n\n /**\n * @summary Borrow\n */\nexport const useBorrow = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof borrow>>, TError,BorrowMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof borrow>>,\n TError,\n BorrowMutationVariables,\n TContext\n > => {\n return useMutation(getBorrowMutationOptions(options), queryClient);\n }\n export const getReturnLoanUrl = (loanId: number,) => {\n\n\n\n\n return `/cvs/loans/${loanId}`\n}\n\n/**\n * Give a loan back early, freeing its seat. Idempotent.\n *\n * Returning something already returned is ``204``: the caller wanted it back on\n * the shelf and it is on the shelf. The legacy answered an error, which meant a\n * retried return looked like a failure and clients stopped retrying.\n *\n * The unit stays spent — see the module docstring. Only the seat comes back.\n * @summary Return Loan\n */\nexport const returnLoan = async (loanId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getReturnLoanUrl(loanId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getReturnLoanMutationKey = () => ['returnLoan'] as const;\n\nexport const getReturnLoanMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError,ReturnLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError,ReturnLoanMutationVariables, TContext> => {\n\nconst mutationKey = getReturnLoanMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof returnLoan>>, ReturnLoanMutationVariables> = (props) => {\n const {loanId} = props ?? {};\n\n return returnLoan(loanId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ReturnLoanMutationResult = NonNullable<Awaited<ReturnType<typeof returnLoan>>>\n\n export type ReturnLoanMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ReturnLoanMutationVariables = {loanId: number}\n\n /**\n * @summary Return Loan\n */\nexport const useReturnLoan = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof returnLoan>>, TError,ReturnLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof returnLoan>>,\n TError,\n ReturnLoanMutationVariables,\n TContext\n > => {\n return useMutation(getReturnLoanMutationOptions(options), queryClient);\n }\n export const getExtendLoanUrl = (loanId: number,) => {\n\n\n\n\n return `/cvs/loans/${loanId}/extensions`\n}\n\n/**\n * Prolong a loan.\n *\n * Bounded by the grant's ``max_extensions`` — the legacy's ``nb_extend`` — and\n * refused once the loan has been returned or has lapsed. Extending something\n * that already expired is not an extension, it is a new loan, and it should\n * spend a new unit rather than quietly avoid one.\n *\n * Not idempotent, deliberately: two extension requests mean two extensions, and\n * a client that wants exactly one should not send two.\n * @summary Extend Loan\n */\nexport const extendLoan = async (loanId: number, options?: Parameters<typeof request>[1]): Promise<LoanRead> => {\n\n return request<LoanRead>(getExtendLoanUrl(loanId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n\n\n\nexport const getExtendLoanMutationKey = () => ['extendLoan'] as const;\n\nexport const getExtendLoanMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError,ExtendLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError,ExtendLoanMutationVariables, TContext> => {\n\nconst mutationKey = getExtendLoanMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof extendLoan>>, ExtendLoanMutationVariables> = (props) => {\n const {loanId} = props ?? {};\n\n return extendLoan(loanId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type ExtendLoanMutationResult = NonNullable<Awaited<ReturnType<typeof extendLoan>>>\n\n export type ExtendLoanMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type ExtendLoanMutationVariables = {loanId: number}\n\n /**\n * @summary Extend Loan\n */\nexport const useExtendLoan = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof extendLoan>>, TError,ExtendLoanMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof extendLoan>>,\n TError,\n ExtendLoanMutationVariables,\n TContext\n > => {\n return useMutation(getExtendLoanMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,S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Ac;CAC1C;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,iBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,6BAA6B,OAAO,GAAG,WAAW;AACvE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
import { Gn as HTTPExceptionResponse, I as StreamingStartQuery, L as StreamingSessionRead, t as ValidationErrorResponse } from "../index-wL_20vR8.js";
|
|
3
|
+
import { a as ErrorType, c as request, n as BodyType } from "../client-BDwBZYB0.js";
|
|
4
|
+
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/cvs-streaming/cvs-streaming.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getStartSessionUrl: () => string;
|
|
8
|
+
/**
|
|
9
|
+
* Begin playing a title. Returns the manifests and, if encrypted, a licence.
|
|
10
|
+
*
|
|
11
|
+
* ``409`` when every seat is taken, ``404`` when the caller is not entitled or
|
|
12
|
+
* the title has no video, ``503`` when the DRM broker cannot be reached.
|
|
13
|
+
*
|
|
14
|
+
* **404 and not 403 for an entitlement refusal**, consistently with the rest
|
|
15
|
+
* of the API: whether a particular library licensed a particular film is not
|
|
16
|
+
* something an unentitled caller gets to enumerate.
|
|
17
|
+
*
|
|
18
|
+
* **The seat is taken before the licence is minted.** A licence is a real cost
|
|
19
|
+
* with a third party and cannot be un-minted; a lease can be closed. So the
|
|
20
|
+
* order is entitle, seat, then mint — and a client that gets a 409 has cost
|
|
21
|
+
* the library nothing.
|
|
22
|
+
*
|
|
23
|
+
* Not idempotent on its own, but honours ``Idempotency-Key``: a retried start
|
|
24
|
+
* returns the lease the first attempt opened rather than taking a second seat.
|
|
25
|
+
* A licence is re-minted on the retry, which is correct — the first response
|
|
26
|
+
* may never have arrived, and a licence is cheap to replace while a seat is
|
|
27
|
+
* not.
|
|
28
|
+
* @summary Start Session
|
|
29
|
+
*/
|
|
30
|
+
export declare const startSession: (streamingStartQuery: StreamingStartQuery, options?: Parameters<typeof request>[1]) => Promise<StreamingSessionRead>;
|
|
31
|
+
export declare const getStartSessionMutationKey: () => readonly ['startSession'];
|
|
32
|
+
export declare const getStartSessionMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
33
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError, StartSessionMutationVariables, TContext>;
|
|
34
|
+
request?: SecondParameter<typeof request>;
|
|
35
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError, StartSessionMutationVariables, TContext>;
|
|
36
|
+
export type StartSessionMutationResult = NonNullable<Awaited<ReturnType<typeof startSession>>>;
|
|
37
|
+
export type StartSessionMutationBody = BodyType<StreamingStartQuery>;
|
|
38
|
+
export type StartSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
39
|
+
export type StartSessionMutationVariables = {
|
|
40
|
+
data: BodyType<StreamingStartQuery>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* @summary Start Session
|
|
44
|
+
*/
|
|
45
|
+
export declare const useStartSession: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
46
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError, StartSessionMutationVariables, TContext>;
|
|
47
|
+
request?: SecondParameter<typeof request>;
|
|
48
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof startSession>>, TError, StartSessionMutationVariables, TContext>;
|
|
49
|
+
export declare const getStreamingDetailsUrl: (docId: number) => string;
|
|
50
|
+
/**
|
|
51
|
+
* What a title needs in order to play, without starting anything.
|
|
52
|
+
*
|
|
53
|
+
* No lease, no licence, no unit — a client rendering a "play" button should not
|
|
54
|
+
* have to spend a view to find out whether the button should be enabled.
|
|
55
|
+
* ``404`` when there is no playable video.
|
|
56
|
+
* @summary Streaming Details
|
|
57
|
+
*/
|
|
58
|
+
export declare const streamingDetails: (docId: number, options?: Parameters<typeof request>[1]) => Promise<StreamingSessionRead>;
|
|
59
|
+
export declare const getStreamingDetailsQueryKey: (docId: number) => readonly [`/streaming/${number}/details`];
|
|
60
|
+
export declare const getStreamingDetailsQueryOptions: <TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: {
|
|
61
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>;
|
|
62
|
+
request?: SecondParameter<typeof request>;
|
|
63
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData> & {
|
|
64
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
65
|
+
};
|
|
66
|
+
export type StreamingDetailsQueryResult = NonNullable<Awaited<ReturnType<typeof streamingDetails>>>;
|
|
67
|
+
export type StreamingDetailsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
68
|
+
export declare function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options: {
|
|
69
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, Awaited<ReturnType<typeof streamingDetails>>>, 'initialData'>;
|
|
70
|
+
request?: SecondParameter<typeof request>;
|
|
71
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
72
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
73
|
+
};
|
|
74
|
+
export declare function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: {
|
|
75
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, Awaited<ReturnType<typeof streamingDetails>>>, 'initialData'>;
|
|
76
|
+
request?: SecondParameter<typeof request>;
|
|
77
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
78
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
79
|
+
};
|
|
80
|
+
export declare function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: {
|
|
81
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>;
|
|
82
|
+
request?: SecondParameter<typeof request>;
|
|
83
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
84
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
//# sourceMappingURL=cvs-streaming.d.ts.map
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/cvs-streaming/cvs-streaming.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const withQueryKey = (query, queryKey) => {
|
|
13
|
+
const result = { queryKey };
|
|
14
|
+
for (const key of Object.keys(query)) {
|
|
15
|
+
if (key === "queryKey") continue;
|
|
16
|
+
Object.defineProperty(result, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get: () => query[key]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const getStartSessionUrl = () => {
|
|
25
|
+
return `/streaming/sessions`;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Begin playing a title. Returns the manifests and, if encrypted, a licence.
|
|
29
|
+
*
|
|
30
|
+
* ``409`` when every seat is taken, ``404`` when the caller is not entitled or
|
|
31
|
+
* the title has no video, ``503`` when the DRM broker cannot be reached.
|
|
32
|
+
*
|
|
33
|
+
* **404 and not 403 for an entitlement refusal**, consistently with the rest
|
|
34
|
+
* of the API: whether a particular library licensed a particular film is not
|
|
35
|
+
* something an unentitled caller gets to enumerate.
|
|
36
|
+
*
|
|
37
|
+
* **The seat is taken before the licence is minted.** A licence is a real cost
|
|
38
|
+
* with a third party and cannot be un-minted; a lease can be closed. So the
|
|
39
|
+
* order is entitle, seat, then mint — and a client that gets a 409 has cost
|
|
40
|
+
* the library nothing.
|
|
41
|
+
*
|
|
42
|
+
* Not idempotent on its own, but honours ``Idempotency-Key``: a retried start
|
|
43
|
+
* returns the lease the first attempt opened rather than taking a second seat.
|
|
44
|
+
* A licence is re-minted on the retry, which is correct — the first response
|
|
45
|
+
* may never have arrived, and a licence is cheap to replace while a seat is
|
|
46
|
+
* not.
|
|
47
|
+
* @summary Start Session
|
|
48
|
+
*/
|
|
49
|
+
const startSession = async (streamingStartQuery, options) => {
|
|
50
|
+
const getHeaders = (h) => {
|
|
51
|
+
if (!h) return {};
|
|
52
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
53
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
54
|
+
const headers = {};
|
|
55
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
56
|
+
return headers;
|
|
57
|
+
};
|
|
58
|
+
return request(getStartSessionUrl(), {
|
|
59
|
+
...options,
|
|
60
|
+
method: "POST",
|
|
61
|
+
headers: {
|
|
62
|
+
"Content-Type": "application/json",
|
|
63
|
+
...getHeaders(options?.headers)
|
|
64
|
+
},
|
|
65
|
+
body: JSON.stringify(streamingStartQuery)
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const getStartSessionMutationKey = () => ["startSession"];
|
|
69
|
+
const getStartSessionMutationOptions = (options) => {
|
|
70
|
+
const mutationKey = getStartSessionMutationKey();
|
|
71
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
72
|
+
...options,
|
|
73
|
+
mutation: {
|
|
74
|
+
...options.mutation,
|
|
75
|
+
mutationKey
|
|
76
|
+
}
|
|
77
|
+
} : {
|
|
78
|
+
mutation: { mutationKey },
|
|
79
|
+
request: void 0
|
|
80
|
+
};
|
|
81
|
+
const mutationFn = (props) => {
|
|
82
|
+
const { data } = props ?? {};
|
|
83
|
+
return startSession(data, requestOptions);
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
mutationFn,
|
|
87
|
+
...mutationOptions
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* @summary Start Session
|
|
92
|
+
*/
|
|
93
|
+
const useStartSession = (options, queryClient) => {
|
|
94
|
+
return useMutation(getStartSessionMutationOptions(options), queryClient);
|
|
95
|
+
};
|
|
96
|
+
const getStreamingDetailsUrl = (docId) => {
|
|
97
|
+
return `/streaming/${docId}/details`;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* What a title needs in order to play, without starting anything.
|
|
101
|
+
*
|
|
102
|
+
* No lease, no licence, no unit — a client rendering a "play" button should not
|
|
103
|
+
* have to spend a view to find out whether the button should be enabled.
|
|
104
|
+
* ``404`` when there is no playable video.
|
|
105
|
+
* @summary Streaming Details
|
|
106
|
+
*/
|
|
107
|
+
const streamingDetails = async (docId, options) => {
|
|
108
|
+
return request(getStreamingDetailsUrl(docId), {
|
|
109
|
+
...options,
|
|
110
|
+
method: "GET"
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const getStreamingDetailsQueryKey = (docId) => {
|
|
114
|
+
return [`/streaming/${docId}/details`];
|
|
115
|
+
};
|
|
116
|
+
const getStreamingDetailsQueryOptions = (docId, options) => {
|
|
117
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
118
|
+
const queryKey = queryOptions?.queryKey ?? getStreamingDetailsQueryKey(docId);
|
|
119
|
+
const queryFn = ({ signal }) => streamingDetails(docId, {
|
|
120
|
+
signal,
|
|
121
|
+
...requestOptions
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
queryKey,
|
|
125
|
+
queryFn,
|
|
126
|
+
enabled: docId !== null && docId !== void 0,
|
|
127
|
+
...queryOptions
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* @summary Streaming Details
|
|
132
|
+
*/
|
|
133
|
+
function useStreamingDetails(docId, options, queryClient) {
|
|
134
|
+
const queryOptions = getStreamingDetailsQueryOptions(docId, options);
|
|
135
|
+
const query = useQuery(queryOptions, queryClient);
|
|
136
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { getStartSessionMutationKey, getStartSessionMutationOptions, getStartSessionUrl, getStreamingDetailsQueryKey, getStreamingDetailsQueryOptions, getStreamingDetailsUrl, startSession, streamingDetails, useStartSession, useStreamingDetails };
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=cvs-streaming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cvs-streaming.js","names":[],"sources":["../../src/react/cvs-streaming/cvs-streaming.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n StreamingSessionRead,\n StreamingStartQuery,\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 getStartSessionUrl = () => {\n\n\n\n\n return `/streaming/sessions`\n}\n\n/**\n * Begin playing a title. Returns the manifests and, if encrypted, a licence.\n *\n * ``409`` when every seat is taken, ``404`` when the caller is not entitled or\n * the title has no video, ``503`` when the DRM broker cannot be reached.\n *\n * **404 and not 403 for an entitlement refusal**, consistently with the rest\n * of the API: whether a particular library licensed a particular film is not\n * something an unentitled caller gets to enumerate.\n *\n * **The seat is taken before the licence is minted.** A licence is a real cost\n * with a third party and cannot be un-minted; a lease can be closed. So the\n * order is entitle, seat, then mint — and a client that gets a 409 has cost\n * the library nothing.\n *\n * Not idempotent on its own, but honours ``Idempotency-Key``: a retried start\n * returns the lease the first attempt opened rather than taking a second seat.\n * A licence is re-minted on the retry, which is correct — the first response\n * may never have arrived, and a licence is cheap to replace while a seat is\n * not.\n * @summary Start Session\n */\nexport const startSession = async (streamingStartQuery: StreamingStartQuery, options?: Parameters<typeof request>[1]): Promise<StreamingSessionRead> => {\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<StreamingSessionRead>(getStartSessionUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(streamingStartQuery)\n }\n);}\n\n\n\n\n\nexport const getStartSessionMutationKey = () => ['startSession'] as const;\n\nexport const getStartSessionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError,StartSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError,StartSessionMutationVariables, TContext> => {\n\nconst mutationKey = getStartSessionMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof startSession>>, StartSessionMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return startSession(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type StartSessionMutationResult = NonNullable<Awaited<ReturnType<typeof startSession>>>\n export type StartSessionMutationBody = BodyType<StreamingStartQuery>\n export type StartSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type StartSessionMutationVariables = {data: BodyType<StreamingStartQuery>}\n\n /**\n * @summary Start Session\n */\nexport const useStartSession = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startSession>>, TError,StartSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof startSession>>,\n TError,\n StartSessionMutationVariables,\n TContext\n > => {\n return useMutation(getStartSessionMutationOptions(options), queryClient);\n }\n export const getStreamingDetailsUrl = (docId: number,) => {\n\n\n\n\n return `/streaming/${docId}/details`\n}\n\n/**\n * What a title needs in order to play, without starting anything.\n *\n * No lease, no licence, no unit — a client rendering a \"play\" button should not\n * have to spend a view to find out whether the button should be enabled.\n * ``404`` when there is no playable video.\n * @summary Streaming Details\n */\nexport const streamingDetails = async (docId: number, options?: Parameters<typeof request>[1]): Promise<StreamingSessionRead> => {\n\n return request<StreamingSessionRead>(getStreamingDetailsUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getStreamingDetailsQueryKey = (docId: number,) => {\n return [\n `/streaming/${docId}/details`\n ] as const;\n }\n\n\nexport const getStreamingDetailsQueryOptions = <TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getStreamingDetailsQueryKey(docId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof streamingDetails>>> = ({ signal }) => streamingDetails(docId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: docId !== null && docId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type StreamingDetailsQueryResult = NonNullable<Awaited<ReturnType<typeof streamingDetails>>>\nexport type StreamingDetailsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof streamingDetails>>,\n TError,\n Awaited<ReturnType<typeof streamingDetails>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof streamingDetails>>,\n TError,\n Awaited<ReturnType<typeof streamingDetails>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Streaming Details\n */\n\nexport function useStreamingDetails<TData = Awaited<ReturnType<typeof streamingDetails>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n docId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof streamingDetails>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getStreamingDetailsQueryOptions(docId,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\n"],"mappings":";;;;;;;;;;;AAyCA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,2BAA2B;CAKtC,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,eAAe,OAAO,qBAA0C,YAA2E;CAEpJ,MAAM,cAAc,MAAwF;EAC5G,IAAI,CAAC,GAAG,OAAO,CAAC;EAChB,IAAI,aAAa,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;EAC/D,IAAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAA8B,mBAAmB,GACtD;EACE,GAAG;EACH,QAAQ;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