@learnorama/mozaik-sdk 0.1.0-staging.11.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.
Files changed (208) hide show
  1. package/README.md +94 -0
  2. package/dist/api/account.d.ts +75 -0
  3. package/dist/api/account.js +117 -0
  4. package/dist/api/account.js.map +1 -0
  5. package/dist/api/admin-catalogue.d.ts +68 -0
  6. package/dist/api/admin-catalogue.js +155 -0
  7. package/dist/api/admin-catalogue.js.map +1 -0
  8. package/dist/api/admin-consumption.d.ts +27 -0
  9. package/dist/api/admin-consumption.js +55 -0
  10. package/dist/api/admin-consumption.js.map +1 -0
  11. package/dist/api/admin-licenses.d.ts +21 -0
  12. package/dist/api/admin-licenses.js +34 -0
  13. package/dist/api/admin-licenses.js.map +1 -0
  14. package/dist/api/admin-patrons.d.ts +36 -0
  15. package/dist/api/admin-patrons.js +76 -0
  16. package/dist/api/admin-patrons.js.map +1 -0
  17. package/dist/api/admin-reviews.d.ts +30 -0
  18. package/dist/api/admin-reviews.js +63 -0
  19. package/dist/api/admin-reviews.js.map +1 -0
  20. package/dist/api/admin-roles.d.ts +34 -0
  21. package/dist/api/admin-roles.js +62 -0
  22. package/dist/api/admin-roles.js.map +1 -0
  23. package/dist/api/admin-support.d.ts +68 -0
  24. package/dist/api/admin-support.js +116 -0
  25. package/dist/api/admin-support.js.map +1 -0
  26. package/dist/api/admin-tenants.d.ts +33 -0
  27. package/dist/api/admin-tenants.js +68 -0
  28. package/dist/api/admin-tenants.js.map +1 -0
  29. package/dist/api/admin-tutoring.d.ts +159 -0
  30. package/dist/api/admin-tutoring.js +455 -0
  31. package/dist/api/admin-tutoring.js.map +1 -0
  32. package/dist/api/auth.d.ts +92 -0
  33. package/dist/api/auth.js +192 -0
  34. package/dist/api/auth.js.map +1 -0
  35. package/dist/api/biblio-catalogue.d.ts +122 -0
  36. package/dist/api/biblio-catalogue.js +223 -0
  37. package/dist/api/biblio-catalogue.js.map +1 -0
  38. package/dist/api/biblio-home.d.ts +18 -0
  39. package/dist/api/biblio-home.js +31 -0
  40. package/dist/api/biblio-home.js.map +1 -0
  41. package/dist/api/biblio-library.d.ts +94 -0
  42. package/dist/api/biblio-library.js +187 -0
  43. package/dist/api/biblio-library.js.map +1 -0
  44. package/dist/api/biblio-nextory.d.ts +43 -0
  45. package/dist/api/biblio-nextory.js +65 -0
  46. package/dist/api/biblio-nextory.js.map +1 -0
  47. package/dist/api/biblio-press.d.ts +38 -0
  48. package/dist/api/biblio-press.js +70 -0
  49. package/dist/api/biblio-press.js.map +1 -0
  50. package/dist/api/biblio-search.d.ts +17 -0
  51. package/dist/api/biblio-search.js +30 -0
  52. package/dist/api/biblio-search.js.map +1 -0
  53. package/dist/api/biblio-telemetry.d.ts +28 -0
  54. package/dist/api/biblio-telemetry.js +49 -0
  55. package/dist/api/biblio-telemetry.js.map +1 -0
  56. package/dist/api/consumption.d.ts +30 -0
  57. package/dist/api/consumption.js +45 -0
  58. package/dist/api/consumption.js.map +1 -0
  59. package/dist/api/cvs-app.d.ts +39 -0
  60. package/dist/api/cvs-app.js +72 -0
  61. package/dist/api/cvs-app.js.map +1 -0
  62. package/dist/api/cvs-documents.d.ts +106 -0
  63. package/dist/api/cvs-documents.js +208 -0
  64. package/dist/api/cvs-documents.js.map +1 -0
  65. package/dist/api/cvs-favorites.d.ts +53 -0
  66. package/dist/api/cvs-favorites.js +82 -0
  67. package/dist/api/cvs-favorites.js.map +1 -0
  68. package/dist/api/cvs-loans.d.ts +59 -0
  69. package/dist/api/cvs-loans.js +106 -0
  70. package/dist/api/cvs-loans.js.map +1 -0
  71. package/dist/api/cvs-streaming.d.ts +40 -0
  72. package/dist/api/cvs-streaming.js +68 -0
  73. package/dist/api/cvs-streaming.js.map +1 -0
  74. package/dist/api/index.d.ts +34 -0
  75. package/dist/api/index.js +34 -0
  76. package/dist/api/partner-catalogue.d.ts +77 -0
  77. package/dist/api/partner-catalogue.js +125 -0
  78. package/dist/api/partner-catalogue.js.map +1 -0
  79. package/dist/api/partner-reader.d.ts +56 -0
  80. package/dist/api/partner-reader.js +103 -0
  81. package/dist/api/partner-reader.js.map +1 -0
  82. package/dist/api/profiles.d.ts +64 -0
  83. package/dist/api/profiles.js +126 -0
  84. package/dist/api/profiles.js.map +1 -0
  85. package/dist/api/tutoring-catalogue.d.ts +32 -0
  86. package/dist/api/tutoring-catalogue.js +59 -0
  87. package/dist/api/tutoring-catalogue.js.map +1 -0
  88. package/dist/api/tutoring-chat.d.ts +31 -0
  89. package/dist/api/tutoring-chat.js +71 -0
  90. package/dist/api/tutoring-chat.js.map +1 -0
  91. package/dist/api/tutoring-dispatch.d.ts +37 -0
  92. package/dist/api/tutoring-dispatch.js +83 -0
  93. package/dist/api/tutoring-dispatch.js.map +1 -0
  94. package/dist/api/tutoring-practitioner.d.ts +55 -0
  95. package/dist/api/tutoring-practitioner.js +110 -0
  96. package/dist/api/tutoring-practitioner.js.map +1 -0
  97. package/dist/api/tutoring-requests.d.ts +86 -0
  98. package/dist/api/tutoring-requests.js +176 -0
  99. package/dist/api/tutoring-requests.js.map +1 -0
  100. package/dist/chunks/client.d.ts +28 -0
  101. package/dist/chunks/client.js +61 -0
  102. package/dist/chunks/client.js.map +1 -0
  103. package/dist/chunks/index.d.ts +4566 -0
  104. package/dist/index.d.ts +9 -0
  105. package/dist/index.js +10 -0
  106. package/dist/index.js.map +1 -0
  107. package/dist/models.d.ts +3 -0
  108. package/dist/models.js +175 -0
  109. package/dist/models.js.map +1 -0
  110. package/dist/react/account.d.ts +163 -0
  111. package/dist/react/account.js +240 -0
  112. package/dist/react/account.js.map +1 -0
  113. package/dist/react/admin-catalogue.d.ts +196 -0
  114. package/dist/react/admin-catalogue.js +336 -0
  115. package/dist/react/admin-catalogue.js.map +1 -0
  116. package/dist/react/admin-consumption.d.ts +75 -0
  117. package/dist/react/admin-consumption.js +127 -0
  118. package/dist/react/admin-consumption.js.map +1 -0
  119. package/dist/react/admin-licenses.d.ts +50 -0
  120. package/dist/react/admin-licenses.js +78 -0
  121. package/dist/react/admin-licenses.js.map +1 -0
  122. package/dist/react/admin-patrons.d.ts +111 -0
  123. package/dist/react/admin-patrons.js +173 -0
  124. package/dist/react/admin-patrons.js.map +1 -0
  125. package/dist/react/admin-reviews.d.ts +78 -0
  126. package/dist/react/admin-reviews.js +135 -0
  127. package/dist/react/admin-reviews.js.map +1 -0
  128. package/dist/react/admin-roles.d.ts +82 -0
  129. package/dist/react/admin-roles.js +135 -0
  130. package/dist/react/admin-roles.js.map +1 -0
  131. package/dist/react/admin-support.d.ts +123 -0
  132. package/dist/react/admin-support.js +208 -0
  133. package/dist/react/admin-support.js.map +1 -0
  134. package/dist/react/admin-tenants.d.ts +108 -0
  135. package/dist/react/admin-tenants.js +165 -0
  136. package/dist/react/admin-tenants.js.map +1 -0
  137. package/dist/react/admin-tutoring.d.ts +556 -0
  138. package/dist/react/admin-tutoring.js +954 -0
  139. package/dist/react/admin-tutoring.js.map +1 -0
  140. package/dist/react/auth.d.ts +220 -0
  141. package/dist/react/auth.js +372 -0
  142. package/dist/react/auth.js.map +1 -0
  143. package/dist/react/biblio-catalogue.d.ts +374 -0
  144. package/dist/react/biblio-catalogue.js +498 -0
  145. package/dist/react/biblio-catalogue.js.map +1 -0
  146. package/dist/react/biblio-home.d.ts +47 -0
  147. package/dist/react/biblio-home.js +75 -0
  148. package/dist/react/biblio-home.js.map +1 -0
  149. package/dist/react/biblio-library.d.ts +285 -0
  150. package/dist/react/biblio-library.js +411 -0
  151. package/dist/react/biblio-library.js.map +1 -0
  152. package/dist/react/biblio-nextory.d.ts +100 -0
  153. package/dist/react/biblio-nextory.js +163 -0
  154. package/dist/react/biblio-nextory.js.map +1 -0
  155. package/dist/react/biblio-press.d.ts +121 -0
  156. package/dist/react/biblio-press.js +163 -0
  157. package/dist/react/biblio-press.js.map +1 -0
  158. package/dist/react/biblio-search.d.ts +46 -0
  159. package/dist/react/biblio-search.js +74 -0
  160. package/dist/react/biblio-search.js.map +1 -0
  161. package/dist/react/biblio-telemetry.d.ts +49 -0
  162. package/dist/react/biblio-telemetry.js +85 -0
  163. package/dist/react/biblio-telemetry.js.map +1 -0
  164. package/dist/react/consumption.d.ts +66 -0
  165. package/dist/react/consumption.js +109 -0
  166. package/dist/react/consumption.js.map +1 -0
  167. package/dist/react/cvs-app.d.ts +86 -0
  168. package/dist/react/cvs-app.js +144 -0
  169. package/dist/react/cvs-app.js.map +1 -0
  170. package/dist/react/cvs-documents.d.ts +254 -0
  171. package/dist/react/cvs-documents.js +418 -0
  172. package/dist/react/cvs-documents.js.map +1 -0
  173. package/dist/react/cvs-favorites.d.ts +143 -0
  174. package/dist/react/cvs-favorites.js +206 -0
  175. package/dist/react/cvs-favorites.js.map +1 -0
  176. package/dist/react/cvs-loans.d.ts +140 -0
  177. package/dist/react/cvs-loans.js +234 -0
  178. package/dist/react/cvs-loans.js.map +1 -0
  179. package/dist/react/cvs-streaming.d.ts +87 -0
  180. package/dist/react/cvs-streaming.js +141 -0
  181. package/dist/react/cvs-streaming.js.map +1 -0
  182. package/dist/react/index.d.ts +34 -0
  183. package/dist/react/index.js +34 -0
  184. package/dist/react/partner-catalogue.d.ts +223 -0
  185. package/dist/react/partner-catalogue.js +301 -0
  186. package/dist/react/partner-catalogue.js.map +1 -0
  187. package/dist/react/partner-reader.d.ts +159 -0
  188. package/dist/react/partner-reader.js +226 -0
  189. package/dist/react/partner-reader.js.map +1 -0
  190. package/dist/react/profiles.d.ts +174 -0
  191. package/dist/react/profiles.js +279 -0
  192. package/dist/react/profiles.js.map +1 -0
  193. package/dist/react/tutoring-catalogue.d.ts +115 -0
  194. package/dist/react/tutoring-catalogue.js +151 -0
  195. package/dist/react/tutoring-catalogue.js.map +1 -0
  196. package/dist/react/tutoring-chat.d.ts +96 -0
  197. package/dist/react/tutoring-chat.js +172 -0
  198. package/dist/react/tutoring-chat.js.map +1 -0
  199. package/dist/react/tutoring-dispatch.d.ts +102 -0
  200. package/dist/react/tutoring-dispatch.js +183 -0
  201. package/dist/react/tutoring-dispatch.js.map +1 -0
  202. package/dist/react/tutoring-practitioner.d.ts +129 -0
  203. package/dist/react/tutoring-practitioner.js +230 -0
  204. package/dist/react/tutoring-practitioner.js.map +1 -0
  205. package/dist/react/tutoring-requests.d.ts +233 -0
  206. package/dist/react/tutoring-requests.js +385 -0
  207. package/dist/react/tutoring-requests.js.map +1 -0
  208. package/package.json +70 -0
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # @learnorama/mozaik-sdk
2
+
3
+ Mozaik's typed API client, generated with Orval from the deployed OpenAPI schema.
4
+ Native fetch functions and optional TanStack Query v5 hooks are published as ESM
5
+ with TypeScript declarations. Import only the API areas your application uses.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @learnorama/mozaik-sdk@staging
11
+ ```
12
+
13
+ For React, also install `@tanstack/react-query` v5.102.8 or later in v5. React 18.3
14
+ and React 19 are supported. React dependencies are optional for plain API consumers.
15
+ Modern browsers and Node.js 22 or later provide the fetch APIs used by this package.
16
+
17
+ ## Configure and call the API
18
+
19
+ ```ts
20
+ import { createClient } from '@learnorama/mozaik-sdk';
21
+ import { readMe } from '@learnorama/mozaik-sdk/api/auth';
22
+
23
+ // Supply the token from your application's session manager.
24
+ export function apiClient(getAccessToken: () => Promise<string | undefined>) {
25
+ return createClient({
26
+ baseUrl: 'https://api.stg.mozaik.co',
27
+ getAccessToken,
28
+ });
29
+ }
30
+
31
+ // const me = await readMe({ client: apiClient(session.getAccessToken) });
32
+ ```
33
+
34
+ The token getter runs for every request, so refreshing a token does not require
35
+ recreating the client. Clients can also supply default headers and a custom fetch
36
+ implementation. Request options accept headers and an AbortSignal.
37
+
38
+ There is no global token storage, automatic sign-in or automatic replay of failed
39
+ writes. The application owns its PKCE flow and session refresh. Backend-owned
40
+ Keycloak client secrets must never be supplied to this SDK.
41
+
42
+ ## React
43
+
44
+ Wrap the application in TanStack Query's `QueryClientProvider`. Within it:
45
+
46
+ ```tsx
47
+ import type { Client } from '@learnorama/mozaik-sdk';
48
+ import { useReadMe } from '@learnorama/mozaik-sdk/react/auth';
49
+
50
+ export function CurrentAccount({ client }: { client: Client }) {
51
+ const me = useReadMe({ request: { client }, query: { staleTime: 30_000 } });
52
+ if (me.isPending) return <p>Loading…</p>;
53
+ if (me.isError) return <p>Could not load your account.</p>;
54
+ return <p>{me.data.account.email}</p>;
55
+ }
56
+ ```
57
+
58
+ GET operations generate queries; write operations generate mutations. Query keys
59
+ and query/mutation options are exported for prefetching and explicit invalidation.
60
+ For example, `getReadMeQueryOptions` works with `queryClient.fetchQuery`.
61
+ React entrypoints include `"use client"` for frameworks that use React Server Components.
62
+
63
+ Create a separate client and QueryClient for each server-side request. Clear the
64
+ query cache on logout, account change, or a change of acting-as/tenant context;
65
+ generated query keys do not contain credentials or identify the current user.
66
+
67
+ ## Models and errors
68
+
69
+ ```ts
70
+ import { ApiError } from '@learnorama/mozaik-sdk';
71
+ import type { MeRead } from '@learnorama/mozaik-sdk/models';
72
+ ```
73
+
74
+ Successful requests return the response data directly. HTTP failures reject with
75
+ `ApiError`, exposing `status`, `data` and response `headers`. Network and cancellation
76
+ errors retain the native fetch error. Empty 204 responses return `undefined`.
77
+
78
+ Modules include `auth`, `profiles`, `account`, `biblio-catalogue`, `cvs-documents`,
79
+ `tutoring-requests`, `admin-tenants`, and other OpenAPI tags, under both `/api/<tag>`
80
+ and `/react/<tag>`. Orchestrator health checks and encoding webhooks are excluded.
81
+
82
+ ## Version and traceability
83
+
84
+ Backend and SDK release versions start together at 0.1.0. The `staging` npm tag
85
+ tracks staging SDK publications. Pin an exact version when reproducible installs
86
+ are required; the backend commit SHA is metadata, not the package version.
87
+
88
+ ```ts
89
+ import { apiVersion, backendRevision, schemaSha256 } from '@learnorama/mozaik-sdk';
90
+ ```
91
+
92
+ TypeScript types describe the API contract; they do not validate response bodies
93
+ at runtime. The package contains the client and type declarations, not application
94
+ credentials or backend implementation code.
@@ -0,0 +1,75 @@
1
+
2
+ import { $r as AccountDetailRead, B as ServiceListRead, Zr as AccountUpdateWrite } from "../chunks/index.js";
3
+ import { c as request } from "../chunks/client.js";
4
+ //#region src/api/account/account.d.ts
5
+ export declare const getDeleteAccountUrl: () => string;
6
+ /**
7
+ * Close the account (E17). Anonymises; does not erase.
8
+ *
9
+ * The spec asked for the password to be re-submitted. We do not hold one, and
10
+ * assurance is the better guard anyway: a password check would have passed for a
11
+ * session that arrived through a partner handing over a static key in a URL,
12
+ * and ``RequireHighAssurance`` refuses exactly that. The legacy required no
13
+ * confirmation of any kind and accepted the call from a sub-profile (defect D8).
14
+ *
15
+ * **What survives, and why.** The row stays, with identity cleared and
16
+ * ``is_anonymous`` set. Consumption history, loans and billing records point at
17
+ * this user, and deleting the row would either cascade them away — destroying
18
+ * the library's statutory reporting — or orphan them. Clearing the identifying
19
+ * columns satisfies erasure of personal data while leaving the countable facts
20
+ * countable. The retained set is: which tenant, when they registered, and what
21
+ * they consumed, with no name, login, email, birth date or member number.
22
+ *
23
+ * Sub-profiles go with the holder: they are people on the same membership and
24
+ * cannot outlive it. Their rows are anonymised too, not deleted, for the same
25
+ * reason.
26
+ *
27
+ * **The broker is disabled first, and a failure aborts the whole thing.** The
28
+ * credential lives in Keycloak, so anonymising locally while leaving it enabled
29
+ * would let the same person sign in tomorrow and be provisioned a fresh account
30
+ * — erasure that erases nothing. Disabling before any local write means the
31
+ * failure mode is "nothing happened", which is recoverable, rather than "half
32
+ * happened", which is not.
33
+ *
34
+ * Still missing, and not safe to ship without: no audit record is written.
35
+ * @summary Delete Account
36
+ */
37
+ export declare const deleteAccount: (options?: Parameters<typeof request>[1]) => Promise<void>;
38
+ export declare const getReadAccountUrl: () => string;
39
+ /**
40
+ * The authenticated account (E15).
41
+ *
42
+ * No query, no join: ``CurrentUserDep`` has already resolved the row behind the
43
+ * token. The endpoint the legacy should have had here has been returning ``500``
44
+ * on every request for as long as anyone has looked (defect D1).
45
+ * @summary Read Account
46
+ */
47
+ export declare const readAccount: (options?: Parameters<typeof request>[1]) => Promise<AccountDetailRead>;
48
+ export declare const getUpdateAccountUrl: () => string;
49
+ /**
50
+ * Partially update the account (E16).
51
+ *
52
+ * ``exclude_unset`` is what separates PATCH from PUT here: a field the client
53
+ * omitted is left alone, which is not the same as a field it sent as null. The
54
+ * response is built from the persisted row rather than the submitted body.
55
+ * @summary Update Account
56
+ */
57
+ export declare const updateAccount: (accountUpdateWrite: AccountUpdateWrite, options?: Parameters<typeof request>[1]) => Promise<AccountDetailRead>;
58
+ export declare const getListServicesUrl: () => string;
59
+ /**
60
+ * Third-party services this account's establishment offers (E27).
61
+ *
62
+ * Under ``/me`` rather than ``/biblio/me`` because it is not a catalogue: these
63
+ * are the establishment's own service tiles, and they belong to the tenant
64
+ * whichever catalogue that tenant reads from. It is also the one place the
65
+ * biblio spec describes something the *CVS* schema models, which is why it sat
66
+ * in the wrong module until the prefixes made the mismatch visible.
67
+ *
68
+ * Date-windowed. A service outside its window is absent rather than disabled:
69
+ * the client should not have to know the difference, and a visible dead link is
70
+ * worse than no link.
71
+ * @summary List Services
72
+ */
73
+ export declare const listServices: (options?: Parameters<typeof request>[1]) => Promise<ServiceListRead>;
74
+ //#endregion
75
+ //# sourceMappingURL=account.d.ts.map
@@ -0,0 +1,117 @@
1
+
2
+ import { r as request } from "../chunks/client.js";
3
+ //#region src/api/account/account.ts
4
+ const getDeleteAccountUrl = () => {
5
+ return `/me`;
6
+ };
7
+ /**
8
+ * Close the account (E17). Anonymises; does not erase.
9
+ *
10
+ * The spec asked for the password to be re-submitted. We do not hold one, and
11
+ * assurance is the better guard anyway: a password check would have passed for a
12
+ * session that arrived through a partner handing over a static key in a URL,
13
+ * and ``RequireHighAssurance`` refuses exactly that. The legacy required no
14
+ * confirmation of any kind and accepted the call from a sub-profile (defect D8).
15
+ *
16
+ * **What survives, and why.** The row stays, with identity cleared and
17
+ * ``is_anonymous`` set. Consumption history, loans and billing records point at
18
+ * this user, and deleting the row would either cascade them away — destroying
19
+ * the library's statutory reporting — or orphan them. Clearing the identifying
20
+ * columns satisfies erasure of personal data while leaving the countable facts
21
+ * countable. The retained set is: which tenant, when they registered, and what
22
+ * they consumed, with no name, login, email, birth date or member number.
23
+ *
24
+ * Sub-profiles go with the holder: they are people on the same membership and
25
+ * cannot outlive it. Their rows are anonymised too, not deleted, for the same
26
+ * reason.
27
+ *
28
+ * **The broker is disabled first, and a failure aborts the whole thing.** The
29
+ * credential lives in Keycloak, so anonymising locally while leaving it enabled
30
+ * would let the same person sign in tomorrow and be provisioned a fresh account
31
+ * — erasure that erases nothing. Disabling before any local write means the
32
+ * failure mode is "nothing happened", which is recoverable, rather than "half
33
+ * happened", which is not.
34
+ *
35
+ * Still missing, and not safe to ship without: no audit record is written.
36
+ * @summary Delete Account
37
+ */
38
+ const deleteAccount = async (options) => {
39
+ return request(getDeleteAccountUrl(), {
40
+ ...options,
41
+ method: "DELETE"
42
+ });
43
+ };
44
+ const getReadAccountUrl = () => {
45
+ return `/me`;
46
+ };
47
+ /**
48
+ * The authenticated account (E15).
49
+ *
50
+ * No query, no join: ``CurrentUserDep`` has already resolved the row behind the
51
+ * token. The endpoint the legacy should have had here has been returning ``500``
52
+ * on every request for as long as anyone has looked (defect D1).
53
+ * @summary Read Account
54
+ */
55
+ const readAccount = async (options) => {
56
+ return request(getReadAccountUrl(), {
57
+ ...options,
58
+ method: "GET"
59
+ });
60
+ };
61
+ const getUpdateAccountUrl = () => {
62
+ return `/me`;
63
+ };
64
+ /**
65
+ * Partially update the account (E16).
66
+ *
67
+ * ``exclude_unset`` is what separates PATCH from PUT here: a field the client
68
+ * omitted is left alone, which is not the same as a field it sent as null. The
69
+ * response is built from the persisted row rather than the submitted body.
70
+ * @summary Update Account
71
+ */
72
+ const updateAccount = async (accountUpdateWrite, options) => {
73
+ const getHeaders = (h) => {
74
+ if (!h) return {};
75
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
76
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
77
+ const headers = {};
78
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
79
+ return headers;
80
+ };
81
+ return request(getUpdateAccountUrl(), {
82
+ ...options,
83
+ method: "PATCH",
84
+ headers: {
85
+ "Content-Type": "application/json",
86
+ ...getHeaders(options?.headers)
87
+ },
88
+ body: JSON.stringify(accountUpdateWrite)
89
+ });
90
+ };
91
+ const getListServicesUrl = () => {
92
+ return `/me/services`;
93
+ };
94
+ /**
95
+ * Third-party services this account's establishment offers (E27).
96
+ *
97
+ * Under ``/me`` rather than ``/biblio/me`` because it is not a catalogue: these
98
+ * are the establishment's own service tiles, and they belong to the tenant
99
+ * whichever catalogue that tenant reads from. It is also the one place the
100
+ * biblio spec describes something the *CVS* schema models, which is why it sat
101
+ * in the wrong module until the prefixes made the mismatch visible.
102
+ *
103
+ * Date-windowed. A service outside its window is absent rather than disabled:
104
+ * the client should not have to know the difference, and a visible dead link is
105
+ * worse than no link.
106
+ * @summary List Services
107
+ */
108
+ const listServices = async (options) => {
109
+ return request(getListServicesUrl(), {
110
+ ...options,
111
+ method: "GET"
112
+ });
113
+ };
114
+ //#endregion
115
+ export { deleteAccount, getDeleteAccountUrl, getListServicesUrl, getReadAccountUrl, getUpdateAccountUrl, listServices, readAccount, updateAccount };
116
+
117
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","names":[],"sources":["../../src/api/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 type {\n AccountDetailRead,\n AccountUpdateWrite,\n ServiceListRead\n} from '../../models';\n\nimport { request } from '../../client';\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\nexport 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\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\nexport 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"],"mappings":";;;AAeA,MAAa,4BAA4B;CAKvC,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,gBAAgB,OAAQ,YAA2D;CAE9F,OAAO,QAAc,oBAAoB,GACzC;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,0BAA0B;CAKrC,OAAO;AACT;;;;;;;;;AAUA,MAAa,cAAc,OAAQ,YAAwE;CAEzG,OAAO,QAA2B,kBAAkB,GACpD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,4BAA4B;CAKvC,OAAO;AACT;;;;;;;;;AAUA,MAAa,gBAAgB,OAAO,oBAAwC,YAAwE;CAEhJ,MAAM,cAAc,MAAwF;EAC5G,IAAI,CAAC,GAAG,OAAO,CAAC;EAChB,IAAI,aAAa,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;EAC/D,IAAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAA2B,oBAAoB,GACpD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,kBAAkB;CACzC,CACF;AAAE;AAGF,MAAa,2BAA2B;CAKtC,OAAO;AACT;;;;;;;;;;;;;;;AAgBA,MAAa,eAAe,OAAQ,YAAsE;CAExG,OAAO,QAAyB,mBAAmB,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE"}
@@ -0,0 +1,68 @@
1
+
2
+ import { C as ThemeWrite, E as ThemeRead, T as ThemeListRead, sn as ListThemesParams, w as ThemeOrderWrite } from "../chunks/index.js";
3
+ import { c as request } from "../chunks/client.js";
4
+ //#region src/api/admin-catalogue/admin-catalogue.d.ts
5
+ export declare const getListThemesUrl: (params?: ListThemesParams) => string;
6
+ /**
7
+ * Every theme, or one pillar's, in display order.
8
+ *
9
+ * Not paginated. There are 27 of them, and a client that has to page through
10
+ * a list it is about to reorder cannot reorder it.
11
+ * @summary List Themes
12
+ */
13
+ export declare const listThemes: (params?: ListThemesParams, options?: Parameters<typeof request>[1]) => Promise<ThemeListRead>;
14
+ export declare const getCreateThemeUrl: () => string;
15
+ /**
16
+ * Add a theme.
17
+ *
18
+ * ``409`` on a duplicate ``(pillar, title)``: that pair is unique in the
19
+ * schema, and two themes with the same name in the same pillar are
20
+ * indistinguishable to everyone downstream.
21
+ *
22
+ * With no ``sortOrder`` it goes last, which is what the legacy's form does by
23
+ * defaulting the field to the current maximum plus one.
24
+ * @summary Create Theme
25
+ */
26
+ export declare const createTheme: (themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]) => Promise<ThemeRead>;
27
+ export declare const getReorderThemesUrl: () => string;
28
+ /**
29
+ * Set the display order for a set of themes, in one transaction.
30
+ *
31
+ * The legacy renumbers one theme per request, so dragging an item in a list of
32
+ * thirty was thirty requests — and closing the tab halfway left the order
33
+ * half-applied, with two themes claiming the same position and the listing
34
+ * silently choosing between them.
35
+ *
36
+ * Ids not named keep their relative order after the ones that are, so a client
37
+ * may send only what moved. An unknown id is ``404`` and nothing is written:
38
+ * a partially applied reorder is the failure this endpoint exists to prevent.
39
+ * @summary Reorder Themes
40
+ */
41
+ export declare const reorderThemes: (themeOrderWrite: ThemeOrderWrite, options?: Parameters<typeof request>[1]) => Promise<void>;
42
+ export declare const getDeleteThemeUrl: (themeId: number) => string;
43
+ /**
44
+ * Remove a theme.
45
+ *
46
+ * ``409`` when works still carry it. The legacy deletes and leaves the
47
+ * references dangling, which is how a catalogue ends up with items filed under
48
+ * a theme that no longer exists and no screen that can find them.
49
+ *
50
+ * Idempotent otherwise: deleting something already gone is ``204``, because
51
+ * the caller wanted it gone and it is gone.
52
+ * @summary Delete Theme
53
+ */
54
+ export declare const deleteTheme: (themeId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
55
+ export declare const getReadThemeUrl: (themeId: number) => string;
56
+ /**
57
+ * One theme.
58
+ * @summary Read Theme
59
+ */
60
+ export declare const readTheme: (themeId: number, options?: Parameters<typeof request>[1]) => Promise<ThemeRead>;
61
+ export declare const getAmendThemeUrl: (themeId: number) => string;
62
+ /**
63
+ * Amend a theme. Same uniqueness rule as creating one.
64
+ * @summary Amend Theme
65
+ */
66
+ export declare const amendTheme: (themeId: number, themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]) => Promise<ThemeRead>;
67
+ //#endregion
68
+ //# sourceMappingURL=admin-catalogue.d.ts.map
@@ -0,0 +1,155 @@
1
+
2
+ import { r as request } from "../chunks/client.js";
3
+ //#region src/api/admin-catalogue/admin-catalogue.ts
4
+ const getListThemesUrl = (params) => {
5
+ const normalizedParams = new URLSearchParams();
6
+ Object.entries(params || {}).forEach(([key, value]) => {
7
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
8
+ });
9
+ const stringifiedParams = normalizedParams.toString();
10
+ return stringifiedParams.length > 0 ? `/admin/themes?${stringifiedParams}` : `/admin/themes`;
11
+ };
12
+ /**
13
+ * Every theme, or one pillar's, in display order.
14
+ *
15
+ * Not paginated. There are 27 of them, and a client that has to page through
16
+ * a list it is about to reorder cannot reorder it.
17
+ * @summary List Themes
18
+ */
19
+ const listThemes = async (params, options) => {
20
+ return request(getListThemesUrl(params), {
21
+ ...options,
22
+ method: "GET"
23
+ });
24
+ };
25
+ const getCreateThemeUrl = () => {
26
+ return `/admin/themes`;
27
+ };
28
+ /**
29
+ * Add a theme.
30
+ *
31
+ * ``409`` on a duplicate ``(pillar, title)``: that pair is unique in the
32
+ * schema, and two themes with the same name in the same pillar are
33
+ * indistinguishable to everyone downstream.
34
+ *
35
+ * With no ``sortOrder`` it goes last, which is what the legacy's form does by
36
+ * defaulting the field to the current maximum plus one.
37
+ * @summary Create Theme
38
+ */
39
+ const createTheme = async (themeWrite, options) => {
40
+ const getHeaders = (h) => {
41
+ if (!h) return {};
42
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
43
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
44
+ const headers = {};
45
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
46
+ return headers;
47
+ };
48
+ return request(getCreateThemeUrl(), {
49
+ ...options,
50
+ method: "POST",
51
+ headers: {
52
+ "Content-Type": "application/json",
53
+ ...getHeaders(options?.headers)
54
+ },
55
+ body: JSON.stringify(themeWrite)
56
+ });
57
+ };
58
+ const getReorderThemesUrl = () => {
59
+ return `/admin/themes/order`;
60
+ };
61
+ /**
62
+ * Set the display order for a set of themes, in one transaction.
63
+ *
64
+ * The legacy renumbers one theme per request, so dragging an item in a list of
65
+ * thirty was thirty requests — and closing the tab halfway left the order
66
+ * half-applied, with two themes claiming the same position and the listing
67
+ * silently choosing between them.
68
+ *
69
+ * Ids not named keep their relative order after the ones that are, so a client
70
+ * may send only what moved. An unknown id is ``404`` and nothing is written:
71
+ * a partially applied reorder is the failure this endpoint exists to prevent.
72
+ * @summary Reorder Themes
73
+ */
74
+ const reorderThemes = async (themeOrderWrite, options) => {
75
+ const getHeaders = (h) => {
76
+ if (!h) return {};
77
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
78
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
79
+ const headers = {};
80
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
81
+ return headers;
82
+ };
83
+ return request(getReorderThemesUrl(), {
84
+ ...options,
85
+ method: "PUT",
86
+ headers: {
87
+ "Content-Type": "application/json",
88
+ ...getHeaders(options?.headers)
89
+ },
90
+ body: JSON.stringify(themeOrderWrite)
91
+ });
92
+ };
93
+ const getDeleteThemeUrl = (themeId) => {
94
+ return `/admin/themes/${themeId}`;
95
+ };
96
+ /**
97
+ * Remove a theme.
98
+ *
99
+ * ``409`` when works still carry it. The legacy deletes and leaves the
100
+ * references dangling, which is how a catalogue ends up with items filed under
101
+ * a theme that no longer exists and no screen that can find them.
102
+ *
103
+ * Idempotent otherwise: deleting something already gone is ``204``, because
104
+ * the caller wanted it gone and it is gone.
105
+ * @summary Delete Theme
106
+ */
107
+ const deleteTheme = async (themeId, options) => {
108
+ return request(getDeleteThemeUrl(themeId), {
109
+ ...options,
110
+ method: "DELETE"
111
+ });
112
+ };
113
+ const getReadThemeUrl = (themeId) => {
114
+ return `/admin/themes/${themeId}`;
115
+ };
116
+ /**
117
+ * One theme.
118
+ * @summary Read Theme
119
+ */
120
+ const readTheme = async (themeId, options) => {
121
+ return request(getReadThemeUrl(themeId), {
122
+ ...options,
123
+ method: "GET"
124
+ });
125
+ };
126
+ const getAmendThemeUrl = (themeId) => {
127
+ return `/admin/themes/${themeId}`;
128
+ };
129
+ /**
130
+ * Amend a theme. Same uniqueness rule as creating one.
131
+ * @summary Amend Theme
132
+ */
133
+ const amendTheme = async (themeId, themeWrite, options) => {
134
+ const getHeaders = (h) => {
135
+ if (!h) return {};
136
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
137
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
138
+ const headers = {};
139
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
140
+ return headers;
141
+ };
142
+ return request(getAmendThemeUrl(themeId), {
143
+ ...options,
144
+ method: "PATCH",
145
+ headers: {
146
+ "Content-Type": "application/json",
147
+ ...getHeaders(options?.headers)
148
+ },
149
+ body: JSON.stringify(themeWrite)
150
+ });
151
+ };
152
+ //#endregion
153
+ export { amendTheme, createTheme, deleteTheme, getAmendThemeUrl, getCreateThemeUrl, getDeleteThemeUrl, getListThemesUrl, getReadThemeUrl, getReorderThemesUrl, listThemes, readTheme, reorderThemes };
154
+
155
+ //# sourceMappingURL=admin-catalogue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-catalogue.js","names":[],"sources":["../../src/api/admin-catalogue/admin-catalogue.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport type {\n ListThemesParams,\n ThemeListRead,\n ThemeOrderWrite,\n ThemeRead,\n ThemeWrite\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getListThemesUrl = (params?: ListThemesParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/admin/themes?${stringifiedParams}` : `/admin/themes`\n}\n\n/**\n * Every theme, or one pillar's, in display order.\n *\n * Not paginated. There are 27 of them, and a client that has to page through\n * a list it is about to reorder cannot reorder it.\n * @summary List Themes\n */\nexport const listThemes = async (params?: ListThemesParams, options?: Parameters<typeof request>[1]): Promise<ThemeListRead> => {\n\n return request<ThemeListRead>(getListThemesUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getCreateThemeUrl = () => {\n\n\n\n\n return `/admin/themes`\n}\n\n/**\n * Add a theme.\n *\n * ``409`` on a duplicate ``(pillar, title)``: that pair is unique in the\n * schema, and two themes with the same name in the same pillar are\n * indistinguishable to everyone downstream.\n *\n * With no ``sortOrder`` it goes last, which is what the legacy's form does by\n * defaulting the field to the current maximum plus one.\n * @summary Create Theme\n */\nexport const createTheme = async (themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]): Promise<ThemeRead> => {\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<ThemeRead>(getCreateThemeUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(themeWrite)\n }\n);}\n\n\nexport const getReorderThemesUrl = () => {\n\n\n\n\n return `/admin/themes/order`\n}\n\n/**\n * Set the display order for a set of themes, in one transaction.\n *\n * The legacy renumbers one theme per request, so dragging an item in a list of\n * thirty was thirty requests — and closing the tab halfway left the order\n * half-applied, with two themes claiming the same position and the listing\n * silently choosing between them.\n *\n * Ids not named keep their relative order after the ones that are, so a client\n * may send only what moved. An unknown id is ``404`` and nothing is written:\n * a partially applied reorder is the failure this endpoint exists to prevent.\n * @summary Reorder Themes\n */\nexport const reorderThemes = async (themeOrderWrite: ThemeOrderWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getReorderThemesUrl(),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(themeOrderWrite)\n }\n);}\n\n\nexport const getDeleteThemeUrl = (themeId: number,) => {\n\n\n\n\n return `/admin/themes/${themeId}`\n}\n\n/**\n * Remove a theme.\n *\n * ``409`` when works still carry it. The legacy deletes and leaves the\n * references dangling, which is how a catalogue ends up with items filed under\n * a theme that no longer exists and no screen that can find them.\n *\n * Idempotent otherwise: deleting something already gone is ``204``, because\n * the caller wanted it gone and it is gone.\n * @summary Delete Theme\n */\nexport const deleteTheme = async (themeId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteThemeUrl(themeId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\nexport const getReadThemeUrl = (themeId: number,) => {\n\n\n\n\n return `/admin/themes/${themeId}`\n}\n\n/**\n * One theme.\n * @summary Read Theme\n */\nexport const readTheme = async (themeId: number, options?: Parameters<typeof request>[1]): Promise<ThemeRead> => {\n\n return request<ThemeRead>(getReadThemeUrl(themeId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getAmendThemeUrl = (themeId: number,) => {\n\n\n\n\n return `/admin/themes/${themeId}`\n}\n\n/**\n * Amend a theme. Same uniqueness rule as creating one.\n * @summary Amend Theme\n */\nexport const amendTheme = async (themeId: number,\n themeWrite: ThemeWrite, options?: Parameters<typeof request>[1]): Promise<ThemeRead> => {\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<ThemeRead>(getAmendThemeUrl(themeId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(themeWrite)\n }\n);}\n\n\n"],"mappings":"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"}
@@ -0,0 +1,27 @@
1
+
2
+ import { in as LiveLeaseListRead, zn as LeaseCloseWrite } from "../chunks/index.js";
3
+ import { c as request } from "../chunks/client.js";
4
+ //#region src/api/admin-consumption/admin-consumption.d.ts
5
+ export declare const getListLiveLeasesUrl: () => string;
6
+ /**
7
+ * What is open right now, within the caller's tenant scope.
8
+ *
9
+ * Read from the ledger rather than the Redis live set: this is a diagnostic and
10
+ * must show the truth even when the cache is cold, and it runs once when
11
+ * somebody opens a screen rather than on every read.
12
+ * @summary List Live Leases
13
+ */
14
+ export declare const listLiveLeases: (options?: Parameters<typeof request>[1]) => Promise<LiveLeaseListRead>;
15
+ export declare const getForceCloseLeaseUrl: (eventId: number) => string;
16
+ /**
17
+ * Force-close somebody else's lease. The legacy's ``FermeSessionAdherent``.
18
+ *
19
+ * Audited, which the legacy's was not: a button that ends a stranger's reading
20
+ * session and leaves no trace is indistinguishable from abuse of the same
21
+ * button. Tenant-scoped like every staff action, so a lease outside the
22
+ * caller's scope is ``404`` rather than ``403``.
23
+ * @summary Force Close Lease
24
+ */
25
+ export declare const forceCloseLease: (eventId: number, leaseCloseWrite: LeaseCloseWrite, options?: Parameters<typeof request>[1]) => Promise<void>;
26
+ //#endregion
27
+ //# sourceMappingURL=admin-consumption.d.ts.map
@@ -0,0 +1,55 @@
1
+
2
+ import { r as request } from "../chunks/client.js";
3
+ //#region src/api/admin-consumption/admin-consumption.ts
4
+ const getListLiveLeasesUrl = () => {
5
+ return `/admin/consumption/live`;
6
+ };
7
+ /**
8
+ * What is open right now, within the caller's tenant scope.
9
+ *
10
+ * Read from the ledger rather than the Redis live set: this is a diagnostic and
11
+ * must show the truth even when the cache is cold, and it runs once when
12
+ * somebody opens a screen rather than on every read.
13
+ * @summary List Live Leases
14
+ */
15
+ const listLiveLeases = async (options) => {
16
+ return request(getListLiveLeasesUrl(), {
17
+ ...options,
18
+ method: "GET"
19
+ });
20
+ };
21
+ const getForceCloseLeaseUrl = (eventId) => {
22
+ return `/admin/consumption/${eventId}`;
23
+ };
24
+ /**
25
+ * Force-close somebody else's lease. The legacy's ``FermeSessionAdherent``.
26
+ *
27
+ * Audited, which the legacy's was not: a button that ends a stranger's reading
28
+ * session and leaves no trace is indistinguishable from abuse of the same
29
+ * button. Tenant-scoped like every staff action, so a lease outside the
30
+ * caller's scope is ``404`` rather than ``403``.
31
+ * @summary Force Close Lease
32
+ */
33
+ const forceCloseLease = async (eventId, leaseCloseWrite, options) => {
34
+ const getHeaders = (h) => {
35
+ if (!h) return {};
36
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
37
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
38
+ const headers = {};
39
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
40
+ return headers;
41
+ };
42
+ return request(getForceCloseLeaseUrl(eventId), {
43
+ ...options,
44
+ method: "DELETE",
45
+ headers: {
46
+ "Content-Type": "application/json",
47
+ ...getHeaders(options?.headers)
48
+ },
49
+ body: JSON.stringify(leaseCloseWrite)
50
+ });
51
+ };
52
+ //#endregion
53
+ export { forceCloseLease, getForceCloseLeaseUrl, getListLiveLeasesUrl, listLiveLeases };
54
+
55
+ //# sourceMappingURL=admin-consumption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-consumption.js","names":[],"sources":["../../src/api/admin-consumption/admin-consumption.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport type {\n LeaseCloseWrite,\n LiveLeaseListRead\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getListLiveLeasesUrl = () => {\n\n\n\n\n return `/admin/consumption/live`\n}\n\n/**\n * What is open right now, within the caller's tenant scope.\n *\n * Read from the ledger rather than the Redis live set: this is a diagnostic and\n * must show the truth even when the cache is cold, and it runs once when\n * somebody opens a screen rather than on every read.\n * @summary List Live Leases\n */\nexport const listLiveLeases = async ( options?: Parameters<typeof request>[1]): Promise<LiveLeaseListRead> => {\n\n return request<LiveLeaseListRead>(getListLiveLeasesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getForceCloseLeaseUrl = (eventId: number,) => {\n\n\n\n\n return `/admin/consumption/${eventId}`\n}\n\n/**\n * Force-close somebody else's lease. The legacy's ``FermeSessionAdherent``.\n *\n * Audited, which the legacy's was not: a button that ends a stranger's reading\n * session and leaves no trace is indistinguishable from abuse of the same\n * button. Tenant-scoped like every staff action, so a lease outside the\n * caller's scope is ``404`` rather than ``403``.\n * @summary Force Close Lease\n */\nexport const forceCloseLease = async (eventId: number,\n leaseCloseWrite: LeaseCloseWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<void>(getForceCloseLeaseUrl(eventId),\n {\n ...options,\n method: 'DELETE',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(leaseCloseWrite)\n }\n);}\n\n\n"],"mappings":";;;AAcA,MAAa,6BAA6B;CAKxC,OAAO;AACT;;;;;;;;;AAUA,MAAa,iBAAiB,OAAQ,YAAwE;CAE5G,OAAO,QAA2B,qBAAqB,GACvD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,yBAAyB,YAAqB;CAKzD,OAAO,sBAAsB;AAC/B;;;;;;;;;;AAWA,MAAa,kBAAkB,OAAO,SAClC,iBAAkC,YAA2D;CAE7F,MAAM,cAAc,MAAwF;EAC5G,IAAI,CAAC,GAAG,OAAO,CAAC;EAChB,IAAI,aAAa,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;EAC/D,IAAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAc,sBAAsB,OAAO,GAChD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,eAAe;CACtC,CACF;AAAE"}
@@ -0,0 +1,21 @@
1
+
2
+ import { $ as ReadPatronLicenseParams, R as StaffLicenseRead } from "../chunks/index.js";
3
+ import { c as request } from "../chunks/client.js";
4
+ //#region src/api/admin-licenses/admin-licenses.d.ts
5
+ export declare const getReadPatronLicenseUrl: (params: ReadPatronLicenseParams) => string;
6
+ /**
7
+ * Report one account's licence state. Never allocates, never repairs.
8
+ *
9
+ * Scoped like every other staff read: an agent who cannot see the account gets
10
+ * ``404``, the same answer as for an address nobody holds, so the endpoint
11
+ * cannot be used to test whether a member exists elsewhere.
12
+ *
13
+ * ``partner_active`` is ``None`` when the partner could not be reached. That is
14
+ * deliberately distinct from ``False`` — "we could not ask" and "they said the
15
+ * subscription is closed" lead a support agent to different actions, and
16
+ * collapsing them is how a working account gets re-provisioned.
17
+ * @summary Read Patron License
18
+ */
19
+ export declare const readPatronLicense: (params: ReadPatronLicenseParams, options?: Parameters<typeof request>[1]) => Promise<StaffLicenseRead>;
20
+ //#endregion
21
+ //# sourceMappingURL=admin-licenses.d.ts.map