@learnorama/mozaik-sdk 0.12.3-staging.46.1 → 0.13.0-staging.48.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 (266) hide show
  1. package/README.md +25 -0
  2. package/dist/api/account.d.ts +1 -1
  3. package/dist/api/account.js.map +1 -1
  4. package/dist/api/admin-catalogue.d.ts +1 -1
  5. package/dist/api/admin-catalogue.js.map +1 -1
  6. package/dist/api/admin-consumption.d.ts +1 -1
  7. package/dist/api/admin-consumption.js.map +1 -1
  8. package/dist/api/admin-contracts.d.ts +1 -1
  9. package/dist/api/admin-contracts.js.map +1 -1
  10. package/dist/api/admin-desk.d.ts +1 -1
  11. package/dist/api/admin-desk.js.map +1 -1
  12. package/dist/api/admin-licenses.d.ts +1 -1
  13. package/dist/api/admin-licenses.js.map +1 -1
  14. package/dist/api/admin-partner-selections.d.ts +1 -1
  15. package/dist/api/admin-partner-selections.js.map +1 -1
  16. package/dist/api/admin-patrons.d.ts +1 -1
  17. package/dist/api/admin-patrons.js.map +1 -1
  18. package/dist/api/admin-reviews.d.ts +1 -1
  19. package/dist/api/admin-reviews.js.map +1 -1
  20. package/dist/api/admin-roles.d.ts +1 -1
  21. package/dist/api/admin-roles.js.map +1 -1
  22. package/dist/api/admin-support.d.ts +1 -1
  23. package/dist/api/admin-support.js.map +1 -1
  24. package/dist/api/admin-tenants.d.ts +1 -1
  25. package/dist/api/admin-tenants.js.map +1 -1
  26. package/dist/api/admin-tutoring.d.ts +1 -1
  27. package/dist/api/admin-tutoring.js.map +1 -1
  28. package/dist/api/auth.d.ts +1 -1
  29. package/dist/api/auth.js.map +1 -1
  30. package/dist/api/biblio-billing-webhooks.d.ts +18 -0
  31. package/dist/api/biblio-billing-webhooks.js +62 -0
  32. package/dist/api/biblio-billing-webhooks.js.map +1 -0
  33. package/dist/api/biblio-billing.d.ts +192 -0
  34. package/dist/api/biblio-billing.js +645 -0
  35. package/dist/api/biblio-billing.js.map +1 -0
  36. package/dist/api/biblio-catalogue.d.ts +1 -1
  37. package/dist/api/biblio-catalogue.js.map +1 -1
  38. package/dist/api/biblio-home.d.ts +1 -1
  39. package/dist/api/biblio-home.js.map +1 -1
  40. package/dist/api/biblio-learning-author-profiles.d.ts +108 -0
  41. package/dist/api/biblio-learning-author-profiles.js +331 -0
  42. package/dist/api/biblio-learning-author-profiles.js.map +1 -0
  43. package/dist/api/biblio-learning-authoring.d.ts +168 -0
  44. package/dist/api/biblio-learning-authoring.js +586 -0
  45. package/dist/api/biblio-learning-authoring.js.map +1 -0
  46. package/dist/api/biblio-learning-editorial.d.ts +54 -0
  47. package/dist/api/biblio-learning-editorial.js +149 -0
  48. package/dist/api/biblio-learning-editorial.js.map +1 -0
  49. package/dist/api/biblio-learning-feedback.d.ts +60 -0
  50. package/dist/api/biblio-learning-feedback.js +180 -0
  51. package/dist/api/biblio-learning-feedback.js.map +1 -0
  52. package/dist/api/biblio-learning-finance.d.ts +186 -0
  53. package/dist/api/biblio-learning-finance.js +622 -0
  54. package/dist/api/biblio-learning-finance.js.map +1 -0
  55. package/dist/api/biblio-learning-integrations.d.ts +60 -0
  56. package/dist/api/biblio-learning-integrations.js +215 -0
  57. package/dist/api/biblio-learning-integrations.js.map +1 -0
  58. package/dist/api/biblio-learning-membership.d.ts +24 -0
  59. package/dist/api/biblio-learning-membership.js +69 -0
  60. package/dist/api/biblio-learning-membership.js.map +1 -0
  61. package/dist/api/biblio-learning.d.ts +222 -0
  62. package/dist/api/biblio-learning.js +697 -0
  63. package/dist/api/biblio-learning.js.map +1 -0
  64. package/dist/api/biblio-library.d.ts +1 -1
  65. package/dist/api/biblio-library.js.map +1 -1
  66. package/dist/api/biblio-nextory.d.ts +1 -1
  67. package/dist/api/biblio-nextory.js.map +1 -1
  68. package/dist/api/biblio-press.d.ts +1 -1
  69. package/dist/api/biblio-press.js.map +1 -1
  70. package/dist/api/biblio-search.d.ts +1 -1
  71. package/dist/api/biblio-search.js.map +1 -1
  72. package/dist/api/biblio-telemetry.d.ts +1 -1
  73. package/dist/api/biblio-telemetry.js.map +1 -1
  74. package/dist/api/consumption.d.ts +1 -1
  75. package/dist/api/consumption.js.map +1 -1
  76. package/dist/api/cvs-app.d.ts +1 -1
  77. package/dist/api/cvs-app.js.map +1 -1
  78. package/dist/api/cvs-documents.d.ts +1 -1
  79. package/dist/api/cvs-documents.js.map +1 -1
  80. package/dist/api/cvs-favorites.d.ts +1 -1
  81. package/dist/api/cvs-favorites.js.map +1 -1
  82. package/dist/api/cvs-ils.d.ts +1 -1
  83. package/dist/api/cvs-ils.js.map +1 -1
  84. package/dist/api/cvs-loans.d.ts +1 -1
  85. package/dist/api/cvs-loans.js.map +1 -1
  86. package/dist/api/cvs-payments.d.ts +1 -1
  87. package/dist/api/cvs-payments.js.map +1 -1
  88. package/dist/api/cvs-streaming.d.ts +1 -1
  89. package/dist/api/cvs-streaming.js.map +1 -1
  90. package/dist/api/index.d.ts +11 -1
  91. package/dist/api/index.js +11 -1
  92. package/dist/api/partner-catalogue.d.ts +1 -1
  93. package/dist/api/partner-catalogue.js.map +1 -1
  94. package/dist/api/partner-reader.d.ts +1 -1
  95. package/dist/api/partner-reader.js.map +1 -1
  96. package/dist/api/profiles.d.ts +1 -1
  97. package/dist/api/profiles.js.map +1 -1
  98. package/dist/api/search.d.ts +1 -1
  99. package/dist/api/search.js.map +1 -1
  100. package/dist/api/tutoring-catalogue.d.ts +1 -1
  101. package/dist/api/tutoring-catalogue.js.map +1 -1
  102. package/dist/api/tutoring-chat.d.ts +1 -1
  103. package/dist/api/tutoring-chat.js.map +1 -1
  104. package/dist/api/tutoring-dispatch.d.ts +1 -1
  105. package/dist/api/tutoring-dispatch.js.map +1 -1
  106. package/dist/api/tutoring-practitioner.d.ts +1 -1
  107. package/dist/api/tutoring-practitioner.js.map +1 -1
  108. package/dist/api/tutoring-requests.d.ts +1 -1
  109. package/dist/api/tutoring-requests.js.map +1 -1
  110. package/dist/chunks/client2.d.ts +1 -1
  111. package/dist/chunks/connection.d.ts +1 -1
  112. package/dist/chunks/index.d.ts +10062 -3487
  113. package/dist/index.d.ts +3 -3
  114. package/dist/index.js +3 -3
  115. package/dist/index.js.map +1 -1
  116. package/dist/models.d.ts +2 -2
  117. package/dist/models.js +329 -1
  118. package/dist/models.js.map +1 -1
  119. package/dist/react/account.d.ts +1 -1
  120. package/dist/react/account.js +1 -1
  121. package/dist/react/account.js.map +1 -1
  122. package/dist/react/admin-catalogue.d.ts +1 -1
  123. package/dist/react/admin-catalogue.js +1 -1
  124. package/dist/react/admin-catalogue.js.map +1 -1
  125. package/dist/react/admin-consumption.d.ts +1 -1
  126. package/dist/react/admin-consumption.js +1 -1
  127. package/dist/react/admin-consumption.js.map +1 -1
  128. package/dist/react/admin-contracts.d.ts +1 -1
  129. package/dist/react/admin-contracts.js +1 -1
  130. package/dist/react/admin-contracts.js.map +1 -1
  131. package/dist/react/admin-desk.d.ts +1 -1
  132. package/dist/react/admin-desk.js +1 -1
  133. package/dist/react/admin-desk.js.map +1 -1
  134. package/dist/react/admin-licenses.d.ts +1 -1
  135. package/dist/react/admin-licenses.js +1 -1
  136. package/dist/react/admin-licenses.js.map +1 -1
  137. package/dist/react/admin-partner-selections.d.ts +1 -1
  138. package/dist/react/admin-partner-selections.js +1 -1
  139. package/dist/react/admin-partner-selections.js.map +1 -1
  140. package/dist/react/admin-patrons.d.ts +1 -1
  141. package/dist/react/admin-patrons.js +1 -1
  142. package/dist/react/admin-patrons.js.map +1 -1
  143. package/dist/react/admin-reviews.d.ts +1 -1
  144. package/dist/react/admin-reviews.js +1 -1
  145. package/dist/react/admin-reviews.js.map +1 -1
  146. package/dist/react/admin-roles.d.ts +1 -1
  147. package/dist/react/admin-roles.js +1 -1
  148. package/dist/react/admin-roles.js.map +1 -1
  149. package/dist/react/admin-support.d.ts +1 -1
  150. package/dist/react/admin-support.js +1 -1
  151. package/dist/react/admin-support.js.map +1 -1
  152. package/dist/react/admin-tenants.d.ts +1 -1
  153. package/dist/react/admin-tenants.js +1 -1
  154. package/dist/react/admin-tenants.js.map +1 -1
  155. package/dist/react/admin-tutoring.d.ts +1 -1
  156. package/dist/react/admin-tutoring.js +1 -1
  157. package/dist/react/admin-tutoring.js.map +1 -1
  158. package/dist/react/auth.d.ts +1 -1
  159. package/dist/react/auth.js +1 -1
  160. package/dist/react/auth.js.map +1 -1
  161. package/dist/react/biblio-billing-webhooks.d.ts +56 -0
  162. package/dist/react/biblio-billing-webhooks.js +126 -0
  163. package/dist/react/biblio-billing-webhooks.js.map +1 -0
  164. package/dist/react/biblio-billing.d.ts +876 -0
  165. package/dist/react/biblio-billing.js +1491 -0
  166. package/dist/react/biblio-billing.js.map +1 -0
  167. package/dist/react/biblio-catalogue.d.ts +1 -1
  168. package/dist/react/biblio-catalogue.js +1 -1
  169. package/dist/react/biblio-catalogue.js.map +1 -1
  170. package/dist/react/biblio-home.d.ts +1 -1
  171. package/dist/react/biblio-home.js +1 -1
  172. package/dist/react/biblio-home.js.map +1 -1
  173. package/dist/react/biblio-learning-author-profiles.d.ts +513 -0
  174. package/dist/react/biblio-learning-author-profiles.js +795 -0
  175. package/dist/react/biblio-learning-author-profiles.js.map +1 -0
  176. package/dist/react/biblio-learning-authoring.d.ts +745 -0
  177. package/dist/react/biblio-learning-authoring.js +1335 -0
  178. package/dist/react/biblio-learning-authoring.js.map +1 -0
  179. package/dist/react/biblio-learning-editorial.d.ts +264 -0
  180. package/dist/react/biblio-learning-editorial.js +371 -0
  181. package/dist/react/biblio-learning-editorial.js.map +1 -0
  182. package/dist/react/biblio-learning-feedback.d.ts +280 -0
  183. package/dist/react/biblio-learning-feedback.js +433 -0
  184. package/dist/react/biblio-learning-feedback.js.map +1 -0
  185. package/dist/react/biblio-learning-finance.d.ts +868 -0
  186. package/dist/react/biblio-learning-finance.js +1439 -0
  187. package/dist/react/biblio-learning-finance.js.map +1 -0
  188. package/dist/react/biblio-learning-integrations.d.ts +237 -0
  189. package/dist/react/biblio-learning-integrations.js +483 -0
  190. package/dist/react/biblio-learning-integrations.js.map +1 -0
  191. package/dist/react/biblio-learning-membership.d.ts +99 -0
  192. package/dist/react/biblio-learning-membership.js +165 -0
  193. package/dist/react/biblio-learning-membership.js.map +1 -0
  194. package/dist/react/biblio-learning.d.ts +1047 -0
  195. package/dist/react/biblio-learning.js +1667 -0
  196. package/dist/react/biblio-learning.js.map +1 -0
  197. package/dist/react/biblio-library.d.ts +1 -1
  198. package/dist/react/biblio-library.js +1 -1
  199. package/dist/react/biblio-library.js.map +1 -1
  200. package/dist/react/biblio-nextory.d.ts +1 -1
  201. package/dist/react/biblio-nextory.js +1 -1
  202. package/dist/react/biblio-nextory.js.map +1 -1
  203. package/dist/react/biblio-press.d.ts +1 -1
  204. package/dist/react/biblio-press.js +1 -1
  205. package/dist/react/biblio-press.js.map +1 -1
  206. package/dist/react/biblio-search.d.ts +1 -1
  207. package/dist/react/biblio-search.js +1 -1
  208. package/dist/react/biblio-search.js.map +1 -1
  209. package/dist/react/biblio-telemetry.d.ts +1 -1
  210. package/dist/react/biblio-telemetry.js +1 -1
  211. package/dist/react/biblio-telemetry.js.map +1 -1
  212. package/dist/react/chat.d.ts +1 -1
  213. package/dist/react/consumption.d.ts +1 -1
  214. package/dist/react/consumption.js +1 -1
  215. package/dist/react/consumption.js.map +1 -1
  216. package/dist/react/cvs-app.d.ts +1 -1
  217. package/dist/react/cvs-app.js +1 -1
  218. package/dist/react/cvs-app.js.map +1 -1
  219. package/dist/react/cvs-documents.d.ts +1 -1
  220. package/dist/react/cvs-documents.js +1 -1
  221. package/dist/react/cvs-documents.js.map +1 -1
  222. package/dist/react/cvs-favorites.d.ts +1 -1
  223. package/dist/react/cvs-favorites.js +1 -1
  224. package/dist/react/cvs-favorites.js.map +1 -1
  225. package/dist/react/cvs-ils.d.ts +1 -1
  226. package/dist/react/cvs-ils.js +1 -1
  227. package/dist/react/cvs-ils.js.map +1 -1
  228. package/dist/react/cvs-loans.d.ts +1 -1
  229. package/dist/react/cvs-loans.js +1 -1
  230. package/dist/react/cvs-loans.js.map +1 -1
  231. package/dist/react/cvs-payments.d.ts +1 -1
  232. package/dist/react/cvs-payments.js +1 -1
  233. package/dist/react/cvs-payments.js.map +1 -1
  234. package/dist/react/cvs-streaming.d.ts +1 -1
  235. package/dist/react/cvs-streaming.js +1 -1
  236. package/dist/react/cvs-streaming.js.map +1 -1
  237. package/dist/react/index.d.ts +11 -1
  238. package/dist/react/index.js +11 -1
  239. package/dist/react/partner-catalogue.d.ts +1 -1
  240. package/dist/react/partner-catalogue.js +1 -1
  241. package/dist/react/partner-catalogue.js.map +1 -1
  242. package/dist/react/partner-reader.d.ts +1 -1
  243. package/dist/react/partner-reader.js +1 -1
  244. package/dist/react/partner-reader.js.map +1 -1
  245. package/dist/react/profiles.d.ts +1 -1
  246. package/dist/react/profiles.js +1 -1
  247. package/dist/react/profiles.js.map +1 -1
  248. package/dist/react/search.d.ts +1 -1
  249. package/dist/react/search.js +1 -1
  250. package/dist/react/search.js.map +1 -1
  251. package/dist/react/tutoring-catalogue.d.ts +1 -1
  252. package/dist/react/tutoring-catalogue.js +1 -1
  253. package/dist/react/tutoring-catalogue.js.map +1 -1
  254. package/dist/react/tutoring-chat.d.ts +1 -1
  255. package/dist/react/tutoring-chat.js +1 -1
  256. package/dist/react/tutoring-chat.js.map +1 -1
  257. package/dist/react/tutoring-dispatch.d.ts +1 -1
  258. package/dist/react/tutoring-dispatch.js +1 -1
  259. package/dist/react/tutoring-dispatch.js.map +1 -1
  260. package/dist/react/tutoring-practitioner.d.ts +1 -1
  261. package/dist/react/tutoring-practitioner.js +1 -1
  262. package/dist/react/tutoring-practitioner.js.map +1 -1
  263. package/dist/react/tutoring-requests.d.ts +1 -1
  264. package/dist/react/tutoring-requests.js +1 -1
  265. package/dist/react/tutoring-requests.js.map +1 -1
  266. package/package.json +7 -7
