@learnorama/mozaik-sdk 0.1.0 → 0.5.0-staging.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -5
- package/dist/api/account.d.ts +2 -2
- package/dist/api/account.js +1 -1
- package/dist/api/account.js.map +1 -1
- package/dist/api/admin-catalogue.d.ts +2 -2
- package/dist/api/admin-catalogue.js +1 -1
- package/dist/api/admin-catalogue.js.map +1 -1
- package/dist/api/admin-consumption.d.ts +7 -2
- package/dist/api/admin-consumption.js +6 -1
- package/dist/api/admin-consumption.js.map +1 -1
- package/dist/api/admin-licenses.d.ts +2 -2
- package/dist/api/admin-licenses.js +1 -1
- package/dist/api/admin-licenses.js.map +1 -1
- package/dist/api/admin-patrons.d.ts +3 -3
- package/dist/api/admin-patrons.js +2 -2
- package/dist/api/admin-patrons.js.map +1 -1
- package/dist/api/admin-reviews.d.ts +2 -2
- package/dist/api/admin-reviews.js +1 -1
- package/dist/api/admin-reviews.js.map +1 -1
- package/dist/api/admin-roles.d.ts +3 -3
- package/dist/api/admin-roles.js +2 -2
- package/dist/api/admin-roles.js.map +1 -1
- package/dist/api/admin-support.d.ts +2 -2
- package/dist/api/admin-support.js +1 -1
- package/dist/api/admin-support.js.map +1 -1
- package/dist/api/admin-tenants.d.ts +14 -2
- package/dist/api/admin-tenants.js +38 -2
- package/dist/api/admin-tenants.js.map +1 -1
- package/dist/api/admin-tutoring.d.ts +2 -2
- package/dist/api/admin-tutoring.js +1 -1
- package/dist/api/admin-tutoring.js.map +1 -1
- package/dist/api/auth.d.ts +2 -2
- package/dist/api/auth.js +1 -1
- package/dist/api/auth.js.map +1 -1
- package/dist/api/biblio-catalogue.d.ts +2 -2
- package/dist/api/biblio-catalogue.js +1 -1
- package/dist/api/biblio-catalogue.js.map +1 -1
- package/dist/api/biblio-home.d.ts +2 -2
- package/dist/api/biblio-home.js +1 -1
- package/dist/api/biblio-home.js.map +1 -1
- package/dist/api/biblio-library.d.ts +2 -2
- package/dist/api/biblio-library.js +1 -1
- package/dist/api/biblio-library.js.map +1 -1
- package/dist/api/biblio-nextory.d.ts +2 -2
- package/dist/api/biblio-nextory.js +1 -1
- package/dist/api/biblio-nextory.js.map +1 -1
- package/dist/api/biblio-press.d.ts +2 -2
- package/dist/api/biblio-press.js +1 -1
- package/dist/api/biblio-press.js.map +1 -1
- package/dist/api/biblio-search.d.ts +2 -2
- package/dist/api/biblio-search.js +1 -1
- package/dist/api/biblio-search.js.map +1 -1
- package/dist/api/biblio-telemetry.d.ts +2 -2
- package/dist/api/biblio-telemetry.js +1 -1
- package/dist/api/biblio-telemetry.js.map +1 -1
- package/dist/api/consumption.d.ts +2 -2
- package/dist/api/consumption.js +1 -1
- package/dist/api/consumption.js.map +1 -1
- package/dist/api/cvs-app.d.ts +2 -2
- package/dist/api/cvs-app.js +1 -1
- package/dist/api/cvs-app.js.map +1 -1
- package/dist/api/cvs-documents.d.ts +16 -4
- package/dist/api/cvs-documents.js +22 -5
- package/dist/api/cvs-documents.js.map +1 -1
- package/dist/api/cvs-favorites.d.ts +2 -2
- package/dist/api/cvs-favorites.js +1 -1
- package/dist/api/cvs-favorites.js.map +1 -1
- package/dist/api/cvs-ils.d.ts +167 -0
- package/dist/api/cvs-ils.js +362 -0
- package/dist/api/cvs-ils.js.map +1 -0
- package/dist/api/cvs-loans.d.ts +2 -2
- package/dist/api/cvs-loans.js +1 -1
- package/dist/api/cvs-loans.js.map +1 -1
- package/dist/api/cvs-payments.d.ts +49 -0
- package/dist/api/cvs-payments.js +84 -0
- package/dist/api/cvs-payments.js.map +1 -0
- package/dist/api/cvs-streaming.d.ts +2 -2
- package/dist/api/cvs-streaming.js +1 -1
- package/dist/api/cvs-streaming.js.map +1 -1
- package/dist/api/index.d.ts +5 -2
- package/dist/api/index.js +7 -4
- package/dist/api/partner-catalogue.d.ts +2 -2
- package/dist/api/partner-catalogue.js +1 -1
- package/dist/api/partner-catalogue.js.map +1 -1
- package/dist/api/partner-reader.d.ts +2 -2
- package/dist/api/partner-reader.js +1 -1
- package/dist/api/partner-reader.js.map +1 -1
- package/dist/api/profiles.d.ts +2 -2
- package/dist/api/profiles.js +1 -1
- package/dist/api/profiles.js.map +1 -1
- package/dist/api/search.d.ts +18 -0
- package/dist/api/search.js +37 -0
- package/dist/api/search.js.map +1 -0
- package/dist/api/tutoring-catalogue.d.ts +2 -2
- package/dist/api/tutoring-catalogue.js +1 -1
- package/dist/api/tutoring-catalogue.js.map +1 -1
- package/dist/api/tutoring-chat.d.ts +2 -2
- package/dist/api/tutoring-chat.js +1 -1
- package/dist/api/tutoring-chat.js.map +1 -1
- package/dist/api/tutoring-dispatch.d.ts +2 -2
- package/dist/api/tutoring-dispatch.js +1 -1
- package/dist/api/tutoring-dispatch.js.map +1 -1
- package/dist/api/tutoring-practitioner.d.ts +2 -2
- package/dist/api/tutoring-practitioner.js +1 -1
- package/dist/api/tutoring-practitioner.js.map +1 -1
- package/dist/api/tutoring-requests.d.ts +2 -2
- package/dist/api/tutoring-requests.js +1 -1
- package/dist/api/tutoring-requests.js.map +1 -1
- package/dist/auth.d.ts +10 -0
- package/dist/auth.js +451 -0
- package/dist/auth.js.map +1 -0
- package/dist/chat.d.ts +3 -0
- package/dist/chat.js +3 -0
- package/dist/{client-BDwBZYB0.d.ts → chunks/client.d.ts} +1 -1
- package/dist/{client-D3kMOcIr.js → chunks/client.js} +1 -1
- package/dist/chunks/client.js.map +1 -0
- package/dist/chunks/client2.d.ts +53 -0
- package/dist/chunks/connection.d.ts +28 -0
- package/dist/chunks/connection.js +141 -0
- package/dist/chunks/connection.js.map +1 -0
- package/dist/{index-wL_20vR8.d.ts → chunks/index.d.ts} +922 -128
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +2 -2
- package/dist/models.js +44 -1
- package/dist/models.js.map +1 -1
- package/dist/react/account.d.ts +2 -2
- package/dist/react/account.js +2 -2
- package/dist/react/account.js.map +1 -1
- package/dist/react/admin-catalogue.d.ts +2 -2
- package/dist/react/admin-catalogue.js +2 -2
- package/dist/react/admin-catalogue.js.map +1 -1
- package/dist/react/admin-consumption.d.ts +7 -2
- package/dist/react/admin-consumption.js +7 -2
- package/dist/react/admin-consumption.js.map +1 -1
- package/dist/react/admin-licenses.d.ts +2 -2
- package/dist/react/admin-licenses.js +2 -2
- package/dist/react/admin-licenses.js.map +1 -1
- package/dist/react/admin-patrons.d.ts +3 -3
- package/dist/react/admin-patrons.js +3 -3
- package/dist/react/admin-patrons.js.map +1 -1
- package/dist/react/admin-reviews.d.ts +2 -2
- package/dist/react/admin-reviews.js +2 -2
- package/dist/react/admin-reviews.js.map +1 -1
- package/dist/react/admin-roles.d.ts +3 -3
- package/dist/react/admin-roles.js +3 -3
- package/dist/react/admin-roles.js.map +1 -1
- package/dist/react/admin-support.d.ts +2 -2
- package/dist/react/admin-support.js +2 -2
- package/dist/react/admin-support.js.map +1 -1
- package/dist/react/admin-tenants.d.ts +68 -2
- package/dist/react/admin-tenants.js +87 -3
- package/dist/react/admin-tenants.js.map +1 -1
- package/dist/react/admin-tutoring.d.ts +2 -2
- package/dist/react/admin-tutoring.js +2 -2
- package/dist/react/admin-tutoring.js.map +1 -1
- package/dist/react/auth.d.ts +2 -2
- package/dist/react/auth.js +2 -2
- package/dist/react/auth.js.map +1 -1
- package/dist/react/biblio-catalogue.d.ts +2 -2
- package/dist/react/biblio-catalogue.js +2 -2
- package/dist/react/biblio-catalogue.js.map +1 -1
- package/dist/react/biblio-home.d.ts +2 -2
- package/dist/react/biblio-home.js +2 -2
- package/dist/react/biblio-home.js.map +1 -1
- package/dist/react/biblio-library.d.ts +2 -2
- package/dist/react/biblio-library.js +2 -2
- package/dist/react/biblio-library.js.map +1 -1
- package/dist/react/biblio-nextory.d.ts +2 -2
- package/dist/react/biblio-nextory.js +2 -2
- package/dist/react/biblio-nextory.js.map +1 -1
- package/dist/react/biblio-press.d.ts +2 -2
- package/dist/react/biblio-press.js +2 -2
- package/dist/react/biblio-press.js.map +1 -1
- package/dist/react/biblio-search.d.ts +2 -2
- package/dist/react/biblio-search.js +2 -2
- package/dist/react/biblio-search.js.map +1 -1
- package/dist/react/biblio-telemetry.d.ts +2 -2
- package/dist/react/biblio-telemetry.js +2 -2
- package/dist/react/biblio-telemetry.js.map +1 -1
- package/dist/react/chat.d.ts +36 -0
- package/dist/react/chat.js +234 -0
- package/dist/react/chat.js.map +1 -0
- package/dist/react/consumption.d.ts +2 -2
- package/dist/react/consumption.js +2 -2
- package/dist/react/consumption.js.map +1 -1
- package/dist/react/cvs-app.d.ts +2 -2
- package/dist/react/cvs-app.js +2 -2
- package/dist/react/cvs-app.js.map +1 -1
- package/dist/react/cvs-documents.d.ts +17 -4
- package/dist/react/cvs-documents.js +25 -8
- package/dist/react/cvs-documents.js.map +1 -1
- package/dist/react/cvs-favorites.d.ts +2 -2
- package/dist/react/cvs-favorites.js +2 -2
- package/dist/react/cvs-favorites.js.map +1 -1
- package/dist/react/cvs-ils.d.ts +552 -0
- package/dist/react/cvs-ils.js +822 -0
- package/dist/react/cvs-ils.js.map +1 -0
- package/dist/react/cvs-loans.d.ts +2 -2
- package/dist/react/cvs-loans.js +2 -2
- package/dist/react/cvs-loans.js.map +1 -1
- package/dist/react/cvs-payments.d.ts +123 -0
- package/dist/react/cvs-payments.js +181 -0
- package/dist/react/cvs-payments.js.map +1 -0
- package/dist/react/cvs-streaming.d.ts +2 -2
- package/dist/react/cvs-streaming.js +2 -2
- package/dist/react/cvs-streaming.js.map +1 -1
- package/dist/react/index.d.ts +5 -2
- package/dist/react/index.js +5 -2
- package/dist/react/partner-catalogue.d.ts +2 -2
- package/dist/react/partner-catalogue.js +2 -2
- package/dist/react/partner-catalogue.js.map +1 -1
- package/dist/react/partner-reader.d.ts +2 -2
- package/dist/react/partner-reader.js +2 -2
- package/dist/react/partner-reader.js.map +1 -1
- package/dist/react/profiles.d.ts +2 -2
- package/dist/react/profiles.js +2 -2
- package/dist/react/profiles.js.map +1 -1
- package/dist/react/search.d.ts +47 -0
- package/dist/react/search.js +81 -0
- package/dist/react/search.js.map +1 -0
- package/dist/react/sso.d.ts +15 -0
- package/dist/react/sso.js +48 -0
- package/dist/react/sso.js.map +1 -0
- package/dist/react/tutoring-catalogue.d.ts +2 -2
- package/dist/react/tutoring-catalogue.js +2 -2
- package/dist/react/tutoring-catalogue.js.map +1 -1
- package/dist/react/tutoring-chat.d.ts +2 -2
- package/dist/react/tutoring-chat.js +2 -2
- package/dist/react/tutoring-chat.js.map +1 -1
- package/dist/react/tutoring-dispatch.d.ts +2 -2
- package/dist/react/tutoring-dispatch.js +2 -2
- package/dist/react/tutoring-dispatch.js.map +1 -1
- package/dist/react/tutoring-practitioner.d.ts +2 -2
- package/dist/react/tutoring-practitioner.js +2 -2
- package/dist/react/tutoring-practitioner.js.map +1 -1
- package/dist/react/tutoring-requests.d.ts +2 -2
- package/dist/react/tutoring-requests.js +2 -2
- package/dist/react/tutoring-requests.js.map +1 -1
- package/package.json +29 -1
- package/dist/client-D3kMOcIr.js.map +0 -1
|
@@ -0,0 +1,822 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../chunks/client.js";
|
|
3
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/cvs-ils/cvs-ils.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.5.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 getReadIlsAccountUrl = () => {
|
|
25
|
+
return `/ils/account`;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The borrower record held by the library.
|
|
29
|
+
*
|
|
30
|
+
* Passed through unmodelled — PMB documents no shape for this call and the
|
|
31
|
+
* four libraries run different versions, so a fixed schema would drop exactly
|
|
32
|
+
* the fine and expiry fields a patron most needs.
|
|
33
|
+
* @summary Read Ils Account
|
|
34
|
+
*/
|
|
35
|
+
const readIlsAccount = async (options) => {
|
|
36
|
+
return request(getReadIlsAccountUrl(), {
|
|
37
|
+
...options,
|
|
38
|
+
method: "GET"
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const getReadIlsAccountQueryKey = () => {
|
|
42
|
+
return [`/ils/account`];
|
|
43
|
+
};
|
|
44
|
+
const getReadIlsAccountQueryOptions = (options) => {
|
|
45
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
46
|
+
const queryKey = queryOptions?.queryKey ?? getReadIlsAccountQueryKey();
|
|
47
|
+
const queryFn = ({ signal }) => readIlsAccount({
|
|
48
|
+
signal,
|
|
49
|
+
...requestOptions
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
queryKey,
|
|
53
|
+
queryFn,
|
|
54
|
+
...queryOptions
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* @summary Read Ils Account
|
|
59
|
+
*/
|
|
60
|
+
function useReadIlsAccount(options, queryClient) {
|
|
61
|
+
const queryOptions = getReadIlsAccountQueryOptions(options);
|
|
62
|
+
const query = useQuery(queryOptions, queryClient);
|
|
63
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
64
|
+
}
|
|
65
|
+
const getListIlsHoldLocationsUrl = () => {
|
|
66
|
+
return `/ils/hold-locations`;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Branches a reservation may be collected from.
|
|
70
|
+
*
|
|
71
|
+
* A separate call from ``/ils/locations`` because it is a different list —
|
|
72
|
+
* not every branch accepts collections, and offering one that does not
|
|
73
|
+
* produces a hold the patron can never pick up.
|
|
74
|
+
* @summary List Ils Hold Locations
|
|
75
|
+
*/
|
|
76
|
+
const listIlsHoldLocations = async (options) => {
|
|
77
|
+
return request(getListIlsHoldLocationsUrl(), {
|
|
78
|
+
...options,
|
|
79
|
+
method: "GET"
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const getListIlsHoldLocationsQueryKey = () => {
|
|
83
|
+
return [`/ils/hold-locations`];
|
|
84
|
+
};
|
|
85
|
+
const getListIlsHoldLocationsQueryOptions = (options) => {
|
|
86
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
87
|
+
const queryKey = queryOptions?.queryKey ?? getListIlsHoldLocationsQueryKey();
|
|
88
|
+
const queryFn = ({ signal }) => listIlsHoldLocations({
|
|
89
|
+
signal,
|
|
90
|
+
...requestOptions
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
queryKey,
|
|
94
|
+
queryFn,
|
|
95
|
+
...queryOptions
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* @summary List Ils Hold Locations
|
|
100
|
+
*/
|
|
101
|
+
function useListIlsHoldLocations(options, queryClient) {
|
|
102
|
+
const queryOptions = getListIlsHoldLocationsQueryOptions(options);
|
|
103
|
+
const query = useQuery(queryOptions, queryClient);
|
|
104
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
105
|
+
}
|
|
106
|
+
const getListIlsHoldsUrl = () => {
|
|
107
|
+
return `/ils/holds`;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* This patron's reservations, with their place in each queue.
|
|
111
|
+
* @summary List Ils Holds
|
|
112
|
+
*/
|
|
113
|
+
const listIlsHolds = async (options) => {
|
|
114
|
+
return request(getListIlsHoldsUrl(), {
|
|
115
|
+
...options,
|
|
116
|
+
method: "GET"
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const getListIlsHoldsQueryKey = () => {
|
|
120
|
+
return [`/ils/holds`];
|
|
121
|
+
};
|
|
122
|
+
const getListIlsHoldsQueryOptions = (options) => {
|
|
123
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
124
|
+
const queryKey = queryOptions?.queryKey ?? getListIlsHoldsQueryKey();
|
|
125
|
+
const queryFn = ({ signal }) => listIlsHolds({
|
|
126
|
+
signal,
|
|
127
|
+
...requestOptions
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
queryKey,
|
|
131
|
+
queryFn,
|
|
132
|
+
...queryOptions
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* @summary List Ils Holds
|
|
137
|
+
*/
|
|
138
|
+
function useListIlsHolds(options, queryClient) {
|
|
139
|
+
const queryOptions = getListIlsHoldsQueryOptions(options);
|
|
140
|
+
const query = useQuery(queryOptions, queryClient);
|
|
141
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
142
|
+
}
|
|
143
|
+
const getPlaceIlsHoldUrl = () => {
|
|
144
|
+
return `/ils/holds`;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Reserve a record, for collection at a branch.
|
|
148
|
+
*
|
|
149
|
+
* Check ``GET /ils/records/{record_id}/holdable`` first if you want to show
|
|
150
|
+
* the patron why not before they try — this returns the library's refusal
|
|
151
|
+
* either way.
|
|
152
|
+
* @summary Place Ils Hold
|
|
153
|
+
*/
|
|
154
|
+
const placeIlsHold = async (ilsHoldWrite, options) => {
|
|
155
|
+
const getHeaders = (h) => {
|
|
156
|
+
if (!h) return {};
|
|
157
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
158
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
159
|
+
const headers = {};
|
|
160
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
161
|
+
return headers;
|
|
162
|
+
};
|
|
163
|
+
return request(getPlaceIlsHoldUrl(), {
|
|
164
|
+
...options,
|
|
165
|
+
method: "POST",
|
|
166
|
+
headers: {
|
|
167
|
+
"Content-Type": "application/json",
|
|
168
|
+
...getHeaders(options?.headers)
|
|
169
|
+
},
|
|
170
|
+
body: JSON.stringify(ilsHoldWrite)
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
const getPlaceIlsHoldMutationKey = () => ["placeIlsHold"];
|
|
174
|
+
const getPlaceIlsHoldMutationOptions = (options) => {
|
|
175
|
+
const mutationKey = getPlaceIlsHoldMutationKey();
|
|
176
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
177
|
+
...options,
|
|
178
|
+
mutation: {
|
|
179
|
+
...options.mutation,
|
|
180
|
+
mutationKey
|
|
181
|
+
}
|
|
182
|
+
} : {
|
|
183
|
+
mutation: { mutationKey },
|
|
184
|
+
request: void 0
|
|
185
|
+
};
|
|
186
|
+
const mutationFn = (props) => {
|
|
187
|
+
const { data } = props ?? {};
|
|
188
|
+
return placeIlsHold(data, requestOptions);
|
|
189
|
+
};
|
|
190
|
+
return {
|
|
191
|
+
mutationFn,
|
|
192
|
+
...mutationOptions
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* @summary Place Ils Hold
|
|
197
|
+
*/
|
|
198
|
+
const usePlaceIlsHold = (options, queryClient) => {
|
|
199
|
+
return useMutation(getPlaceIlsHoldMutationOptions(options), queryClient);
|
|
200
|
+
};
|
|
201
|
+
const getCancelIlsHoldUrl = (holdId) => {
|
|
202
|
+
return `/ils/holds/${holdId}`;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Cancel a reservation. The library decides whether it may still be.
|
|
206
|
+
* @summary Cancel Ils Hold
|
|
207
|
+
*/
|
|
208
|
+
const cancelIlsHold = async (holdId, options) => {
|
|
209
|
+
return request(getCancelIlsHoldUrl(holdId), {
|
|
210
|
+
...options,
|
|
211
|
+
method: "DELETE"
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
const getCancelIlsHoldMutationKey = () => ["cancelIlsHold"];
|
|
215
|
+
const getCancelIlsHoldMutationOptions = (options) => {
|
|
216
|
+
const mutationKey = getCancelIlsHoldMutationKey();
|
|
217
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
218
|
+
...options,
|
|
219
|
+
mutation: {
|
|
220
|
+
...options.mutation,
|
|
221
|
+
mutationKey
|
|
222
|
+
}
|
|
223
|
+
} : {
|
|
224
|
+
mutation: { mutationKey },
|
|
225
|
+
request: void 0
|
|
226
|
+
};
|
|
227
|
+
const mutationFn = (props) => {
|
|
228
|
+
const { holdId } = props ?? {};
|
|
229
|
+
return cancelIlsHold(holdId, requestOptions);
|
|
230
|
+
};
|
|
231
|
+
return {
|
|
232
|
+
mutationFn,
|
|
233
|
+
...mutationOptions
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* @summary Cancel Ils Hold
|
|
238
|
+
*/
|
|
239
|
+
const useCancelIlsHold = (options, queryClient) => {
|
|
240
|
+
return useMutation(getCancelIlsHoldMutationOptions(options), queryClient);
|
|
241
|
+
};
|
|
242
|
+
const getListIlsLoansUrl = (params) => {
|
|
243
|
+
const normalizedParams = new URLSearchParams();
|
|
244
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
245
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
246
|
+
});
|
|
247
|
+
const stringifiedParams = normalizedParams.toString();
|
|
248
|
+
return stringifiedParams.length > 0 ? `/ils/loans?${stringifiedParams}` : `/ils/loans`;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* What this patron has out from their library.
|
|
252
|
+
*
|
|
253
|
+
* ``state`` replaces PMB's integer ``loan_type``. The wire values were 0, 1
|
|
254
|
+
* and 2 with the meanings in the vendor's documentation and nowhere in the
|
|
255
|
+
* URL; a client should not have to know that 2 means overdue.
|
|
256
|
+
* @summary List Ils Loans
|
|
257
|
+
*/
|
|
258
|
+
const listIlsLoans = async (params, options) => {
|
|
259
|
+
return request(getListIlsLoansUrl(params), {
|
|
260
|
+
...options,
|
|
261
|
+
method: "GET"
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
const getListIlsLoansQueryKey = (params) => {
|
|
265
|
+
return [`/ils/loans`, ...params ? [params] : []];
|
|
266
|
+
};
|
|
267
|
+
const getListIlsLoansQueryOptions = (params, options) => {
|
|
268
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
269
|
+
const queryKey = queryOptions?.queryKey ?? getListIlsLoansQueryKey(params);
|
|
270
|
+
const queryFn = ({ signal }) => listIlsLoans(params, {
|
|
271
|
+
signal,
|
|
272
|
+
...requestOptions
|
|
273
|
+
});
|
|
274
|
+
return {
|
|
275
|
+
queryKey,
|
|
276
|
+
queryFn,
|
|
277
|
+
...queryOptions
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* @summary List Ils Loans
|
|
282
|
+
*/
|
|
283
|
+
function useListIlsLoans(params, options, queryClient) {
|
|
284
|
+
const queryOptions = getListIlsLoansQueryOptions(params, options);
|
|
285
|
+
const query = useQuery(queryOptions, queryClient);
|
|
286
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
287
|
+
}
|
|
288
|
+
const getRenewIlsLoanUrl = (barcode) => {
|
|
289
|
+
return `/ils/loans/${barcode}/renewals`;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Extend one loan.
|
|
293
|
+
*
|
|
294
|
+
* Keyed on the **item barcode**, not a loan id, because that is what PMB
|
|
295
|
+
* renews — a physical copy — and it is the number printed on the book. It is
|
|
296
|
+
* also what ``GET /ils/loans`` returns as ``barcode``.
|
|
297
|
+
*
|
|
298
|
+
* A refusal is a ``200`` with ``ok: false``, not an error: "this cannot be
|
|
299
|
+
* renewed again" is the library's answer to a valid question, and the reason
|
|
300
|
+
* it gives is worth showing the patron.
|
|
301
|
+
* @summary Renew Ils Loan
|
|
302
|
+
*/
|
|
303
|
+
const renewIlsLoan = async (barcode, options) => {
|
|
304
|
+
return request(getRenewIlsLoanUrl(barcode), {
|
|
305
|
+
...options,
|
|
306
|
+
method: "POST"
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
const getRenewIlsLoanMutationKey = () => ["renewIlsLoan"];
|
|
310
|
+
const getRenewIlsLoanMutationOptions = (options) => {
|
|
311
|
+
const mutationKey = getRenewIlsLoanMutationKey();
|
|
312
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
313
|
+
...options,
|
|
314
|
+
mutation: {
|
|
315
|
+
...options.mutation,
|
|
316
|
+
mutationKey
|
|
317
|
+
}
|
|
318
|
+
} : {
|
|
319
|
+
mutation: { mutationKey },
|
|
320
|
+
request: void 0
|
|
321
|
+
};
|
|
322
|
+
const mutationFn = (props) => {
|
|
323
|
+
const { barcode } = props ?? {};
|
|
324
|
+
return renewIlsLoan(barcode, requestOptions);
|
|
325
|
+
};
|
|
326
|
+
return {
|
|
327
|
+
mutationFn,
|
|
328
|
+
...mutationOptions
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* @summary Renew Ils Loan
|
|
333
|
+
*/
|
|
334
|
+
const useRenewIlsLoan = (options, queryClient) => {
|
|
335
|
+
return useMutation(getRenewIlsLoanMutationOptions(options), queryClient);
|
|
336
|
+
};
|
|
337
|
+
const getListIlsLocationsUrl = () => {
|
|
338
|
+
return `/ils/locations`;
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* Every branch in the library's catalogue.
|
|
342
|
+
* @summary List Ils Locations
|
|
343
|
+
*/
|
|
344
|
+
const listIlsLocations = async (options) => {
|
|
345
|
+
return request(getListIlsLocationsUrl(), {
|
|
346
|
+
...options,
|
|
347
|
+
method: "GET"
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
const getListIlsLocationsQueryKey = () => {
|
|
351
|
+
return [`/ils/locations`];
|
|
352
|
+
};
|
|
353
|
+
const getListIlsLocationsQueryOptions = (options) => {
|
|
354
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
355
|
+
const queryKey = queryOptions?.queryKey ?? getListIlsLocationsQueryKey();
|
|
356
|
+
const queryFn = ({ signal }) => listIlsLocations({
|
|
357
|
+
signal,
|
|
358
|
+
...requestOptions
|
|
359
|
+
});
|
|
360
|
+
return {
|
|
361
|
+
queryKey,
|
|
362
|
+
queryFn,
|
|
363
|
+
...queryOptions
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* @summary List Ils Locations
|
|
368
|
+
*/
|
|
369
|
+
function useListIlsLocations(options, queryClient) {
|
|
370
|
+
const queryOptions = getListIlsLocationsQueryOptions(options);
|
|
371
|
+
const query = useQuery(queryOptions, queryClient);
|
|
372
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
373
|
+
}
|
|
374
|
+
const getChangeIlsPasswordUrl = () => {
|
|
375
|
+
return `/ils/password`;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Change the password on the **library's** system.
|
|
379
|
+
*
|
|
380
|
+
* Not the Mozaik one. A patron who changes it here still signs in to this
|
|
381
|
+
* platform with their Mozaik credentials, and saying so in the UI avoids the
|
|
382
|
+
* support ticket.
|
|
383
|
+
* @summary Change Ils Password
|
|
384
|
+
*/
|
|
385
|
+
const changeIlsPassword = async (ilsPasswordWrite, options) => {
|
|
386
|
+
const getHeaders = (h) => {
|
|
387
|
+
if (!h) return {};
|
|
388
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
389
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
390
|
+
const headers = {};
|
|
391
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
392
|
+
return headers;
|
|
393
|
+
};
|
|
394
|
+
return request(getChangeIlsPasswordUrl(), {
|
|
395
|
+
...options,
|
|
396
|
+
method: "PUT",
|
|
397
|
+
headers: {
|
|
398
|
+
"Content-Type": "application/json",
|
|
399
|
+
...getHeaders(options?.headers)
|
|
400
|
+
},
|
|
401
|
+
body: JSON.stringify(ilsPasswordWrite)
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
const getChangeIlsPasswordMutationKey = () => ["changeIlsPassword"];
|
|
405
|
+
const getChangeIlsPasswordMutationOptions = (options) => {
|
|
406
|
+
const mutationKey = getChangeIlsPasswordMutationKey();
|
|
407
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
408
|
+
...options,
|
|
409
|
+
mutation: {
|
|
410
|
+
...options.mutation,
|
|
411
|
+
mutationKey
|
|
412
|
+
}
|
|
413
|
+
} : {
|
|
414
|
+
mutation: { mutationKey },
|
|
415
|
+
request: void 0
|
|
416
|
+
};
|
|
417
|
+
const mutationFn = (props) => {
|
|
418
|
+
const { data } = props ?? {};
|
|
419
|
+
return changeIlsPassword(data, requestOptions);
|
|
420
|
+
};
|
|
421
|
+
return {
|
|
422
|
+
mutationFn,
|
|
423
|
+
...mutationOptions
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
/**
|
|
427
|
+
* @summary Change Ils Password
|
|
428
|
+
*/
|
|
429
|
+
const useChangeIlsPassword = (options, queryClient) => {
|
|
430
|
+
return useMutation(getChangeIlsPasswordMutationOptions(options), queryClient);
|
|
431
|
+
};
|
|
432
|
+
const getReadIlsHoldableUrl = (recordId, params) => {
|
|
433
|
+
const normalizedParams = new URLSearchParams();
|
|
434
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
435
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
436
|
+
});
|
|
437
|
+
const stringifiedParams = normalizedParams.toString();
|
|
438
|
+
return stringifiedParams.length > 0 ? `/ils/records/${recordId}/holdable?${stringifiedParams}` : `/ils/records/${recordId}/holdable`;
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* Whether this patron may reserve this record, and the library's reason.
|
|
442
|
+
* @summary Read Ils Holdable
|
|
443
|
+
*/
|
|
444
|
+
const readIlsHoldable = async (recordId, params, options) => {
|
|
445
|
+
return request(getReadIlsHoldableUrl(recordId, params), {
|
|
446
|
+
...options,
|
|
447
|
+
method: "GET"
|
|
448
|
+
});
|
|
449
|
+
};
|
|
450
|
+
const getReadIlsHoldableQueryKey = (recordId, params) => {
|
|
451
|
+
return [`/ils/records/${recordId}/holdable`, ...params ? [params] : []];
|
|
452
|
+
};
|
|
453
|
+
const getReadIlsHoldableQueryOptions = (recordId, params, options) => {
|
|
454
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
455
|
+
const queryKey = queryOptions?.queryKey ?? getReadIlsHoldableQueryKey(recordId, params);
|
|
456
|
+
const queryFn = ({ signal }) => readIlsHoldable(recordId, params, {
|
|
457
|
+
signal,
|
|
458
|
+
...requestOptions
|
|
459
|
+
});
|
|
460
|
+
return {
|
|
461
|
+
queryKey,
|
|
462
|
+
queryFn,
|
|
463
|
+
enabled: recordId !== null && recordId !== void 0,
|
|
464
|
+
...queryOptions
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
/**
|
|
468
|
+
* @summary Read Ils Holdable
|
|
469
|
+
*/
|
|
470
|
+
function useReadIlsHoldable(recordId, params, options, queryClient) {
|
|
471
|
+
const queryOptions = getReadIlsHoldableQueryOptions(recordId, params, options);
|
|
472
|
+
const query = useQuery(queryOptions, queryClient);
|
|
473
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
474
|
+
}
|
|
475
|
+
const getAddIlsReviewUrl = (recordId) => {
|
|
476
|
+
return `/ils/records/${recordId}/reviews`;
|
|
477
|
+
};
|
|
478
|
+
/**
|
|
479
|
+
* Post a review to the library's OPAC, where its other borrowers see it.
|
|
480
|
+
*
|
|
481
|
+
* Distinct from a Mozaik review: this one lives on the library's system and
|
|
482
|
+
* is not moderated here.
|
|
483
|
+
* @summary Add Ils Review
|
|
484
|
+
*/
|
|
485
|
+
const addIlsReview = async (recordId, ilsReviewWrite, options) => {
|
|
486
|
+
const getHeaders = (h) => {
|
|
487
|
+
if (!h) return {};
|
|
488
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
489
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
490
|
+
const headers = {};
|
|
491
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
492
|
+
return headers;
|
|
493
|
+
};
|
|
494
|
+
return request(getAddIlsReviewUrl(recordId), {
|
|
495
|
+
...options,
|
|
496
|
+
method: "POST",
|
|
497
|
+
headers: {
|
|
498
|
+
"Content-Type": "application/json",
|
|
499
|
+
...getHeaders(options?.headers)
|
|
500
|
+
},
|
|
501
|
+
body: JSON.stringify(ilsReviewWrite)
|
|
502
|
+
});
|
|
503
|
+
};
|
|
504
|
+
const getAddIlsReviewMutationKey = () => ["addIlsReview"];
|
|
505
|
+
const getAddIlsReviewMutationOptions = (options) => {
|
|
506
|
+
const mutationKey = getAddIlsReviewMutationKey();
|
|
507
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
508
|
+
...options,
|
|
509
|
+
mutation: {
|
|
510
|
+
...options.mutation,
|
|
511
|
+
mutationKey
|
|
512
|
+
}
|
|
513
|
+
} : {
|
|
514
|
+
mutation: { mutationKey },
|
|
515
|
+
request: void 0
|
|
516
|
+
};
|
|
517
|
+
const mutationFn = (props) => {
|
|
518
|
+
const { recordId, data } = props ?? {};
|
|
519
|
+
return addIlsReview(recordId, data, requestOptions);
|
|
520
|
+
};
|
|
521
|
+
return {
|
|
522
|
+
mutationFn,
|
|
523
|
+
...mutationOptions
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
/**
|
|
527
|
+
* @summary Add Ils Review
|
|
528
|
+
*/
|
|
529
|
+
const useAddIlsReview = (options, queryClient) => {
|
|
530
|
+
return useMutation(getAddIlsReviewMutationOptions(options), queryClient);
|
|
531
|
+
};
|
|
532
|
+
const getAddIlsTagUrl = (recordId) => {
|
|
533
|
+
return `/ils/records/${recordId}/tags`;
|
|
534
|
+
};
|
|
535
|
+
/**
|
|
536
|
+
* Tag a record in the library's catalogue.
|
|
537
|
+
* @summary Add Ils Tag
|
|
538
|
+
*/
|
|
539
|
+
const addIlsTag = async (recordId, ilsTagWrite, options) => {
|
|
540
|
+
const getHeaders = (h) => {
|
|
541
|
+
if (!h) return {};
|
|
542
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
543
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
544
|
+
const headers = {};
|
|
545
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
546
|
+
return headers;
|
|
547
|
+
};
|
|
548
|
+
return request(getAddIlsTagUrl(recordId), {
|
|
549
|
+
...options,
|
|
550
|
+
method: "POST",
|
|
551
|
+
headers: {
|
|
552
|
+
"Content-Type": "application/json",
|
|
553
|
+
...getHeaders(options?.headers)
|
|
554
|
+
},
|
|
555
|
+
body: JSON.stringify(ilsTagWrite)
|
|
556
|
+
});
|
|
557
|
+
};
|
|
558
|
+
const getAddIlsTagMutationKey = () => ["addIlsTag"];
|
|
559
|
+
const getAddIlsTagMutationOptions = (options) => {
|
|
560
|
+
const mutationKey = getAddIlsTagMutationKey();
|
|
561
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
562
|
+
...options,
|
|
563
|
+
mutation: {
|
|
564
|
+
...options.mutation,
|
|
565
|
+
mutationKey
|
|
566
|
+
}
|
|
567
|
+
} : {
|
|
568
|
+
mutation: { mutationKey },
|
|
569
|
+
request: void 0
|
|
570
|
+
};
|
|
571
|
+
const mutationFn = (props) => {
|
|
572
|
+
const { recordId, data } = props ?? {};
|
|
573
|
+
return addIlsTag(recordId, data, requestOptions);
|
|
574
|
+
};
|
|
575
|
+
return {
|
|
576
|
+
mutationFn,
|
|
577
|
+
...mutationOptions
|
|
578
|
+
};
|
|
579
|
+
};
|
|
580
|
+
/**
|
|
581
|
+
* @summary Add Ils Tag
|
|
582
|
+
*/
|
|
583
|
+
const useAddIlsTag = (options, queryClient) => {
|
|
584
|
+
return useMutation(getAddIlsTagMutationOptions(options), queryClient);
|
|
585
|
+
};
|
|
586
|
+
const getSignOutOfIlsUrl = () => {
|
|
587
|
+
return `/ils/session`;
|
|
588
|
+
};
|
|
589
|
+
/**
|
|
590
|
+
* Drop the link. Idempotent, and never fails on the library's account.
|
|
591
|
+
*
|
|
592
|
+
* Our copy of the session goes first. Telling PMB is best-effort: if the
|
|
593
|
+
* library is down, the patron is still signed out here, which is the part
|
|
594
|
+
* they asked for and the part that matters for a shared device.
|
|
595
|
+
* @summary Sign Out Of Ils
|
|
596
|
+
*/
|
|
597
|
+
const signOutOfIls = async (options) => {
|
|
598
|
+
return request(getSignOutOfIlsUrl(), {
|
|
599
|
+
...options,
|
|
600
|
+
method: "DELETE"
|
|
601
|
+
});
|
|
602
|
+
};
|
|
603
|
+
const getSignOutOfIlsMutationKey = () => ["signOutOfIls"];
|
|
604
|
+
const getSignOutOfIlsMutationOptions = (options) => {
|
|
605
|
+
const mutationKey = getSignOutOfIlsMutationKey();
|
|
606
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
607
|
+
...options,
|
|
608
|
+
mutation: {
|
|
609
|
+
...options.mutation,
|
|
610
|
+
mutationKey
|
|
611
|
+
}
|
|
612
|
+
} : {
|
|
613
|
+
mutation: { mutationKey },
|
|
614
|
+
request: void 0
|
|
615
|
+
};
|
|
616
|
+
const mutationFn = () => {
|
|
617
|
+
return signOutOfIls(requestOptions);
|
|
618
|
+
};
|
|
619
|
+
return {
|
|
620
|
+
mutationFn,
|
|
621
|
+
...mutationOptions
|
|
622
|
+
};
|
|
623
|
+
};
|
|
624
|
+
/**
|
|
625
|
+
* @summary Sign Out Of Ils
|
|
626
|
+
*/
|
|
627
|
+
const useSignOutOfIls = (options, queryClient) => {
|
|
628
|
+
return useMutation(getSignOutOfIlsMutationOptions(options), queryClient);
|
|
629
|
+
};
|
|
630
|
+
const getSignInToIlsUrl = () => {
|
|
631
|
+
return `/ils/session`;
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* Link this patron to their library account with their card credentials.
|
|
635
|
+
*
|
|
636
|
+
* Replaces ``login``, ``login-md5`` and ``login-aes``: those are three ways to
|
|
637
|
+
* carry one password to a server of unknown vintage, and the connector
|
|
638
|
+
* negotiates between them — AES first, because it is the only one that does
|
|
639
|
+
* not hand the library a password it can replay.
|
|
640
|
+
*
|
|
641
|
+
* **The credentials are not stored.** They open an upstream session and are
|
|
642
|
+
* discarded; the session is what persists, and it expires. That is why there
|
|
643
|
+
* is no silent re-login anywhere below — a patron whose session lapses is
|
|
644
|
+
* asked again, because we deliberately cannot do it for them.
|
|
645
|
+
*
|
|
646
|
+
* ``401`` for a wrong card number or password — the patron's, at their
|
|
647
|
+
* library, not their Mozaik credentials.
|
|
648
|
+
* @summary Sign In To Ils
|
|
649
|
+
*/
|
|
650
|
+
const signInToIls = async (ilsSignInWrite, options) => {
|
|
651
|
+
const getHeaders = (h) => {
|
|
652
|
+
if (!h) return {};
|
|
653
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
654
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
655
|
+
const headers = {};
|
|
656
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
657
|
+
return headers;
|
|
658
|
+
};
|
|
659
|
+
return request(getSignInToIlsUrl(), {
|
|
660
|
+
...options,
|
|
661
|
+
method: "POST",
|
|
662
|
+
headers: {
|
|
663
|
+
"Content-Type": "application/json",
|
|
664
|
+
...getHeaders(options?.headers)
|
|
665
|
+
},
|
|
666
|
+
body: JSON.stringify(ilsSignInWrite)
|
|
667
|
+
});
|
|
668
|
+
};
|
|
669
|
+
const getSignInToIlsMutationKey = () => ["signInToIls"];
|
|
670
|
+
const getSignInToIlsMutationOptions = (options) => {
|
|
671
|
+
const mutationKey = getSignInToIlsMutationKey();
|
|
672
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
673
|
+
...options,
|
|
674
|
+
mutation: {
|
|
675
|
+
...options.mutation,
|
|
676
|
+
mutationKey
|
|
677
|
+
}
|
|
678
|
+
} : {
|
|
679
|
+
mutation: { mutationKey },
|
|
680
|
+
request: void 0
|
|
681
|
+
};
|
|
682
|
+
const mutationFn = (props) => {
|
|
683
|
+
const { data } = props ?? {};
|
|
684
|
+
return signInToIls(data, requestOptions);
|
|
685
|
+
};
|
|
686
|
+
return {
|
|
687
|
+
mutationFn,
|
|
688
|
+
...mutationOptions
|
|
689
|
+
};
|
|
690
|
+
};
|
|
691
|
+
/**
|
|
692
|
+
* @summary Sign In To Ils
|
|
693
|
+
*/
|
|
694
|
+
const useSignInToIls = (options, queryClient) => {
|
|
695
|
+
return useMutation(getSignInToIlsMutationOptions(options), queryClient);
|
|
696
|
+
};
|
|
697
|
+
const getReadIlsStatusUrl = () => {
|
|
698
|
+
return `/ils/status`;
|
|
699
|
+
};
|
|
700
|
+
/**
|
|
701
|
+
* Whether this library has a catalogue system, and whether we speak it.
|
|
702
|
+
*
|
|
703
|
+
* **Read this first.** Most libraries have no ILS, and a client that assumes
|
|
704
|
+
* otherwise renders a "my loans" tab that can only ever answer ``409``.
|
|
705
|
+
*
|
|
706
|
+
* Never 409s itself — "there is no integration" is the answer, not an error.
|
|
707
|
+
* @summary Read Ils Status
|
|
708
|
+
*/
|
|
709
|
+
const readIlsStatus = async (options) => {
|
|
710
|
+
return request(getReadIlsStatusUrl(), {
|
|
711
|
+
...options,
|
|
712
|
+
method: "GET"
|
|
713
|
+
});
|
|
714
|
+
};
|
|
715
|
+
const getReadIlsStatusQueryKey = () => {
|
|
716
|
+
return [`/ils/status`];
|
|
717
|
+
};
|
|
718
|
+
const getReadIlsStatusQueryOptions = (options) => {
|
|
719
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
720
|
+
const queryKey = queryOptions?.queryKey ?? getReadIlsStatusQueryKey();
|
|
721
|
+
const queryFn = ({ signal }) => readIlsStatus({
|
|
722
|
+
signal,
|
|
723
|
+
...requestOptions
|
|
724
|
+
});
|
|
725
|
+
return {
|
|
726
|
+
queryKey,
|
|
727
|
+
queryFn,
|
|
728
|
+
...queryOptions
|
|
729
|
+
};
|
|
730
|
+
};
|
|
731
|
+
/**
|
|
732
|
+
* @summary Read Ils Status
|
|
733
|
+
*/
|
|
734
|
+
function useReadIlsStatus(options, queryClient) {
|
|
735
|
+
const queryOptions = getReadIlsStatusQueryOptions(options);
|
|
736
|
+
const query = useQuery(queryOptions, queryClient);
|
|
737
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
738
|
+
}
|
|
739
|
+
const getListIlsSuggestionCategoriesUrl = () => {
|
|
740
|
+
return `/ils/suggestion-categories`;
|
|
741
|
+
};
|
|
742
|
+
/**
|
|
743
|
+
* Categories a purchase suggestion may name.
|
|
744
|
+
*
|
|
745
|
+
* The suggestion itself is not submitted here: PMB's OPAC borrower services
|
|
746
|
+
* expose the two vocabularies and no ``add_suggestion``, so the legacy could
|
|
747
|
+
* not submit one either. Carried because a client building a suggestion form
|
|
748
|
+
* needs them, and their absence would look like an oversight rather than the
|
|
749
|
+
* vendor's.
|
|
750
|
+
* @summary List Ils Suggestion Categories
|
|
751
|
+
*/
|
|
752
|
+
const listIlsSuggestionCategories = async (options) => {
|
|
753
|
+
return request(getListIlsSuggestionCategoriesUrl(), {
|
|
754
|
+
...options,
|
|
755
|
+
method: "GET"
|
|
756
|
+
});
|
|
757
|
+
};
|
|
758
|
+
const getListIlsSuggestionCategoriesQueryKey = () => {
|
|
759
|
+
return [`/ils/suggestion-categories`];
|
|
760
|
+
};
|
|
761
|
+
const getListIlsSuggestionCategoriesQueryOptions = (options) => {
|
|
762
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
763
|
+
const queryKey = queryOptions?.queryKey ?? getListIlsSuggestionCategoriesQueryKey();
|
|
764
|
+
const queryFn = ({ signal }) => listIlsSuggestionCategories({
|
|
765
|
+
signal,
|
|
766
|
+
...requestOptions
|
|
767
|
+
});
|
|
768
|
+
return {
|
|
769
|
+
queryKey,
|
|
770
|
+
queryFn,
|
|
771
|
+
...queryOptions
|
|
772
|
+
};
|
|
773
|
+
};
|
|
774
|
+
/**
|
|
775
|
+
* @summary List Ils Suggestion Categories
|
|
776
|
+
*/
|
|
777
|
+
function useListIlsSuggestionCategories(options, queryClient) {
|
|
778
|
+
const queryOptions = getListIlsSuggestionCategoriesQueryOptions(options);
|
|
779
|
+
const query = useQuery(queryOptions, queryClient);
|
|
780
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
781
|
+
}
|
|
782
|
+
const getListIlsSuggestionSourcesUrl = () => {
|
|
783
|
+
return `/ils/suggestion-sources`;
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* Sources a purchase suggestion may cite. See the note on categories.
|
|
787
|
+
* @summary List Ils Suggestion Sources
|
|
788
|
+
*/
|
|
789
|
+
const listIlsSuggestionSources = async (options) => {
|
|
790
|
+
return request(getListIlsSuggestionSourcesUrl(), {
|
|
791
|
+
...options,
|
|
792
|
+
method: "GET"
|
|
793
|
+
});
|
|
794
|
+
};
|
|
795
|
+
const getListIlsSuggestionSourcesQueryKey = () => {
|
|
796
|
+
return [`/ils/suggestion-sources`];
|
|
797
|
+
};
|
|
798
|
+
const getListIlsSuggestionSourcesQueryOptions = (options) => {
|
|
799
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
800
|
+
const queryKey = queryOptions?.queryKey ?? getListIlsSuggestionSourcesQueryKey();
|
|
801
|
+
const queryFn = ({ signal }) => listIlsSuggestionSources({
|
|
802
|
+
signal,
|
|
803
|
+
...requestOptions
|
|
804
|
+
});
|
|
805
|
+
return {
|
|
806
|
+
queryKey,
|
|
807
|
+
queryFn,
|
|
808
|
+
...queryOptions
|
|
809
|
+
};
|
|
810
|
+
};
|
|
811
|
+
/**
|
|
812
|
+
* @summary List Ils Suggestion Sources
|
|
813
|
+
*/
|
|
814
|
+
function useListIlsSuggestionSources(options, queryClient) {
|
|
815
|
+
const queryOptions = getListIlsSuggestionSourcesQueryOptions(options);
|
|
816
|
+
const query = useQuery(queryOptions, queryClient);
|
|
817
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
818
|
+
}
|
|
819
|
+
//#endregion
|
|
820
|
+
export { addIlsReview, addIlsTag, cancelIlsHold, changeIlsPassword, getAddIlsReviewMutationKey, getAddIlsReviewMutationOptions, getAddIlsReviewUrl, getAddIlsTagMutationKey, getAddIlsTagMutationOptions, getAddIlsTagUrl, getCancelIlsHoldMutationKey, getCancelIlsHoldMutationOptions, getCancelIlsHoldUrl, getChangeIlsPasswordMutationKey, getChangeIlsPasswordMutationOptions, getChangeIlsPasswordUrl, getListIlsHoldLocationsQueryKey, getListIlsHoldLocationsQueryOptions, getListIlsHoldLocationsUrl, getListIlsHoldsQueryKey, getListIlsHoldsQueryOptions, getListIlsHoldsUrl, getListIlsLoansQueryKey, getListIlsLoansQueryOptions, getListIlsLoansUrl, getListIlsLocationsQueryKey, getListIlsLocationsQueryOptions, getListIlsLocationsUrl, getListIlsSuggestionCategoriesQueryKey, getListIlsSuggestionCategoriesQueryOptions, getListIlsSuggestionCategoriesUrl, getListIlsSuggestionSourcesQueryKey, getListIlsSuggestionSourcesQueryOptions, getListIlsSuggestionSourcesUrl, getPlaceIlsHoldMutationKey, getPlaceIlsHoldMutationOptions, getPlaceIlsHoldUrl, getReadIlsAccountQueryKey, getReadIlsAccountQueryOptions, getReadIlsAccountUrl, getReadIlsHoldableQueryKey, getReadIlsHoldableQueryOptions, getReadIlsHoldableUrl, getReadIlsStatusQueryKey, getReadIlsStatusQueryOptions, getReadIlsStatusUrl, getRenewIlsLoanMutationKey, getRenewIlsLoanMutationOptions, getRenewIlsLoanUrl, getSignInToIlsMutationKey, getSignInToIlsMutationOptions, getSignInToIlsUrl, getSignOutOfIlsMutationKey, getSignOutOfIlsMutationOptions, getSignOutOfIlsUrl, listIlsHoldLocations, listIlsHolds, listIlsLoans, listIlsLocations, listIlsSuggestionCategories, listIlsSuggestionSources, placeIlsHold, readIlsAccount, readIlsHoldable, readIlsStatus, renewIlsLoan, signInToIls, signOutOfIls, useAddIlsReview, useAddIlsTag, useCancelIlsHold, useChangeIlsPassword, useListIlsHoldLocations, useListIlsHolds, useListIlsLoans, useListIlsLocations, useListIlsSuggestionCategories, useListIlsSuggestionSources, usePlaceIlsHold, useReadIlsAccount, useReadIlsHoldable, useReadIlsStatus, useRenewIlsLoan, useSignInToIls, useSignOutOfIls };
|
|
821
|
+
|
|
822
|
+
//# sourceMappingURL=cvs-ils.js.map
|