@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.
- package/README.md +25 -0
- package/dist/api/account.d.ts +1 -1
- package/dist/api/account.js.map +1 -1
- package/dist/api/admin-catalogue.d.ts +1 -1
- package/dist/api/admin-catalogue.js.map +1 -1
- package/dist/api/admin-consumption.d.ts +1 -1
- package/dist/api/admin-consumption.js.map +1 -1
- package/dist/api/admin-contracts.d.ts +1 -1
- package/dist/api/admin-contracts.js.map +1 -1
- package/dist/api/admin-desk.d.ts +1 -1
- package/dist/api/admin-desk.js.map +1 -1
- package/dist/api/admin-licenses.d.ts +1 -1
- package/dist/api/admin-licenses.js.map +1 -1
- package/dist/api/admin-partner-selections.d.ts +1 -1
- package/dist/api/admin-partner-selections.js.map +1 -1
- package/dist/api/admin-patrons.d.ts +1 -1
- package/dist/api/admin-patrons.js.map +1 -1
- package/dist/api/admin-reviews.d.ts +1 -1
- package/dist/api/admin-reviews.js.map +1 -1
- package/dist/api/admin-roles.d.ts +1 -1
- package/dist/api/admin-roles.js.map +1 -1
- package/dist/api/admin-support.d.ts +1 -1
- package/dist/api/admin-support.js.map +1 -1
- package/dist/api/admin-tenants.d.ts +1 -1
- package/dist/api/admin-tenants.js.map +1 -1
- package/dist/api/admin-tutoring.d.ts +1 -1
- package/dist/api/admin-tutoring.js.map +1 -1
- package/dist/api/auth.d.ts +1 -1
- package/dist/api/auth.js.map +1 -1
- package/dist/api/biblio-billing-webhooks.d.ts +18 -0
- package/dist/api/biblio-billing-webhooks.js +62 -0
- package/dist/api/biblio-billing-webhooks.js.map +1 -0
- package/dist/api/biblio-billing.d.ts +192 -0
- package/dist/api/biblio-billing.js +645 -0
- package/dist/api/biblio-billing.js.map +1 -0
- package/dist/api/biblio-catalogue.d.ts +1 -1
- package/dist/api/biblio-catalogue.js.map +1 -1
- package/dist/api/biblio-home.d.ts +1 -1
- package/dist/api/biblio-home.js.map +1 -1
- package/dist/api/biblio-learning-author-profiles.d.ts +108 -0
- package/dist/api/biblio-learning-author-profiles.js +331 -0
- package/dist/api/biblio-learning-author-profiles.js.map +1 -0
- package/dist/api/biblio-learning-authoring.d.ts +168 -0
- package/dist/api/biblio-learning-authoring.js +586 -0
- package/dist/api/biblio-learning-authoring.js.map +1 -0
- package/dist/api/biblio-learning-editorial.d.ts +54 -0
- package/dist/api/biblio-learning-editorial.js +149 -0
- package/dist/api/biblio-learning-editorial.js.map +1 -0
- package/dist/api/biblio-learning-feedback.d.ts +60 -0
- package/dist/api/biblio-learning-feedback.js +180 -0
- package/dist/api/biblio-learning-feedback.js.map +1 -0
- package/dist/api/biblio-learning-finance.d.ts +186 -0
- package/dist/api/biblio-learning-finance.js +622 -0
- package/dist/api/biblio-learning-finance.js.map +1 -0
- package/dist/api/biblio-learning-integrations.d.ts +60 -0
- package/dist/api/biblio-learning-integrations.js +215 -0
- package/dist/api/biblio-learning-integrations.js.map +1 -0
- package/dist/api/biblio-learning-membership.d.ts +24 -0
- package/dist/api/biblio-learning-membership.js +69 -0
- package/dist/api/biblio-learning-membership.js.map +1 -0
- package/dist/api/biblio-learning.d.ts +222 -0
- package/dist/api/biblio-learning.js +697 -0
- package/dist/api/biblio-learning.js.map +1 -0
- package/dist/api/biblio-library.d.ts +1 -1
- package/dist/api/biblio-library.js.map +1 -1
- package/dist/api/biblio-nextory.d.ts +1 -1
- package/dist/api/biblio-nextory.js.map +1 -1
- package/dist/api/biblio-press.d.ts +1 -1
- package/dist/api/biblio-press.js.map +1 -1
- package/dist/api/biblio-search.d.ts +1 -1
- package/dist/api/biblio-search.js.map +1 -1
- package/dist/api/biblio-telemetry.d.ts +1 -1
- package/dist/api/biblio-telemetry.js.map +1 -1
- package/dist/api/consumption.d.ts +1 -1
- package/dist/api/consumption.js.map +1 -1
- package/dist/api/cvs-app.d.ts +1 -1
- package/dist/api/cvs-app.js.map +1 -1
- package/dist/api/cvs-documents.d.ts +1 -1
- package/dist/api/cvs-documents.js.map +1 -1
- package/dist/api/cvs-favorites.d.ts +1 -1
- package/dist/api/cvs-favorites.js.map +1 -1
- package/dist/api/cvs-ils.d.ts +1 -1
- package/dist/api/cvs-ils.js.map +1 -1
- package/dist/api/cvs-loans.d.ts +1 -1
- package/dist/api/cvs-loans.js.map +1 -1
- package/dist/api/cvs-payments.d.ts +1 -1
- package/dist/api/cvs-payments.js.map +1 -1
- package/dist/api/cvs-streaming.d.ts +1 -1
- package/dist/api/cvs-streaming.js.map +1 -1
- package/dist/api/index.d.ts +11 -1
- package/dist/api/index.js +11 -1
- package/dist/api/partner-catalogue.d.ts +1 -1
- package/dist/api/partner-catalogue.js.map +1 -1
- package/dist/api/partner-reader.d.ts +1 -1
- package/dist/api/partner-reader.js.map +1 -1
- package/dist/api/profiles.d.ts +1 -1
- package/dist/api/profiles.js.map +1 -1
- package/dist/api/search.d.ts +1 -1
- package/dist/api/search.js.map +1 -1
- package/dist/api/tutoring-catalogue.d.ts +1 -1
- package/dist/api/tutoring-catalogue.js.map +1 -1
- package/dist/api/tutoring-chat.d.ts +1 -1
- package/dist/api/tutoring-chat.js.map +1 -1
- package/dist/api/tutoring-dispatch.d.ts +1 -1
- package/dist/api/tutoring-dispatch.js.map +1 -1
- package/dist/api/tutoring-practitioner.d.ts +1 -1
- package/dist/api/tutoring-practitioner.js.map +1 -1
- package/dist/api/tutoring-requests.d.ts +1 -1
- package/dist/api/tutoring-requests.js.map +1 -1
- package/dist/chunks/client2.d.ts +1 -1
- package/dist/chunks/connection.d.ts +1 -1
- package/dist/chunks/index.d.ts +10062 -3487
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +2 -2
- package/dist/models.js +329 -1
- package/dist/models.js.map +1 -1
- package/dist/react/account.d.ts +1 -1
- package/dist/react/account.js +1 -1
- package/dist/react/account.js.map +1 -1
- package/dist/react/admin-catalogue.d.ts +1 -1
- package/dist/react/admin-catalogue.js +1 -1
- package/dist/react/admin-catalogue.js.map +1 -1
- package/dist/react/admin-consumption.d.ts +1 -1
- package/dist/react/admin-consumption.js +1 -1
- package/dist/react/admin-consumption.js.map +1 -1
- package/dist/react/admin-contracts.d.ts +1 -1
- package/dist/react/admin-contracts.js +1 -1
- package/dist/react/admin-contracts.js.map +1 -1
- package/dist/react/admin-desk.d.ts +1 -1
- package/dist/react/admin-desk.js +1 -1
- package/dist/react/admin-desk.js.map +1 -1
- package/dist/react/admin-licenses.d.ts +1 -1
- package/dist/react/admin-licenses.js +1 -1
- package/dist/react/admin-licenses.js.map +1 -1
- package/dist/react/admin-partner-selections.d.ts +1 -1
- package/dist/react/admin-partner-selections.js +1 -1
- package/dist/react/admin-partner-selections.js.map +1 -1
- package/dist/react/admin-patrons.d.ts +1 -1
- package/dist/react/admin-patrons.js +1 -1
- package/dist/react/admin-patrons.js.map +1 -1
- package/dist/react/admin-reviews.d.ts +1 -1
- package/dist/react/admin-reviews.js +1 -1
- package/dist/react/admin-reviews.js.map +1 -1
- package/dist/react/admin-roles.d.ts +1 -1
- package/dist/react/admin-roles.js +1 -1
- package/dist/react/admin-roles.js.map +1 -1
- package/dist/react/admin-support.d.ts +1 -1
- package/dist/react/admin-support.js +1 -1
- package/dist/react/admin-support.js.map +1 -1
- package/dist/react/admin-tenants.d.ts +1 -1
- package/dist/react/admin-tenants.js +1 -1
- package/dist/react/admin-tenants.js.map +1 -1
- package/dist/react/admin-tutoring.d.ts +1 -1
- package/dist/react/admin-tutoring.js +1 -1
- package/dist/react/admin-tutoring.js.map +1 -1
- package/dist/react/auth.d.ts +1 -1
- package/dist/react/auth.js +1 -1
- package/dist/react/auth.js.map +1 -1
- package/dist/react/biblio-billing-webhooks.d.ts +56 -0
- package/dist/react/biblio-billing-webhooks.js +126 -0
- package/dist/react/biblio-billing-webhooks.js.map +1 -0
- package/dist/react/biblio-billing.d.ts +876 -0
- package/dist/react/biblio-billing.js +1491 -0
- package/dist/react/biblio-billing.js.map +1 -0
- package/dist/react/biblio-catalogue.d.ts +1 -1
- package/dist/react/biblio-catalogue.js +1 -1
- package/dist/react/biblio-catalogue.js.map +1 -1
- package/dist/react/biblio-home.d.ts +1 -1
- package/dist/react/biblio-home.js +1 -1
- package/dist/react/biblio-home.js.map +1 -1
- package/dist/react/biblio-learning-author-profiles.d.ts +513 -0
- package/dist/react/biblio-learning-author-profiles.js +795 -0
- package/dist/react/biblio-learning-author-profiles.js.map +1 -0
- package/dist/react/biblio-learning-authoring.d.ts +745 -0
- package/dist/react/biblio-learning-authoring.js +1335 -0
- package/dist/react/biblio-learning-authoring.js.map +1 -0
- package/dist/react/biblio-learning-editorial.d.ts +264 -0
- package/dist/react/biblio-learning-editorial.js +371 -0
- package/dist/react/biblio-learning-editorial.js.map +1 -0
- package/dist/react/biblio-learning-feedback.d.ts +280 -0
- package/dist/react/biblio-learning-feedback.js +433 -0
- package/dist/react/biblio-learning-feedback.js.map +1 -0
- package/dist/react/biblio-learning-finance.d.ts +868 -0
- package/dist/react/biblio-learning-finance.js +1439 -0
- package/dist/react/biblio-learning-finance.js.map +1 -0
- package/dist/react/biblio-learning-integrations.d.ts +237 -0
- package/dist/react/biblio-learning-integrations.js +483 -0
- package/dist/react/biblio-learning-integrations.js.map +1 -0
- package/dist/react/biblio-learning-membership.d.ts +99 -0
- package/dist/react/biblio-learning-membership.js +165 -0
- package/dist/react/biblio-learning-membership.js.map +1 -0
- package/dist/react/biblio-learning.d.ts +1047 -0
- package/dist/react/biblio-learning.js +1667 -0
- package/dist/react/biblio-learning.js.map +1 -0
- package/dist/react/biblio-library.d.ts +1 -1
- package/dist/react/biblio-library.js +1 -1
- package/dist/react/biblio-library.js.map +1 -1
- package/dist/react/biblio-nextory.d.ts +1 -1
- package/dist/react/biblio-nextory.js +1 -1
- package/dist/react/biblio-nextory.js.map +1 -1
- package/dist/react/biblio-press.d.ts +1 -1
- package/dist/react/biblio-press.js +1 -1
- package/dist/react/biblio-press.js.map +1 -1
- package/dist/react/biblio-search.d.ts +1 -1
- package/dist/react/biblio-search.js +1 -1
- package/dist/react/biblio-search.js.map +1 -1
- package/dist/react/biblio-telemetry.d.ts +1 -1
- package/dist/react/biblio-telemetry.js +1 -1
- package/dist/react/biblio-telemetry.js.map +1 -1
- package/dist/react/chat.d.ts +1 -1
- package/dist/react/consumption.d.ts +1 -1
- package/dist/react/consumption.js +1 -1
- package/dist/react/consumption.js.map +1 -1
- package/dist/react/cvs-app.d.ts +1 -1
- package/dist/react/cvs-app.js +1 -1
- package/dist/react/cvs-app.js.map +1 -1
- package/dist/react/cvs-documents.d.ts +1 -1
- package/dist/react/cvs-documents.js +1 -1
- package/dist/react/cvs-documents.js.map +1 -1
- package/dist/react/cvs-favorites.d.ts +1 -1
- package/dist/react/cvs-favorites.js +1 -1
- package/dist/react/cvs-favorites.js.map +1 -1
- package/dist/react/cvs-ils.d.ts +1 -1
- package/dist/react/cvs-ils.js +1 -1
- package/dist/react/cvs-ils.js.map +1 -1
- package/dist/react/cvs-loans.d.ts +1 -1
- package/dist/react/cvs-loans.js +1 -1
- package/dist/react/cvs-loans.js.map +1 -1
- package/dist/react/cvs-payments.d.ts +1 -1
- package/dist/react/cvs-payments.js +1 -1
- package/dist/react/cvs-payments.js.map +1 -1
- package/dist/react/cvs-streaming.d.ts +1 -1
- package/dist/react/cvs-streaming.js +1 -1
- package/dist/react/cvs-streaming.js.map +1 -1
- package/dist/react/index.d.ts +11 -1
- package/dist/react/index.js +11 -1
- package/dist/react/partner-catalogue.d.ts +1 -1
- package/dist/react/partner-catalogue.js +1 -1
- package/dist/react/partner-catalogue.js.map +1 -1
- package/dist/react/partner-reader.d.ts +1 -1
- package/dist/react/partner-reader.js +1 -1
- package/dist/react/partner-reader.js.map +1 -1
- package/dist/react/profiles.d.ts +1 -1
- package/dist/react/profiles.js +1 -1
- package/dist/react/profiles.js.map +1 -1
- package/dist/react/search.d.ts +1 -1
- package/dist/react/search.js +1 -1
- package/dist/react/search.js.map +1 -1
- package/dist/react/tutoring-catalogue.d.ts +1 -1
- package/dist/react/tutoring-catalogue.js +1 -1
- package/dist/react/tutoring-catalogue.js.map +1 -1
- package/dist/react/tutoring-chat.d.ts +1 -1
- package/dist/react/tutoring-chat.js +1 -1
- package/dist/react/tutoring-chat.js.map +1 -1
- package/dist/react/tutoring-dispatch.d.ts +1 -1
- package/dist/react/tutoring-dispatch.js +1 -1
- package/dist/react/tutoring-dispatch.js.map +1 -1
- package/dist/react/tutoring-practitioner.d.ts +1 -1
- package/dist/react/tutoring-practitioner.js +1 -1
- package/dist/react/tutoring-practitioner.js.map +1 -1
- package/dist/react/tutoring-requests.d.ts +1 -1
- package/dist/react/tutoring-requests.js +1 -1
- package/dist/react/tutoring-requests.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,795 @@
|
|
|
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-author-profiles/biblio-learning-author-profiles.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 getLearningOwnAuthorProfilesUrl = (params) => {
|
|
25
|
+
const normalizedParams = new URLSearchParams();
|
|
26
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
27
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
28
|
+
});
|
|
29
|
+
const stringifiedParams = normalizedParams.toString();
|
|
30
|
+
return stringifiedParams.length > 0 ? `/learning/author/profiles?${stringifiedParams}` : `/learning/author/profiles`;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. Results are filtered to the caller's scope before pagination; page is one-based and limit is bounded by the shared pagination contract. Includes inactive drafts and active public profiles, ordered by author ID. An imported active public snapshot may have no native publishedRevisionId; this does not imply that a publication date is known.
|
|
34
|
+
* @summary List author profiles I can manage
|
|
35
|
+
*/
|
|
36
|
+
const learningOwnAuthorProfiles = async (params, options) => {
|
|
37
|
+
return request(getLearningOwnAuthorProfilesUrl(params), {
|
|
38
|
+
...options,
|
|
39
|
+
method: "GET"
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const getLearningOwnAuthorProfilesQueryKey = (params) => {
|
|
43
|
+
return [`/learning/author/profiles`, ...params ? [params] : []];
|
|
44
|
+
};
|
|
45
|
+
const getLearningOwnAuthorProfilesQueryOptions = (params, options) => {
|
|
46
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
47
|
+
const queryKey = queryOptions?.queryKey ?? getLearningOwnAuthorProfilesQueryKey(params);
|
|
48
|
+
const queryFn = ({ signal }) => learningOwnAuthorProfiles(params, {
|
|
49
|
+
signal,
|
|
50
|
+
...requestOptions
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
queryKey,
|
|
54
|
+
queryFn,
|
|
55
|
+
...queryOptions
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @summary List author profiles I can manage
|
|
60
|
+
*/
|
|
61
|
+
function useLearningOwnAuthorProfiles(params, options, queryClient) {
|
|
62
|
+
const queryOptions = getLearningOwnAuthorProfilesQueryOptions(params, options);
|
|
63
|
+
const query = useQuery(queryOptions, queryClient);
|
|
64
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
65
|
+
}
|
|
66
|
+
const getLearningCreateAuthorProfileUrl = () => {
|
|
67
|
+
return `/learning/author/profiles`;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Requires the effective independent author profile and the relevant catalogue, ownership or global authority. Support impersonation is rejected. Creates an inactive teaching profile and its initial editable revision. The definition is not public until approved. Omitting authorId creates a new public author identity; binding an existing authorId or another ownerUserId requires global authority. Portrait assets must be eligible images in the chosen catalogue.
|
|
71
|
+
* @summary Create an author profile and its first draft
|
|
72
|
+
*/
|
|
73
|
+
const learningCreateAuthorProfile = async (learningAuthorProfileCreateWrite, options) => {
|
|
74
|
+
const getHeaders = (h) => {
|
|
75
|
+
if (!h) return {};
|
|
76
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
77
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
78
|
+
const headers = {};
|
|
79
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
80
|
+
return headers;
|
|
81
|
+
};
|
|
82
|
+
return request(getLearningCreateAuthorProfileUrl(), {
|
|
83
|
+
...options,
|
|
84
|
+
method: "POST",
|
|
85
|
+
headers: {
|
|
86
|
+
"Content-Type": "application/json",
|
|
87
|
+
...getHeaders(options?.headers)
|
|
88
|
+
},
|
|
89
|
+
body: JSON.stringify(learningAuthorProfileCreateWrite)
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
const getLearningCreateAuthorProfileMutationKey = () => ["learningCreateAuthorProfile"];
|
|
93
|
+
const getLearningCreateAuthorProfileMutationOptions = (options) => {
|
|
94
|
+
const mutationKey = getLearningCreateAuthorProfileMutationKey();
|
|
95
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
96
|
+
...options,
|
|
97
|
+
mutation: {
|
|
98
|
+
...options.mutation,
|
|
99
|
+
mutationKey
|
|
100
|
+
}
|
|
101
|
+
} : {
|
|
102
|
+
mutation: { mutationKey },
|
|
103
|
+
request: void 0
|
|
104
|
+
};
|
|
105
|
+
const mutationFn = (props) => {
|
|
106
|
+
const { data } = props ?? {};
|
|
107
|
+
return learningCreateAuthorProfile(data, requestOptions);
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
mutationFn,
|
|
111
|
+
...mutationOptions
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* @summary Create an author profile and its first draft
|
|
116
|
+
*/
|
|
117
|
+
const useLearningCreateAuthorProfile = (options, queryClient) => {
|
|
118
|
+
return useMutation(getLearningCreateAuthorProfileMutationOptions(options), queryClient);
|
|
119
|
+
};
|
|
120
|
+
const getLearningAuthorProfileAdminUrl = (authorId) => {
|
|
121
|
+
return `/learning/author/profiles/${authorId}`;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. Returns ownership and the native published revision pointer without exposing raw provider metadata. authorId is the existing public author identity. A null publishedRevisionId can describe a newly created profile or an imported public snapshot; use isActive and revision history for context.
|
|
125
|
+
* @summary Read an author's private profile metadata
|
|
126
|
+
*/
|
|
127
|
+
const learningAuthorProfileAdmin = async (authorId, options) => {
|
|
128
|
+
return request(getLearningAuthorProfileAdminUrl(authorId), {
|
|
129
|
+
...options,
|
|
130
|
+
method: "GET"
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
const getLearningAuthorProfileAdminQueryKey = (authorId) => {
|
|
134
|
+
return [`/learning/author/profiles/${authorId}`];
|
|
135
|
+
};
|
|
136
|
+
const getLearningAuthorProfileAdminQueryOptions = (authorId, options) => {
|
|
137
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
138
|
+
const queryKey = queryOptions?.queryKey ?? getLearningAuthorProfileAdminQueryKey(authorId);
|
|
139
|
+
const queryFn = ({ signal }) => learningAuthorProfileAdmin(authorId, {
|
|
140
|
+
signal,
|
|
141
|
+
...requestOptions
|
|
142
|
+
});
|
|
143
|
+
return {
|
|
144
|
+
queryKey,
|
|
145
|
+
queryFn,
|
|
146
|
+
enabled: authorId !== null && authorId !== void 0,
|
|
147
|
+
...queryOptions
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* @summary Read an author's private profile metadata
|
|
152
|
+
*/
|
|
153
|
+
function useLearningAuthorProfileAdmin(authorId, options, queryClient) {
|
|
154
|
+
const queryOptions = getLearningAuthorProfileAdminQueryOptions(authorId, options);
|
|
155
|
+
const query = useQuery(queryOptions, queryClient);
|
|
156
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
157
|
+
}
|
|
158
|
+
const getLearningAuthorMessagesUrl = (authorId, params) => {
|
|
159
|
+
const normalizedParams = new URLSearchParams();
|
|
160
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
161
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
162
|
+
});
|
|
163
|
+
const stringifiedParams = normalizedParams.toString();
|
|
164
|
+
return stringifiedParams.length > 0 ? `/learning/author/profiles/${authorId}/messages?${stringifiedParams}` : `/learning/author/profiles/${authorId}/messages`;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are 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 message ID. Includes native profile discussion and matching imported source messages when available. Author messages do not carry courseId or course revisionId. Historical messages can have unknown author attribution or creation date.
|
|
168
|
+
* @summary List private editorial messages for an author
|
|
169
|
+
*/
|
|
170
|
+
const learningAuthorMessages = async (authorId, params, options) => {
|
|
171
|
+
return request(getLearningAuthorMessagesUrl(authorId, params), {
|
|
172
|
+
...options,
|
|
173
|
+
method: "GET"
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
const getLearningAuthorMessagesQueryKey = (authorId, params) => {
|
|
177
|
+
return [`/learning/author/profiles/${authorId}/messages`, ...params ? [params] : []];
|
|
178
|
+
};
|
|
179
|
+
const getLearningAuthorMessagesQueryOptions = (authorId, params, options) => {
|
|
180
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
181
|
+
const queryKey = queryOptions?.queryKey ?? getLearningAuthorMessagesQueryKey(authorId, params);
|
|
182
|
+
const queryFn = ({ signal }) => learningAuthorMessages(authorId, params, {
|
|
183
|
+
signal,
|
|
184
|
+
...requestOptions
|
|
185
|
+
});
|
|
186
|
+
return {
|
|
187
|
+
queryKey,
|
|
188
|
+
queryFn,
|
|
189
|
+
enabled: authorId !== null && authorId !== void 0,
|
|
190
|
+
...queryOptions
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* @summary List private editorial messages for an author
|
|
195
|
+
*/
|
|
196
|
+
function useLearningAuthorMessages(authorId, params, options, queryClient) {
|
|
197
|
+
const queryOptions = getLearningAuthorMessagesQueryOptions(authorId, params, options);
|
|
198
|
+
const query = useQuery(queryOptions, queryClient);
|
|
199
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
200
|
+
}
|
|
201
|
+
const getLearningAddAuthorMessageUrl = (authorId) => {
|
|
202
|
+
return `/learning/author/profiles/${authorId}/messages`;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. Appends a message to the profile's editorial discussion, attributed to the effective profile. The source object fields identify the native LearningAuthorProfile subject; they are not a course revision reference. Messages do not change publication status.
|
|
206
|
+
* @summary Add a private author profile message
|
|
207
|
+
*/
|
|
208
|
+
const learningAddAuthorMessage = async (authorId, learningAuthorMessageWrite, options) => {
|
|
209
|
+
const getHeaders = (h) => {
|
|
210
|
+
if (!h) return {};
|
|
211
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
212
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
213
|
+
const headers = {};
|
|
214
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
215
|
+
return headers;
|
|
216
|
+
};
|
|
217
|
+
return request(getLearningAddAuthorMessageUrl(authorId), {
|
|
218
|
+
...options,
|
|
219
|
+
method: "POST",
|
|
220
|
+
headers: {
|
|
221
|
+
"Content-Type": "application/json",
|
|
222
|
+
...getHeaders(options?.headers)
|
|
223
|
+
},
|
|
224
|
+
body: JSON.stringify(learningAuthorMessageWrite)
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
const getLearningAddAuthorMessageMutationKey = () => ["learningAddAuthorMessage"];
|
|
228
|
+
const getLearningAddAuthorMessageMutationOptions = (options) => {
|
|
229
|
+
const mutationKey = getLearningAddAuthorMessageMutationKey();
|
|
230
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
231
|
+
...options,
|
|
232
|
+
mutation: {
|
|
233
|
+
...options.mutation,
|
|
234
|
+
mutationKey
|
|
235
|
+
}
|
|
236
|
+
} : {
|
|
237
|
+
mutation: { mutationKey },
|
|
238
|
+
request: void 0
|
|
239
|
+
};
|
|
240
|
+
const mutationFn = (props) => {
|
|
241
|
+
const { authorId, data } = props ?? {};
|
|
242
|
+
return learningAddAuthorMessage(authorId, data, requestOptions);
|
|
243
|
+
};
|
|
244
|
+
return {
|
|
245
|
+
mutationFn,
|
|
246
|
+
...mutationOptions
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* @summary Add a private author profile message
|
|
251
|
+
*/
|
|
252
|
+
const useLearningAddAuthorMessage = (options, queryClient) => {
|
|
253
|
+
return useMutation(getLearningAddAuthorMessageMutationOptions(options), queryClient);
|
|
254
|
+
};
|
|
255
|
+
const getLearningPreviewAuthorPortraitUrl = (authorId, assetId) => {
|
|
256
|
+
return `/learning/author/profiles/${authorId}/portraits/${assetId}`;
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. Returns a delivery descriptor for a candidate image that the caller may use in this profile's catalogue. assetId may refer to a completed private portrait upload or eligible teaching image. Previewing does not publish it; the public portrait remains tied to the current public profile.
|
|
260
|
+
* @summary Preview an eligible private author portrait
|
|
261
|
+
*/
|
|
262
|
+
const learningPreviewAuthorPortrait = async (authorId, assetId, options) => {
|
|
263
|
+
return request(getLearningPreviewAuthorPortraitUrl(authorId, assetId), {
|
|
264
|
+
...options,
|
|
265
|
+
method: "GET"
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
const getLearningPreviewAuthorPortraitQueryKey = (authorId, assetId) => {
|
|
269
|
+
return [`/learning/author/profiles/${authorId}/portraits/${assetId}`];
|
|
270
|
+
};
|
|
271
|
+
const getLearningPreviewAuthorPortraitQueryOptions = (authorId, assetId, options) => {
|
|
272
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
273
|
+
const queryKey = queryOptions?.queryKey ?? getLearningPreviewAuthorPortraitQueryKey(authorId, assetId);
|
|
274
|
+
const queryFn = ({ signal }) => learningPreviewAuthorPortrait(authorId, assetId, {
|
|
275
|
+
signal,
|
|
276
|
+
...requestOptions
|
|
277
|
+
});
|
|
278
|
+
return {
|
|
279
|
+
queryKey,
|
|
280
|
+
queryFn,
|
|
281
|
+
enabled: authorId !== null && authorId !== void 0 && assetId !== null && assetId !== void 0,
|
|
282
|
+
...queryOptions
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* @summary Preview an eligible private author portrait
|
|
287
|
+
*/
|
|
288
|
+
function useLearningPreviewAuthorPortrait(authorId, assetId, options, queryClient) {
|
|
289
|
+
const queryOptions = getLearningPreviewAuthorPortraitQueryOptions(authorId, assetId, options);
|
|
290
|
+
const query = useQuery(queryOptions, queryClient);
|
|
291
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
292
|
+
}
|
|
293
|
+
const getLearningAuthorFragmentsUrl = (authorId, params) => {
|
|
294
|
+
const normalizedParams = new URLSearchParams();
|
|
295
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
296
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
297
|
+
});
|
|
298
|
+
const stringifiedParams = normalizedParams.toString();
|
|
299
|
+
return stringifiedParams.length > 0 ? `/learning/author/profiles/${authorId}/revision-fragments?${stringifiedParams}` : `/learning/author/profiles/${authorId}/revision-fragments`;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. Results are filtered to the caller's scope before pagination; page is one-based and limit is bounded by the shared pagination contract. A fragment is partial source evidence, not a complete native revision or a replayable patch. Missing source dates and publication facts remain unknown; neither version labels nor source status prove publication. Returns summaries for the profile's matched source identity, ordered by fragment ID. No source identity match produces an empty collection. Payload bytes are available from the scoped detail endpoint.
|
|
303
|
+
* @summary List an author's imported revision fragments
|
|
304
|
+
*/
|
|
305
|
+
const learningAuthorFragments = async (authorId, params, options) => {
|
|
306
|
+
return request(getLearningAuthorFragmentsUrl(authorId, params), {
|
|
307
|
+
...options,
|
|
308
|
+
method: "GET"
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
const getLearningAuthorFragmentsQueryKey = (authorId, params) => {
|
|
312
|
+
return [`/learning/author/profiles/${authorId}/revision-fragments`, ...params ? [params] : []];
|
|
313
|
+
};
|
|
314
|
+
const getLearningAuthorFragmentsQueryOptions = (authorId, params, options) => {
|
|
315
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
316
|
+
const queryKey = queryOptions?.queryKey ?? getLearningAuthorFragmentsQueryKey(authorId, params);
|
|
317
|
+
const queryFn = ({ signal }) => learningAuthorFragments(authorId, params, {
|
|
318
|
+
signal,
|
|
319
|
+
...requestOptions
|
|
320
|
+
});
|
|
321
|
+
return {
|
|
322
|
+
queryKey,
|
|
323
|
+
queryFn,
|
|
324
|
+
enabled: authorId !== null && authorId !== void 0,
|
|
325
|
+
...queryOptions
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* @summary List an author's imported revision fragments
|
|
330
|
+
*/
|
|
331
|
+
function useLearningAuthorFragments(authorId, params, options, queryClient) {
|
|
332
|
+
const queryOptions = getLearningAuthorFragmentsQueryOptions(authorId, params, options);
|
|
333
|
+
const query = useQuery(queryOptions, queryClient);
|
|
334
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
335
|
+
}
|
|
336
|
+
const getLearningAuthorFragmentUrl = (authorId, fragmentId) => {
|
|
337
|
+
return `/learning/author/profiles/${authorId}/revision-fragments/${fragmentId}`;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. A fragment is partial source evidence, not a complete native revision or a replayable patch. Missing source dates and publication facts remain unknown; neither version labels nor source status prove publication. fragmentId must match the selected author's source identity and catalogue. sourcePayload contains opaque base64-encoded source bytes when retained; inspect them as evidence, never execute or deserialize them as trusted application objects.
|
|
341
|
+
* @summary Read an author's imported revision fragment
|
|
342
|
+
*/
|
|
343
|
+
const learningAuthorFragment = async (authorId, fragmentId, options) => {
|
|
344
|
+
return request(getLearningAuthorFragmentUrl(authorId, fragmentId), {
|
|
345
|
+
...options,
|
|
346
|
+
method: "GET"
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
const getLearningAuthorFragmentQueryKey = (authorId, fragmentId) => {
|
|
350
|
+
return [`/learning/author/profiles/${authorId}/revision-fragments/${fragmentId}`];
|
|
351
|
+
};
|
|
352
|
+
const getLearningAuthorFragmentQueryOptions = (authorId, fragmentId, options) => {
|
|
353
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
354
|
+
const queryKey = queryOptions?.queryKey ?? getLearningAuthorFragmentQueryKey(authorId, fragmentId);
|
|
355
|
+
const queryFn = ({ signal }) => learningAuthorFragment(authorId, fragmentId, {
|
|
356
|
+
signal,
|
|
357
|
+
...requestOptions
|
|
358
|
+
});
|
|
359
|
+
return {
|
|
360
|
+
queryKey,
|
|
361
|
+
queryFn,
|
|
362
|
+
enabled: authorId !== null && authorId !== void 0 && fragmentId !== null && fragmentId !== void 0,
|
|
363
|
+
...queryOptions
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* @summary Read an author's imported revision fragment
|
|
368
|
+
*/
|
|
369
|
+
function useLearningAuthorFragment(authorId, fragmentId, options, queryClient) {
|
|
370
|
+
const queryOptions = getLearningAuthorFragmentQueryOptions(authorId, fragmentId, options);
|
|
371
|
+
const query = useQuery(queryOptions, queryClient);
|
|
372
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
373
|
+
}
|
|
374
|
+
const getLearningAuthorRevisionsUrl = (authorId, params) => {
|
|
375
|
+
const normalizedParams = new URLSearchParams();
|
|
376
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
377
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
378
|
+
});
|
|
379
|
+
const stringifiedParams = normalizedParams.toString();
|
|
380
|
+
return stringifiedParams.length > 0 ? `/learning/author/profiles/${authorId}/revisions?${stringifiedParams}` : `/learning/author/profiles/${authorId}/revisions`;
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are 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 revision ID descending. These are complete native definitions. Partial imported revisions are available separately from revision-fragments and are not promoted into this history. version counts revisions; editVersion counts replacements within a draft.
|
|
384
|
+
* @summary List an author's native editorial revisions
|
|
385
|
+
*/
|
|
386
|
+
const learningAuthorRevisions = async (authorId, params, options) => {
|
|
387
|
+
return request(getLearningAuthorRevisionsUrl(authorId, params), {
|
|
388
|
+
...options,
|
|
389
|
+
method: "GET"
|
|
390
|
+
});
|
|
391
|
+
};
|
|
392
|
+
const getLearningAuthorRevisionsQueryKey = (authorId, params) => {
|
|
393
|
+
return [`/learning/author/profiles/${authorId}/revisions`, ...params ? [params] : []];
|
|
394
|
+
};
|
|
395
|
+
const getLearningAuthorRevisionsQueryOptions = (authorId, params, options) => {
|
|
396
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
397
|
+
const queryKey = queryOptions?.queryKey ?? getLearningAuthorRevisionsQueryKey(authorId, params);
|
|
398
|
+
const queryFn = ({ signal }) => learningAuthorRevisions(authorId, params, {
|
|
399
|
+
signal,
|
|
400
|
+
...requestOptions
|
|
401
|
+
});
|
|
402
|
+
return {
|
|
403
|
+
queryKey,
|
|
404
|
+
queryFn,
|
|
405
|
+
enabled: authorId !== null && authorId !== void 0,
|
|
406
|
+
...queryOptions
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* @summary List an author's native editorial revisions
|
|
411
|
+
*/
|
|
412
|
+
function useLearningAuthorRevisions(authorId, params, options, queryClient) {
|
|
413
|
+
const queryOptions = getLearningAuthorRevisionsQueryOptions(authorId, params, options);
|
|
414
|
+
const query = useQuery(queryOptions, queryClient);
|
|
415
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
416
|
+
}
|
|
417
|
+
const getLearningDraftAuthorRevisionUrl = (authorId) => {
|
|
418
|
+
return `/learning/author/profiles/${authorId}/revisions`;
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. Creates the next numbered revision from the supplied full definition. No existing draft or submitted revision may be present. Rejected or published definitions remain in history. The public profile stays unchanged until this draft is submitted and approved.
|
|
422
|
+
* @summary Create the next author profile draft
|
|
423
|
+
*/
|
|
424
|
+
const learningDraftAuthorRevision = async (authorId, learningAuthorDefinitionWrite, options) => {
|
|
425
|
+
const getHeaders = (h) => {
|
|
426
|
+
if (!h) return {};
|
|
427
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
428
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
429
|
+
const headers = {};
|
|
430
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
431
|
+
return headers;
|
|
432
|
+
};
|
|
433
|
+
return request(getLearningDraftAuthorRevisionUrl(authorId), {
|
|
434
|
+
...options,
|
|
435
|
+
method: "POST",
|
|
436
|
+
headers: {
|
|
437
|
+
"Content-Type": "application/json",
|
|
438
|
+
...getHeaders(options?.headers)
|
|
439
|
+
},
|
|
440
|
+
body: JSON.stringify(learningAuthorDefinitionWrite)
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
const getLearningDraftAuthorRevisionMutationKey = () => ["learningDraftAuthorRevision"];
|
|
444
|
+
const getLearningDraftAuthorRevisionMutationOptions = (options) => {
|
|
445
|
+
const mutationKey = getLearningDraftAuthorRevisionMutationKey();
|
|
446
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
447
|
+
...options,
|
|
448
|
+
mutation: {
|
|
449
|
+
...options.mutation,
|
|
450
|
+
mutationKey
|
|
451
|
+
}
|
|
452
|
+
} : {
|
|
453
|
+
mutation: { mutationKey },
|
|
454
|
+
request: void 0
|
|
455
|
+
};
|
|
456
|
+
const mutationFn = (props) => {
|
|
457
|
+
const { authorId, data } = props ?? {};
|
|
458
|
+
return learningDraftAuthorRevision(authorId, data, requestOptions);
|
|
459
|
+
};
|
|
460
|
+
return {
|
|
461
|
+
mutationFn,
|
|
462
|
+
...mutationOptions
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
/**
|
|
466
|
+
* @summary Create the next author profile draft
|
|
467
|
+
*/
|
|
468
|
+
const useLearningDraftAuthorRevision = (options, queryClient) => {
|
|
469
|
+
return useMutation(getLearningDraftAuthorRevisionMutationOptions(options), queryClient);
|
|
470
|
+
};
|
|
471
|
+
const getLearningEditAuthorRevisionUrl = (authorId, revisionId) => {
|
|
472
|
+
return `/learning/author/profiles/${authorId}/revisions/${revisionId}`;
|
|
473
|
+
};
|
|
474
|
+
/**
|
|
475
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. Replaces the full draft definition and increments editVersion. expectedEditVersion must match the latest response. Only draft status is editable; a rejected profile revision needs a new successor. Neither this edit nor a private portrait preview changes the public profile.
|
|
476
|
+
* @summary Replace an editable author profile draft
|
|
477
|
+
*/
|
|
478
|
+
const learningEditAuthorRevision = async (authorId, revisionId, learningAuthorRevisionUpdateWrite, options) => {
|
|
479
|
+
const getHeaders = (h) => {
|
|
480
|
+
if (!h) return {};
|
|
481
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
482
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
483
|
+
const headers = {};
|
|
484
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
485
|
+
return headers;
|
|
486
|
+
};
|
|
487
|
+
return request(getLearningEditAuthorRevisionUrl(authorId, revisionId), {
|
|
488
|
+
...options,
|
|
489
|
+
method: "PUT",
|
|
490
|
+
headers: {
|
|
491
|
+
"Content-Type": "application/json",
|
|
492
|
+
...getHeaders(options?.headers)
|
|
493
|
+
},
|
|
494
|
+
body: JSON.stringify(learningAuthorRevisionUpdateWrite)
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
const getLearningEditAuthorRevisionMutationKey = () => ["learningEditAuthorRevision"];
|
|
498
|
+
const getLearningEditAuthorRevisionMutationOptions = (options) => {
|
|
499
|
+
const mutationKey = getLearningEditAuthorRevisionMutationKey();
|
|
500
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
501
|
+
...options,
|
|
502
|
+
mutation: {
|
|
503
|
+
...options.mutation,
|
|
504
|
+
mutationKey
|
|
505
|
+
}
|
|
506
|
+
} : {
|
|
507
|
+
mutation: { mutationKey },
|
|
508
|
+
request: void 0
|
|
509
|
+
};
|
|
510
|
+
const mutationFn = (props) => {
|
|
511
|
+
const { authorId, revisionId, data } = props ?? {};
|
|
512
|
+
return learningEditAuthorRevision(authorId, revisionId, data, requestOptions);
|
|
513
|
+
};
|
|
514
|
+
return {
|
|
515
|
+
mutationFn,
|
|
516
|
+
...mutationOptions
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
/**
|
|
520
|
+
* @summary Replace an editable author profile draft
|
|
521
|
+
*/
|
|
522
|
+
const useLearningEditAuthorRevision = (options, queryClient) => {
|
|
523
|
+
return useMutation(getLearningEditAuthorRevisionMutationOptions(options), queryClient);
|
|
524
|
+
};
|
|
525
|
+
const getLearningReviewAuthorRevisionUrl = (authorId, revisionId) => {
|
|
526
|
+
return `/learning/author/profiles/${authorId}/revisions/${revisionId}/review`;
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* Requires review authority for the author's active catalogue or global authority; ownership alone is insufficient. Only submitted revisions can be reviewed. Approval atomically updates the public identity, biography, portrait and activity flag, and supersedes the previous published revision. Rejection retains the current public profile and stores the review note.
|
|
530
|
+
* @summary Approve or reject an author profile revision
|
|
531
|
+
*/
|
|
532
|
+
const learningReviewAuthorRevision = async (authorId, revisionId, courseReviewWrite, options) => {
|
|
533
|
+
const getHeaders = (h) => {
|
|
534
|
+
if (!h) return {};
|
|
535
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
536
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
537
|
+
const headers = {};
|
|
538
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
539
|
+
return headers;
|
|
540
|
+
};
|
|
541
|
+
return request(getLearningReviewAuthorRevisionUrl(authorId, revisionId), {
|
|
542
|
+
...options,
|
|
543
|
+
method: "POST",
|
|
544
|
+
headers: {
|
|
545
|
+
"Content-Type": "application/json",
|
|
546
|
+
...getHeaders(options?.headers)
|
|
547
|
+
},
|
|
548
|
+
body: JSON.stringify(courseReviewWrite)
|
|
549
|
+
});
|
|
550
|
+
};
|
|
551
|
+
const getLearningReviewAuthorRevisionMutationKey = () => ["learningReviewAuthorRevision"];
|
|
552
|
+
const getLearningReviewAuthorRevisionMutationOptions = (options) => {
|
|
553
|
+
const mutationKey = getLearningReviewAuthorRevisionMutationKey();
|
|
554
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
555
|
+
...options,
|
|
556
|
+
mutation: {
|
|
557
|
+
...options.mutation,
|
|
558
|
+
mutationKey
|
|
559
|
+
}
|
|
560
|
+
} : {
|
|
561
|
+
mutation: { mutationKey },
|
|
562
|
+
request: void 0
|
|
563
|
+
};
|
|
564
|
+
const mutationFn = (props) => {
|
|
565
|
+
const { authorId, revisionId, data } = props ?? {};
|
|
566
|
+
return learningReviewAuthorRevision(authorId, revisionId, data, requestOptions);
|
|
567
|
+
};
|
|
568
|
+
return {
|
|
569
|
+
mutationFn,
|
|
570
|
+
...mutationOptions
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
/**
|
|
574
|
+
* @summary Approve or reject an author profile revision
|
|
575
|
+
*/
|
|
576
|
+
const useLearningReviewAuthorRevision = (options, queryClient) => {
|
|
577
|
+
return useMutation(getLearningReviewAuthorRevisionMutationOptions(options), queryClient);
|
|
578
|
+
};
|
|
579
|
+
const getLearningSubmitAuthorRevisionUrl = (authorId, revisionId) => {
|
|
580
|
+
return `/learning/author/profiles/${authorId}/revisions/${revisionId}/submit`;
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. Only a draft may be submitted. Revalidates the portrait, records submittedAt and freezes editing while awaiting review. The currently public biography and portrait remain in place until approval.
|
|
584
|
+
* @summary Submit an author profile draft for review
|
|
585
|
+
*/
|
|
586
|
+
const learningSubmitAuthorRevision = async (authorId, revisionId, options) => {
|
|
587
|
+
return request(getLearningSubmitAuthorRevisionUrl(authorId, revisionId), {
|
|
588
|
+
...options,
|
|
589
|
+
method: "POST"
|
|
590
|
+
});
|
|
591
|
+
};
|
|
592
|
+
const getLearningSubmitAuthorRevisionMutationKey = () => ["learningSubmitAuthorRevision"];
|
|
593
|
+
const getLearningSubmitAuthorRevisionMutationOptions = (options) => {
|
|
594
|
+
const mutationKey = getLearningSubmitAuthorRevisionMutationKey();
|
|
595
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
596
|
+
...options,
|
|
597
|
+
mutation: {
|
|
598
|
+
...options.mutation,
|
|
599
|
+
mutationKey
|
|
600
|
+
}
|
|
601
|
+
} : {
|
|
602
|
+
mutation: { mutationKey },
|
|
603
|
+
request: void 0
|
|
604
|
+
};
|
|
605
|
+
const mutationFn = (props) => {
|
|
606
|
+
const { authorId, revisionId } = props ?? {};
|
|
607
|
+
return learningSubmitAuthorRevision(authorId, revisionId, requestOptions);
|
|
608
|
+
};
|
|
609
|
+
return {
|
|
610
|
+
mutationFn,
|
|
611
|
+
...mutationOptions
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* @summary Submit an author profile draft for review
|
|
616
|
+
*/
|
|
617
|
+
const useLearningSubmitAuthorRevision = (options, queryClient) => {
|
|
618
|
+
return useMutation(getLearningSubmitAuthorRevisionMutationOptions(options), queryClient);
|
|
619
|
+
};
|
|
620
|
+
const getLearningReserveAuthorPortraitUrl = (authorId) => {
|
|
621
|
+
return `/learning/author/profiles/${authorId}/uploads`;
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* Visible only to the profile owner, a reviewer of its active catalogue, or a global operator. Support impersonation and dependent profiles are rejected. Reserves a PNG or JPEG of at most 10 MiB. Send exactly sizeBytes raw bytes with the declared Content-Type to uploadUrl using method before expiresAt. Reservation alone creates no usable portrait; reference the asset returned after upload completion in an author revision, then submit and approve it to make it public.
|
|
625
|
+
* @summary Reserve a private author portrait upload
|
|
626
|
+
*/
|
|
627
|
+
const learningReserveAuthorPortrait = async (authorId, learningUploadWrite, options) => {
|
|
628
|
+
const getHeaders = (h) => {
|
|
629
|
+
if (!h) return {};
|
|
630
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
631
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
632
|
+
const headers = {};
|
|
633
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
634
|
+
return headers;
|
|
635
|
+
};
|
|
636
|
+
return request(getLearningReserveAuthorPortraitUrl(authorId), {
|
|
637
|
+
...options,
|
|
638
|
+
method: "POST",
|
|
639
|
+
headers: {
|
|
640
|
+
"Content-Type": "application/json",
|
|
641
|
+
...getHeaders(options?.headers)
|
|
642
|
+
},
|
|
643
|
+
body: JSON.stringify(learningUploadWrite)
|
|
644
|
+
});
|
|
645
|
+
};
|
|
646
|
+
const getLearningReserveAuthorPortraitMutationKey = () => ["learningReserveAuthorPortrait"];
|
|
647
|
+
const getLearningReserveAuthorPortraitMutationOptions = (options) => {
|
|
648
|
+
const mutationKey = getLearningReserveAuthorPortraitMutationKey();
|
|
649
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
650
|
+
...options,
|
|
651
|
+
mutation: {
|
|
652
|
+
...options.mutation,
|
|
653
|
+
mutationKey
|
|
654
|
+
}
|
|
655
|
+
} : {
|
|
656
|
+
mutation: { mutationKey },
|
|
657
|
+
request: void 0
|
|
658
|
+
};
|
|
659
|
+
const mutationFn = (props) => {
|
|
660
|
+
const { authorId, data } = props ?? {};
|
|
661
|
+
return learningReserveAuthorPortrait(authorId, data, requestOptions);
|
|
662
|
+
};
|
|
663
|
+
return {
|
|
664
|
+
mutationFn,
|
|
665
|
+
...mutationOptions
|
|
666
|
+
};
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* @summary Reserve a private author portrait upload
|
|
670
|
+
*/
|
|
671
|
+
const useLearningReserveAuthorPortrait = (options, queryClient) => {
|
|
672
|
+
return useMutation(getLearningReserveAuthorPortraitMutationOptions(options), queryClient);
|
|
673
|
+
};
|
|
674
|
+
const getLearningPublicAuthorProfilesUrl = (params) => {
|
|
675
|
+
const normalizedParams = new URLSearchParams();
|
|
676
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
677
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
678
|
+
});
|
|
679
|
+
const stringifiedParams = normalizedParams.toString();
|
|
680
|
+
return stringifiedParams.length > 0 ? `/learning/authors?${stringifiedParams}` : `/learning/authors`;
|
|
681
|
+
};
|
|
682
|
+
/**
|
|
683
|
+
* Requires an authenticated effective profile in the learning context. Results are filtered to the caller's scope before pagination; page is one-based and limit is bounded by the shared pagination contract. Lists active profiles in active catalogues, ordered by author ID. Returns the current public projection, including imported public snapshots, with no private ownership, draft or review metadata. portraitUrl is the API locator for a separate media delivery request.
|
|
684
|
+
* @summary List published teaching author profiles
|
|
685
|
+
*/
|
|
686
|
+
const learningPublicAuthorProfiles = async (params, options) => {
|
|
687
|
+
return request(getLearningPublicAuthorProfilesUrl(params), {
|
|
688
|
+
...options,
|
|
689
|
+
method: "GET"
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
const getLearningPublicAuthorProfilesQueryKey = (params) => {
|
|
693
|
+
return [`/learning/authors`, ...params ? [params] : []];
|
|
694
|
+
};
|
|
695
|
+
const getLearningPublicAuthorProfilesQueryOptions = (params, options) => {
|
|
696
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
697
|
+
const queryKey = queryOptions?.queryKey ?? getLearningPublicAuthorProfilesQueryKey(params);
|
|
698
|
+
const queryFn = ({ signal }) => learningPublicAuthorProfiles(params, {
|
|
699
|
+
signal,
|
|
700
|
+
...requestOptions
|
|
701
|
+
});
|
|
702
|
+
return {
|
|
703
|
+
queryKey,
|
|
704
|
+
queryFn,
|
|
705
|
+
...queryOptions
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* @summary List published teaching author profiles
|
|
710
|
+
*/
|
|
711
|
+
function useLearningPublicAuthorProfiles(params, options, queryClient) {
|
|
712
|
+
const queryOptions = getLearningPublicAuthorProfilesQueryOptions(params, options);
|
|
713
|
+
const query = useQuery(queryOptions, queryClient);
|
|
714
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
715
|
+
}
|
|
716
|
+
const getLearningPublicAuthorProfileUrl = (authorId) => {
|
|
717
|
+
return `/learning/authors/${authorId}`;
|
|
718
|
+
};
|
|
719
|
+
/**
|
|
720
|
+
* Returns the current public profile to an authenticated effective profile in the learning context. Both the profile and its catalogue must be active. Pending drafts and review notes are private. Follow portraitUrl through the portrait endpoint to obtain a delivery descriptor.
|
|
721
|
+
* @summary Read a published teaching author profile
|
|
722
|
+
*/
|
|
723
|
+
const learningPublicAuthorProfile = async (authorId, options) => {
|
|
724
|
+
return request(getLearningPublicAuthorProfileUrl(authorId), {
|
|
725
|
+
...options,
|
|
726
|
+
method: "GET"
|
|
727
|
+
});
|
|
728
|
+
};
|
|
729
|
+
const getLearningPublicAuthorProfileQueryKey = (authorId) => {
|
|
730
|
+
return [`/learning/authors/${authorId}`];
|
|
731
|
+
};
|
|
732
|
+
const getLearningPublicAuthorProfileQueryOptions = (authorId, options) => {
|
|
733
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
734
|
+
const queryKey = queryOptions?.queryKey ?? getLearningPublicAuthorProfileQueryKey(authorId);
|
|
735
|
+
const queryFn = ({ signal }) => learningPublicAuthorProfile(authorId, {
|
|
736
|
+
signal,
|
|
737
|
+
...requestOptions
|
|
738
|
+
});
|
|
739
|
+
return {
|
|
740
|
+
queryKey,
|
|
741
|
+
queryFn,
|
|
742
|
+
enabled: authorId !== null && authorId !== void 0,
|
|
743
|
+
...queryOptions
|
|
744
|
+
};
|
|
745
|
+
};
|
|
746
|
+
/**
|
|
747
|
+
* @summary Read a published teaching author profile
|
|
748
|
+
*/
|
|
749
|
+
function useLearningPublicAuthorProfile(authorId, options, queryClient) {
|
|
750
|
+
const queryOptions = getLearningPublicAuthorProfileQueryOptions(authorId, options);
|
|
751
|
+
const query = useQuery(queryOptions, queryClient);
|
|
752
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
753
|
+
}
|
|
754
|
+
const getLearningAuthorPortraitUrl = (authorId) => {
|
|
755
|
+
return `/learning/authors/${authorId}/portrait`;
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
* Requires an active public author in an active catalogue. Returns a media delivery descriptor for the approved or imported public portrait, not image bytes. Draft portrait assets are accessible only through the private preview endpoint. Delivery URLs may expire and do not disclose storage keys or provider metadata.
|
|
759
|
+
* @summary Get the currently public author portrait
|
|
760
|
+
*/
|
|
761
|
+
const learningAuthorPortrait = async (authorId, options) => {
|
|
762
|
+
return request(getLearningAuthorPortraitUrl(authorId), {
|
|
763
|
+
...options,
|
|
764
|
+
method: "GET"
|
|
765
|
+
});
|
|
766
|
+
};
|
|
767
|
+
const getLearningAuthorPortraitQueryKey = (authorId) => {
|
|
768
|
+
return [`/learning/authors/${authorId}/portrait`];
|
|
769
|
+
};
|
|
770
|
+
const getLearningAuthorPortraitQueryOptions = (authorId, options) => {
|
|
771
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
772
|
+
const queryKey = queryOptions?.queryKey ?? getLearningAuthorPortraitQueryKey(authorId);
|
|
773
|
+
const queryFn = ({ signal }) => learningAuthorPortrait(authorId, {
|
|
774
|
+
signal,
|
|
775
|
+
...requestOptions
|
|
776
|
+
});
|
|
777
|
+
return {
|
|
778
|
+
queryKey,
|
|
779
|
+
queryFn,
|
|
780
|
+
enabled: authorId !== null && authorId !== void 0,
|
|
781
|
+
...queryOptions
|
|
782
|
+
};
|
|
783
|
+
};
|
|
784
|
+
/**
|
|
785
|
+
* @summary Get the currently public author portrait
|
|
786
|
+
*/
|
|
787
|
+
function useLearningAuthorPortrait(authorId, options, queryClient) {
|
|
788
|
+
const queryOptions = getLearningAuthorPortraitQueryOptions(authorId, options);
|
|
789
|
+
const query = useQuery(queryOptions, queryClient);
|
|
790
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
791
|
+
}
|
|
792
|
+
//#endregion
|
|
793
|
+
export { getLearningAddAuthorMessageMutationKey, getLearningAddAuthorMessageMutationOptions, getLearningAddAuthorMessageUrl, getLearningAuthorFragmentQueryKey, getLearningAuthorFragmentQueryOptions, getLearningAuthorFragmentUrl, getLearningAuthorFragmentsQueryKey, getLearningAuthorFragmentsQueryOptions, getLearningAuthorFragmentsUrl, getLearningAuthorMessagesQueryKey, getLearningAuthorMessagesQueryOptions, getLearningAuthorMessagesUrl, getLearningAuthorPortraitQueryKey, getLearningAuthorPortraitQueryOptions, getLearningAuthorPortraitUrl, getLearningAuthorProfileAdminQueryKey, getLearningAuthorProfileAdminQueryOptions, getLearningAuthorProfileAdminUrl, getLearningAuthorRevisionsQueryKey, getLearningAuthorRevisionsQueryOptions, getLearningAuthorRevisionsUrl, getLearningCreateAuthorProfileMutationKey, getLearningCreateAuthorProfileMutationOptions, getLearningCreateAuthorProfileUrl, getLearningDraftAuthorRevisionMutationKey, getLearningDraftAuthorRevisionMutationOptions, getLearningDraftAuthorRevisionUrl, getLearningEditAuthorRevisionMutationKey, getLearningEditAuthorRevisionMutationOptions, getLearningEditAuthorRevisionUrl, getLearningOwnAuthorProfilesQueryKey, getLearningOwnAuthorProfilesQueryOptions, getLearningOwnAuthorProfilesUrl, getLearningPreviewAuthorPortraitQueryKey, getLearningPreviewAuthorPortraitQueryOptions, getLearningPreviewAuthorPortraitUrl, getLearningPublicAuthorProfileQueryKey, getLearningPublicAuthorProfileQueryOptions, getLearningPublicAuthorProfileUrl, getLearningPublicAuthorProfilesQueryKey, getLearningPublicAuthorProfilesQueryOptions, getLearningPublicAuthorProfilesUrl, getLearningReserveAuthorPortraitMutationKey, getLearningReserveAuthorPortraitMutationOptions, getLearningReserveAuthorPortraitUrl, getLearningReviewAuthorRevisionMutationKey, getLearningReviewAuthorRevisionMutationOptions, getLearningReviewAuthorRevisionUrl, getLearningSubmitAuthorRevisionMutationKey, getLearningSubmitAuthorRevisionMutationOptions, getLearningSubmitAuthorRevisionUrl, learningAddAuthorMessage, learningAuthorFragment, learningAuthorFragments, learningAuthorMessages, learningAuthorPortrait, learningAuthorProfileAdmin, learningAuthorRevisions, learningCreateAuthorProfile, learningDraftAuthorRevision, learningEditAuthorRevision, learningOwnAuthorProfiles, learningPreviewAuthorPortrait, learningPublicAuthorProfile, learningPublicAuthorProfiles, learningReserveAuthorPortrait, learningReviewAuthorRevision, learningSubmitAuthorRevision, useLearningAddAuthorMessage, useLearningAuthorFragment, useLearningAuthorFragments, useLearningAuthorMessages, useLearningAuthorPortrait, useLearningAuthorProfileAdmin, useLearningAuthorRevisions, useLearningCreateAuthorProfile, useLearningDraftAuthorRevision, useLearningEditAuthorRevision, useLearningOwnAuthorProfiles, useLearningPreviewAuthorPortrait, useLearningPublicAuthorProfile, useLearningPublicAuthorProfiles, useLearningReserveAuthorPortrait, useLearningReviewAuthorRevision, useLearningSubmitAuthorRevision };
|
|
794
|
+
|
|
795
|
+
//# sourceMappingURL=biblio-learning-author-profiles.js.map
|