@@ -0,0 +1,1335 @@
1
+ "use client";
2
+ import { r as request } from "../chunks/client.js";
3
+ import { useMutation, useQuery } from "@tanstack/react-query";
4
+ //#region src/react/biblio-learning-authoring/biblio-learning-authoring.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.13.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 getLearningListAuthorCataloguesUrl = () => {
25
+ return `/learning/author/catalogues`;
26
+ };
27
+ /**
28
+ * Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Lists active catalogues with creation, review or finance authority. Review permission also enables creation; finance permission alone does not. The collection is ordered by catalogue ID and is not paginated.
29
+ * @summary List my authoring catalogues
30
+ */
31
+ const learningListAuthorCatalogues = async (options) => {
32
+ return request(getLearningListAuthorCataloguesUrl(), {
33
+ ...options,
34
+ method: "GET"
35
+ });
36
+ };
37
+ const getLearningListAuthorCataloguesQueryKey = () => {
38
+ return [`/learning/author/catalogues`];
39
+ };
40
+ const getLearningListAuthorCataloguesQueryOptions = (options) => {
41
+ const { query: queryOptions, request: requestOptions } = options ?? {};
42
+ const queryKey = queryOptions?.queryKey ?? getLearningListAuthorCataloguesQueryKey();
43
+ const queryFn = ({ signal }) => learningListAuthorCatalogues({
44
+ signal,
45
+ ...requestOptions
46
+ });
47
+ return {
48
+ queryKey,
49
+ queryFn,
50
+ ...queryOptions
51
+ };
52
+ };
53
+ /**
54
+ * @summary List my authoring catalogues
55
+ */
56
+ function useLearningListAuthorCatalogues(options, queryClient) {
57
+ const queryOptions = getLearningListAuthorCataloguesQueryOptions(options);
58
+ const query = useQuery(queryOptions, queryClient);
59
+ return withQueryKey(query, queryOptions.queryKey);
60
+ }
61
+ const getLearningCreateAuthorCatalogueUrl = () => {
62
+ return `/learning/author/catalogues`;
63
+ };
64
+ /**
65
+ * Requires global catalogue write authority and rejects support impersonation. Creates an active authoring catalogue; the returned capability flags describe the operator making this request.
66
+ * @summary Create a learning catalogue
67
+ */
68
+ const learningCreateAuthorCatalogue = async (learningCatalogueWrite, options) => {
69
+ const getHeaders = (h) => {
70
+ if (!h) return {};
71
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
72
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
73
+ const headers = {};
74
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
75
+ return headers;
76
+ };
77
+ return request(getLearningCreateAuthorCatalogueUrl(), {
78
+ ...options,
79
+ method: "POST",
80
+ headers: {
81
+ "Content-Type": "application/json",
82
+ ...getHeaders(options?.headers)
83
+ },
84
+ body: JSON.stringify(learningCatalogueWrite)
85
+ });
86
+ };
87
+ const getLearningCreateAuthorCatalogueMutationKey = () => ["learningCreateAuthorCatalogue"];
88
+ const getLearningCreateAuthorCatalogueMutationOptions = (options) => {
89
+ const mutationKey = getLearningCreateAuthorCatalogueMutationKey();
90
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
91
+ ...options,
92
+ mutation: {
93
+ ...options.mutation,
94
+ mutationKey
95
+ }
96
+ } : {
97
+ mutation: { mutationKey },
98
+ request: void 0
99
+ };
100
+ const mutationFn = (props) => {
101
+ const { data } = props ?? {};
102
+ return learningCreateAuthorCatalogue(data, requestOptions);
103
+ };
104
+ return {
105
+ mutationFn,
106
+ ...mutationOptions
107
+ };
108
+ };
109
+ /**
110
+ * @summary Create a learning catalogue
111
+ */
112
+ const useLearningCreateAuthorCatalogue = (options, queryClient) => {
113
+ return useMutation(getLearningCreateAuthorCatalogueMutationOptions(options), queryClient);
114
+ };
115
+ const getLearningSetCatalogueAuthorityUrl = (catalogueId) => {
116
+ return `/learning/author/catalogues/${catalogueId}/authority`;
117
+ };
118
+ /**
119
+ * Requires global catalogue write authority. Replaces all three grants for the selected active independent account, including revocation when all flags are false. The reason is recorded for audit. Successful updates return 204 with no response body.
120
+ * @summary Replace an author's catalogue permissions
121
+ */
122
+ const learningSetCatalogueAuthority = async (catalogueId, learningCatalogueGrantWrite, options) => {
123
+ const getHeaders = (h) => {
124
+ if (!h) return {};
125
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
126
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
127
+ const headers = {};
128
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
129
+ return headers;
130
+ };
131
+ return request(getLearningSetCatalogueAuthorityUrl(catalogueId), {
132
+ ...options,
133
+ method: "PUT",
134
+ headers: {
135
+ "Content-Type": "application/json",
136
+ ...getHeaders(options?.headers)
137
+ },
138
+ body: JSON.stringify(learningCatalogueGrantWrite)
139
+ });
140
+ };
141
+ const getLearningSetCatalogueAuthorityMutationKey = () => ["learningSetCatalogueAuthority"];
142
+ const getLearningSetCatalogueAuthorityMutationOptions = (options) => {
143
+ const mutationKey = getLearningSetCatalogueAuthorityMutationKey();
144
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
145
+ ...options,
146
+ mutation: {
147
+ ...options.mutation,
148
+ mutationKey
149
+ }
150
+ } : {
151
+ mutation: { mutationKey },
152
+ request: void 0
153
+ };
154
+ const mutationFn = (props) => {
155
+ const { catalogueId, data } = props ?? {};
156
+ return learningSetCatalogueAuthority(catalogueId, data, requestOptions);
157
+ };
158
+ return {
159
+ mutationFn,
160
+ ...mutationOptions
161
+ };
162
+ };
163
+ /**
164
+ * @summary Replace an author's catalogue permissions
165
+ */
166
+ const useLearningSetCatalogueAuthority = (options, queryClient) => {
167
+ return useMutation(getLearningSetCatalogueAuthorityMutationOptions(options), queryClient);
168
+ };
169
+ const getLearningListAuthorCoursesUrl = (params) => {
170
+ const normalizedParams = new URLSearchParams();
171
+ Object.entries(params || {}).forEach(([key, value]) => {
172
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
173
+ });
174
+ const stringifiedParams = normalizedParams.toString();
175
+ return stringifiedParams.length > 0 ? `/learning/author/courses?${stringifiedParams}` : `/learning/author/courses`;
176
+ };
177
+ /**
178
+ * Returns courses assigned to the effective author and courses in active catalogues they may review. Global administrators and support readers can see all courses. Dependent profiles and support impersonation are refused. Pagination counts this authorized scope and sorts by course ID ascending; draft courses are included.
179
+ * @summary List courses available to the author
180
+ */
181
+ const learningListAuthorCourses = async (params, options) => {
182
+ return request(getLearningListAuthorCoursesUrl(params), {
183
+ ...options,
184
+ method: "GET"
185
+ });
186
+ };
187
+ const getLearningListAuthorCoursesQueryKey = (params) => {
188
+ return [`/learning/author/courses`, ...params ? [params] : []];
189
+ };
190
+ const getLearningListAuthorCoursesQueryOptions = (params, options) => {
191
+ const { query: queryOptions, request: requestOptions } = options ?? {};
192
+ const queryKey = queryOptions?.queryKey ?? getLearningListAuthorCoursesQueryKey(params);
193
+ const queryFn = ({ signal }) => learningListAuthorCourses(params, {
194
+ signal,
195
+ ...requestOptions
196
+ });
197
+ return {
198
+ queryKey,
199
+ queryFn,
200
+ ...queryOptions
201
+ };
202
+ };
203
+ /**
204
+ * @summary List courses available to the author
205
+ */
206
+ function useLearningListAuthorCourses(params, options, queryClient) {
207
+ const queryOptions = getLearningListAuthorCoursesQueryOptions(params, options);
208
+ const query = useQuery(queryOptions, queryClient);
209
+ return withQueryKey(query, queryOptions.queryKey);
210
+ }
211
+ const getLearningCreateCourseUrl = () => {
212
+ return `/learning/author/courses`;
213
+ };
214
+ /**
215
+ * Create an inactive course from a title in an authorized catalogue, then register media and create an edition. Binding an existing catalogue contentId, or creating without catalogueId, requires global administration. Assigning other authors requires curator authority. Publication activates a new course; this request alone does not make it readable.
216
+ * @summary Create a native course shell
217
+ */
218
+ const learningCreateCourse = async (learningCourseCreateWrite, options) => {
219
+ const getHeaders = (h) => {
220
+ if (!h) return {};
221
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
222
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
223
+ const headers = {};
224
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
225
+ return headers;
226
+ };
227
+ return request(getLearningCreateCourseUrl(), {
228
+ ...options,
229
+ method: "POST",
230
+ headers: {
231
+ "Content-Type": "application/json",
232
+ ...getHeaders(options?.headers)
233
+ },
234
+ body: JSON.stringify(learningCourseCreateWrite)
235
+ });
236
+ };
237
+ const getLearningCreateCourseMutationKey = () => ["learningCreateCourse"];
238
+ const getLearningCreateCourseMutationOptions = (options) => {
239
+ const mutationKey = getLearningCreateCourseMutationKey();
240
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
241
+ ...options,
242
+ mutation: {
243
+ ...options.mutation,
244
+ mutationKey
245
+ }
246
+ } : {
247
+ mutation: { mutationKey },
248
+ request: void 0
249
+ };
250
+ const mutationFn = (props) => {
251
+ const { data } = props ?? {};
252
+ return learningCreateCourse(data, requestOptions);
253
+ };
254
+ return {
255
+ mutationFn,
256
+ ...mutationOptions
257
+ };
258
+ };
259
+ /**
260
+ * @summary Create a native course shell
261
+ */
262
+ const useLearningCreateCourse = (options, queryClient) => {
263
+ return useMutation(getLearningCreateCourseMutationOptions(options), queryClient);
264
+ };
265
+ const getLearningUpdateCourseSettingsUrl = (courseId) => {
266
+ return `/learning/author/courses/${courseId}`;
267
+ };
268
+ /**
269
+ * Requires course curator or global administrator authority and an audit reason. Non-null scalar fields replace their current values; null or omitted values leave them unchanged. authorIds replaces the complete author set, including clearing it with an empty list. A course must have a published edition before isActive can be true.
270
+ * @summary Update publication and author settings
271
+ */
272
+ const learningUpdateCourseSettings = async (courseId, learningCourseSettingsWrite, options) => {
273
+ const getHeaders = (h) => {
274
+ if (!h) return {};
275
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
276
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
277
+ const headers = {};
278
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
279
+ return headers;
280
+ };
281
+ return request(getLearningUpdateCourseSettingsUrl(courseId), {
282
+ ...options,
283
+ method: "PATCH",
284
+ headers: {
285
+ "Content-Type": "application/json",
286
+ ...getHeaders(options?.headers)
287
+ },
288
+ body: JSON.stringify(learningCourseSettingsWrite)
289
+ });
290
+ };
291
+ const getLearningUpdateCourseSettingsMutationKey = () => ["learningUpdateCourseSettings"];
292
+ const getLearningUpdateCourseSettingsMutationOptions = (options) => {
293
+ const mutationKey = getLearningUpdateCourseSettingsMutationKey();
294
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
295
+ ...options,
296
+ mutation: {
297
+ ...options.mutation,
298
+ mutationKey
299
+ }
300
+ } : {
301
+ mutation: { mutationKey },
302
+ request: void 0
303
+ };
304
+ const mutationFn = (props) => {
305
+ const { courseId, data } = props ?? {};
306
+ return learningUpdateCourseSettings(courseId, data, requestOptions);
307
+ };
308
+ return {
309
+ mutationFn,
310
+ ...mutationOptions
311
+ };
312
+ };
313
+ /**
314
+ * @summary Update publication and author settings
315
+ */
316
+ const useLearningUpdateCourseSettings = (options, queryClient) => {
317
+ return useMutation(getLearningUpdateCourseSettingsMutationOptions(options), queryClient);
318
+ };
319
+ const getLearningRegisterAssetUrl = (courseId) => {
320
+ return `/learning/author/courses/${courseId}/assets`;
321
+ };
322
+ /**
323
+ * Requires edit authority on the course. Registers an immutable media reference for use in edition definitions. Vimeo requires a numeric video ID; external resources require HTTPS without credentials; HTML is sanitized; storage keys must identify an existing object under this author's learning prefix. The response identifies the asset and does not issue a playback URL. For new file bytes use the upload reservation workflow.
324
+ * @summary Register a course media resource
325
+ */
326
+ const learningRegisterAsset = async (courseId, learningAssetWrite, options) => {
327
+ const getHeaders = (h) => {
328
+ if (!h) return {};
329
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
330
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
331
+ const headers = {};
332
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
333
+ return headers;
334
+ };
335
+ return request(getLearningRegisterAssetUrl(courseId), {
336
+ ...options,
337
+ method: "POST",
338
+ headers: {
339
+ "Content-Type": "application/json",
340
+ ...getHeaders(options?.headers)
341
+ },
342
+ body: JSON.stringify(learningAssetWrite)
343
+ });
344
+ };
345
+ const getLearningRegisterAssetMutationKey = () => ["learningRegisterAsset"];
346
+ const getLearningRegisterAssetMutationOptions = (options) => {
347
+ const mutationKey = getLearningRegisterAssetMutationKey();
348
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
349
+ ...options,
350
+ mutation: {
351
+ ...options.mutation,
352
+ mutationKey
353
+ }
354
+ } : {
355
+ mutation: { mutationKey },
356
+ request: void 0
357
+ };
358
+ const mutationFn = (props) => {
359
+ const { courseId, data } = props ?? {};
360
+ return learningRegisterAsset(courseId, data, requestOptions);
361
+ };
362
+ return {
363
+ mutationFn,
364
+ ...mutationOptions
365
+ };
366
+ };
367
+ /**
368
+ * @summary Register a course media resource
369
+ */
370
+ const useLearningRegisterAsset = (options, queryClient) => {
371
+ return useMutation(getLearningRegisterAssetMutationOptions(options), queryClient);
372
+ };
373
+ const getLearningAttachCaptionsUrl = (courseId, assetId) => {
374
+ return `/learning/author/courses/${courseId}/assets/${assetId}/captions`;
375
+ };
376
+ /**
377
+ * Requires course edit authority. First upload validated UTF-8 WebVTT to the same course, then reference its asset ID here. Returns a new immutable media variant; existing editions keep their original asset. Repeating the original asset, caption asset and language returns the existing variant. Put the returned assetId into a draft edition to publish the captions.
378
+ * @summary Create a captioned variant of course audio or video
379
+ */
380
+ const learningAttachCaptions = async (courseId, assetId, learningCaptionWrite, options) => {
381
+ const getHeaders = (h) => {
382
+ if (!h) return {};
383
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
384
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
385
+ const headers = {};
386
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
387
+ return headers;
388
+ };
389
+ return request(getLearningAttachCaptionsUrl(courseId, assetId), {
390
+ ...options,
391
+ method: "POST",
392
+ headers: {
393
+ "Content-Type": "application/json",
394
+ ...getHeaders(options?.headers)
395
+ },
396
+ body: JSON.stringify(learningCaptionWrite)
397
+ });
398
+ };
399
+ const getLearningAttachCaptionsMutationKey = () => ["learningAttachCaptions"];
400
+ const getLearningAttachCaptionsMutationOptions = (options) => {
401
+ const mutationKey = getLearningAttachCaptionsMutationKey();
402
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
403
+ ...options,
404
+ mutation: {
405
+ ...options.mutation,
406
+ mutationKey
407
+ }
408
+ } : {
409
+ mutation: { mutationKey },
410
+ request: void 0
411
+ };
412
+ const mutationFn = (props) => {
413
+ const { courseId, assetId, data } = props ?? {};
414
+ return learningAttachCaptions(courseId, assetId, data, requestOptions);
415
+ };
416
+ return {
417
+ mutationFn,
418
+ ...mutationOptions
419
+ };
420
+ };
421
+ /**
422
+ * @summary Create a captioned variant of course audio or video
423
+ */
424
+ const useLearningAttachCaptions = (options, queryClient) => {
425
+ return useMutation(getLearningAttachCaptionsMutationOptions(options), queryClient);
426
+ };
427
+ const getLearningListRevisionsUrl = (courseId, params) => {
428
+ const normalizedParams = new URLSearchParams();
429
+ Object.entries(params || {}).forEach(([key, value]) => {
430
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
431
+ });
432
+ const stringifiedParams = normalizedParams.toString();
433
+ return stringifiedParams.length > 0 ? `/learning/author/courses/${courseId}/revisions?${stringifiedParams}` : `/learning/author/courses/${courseId}/revisions`;
434
+ };
435
+ /**
436
+ * Requires read authority on this course. Returns draft, submitted, published, rejected and superseded editions, newest version first. version identifies the course edition; editVersion is the optimistic concurrency counter within a working edition.
437
+ * @summary List the course's edition history
438
+ */
439
+ const learningListRevisions = async (courseId, params, options) => {
440
+ return request(getLearningListRevisionsUrl(courseId, params), {
441
+ ...options,
442
+ method: "GET"
443
+ });
444
+ };
445
+ const getLearningListRevisionsQueryKey = (courseId, params) => {
446
+ return [`/learning/author/courses/${courseId}/revisions`, ...params ? [params] : []];
447
+ };
448
+ const getLearningListRevisionsQueryOptions = (courseId, params, options) => {
449
+ const { query: queryOptions, request: requestOptions } = options ?? {};
450
+ const queryKey = queryOptions?.queryKey ?? getLearningListRevisionsQueryKey(courseId, params);
451
+ const queryFn = ({ signal }) => learningListRevisions(courseId, params, {
452
+ signal,
453
+ ...requestOptions
454
+ });
455
+ return {
456
+ queryKey,
457
+ queryFn,
458
+ enabled: courseId !== null && courseId !== void 0,
459
+ ...queryOptions
460
+ };
461
+ };
462
+ /**
463
+ * @summary List the course's edition history
464
+ */
465
+ function useLearningListRevisions(courseId, params, options, queryClient) {
466
+ const queryOptions = getLearningListRevisionsQueryOptions(courseId, params, options);
467
+ const query = useQuery(queryOptions, queryClient);
468
+ return withQueryKey(query, queryOptions.queryKey);
469
+ }
470
+ const getLearningCreateRevisionUrl = (courseId) => {
471
+ return `/learning/author/courses/${courseId}/revisions`;
472
+ };
473
+ /**
474
+ * Requires course edit authority. Creates a complete edition with the next version number; only one draft or submitted edition may exist for a course. Asset and library references must be available to this course. Chapters contain 1–2000 lessons with unique keys across the edition; the serialized authoring definition is limited to 2,000,000 bytes. Published editions and existing enrollments remain pinned to their definitions.
475
+ * @summary Create the next draft edition
476
+ */
477
+ const learningCreateRevision = async (courseId, courseRevisionWriteInput, options) => {
478
+ const getHeaders = (h) => {
479
+ if (!h) return {};
480
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
481
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
482
+ const headers = {};
483
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
484
+ return headers;
485
+ };
486
+ return request(getLearningCreateRevisionUrl(courseId), {
487
+ ...options,
488
+ method: "POST",
489
+ headers: {
490
+ "Content-Type": "application/json",
491
+ ...getHeaders(options?.headers)
492
+ },
493
+ body: JSON.stringify(courseRevisionWriteInput)
494
+ });
495
+ };
496
+ const getLearningCreateRevisionMutationKey = () => ["learningCreateRevision"];
497
+ const getLearningCreateRevisionMutationOptions = (options) => {
498
+ const mutationKey = getLearningCreateRevisionMutationKey();
499
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
500
+ ...options,
501
+ mutation: {
502
+ ...options.mutation,
503
+ mutationKey
504
+ }
505
+ } : {
506
+ mutation: { mutationKey },
507
+ request: void 0
508
+ };
509
+ const mutationFn = (props) => {
510
+ const { courseId, data } = props ?? {};
511
+ return learningCreateRevision(courseId, data, requestOptions);
512
+ };
513
+ return {
514
+ mutationFn,
515
+ ...mutationOptions
516
+ };
517
+ };
518
+ /**
519
+ * @summary Create the next draft edition
520
+ */
521
+ const useLearningCreateRevision = (options, queryClient) => {
522
+ return useMutation(getLearningCreateRevisionMutationOptions(options), queryClient);
523
+ };
524
+ const getLearningReadAuthorRevisionUrl = (courseId, revisionId) => {
525
+ return `/learning/author/courses/${courseId}/revisions/${revisionId}`;
526
+ };
527
+ /**
528
+ * Requires authoring read authority and checks that revisionId belongs to courseId. Returns editorial content, lessons, resources, vocabularies and private assessment solutions. Read revision.editVersion before replacing a changed definition. This author-only representation includes grading keys that are deliberately absent from reader questions.
529
+ * @summary Read a complete editable edition definition
530
+ */
531
+ const learningReadAuthorRevision = async (courseId, revisionId, options) => {
532
+ return request(getLearningReadAuthorRevisionUrl(courseId, revisionId), {
533
+ ...options,
534
+ method: "GET"
535
+ });
536
+ };
537
+ const getLearningReadAuthorRevisionQueryKey = (courseId, revisionId) => {
538
+ return [`/learning/author/courses/${courseId}/revisions/${revisionId}`];
539
+ };
540
+ const getLearningReadAuthorRevisionQueryOptions = (courseId, revisionId, options) => {
541
+ const { query: queryOptions, request: requestOptions } = options ?? {};
542
+ const queryKey = queryOptions?.queryKey ?? getLearningReadAuthorRevisionQueryKey(courseId, revisionId);
543
+ const queryFn = ({ signal }) => learningReadAuthorRevision(courseId, revisionId, {
544
+ signal,
545
+ ...requestOptions
546
+ });
547
+ return {
548
+ queryKey,
549
+ queryFn,
550
+ enabled: courseId !== null && courseId !== void 0 && revisionId !== null && revisionId !== void 0,
551
+ ...queryOptions
552
+ };
553
+ };
554
+ /**
555
+ * @summary Read a complete editable edition definition
556
+ */
557
+ function useLearningReadAuthorRevision(courseId, revisionId, options, queryClient) {
558
+ const queryOptions = getLearningReadAuthorRevisionQueryOptions(courseId, revisionId, options);
559
+ const query = useQuery(queryOptions, queryClient);
560
+ return withQueryKey(query, queryOptions.queryKey);
561
+ }
562
+ const getLearningReplaceRevisionUrl = (courseId, revisionId) => {
563
+ return `/learning/author/courses/${courseId}/revisions/${revisionId}`;
564
+ };
565
+ /**
566
+ * Replaces the entire editorial and lesson graph of a draft or rejected edition. Send the editVersion last read as expectedEditVersion. An identical definition is an idempotent replay; a changed definition requires a matching version and increments editVersion. A changed rejected edition returns to draft and clears its review note and submission date. Published and submitted editions cannot be edited.
567
+ * @summary Replace a draft edition with concurrency protection
568
+ */
569
+ const learningReplaceRevision = async (courseId, revisionId, courseRevisionWriteInput, options) => {
570
+ const getHeaders = (h) => {
571
+ if (!h) return {};
572
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
573
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
574
+ const headers = {};
575
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
576
+ return headers;
577
+ };
578
+ return request(getLearningReplaceRevisionUrl(courseId, revisionId), {
579
+ ...options,
580
+ method: "PUT",
581
+ headers: {
582
+ "Content-Type": "application/json",
583
+ ...getHeaders(options?.headers)
584
+ },
585
+ body: JSON.stringify(courseRevisionWriteInput)
586
+ });
587
+ };
588
+ const getLearningReplaceRevisionMutationKey = () => ["learningReplaceRevision"];
589
+ const getLearningReplaceRevisionMutationOptions = (options) => {
590
+ const mutationKey = getLearningReplaceRevisionMutationKey();
591
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
592
+ ...options,
593
+ mutation: {
594
+ ...options.mutation,
595
+ mutationKey
596
+ }
597
+ } : {
598
+ mutation: { mutationKey },
599
+ request: void 0
600
+ };
601
+ const mutationFn = (props) => {
602
+ const { courseId, revisionId, data } = props ?? {};
603
+ return learningReplaceRevision(courseId, revisionId, data, requestOptions);
604
+ };
605
+ return {
606
+ mutationFn,
607
+ ...mutationOptions
608
+ };
609
+ };
610
+ /**
611
+ * @summary Replace a draft edition with concurrency protection
612
+ */
613
+ const useLearningReplaceRevision = (options, queryClient) => {
614
+ return useMutation(getLearningReplaceRevisionMutationOptions(options), queryClient);
615
+ };
616
+ const getLearningReviewRevisionUrl = (courseId, revisionId) => {
617
+ return `/learning/author/courses/${courseId}/revisions/${revisionId}/review`;
618
+ };
619
+ /**
620
+ * Requires course curator or global administrator authority. Approval revalidates materials, publishes this edition, supersedes its published predecessor, updates catalogue editorial fields and activates the course. Existing readers retain their selected edition until they explicitly upgrade. Rejection returns the edition for editing. Every decision requires a review note; repeated decisions return 409 once the edition leaves submitted.
621
+ * @summary Publish or reject a submitted edition
622
+ */
623
+ const learningReviewRevision = async (courseId, revisionId, courseReviewWrite, options) => {
624
+ const getHeaders = (h) => {
625
+ if (!h) return {};
626
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
627
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
628
+ const headers = {};
629
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
630
+ return headers;
631
+ };
632
+ return request(getLearningReviewRevisionUrl(courseId, revisionId), {
633
+ ...options,
634
+ method: "POST",
635
+ headers: {
636
+ "Content-Type": "application/json",
637
+ ...getHeaders(options?.headers)
638
+ },
639
+ body: JSON.stringify(courseReviewWrite)
640
+ });
641
+ };
642
+ const getLearningReviewRevisionMutationKey = () => ["learningReviewRevision"];
643
+ const getLearningReviewRevisionMutationOptions = (options) => {
644
+ const mutationKey = getLearningReviewRevisionMutationKey();
645
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
646
+ ...options,
647
+ mutation: {
648
+ ...options.mutation,
649
+ mutationKey
650
+ }
651
+ } : {
652
+ mutation: { mutationKey },
653
+ request: void 0
654
+ };
655
+ const mutationFn = (props) => {
656
+ const { courseId, revisionId, data } = props ?? {};
657
+ return learningReviewRevision(courseId, revisionId, data, requestOptions);
658
+ };
659
+ return {
660
+ mutationFn,
661
+ ...mutationOptions
662
+ };
663
+ };
664
+ /**
665
+ * @summary Publish or reject a submitted edition
666
+ */
667
+ const useLearningReviewRevision = (options, queryClient) => {
668
+ return useMutation(getLearningReviewRevisionMutationOptions(options), queryClient);
669
+ };
670
+ const getLearningSubmitRevisionUrl = (courseId, revisionId) => {
671
+ return `/learning/author/courses/${courseId}/revisions/${revisionId}/submit`;
672
+ };
673
+ /**
674
+ * Requires course edit authority. Moves draft to submitted and records submittedAt; reviewers can then approve or reject it. Submission locks the definition against editing. This transition is not replay-idempotent: submitting an already submitted edition returns 409.
675
+ * @summary Submit a draft edition for review
676
+ */
677
+ const learningSubmitRevision = async (courseId, revisionId, options) => {
678
+ return request(getLearningSubmitRevisionUrl(courseId, revisionId), {
679
+ ...options,
680
+ method: "POST"
681
+ });
682
+ };
683
+ const getLearningSubmitRevisionMutationKey = () => ["learningSubmitRevision"];
684
+ const getLearningSubmitRevisionMutationOptions = (options) => {
685
+ const mutationKey = getLearningSubmitRevisionMutationKey();
686
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
687
+ ...options,
688
+ mutation: {
689
+ ...options.mutation,
690
+ mutationKey
691
+ }
692
+ } : {
693
+ mutation: { mutationKey },
694
+ request: void 0
695
+ };
696
+ const mutationFn = (props) => {
697
+ const { courseId, revisionId } = props ?? {};
698
+ return learningSubmitRevision(courseId, revisionId, requestOptions);
699
+ };
700
+ return {
701
+ mutationFn,
702
+ ...mutationOptions
703
+ };
704
+ };
705
+ /**
706
+ * @summary Submit a draft edition for review
707
+ */
708
+ const useLearningSubmitRevision = (options, queryClient) => {
709
+ return useMutation(getLearningSubmitRevisionMutationOptions(options), queryClient);
710
+ };
711
+ const getLearningListLibrariesUrl = (params) => {
712
+ const normalizedParams = new URLSearchParams();
713
+ Object.entries(params || {}).forEach(([key, value]) => {
714
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
715
+ });
716
+ const stringifiedParams = normalizedParams.toString();
717
+ return stringifiedParams.length > 0 ? `/learning/author/libraries?${stringifiedParams}` : `/learning/author/libraries`;
718
+ };
719
+ /**
720
+ * Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Results are filtered to the caller's scope before pagination; page is one-based and limit is bounded by the shared pagination contract. Lists owned or shared libraries for creators, all libraries in reviewable active catalogues for reviewers, and all libraries for global operators. Ordered by library ID. publishedVersion=0 means no native published version is selected.
721
+ * @summary List reusable teaching libraries
722
+ */
723
+ const learningListLibraries = async (params, options) => {
724
+ return request(getLearningListLibrariesUrl(params), {
725
+ ...options,
726
+ method: "GET"
727
+ });
728
+ };
729
+ const getLearningListLibrariesQueryKey = (params) => {
730
+ return [`/learning/author/libraries`, ...params ? [params] : []];
731
+ };
732
+ const getLearningListLibrariesQueryOptions = (params, options) => {
733
+ const { query: queryOptions, request: requestOptions } = options ?? {};
734
+ const queryKey = queryOptions?.queryKey ?? getLearningListLibrariesQueryKey(params);
735
+ const queryFn = ({ signal }) => learningListLibraries(params, {
736
+ signal,
737
+ ...requestOptions
738
+ });
739
+ return {
740
+ queryKey,
741
+ queryFn,
742
+ ...queryOptions
743
+ };
744
+ };
745
+ /**
746
+ * @summary List reusable teaching libraries
747
+ */
748
+ function useLearningListLibraries(params, options, queryClient) {
749
+ const queryOptions = getLearningListLibrariesQueryOptions(params, options);
750
+ const query = useQuery(queryOptions, queryClient);
751
+ return withQueryKey(query, queryOptions.queryKey);
752
+ }
753
+ const getLearningCreateLibraryUrl = () => {
754
+ return `/learning/author/libraries`;
755
+ };
756
+ /**
757
+ * Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Creates an empty assessment or vocabulary container owned by the caller. A null catalogueId requires global authority. shared allows catalogue peers to reuse published material; it does not grant them editing rights. Create a version separately.
758
+ * @summary Create a reusable teaching library
759
+ */
760
+ const learningCreateLibrary = async (learningLibraryWrite, options) => {
761
+ const getHeaders = (h) => {
762
+ if (!h) return {};
763
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
764
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
765
+ const headers = {};
766
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
767
+ return headers;
768
+ };
769
+ return request(getLearningCreateLibraryUrl(), {
770
+ ...options,
771
+ method: "POST",
772
+ headers: {
773
+ "Content-Type": "application/json",
774
+ ...getHeaders(options?.headers)
775
+ },
776
+ body: JSON.stringify(learningLibraryWrite)
777
+ });
778
+ };
779
+ const getLearningCreateLibraryMutationKey = () => ["learningCreateLibrary"];
780
+ const getLearningCreateLibraryMutationOptions = (options) => {
781
+ const mutationKey = getLearningCreateLibraryMutationKey();
782
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
783
+ ...options,
784
+ mutation: {
785
+ ...options.mutation,
786
+ mutationKey
787
+ }
788
+ } : {
789
+ mutation: { mutationKey },
790
+ request: void 0
791
+ };
792
+ const mutationFn = (props) => {
793
+ const { data } = props ?? {};
794
+ return learningCreateLibrary(data, requestOptions);
795
+ };
796
+ return {
797
+ mutationFn,
798
+ ...mutationOptions
799
+ };
800
+ };
801
+ /**
802
+ * @summary Create a reusable teaching library
803
+ */
804
+ const useLearningCreateLibrary = (options, queryClient) => {
805
+ return useMutation(getLearningCreateLibraryMutationOptions(options), queryClient);
806
+ };
807
+ const getLearningListLibraryVersionsUrl = (libraryId, params) => {
808
+ const normalizedParams = new URLSearchParams();
809
+ Object.entries(params || {}).forEach(([key, value]) => {
810
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
811
+ });
812
+ const stringifiedParams = normalizedParams.toString();
813
+ return stringifiedParams.length > 0 ? `/learning/author/libraries/${libraryId}/versions?${stringifiedParams}` : `/learning/author/libraries/${libraryId}/versions`;
814
+ };
815
+ /**
816
+ * Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Results are filtered to the caller's scope before pagination; page is one-based and limit is bounded by the shared pagination contract. Ordered by version descending. Owners, reviewers and global operators can read drafts; other eligible users see published and superseded versions only. sealed is authoritative for editing: imported or referenced material can be sealed even with a draft status.
817
+ * @summary List versions of a teaching library
818
+ */
819
+ const learningListLibraryVersions = async (libraryId, params, options) => {
820
+ return request(getLearningListLibraryVersionsUrl(libraryId, params), {
821
+ ...options,
822
+ method: "GET"
823
+ });
824
+ };
825
+ const getLearningListLibraryVersionsQueryKey = (libraryId, params) => {
826
+ return [`/learning/author/libraries/${libraryId}/versions`, ...params ? [params] : []];
827
+ };
828
+ const getLearningListLibraryVersionsQueryOptions = (libraryId, params, options) => {
829
+ const { query: queryOptions, request: requestOptions } = options ?? {};
830
+ const queryKey = queryOptions?.queryKey ?? getLearningListLibraryVersionsQueryKey(libraryId, params);
831
+ const queryFn = ({ signal }) => learningListLibraryVersions(libraryId, params, {
832
+ signal,
833
+ ...requestOptions
834
+ });
835
+ return {
836
+ queryKey,
837
+ queryFn,
838
+ enabled: libraryId !== null && libraryId !== void 0,
839
+ ...queryOptions
840
+ };
841
+ };
842
+ /**
843
+ * @summary List versions of a teaching library
844
+ */
845
+ function useLearningListLibraryVersions(libraryId, params, options, queryClient) {
846
+ const queryOptions = getLearningListLibraryVersionsQueryOptions(libraryId, params, options);
847
+ const query = useQuery(queryOptions, queryClient);
848
+ return withQueryKey(query, queryOptions.queryKey);
849
+ }
850
+ const getLearningCreateLibraryVersionUrl = (libraryId) => {
851
+ return `/learning/author/libraries/${libraryId}/versions`;
852
+ };
853
+ /**
854
+ * Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Requires library ownership, catalogue review authority or global authority for writes; sharing only permits reuse and reading published versions. Creates the next numbered draft without changing any previous definition. Supply exactly one assessment or vocabulary matching the library kind. There must be no submitted version or unsealed working draft. Sealed source drafts do not block a successor. Referenced questions must be published and accessible; sourceLessonKeys are not accepted for libraries.
855
+ * @summary Create a successor library version
856
+ */
857
+ const learningCreateLibraryVersion = async (libraryId, learningLibraryVersionWrite, options) => {
858
+ const getHeaders = (h) => {
859
+ if (!h) return {};
860
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
861
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
862
+ const headers = {};
863
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
864
+ return headers;
865
+ };
866
+ return request(getLearningCreateLibraryVersionUrl(libraryId), {
867
+ ...options,
868
+ method: "POST",
869
+ headers: {
870
+ "Content-Type": "application/json",
871
+ ...getHeaders(options?.headers)
872
+ },
873
+ body: JSON.stringify(learningLibraryVersionWrite)
874
+ });
875
+ };
876
+ const getLearningCreateLibraryVersionMutationKey = () => ["learningCreateLibraryVersion"];
877
+ const getLearningCreateLibraryVersionMutationOptions = (options) => {
878
+ const mutationKey = getLearningCreateLibraryVersionMutationKey();
879
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
880
+ ...options,
881
+ mutation: {
882
+ ...options.mutation,
883
+ mutationKey
884
+ }
885
+ } : {
886
+ mutation: { mutationKey },
887
+ request: void 0
888
+ };
889
+ const mutationFn = (props) => {
890
+ const { libraryId, data } = props ?? {};
891
+ return learningCreateLibraryVersion(libraryId, data, requestOptions);
892
+ };
893
+ return {
894
+ mutationFn,
895
+ ...mutationOptions
896
+ };
897
+ };
898
+ /**
899
+ * @summary Create a successor library version
900
+ */
901
+ const useLearningCreateLibraryVersion = (options, queryClient) => {
902
+ return useMutation(getLearningCreateLibraryVersionMutationOptions(options), queryClient);
903
+ };
904
+ const getLearningReadLibraryVersionUrl = (libraryId, version) => {
905
+ return `/learning/author/libraries/${libraryId}/versions/${version}`;
906
+ };
907
+ /**
908
+ * Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Returns the full authoring definition and stable question references. version is the library's sequential version number, not materialId. Draft visibility is restricted to owner/reviewer/global operator. Answer keys are part of this private authoring contract. A sealed source snapshot must be copied into a successor to change it.
909
+ * @summary Read a teaching library version
910
+ */
911
+ const learningReadLibraryVersion = async (libraryId, version, options) => {
912
+ return request(getLearningReadLibraryVersionUrl(libraryId, version), {
913
+ ...options,
914
+ method: "GET"
915
+ });
916
+ };
917
+ const getLearningReadLibraryVersionQueryKey = (libraryId, version) => {
918
+ return [`/learning/author/libraries/${libraryId}/versions/${version}`];
919
+ };
920
+ const getLearningReadLibraryVersionQueryOptions = (libraryId, version, options) => {
921
+ const { query: queryOptions, request: requestOptions } = options ?? {};
922
+ const queryKey = queryOptions?.queryKey ?? getLearningReadLibraryVersionQueryKey(libraryId, version);
923
+ const queryFn = ({ signal }) => learningReadLibraryVersion(libraryId, version, {
924
+ signal,
925
+ ...requestOptions
926
+ });
927
+ return {
928
+ queryKey,
929
+ queryFn,
930
+ enabled: libraryId !== null && libraryId !== void 0 && version !== null && version !== void 0,
931
+ ...queryOptions
932
+ };
933
+ };
934
+ /**
935
+ * @summary Read a teaching library version
936
+ */
937
+ function useLearningReadLibraryVersion(libraryId, version, options, queryClient) {
938
+ const queryOptions = getLearningReadLibraryVersionQueryOptions(libraryId, version, options);
939
+ const query = useQuery(queryOptions, queryClient);
940
+ return withQueryKey(query, queryOptions.queryKey);
941
+ }
942
+ const getLearningReplaceLibraryVersionUrl = (libraryId, version) => {
943
+ return `/learning/author/libraries/${libraryId}/versions/${version}`;
944
+ };
945
+ /**
946
+ * Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Requires library ownership, catalogue review authority or global authority for writes; sharing only permits reuse and reading published versions. Replaces an unsealed draft or rejected version. Supply the current expectedEditVersion when changing the definition; a semantic no-op returns the same version. Submitted, published, superseded, imported and referenced definitions are immutable. Create a successor for sealed material instead. Exactly one matching assessment or vocabulary is required.
947
+ * @summary Replace an editable library definition
948
+ */
949
+ const learningReplaceLibraryVersion = async (libraryId, version, learningLibraryVersionWrite, options) => {
950
+ const getHeaders = (h) => {
951
+ if (!h) return {};
952
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
953
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
954
+ const headers = {};
955
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
956
+ return headers;
957
+ };
958
+ return request(getLearningReplaceLibraryVersionUrl(libraryId, version), {
959
+ ...options,
960
+ method: "PUT",
961
+ headers: {
962
+ "Content-Type": "application/json",
963
+ ...getHeaders(options?.headers)
964
+ },
965
+ body: JSON.stringify(learningLibraryVersionWrite)
966
+ });
967
+ };
968
+ const getLearningReplaceLibraryVersionMutationKey = () => ["learningReplaceLibraryVersion"];
969
+ const getLearningReplaceLibraryVersionMutationOptions = (options) => {
970
+ const mutationKey = getLearningReplaceLibraryVersionMutationKey();
971
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
972
+ ...options,
973
+ mutation: {
974
+ ...options.mutation,
975
+ mutationKey
976
+ }
977
+ } : {
978
+ mutation: { mutationKey },
979
+ request: void 0
980
+ };
981
+ const mutationFn = (props) => {
982
+ const { libraryId, version, data } = props ?? {};
983
+ return learningReplaceLibraryVersion(libraryId, version, data, requestOptions);
984
+ };
985
+ return {
986
+ mutationFn,
987
+ ...mutationOptions
988
+ };
989
+ };
990
+ /**
991
+ * @summary Replace an editable library definition
992
+ */
993
+ const useLearningReplaceLibraryVersion = (options, queryClient) => {
994
+ return useMutation(getLearningReplaceLibraryVersionMutationOptions(options), queryClient);
995
+ };
996
+ const getLearningReviewLibraryVersionUrl = (libraryId, version) => {
997
+ return `/learning/author/libraries/${libraryId}/versions/${version}/review`;
998
+ };
999
+ /**
1000
+ * Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Requires catalogue review or global authority. Approval revalidates resources, publishes this version and supersedes the previously published version. Rejection records the decision and makes an unpinned definition editable again. The supplied note is audited; it is not a field of the returned version summary.
1001
+ * @summary Approve or reject a submitted library version
1002
+ */
1003
+ const learningReviewLibraryVersion = async (libraryId, version, courseReviewWrite, options) => {
1004
+ const getHeaders = (h) => {
1005
+ if (!h) return {};
1006
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1007
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1008
+ const headers = {};
1009
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1010
+ return headers;
1011
+ };
1012
+ return request(getLearningReviewLibraryVersionUrl(libraryId, version), {
1013
+ ...options,
1014
+ method: "POST",
1015
+ headers: {
1016
+ "Content-Type": "application/json",
1017
+ ...getHeaders(options?.headers)
1018
+ },
1019
+ body: JSON.stringify(courseReviewWrite)
1020
+ });
1021
+ };
1022
+ const getLearningReviewLibraryVersionMutationKey = () => ["learningReviewLibraryVersion"];
1023
+ const getLearningReviewLibraryVersionMutationOptions = (options) => {
1024
+ const mutationKey = getLearningReviewLibraryVersionMutationKey();
1025
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
1026
+ ...options,
1027
+ mutation: {
1028
+ ...options.mutation,
1029
+ mutationKey
1030
+ }
1031
+ } : {
1032
+ mutation: { mutationKey },
1033
+ request: void 0
1034
+ };
1035
+ const mutationFn = (props) => {
1036
+ const { libraryId, version, data } = props ?? {};
1037
+ return learningReviewLibraryVersion(libraryId, version, data, requestOptions);
1038
+ };
1039
+ return {
1040
+ mutationFn,
1041
+ ...mutationOptions
1042
+ };
1043
+ };
1044
+ /**
1045
+ * @summary Approve or reject a submitted library version
1046
+ */
1047
+ const useLearningReviewLibraryVersion = (options, queryClient) => {
1048
+ return useMutation(getLearningReviewLibraryVersionMutationOptions(options), queryClient);
1049
+ };
1050
+ const getLearningSubmitLibraryVersionUrl = (libraryId, version) => {
1051
+ return `/learning/author/libraries/${libraryId}/versions/${version}/submit`;
1052
+ };
1053
+ /**
1054
+ * Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Requires library ownership, catalogue review authority or global authority for writes; sharing only permits reuse and reading published versions. Only an unsealed draft can be submitted. Submission locks its definition pending review; it does not publish the material. Source snapshots and referenced drafts require a successor before submission.
1055
+ * @summary Submit a library draft for review
1056
+ */
1057
+ const learningSubmitLibraryVersion = async (libraryId, version, options) => {
1058
+ return request(getLearningSubmitLibraryVersionUrl(libraryId, version), {
1059
+ ...options,
1060
+ method: "POST"
1061
+ });
1062
+ };
1063
+ const getLearningSubmitLibraryVersionMutationKey = () => ["learningSubmitLibraryVersion"];
1064
+ const getLearningSubmitLibraryVersionMutationOptions = (options) => {
1065
+ const mutationKey = getLearningSubmitLibraryVersionMutationKey();
1066
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
1067
+ ...options,
1068
+ mutation: {
1069
+ ...options.mutation,
1070
+ mutationKey
1071
+ }
1072
+ } : {
1073
+ mutation: { mutationKey },
1074
+ request: void 0
1075
+ };
1076
+ const mutationFn = (props) => {
1077
+ const { libraryId, version } = props ?? {};
1078
+ return learningSubmitLibraryVersion(libraryId, version, requestOptions);
1079
+ };
1080
+ return {
1081
+ mutationFn,
1082
+ ...mutationOptions
1083
+ };
1084
+ };
1085
+ /**
1086
+ * @summary Submit a library draft for review
1087
+ */
1088
+ const useLearningSubmitLibraryVersion = (options, queryClient) => {
1089
+ return useMutation(getLearningSubmitLibraryVersionMutationOptions(options), queryClient);
1090
+ };
1091
+ const getLearningCreatePathUrl = () => {
1092
+ return `/learning/author/paths`;
1093
+ };
1094
+ /**
1095
+ * Requires review authority for the chosen catalogue, or global authority for a null catalogueId. Creates a path with ordered, unique content IDs; these are catalogue content identities, not revision IDs. Creators without review permission cannot curate paths. Active publication requires active content and eligible catalogue resources.
1096
+ * @summary Create a curated learning path
1097
+ */
1098
+ const learningCreatePath = async (learningPathWrite, options) => {
1099
+ const getHeaders = (h) => {
1100
+ if (!h) return {};
1101
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1102
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1103
+ const headers = {};
1104
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1105
+ return headers;
1106
+ };
1107
+ return request(getLearningCreatePathUrl(), {
1108
+ ...options,
1109
+ method: "POST",
1110
+ headers: {
1111
+ "Content-Type": "application/json",
1112
+ ...getHeaders(options?.headers)
1113
+ },
1114
+ body: JSON.stringify(learningPathWrite)
1115
+ });
1116
+ };
1117
+ const getLearningCreatePathMutationKey = () => ["learningCreatePath"];
1118
+ const getLearningCreatePathMutationOptions = (options) => {
1119
+ const mutationKey = getLearningCreatePathMutationKey();
1120
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
1121
+ ...options,
1122
+ mutation: {
1123
+ ...options.mutation,
1124
+ mutationKey
1125
+ }
1126
+ } : {
1127
+ mutation: { mutationKey },
1128
+ request: void 0
1129
+ };
1130
+ const mutationFn = (props) => {
1131
+ const { data } = props ?? {};
1132
+ return learningCreatePath(data, requestOptions);
1133
+ };
1134
+ return {
1135
+ mutationFn,
1136
+ ...mutationOptions
1137
+ };
1138
+ };
1139
+ /**
1140
+ * @summary Create a curated learning path
1141
+ */
1142
+ const useLearningCreatePath = (options, queryClient) => {
1143
+ return useMutation(getLearningCreatePathMutationOptions(options), queryClient);
1144
+ };
1145
+ const getLearningReadAuthorPathUrl = (pathId) => {
1146
+ return `/learning/author/paths/${pathId}`;
1147
+ };
1148
+ /**
1149
+ * Requires review authority for the path's original catalogue or global authority. Returns the complete ordered definition and its current editVersion; use that counter in the next replacement request.
1150
+ * @summary Read a path's authoring definition
1151
+ */
1152
+ const learningReadAuthorPath = async (pathId, options) => {
1153
+ return request(getLearningReadAuthorPathUrl(pathId), {
1154
+ ...options,
1155
+ method: "GET"
1156
+ });
1157
+ };
1158
+ const getLearningReadAuthorPathQueryKey = (pathId) => {
1159
+ return [`/learning/author/paths/${pathId}`];
1160
+ };
1161
+ const getLearningReadAuthorPathQueryOptions = (pathId, options) => {
1162
+ const { query: queryOptions, request: requestOptions } = options ?? {};
1163
+ const queryKey = queryOptions?.queryKey ?? getLearningReadAuthorPathQueryKey(pathId);
1164
+ const queryFn = ({ signal }) => learningReadAuthorPath(pathId, {
1165
+ signal,
1166
+ ...requestOptions
1167
+ });
1168
+ return {
1169
+ queryKey,
1170
+ queryFn,
1171
+ enabled: pathId !== null && pathId !== void 0,
1172
+ ...queryOptions
1173
+ };
1174
+ };
1175
+ /**
1176
+ * @summary Read a path's authoring definition
1177
+ */
1178
+ function useLearningReadAuthorPath(pathId, options, queryClient) {
1179
+ const queryOptions = getLearningReadAuthorPathQueryOptions(pathId, options);
1180
+ const query = useQuery(queryOptions, queryClient);
1181
+ return withQueryKey(query, queryOptions.queryKey);
1182
+ }
1183
+ const getLearningUpdatePathUrl = (pathId) => {
1184
+ return `/learning/author/paths/${pathId}`;
1185
+ };
1186
+ /**
1187
+ * Requires review authority for the original catalogue or global authority. Replaces the entire definition and step ordering, increments editVersion, and requires expectedEditVersion to match. The catalogue cannot change. Setting isActive=true requires all referenced content to be active; step visibility for readers still follows their existing access grants.
1188
+ * @summary Replace and optionally publish a learning path
1189
+ */
1190
+ const learningUpdatePath = async (pathId, learningPathWrite, options) => {
1191
+ const getHeaders = (h) => {
1192
+ if (!h) return {};
1193
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1194
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1195
+ const headers = {};
1196
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1197
+ return headers;
1198
+ };
1199
+ return request(getLearningUpdatePathUrl(pathId), {
1200
+ ...options,
1201
+ method: "PUT",
1202
+ headers: {
1203
+ "Content-Type": "application/json",
1204
+ ...getHeaders(options?.headers)
1205
+ },
1206
+ body: JSON.stringify(learningPathWrite)
1207
+ });
1208
+ };
1209
+ const getLearningUpdatePathMutationKey = () => ["learningUpdatePath"];
1210
+ const getLearningUpdatePathMutationOptions = (options) => {
1211
+ const mutationKey = getLearningUpdatePathMutationKey();
1212
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
1213
+ ...options,
1214
+ mutation: {
1215
+ ...options.mutation,
1216
+ mutationKey
1217
+ }
1218
+ } : {
1219
+ mutation: { mutationKey },
1220
+ request: void 0
1221
+ };
1222
+ const mutationFn = (props) => {
1223
+ const { pathId, data } = props ?? {};
1224
+ return learningUpdatePath(pathId, data, requestOptions);
1225
+ };
1226
+ return {
1227
+ mutationFn,
1228
+ ...mutationOptions
1229
+ };
1230
+ };
1231
+ /**
1232
+ * @summary Replace and optionally publish a learning path
1233
+ */
1234
+ const useLearningUpdatePath = (options, queryClient) => {
1235
+ return useMutation(getLearningUpdatePathMutationOptions(options), queryClient);
1236
+ };
1237
+ const getLearningCreatePathAssessmentUrl = (pathId) => {
1238
+ return `/learning/author/paths/${pathId}/assessments`;
1239
+ };
1240
+ /**
1241
+ * Requires path catalogue review authority or global authority. Creates a new assessment with kind=final and explicit questions or published questionRefs; sourceLessonKeys are not accepted. References must come from courses in this path. Existing assessments are immutable; withdraw one and create another when replacing it.
1242
+ * @summary Add a final assessment to a learning path
1243
+ */
1244
+ const learningCreatePathAssessment = async (pathId, learningAssessmentWriteInput, options) => {
1245
+ const getHeaders = (h) => {
1246
+ if (!h) return {};
1247
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1248
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1249
+ const headers = {};
1250
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1251
+ return headers;
1252
+ };
1253
+ return request(getLearningCreatePathAssessmentUrl(pathId), {
1254
+ ...options,
1255
+ method: "POST",
1256
+ headers: {
1257
+ "Content-Type": "application/json",
1258
+ ...getHeaders(options?.headers)
1259
+ },
1260
+ body: JSON.stringify(learningAssessmentWriteInput)
1261
+ });
1262
+ };
1263
+ const getLearningCreatePathAssessmentMutationKey = () => ["learningCreatePathAssessment"];
1264
+ const getLearningCreatePathAssessmentMutationOptions = (options) => {
1265
+ const mutationKey = getLearningCreatePathAssessmentMutationKey();
1266
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
1267
+ ...options,
1268
+ mutation: {
1269
+ ...options.mutation,
1270
+ mutationKey
1271
+ }
1272
+ } : {
1273
+ mutation: { mutationKey },
1274
+ request: void 0
1275
+ };
1276
+ const mutationFn = (props) => {
1277
+ const { pathId, data } = props ?? {};
1278
+ return learningCreatePathAssessment(pathId, data, requestOptions);
1279
+ };
1280
+ return {
1281
+ mutationFn,
1282
+ ...mutationOptions
1283
+ };
1284
+ };
1285
+ /**
1286
+ * @summary Add a final assessment to a learning path
1287
+ */
1288
+ const useLearningCreatePathAssessment = (options, queryClient) => {
1289
+ return useMutation(getLearningCreatePathAssessmentMutationOptions(options), queryClient);
1290
+ };
1291
+ const getLearningWithdrawPathAssessmentUrl = (pathId, assessmentId) => {
1292
+ return `/learning/author/paths/${pathId}/assessments/${assessmentId}`;
1293
+ };
1294
+ /**
1295
+ * Requires path catalogue review authority or global authority. Marks the selected assessment inactive while retaining its identity and recorded evidence. assessmentId must belong to pathId. Repeating withdrawal leaves it inactive. Success returns 204 with no response body.
1296
+ * @summary Withdraw a path assessment
1297
+ */
1298
+ const learningWithdrawPathAssessment = async (pathId, assessmentId, options) => {
1299
+ return request(getLearningWithdrawPathAssessmentUrl(pathId, assessmentId), {
1300
+ ...options,
1301
+ method: "DELETE"
1302
+ });
1303
+ };
1304
+ const getLearningWithdrawPathAssessmentMutationKey = () => ["learningWithdrawPathAssessment"];
1305
+ const getLearningWithdrawPathAssessmentMutationOptions = (options) => {
1306
+ const mutationKey = getLearningWithdrawPathAssessmentMutationKey();
1307
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
1308
+ ...options,
1309
+ mutation: {
1310
+ ...options.mutation,
1311
+ mutationKey
1312
+ }
1313
+ } : {
1314
+ mutation: { mutationKey },
1315
+ request: void 0
1316
+ };
1317
+ const mutationFn = (props) => {
1318
+ const { pathId, assessmentId } = props ?? {};
1319
+ return learningWithdrawPathAssessment(pathId, assessmentId, requestOptions);
1320
+ };
1321
+ return {
1322
+ mutationFn,
1323
+ ...mutationOptions
1324
+ };
1325
+ };
1326
+ /**
1327
+ * @summary Withdraw a path assessment
1328
+ */
1329
+ const useLearningWithdrawPathAssessment = (options, queryClient) => {
1330
+ return useMutation(getLearningWithdrawPathAssessmentMutationOptions(options), queryClient);
1331
+ };
1332
+ //#endregion
1333
+ export { getLearningAttachCaptionsMutationKey, getLearningAttachCaptionsMutationOptions, getLearningAttachCaptionsUrl, getLearningCreateAuthorCatalogueMutationKey, getLearningCreateAuthorCatalogueMutationOptions, getLearningCreateAuthorCatalogueUrl, getLearningCreateCourseMutationKey, getLearningCreateCourseMutationOptions, getLearningCreateCourseUrl, getLearningCreateLibraryMutationKey, getLearningCreateLibraryMutationOptions, getLearningCreateLibraryUrl, getLearningCreateLibraryVersionMutationKey, getLearningCreateLibraryVersionMutationOptions, getLearningCreateLibraryVersionUrl, getLearningCreatePathAssessmentMutationKey, getLearningCreatePathAssessmentMutationOptions, getLearningCreatePathAssessmentUrl, getLearningCreatePathMutationKey, getLearningCreatePathMutationOptions, getLearningCreatePathUrl, getLearningCreateRevisionMutationKey, getLearningCreateRevisionMutationOptions, getLearningCreateRevisionUrl, getLearningListAuthorCataloguesQueryKey, getLearningListAuthorCataloguesQueryOptions, getLearningListAuthorCataloguesUrl, getLearningListAuthorCoursesQueryKey, getLearningListAuthorCoursesQueryOptions, getLearningListAuthorCoursesUrl, getLearningListLibrariesQueryKey, getLearningListLibrariesQueryOptions, getLearningListLibrariesUrl, getLearningListLibraryVersionsQueryKey, getLearningListLibraryVersionsQueryOptions, getLearningListLibraryVersionsUrl, getLearningListRevisionsQueryKey, getLearningListRevisionsQueryOptions, getLearningListRevisionsUrl, getLearningReadAuthorPathQueryKey, getLearningReadAuthorPathQueryOptions, getLearningReadAuthorPathUrl, getLearningReadAuthorRevisionQueryKey, getLearningReadAuthorRevisionQueryOptions, getLearningReadAuthorRevisionUrl, getLearningReadLibraryVersionQueryKey, getLearningReadLibraryVersionQueryOptions, getLearningReadLibraryVersionUrl, getLearningRegisterAssetMutationKey, getLearningRegisterAssetMutationOptions, getLearningRegisterAssetUrl, getLearningReplaceLibraryVersionMutationKey, getLearningReplaceLibraryVersionMutationOptions, getLearningReplaceLibraryVersionUrl, getLearningReplaceRevisionMutationKey, getLearningReplaceRevisionMutationOptions, getLearningReplaceRevisionUrl, getLearningReviewLibraryVersionMutationKey, getLearningReviewLibraryVersionMutationOptions, getLearningReviewLibraryVersionUrl, getLearningReviewRevisionMutationKey, getLearningReviewRevisionMutationOptions, getLearningReviewRevisionUrl, getLearningSetCatalogueAuthorityMutationKey, getLearningSetCatalogueAuthorityMutationOptions, getLearningSetCatalogueAuthorityUrl, getLearningSubmitLibraryVersionMutationKey, getLearningSubmitLibraryVersionMutationOptions, getLearningSubmitLibraryVersionUrl, getLearningSubmitRevisionMutationKey, getLearningSubmitRevisionMutationOptions, getLearningSubmitRevisionUrl, getLearningUpdateCourseSettingsMutationKey, getLearningUpdateCourseSettingsMutationOptions, getLearningUpdateCourseSettingsUrl, getLearningUpdatePathMutationKey, getLearningUpdatePathMutationOptions, getLearningUpdatePathUrl, getLearningWithdrawPathAssessmentMutationKey, getLearningWithdrawPathAssessmentMutationOptions, getLearningWithdrawPathAssessmentUrl, learningAttachCaptions, learningCreateAuthorCatalogue, learningCreateCourse, learningCreateLibrary, learningCreateLibraryVersion, learningCreatePath, learningCreatePathAssessment, learningCreateRevision, learningListAuthorCatalogues, learningListAuthorCourses, learningListLibraries, learningListLibraryVersions, learningListRevisions, learningReadAuthorPath, learningReadAuthorRevision, learningReadLibraryVersion, learningRegisterAsset, learningReplaceLibraryVersion, learningReplaceRevision, learningReviewLibraryVersion, learningReviewRevision, learningSetCatalogueAuthority, learningSubmitLibraryVersion, learningSubmitRevision, learningUpdateCourseSettings, learningUpdatePath, learningWithdrawPathAssessment, useLearningAttachCaptions, useLearningCreateAuthorCatalogue, useLearningCreateCourse, useLearningCreateLibrary, useLearningCreateLibraryVersion, useLearningCreatePath, useLearningCreatePathAssessment, useLearningCreateRevision, useLearningListAuthorCatalogues, useLearningListAuthorCourses, useLearningListLibraries, useLearningListLibraryVersions, useLearningListRevisions, useLearningReadAuthorPath, useLearningReadAuthorRevision, useLearningReadLibraryVersion, useLearningRegisterAsset, useLearningReplaceLibraryVersion, useLearningReplaceRevision, useLearningReviewLibraryVersion, useLearningReviewRevision, useLearningSetCatalogueAuthority, useLearningSubmitLibraryVersion, useLearningSubmitRevision, useLearningUpdateCourseSettings, useLearningUpdatePath, useLearningWithdrawPathAssessment };
1334
+
1335
+ //# sourceMappingURL=biblio-learning-authoring.js.map