@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,106 @@
|
|
|
1
|
+
|
|
2
|
+
import { G as ReviewUpdateWrite, K as ReviewRead, M as SupplierGrantRead, Un as LastPositionWrite, ft as RatingUpdateWrite, hr as DocumentRead, mr as DocumentSearchWrite, vr as DocumentPage } from "../index-wL_20vR8.js";
|
|
3
|
+
import { c as request } from "../client-BDwBZYB0.js";
|
|
4
|
+
//#region src/api/cvs-documents/cvs-documents.d.ts
|
|
5
|
+
export declare const getSearchDocumentsUrl: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* Search the CVS catalogue.
|
|
8
|
+
*
|
|
9
|
+
* ``POST`` because the legacy put the query in the body and the mobile clients
|
|
10
|
+
* send it that way. It is a read, so it stays safe: nothing here writes.
|
|
11
|
+
*
|
|
12
|
+
* Same division as ``/search``: the index ranks, PostgreSQL authorises. An
|
|
13
|
+
* index outage degrades to no results rather than to an unfiltered catalogue.
|
|
14
|
+
* @summary Search Documents
|
|
15
|
+
*/
|
|
16
|
+
export declare const searchDocuments: (documentSearchWrite: DocumentSearchWrite, options?: Parameters<typeof request>[1]) => Promise<DocumentPage>;
|
|
17
|
+
export declare const getReadDocumentUrl: (docId: number) => string;
|
|
18
|
+
/**
|
|
19
|
+
* One work, if this caller's contract reaches it.
|
|
20
|
+
*
|
|
21
|
+
* Missing until now, which was an oversight rather than a decision: search,
|
|
22
|
+
* rating, review and position all existed and there was no way to fetch the
|
|
23
|
+
* thing they act on. The legacy has no equivalent either — the app assembles a
|
|
24
|
+
* document sheet from whatever the menu endpoint already returned, which is why
|
|
25
|
+
* a deep link into a title has never worked properly.
|
|
26
|
+
* @summary Read Document
|
|
27
|
+
*/
|
|
28
|
+
export declare const readDocument: (docId: number, options?: Parameters<typeof request>[1]) => Promise<DocumentRead>;
|
|
29
|
+
export declare const getOpenAtSupplierUrl: (docId: number) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Authorise this patron to open one title at the supplier hosting it.
|
|
32
|
+
*
|
|
33
|
+
* Replaces the legacy ``wstoken``: 4,878 lines dispatching on
|
|
34
|
+
* ``frn.plate_forme`` through 57 near-identical arms. The signing schemes
|
|
35
|
+
* reduce to eight (:class:`~app.models.enums.TokenFormula`) and the platform
|
|
36
|
+
* map to a table, so what is left here is the order of operations.
|
|
37
|
+
*
|
|
38
|
+
* **Entitle, seat, then sign** — the same order the streaming route uses, and
|
|
39
|
+
* for the same reason. A signature is cheap to produce and impossible to
|
|
40
|
+
* recall once it has left; a seat can be released. Signing first would mean a
|
|
41
|
+
* refused request had already handed a patron something that works.
|
|
42
|
+
*
|
|
43
|
+
* ``404`` when the caller is not entitled or the title does not exist — the
|
|
44
|
+
* two are deliberately indistinguishable, as everywhere else in this API.
|
|
45
|
+
* ``409`` when every seat is taken: the caller *is* entitled and should be
|
|
46
|
+
* offered "try later", not "buy a subscription". ``409`` too when the supplier
|
|
47
|
+
* sits on a platform nobody implemented — four do, and the legacy cannot serve
|
|
48
|
+
* them either, so the honest answer is that this title is not openable rather
|
|
49
|
+
* than a 500 from a missing branch.
|
|
50
|
+
*
|
|
51
|
+
* The returned token is for the *supplier*, not for us. See
|
|
52
|
+
* :class:`~app.datamodels.cvs.downloads.SupplierGrantRead`.
|
|
53
|
+
* @summary Open At Supplier
|
|
54
|
+
*/
|
|
55
|
+
export declare const openAtSupplier: (docId: number, options?: Parameters<typeof request>[1]) => Promise<SupplierGrantRead>;
|
|
56
|
+
export declare const getReadLastPositionUrl: (docId: number) => string;
|
|
57
|
+
/**
|
|
58
|
+
* Where this patron got to, or ``0`` if they have not started.
|
|
59
|
+
*
|
|
60
|
+
* New: the legacy has no way to read the position back, so a client that lost
|
|
61
|
+
* its local state could never resume. Absent means not started, which is why
|
|
62
|
+
* the row is not created on read.
|
|
63
|
+
* @summary Read Last Position
|
|
64
|
+
*/
|
|
65
|
+
export declare const readLastPosition: (docId: number, options?: Parameters<typeof request>[1]) => Promise<LastPositionWrite>;
|
|
66
|
+
export declare const getSetLastPositionUrl: (docId: number) => string;
|
|
67
|
+
/**
|
|
68
|
+
* Record where this patron got to.
|
|
69
|
+
*
|
|
70
|
+
* A write, and the legacy declares it ``GET`` with the position in the query
|
|
71
|
+
* string — which makes resuming a book a cacheable idempotent read that mutates
|
|
72
|
+
* state, and puts it outside the CSRF layer for free.
|
|
73
|
+
*
|
|
74
|
+
* Stored in :class:`~app.models.activity.ReadingPosition`, which the products
|
|
75
|
+
* share — CVS and the partner reader today — so a member who reads across them
|
|
76
|
+
* keeps their place in one shape.
|
|
77
|
+
* @summary Set Last Position
|
|
78
|
+
*/
|
|
79
|
+
export declare const setLastPosition: (docId: number, lastPositionWrite: LastPositionWrite, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
80
|
+
export declare const getRateDocumentUrl: (docId: number) => string;
|
|
81
|
+
/**
|
|
82
|
+
* Rate a document. Idempotent — rating again replaces the earlier score.
|
|
83
|
+
*
|
|
84
|
+
* ``PUT`` on the rating sub-resource rather than the legacy
|
|
85
|
+
* ``POST /document/rating/update`` with the id in the body: the identifier
|
|
86
|
+
* belongs in the path, and "update" in a path names an operation in a position
|
|
87
|
+
* reserved for a resource.
|
|
88
|
+
* @summary Rate Document
|
|
89
|
+
*/
|
|
90
|
+
export declare const rateDocument: (docId: number, ratingUpdateWrite: RatingUpdateWrite, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
91
|
+
export declare const getWriteReviewUrl: (docId: number) => string;
|
|
92
|
+
/**
|
|
93
|
+
* Write or replace this patron's review of a document.
|
|
94
|
+
*
|
|
95
|
+
* One review per person per document, so this is a ``PUT`` on a singular
|
|
96
|
+
* sub-resource rather than a ``POST`` to a collection. The legacy had two routes
|
|
97
|
+
* — with and without an ``avisId`` — for what is one row.
|
|
98
|
+
*
|
|
99
|
+
* Every write resets the review to unpublished. An edit after moderation is a
|
|
100
|
+
* new thing to moderate, and carrying the old approval forward is how an
|
|
101
|
+
* approved review becomes a different text.
|
|
102
|
+
* @summary Write Review
|
|
103
|
+
*/
|
|
104
|
+
export declare const writeReview: (docId: number, reviewUpdateWrite: ReviewUpdateWrite, options?: Parameters<typeof request>[1]) => Promise<ReviewRead>;
|
|
105
|
+
//#endregion
|
|
106
|
+
//# sourceMappingURL=cvs-documents.d.ts.map
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
//#region src/api/cvs-documents/cvs-documents.ts
|
|
4
|
+
const getSearchDocumentsUrl = () => {
|
|
5
|
+
return `/cvs/documents/search`;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Search the CVS catalogue.
|
|
9
|
+
*
|
|
10
|
+
* ``POST`` because the legacy put the query in the body and the mobile clients
|
|
11
|
+
* send it that way. It is a read, so it stays safe: nothing here writes.
|
|
12
|
+
*
|
|
13
|
+
* Same division as ``/search``: the index ranks, PostgreSQL authorises. An
|
|
14
|
+
* index outage degrades to no results rather than to an unfiltered catalogue.
|
|
15
|
+
* @summary Search Documents
|
|
16
|
+
*/
|
|
17
|
+
const searchDocuments = async (documentSearchWrite, options) => {
|
|
18
|
+
const getHeaders = (h) => {
|
|
19
|
+
if (!h) return {};
|
|
20
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
21
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
22
|
+
const headers = {};
|
|
23
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
24
|
+
return headers;
|
|
25
|
+
};
|
|
26
|
+
return request(getSearchDocumentsUrl(), {
|
|
27
|
+
...options,
|
|
28
|
+
method: "POST",
|
|
29
|
+
headers: {
|
|
30
|
+
"Content-Type": "application/json",
|
|
31
|
+
...getHeaders(options?.headers)
|
|
32
|
+
},
|
|
33
|
+
body: JSON.stringify(documentSearchWrite)
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const getReadDocumentUrl = (docId) => {
|
|
37
|
+
return `/cvs/documents/${docId}`;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* One work, if this caller's contract reaches it.
|
|
41
|
+
*
|
|
42
|
+
* Missing until now, which was an oversight rather than a decision: search,
|
|
43
|
+
* rating, review and position all existed and there was no way to fetch the
|
|
44
|
+
* thing they act on. The legacy has no equivalent either — the app assembles a
|
|
45
|
+
* document sheet from whatever the menu endpoint already returned, which is why
|
|
46
|
+
* a deep link into a title has never worked properly.
|
|
47
|
+
* @summary Read Document
|
|
48
|
+
*/
|
|
49
|
+
const readDocument = async (docId, options) => {
|
|
50
|
+
return request(getReadDocumentUrl(docId), {
|
|
51
|
+
...options,
|
|
52
|
+
method: "GET"
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const getOpenAtSupplierUrl = (docId) => {
|
|
56
|
+
return `/cvs/documents/${docId}/grant`;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Authorise this patron to open one title at the supplier hosting it.
|
|
60
|
+
*
|
|
61
|
+
* Replaces the legacy ``wstoken``: 4,878 lines dispatching on
|
|
62
|
+
* ``frn.plate_forme`` through 57 near-identical arms. The signing schemes
|
|
63
|
+
* reduce to eight (:class:`~app.models.enums.TokenFormula`) and the platform
|
|
64
|
+
* map to a table, so what is left here is the order of operations.
|
|
65
|
+
*
|
|
66
|
+
* **Entitle, seat, then sign** — the same order the streaming route uses, and
|
|
67
|
+
* for the same reason. A signature is cheap to produce and impossible to
|
|
68
|
+
* recall once it has left; a seat can be released. Signing first would mean a
|
|
69
|
+
* refused request had already handed a patron something that works.
|
|
70
|
+
*
|
|
71
|
+
* ``404`` when the caller is not entitled or the title does not exist — the
|
|
72
|
+
* two are deliberately indistinguishable, as everywhere else in this API.
|
|
73
|
+
* ``409`` when every seat is taken: the caller *is* entitled and should be
|
|
74
|
+
* offered "try later", not "buy a subscription". ``409`` too when the supplier
|
|
75
|
+
* sits on a platform nobody implemented — four do, and the legacy cannot serve
|
|
76
|
+
* them either, so the honest answer is that this title is not openable rather
|
|
77
|
+
* than a 500 from a missing branch.
|
|
78
|
+
*
|
|
79
|
+
* The returned token is for the *supplier*, not for us. See
|
|
80
|
+
* :class:`~app.datamodels.cvs.downloads.SupplierGrantRead`.
|
|
81
|
+
* @summary Open At Supplier
|
|
82
|
+
*/
|
|
83
|
+
const openAtSupplier = async (docId, options) => {
|
|
84
|
+
return request(getOpenAtSupplierUrl(docId), {
|
|
85
|
+
...options,
|
|
86
|
+
method: "POST"
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const getReadLastPositionUrl = (docId) => {
|
|
90
|
+
return `/cvs/documents/${docId}/position`;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Where this patron got to, or ``0`` if they have not started.
|
|
94
|
+
*
|
|
95
|
+
* New: the legacy has no way to read the position back, so a client that lost
|
|
96
|
+
* its local state could never resume. Absent means not started, which is why
|
|
97
|
+
* the row is not created on read.
|
|
98
|
+
* @summary Read Last Position
|
|
99
|
+
*/
|
|
100
|
+
const readLastPosition = async (docId, options) => {
|
|
101
|
+
return request(getReadLastPositionUrl(docId), {
|
|
102
|
+
...options,
|
|
103
|
+
method: "GET"
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const getSetLastPositionUrl = (docId) => {
|
|
107
|
+
return `/cvs/documents/${docId}/position`;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Record where this patron got to.
|
|
111
|
+
*
|
|
112
|
+
* A write, and the legacy declares it ``GET`` with the position in the query
|
|
113
|
+
* string — which makes resuming a book a cacheable idempotent read that mutates
|
|
114
|
+
* state, and puts it outside the CSRF layer for free.
|
|
115
|
+
*
|
|
116
|
+
* Stored in :class:`~app.models.activity.ReadingPosition`, which the products
|
|
117
|
+
* share — CVS and the partner reader today — so a member who reads across them
|
|
118
|
+
* keeps their place in one shape.
|
|
119
|
+
* @summary Set Last Position
|
|
120
|
+
*/
|
|
121
|
+
const setLastPosition = async (docId, lastPositionWrite, options) => {
|
|
122
|
+
const getHeaders = (h) => {
|
|
123
|
+
if (!h) return {};
|
|
124
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
125
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
126
|
+
const headers = {};
|
|
127
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
128
|
+
return headers;
|
|
129
|
+
};
|
|
130
|
+
return request(getSetLastPositionUrl(docId), {
|
|
131
|
+
...options,
|
|
132
|
+
method: "PUT",
|
|
133
|
+
headers: {
|
|
134
|
+
"Content-Type": "application/json",
|
|
135
|
+
...getHeaders(options?.headers)
|
|
136
|
+
},
|
|
137
|
+
body: JSON.stringify(lastPositionWrite)
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
const getRateDocumentUrl = (docId) => {
|
|
141
|
+
return `/cvs/documents/${docId}/rating`;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Rate a document. Idempotent — rating again replaces the earlier score.
|
|
145
|
+
*
|
|
146
|
+
* ``PUT`` on the rating sub-resource rather than the legacy
|
|
147
|
+
* ``POST /document/rating/update`` with the id in the body: the identifier
|
|
148
|
+
* belongs in the path, and "update" in a path names an operation in a position
|
|
149
|
+
* reserved for a resource.
|
|
150
|
+
* @summary Rate Document
|
|
151
|
+
*/
|
|
152
|
+
const rateDocument = async (docId, ratingUpdateWrite, options) => {
|
|
153
|
+
const getHeaders = (h) => {
|
|
154
|
+
if (!h) return {};
|
|
155
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
156
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
157
|
+
const headers = {};
|
|
158
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
159
|
+
return headers;
|
|
160
|
+
};
|
|
161
|
+
return request(getRateDocumentUrl(docId), {
|
|
162
|
+
...options,
|
|
163
|
+
method: "PUT",
|
|
164
|
+
headers: {
|
|
165
|
+
"Content-Type": "application/json",
|
|
166
|
+
...getHeaders(options?.headers)
|
|
167
|
+
},
|
|
168
|
+
body: JSON.stringify(ratingUpdateWrite)
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
const getWriteReviewUrl = (docId) => {
|
|
172
|
+
return `/cvs/documents/${docId}/review`;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Write or replace this patron's review of a document.
|
|
176
|
+
*
|
|
177
|
+
* One review per person per document, so this is a ``PUT`` on a singular
|
|
178
|
+
* sub-resource rather than a ``POST`` to a collection. The legacy had two routes
|
|
179
|
+
* — with and without an ``avisId`` — for what is one row.
|
|
180
|
+
*
|
|
181
|
+
* Every write resets the review to unpublished. An edit after moderation is a
|
|
182
|
+
* new thing to moderate, and carrying the old approval forward is how an
|
|
183
|
+
* approved review becomes a different text.
|
|
184
|
+
* @summary Write Review
|
|
185
|
+
*/
|
|
186
|
+
const writeReview = async (docId, reviewUpdateWrite, options) => {
|
|
187
|
+
const getHeaders = (h) => {
|
|
188
|
+
if (!h) return {};
|
|
189
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
190
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
191
|
+
const headers = {};
|
|
192
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
193
|
+
return headers;
|
|
194
|
+
};
|
|
195
|
+
return request(getWriteReviewUrl(docId), {
|
|
196
|
+
...options,
|
|
197
|
+
method: "PUT",
|
|
198
|
+
headers: {
|
|
199
|
+
"Content-Type": "application/json",
|
|
200
|
+
...getHeaders(options?.headers)
|
|
201
|
+
},
|
|
202
|
+
body: JSON.stringify(reviewUpdateWrite)
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
//#endregion
|
|
206
|
+
export { getOpenAtSupplierUrl, getRateDocumentUrl, getReadDocumentUrl, getReadLastPositionUrl, getSearchDocumentsUrl, getSetLastPositionUrl, getWriteReviewUrl, openAtSupplier, rateDocument, readDocument, readLastPosition, searchDocuments, setLastPosition, writeReview };
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=cvs-documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cvs-documents.js","names":[],"sources":["../../src/api/cvs-documents/cvs-documents.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport type {\n DocumentPage,\n DocumentRead,\n DocumentSearchWrite,\n LastPositionWrite,\n RatingUpdateWrite,\n ReviewRead,\n ReviewUpdateWrite,\n SupplierGrantRead\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getSearchDocumentsUrl = () => {\n\n\n\n\n return `/cvs/documents/search`\n}\n\n/**\n * Search the CVS catalogue.\n *\n * ``POST`` because the legacy put the query in the body and the mobile clients\n * send it that way. It is a read, so it stays safe: nothing here writes.\n *\n * Same division as ``/search``: the index ranks, PostgreSQL authorises. An\n * index outage degrades to no results rather than to an unfiltered catalogue.\n * @summary Search Documents\n */\nexport const searchDocuments = async (documentSearchWrite: DocumentSearchWrite, options?: Parameters<typeof request>[1]): Promise<DocumentPage> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<DocumentPage>(getSearchDocumentsUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(documentSearchWrite)\n }\n);}\n\n\nexport const getReadDocumentUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}`\n}\n\n/**\n * One work, if this caller's contract reaches it.\n *\n * Missing until now, which was an oversight rather than a decision: search,\n * rating, review and position all existed and there was no way to fetch the\n * thing they act on. The legacy has no equivalent either — the app assembles a\n * document sheet from whatever the menu endpoint already returned, which is why\n * a deep link into a title has never worked properly.\n * @summary Read Document\n */\nexport const readDocument = async (docId: number, options?: Parameters<typeof request>[1]): Promise<DocumentRead> => {\n\n return request<DocumentRead>(getReadDocumentUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getOpenAtSupplierUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/grant`\n}\n\n/**\n * Authorise this patron to open one title at the supplier hosting it.\n *\n * Replaces the legacy ``wstoken``: 4,878 lines dispatching on\n * ``frn.plate_forme`` through 57 near-identical arms. The signing schemes\n * reduce to eight (:class:`~app.models.enums.TokenFormula`) and the platform\n * map to a table, so what is left here is the order of operations.\n *\n * **Entitle, seat, then sign** — the same order the streaming route uses, and\n * for the same reason. A signature is cheap to produce and impossible to\n * recall once it has left; a seat can be released. Signing first would mean a\n * refused request had already handed a patron something that works.\n *\n * ``404`` when the caller is not entitled or the title does not exist — the\n * two are deliberately indistinguishable, as everywhere else in this API.\n * ``409`` when every seat is taken: the caller *is* entitled and should be\n * offered \"try later\", not \"buy a subscription\". ``409`` too when the supplier\n * sits on a platform nobody implemented — four do, and the legacy cannot serve\n * them either, so the honest answer is that this title is not openable rather\n * than a 500 from a missing branch.\n *\n * The returned token is for the *supplier*, not for us. See\n * :class:`~app.datamodels.cvs.downloads.SupplierGrantRead`.\n * @summary Open At Supplier\n */\nexport const openAtSupplier = async (docId: number, options?: Parameters<typeof request>[1]): Promise<SupplierGrantRead> => {\n\n return request<SupplierGrantRead>(getOpenAtSupplierUrl(docId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\nexport const getReadLastPositionUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/position`\n}\n\n/**\n * Where this patron got to, or ``0`` if they have not started.\n *\n * New: the legacy has no way to read the position back, so a client that lost\n * its local state could never resume. Absent means not started, which is why\n * the row is not created on read.\n * @summary Read Last Position\n */\nexport const readLastPosition = async (docId: number, options?: Parameters<typeof request>[1]): Promise<LastPositionWrite> => {\n\n return request<LastPositionWrite>(getReadLastPositionUrl(docId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getSetLastPositionUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/position`\n}\n\n/**\n * Record where this patron got to.\n *\n * A write, and the legacy declares it ``GET`` with the position in the query\n * string — which makes resuming a book a cacheable idempotent read that mutates\n * state, and puts it outside the CSRF layer for free.\n *\n * Stored in :class:`~app.models.activity.ReadingPosition`, which the products\n * share — CVS and the partner reader today — so a member who reads across them\n * keeps their place in one shape.\n * @summary Set Last Position\n */\nexport const setLastPosition = async (docId: number,\n lastPositionWrite: LastPositionWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getSetLastPositionUrl(docId),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(lastPositionWrite)\n }\n);}\n\n\nexport const getRateDocumentUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/rating`\n}\n\n/**\n * Rate a document. Idempotent — rating again replaces the earlier score.\n *\n * ``PUT`` on the rating sub-resource rather than the legacy\n * ``POST /document/rating/update`` with the id in the body: the identifier\n * belongs in the path, and \"update\" in a path names an operation in a position\n * reserved for a resource.\n * @summary Rate Document\n */\nexport const rateDocument = async (docId: number,\n ratingUpdateWrite: RatingUpdateWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getRateDocumentUrl(docId),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(ratingUpdateWrite)\n }\n);}\n\n\nexport const getWriteReviewUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/documents/${docId}/review`\n}\n\n/**\n * Write or replace this patron's review of a document.\n *\n * One review per person per document, so this is a ``PUT`` on a singular\n * sub-resource rather than a ``POST`` to a collection. The legacy had two routes\n * — with and without an ``avisId`` — for what is one row.\n *\n * Every write resets the review to unpublished. An edit after moderation is a\n * new thing to moderate, and carrying the old approval forward is how an\n * approved review becomes a different text.\n * @summary Write Review\n */\nexport const writeReview = async (docId: number,\n reviewUpdateWrite: ReviewUpdateWrite, options?: Parameters<typeof request>[1]): Promise<ReviewRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<ReviewRead>(getWriteReviewUrl(docId),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(reviewUpdateWrite)\n }\n);}\n\n\n"],"mappings":";;;AAoBA,MAAa,8BAA8B;CAKzC,OAAO;AACT;;;;;;;;;;;AAYA,MAAa,kBAAkB,OAAO,qBAA0C,YAAmE;CAE/I,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,QAAsB,sBAAsB,GACjD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,mBAAmB;CAC1C,CACF;AAAE;AAGF,MAAa,sBAAsB,UAAmB;CAKpD,OAAO,kBAAkB;AAC3B;;;;;;;;;;;AAYA,MAAa,eAAe,OAAO,OAAe,YAAmE;CAEnH,OAAO,QAAsB,mBAAmB,KAAK,GACrD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,wBAAwB,UAAmB;CAKtD,OAAO,kBAAkB,MAAM;AACjC;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,iBAAiB,OAAO,OAAe,YAAwE;CAE1H,OAAO,QAA2B,qBAAqB,KAAK,GAC5D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,0BAA0B,UAAmB;CAKxD,OAAO,kBAAkB,MAAM;AACjC;;;;;;;;;AAUA,MAAa,mBAAmB,OAAO,OAAe,YAAwE;CAE5H,OAAO,QAA2B,uBAAuB,KAAK,GAC9D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,yBAAyB,UAAmB;CAKvD,OAAO,kBAAkB,MAAM;AACjC;;;;;;;;;;;;;AAcA,MAAa,kBAAkB,OAAO,OAClC,mBAAsC,YAA2D;CAEjG,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,QAAc,sBAAsB,KAAK,GAC9C;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,iBAAiB;CACxC,CACF;AAAE;AAGF,MAAa,sBAAsB,UAAmB;CAKpD,OAAO,kBAAkB,MAAM;AACjC;;;;;;;;;;AAWA,MAAa,eAAe,OAAO,OAC/B,mBAAsC,YAA2D;CAEjG,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,QAAc,mBAAmB,KAAK,GAC3C;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,iBAAiB;CACxC,CACF;AAAE;AAGF,MAAa,qBAAqB,UAAmB;CAKnD,OAAO,kBAAkB,MAAM;AACjC;;;;;;;;;;;;;AAcA,MAAa,cAAc,OAAO,OAC9B,mBAAsC,YAAiE;CAEvG,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,QAAoB,kBAAkB,KAAK,GAChD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,iBAAiB;CACxC,CACF;AAAE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { rr as SelectionRead, tr as FavoriteListRead } from "../index-wL_20vR8.js";
|
|
3
|
+
import { c as request } from "../client-BDwBZYB0.js";
|
|
4
|
+
//#region src/api/cvs-favorites/cvs-favorites.d.ts
|
|
5
|
+
export declare const getListCvsFavoritesUrl: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* The caller's favourites.
|
|
8
|
+
*
|
|
9
|
+
* Entitlement-filtered. A title the library has stopped licensing stays in the
|
|
10
|
+
* list — removing it silently would lose the patron's own curation over a
|
|
11
|
+
* contract change they had nothing to do with — but it is not returned here,
|
|
12
|
+
* because a client cannot open it. When the licence comes back, so does the
|
|
13
|
+
* entry.
|
|
14
|
+
* @summary List Cvs Favorites
|
|
15
|
+
*/
|
|
16
|
+
export declare const listCvsFavorites: (options?: Parameters<typeof request>[1]) => Promise<FavoriteListRead>;
|
|
17
|
+
export declare const getRemoveCvsFavoriteUrl: (docId: number) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Remove a work from the caller's list. Idempotent.
|
|
20
|
+
*
|
|
21
|
+
* Scoped to ``kind = 8`` through the list lookup, so this can never delete a
|
|
22
|
+
* line out of the patron's loans or reservations — which live in the same two
|
|
23
|
+
* tables and would look identical to a query that only matched on
|
|
24
|
+
* ``(user_id, doc_id)``.
|
|
25
|
+
* @summary Remove Cvs Favorite
|
|
26
|
+
*/
|
|
27
|
+
export declare const removeCvsFavorite: (docId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
28
|
+
export declare const getAddCvsFavoriteUrl: (docId: number) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Add a work to the caller's list. Idempotent.
|
|
31
|
+
*
|
|
32
|
+
* ``PUT`` and ``DELETE`` on the item, rather than the legacy's single route
|
|
33
|
+
* answering both ``POST`` and ``DELETE`` on a path with a required
|
|
34
|
+
* ``{selectionId}`` its own handler declares optional.
|
|
35
|
+
*
|
|
36
|
+
* Not entitlement-gated. A patron may bookmark something their library has not
|
|
37
|
+
* licensed yet — that is a signal worth having, and it is what an acquisitions
|
|
38
|
+
* request is made of. Reaching the work is gated, at the point of reaching it.
|
|
39
|
+
* @summary Add Cvs Favorite
|
|
40
|
+
*/
|
|
41
|
+
export declare const addCvsFavorite: (docId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
42
|
+
export declare const getListSelectionsUrl: () => string;
|
|
43
|
+
/**
|
|
44
|
+
* Every list this patron holds, of every kind.
|
|
45
|
+
*
|
|
46
|
+
* Read-only and deliberately unfiltered: a client showing "my loans" and "my
|
|
47
|
+
* list" side by side needs to know which is which, and hiding the ILS-mirrored
|
|
48
|
+
* kinds would only make it guess.
|
|
49
|
+
* @summary List Selections
|
|
50
|
+
*/
|
|
51
|
+
export declare const listSelections: (options?: Parameters<typeof request>[1]) => Promise<SelectionRead[]>;
|
|
52
|
+
//#endregion
|
|
53
|
+
//# sourceMappingURL=cvs-favorites.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
//#region src/api/cvs-favorites/cvs-favorites.ts
|
|
4
|
+
const getListCvsFavoritesUrl = () => {
|
|
5
|
+
return `/cvs/favorites`;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The caller's favourites.
|
|
9
|
+
*
|
|
10
|
+
* Entitlement-filtered. A title the library has stopped licensing stays in the
|
|
11
|
+
* list — removing it silently would lose the patron's own curation over a
|
|
12
|
+
* contract change they had nothing to do with — but it is not returned here,
|
|
13
|
+
* because a client cannot open it. When the licence comes back, so does the
|
|
14
|
+
* entry.
|
|
15
|
+
* @summary List Cvs Favorites
|
|
16
|
+
*/
|
|
17
|
+
const listCvsFavorites = async (options) => {
|
|
18
|
+
return request(getListCvsFavoritesUrl(), {
|
|
19
|
+
...options,
|
|
20
|
+
method: "GET"
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const getRemoveCvsFavoriteUrl = (docId) => {
|
|
24
|
+
return `/cvs/favorites/${docId}`;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Remove a work from the caller's list. Idempotent.
|
|
28
|
+
*
|
|
29
|
+
* Scoped to ``kind = 8`` through the list lookup, so this can never delete a
|
|
30
|
+
* line out of the patron's loans or reservations — which live in the same two
|
|
31
|
+
* tables and would look identical to a query that only matched on
|
|
32
|
+
* ``(user_id, doc_id)``.
|
|
33
|
+
* @summary Remove Cvs Favorite
|
|
34
|
+
*/
|
|
35
|
+
const removeCvsFavorite = async (docId, options) => {
|
|
36
|
+
return request(getRemoveCvsFavoriteUrl(docId), {
|
|
37
|
+
...options,
|
|
38
|
+
method: "DELETE"
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const getAddCvsFavoriteUrl = (docId) => {
|
|
42
|
+
return `/cvs/favorites/${docId}`;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Add a work to the caller's list. Idempotent.
|
|
46
|
+
*
|
|
47
|
+
* ``PUT`` and ``DELETE`` on the item, rather than the legacy's single route
|
|
48
|
+
* answering both ``POST`` and ``DELETE`` on a path with a required
|
|
49
|
+
* ``{selectionId}`` its own handler declares optional.
|
|
50
|
+
*
|
|
51
|
+
* Not entitlement-gated. A patron may bookmark something their library has not
|
|
52
|
+
* licensed yet — that is a signal worth having, and it is what an acquisitions
|
|
53
|
+
* request is made of. Reaching the work is gated, at the point of reaching it.
|
|
54
|
+
* @summary Add Cvs Favorite
|
|
55
|
+
*/
|
|
56
|
+
const addCvsFavorite = async (docId, options) => {
|
|
57
|
+
return request(getAddCvsFavoriteUrl(docId), {
|
|
58
|
+
...options,
|
|
59
|
+
method: "PUT"
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const getListSelectionsUrl = () => {
|
|
63
|
+
return `/cvs/lists`;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Every list this patron holds, of every kind.
|
|
67
|
+
*
|
|
68
|
+
* Read-only and deliberately unfiltered: a client showing "my loans" and "my
|
|
69
|
+
* list" side by side needs to know which is which, and hiding the ILS-mirrored
|
|
70
|
+
* kinds would only make it guess.
|
|
71
|
+
* @summary List Selections
|
|
72
|
+
*/
|
|
73
|
+
const listSelections = async (options) => {
|
|
74
|
+
return request(getListSelectionsUrl(), {
|
|
75
|
+
...options,
|
|
76
|
+
method: "GET"
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { addCvsFavorite, getAddCvsFavoriteUrl, getListCvsFavoritesUrl, getListSelectionsUrl, getRemoveCvsFavoriteUrl, listCvsFavorites, listSelections, removeCvsFavorite };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=cvs-favorites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cvs-favorites.js","names":[],"sources":["../../src/api/cvs-favorites/cvs-favorites.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport type {\n FavoriteListRead,\n SelectionRead\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getListCvsFavoritesUrl = () => {\n\n\n\n\n return `/cvs/favorites`\n}\n\n/**\n * The caller's favourites.\n *\n * Entitlement-filtered. A title the library has stopped licensing stays in the\n * list — removing it silently would lose the patron's own curation over a\n * contract change they had nothing to do with — but it is not returned here,\n * because a client cannot open it. When the licence comes back, so does the\n * entry.\n * @summary List Cvs Favorites\n */\nexport const listCvsFavorites = async ( options?: Parameters<typeof request>[1]): Promise<FavoriteListRead> => {\n\n return request<FavoriteListRead>(getListCvsFavoritesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getRemoveCvsFavoriteUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/favorites/${docId}`\n}\n\n/**\n * Remove a work from the caller's list. Idempotent.\n *\n * Scoped to ``kind = 8`` through the list lookup, so this can never delete a\n * line out of the patron's loans or reservations — which live in the same two\n * tables and would look identical to a query that only matched on\n * ``(user_id, doc_id)``.\n * @summary Remove Cvs Favorite\n */\nexport const removeCvsFavorite = async (docId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getRemoveCvsFavoriteUrl(docId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\nexport const getAddCvsFavoriteUrl = (docId: number,) => {\n\n\n\n\n return `/cvs/favorites/${docId}`\n}\n\n/**\n * Add a work to the caller's list. Idempotent.\n *\n * ``PUT`` and ``DELETE`` on the item, rather than the legacy's single route\n * answering both ``POST`` and ``DELETE`` on a path with a required\n * ``{selectionId}`` its own handler declares optional.\n *\n * Not entitlement-gated. A patron may bookmark something their library has not\n * licensed yet — that is a signal worth having, and it is what an acquisitions\n * request is made of. Reaching the work is gated, at the point of reaching it.\n * @summary Add Cvs Favorite\n */\nexport const addCvsFavorite = async (docId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getAddCvsFavoriteUrl(docId),\n {\n ...options,\n method: 'PUT'\n\n\n }\n);}\n\n\nexport const getListSelectionsUrl = () => {\n\n\n\n\n return `/cvs/lists`\n}\n\n/**\n * Every list this patron holds, of every kind.\n *\n * Read-only and deliberately unfiltered: a client showing \"my loans\" and \"my\n * list\" side by side needs to know which is which, and hiding the ILS-mirrored\n * kinds would only make it guess.\n * @summary List Selections\n */\nexport const listSelections = async ( options?: Parameters<typeof request>[1]): Promise<SelectionRead[]> => {\n\n return request<SelectionRead[]>(getListSelectionsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n"],"mappings":";;;AAcA,MAAa,+BAA+B;CAK1C,OAAO;AACT;;;;;;;;;;;AAYA,MAAa,mBAAmB,OAAQ,YAAuE;CAE7G,OAAO,QAA0B,uBAAuB,GACxD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,2BAA2B,UAAmB;CAKzD,OAAO,kBAAkB;AAC3B;;;;;;;;;;AAWA,MAAa,oBAAoB,OAAO,OAAe,YAA2D;CAEhH,OAAO,QAAc,wBAAwB,KAAK,GAClD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,wBAAwB,UAAmB;CAKtD,OAAO,kBAAkB;AAC3B;;;;;;;;;;;;;AAcA,MAAa,iBAAiB,OAAO,OAAe,YAA2D;CAE7G,OAAO,QAAc,qBAAqB,KAAK,GAC/C;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,6BAA6B;CAKxC,OAAO;AACT;;;;;;;;;AAUA,MAAa,iBAAiB,OAAQ,YAAsE;CAE1G,OAAO,QAAyB,qBAAqB,GACrD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
import { Ur as BorrowWrite, nn as LoanPage, rn as LoanRead, yn as ListLoansParams } from "../index-wL_20vR8.js";
|
|
3
|
+
import { c as request } from "../client-BDwBZYB0.js";
|
|
4
|
+
//#region src/api/cvs-loans/cvs-loans.d.ts
|
|
5
|
+
export declare const getListLoansUrl: (params?: ListLoansParams) => string;
|
|
6
|
+
/**
|
|
7
|
+
* What this caller currently holds (and optionally what they have returned).
|
|
8
|
+
*
|
|
9
|
+
* Replaces ``/download/details``, which took a ``downloadid`` and answered about
|
|
10
|
+
* one loan at a time — so a client rebuilding its shelf after reinstalling made
|
|
11
|
+
* one request per title, and had no way to discover the ids in the first place.
|
|
12
|
+
* @summary List Loans
|
|
13
|
+
*/
|
|
14
|
+
export declare const listLoans: (params?: ListLoansParams, options?: Parameters<typeof request>[1]) => Promise<LoanPage>;
|
|
15
|
+
export declare const getBorrowUrl: () => string;
|
|
16
|
+
/**
|
|
17
|
+
* Borrow a work.
|
|
18
|
+
*
|
|
19
|
+
* The order matters and is the whole point of the entitlement model:
|
|
20
|
+
*
|
|
21
|
+
* 1. **Entitled?** — is this act permitted on this work under a live contract.
|
|
22
|
+
* 2. **A seat free?** — ``max_concurrent`` counted from unreturned loans.
|
|
23
|
+
* 3. **Units left?** — reserved in Redis *before* the row is written, so a
|
|
24
|
+
* refusal costs no database work.
|
|
25
|
+
* 4. **Append.** The ledger row is the loan.
|
|
26
|
+
*
|
|
27
|
+
* Idempotent on ``request_key``: a retried borrow returns the loan the first
|
|
28
|
+
* attempt created rather than taking a second copy of the same title.
|
|
29
|
+
* @summary Borrow
|
|
30
|
+
*/
|
|
31
|
+
export declare const borrow: (borrowWrite: BorrowWrite, options?: Parameters<typeof request>[1]) => Promise<LoanRead>;
|
|
32
|
+
export declare const getReturnLoanUrl: (loanId: number) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Give a loan back early, freeing its seat. Idempotent.
|
|
35
|
+
*
|
|
36
|
+
* Returning something already returned is ``204``: the caller wanted it back on
|
|
37
|
+
* the shelf and it is on the shelf. The legacy answered an error, which meant a
|
|
38
|
+
* retried return looked like a failure and clients stopped retrying.
|
|
39
|
+
*
|
|
40
|
+
* The unit stays spent — see the module docstring. Only the seat comes back.
|
|
41
|
+
* @summary Return Loan
|
|
42
|
+
*/
|
|
43
|
+
export declare const returnLoan: (loanId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
44
|
+
export declare const getExtendLoanUrl: (loanId: number) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Prolong a loan.
|
|
47
|
+
*
|
|
48
|
+
* Bounded by the grant's ``max_extensions`` — the legacy's ``nb_extend`` — and
|
|
49
|
+
* refused once the loan has been returned or has lapsed. Extending something
|
|
50
|
+
* that already expired is not an extension, it is a new loan, and it should
|
|
51
|
+
* spend a new unit rather than quietly avoid one.
|
|
52
|
+
*
|
|
53
|
+
* Not idempotent, deliberately: two extension requests mean two extensions, and
|
|
54
|
+
* a client that wants exactly one should not send two.
|
|
55
|
+
* @summary Extend Loan
|
|
56
|
+
*/
|
|
57
|
+
export declare const extendLoan: (loanId: number, options?: Parameters<typeof request>[1]) => Promise<LoanRead>;
|
|
58
|
+
//#endregion
|
|
59
|
+
//# sourceMappingURL=cvs-loans.d.ts.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
//#region src/api/cvs-loans/cvs-loans.ts
|
|
4
|
+
const getListLoansUrl = (params) => {
|
|
5
|
+
const normalizedParams = new URLSearchParams();
|
|
6
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
7
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
8
|
+
});
|
|
9
|
+
const stringifiedParams = normalizedParams.toString();
|
|
10
|
+
return stringifiedParams.length > 0 ? `/cvs/loans?${stringifiedParams}` : `/cvs/loans`;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* What this caller currently holds (and optionally what they have returned).
|
|
14
|
+
*
|
|
15
|
+
* Replaces ``/download/details``, which took a ``downloadid`` and answered about
|
|
16
|
+
* one loan at a time — so a client rebuilding its shelf after reinstalling made
|
|
17
|
+
* one request per title, and had no way to discover the ids in the first place.
|
|
18
|
+
* @summary List Loans
|
|
19
|
+
*/
|
|
20
|
+
const listLoans = async (params, options) => {
|
|
21
|
+
return request(getListLoansUrl(params), {
|
|
22
|
+
...options,
|
|
23
|
+
method: "GET"
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const getBorrowUrl = () => {
|
|
27
|
+
return `/cvs/loans`;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Borrow a work.
|
|
31
|
+
*
|
|
32
|
+
* The order matters and is the whole point of the entitlement model:
|
|
33
|
+
*
|
|
34
|
+
* 1. **Entitled?** — is this act permitted on this work under a live contract.
|
|
35
|
+
* 2. **A seat free?** — ``max_concurrent`` counted from unreturned loans.
|
|
36
|
+
* 3. **Units left?** — reserved in Redis *before* the row is written, so a
|
|
37
|
+
* refusal costs no database work.
|
|
38
|
+
* 4. **Append.** The ledger row is the loan.
|
|
39
|
+
*
|
|
40
|
+
* Idempotent on ``request_key``: a retried borrow returns the loan the first
|
|
41
|
+
* attempt created rather than taking a second copy of the same title.
|
|
42
|
+
* @summary Borrow
|
|
43
|
+
*/
|
|
44
|
+
const borrow = async (borrowWrite, options) => {
|
|
45
|
+
const getHeaders = (h) => {
|
|
46
|
+
if (!h) return {};
|
|
47
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
48
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
49
|
+
const headers = {};
|
|
50
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
51
|
+
return headers;
|
|
52
|
+
};
|
|
53
|
+
return request(getBorrowUrl(), {
|
|
54
|
+
...options,
|
|
55
|
+
method: "POST",
|
|
56
|
+
headers: {
|
|
57
|
+
"Content-Type": "application/json",
|
|
58
|
+
...getHeaders(options?.headers)
|
|
59
|
+
},
|
|
60
|
+
body: JSON.stringify(borrowWrite)
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const getReturnLoanUrl = (loanId) => {
|
|
64
|
+
return `/cvs/loans/${loanId}`;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Give a loan back early, freeing its seat. Idempotent.
|
|
68
|
+
*
|
|
69
|
+
* Returning something already returned is ``204``: the caller wanted it back on
|
|
70
|
+
* the shelf and it is on the shelf. The legacy answered an error, which meant a
|
|
71
|
+
* retried return looked like a failure and clients stopped retrying.
|
|
72
|
+
*
|
|
73
|
+
* The unit stays spent — see the module docstring. Only the seat comes back.
|
|
74
|
+
* @summary Return Loan
|
|
75
|
+
*/
|
|
76
|
+
const returnLoan = async (loanId, options) => {
|
|
77
|
+
return request(getReturnLoanUrl(loanId), {
|
|
78
|
+
...options,
|
|
79
|
+
method: "DELETE"
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const getExtendLoanUrl = (loanId) => {
|
|
83
|
+
return `/cvs/loans/${loanId}/extensions`;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Prolong a loan.
|
|
87
|
+
*
|
|
88
|
+
* Bounded by the grant's ``max_extensions`` — the legacy's ``nb_extend`` — and
|
|
89
|
+
* refused once the loan has been returned or has lapsed. Extending something
|
|
90
|
+
* that already expired is not an extension, it is a new loan, and it should
|
|
91
|
+
* spend a new unit rather than quietly avoid one.
|
|
92
|
+
*
|
|
93
|
+
* Not idempotent, deliberately: two extension requests mean two extensions, and
|
|
94
|
+
* a client that wants exactly one should not send two.
|
|
95
|
+
* @summary Extend Loan
|
|
96
|
+
*/
|
|
97
|
+
const extendLoan = async (loanId, options) => {
|
|
98
|
+
return request(getExtendLoanUrl(loanId), {
|
|
99
|
+
...options,
|
|
100
|
+
method: "POST"
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { borrow, extendLoan, getBorrowUrl, getExtendLoanUrl, getListLoansUrl, getReturnLoanUrl, listLoans, returnLoan };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=cvs-loans.js.map
|