@gyldendalas/gyldendal-divine-api 0.2.7 → 0.2.9

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.d.ts CHANGED
@@ -840,22 +840,9 @@ declare class AIBotService extends BaseService {
840
840
  }): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
841
841
  }
842
842
 
843
- declare enum ApiErrors {
844
- OVERVIEW_NOT_FOUND = "Quiz overview not found",
845
- NOT_FOUND = "Quiz not found",
846
- ARCHIVED = "This shared quiz session is archived",
847
- GALE_USER_DATA_CLIENT_ERROR = "Failed to fetch Gale user data: Client error"
848
- }
849
843
  interface QuizStartResponse {
850
844
  quizUnitId: number;
851
845
  }
852
- interface QuizApiError {
853
- response: {
854
- _data: {
855
- Error: ApiErrors;
856
- };
857
- };
858
- }
859
846
  interface Quiz {
860
847
  quizId: number;
861
848
  quizName: string;
@@ -941,6 +928,7 @@ interface Answer {
941
928
  answerOptions?: AnswerIcon[];
942
929
  questionId?: number;
943
930
  answerBins?: AnswerBins[];
931
+ index?: number;
944
932
  }
945
933
  interface WordOptions {
946
934
  options: WordOptionsOption[];
@@ -978,10 +966,12 @@ interface Dropdown {
978
966
  option: string;
979
967
  isCorrect: boolean;
980
968
  position?: number;
969
+ index?: number;
981
970
  }
982
971
  interface DropdownFormattedOption {
983
972
  answerId: number;
984
973
  options: Dropdown[];
974
+ originalOptions: Dropdown[];
985
975
  }
986
976
  interface TableData {
987
977
  [key: string]: {
@@ -1175,9 +1165,9 @@ type QuizLocalState = {
1175
1165
  declare class QuizService extends BaseService {
1176
1166
  discoverUrlPrefix(): string;
1177
1167
  private makeHeaders;
1178
- checkActiveSession({ isbn, quizNumber, extraHeaders, timeout }: {
1168
+ checkActiveSession({ isbn, quiz, extraHeaders, timeout }: {
1179
1169
  isbn: string;
1180
- quizNumber: number;
1170
+ quiz: number;
1181
1171
  extraHeaders?: Record<string, string>;
1182
1172
  timeout?: number;
1183
1173
  }): Promise<QuizStartResponse>;
@@ -1295,4 +1285,4 @@ declare class SolrProxyService extends BaseService {
1295
1285
  discoverUrlPrefix(): string;
1296
1286
  }
1297
1287
 
1298
- export { AIBotService, type AIChatCompletion, type AIChatCompletionDelta, type AIChatCompletionOptions, type AIChatCompletionRequest, type AIChatMessage, type AIChatMessageDelta, type AIChatRole, type ActivePublicationFilters, type Answer, type AnswerBins, type AnswerIcon, ApiErrors, 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 QuizApiError, 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 };
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
@@ -1033,13 +1033,7 @@ var AIBotService = class extends base_service_default {
1033
1033
  };
1034
1034
 
1035
1035
  // src/services/quiz_service.ts
1036
- var ApiErrors = /* @__PURE__ */ ((ApiErrors2) => {
1037
- ApiErrors2["OVERVIEW_NOT_FOUND"] = "Quiz overview not found";
1038
- ApiErrors2["NOT_FOUND"] = "Quiz not found";
1039
- ApiErrors2["ARCHIVED"] = "This shared quiz session is archived";
1040
- ApiErrors2["GALE_USER_DATA_CLIENT_ERROR"] = "Failed to fetch Gale user data: Client error";
1041
- return ApiErrors2;
1042
- })(ApiErrors || {});
1036
+ var REQUEST_TIMEOUT = 1e4;
1043
1037
  var QuizService = class extends base_service_default {
1044
1038
  discoverUrlPrefix() {
1045
1039
  switch (this.environment) {
@@ -1070,11 +1064,11 @@ var QuizService = class extends base_service_default {
1070
1064
  // ─────────────────────────────────────────────────────────────
1071
1065
  async checkActiveSession({
1072
1066
  isbn,
1073
- quizNumber,
1067
+ quiz,
1074
1068
  extraHeaders,
1075
- timeout = 3e3
1069
+ timeout = REQUEST_TIMEOUT
1076
1070
  }) {
1077
- const url = `${this.getUrlPrefix()}/isbn/${isbn}/quiz/${quizNumber}`;
1071
+ const url = `${this.getUrlPrefix()}/isbn/${isbn}/quiz/${quiz}`;
1078
1072
  const headers = this.makeHeaders(extraHeaders);
1079
1073
  const res = await this.getAsync({ url, headers, timeout });
1080
1074
  return await res.json();
@@ -1084,7 +1078,7 @@ var QuizService = class extends base_service_default {
1084
1078
  quiz,
1085
1079
  shared,
1086
1080
  extraHeaders,
1087
- timeout = 3e3
1081
+ timeout = REQUEST_TIMEOUT
1088
1082
  }) {
1089
1083
  const url = shared ? `${this.getUrlPrefix()}/shared/student/${quiz}` : `${this.getUrlPrefix()}/isbn/${isbn}/quiz/${quiz}`;
1090
1084
  const headers = this.makeHeaders(extraHeaders);
@@ -1096,7 +1090,7 @@ var QuizService = class extends base_service_default {
1096
1090
  quizUnitId,
1097
1091
  shared,
1098
1092
  extraHeaders,
1099
- timeout = 3e3
1093
+ timeout = REQUEST_TIMEOUT
1100
1094
  }) {
1101
1095
  const url = shared ? `${this.getUrlPrefix()}/shared/student/${quizUnitId}` : `${this.getUrlPrefix()}/isbn/${isbn}/student/${quizUnitId}`;
1102
1096
  const headers = this.makeHeaders(extraHeaders);
@@ -1108,7 +1102,7 @@ var QuizService = class extends base_service_default {
1108
1102
  quizUnitId,
1109
1103
  questionID,
1110
1104
  extraHeaders,
1111
- timeout = 3e3
1105
+ timeout = REQUEST_TIMEOUT
1112
1106
  }) {
1113
1107
  const url = `${this.getUrlPrefix()}/isbn/${isbn}/student/${quizUnitId}/question/${questionID}`;
1114
1108
  const headers = this.makeHeaders(extraHeaders);
@@ -1126,7 +1120,7 @@ var QuizService = class extends base_service_default {
1126
1120
  answer,
1127
1121
  shared,
1128
1122
  extraHeaders,
1129
- timeout = 3e3
1123
+ timeout = REQUEST_TIMEOUT
1130
1124
  }) {
1131
1125
  const url = shared ? `${this.getUrlPrefix()}/shared/student/${quizUnitId}` : `${this.getUrlPrefix()}/isbn/${isbn}/student/${quizUnitId}`;
1132
1126
  const headers = this.makeHeaders(extraHeaders);
@@ -1143,7 +1137,7 @@ var QuizService = class extends base_service_default {
1143
1137
  quizUnitId,
1144
1138
  shared,
1145
1139
  extraHeaders,
1146
- timeout = 3e3
1140
+ timeout = REQUEST_TIMEOUT
1147
1141
  }) {
1148
1142
  const url = shared ? `${this.getUrlPrefix()}/shared/student/${quizUnitId}/finish` : `${this.getUrlPrefix()}/isbn/${isbn}/student/${quizUnitId}`;
1149
1143
  const headers = this.makeHeaders(extraHeaders);
@@ -1160,7 +1154,7 @@ var QuizService = class extends base_service_default {
1160
1154
  quizUnitId,
1161
1155
  shared,
1162
1156
  extraHeaders,
1163
- timeout = 3e3
1157
+ timeout = REQUEST_TIMEOUT
1164
1158
  }) {
1165
1159
  const url = shared ? `${this.getUrlPrefix()}/shared/student/${quizUnitId}/result` : `${this.getUrlPrefix()}/isbn/${isbn}/student/overview/${quizUnitId}`;
1166
1160
  const headers = this.makeHeaders(extraHeaders);
@@ -1173,7 +1167,7 @@ var QuizService = class extends base_service_default {
1173
1167
  async createSharedQuiz({
1174
1168
  quizData,
1175
1169
  extraHeaders,
1176
- timeout = 3e3
1170
+ timeout = REQUEST_TIMEOUT
1177
1171
  }) {
1178
1172
  const url = `${this.getUrlPrefix()}/shared/quiz`;
1179
1173
  const headers = this.makeHeaders(extraHeaders);
@@ -1190,7 +1184,7 @@ var QuizService = class extends base_service_default {
1190
1184
  quizData,
1191
1185
  action,
1192
1186
  extraHeaders,
1193
- timeout = 3e3
1187
+ timeout = REQUEST_TIMEOUT
1194
1188
  }) {
1195
1189
  const url = `${this.getUrlPrefix()}/shared/quiz/${quizSessionId}`;
1196
1190
  const method = action === "edit" ? "PUT" : "POST";
@@ -1211,7 +1205,7 @@ var QuizService = class extends base_service_default {
1211
1205
  async getTeachersQuizProblems({
1212
1206
  quizSessionId,
1213
1207
  extraHeaders,
1214
- timeout = 3e3
1208
+ timeout = REQUEST_TIMEOUT
1215
1209
  }) {
1216
1210
  const url = `${this.getUrlPrefix()}/shared/teacher/quizzes/${quizSessionId}/problems`;
1217
1211
  const headers = this.makeHeaders(extraHeaders);
@@ -1222,7 +1216,7 @@ var QuizService = class extends base_service_default {
1222
1216
  quizSessionId,
1223
1217
  quizUnitId,
1224
1218
  extraHeaders,
1225
- timeout = 3e3
1219
+ timeout = REQUEST_TIMEOUT
1226
1220
  }) {
1227
1221
  const url = `${this.getUrlPrefix()}/shared/teacher/quizzes/${quizSessionId}/units/${quizUnitId}`;
1228
1222
  const headers = this.makeHeaders(extraHeaders);
@@ -1234,7 +1228,7 @@ var QuizService = class extends base_service_default {
1234
1228
  questionId,
1235
1229
  activate,
1236
1230
  extraHeaders,
1237
- timeout = 3e3
1231
+ timeout = REQUEST_TIMEOUT
1238
1232
  }) {
1239
1233
  const url = `${this.getUrlPrefix()}/shared/teacher/quiz/${quizSessionId}/question/${questionId}`;
1240
1234
  const method = activate ? "PATCH" : "DELETE";
@@ -1249,7 +1243,7 @@ var QuizService = class extends base_service_default {
1249
1243
  }
1250
1244
  async getTeachersQuizzes({
1251
1245
  extraHeaders,
1252
- timeout = 3e3
1246
+ timeout = REQUEST_TIMEOUT
1253
1247
  }) {
1254
1248
  const url = `${this.getUrlPrefix()}/shared/teacher/quizzes`;
1255
1249
  const headers = this.makeHeaders(extraHeaders);
@@ -1258,7 +1252,7 @@ var QuizService = class extends base_service_default {
1258
1252
  }
1259
1253
  async getStudentsQuizzes({
1260
1254
  extraHeaders,
1261
- timeout = 3e3
1255
+ timeout = REQUEST_TIMEOUT
1262
1256
  }) {
1263
1257
  const url = `${this.getUrlPrefix()}/shared/student/quizzes`;
1264
1258
  const headers = this.makeHeaders(extraHeaders);
@@ -1268,7 +1262,7 @@ var QuizService = class extends base_service_default {
1268
1262
  async getTeachersQuiz({
1269
1263
  quizSessionId,
1270
1264
  extraHeaders,
1271
- timeout = 3e3
1265
+ timeout = REQUEST_TIMEOUT
1272
1266
  }) {
1273
1267
  const url = `${this.getUrlPrefix()}/shared/teacher/quizzes/${quizSessionId}`;
1274
1268
  const headers = this.makeHeaders(extraHeaders);
@@ -1279,7 +1273,7 @@ var QuizService = class extends base_service_default {
1279
1273
  quizSessionId,
1280
1274
  archive,
1281
1275
  extraHeaders,
1282
- timeout = 3e3
1276
+ timeout = REQUEST_TIMEOUT
1283
1277
  }) {
1284
1278
  const url = `${this.getUrlPrefix()}/shared/quiz/${quizSessionId}`;
1285
1279
  const method = archive ? "DELETE" : "PATCH";
@@ -1296,7 +1290,7 @@ var QuizService = class extends base_service_default {
1296
1290
  quizSessionId,
1297
1291
  quizUnitId,
1298
1292
  extraHeaders,
1299
- timeout = 3e3
1293
+ timeout = REQUEST_TIMEOUT
1300
1294
  }) {
1301
1295
  const url = `${this.getUrlPrefix()}/shared/teacher/quizzes/${quizSessionId}/units/${quizUnitId}`;
1302
1296
  const headers = this.makeHeaders(extraHeaders);
@@ -1342,7 +1336,6 @@ var SolrProxyService = class extends base_service_default {
1342
1336
  };
1343
1337
  export {
1344
1338
  AIBotService,
1345
- ApiErrors,
1346
1339
  CookieConsentLog,
1347
1340
  HighlightResultType,
1348
1341
  HighlightService,