@gyldendalas/gyldendal-divine-api 0.2.6 → 0.2.8
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/dist/index.cjs +13 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -16
- package/dist/index.d.ts +13 -16
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -42,6 +42,13 @@ declare class BaseService {
|
|
|
42
42
|
addAuthHeaders?: boolean;
|
|
43
43
|
timeout: number;
|
|
44
44
|
}): Promise<Response>;
|
|
45
|
+
patchAsync({ url, headers, addAuthHeaders, body, timeout }: {
|
|
46
|
+
url: URL | string;
|
|
47
|
+
headers: Headers | undefined | null;
|
|
48
|
+
addAuthHeaders?: boolean;
|
|
49
|
+
body: string | null | undefined;
|
|
50
|
+
timeout: number;
|
|
51
|
+
}): Promise<Response>;
|
|
45
52
|
callAsync({ url, body, method, headers, timeout, addAuthHeaders }: {
|
|
46
53
|
url: URL | string;
|
|
47
54
|
body: string | null | undefined;
|
|
@@ -833,22 +840,9 @@ declare class AIBotService extends BaseService {
|
|
|
833
840
|
}): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
834
841
|
}
|
|
835
842
|
|
|
836
|
-
declare enum ApiErrors {
|
|
837
|
-
OVERVIEW_NOT_FOUND = "Quiz overview not found",
|
|
838
|
-
NOT_FOUND = "Quiz not found",
|
|
839
|
-
ARCHIVED = "This shared quiz session is archived",
|
|
840
|
-
GALE_USER_DATA_CLIENT_ERROR = "Failed to fetch Gale user data: Client error"
|
|
841
|
-
}
|
|
842
843
|
interface QuizStartResponse {
|
|
843
844
|
quizUnitId: number;
|
|
844
845
|
}
|
|
845
|
-
interface QuizApiError {
|
|
846
|
-
response: {
|
|
847
|
-
_data: {
|
|
848
|
-
Error: ApiErrors;
|
|
849
|
-
};
|
|
850
|
-
};
|
|
851
|
-
}
|
|
852
846
|
interface Quiz {
|
|
853
847
|
quizId: number;
|
|
854
848
|
quizName: string;
|
|
@@ -934,6 +928,7 @@ interface Answer {
|
|
|
934
928
|
answerOptions?: AnswerIcon[];
|
|
935
929
|
questionId?: number;
|
|
936
930
|
answerBins?: AnswerBins[];
|
|
931
|
+
index?: number;
|
|
937
932
|
}
|
|
938
933
|
interface WordOptions {
|
|
939
934
|
options: WordOptionsOption[];
|
|
@@ -971,10 +966,12 @@ interface Dropdown {
|
|
|
971
966
|
option: string;
|
|
972
967
|
isCorrect: boolean;
|
|
973
968
|
position?: number;
|
|
969
|
+
index?: number;
|
|
974
970
|
}
|
|
975
971
|
interface DropdownFormattedOption {
|
|
976
972
|
answerId: number;
|
|
977
973
|
options: Dropdown[];
|
|
974
|
+
originalOptions: Dropdown[];
|
|
978
975
|
}
|
|
979
976
|
interface TableData {
|
|
980
977
|
[key: string]: {
|
|
@@ -1168,9 +1165,9 @@ type QuizLocalState = {
|
|
|
1168
1165
|
declare class QuizService extends BaseService {
|
|
1169
1166
|
discoverUrlPrefix(): string;
|
|
1170
1167
|
private makeHeaders;
|
|
1171
|
-
checkActiveSession({ isbn,
|
|
1168
|
+
checkActiveSession({ isbn, quiz, extraHeaders, timeout }: {
|
|
1172
1169
|
isbn: string;
|
|
1173
|
-
|
|
1170
|
+
quiz: number;
|
|
1174
1171
|
extraHeaders?: Record<string, string>;
|
|
1175
1172
|
timeout?: number;
|
|
1176
1173
|
}): Promise<QuizStartResponse>;
|
|
@@ -1288,4 +1285,4 @@ declare class SolrProxyService extends BaseService {
|
|
|
1288
1285
|
discoverUrlPrefix(): string;
|
|
1289
1286
|
}
|
|
1290
1287
|
|
|
1291
|
-
export { AIBotService, type AIChatCompletion, type AIChatCompletionDelta, type AIChatCompletionOptions, type AIChatCompletionRequest, type AIChatMessage, type AIChatMessageDelta, type AIChatRole, type ActivePublicationFilters, type Answer, type AnswerBins, type AnswerIcon,
|
|
1288
|
+
export { AIBotService, type AIChatCompletion, type AIChatCompletionDelta, type AIChatCompletionOptions, type AIChatCompletionRequest, type AIChatMessage, type AIChatMessageDelta, type AIChatRole, type ActivePublicationFilters, type Answer, type AnswerBins, type AnswerIcon, type Bookmark, type BookmarkUpdate, type CalculatedScore, type ChosenAnswer, type ClientSettings, type ClientSettingsResponse, type Continue, type ContinueUpdate, CookieConsentLog, type CookieConsentRequest, type CookieConsentResponse, type CookieConsentState, type CurrentSpeedSelection, type CurrentVoiceSelection, type DisplayModeOption, type Dropdown, type DropdownFormattedOption, type DropdownMap, type Folder, type FolderContent, type FolderObject, type FontFamily, type FormattedQuestion, type FormattedQuizUnit, type FrontPageSection, type Highlight, type HighlightAddResult, type HighlightCountResponse, type HighlightDeleteResult, type HighlightRanges, type HighlightRequest, type HighlightResponse, HighlightResultType, type HighlightSearchRequest, type HighlightSearchResponse, HighlightService, type HighlightUpdate, type HighlightUpdateRequest, type HighlightUpdateResponse, type HiglightSearchMatch, type ICtype, type ICtypeDict, type IRecreationData, type ITextStartEndObject, type InputText, type InputTextMap, type LayoutView, type MRU, type Mediafile, type NewAnswer, type NoteHighlight, type Notes, type NotesData, type NotesLabels, type NotesRequest, PdfGeneratorService, PollyService, type ProblemAnswerState, type ProblemScore, type Question, type Quiz, type QuizLocalState, type QuizResult, QuizService, type QuizSession, type QuizStartResponse, type QuizTableAction, type QuizTableItem, type QuizTextSettings, type QuizUnit, type ReadAloudStore, type Readability, type Response$1 as Response, type Results, SSMLSpeechSpeeds, type SaveAnswer, type SaveAnswerResponse, type Score, type SearchableKeys, type SharedQuizData, type SharedStudentQuiz, type SharedTeacherQuiz, type SiteMapContent, type SiteMapLabels, type SiteMapPage, type SiteMapPageTreeData, type SiteMapPageTreeItem, type SiteMapRequest, SolrProxyService, type SortOptions, type SpeechmarkEvent, type SynthesisRequest, type SynthesisResponse, type TableData, type TableDataColumn, type Tag, type TagOutput, TaggingService, type TimeSpent, type Tokens, type TokensDiffCheck, UserFolders, UserSettingsBookmarks, UserSettingsClientSettings, UserSettingsContinue, UserSettingsMRU, type WordOptions, type WordOptionsAnswer, type WordOptionsAnswerText, type WordOptionsOption, type WritingTaskData, type WritingTaskItem, type WritingTaskRequest, WritingTaskService };
|
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,13 @@ declare class BaseService {
|
|
|
42
42
|
addAuthHeaders?: boolean;
|
|
43
43
|
timeout: number;
|
|
44
44
|
}): Promise<Response>;
|
|
45
|
+
patchAsync({ url, headers, addAuthHeaders, body, timeout }: {
|
|
46
|
+
url: URL | string;
|
|
47
|
+
headers: Headers | undefined | null;
|
|
48
|
+
addAuthHeaders?: boolean;
|
|
49
|
+
body: string | null | undefined;
|
|
50
|
+
timeout: number;
|
|
51
|
+
}): Promise<Response>;
|
|
45
52
|
callAsync({ url, body, method, headers, timeout, addAuthHeaders }: {
|
|
46
53
|
url: URL | string;
|
|
47
54
|
body: string | null | undefined;
|
|
@@ -833,22 +840,9 @@ declare class AIBotService extends BaseService {
|
|
|
833
840
|
}): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
834
841
|
}
|
|
835
842
|
|
|
836
|
-
declare enum ApiErrors {
|
|
837
|
-
OVERVIEW_NOT_FOUND = "Quiz overview not found",
|
|
838
|
-
NOT_FOUND = "Quiz not found",
|
|
839
|
-
ARCHIVED = "This shared quiz session is archived",
|
|
840
|
-
GALE_USER_DATA_CLIENT_ERROR = "Failed to fetch Gale user data: Client error"
|
|
841
|
-
}
|
|
842
843
|
interface QuizStartResponse {
|
|
843
844
|
quizUnitId: number;
|
|
844
845
|
}
|
|
845
|
-
interface QuizApiError {
|
|
846
|
-
response: {
|
|
847
|
-
_data: {
|
|
848
|
-
Error: ApiErrors;
|
|
849
|
-
};
|
|
850
|
-
};
|
|
851
|
-
}
|
|
852
846
|
interface Quiz {
|
|
853
847
|
quizId: number;
|
|
854
848
|
quizName: string;
|
|
@@ -934,6 +928,7 @@ interface Answer {
|
|
|
934
928
|
answerOptions?: AnswerIcon[];
|
|
935
929
|
questionId?: number;
|
|
936
930
|
answerBins?: AnswerBins[];
|
|
931
|
+
index?: number;
|
|
937
932
|
}
|
|
938
933
|
interface WordOptions {
|
|
939
934
|
options: WordOptionsOption[];
|
|
@@ -971,10 +966,12 @@ interface Dropdown {
|
|
|
971
966
|
option: string;
|
|
972
967
|
isCorrect: boolean;
|
|
973
968
|
position?: number;
|
|
969
|
+
index?: number;
|
|
974
970
|
}
|
|
975
971
|
interface DropdownFormattedOption {
|
|
976
972
|
answerId: number;
|
|
977
973
|
options: Dropdown[];
|
|
974
|
+
originalOptions: Dropdown[];
|
|
978
975
|
}
|
|
979
976
|
interface TableData {
|
|
980
977
|
[key: string]: {
|
|
@@ -1168,9 +1165,9 @@ type QuizLocalState = {
|
|
|
1168
1165
|
declare class QuizService extends BaseService {
|
|
1169
1166
|
discoverUrlPrefix(): string;
|
|
1170
1167
|
private makeHeaders;
|
|
1171
|
-
checkActiveSession({ isbn,
|
|
1168
|
+
checkActiveSession({ isbn, quiz, extraHeaders, timeout }: {
|
|
1172
1169
|
isbn: string;
|
|
1173
|
-
|
|
1170
|
+
quiz: number;
|
|
1174
1171
|
extraHeaders?: Record<string, string>;
|
|
1175
1172
|
timeout?: number;
|
|
1176
1173
|
}): Promise<QuizStartResponse>;
|
|
@@ -1288,4 +1285,4 @@ declare class SolrProxyService extends BaseService {
|
|
|
1288
1285
|
discoverUrlPrefix(): string;
|
|
1289
1286
|
}
|
|
1290
1287
|
|
|
1291
|
-
export { AIBotService, type AIChatCompletion, type AIChatCompletionDelta, type AIChatCompletionOptions, type AIChatCompletionRequest, type AIChatMessage, type AIChatMessageDelta, type AIChatRole, type ActivePublicationFilters, type Answer, type AnswerBins, type AnswerIcon,
|
|
1288
|
+
export { AIBotService, type AIChatCompletion, type AIChatCompletionDelta, type AIChatCompletionOptions, type AIChatCompletionRequest, type AIChatMessage, type AIChatMessageDelta, type AIChatRole, type ActivePublicationFilters, type Answer, type AnswerBins, type AnswerIcon, type Bookmark, type BookmarkUpdate, type CalculatedScore, type ChosenAnswer, type ClientSettings, type ClientSettingsResponse, type Continue, type ContinueUpdate, CookieConsentLog, type CookieConsentRequest, type CookieConsentResponse, type CookieConsentState, type CurrentSpeedSelection, type CurrentVoiceSelection, type DisplayModeOption, type Dropdown, type DropdownFormattedOption, type DropdownMap, type Folder, type FolderContent, type FolderObject, type FontFamily, type FormattedQuestion, type FormattedQuizUnit, type FrontPageSection, type Highlight, type HighlightAddResult, type HighlightCountResponse, type HighlightDeleteResult, type HighlightRanges, type HighlightRequest, type HighlightResponse, HighlightResultType, type HighlightSearchRequest, type HighlightSearchResponse, HighlightService, type HighlightUpdate, type HighlightUpdateRequest, type HighlightUpdateResponse, type HiglightSearchMatch, type ICtype, type ICtypeDict, type IRecreationData, type ITextStartEndObject, type InputText, type InputTextMap, type LayoutView, type MRU, type Mediafile, type NewAnswer, type NoteHighlight, type Notes, type NotesData, type NotesLabels, type NotesRequest, PdfGeneratorService, PollyService, type ProblemAnswerState, type ProblemScore, type Question, type Quiz, type QuizLocalState, type QuizResult, QuizService, type QuizSession, type QuizStartResponse, type QuizTableAction, type QuizTableItem, type QuizTextSettings, type QuizUnit, type ReadAloudStore, type Readability, type Response$1 as Response, type Results, SSMLSpeechSpeeds, type SaveAnswer, type SaveAnswerResponse, type Score, type SearchableKeys, type SharedQuizData, type SharedStudentQuiz, type SharedTeacherQuiz, type SiteMapContent, type SiteMapLabels, type SiteMapPage, type SiteMapPageTreeData, type SiteMapPageTreeItem, type SiteMapRequest, SolrProxyService, type SortOptions, type SpeechmarkEvent, type SynthesisRequest, type SynthesisResponse, type TableData, type TableDataColumn, type Tag, type TagOutput, TaggingService, type TimeSpent, type Tokens, type TokensDiffCheck, UserFolders, UserSettingsBookmarks, UserSettingsClientSettings, UserSettingsContinue, UserSettingsMRU, type WordOptions, type WordOptionsAnswer, type WordOptionsAnswerText, type WordOptionsOption, type WritingTaskData, type WritingTaskItem, type WritingTaskRequest, WritingTaskService };
|
package/dist/index.js
CHANGED
|
@@ -84,6 +84,16 @@ var BaseService = class {
|
|
|
84
84
|
const method = "DELETE";
|
|
85
85
|
return await this.callAsync({ url, body: null, method, headers, addAuthHeaders, timeout });
|
|
86
86
|
}
|
|
87
|
+
async patchAsync({
|
|
88
|
+
url,
|
|
89
|
+
headers,
|
|
90
|
+
addAuthHeaders = true,
|
|
91
|
+
body,
|
|
92
|
+
timeout
|
|
93
|
+
}) {
|
|
94
|
+
const method = "PATCH";
|
|
95
|
+
return await this.callAsync({ url, body, method, headers, addAuthHeaders, timeout });
|
|
96
|
+
}
|
|
87
97
|
async callAsync({
|
|
88
98
|
url,
|
|
89
99
|
body,
|
|
@@ -1023,13 +1033,6 @@ var AIBotService = class extends base_service_default {
|
|
|
1023
1033
|
};
|
|
1024
1034
|
|
|
1025
1035
|
// src/services/quiz_service.ts
|
|
1026
|
-
var ApiErrors = /* @__PURE__ */ ((ApiErrors2) => {
|
|
1027
|
-
ApiErrors2["OVERVIEW_NOT_FOUND"] = "Quiz overview not found";
|
|
1028
|
-
ApiErrors2["NOT_FOUND"] = "Quiz not found";
|
|
1029
|
-
ApiErrors2["ARCHIVED"] = "This shared quiz session is archived";
|
|
1030
|
-
ApiErrors2["GALE_USER_DATA_CLIENT_ERROR"] = "Failed to fetch Gale user data: Client error";
|
|
1031
|
-
return ApiErrors2;
|
|
1032
|
-
})(ApiErrors || {});
|
|
1033
1036
|
var QuizService = class extends base_service_default {
|
|
1034
1037
|
discoverUrlPrefix() {
|
|
1035
1038
|
switch (this.environment) {
|
|
@@ -1060,11 +1063,11 @@ var QuizService = class extends base_service_default {
|
|
|
1060
1063
|
// ─────────────────────────────────────────────────────────────
|
|
1061
1064
|
async checkActiveSession({
|
|
1062
1065
|
isbn,
|
|
1063
|
-
|
|
1066
|
+
quiz,
|
|
1064
1067
|
extraHeaders,
|
|
1065
1068
|
timeout = 3e3
|
|
1066
1069
|
}) {
|
|
1067
|
-
const url = `${this.getUrlPrefix()}/isbn/${isbn}/quiz/${
|
|
1070
|
+
const url = `${this.getUrlPrefix()}/isbn/${isbn}/quiz/${quiz}`;
|
|
1068
1071
|
const headers = this.makeHeaders(extraHeaders);
|
|
1069
1072
|
const res = await this.getAsync({ url, headers, timeout });
|
|
1070
1073
|
return await res.json();
|
|
@@ -1229,7 +1232,7 @@ var QuizService = class extends base_service_default {
|
|
|
1229
1232
|
const url = `${this.getUrlPrefix()}/shared/teacher/quiz/${quizSessionId}/question/${questionId}`;
|
|
1230
1233
|
const method = activate ? "PATCH" : "DELETE";
|
|
1231
1234
|
const headers = this.makeHeaders(extraHeaders);
|
|
1232
|
-
const res = method === "PATCH" ? await this.
|
|
1235
|
+
const res = method === "PATCH" ? await this.patchAsync({
|
|
1233
1236
|
url,
|
|
1234
1237
|
headers,
|
|
1235
1238
|
body: null,
|
|
@@ -1332,7 +1335,6 @@ var SolrProxyService = class extends base_service_default {
|
|
|
1332
1335
|
};
|
|
1333
1336
|
export {
|
|
1334
1337
|
AIBotService,
|
|
1335
|
-
ApiErrors,
|
|
1336
1338
|
CookieConsentLog,
|
|
1337
1339
|
HighlightResultType,
|
|
1338
1340
|
HighlightService,
|