@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,240 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/account/account.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const withQueryKey = (query, queryKey) => {
|
|
13
|
+
const result = { queryKey };
|
|
14
|
+
for (const key of Object.keys(query)) {
|
|
15
|
+
if (key === "queryKey") continue;
|
|
16
|
+
Object.defineProperty(result, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get: () => query[key]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const getDeleteAccountUrl = () => {
|
|
25
|
+
return `/me`;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Close the account (E17). Anonymises; does not erase.
|
|
29
|
+
*
|
|
30
|
+
* The spec asked for the password to be re-submitted. We do not hold one, and
|
|
31
|
+
* assurance is the better guard anyway: a password check would have passed for a
|
|
32
|
+
* session that arrived through a partner handing over a static key in a URL,
|
|
33
|
+
* and ``RequireHighAssurance`` refuses exactly that. The legacy required no
|
|
34
|
+
* confirmation of any kind and accepted the call from a sub-profile (defect D8).
|
|
35
|
+
*
|
|
36
|
+
* **What survives, and why.** The row stays, with identity cleared and
|
|
37
|
+
* ``is_anonymous`` set. Consumption history, loans and billing records point at
|
|
38
|
+
* this user, and deleting the row would either cascade them away — destroying
|
|
39
|
+
* the library's statutory reporting — or orphan them. Clearing the identifying
|
|
40
|
+
* columns satisfies erasure of personal data while leaving the countable facts
|
|
41
|
+
* countable. The retained set is: which tenant, when they registered, and what
|
|
42
|
+
* they consumed, with no name, login, email, birth date or member number.
|
|
43
|
+
*
|
|
44
|
+
* Sub-profiles go with the holder: they are people on the same membership and
|
|
45
|
+
* cannot outlive it. Their rows are anonymised too, not deleted, for the same
|
|
46
|
+
* reason.
|
|
47
|
+
*
|
|
48
|
+
* **The broker is disabled first, and a failure aborts the whole thing.** The
|
|
49
|
+
* credential lives in Keycloak, so anonymising locally while leaving it enabled
|
|
50
|
+
* would let the same person sign in tomorrow and be provisioned a fresh account
|
|
51
|
+
* — erasure that erases nothing. Disabling before any local write means the
|
|
52
|
+
* failure mode is "nothing happened", which is recoverable, rather than "half
|
|
53
|
+
* happened", which is not.
|
|
54
|
+
*
|
|
55
|
+
* Still missing, and not safe to ship without: no audit record is written.
|
|
56
|
+
* @summary Delete Account
|
|
57
|
+
*/
|
|
58
|
+
const deleteAccount = async (options) => {
|
|
59
|
+
return request(getDeleteAccountUrl(), {
|
|
60
|
+
...options,
|
|
61
|
+
method: "DELETE"
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const getDeleteAccountMutationKey = () => ["deleteAccount"];
|
|
65
|
+
const getDeleteAccountMutationOptions = (options) => {
|
|
66
|
+
const mutationKey = getDeleteAccountMutationKey();
|
|
67
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
68
|
+
...options,
|
|
69
|
+
mutation: {
|
|
70
|
+
...options.mutation,
|
|
71
|
+
mutationKey
|
|
72
|
+
}
|
|
73
|
+
} : {
|
|
74
|
+
mutation: { mutationKey },
|
|
75
|
+
request: void 0
|
|
76
|
+
};
|
|
77
|
+
const mutationFn = () => {
|
|
78
|
+
return deleteAccount(requestOptions);
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
mutationFn,
|
|
82
|
+
...mutationOptions
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* @summary Delete Account
|
|
87
|
+
*/
|
|
88
|
+
const useDeleteAccount = (options, queryClient) => {
|
|
89
|
+
return useMutation(getDeleteAccountMutationOptions(options), queryClient);
|
|
90
|
+
};
|
|
91
|
+
const getReadAccountUrl = () => {
|
|
92
|
+
return `/me`;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* The authenticated account (E15).
|
|
96
|
+
*
|
|
97
|
+
* No query, no join: ``CurrentUserDep`` has already resolved the row behind the
|
|
98
|
+
* token. The endpoint the legacy should have had here has been returning ``500``
|
|
99
|
+
* on every request for as long as anyone has looked (defect D1).
|
|
100
|
+
* @summary Read Account
|
|
101
|
+
*/
|
|
102
|
+
const readAccount = async (options) => {
|
|
103
|
+
return request(getReadAccountUrl(), {
|
|
104
|
+
...options,
|
|
105
|
+
method: "GET"
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
const getReadAccountQueryKey = () => {
|
|
109
|
+
return [`/me`];
|
|
110
|
+
};
|
|
111
|
+
const getReadAccountQueryOptions = (options) => {
|
|
112
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
113
|
+
const queryKey = queryOptions?.queryKey ?? getReadAccountQueryKey();
|
|
114
|
+
const queryFn = ({ signal }) => readAccount({
|
|
115
|
+
signal,
|
|
116
|
+
...requestOptions
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
queryKey,
|
|
120
|
+
queryFn,
|
|
121
|
+
...queryOptions
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* @summary Read Account
|
|
126
|
+
*/
|
|
127
|
+
function useReadAccount(options, queryClient) {
|
|
128
|
+
const queryOptions = getReadAccountQueryOptions(options);
|
|
129
|
+
const query = useQuery(queryOptions, queryClient);
|
|
130
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
131
|
+
}
|
|
132
|
+
const getUpdateAccountUrl = () => {
|
|
133
|
+
return `/me`;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Partially update the account (E16).
|
|
137
|
+
*
|
|
138
|
+
* ``exclude_unset`` is what separates PATCH from PUT here: a field the client
|
|
139
|
+
* omitted is left alone, which is not the same as a field it sent as null. The
|
|
140
|
+
* response is built from the persisted row rather than the submitted body.
|
|
141
|
+
* @summary Update Account
|
|
142
|
+
*/
|
|
143
|
+
const updateAccount = async (accountUpdateWrite, options) => {
|
|
144
|
+
const getHeaders = (h) => {
|
|
145
|
+
if (!h) return {};
|
|
146
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
147
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
148
|
+
const headers = {};
|
|
149
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
150
|
+
return headers;
|
|
151
|
+
};
|
|
152
|
+
return request(getUpdateAccountUrl(), {
|
|
153
|
+
...options,
|
|
154
|
+
method: "PATCH",
|
|
155
|
+
headers: {
|
|
156
|
+
"Content-Type": "application/json",
|
|
157
|
+
...getHeaders(options?.headers)
|
|
158
|
+
},
|
|
159
|
+
body: JSON.stringify(accountUpdateWrite)
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
const getUpdateAccountMutationKey = () => ["updateAccount"];
|
|
163
|
+
const getUpdateAccountMutationOptions = (options) => {
|
|
164
|
+
const mutationKey = getUpdateAccountMutationKey();
|
|
165
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
166
|
+
...options,
|
|
167
|
+
mutation: {
|
|
168
|
+
...options.mutation,
|
|
169
|
+
mutationKey
|
|
170
|
+
}
|
|
171
|
+
} : {
|
|
172
|
+
mutation: { mutationKey },
|
|
173
|
+
request: void 0
|
|
174
|
+
};
|
|
175
|
+
const mutationFn = (props) => {
|
|
176
|
+
const { data } = props ?? {};
|
|
177
|
+
return updateAccount(data, requestOptions);
|
|
178
|
+
};
|
|
179
|
+
return {
|
|
180
|
+
mutationFn,
|
|
181
|
+
...mutationOptions
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* @summary Update Account
|
|
186
|
+
*/
|
|
187
|
+
const useUpdateAccount = (options, queryClient) => {
|
|
188
|
+
return useMutation(getUpdateAccountMutationOptions(options), queryClient);
|
|
189
|
+
};
|
|
190
|
+
const getListServicesUrl = () => {
|
|
191
|
+
return `/me/services`;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Third-party services this account's establishment offers (E27).
|
|
195
|
+
*
|
|
196
|
+
* Under ``/me`` rather than ``/biblio/me`` because it is not a catalogue: these
|
|
197
|
+
* are the establishment's own service tiles, and they belong to the tenant
|
|
198
|
+
* whichever catalogue that tenant reads from. It is also the one place the
|
|
199
|
+
* biblio spec describes something the *CVS* schema models, which is why it sat
|
|
200
|
+
* in the wrong module until the prefixes made the mismatch visible.
|
|
201
|
+
*
|
|
202
|
+
* Date-windowed. A service outside its window is absent rather than disabled:
|
|
203
|
+
* the client should not have to know the difference, and a visible dead link is
|
|
204
|
+
* worse than no link.
|
|
205
|
+
* @summary List Services
|
|
206
|
+
*/
|
|
207
|
+
const listServices = async (options) => {
|
|
208
|
+
return request(getListServicesUrl(), {
|
|
209
|
+
...options,
|
|
210
|
+
method: "GET"
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
const getListServicesQueryKey = () => {
|
|
214
|
+
return [`/me/services`];
|
|
215
|
+
};
|
|
216
|
+
const getListServicesQueryOptions = (options) => {
|
|
217
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
218
|
+
const queryKey = queryOptions?.queryKey ?? getListServicesQueryKey();
|
|
219
|
+
const queryFn = ({ signal }) => listServices({
|
|
220
|
+
signal,
|
|
221
|
+
...requestOptions
|
|
222
|
+
});
|
|
223
|
+
return {
|
|
224
|
+
queryKey,
|
|
225
|
+
queryFn,
|
|
226
|
+
...queryOptions
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* @summary List Services
|
|
231
|
+
*/
|
|
232
|
+
function useListServices(options, queryClient) {
|
|
233
|
+
const queryOptions = getListServicesQueryOptions(options);
|
|
234
|
+
const query = useQuery(queryOptions, queryClient);
|
|
235
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
export { deleteAccount, getDeleteAccountMutationKey, getDeleteAccountMutationOptions, getDeleteAccountUrl, getListServicesQueryKey, getListServicesQueryOptions, getListServicesUrl, getReadAccountQueryKey, getReadAccountQueryOptions, getReadAccountUrl, getUpdateAccountMutationKey, getUpdateAccountMutationOptions, getUpdateAccountUrl, listServices, readAccount, updateAccount, useDeleteAccount, useListServices, useReadAccount, useUpdateAccount };
|
|
239
|
+
|
|
240
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","names":[],"sources":["../../src/react/account/account.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n AccountDetailRead,\n AccountUpdateWrite,\n HTTPExceptionResponse,\n ServiceListRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getDeleteAccountUrl = () => {\n\n\n\n\n return `/me`\n}\n\n/**\n * Close the account (E17). Anonymises; does not erase.\n *\n * The spec asked for the password to be re-submitted. We do not hold one, and\n * assurance is the better guard anyway: a password check would have passed for a\n * session that arrived through a partner handing over a static key in a URL,\n * and ``RequireHighAssurance`` refuses exactly that. The legacy required no\n * confirmation of any kind and accepted the call from a sub-profile (defect D8).\n *\n * **What survives, and why.** The row stays, with identity cleared and\n * ``is_anonymous`` set. Consumption history, loans and billing records point at\n * this user, and deleting the row would either cascade them away — destroying\n * the library's statutory reporting — or orphan them. Clearing the identifying\n * columns satisfies erasure of personal data while leaving the countable facts\n * countable. The retained set is: which tenant, when they registered, and what\n * they consumed, with no name, login, email, birth date or member number.\n *\n * Sub-profiles go with the holder: they are people on the same membership and\n * cannot outlive it. Their rows are anonymised too, not deleted, for the same\n * reason.\n *\n * **The broker is disabled first, and a failure aborts the whole thing.** The\n * credential lives in Keycloak, so anonymising locally while leaving it enabled\n * would let the same person sign in tomorrow and be provisioned a fresh account\n * — erasure that erases nothing. Disabling before any local write means the\n * failure mode is \"nothing happened\", which is recoverable, rather than \"half\n * happened\", which is not.\n *\n * Still missing, and not safe to ship without: no audit record is written.\n * @summary Delete Account\n */\nexport const deleteAccount = async ( options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteAccountUrl(),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getDeleteAccountMutationKey = () => ['deleteAccount'] as const;\n\nexport const getDeleteAccountMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAccount>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteAccount>>, TError,void, TContext> => {\n\nconst mutationKey = getDeleteAccountMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteAccount>>, void> = () => {\n\n\n return deleteAccount(requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteAccountMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAccount>>>\n\n export type DeleteAccountMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\n /**\n * @summary Delete Account\n */\nexport const useDeleteAccount = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAccount>>, TError,void, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof deleteAccount>>,\n TError,\n void,\n TContext\n > => {\n return useMutation(getDeleteAccountMutationOptions(options), queryClient);\n }\n export const getReadAccountUrl = () => {\n\n\n\n\n return `/me`\n}\n\n/**\n * The authenticated account (E15).\n *\n * No query, no join: ``CurrentUserDep`` has already resolved the row behind the\n * token. The endpoint the legacy should have had here has been returning ``500``\n * on every request for as long as anyone has looked (defect D1).\n * @summary Read Account\n */\nexport const readAccount = async ( options?: Parameters<typeof request>[1]): Promise<AccountDetailRead> => {\n\n return request<AccountDetailRead>(getReadAccountUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadAccountQueryKey = () => {\n return [\n `/me`\n ] as const;\n }\n\n\nexport const getReadAccountQueryOptions = <TData = Awaited<ReturnType<typeof readAccount>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readAccount>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadAccountQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readAccount>>> = ({ signal }) => readAccount({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readAccount>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadAccountQueryResult = NonNullable<Awaited<ReturnType<typeof readAccount>>>\nexport type ReadAccountQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadAccount<TData = Awaited<ReturnType<typeof readAccount>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readAccount>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readAccount>>,\n TError,\n Awaited<ReturnType<typeof readAccount>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadAccount<TData = Awaited<ReturnType<typeof readAccount>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readAccount>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readAccount>>,\n TError,\n Awaited<ReturnType<typeof readAccount>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadAccount<TData = Awaited<ReturnType<typeof readAccount>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readAccount>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Account\n */\n\nexport function useReadAccount<TData = Awaited<ReturnType<typeof readAccount>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readAccount>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadAccountQueryOptions(options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getUpdateAccountUrl = () => {\n\n\n\n\n return `/me`\n}\n\n/**\n * Partially update the account (E16).\n *\n * ``exclude_unset`` is what separates PATCH from PUT here: a field the client\n * omitted is left alone, which is not the same as a field it sent as null. The\n * response is built from the persisted row rather than the submitted body.\n * @summary Update Account\n */\nexport const updateAccount = async (accountUpdateWrite: AccountUpdateWrite, options?: Parameters<typeof request>[1]): Promise<AccountDetailRead> => {\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<AccountDetailRead>(getUpdateAccountUrl(),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(accountUpdateWrite)\n }\n);}\n\n\n\n\n\nexport const getUpdateAccountMutationKey = () => ['updateAccount'] as const;\n\nexport const getUpdateAccountMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateAccount>>, TError,UpdateAccountMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof updateAccount>>, TError,UpdateAccountMutationVariables, TContext> => {\n\nconst mutationKey = getUpdateAccountMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateAccount>>, UpdateAccountMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return updateAccount(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type UpdateAccountMutationResult = NonNullable<Awaited<ReturnType<typeof updateAccount>>>\n export type UpdateAccountMutationBody = BodyType<AccountUpdateWrite>\n export type UpdateAccountMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type UpdateAccountMutationVariables = {data: BodyType<AccountUpdateWrite>}\n\n /**\n * @summary Update Account\n */\nexport const useUpdateAccount = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateAccount>>, TError,UpdateAccountMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof updateAccount>>,\n TError,\n UpdateAccountMutationVariables,\n TContext\n > => {\n return useMutation(getUpdateAccountMutationOptions(options), queryClient);\n }\n export const getListServicesUrl = () => {\n\n\n\n\n return `/me/services`\n}\n\n/**\n * Third-party services this account's establishment offers (E27).\n *\n * Under ``/me`` rather than ``/biblio/me`` because it is not a catalogue: these\n * are the establishment's own service tiles, and they belong to the tenant\n * whichever catalogue that tenant reads from. It is also the one place the\n * biblio spec describes something the *CVS* schema models, which is why it sat\n * in the wrong module until the prefixes made the mismatch visible.\n *\n * Date-windowed. A service outside its window is absent rather than disabled:\n * the client should not have to know the difference, and a visible dead link is\n * worse than no link.\n * @summary List Services\n */\nexport const listServices = async ( options?: Parameters<typeof request>[1]): Promise<ServiceListRead> => {\n\n return request<ServiceListRead>(getListServicesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListServicesQueryKey = () => {\n return [\n `/me/services`\n ] as const;\n }\n\n\nexport const getListServicesQueryOptions = <TData = Awaited<ReturnType<typeof listServices>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listServices>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListServicesQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listServices>>> = ({ signal }) => listServices({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listServices>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListServicesQueryResult = NonNullable<Awaited<ReturnType<typeof listServices>>>\nexport type ListServicesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListServices<TData = Awaited<ReturnType<typeof listServices>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listServices>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listServices>>,\n TError,\n Awaited<ReturnType<typeof listServices>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListServices<TData = Awaited<ReturnType<typeof listServices>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listServices>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listServices>>,\n TError,\n Awaited<ReturnType<typeof listServices>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListServices<TData = Awaited<ReturnType<typeof listServices>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listServices>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Services\n */\n\nexport function useListServices<TData = Awaited<ReturnType<typeof listServices>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listServices>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListServicesQueryOptions(options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\n"],"mappings":"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"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
|
|
2
|
+
import { C as ThemeWrite, E as ThemeRead, Gn as HTTPExceptionResponse, T as ThemeListRead, sn as ListThemesParams, t as ValidationErrorResponse, w as ThemeOrderWrite } from "../index-wL_20vR8.js";
|
|
3
|
+
import { a as ErrorType, c as request, n as BodyType } from "../client-BDwBZYB0.js";
|
|
4
|
+
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/admin-catalogue/admin-catalogue.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getListThemesUrl: (params?: ListThemesParams) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Every theme, or one pillar's, in display order.
|
|
10
|
+
*
|
|
11
|
+
* Not paginated. There are 27 of them, and a client that has to page through
|
|
12
|
+
* a list it is about to reorder cannot reorder it.
|
|
13
|
+
* @summary List Themes
|
|
14
|
+
*/
|
|
15
|
+
export declare const listThemes: (params?: ListThemesParams, options?: Parameters<typeof request>[1]) => Promise<ThemeListRead>;
|
|
16
|
+
export declare const getListThemesQueryKey: (params?: ListThemesParams) => readonly ["/admin/themes", ...ListThemesParams[]];
|
|
17
|
+
export declare const getListThemesQueryOptions: <TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListThemesParams, options?: {
|
|
18
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>>;
|
|
19
|
+
request?: SecondParameter<typeof request>;
|
|
20
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData> & {
|
|
21
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
22
|
+
};
|
|
23
|
+
export type ListThemesQueryResult = NonNullable<Awaited<ReturnType<typeof listThemes>>>;
|
|
24
|
+
export type ListThemesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
25
|
+
export declare function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: undefined | ListThemesParams, options: {
|
|
26
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listThemes>>, TError, Awaited<ReturnType<typeof listThemes>>>, 'initialData'>;
|
|
27
|
+
request?: SecondParameter<typeof request>;
|
|
28
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
29
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
30
|
+
};
|
|
31
|
+
export declare function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListThemesParams, options?: {
|
|
32
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listThemes>>, TError, Awaited<ReturnType<typeof listThemes>>>, 'initialData'>;
|
|
33
|
+
request?: SecondParameter<typeof request>;
|
|
34
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
35
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
36
|
+
};
|
|
37
|
+
export declare function useListThemes<TData = Awaited<ReturnType<typeof listThemes>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListThemesParams, options?: {
|
|
38
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listThemes>>, TError, TData>>;
|
|
39
|
+
request?: SecondParameter<typeof request>;
|
|
40
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
41
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
42
|
+
};
|
|
43
|
+
export declare const getCreateThemeUrl: () => string;
|
|
44
|
+
/**
|
|
45
|
+
* Add a theme.
|
|
46
|
+
*
|
|
47
|
+
* ``409`` on a duplicate ``(pillar, title)``: that pair is unique in the
|
|
48
|
+
* schema, and two themes with the same name in the same pillar are
|
|
49
|
+
* indistinguishable to everyone downstream.
|
|
50
|
+
*
|
|
51
|
+
* With no ``sortOrder`` it goes last, which is what the legacy's form does by
|
|
52
|
+
* defaulting the field to the current maximum plus one.
|
|
53
|
+
* @summary Create Theme
|
|
54
|
+
*/
|
|
55
|
+
export declare const createTheme: (themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]) => Promise<ThemeRead>;
|
|
56
|
+
export declare const getCreateThemeMutationKey: () => readonly ['createTheme'];
|
|
57
|
+
export declare const getCreateThemeMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
58
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof createTheme>>, TError, CreateThemeMutationVariables, TContext>;
|
|
59
|
+
request?: SecondParameter<typeof request>;
|
|
60
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof createTheme>>, TError, CreateThemeMutationVariables, TContext>;
|
|
61
|
+
export type CreateThemeMutationResult = NonNullable<Awaited<ReturnType<typeof createTheme>>>;
|
|
62
|
+
export type CreateThemeMutationBody = BodyType<ThemeWrite>;
|
|
63
|
+
export type CreateThemeMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
64
|
+
export type CreateThemeMutationVariables = {
|
|
65
|
+
data: BodyType<ThemeWrite>;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* @summary Create Theme
|
|
69
|
+
*/
|
|
70
|
+
export declare const useCreateTheme: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
71
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof createTheme>>, TError, CreateThemeMutationVariables, TContext>;
|
|
72
|
+
request?: SecondParameter<typeof request>;
|
|
73
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof createTheme>>, TError, CreateThemeMutationVariables, TContext>;
|
|
74
|
+
export declare const getReorderThemesUrl: () => string;
|
|
75
|
+
/**
|
|
76
|
+
* Set the display order for a set of themes, in one transaction.
|
|
77
|
+
*
|
|
78
|
+
* The legacy renumbers one theme per request, so dragging an item in a list of
|
|
79
|
+
* thirty was thirty requests — and closing the tab halfway left the order
|
|
80
|
+
* half-applied, with two themes claiming the same position and the listing
|
|
81
|
+
* silently choosing between them.
|
|
82
|
+
*
|
|
83
|
+
* Ids not named keep their relative order after the ones that are, so a client
|
|
84
|
+
* may send only what moved. An unknown id is ``404`` and nothing is written:
|
|
85
|
+
* a partially applied reorder is the failure this endpoint exists to prevent.
|
|
86
|
+
* @summary Reorder Themes
|
|
87
|
+
*/
|
|
88
|
+
export declare const reorderThemes: (themeOrderWrite: ThemeOrderWrite, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
89
|
+
export declare const getReorderThemesMutationKey: () => readonly ['reorderThemes'];
|
|
90
|
+
export declare const getReorderThemesMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
91
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof reorderThemes>>, TError, ReorderThemesMutationVariables, TContext>;
|
|
92
|
+
request?: SecondParameter<typeof request>;
|
|
93
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof reorderThemes>>, TError, ReorderThemesMutationVariables, TContext>;
|
|
94
|
+
export type ReorderThemesMutationResult = NonNullable<Awaited<ReturnType<typeof reorderThemes>>>;
|
|
95
|
+
export type ReorderThemesMutationBody = BodyType<ThemeOrderWrite>;
|
|
96
|
+
export type ReorderThemesMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
97
|
+
export type ReorderThemesMutationVariables = {
|
|
98
|
+
data: BodyType<ThemeOrderWrite>;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* @summary Reorder Themes
|
|
102
|
+
*/
|
|
103
|
+
export declare const useReorderThemes: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
104
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof reorderThemes>>, TError, ReorderThemesMutationVariables, TContext>;
|
|
105
|
+
request?: SecondParameter<typeof request>;
|
|
106
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof reorderThemes>>, TError, ReorderThemesMutationVariables, TContext>;
|
|
107
|
+
export declare const getDeleteThemeUrl: (themeId: number) => string;
|
|
108
|
+
/**
|
|
109
|
+
* Remove a theme.
|
|
110
|
+
*
|
|
111
|
+
* ``409`` when works still carry it. The legacy deletes and leaves the
|
|
112
|
+
* references dangling, which is how a catalogue ends up with items filed under
|
|
113
|
+
* a theme that no longer exists and no screen that can find them.
|
|
114
|
+
*
|
|
115
|
+
* Idempotent otherwise: deleting something already gone is ``204``, because
|
|
116
|
+
* the caller wanted it gone and it is gone.
|
|
117
|
+
* @summary Delete Theme
|
|
118
|
+
*/
|
|
119
|
+
export declare const deleteTheme: (themeId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
120
|
+
export declare const getDeleteThemeMutationKey: () => readonly ['deleteTheme'];
|
|
121
|
+
export declare const getDeleteThemeMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
122
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof deleteTheme>>, TError, DeleteThemeMutationVariables, TContext>;
|
|
123
|
+
request?: SecondParameter<typeof request>;
|
|
124
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof deleteTheme>>, TError, DeleteThemeMutationVariables, TContext>;
|
|
125
|
+
export type DeleteThemeMutationResult = NonNullable<Awaited<ReturnType<typeof deleteTheme>>>;
|
|
126
|
+
export type DeleteThemeMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
127
|
+
export type DeleteThemeMutationVariables = {
|
|
128
|
+
themeId: number;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* @summary Delete Theme
|
|
132
|
+
*/
|
|
133
|
+
export declare const useDeleteTheme: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
134
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof deleteTheme>>, TError, DeleteThemeMutationVariables, TContext>;
|
|
135
|
+
request?: SecondParameter<typeof request>;
|
|
136
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof deleteTheme>>, TError, DeleteThemeMutationVariables, TContext>;
|
|
137
|
+
export declare const getReadThemeUrl: (themeId: number) => string;
|
|
138
|
+
/**
|
|
139
|
+
* One theme.
|
|
140
|
+
* @summary Read Theme
|
|
141
|
+
*/
|
|
142
|
+
export declare const readTheme: (themeId: number, options?: Parameters<typeof request>[1]) => Promise<ThemeRead>;
|
|
143
|
+
export declare const getReadThemeQueryKey: (themeId: number) => readonly [`/admin/themes/${number}`];
|
|
144
|
+
export declare const getReadThemeQueryOptions: <TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(themeId: number, options?: {
|
|
145
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>>;
|
|
146
|
+
request?: SecondParameter<typeof request>;
|
|
147
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData> & {
|
|
148
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
149
|
+
};
|
|
150
|
+
export type ReadThemeQueryResult = NonNullable<Awaited<ReturnType<typeof readTheme>>>;
|
|
151
|
+
export type ReadThemeQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
152
|
+
export declare function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(themeId: number, options: {
|
|
153
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readTheme>>, TError, Awaited<ReturnType<typeof readTheme>>>, 'initialData'>;
|
|
154
|
+
request?: SecondParameter<typeof request>;
|
|
155
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
156
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
157
|
+
};
|
|
158
|
+
export declare function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(themeId: number, options?: {
|
|
159
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readTheme>>, TError, Awaited<ReturnType<typeof readTheme>>>, 'initialData'>;
|
|
160
|
+
request?: SecondParameter<typeof request>;
|
|
161
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
162
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
163
|
+
};
|
|
164
|
+
export declare function useReadTheme<TData = Awaited<ReturnType<typeof readTheme>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(themeId: number, options?: {
|
|
165
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readTheme>>, TError, TData>>;
|
|
166
|
+
request?: SecondParameter<typeof request>;
|
|
167
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
168
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
169
|
+
};
|
|
170
|
+
export declare const getAmendThemeUrl: (themeId: number) => string;
|
|
171
|
+
/**
|
|
172
|
+
* Amend a theme. Same uniqueness rule as creating one.
|
|
173
|
+
* @summary Amend Theme
|
|
174
|
+
*/
|
|
175
|
+
export declare const amendTheme: (themeId: number, themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]) => Promise<ThemeRead>;
|
|
176
|
+
export declare const getAmendThemeMutationKey: () => readonly ['amendTheme'];
|
|
177
|
+
export declare const getAmendThemeMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
178
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof amendTheme>>, TError, AmendThemeMutationVariables, TContext>;
|
|
179
|
+
request?: SecondParameter<typeof request>;
|
|
180
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof amendTheme>>, TError, AmendThemeMutationVariables, TContext>;
|
|
181
|
+
export type AmendThemeMutationResult = NonNullable<Awaited<ReturnType<typeof amendTheme>>>;
|
|
182
|
+
export type AmendThemeMutationBody = BodyType<ThemeWrite>;
|
|
183
|
+
export type AmendThemeMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
184
|
+
export type AmendThemeMutationVariables = {
|
|
185
|
+
themeId: number;
|
|
186
|
+
data: BodyType<ThemeWrite>;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* @summary Amend Theme
|
|
190
|
+
*/
|
|
191
|
+
export declare const useAmendTheme: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
192
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof amendTheme>>, TError, AmendThemeMutationVariables, TContext>;
|
|
193
|
+
request?: SecondParameter<typeof request>;
|
|
194
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof amendTheme>>, TError, AmendThemeMutationVariables, TContext>;
|
|
195
|
+
//#endregion
|
|
196
|
+
//# sourceMappingURL=admin-catalogue.d.ts.map
|