scorm-again 2.0.0 → 2.2.0
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/.github/workflows/stale.yml +14 -0
- package/.run/{Mocha Unit Tests.run.xml → Mocha Unit Tests (watch).run.xml } +1 -1
- package/.run/Template Mocha.run.xml +17 -0
- package/README.md +180 -72
- package/dist/aicc.js +1520 -1149
- package/dist/aicc.js.map +1 -1
- package/dist/aicc.min.js +1 -1
- package/dist/aicc.min.js.map +1 -1
- package/dist/scorm-again.js +2812 -2205
- package/dist/scorm-again.js.map +1 -1
- package/dist/scorm-again.min.js +1 -1
- package/dist/scorm-again.min.js.map +1 -1
- package/dist/scorm12.js +1129 -842
- package/dist/scorm12.js.map +1 -1
- package/dist/scorm12.min.js +1 -1
- package/dist/scorm12.min.js.map +1 -1
- package/dist/scorm2004.js +1921 -1564
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +1 -1
- package/dist/scorm2004.min.js.map +1 -1
- package/package.json +20 -17
- package/src/AICC.ts +15 -17
- package/src/BaseAPI.ts +283 -420
- package/src/Scorm12API.ts +133 -41
- package/src/Scorm2004API.ts +224 -120
- package/src/cmi/aicc/attempts.ts +94 -0
- package/src/cmi/aicc/cmi.ts +100 -0
- package/src/cmi/aicc/core.ts +360 -0
- package/src/cmi/aicc/evaluation.ts +157 -0
- package/src/cmi/aicc/paths.ts +180 -0
- package/src/cmi/aicc/student_data.ts +86 -0
- package/src/cmi/aicc/student_demographics.ts +367 -0
- package/src/cmi/aicc/student_preferences.ts +176 -0
- package/src/cmi/aicc/tries.ts +116 -0
- package/src/cmi/aicc/validation.ts +25 -0
- package/src/cmi/common/array.ts +77 -0
- package/src/cmi/common/base_cmi.ts +46 -0
- package/src/cmi/common/score.ts +203 -0
- package/src/cmi/common/validation.ts +60 -0
- package/src/cmi/scorm12/cmi.ts +224 -0
- package/src/cmi/scorm12/interactions.ts +368 -0
- package/src/cmi/scorm12/nav.ts +54 -0
- package/src/cmi/scorm12/objectives.ts +112 -0
- package/src/cmi/scorm12/student_data.ts +130 -0
- package/src/cmi/scorm12/student_preference.ts +158 -0
- package/src/cmi/scorm12/validation.ts +48 -0
- package/src/cmi/scorm2004/adl.ts +272 -0
- package/src/cmi/scorm2004/cmi.ts +599 -0
- package/src/cmi/scorm2004/comments.ts +163 -0
- package/src/cmi/scorm2004/interactions.ts +466 -0
- package/src/cmi/scorm2004/learner_preference.ts +152 -0
- package/src/cmi/scorm2004/objectives.ts +212 -0
- package/src/cmi/scorm2004/score.ts +78 -0
- package/src/cmi/scorm2004/validation.ts +42 -0
- package/src/constants/default_settings.ts +82 -0
- package/src/constants/enums.ts +17 -0
- package/src/constants/regex.ts +2 -2
- package/src/constants/response_constants.ts +2 -0
- package/src/exceptions.ts +22 -1
- package/src/helpers/scheduled_commit.ts +42 -0
- package/src/interfaces/IBaseAPI.ts +35 -0
- package/src/types/api_types.ts +50 -0
- package/src/utilities/debounce.ts +31 -0
- package/src/utilities.ts +56 -0
- package/test/AICC.spec.ts +11 -1
- package/test/Scorm12API.spec.ts +372 -9
- package/test/Scorm2004API.spec.ts +558 -2
- package/test/cmi/aicc_cmi.spec.ts +188 -11
- package/test/cmi/scorm12_cmi.spec.ts +5 -5
- package/test/cmi/scorm2004_cmi.spec.ts +8 -8
- package/test/cmi_helpers.ts +1 -1
- package/test/types/api_types.spec.ts +126 -0
- package/test/utilities/debounce.spec.ts +56 -0
- package/src/cmi/aicc_cmi.ts +0 -1248
- package/src/cmi/common.ts +0 -411
- package/src/cmi/scorm12_cmi.ts +0 -1426
- package/src/cmi/scorm2004_cmi.ts +0 -1874
package/src/cmi/aicc_cmi.ts
DELETED
|
@@ -1,1248 +0,0 @@
|
|
|
1
|
-
import * as Scorm12CMI from "./scorm12_cmi";
|
|
2
|
-
import { BaseCMI, checkValidFormat, CMIArray, CMIScore } from "./common";
|
|
3
|
-
import APIConstants from "../constants/api_constants";
|
|
4
|
-
import Regex from "../constants/regex";
|
|
5
|
-
import ErrorCodes from "../constants/error_codes";
|
|
6
|
-
import { AICCValidationError } from "../exceptions";
|
|
7
|
-
|
|
8
|
-
const aicc_constants = APIConstants.aicc;
|
|
9
|
-
const aicc_regex = Regex.aicc;
|
|
10
|
-
const aicc_error_codes = ErrorCodes.scorm12;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Helper method, no reason to have to pass the same error codes every time
|
|
14
|
-
* @param {string} value
|
|
15
|
-
* @param {string} regexPattern
|
|
16
|
-
* @param {boolean} allowEmptyString
|
|
17
|
-
* @return {boolean}
|
|
18
|
-
*/
|
|
19
|
-
function checkAICCValidFormat(
|
|
20
|
-
value: string,
|
|
21
|
-
regexPattern: string,
|
|
22
|
-
allowEmptyString?: boolean,
|
|
23
|
-
): boolean {
|
|
24
|
-
return checkValidFormat(
|
|
25
|
-
value,
|
|
26
|
-
regexPattern,
|
|
27
|
-
aicc_error_codes.TYPE_MISMATCH,
|
|
28
|
-
AICCValidationError,
|
|
29
|
-
allowEmptyString,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* CMI Class for AICC
|
|
35
|
-
*/
|
|
36
|
-
export class CMI extends Scorm12CMI.CMI {
|
|
37
|
-
/**
|
|
38
|
-
* Constructor for AICC CMI object
|
|
39
|
-
* @param {boolean} initialized
|
|
40
|
-
*/
|
|
41
|
-
constructor(initialized: boolean = false) {
|
|
42
|
-
super(aicc_constants.cmi_children);
|
|
43
|
-
if (initialized) this.initialize();
|
|
44
|
-
this.student_preference = new AICCStudentPreferences();
|
|
45
|
-
this.student_data = new AICCCMIStudentData();
|
|
46
|
-
this.student_demographics = new CMIStudentDemographics();
|
|
47
|
-
this.evaluation = new CMIEvaluation();
|
|
48
|
-
this.paths = new CMIPaths();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public student_data: AICCCMIStudentData;
|
|
52
|
-
public student_preference: AICCStudentPreferences;
|
|
53
|
-
public student_demographics: CMIStudentDemographics;
|
|
54
|
-
public evaluation: CMIEvaluation;
|
|
55
|
-
public paths: CMIPaths;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Called when the API has been initialized after the CMI has been created
|
|
59
|
-
*/
|
|
60
|
-
initialize() {
|
|
61
|
-
super.initialize();
|
|
62
|
-
this.student_preference?.initialize();
|
|
63
|
-
this.student_data?.initialize();
|
|
64
|
-
this.student_demographics?.initialize();
|
|
65
|
-
this.evaluation?.initialize();
|
|
66
|
-
this.paths?.initialize();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* toJSON for cmi
|
|
71
|
-
*
|
|
72
|
-
* @return {
|
|
73
|
-
* {
|
|
74
|
-
* suspend_data: string,
|
|
75
|
-
* launch_data: string,
|
|
76
|
-
* comments: string,
|
|
77
|
-
* comments_from_lms: string,
|
|
78
|
-
* core: CMICore,
|
|
79
|
-
* objectives: CMIObjectives,
|
|
80
|
-
* student_data: CMIStudentData,
|
|
81
|
-
* student_preference: CMIStudentPreference,
|
|
82
|
-
* interactions: CMIInteractions,
|
|
83
|
-
* paths: CMIPaths
|
|
84
|
-
* }
|
|
85
|
-
* }
|
|
86
|
-
*/
|
|
87
|
-
toJSON(): {
|
|
88
|
-
suspend_data: string;
|
|
89
|
-
launch_data: string;
|
|
90
|
-
comments: string;
|
|
91
|
-
comments_from_lms: string;
|
|
92
|
-
core: Scorm12CMI.CMICore;
|
|
93
|
-
objectives: Scorm12CMI.CMIObjectives;
|
|
94
|
-
student_data: Scorm12CMI.CMIStudentData;
|
|
95
|
-
student_preference: Scorm12CMI.CMIStudentPreference;
|
|
96
|
-
student_demographics: CMIStudentDemographics;
|
|
97
|
-
interactions: Scorm12CMI.CMIInteractions;
|
|
98
|
-
evaluation: CMIEvaluation;
|
|
99
|
-
paths: CMIPaths;
|
|
100
|
-
} {
|
|
101
|
-
this.jsonString = true;
|
|
102
|
-
const result = {
|
|
103
|
-
suspend_data: this.suspend_data,
|
|
104
|
-
launch_data: this.launch_data,
|
|
105
|
-
comments: this.comments,
|
|
106
|
-
comments_from_lms: this.comments_from_lms,
|
|
107
|
-
core: this.core,
|
|
108
|
-
objectives: this.objectives,
|
|
109
|
-
student_data: this.student_data,
|
|
110
|
-
student_preference: this.student_preference,
|
|
111
|
-
student_demographics: this.student_demographics,
|
|
112
|
-
interactions: this.interactions,
|
|
113
|
-
evaluation: this.evaluation,
|
|
114
|
-
paths: this.paths,
|
|
115
|
-
};
|
|
116
|
-
delete this.jsonString;
|
|
117
|
-
return result;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* AICC Evaluation object
|
|
123
|
-
*/
|
|
124
|
-
|
|
125
|
-
class CMIEvaluation extends BaseCMI {
|
|
126
|
-
/**
|
|
127
|
-
* Constructor for AICC Evaluation object
|
|
128
|
-
*/
|
|
129
|
-
constructor() {
|
|
130
|
-
super();
|
|
131
|
-
this.comments = new CMIEvaluationComments();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public comments: CMIEvaluationComments;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Called when the API has been initialized after the CMI has been created
|
|
138
|
-
*/
|
|
139
|
-
initialize() {
|
|
140
|
-
super.initialize();
|
|
141
|
-
this.comments?.initialize();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* toJSON for cmi.evaluation object
|
|
146
|
-
* @return {{comments: CMIEvaluationComments}}
|
|
147
|
-
*/
|
|
148
|
-
toJSON(): {
|
|
149
|
-
comments: CMIEvaluationComments;
|
|
150
|
-
} {
|
|
151
|
-
this.jsonString = true;
|
|
152
|
-
const result = {
|
|
153
|
-
comments: this.comments,
|
|
154
|
-
};
|
|
155
|
-
delete this.jsonString;
|
|
156
|
-
return result;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Class representing AICC's cmi.evaluation.comments object
|
|
162
|
-
*/
|
|
163
|
-
|
|
164
|
-
class CMIEvaluationComments extends CMIArray {
|
|
165
|
-
/**
|
|
166
|
-
* Constructor for AICC Evaluation Comments object
|
|
167
|
-
*/
|
|
168
|
-
constructor() {
|
|
169
|
-
super({
|
|
170
|
-
children: aicc_constants.comments_children,
|
|
171
|
-
errorCode: aicc_error_codes.INVALID_SET_VALUE,
|
|
172
|
-
errorClass: AICCValidationError,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* StudentPreferences class for AICC
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
class AICCStudentPreferences extends Scorm12CMI.CMIStudentPreference {
|
|
182
|
-
/**
|
|
183
|
-
* Constructor for AICC Student Preferences object
|
|
184
|
-
*/
|
|
185
|
-
constructor() {
|
|
186
|
-
super(aicc_constants.student_preference_children);
|
|
187
|
-
this.windows = new CMIArray({
|
|
188
|
-
errorCode: aicc_error_codes.INVALID_SET_VALUE,
|
|
189
|
-
errorClass: AICCValidationError,
|
|
190
|
-
children: "",
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
public windows: CMIArray;
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Called when the API has been initialized after the CMI has been created
|
|
198
|
-
*/
|
|
199
|
-
initialize() {
|
|
200
|
-
super.initialize();
|
|
201
|
-
this.windows?.initialize();
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
private _lesson_type = "";
|
|
205
|
-
private _text_color = "";
|
|
206
|
-
private _text_location = "";
|
|
207
|
-
private _text_size = "";
|
|
208
|
-
private _video = "";
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Getter for _lesson_type
|
|
212
|
-
* @return {string}
|
|
213
|
-
*/
|
|
214
|
-
get lesson_type(): string {
|
|
215
|
-
return this._lesson_type;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Setter for _lesson_type
|
|
220
|
-
* @param {string} lesson_type
|
|
221
|
-
*/
|
|
222
|
-
set lesson_type(lesson_type: string) {
|
|
223
|
-
if (checkAICCValidFormat(lesson_type, aicc_regex.CMIString256)) {
|
|
224
|
-
this._lesson_type = lesson_type;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Getter for _text_color
|
|
230
|
-
* @return {string}
|
|
231
|
-
*/
|
|
232
|
-
get text_color(): string {
|
|
233
|
-
return this._text_color;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Setter for _text_color
|
|
238
|
-
* @param {string} text_color
|
|
239
|
-
*/
|
|
240
|
-
set text_color(text_color: string) {
|
|
241
|
-
if (checkAICCValidFormat(text_color, aicc_regex.CMIString256)) {
|
|
242
|
-
this._text_color = text_color;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Getter for _text_location
|
|
248
|
-
* @return {string}
|
|
249
|
-
*/
|
|
250
|
-
get text_location(): string {
|
|
251
|
-
return this._text_location;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Setter for _text_location
|
|
256
|
-
* @param {string} text_location
|
|
257
|
-
*/
|
|
258
|
-
set text_location(text_location: string) {
|
|
259
|
-
if (checkAICCValidFormat(text_location, aicc_regex.CMIString256)) {
|
|
260
|
-
this._text_location = text_location;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Getter for _text_size
|
|
266
|
-
* @return {string}
|
|
267
|
-
*/
|
|
268
|
-
get text_size(): string {
|
|
269
|
-
return this._text_size;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Setter for _text_size
|
|
274
|
-
* @param {string} text_size
|
|
275
|
-
*/
|
|
276
|
-
set text_size(text_size: string) {
|
|
277
|
-
if (checkAICCValidFormat(text_size, aicc_regex.CMIString256)) {
|
|
278
|
-
this._text_size = text_size;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Getter for _video
|
|
284
|
-
* @return {string}
|
|
285
|
-
*/
|
|
286
|
-
get video(): string {
|
|
287
|
-
return this._video;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Setter for _video
|
|
292
|
-
* @param {string} video
|
|
293
|
-
*/
|
|
294
|
-
set video(video: string) {
|
|
295
|
-
if (checkAICCValidFormat(video, aicc_regex.CMIString256)) {
|
|
296
|
-
this._video = video;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* toJSON for cmi.student_preference
|
|
302
|
-
*
|
|
303
|
-
* @return {
|
|
304
|
-
* {
|
|
305
|
-
* audio: string,
|
|
306
|
-
* language: string,
|
|
307
|
-
* speed: string,
|
|
308
|
-
* text: string,
|
|
309
|
-
* text_color: string,
|
|
310
|
-
* text_location: string,
|
|
311
|
-
* text_size: string,
|
|
312
|
-
* video: string,
|
|
313
|
-
* windows: CMIArray
|
|
314
|
-
* }
|
|
315
|
-
* }
|
|
316
|
-
*/
|
|
317
|
-
toJSON(): {
|
|
318
|
-
audio: string;
|
|
319
|
-
language: string;
|
|
320
|
-
lesson_type: string;
|
|
321
|
-
speed: string;
|
|
322
|
-
text: string;
|
|
323
|
-
text_color: string;
|
|
324
|
-
text_location: string;
|
|
325
|
-
text_size: string;
|
|
326
|
-
video: string;
|
|
327
|
-
windows: CMIArray;
|
|
328
|
-
} {
|
|
329
|
-
this.jsonString = true;
|
|
330
|
-
const result = {
|
|
331
|
-
audio: this.audio,
|
|
332
|
-
language: this.language,
|
|
333
|
-
lesson_type: this.lesson_type,
|
|
334
|
-
speed: this.speed,
|
|
335
|
-
text: this.text,
|
|
336
|
-
text_color: this.text_color,
|
|
337
|
-
text_location: this.text_location,
|
|
338
|
-
text_size: this.text_size,
|
|
339
|
-
video: this.video,
|
|
340
|
-
windows: this.windows,
|
|
341
|
-
};
|
|
342
|
-
delete this.jsonString;
|
|
343
|
-
return result;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* StudentData class for AICC
|
|
349
|
-
*/
|
|
350
|
-
|
|
351
|
-
class AICCCMIStudentData extends Scorm12CMI.CMIStudentData {
|
|
352
|
-
/**
|
|
353
|
-
* Constructor for AICC StudentData object
|
|
354
|
-
*/
|
|
355
|
-
constructor() {
|
|
356
|
-
super(aicc_constants.student_data_children);
|
|
357
|
-
this.tries = new CMITries();
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
public tries: CMITries;
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Called when the API has been initialized after the CMI has been created
|
|
364
|
-
*/
|
|
365
|
-
initialize() {
|
|
366
|
-
super.initialize();
|
|
367
|
-
this.tries?.initialize();
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
private _tries_during_lesson = "";
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Getter for tries_during_lesson
|
|
374
|
-
* @return {string}
|
|
375
|
-
*/
|
|
376
|
-
get tries_during_lesson(): string {
|
|
377
|
-
return this._tries_during_lesson;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Setter for _tries_during_lesson. Sets an error if trying to set after
|
|
382
|
-
* initialization.
|
|
383
|
-
* @param {string} tries_during_lesson
|
|
384
|
-
*/
|
|
385
|
-
set tries_during_lesson(tries_during_lesson: string) {
|
|
386
|
-
if (this.initialized) {
|
|
387
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
388
|
-
} else {
|
|
389
|
-
this._tries_during_lesson = tries_during_lesson;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* toJSON for cmi.student_data object
|
|
395
|
-
* @return {
|
|
396
|
-
* {
|
|
397
|
-
* mastery_score: string,
|
|
398
|
-
* max_time_allowed: string,
|
|
399
|
-
* time_limit_action: string,
|
|
400
|
-
* tries: CMITries
|
|
401
|
-
* }
|
|
402
|
-
* }
|
|
403
|
-
*/
|
|
404
|
-
toJSON(): {
|
|
405
|
-
mastery_score: string;
|
|
406
|
-
max_time_allowed: string;
|
|
407
|
-
time_limit_action: string;
|
|
408
|
-
tries: CMITries;
|
|
409
|
-
} {
|
|
410
|
-
this.jsonString = true;
|
|
411
|
-
const result = {
|
|
412
|
-
mastery_score: this.mastery_score,
|
|
413
|
-
max_time_allowed: this.max_time_allowed,
|
|
414
|
-
time_limit_action: this.time_limit_action,
|
|
415
|
-
tries: this.tries,
|
|
416
|
-
};
|
|
417
|
-
delete this.jsonString;
|
|
418
|
-
return result;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Class representing the AICC cmi.student_demographics object
|
|
424
|
-
*/
|
|
425
|
-
|
|
426
|
-
export class CMIStudentDemographics extends BaseCMI {
|
|
427
|
-
/**
|
|
428
|
-
* Constructor for AICC StudentDemographics object
|
|
429
|
-
*/
|
|
430
|
-
constructor() {
|
|
431
|
-
super();
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
private __children = aicc_constants.student_demographics_children;
|
|
435
|
-
private _city = "";
|
|
436
|
-
private _class = "";
|
|
437
|
-
private _company = "";
|
|
438
|
-
private _country = "";
|
|
439
|
-
private _experience = "";
|
|
440
|
-
private _familiar_name = "";
|
|
441
|
-
private _instructor_name = "";
|
|
442
|
-
private _title = "";
|
|
443
|
-
private _native_language = "";
|
|
444
|
-
private _state = "";
|
|
445
|
-
private _street_address = "";
|
|
446
|
-
private _telephone = "";
|
|
447
|
-
private _years_experience = "";
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Getter for _children
|
|
451
|
-
* @return {string}
|
|
452
|
-
*/
|
|
453
|
-
get _children(): string {
|
|
454
|
-
return this.__children;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Getter for city
|
|
459
|
-
* @return {string}
|
|
460
|
-
*/
|
|
461
|
-
get city(): string {
|
|
462
|
-
return this._city;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Setter for _city. Sets an error if trying to set after
|
|
467
|
-
* initialization.
|
|
468
|
-
* @param {string} city
|
|
469
|
-
*/
|
|
470
|
-
set city(city: string) {
|
|
471
|
-
if (this.initialized) {
|
|
472
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
473
|
-
} else {
|
|
474
|
-
this._city = city;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Getter for class
|
|
480
|
-
* @return {string}
|
|
481
|
-
*/
|
|
482
|
-
get class(): string {
|
|
483
|
-
return this._class;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* Setter for _class. Sets an error if trying to set after
|
|
488
|
-
* initialization.
|
|
489
|
-
* @param {string} clazz
|
|
490
|
-
*/
|
|
491
|
-
set class(clazz: string) {
|
|
492
|
-
if (this.initialized) {
|
|
493
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
494
|
-
} else {
|
|
495
|
-
this._class = clazz;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Getter for company
|
|
501
|
-
* @return {string}
|
|
502
|
-
*/
|
|
503
|
-
get company(): string {
|
|
504
|
-
return this._company;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Setter for _company. Sets an error if trying to set after
|
|
509
|
-
* initialization.
|
|
510
|
-
* @param {string} company
|
|
511
|
-
*/
|
|
512
|
-
set company(company: string) {
|
|
513
|
-
if (this.initialized) {
|
|
514
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
515
|
-
} else {
|
|
516
|
-
this._company = company;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* Getter for country
|
|
522
|
-
* @return {string}
|
|
523
|
-
*/
|
|
524
|
-
get country(): string {
|
|
525
|
-
return this._country;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Setter for _country. Sets an error if trying to set after
|
|
530
|
-
* initialization.
|
|
531
|
-
* @param {string} country
|
|
532
|
-
*/
|
|
533
|
-
set country(country: string) {
|
|
534
|
-
if (this.initialized) {
|
|
535
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
536
|
-
} else {
|
|
537
|
-
this._country = country;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* Getter for experience
|
|
543
|
-
* @return {string}
|
|
544
|
-
*/
|
|
545
|
-
get experience(): string {
|
|
546
|
-
return this._experience;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* Setter for _experience. Sets an error if trying to set after
|
|
551
|
-
* initialization.
|
|
552
|
-
* @param {string} experience
|
|
553
|
-
*/
|
|
554
|
-
set experience(experience: string) {
|
|
555
|
-
if (this.initialized) {
|
|
556
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
557
|
-
} else {
|
|
558
|
-
this._experience = experience;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Getter for familiar_name
|
|
564
|
-
* @return {string}
|
|
565
|
-
*/
|
|
566
|
-
get familiar_name(): string {
|
|
567
|
-
return this._familiar_name;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
/**
|
|
571
|
-
* Setter for _familiar_name. Sets an error if trying to set after
|
|
572
|
-
* initialization.
|
|
573
|
-
* @param {string} familiar_name
|
|
574
|
-
*/
|
|
575
|
-
set familiar_name(familiar_name: string) {
|
|
576
|
-
if (this.initialized) {
|
|
577
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
578
|
-
} else {
|
|
579
|
-
this._familiar_name = familiar_name;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* Getter for instructor_name
|
|
585
|
-
* @return {string}
|
|
586
|
-
*/
|
|
587
|
-
get instructor_name(): string {
|
|
588
|
-
return this._instructor_name;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* Setter for _instructor_name. Sets an error if trying to set after
|
|
593
|
-
* initialization.
|
|
594
|
-
* @param {string} instructor_name
|
|
595
|
-
*/
|
|
596
|
-
set instructor_name(instructor_name: string) {
|
|
597
|
-
if (this.initialized) {
|
|
598
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
599
|
-
} else {
|
|
600
|
-
this._instructor_name = instructor_name;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* Getter for title
|
|
606
|
-
* @return {string}
|
|
607
|
-
*/
|
|
608
|
-
get title(): string {
|
|
609
|
-
return this._title;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Setter for _title. Sets an error if trying to set after
|
|
614
|
-
* initialization.
|
|
615
|
-
* @param {string} title
|
|
616
|
-
*/
|
|
617
|
-
set title(title: string) {
|
|
618
|
-
if (this.initialized) {
|
|
619
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
620
|
-
} else {
|
|
621
|
-
this._title = title;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* Getter for native_language
|
|
627
|
-
* @return {string}
|
|
628
|
-
*/
|
|
629
|
-
get native_language(): string {
|
|
630
|
-
return this._native_language;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* Setter for _native_language. Sets an error if trying to set after
|
|
635
|
-
* initialization.
|
|
636
|
-
* @param {string} native_language
|
|
637
|
-
*/
|
|
638
|
-
set native_language(native_language: string) {
|
|
639
|
-
if (this.initialized) {
|
|
640
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
641
|
-
} else {
|
|
642
|
-
this._native_language = native_language;
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Getter for state
|
|
648
|
-
* @return {string}
|
|
649
|
-
*/
|
|
650
|
-
get state(): string {
|
|
651
|
-
return this._state;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* Setter for _state. Sets an error if trying to set after
|
|
656
|
-
* initialization.
|
|
657
|
-
* @param {string} state
|
|
658
|
-
*/
|
|
659
|
-
set state(state: string) {
|
|
660
|
-
if (this.initialized) {
|
|
661
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
662
|
-
} else {
|
|
663
|
-
this._state = state;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
* Getter for street_address
|
|
669
|
-
* @return {string}
|
|
670
|
-
*/
|
|
671
|
-
get street_address(): string {
|
|
672
|
-
return this._street_address;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* Setter for _street_address. Sets an error if trying to set after
|
|
677
|
-
* initialization.
|
|
678
|
-
* @param {string} street_address
|
|
679
|
-
*/
|
|
680
|
-
set street_address(street_address: string) {
|
|
681
|
-
if (this.initialized) {
|
|
682
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
683
|
-
} else {
|
|
684
|
-
this._street_address = street_address;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
* Getter for telephone
|
|
690
|
-
* @return {string}
|
|
691
|
-
*/
|
|
692
|
-
get telephone(): string {
|
|
693
|
-
return this._telephone;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
/**
|
|
697
|
-
* Setter for _telephone. Sets an error if trying to set after
|
|
698
|
-
* initialization.
|
|
699
|
-
* @param {string} telephone
|
|
700
|
-
*/
|
|
701
|
-
set telephone(telephone: string) {
|
|
702
|
-
if (this.initialized) {
|
|
703
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
704
|
-
} else {
|
|
705
|
-
this._telephone = telephone;
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
* Getter for years_experience
|
|
711
|
-
* @return {string}
|
|
712
|
-
*/
|
|
713
|
-
get years_experience(): string {
|
|
714
|
-
return this._years_experience;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
/**
|
|
718
|
-
* Setter for _years_experience. Sets an error if trying to set after
|
|
719
|
-
* initialization.
|
|
720
|
-
* @param {string} years_experience
|
|
721
|
-
*/
|
|
722
|
-
set years_experience(years_experience: string) {
|
|
723
|
-
if (this.initialized) {
|
|
724
|
-
throw new AICCValidationError(aicc_error_codes.READ_ONLY_ELEMENT);
|
|
725
|
-
} else {
|
|
726
|
-
this._years_experience = years_experience;
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* toJSON for cmi.student_demographics object
|
|
732
|
-
* @return {
|
|
733
|
-
* {
|
|
734
|
-
* city: string,
|
|
735
|
-
* class: string,
|
|
736
|
-
* company: string,
|
|
737
|
-
* country: string,
|
|
738
|
-
* experience: string,
|
|
739
|
-
* familiar_name: string,
|
|
740
|
-
* instructor_name: string,
|
|
741
|
-
* title: string,
|
|
742
|
-
* native_language: string,
|
|
743
|
-
* state: string,
|
|
744
|
-
* street_address: string,
|
|
745
|
-
* telephone: string,
|
|
746
|
-
* years_experience: string
|
|
747
|
-
* }
|
|
748
|
-
* }
|
|
749
|
-
*/
|
|
750
|
-
toJSON(): {
|
|
751
|
-
city: string;
|
|
752
|
-
class: string;
|
|
753
|
-
company: string;
|
|
754
|
-
country: string;
|
|
755
|
-
experience: string;
|
|
756
|
-
familiar_name: string;
|
|
757
|
-
instructor_name: string;
|
|
758
|
-
title: string;
|
|
759
|
-
native_language: string;
|
|
760
|
-
state: string;
|
|
761
|
-
street_address: string;
|
|
762
|
-
telephone: string;
|
|
763
|
-
years_experience: string;
|
|
764
|
-
} {
|
|
765
|
-
this.jsonString = true;
|
|
766
|
-
const result = {
|
|
767
|
-
city: this.city,
|
|
768
|
-
class: this.class,
|
|
769
|
-
company: this.company,
|
|
770
|
-
country: this.country,
|
|
771
|
-
experience: this.experience,
|
|
772
|
-
familiar_name: this.familiar_name,
|
|
773
|
-
instructor_name: this.instructor_name,
|
|
774
|
-
title: this.title,
|
|
775
|
-
native_language: this.native_language,
|
|
776
|
-
state: this.state,
|
|
777
|
-
street_address: this.street_address,
|
|
778
|
-
telephone: this.telephone,
|
|
779
|
-
years_experience: this.years_experience,
|
|
780
|
-
};
|
|
781
|
-
delete this.jsonString;
|
|
782
|
-
return result;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
* Class representing the AICC `cmi.paths` object
|
|
788
|
-
*/
|
|
789
|
-
export class CMIPaths extends CMIArray {
|
|
790
|
-
/**
|
|
791
|
-
* Constructor for inline Paths Array class
|
|
792
|
-
*/
|
|
793
|
-
constructor() {
|
|
794
|
-
super({
|
|
795
|
-
children: aicc_constants.paths_children,
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
/**
|
|
801
|
-
* Class for AICC Paths
|
|
802
|
-
*/
|
|
803
|
-
export class CMIPathsObject extends BaseCMI {
|
|
804
|
-
/**
|
|
805
|
-
* Constructor for AICC Paths objects
|
|
806
|
-
*/
|
|
807
|
-
constructor() {
|
|
808
|
-
super();
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
private _location_id = "";
|
|
812
|
-
private _date = "";
|
|
813
|
-
private _time = "";
|
|
814
|
-
private _status = "";
|
|
815
|
-
private _why_left = "";
|
|
816
|
-
private _time_in_element = "";
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* Getter for _location_id
|
|
820
|
-
* @return {string}
|
|
821
|
-
*/
|
|
822
|
-
get location_id(): string {
|
|
823
|
-
return this._location_id;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
/**
|
|
827
|
-
* Setter for _location_id
|
|
828
|
-
* @param {string} location_id
|
|
829
|
-
*/
|
|
830
|
-
set location_id(location_id: string) {
|
|
831
|
-
if (checkAICCValidFormat(location_id, aicc_regex.CMIString256)) {
|
|
832
|
-
this._location_id = location_id;
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* Getter for _date
|
|
838
|
-
* @return {string}
|
|
839
|
-
*/
|
|
840
|
-
get date(): string {
|
|
841
|
-
return this._date;
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* Setter for _date
|
|
846
|
-
* @param {string} date
|
|
847
|
-
*/
|
|
848
|
-
set date(date: string) {
|
|
849
|
-
if (checkAICCValidFormat(date, aicc_regex.CMIString256)) {
|
|
850
|
-
this._date = date;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
/**
|
|
855
|
-
* Getter for _time
|
|
856
|
-
* @return {string}
|
|
857
|
-
*/
|
|
858
|
-
get time(): string {
|
|
859
|
-
return this._time;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
/**
|
|
863
|
-
* Setter for _time
|
|
864
|
-
* @param {string} time
|
|
865
|
-
*/
|
|
866
|
-
set time(time: string) {
|
|
867
|
-
if (checkAICCValidFormat(time, aicc_regex.CMITime)) {
|
|
868
|
-
this._time = time;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
/**
|
|
873
|
-
* Getter for _status
|
|
874
|
-
* @return {string}
|
|
875
|
-
*/
|
|
876
|
-
get status(): string {
|
|
877
|
-
return this._status;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* Setter for _status
|
|
882
|
-
* @param {string} status
|
|
883
|
-
*/
|
|
884
|
-
set status(status: string) {
|
|
885
|
-
if (checkAICCValidFormat(status, aicc_regex.CMIStatus2)) {
|
|
886
|
-
this._status = status;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
/**
|
|
891
|
-
* Getter for _why_left
|
|
892
|
-
* @return {string}
|
|
893
|
-
*/
|
|
894
|
-
get why_left(): string {
|
|
895
|
-
return this._why_left;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
/**
|
|
899
|
-
* Setter for _why_left
|
|
900
|
-
* @param {string} why_left
|
|
901
|
-
*/
|
|
902
|
-
set why_left(why_left: string) {
|
|
903
|
-
if (checkAICCValidFormat(why_left, aicc_regex.CMIString256)) {
|
|
904
|
-
this._why_left = why_left;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* Getter for _time_in_element
|
|
910
|
-
* @return {string}
|
|
911
|
-
*/
|
|
912
|
-
get time_in_element(): string {
|
|
913
|
-
return this._time_in_element;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
* Setter for _time_in_element
|
|
918
|
-
* @param {string} time_in_element
|
|
919
|
-
*/
|
|
920
|
-
set time_in_element(time_in_element: string) {
|
|
921
|
-
if (checkAICCValidFormat(time_in_element, aicc_regex.CMITime)) {
|
|
922
|
-
this._time_in_element = time_in_element;
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
/**
|
|
927
|
-
* toJSON for cmi.paths.n object
|
|
928
|
-
* @return {
|
|
929
|
-
* {
|
|
930
|
-
* location_id: string,
|
|
931
|
-
* date: string,
|
|
932
|
-
* time: string,
|
|
933
|
-
* status: string,
|
|
934
|
-
* why_left: string,
|
|
935
|
-
* time_in_element: string
|
|
936
|
-
* }
|
|
937
|
-
* }
|
|
938
|
-
*/
|
|
939
|
-
toJSON(): {
|
|
940
|
-
location_id: string;
|
|
941
|
-
date: string;
|
|
942
|
-
time: string;
|
|
943
|
-
status: string;
|
|
944
|
-
why_left: string;
|
|
945
|
-
time_in_element: string;
|
|
946
|
-
} {
|
|
947
|
-
this.jsonString = true;
|
|
948
|
-
const result = {
|
|
949
|
-
location_id: this.location_id,
|
|
950
|
-
date: this.date,
|
|
951
|
-
time: this.time,
|
|
952
|
-
status: this.status,
|
|
953
|
-
why_left: this.why_left,
|
|
954
|
-
time_in_element: this.time_in_element,
|
|
955
|
-
};
|
|
956
|
-
delete this.jsonString;
|
|
957
|
-
return result;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
/**
|
|
962
|
-
* Class representing the AICC cmi.student_data.tries object
|
|
963
|
-
*/
|
|
964
|
-
export class CMITries extends CMIArray {
|
|
965
|
-
/**
|
|
966
|
-
* Constructor for inline Tries Array class
|
|
967
|
-
*/
|
|
968
|
-
constructor() {
|
|
969
|
-
super({
|
|
970
|
-
children: aicc_constants.tries_children,
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
/**
|
|
976
|
-
* Class for AICC Tries
|
|
977
|
-
*/
|
|
978
|
-
export class CMITriesObject extends BaseCMI {
|
|
979
|
-
/**
|
|
980
|
-
* Constructor for AICC Tries object
|
|
981
|
-
*/
|
|
982
|
-
constructor() {
|
|
983
|
-
super();
|
|
984
|
-
this.score = new CMIScore({
|
|
985
|
-
score_children: aicc_constants.score_children,
|
|
986
|
-
score_range: aicc_regex.score_range,
|
|
987
|
-
invalidErrorCode: aicc_error_codes.INVALID_SET_VALUE,
|
|
988
|
-
invalidTypeCode: aicc_error_codes.TYPE_MISMATCH,
|
|
989
|
-
invalidRangeCode: aicc_error_codes.VALUE_OUT_OF_RANGE,
|
|
990
|
-
errorClass: AICCValidationError,
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
public score: CMIScore;
|
|
995
|
-
|
|
996
|
-
/**
|
|
997
|
-
* Called when the API has been initialized after the CMI has been created
|
|
998
|
-
*/
|
|
999
|
-
initialize() {
|
|
1000
|
-
super.initialize();
|
|
1001
|
-
this.score?.initialize();
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
private _status = "";
|
|
1005
|
-
private _time = "";
|
|
1006
|
-
|
|
1007
|
-
/**
|
|
1008
|
-
* Getter for _status
|
|
1009
|
-
* @return {string}
|
|
1010
|
-
*/
|
|
1011
|
-
get status(): string {
|
|
1012
|
-
return this._status;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
/**
|
|
1016
|
-
* Setter for _status
|
|
1017
|
-
* @param {string} status
|
|
1018
|
-
*/
|
|
1019
|
-
set status(status: string) {
|
|
1020
|
-
if (checkAICCValidFormat(status, aicc_regex.CMIStatus2)) {
|
|
1021
|
-
this._status = status;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
/**
|
|
1026
|
-
* Getter for _time
|
|
1027
|
-
* @return {string}
|
|
1028
|
-
*/
|
|
1029
|
-
get time(): string {
|
|
1030
|
-
return this._time;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
/**
|
|
1034
|
-
* Setter for _time
|
|
1035
|
-
* @param {string} time
|
|
1036
|
-
*/
|
|
1037
|
-
set time(time: string) {
|
|
1038
|
-
if (checkAICCValidFormat(time, aicc_regex.CMITime)) {
|
|
1039
|
-
this._time = time;
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
/**
|
|
1044
|
-
* toJSON for cmi.student_data.tries.n object
|
|
1045
|
-
* @return {
|
|
1046
|
-
* {
|
|
1047
|
-
* status: string,
|
|
1048
|
-
* time: string,
|
|
1049
|
-
* score: CMIScore
|
|
1050
|
-
* }
|
|
1051
|
-
* }
|
|
1052
|
-
*/
|
|
1053
|
-
toJSON(): {
|
|
1054
|
-
status: string;
|
|
1055
|
-
time: string;
|
|
1056
|
-
score: CMIScore;
|
|
1057
|
-
} {
|
|
1058
|
-
this.jsonString = true;
|
|
1059
|
-
const result = {
|
|
1060
|
-
status: this.status,
|
|
1061
|
-
time: this.time,
|
|
1062
|
-
score: this.score,
|
|
1063
|
-
};
|
|
1064
|
-
delete this.jsonString;
|
|
1065
|
-
return result;
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
/**
|
|
1070
|
-
* Class for cmi.student_data.attempt_records array
|
|
1071
|
-
*/
|
|
1072
|
-
export class CMIAttemptRecords extends CMIArray {
|
|
1073
|
-
/**
|
|
1074
|
-
* Constructor for inline Tries Array class
|
|
1075
|
-
*/
|
|
1076
|
-
constructor() {
|
|
1077
|
-
super({
|
|
1078
|
-
children: aicc_constants.attempt_records_children,
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
/**
|
|
1084
|
-
* Class for AICC Attempt Records
|
|
1085
|
-
*/
|
|
1086
|
-
export class CMIAttemptRecordsObject extends BaseCMI {
|
|
1087
|
-
/**
|
|
1088
|
-
* Constructor for AICC Attempt Records object
|
|
1089
|
-
*/
|
|
1090
|
-
constructor() {
|
|
1091
|
-
super();
|
|
1092
|
-
this.score = new CMIScore({
|
|
1093
|
-
score_children: aicc_constants.score_children,
|
|
1094
|
-
score_range: aicc_regex.score_range,
|
|
1095
|
-
invalidErrorCode: aicc_error_codes.INVALID_SET_VALUE,
|
|
1096
|
-
invalidTypeCode: aicc_error_codes.TYPE_MISMATCH,
|
|
1097
|
-
invalidRangeCode: aicc_error_codes.VALUE_OUT_OF_RANGE,
|
|
1098
|
-
errorClass: AICCValidationError,
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
public score: CMIScore;
|
|
1103
|
-
|
|
1104
|
-
/**
|
|
1105
|
-
* Called when the API has been initialized after the CMI has been created
|
|
1106
|
-
*/
|
|
1107
|
-
initialize() {
|
|
1108
|
-
super.initialize();
|
|
1109
|
-
this.score?.initialize();
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
private _lesson_status = "";
|
|
1113
|
-
|
|
1114
|
-
/**
|
|
1115
|
-
* Getter for _lesson_status
|
|
1116
|
-
* @return {string}
|
|
1117
|
-
*/
|
|
1118
|
-
get lesson_status(): string {
|
|
1119
|
-
return this._lesson_status;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
/**
|
|
1123
|
-
* Setter for _lesson_status
|
|
1124
|
-
* @param {string} lesson_status
|
|
1125
|
-
*/
|
|
1126
|
-
set lesson_status(lesson_status: string) {
|
|
1127
|
-
if (checkAICCValidFormat(lesson_status, aicc_regex.CMIStatus2)) {
|
|
1128
|
-
this._lesson_status = lesson_status;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
/**
|
|
1133
|
-
* toJSON for cmi.student_data.attempt_records.n object
|
|
1134
|
-
* @return {
|
|
1135
|
-
* {
|
|
1136
|
-
* lesson_status: string,
|
|
1137
|
-
* score: CMIScore
|
|
1138
|
-
* }
|
|
1139
|
-
* }
|
|
1140
|
-
*/
|
|
1141
|
-
toJSON(): {
|
|
1142
|
-
lesson_status: string;
|
|
1143
|
-
score: CMIScore;
|
|
1144
|
-
} {
|
|
1145
|
-
this.jsonString = true;
|
|
1146
|
-
const result = {
|
|
1147
|
-
lesson_status: this.lesson_status,
|
|
1148
|
-
score: this.score,
|
|
1149
|
-
};
|
|
1150
|
-
delete this.jsonString;
|
|
1151
|
-
return result;
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
/**
|
|
1156
|
-
* Class for AICC Evaluation Comments
|
|
1157
|
-
*/
|
|
1158
|
-
export class CMIEvaluationCommentsObject extends BaseCMI {
|
|
1159
|
-
/**
|
|
1160
|
-
* Constructor for Evaluation Comments
|
|
1161
|
-
*/
|
|
1162
|
-
constructor() {
|
|
1163
|
-
super();
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
private _content = "";
|
|
1167
|
-
private _location = "";
|
|
1168
|
-
private _time = "";
|
|
1169
|
-
|
|
1170
|
-
/**
|
|
1171
|
-
* Getter for _content
|
|
1172
|
-
* @return {string}
|
|
1173
|
-
*/
|
|
1174
|
-
get content(): string {
|
|
1175
|
-
return this._content;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
/**
|
|
1179
|
-
* Setter for _content
|
|
1180
|
-
* @param {string} content
|
|
1181
|
-
*/
|
|
1182
|
-
set content(content: string) {
|
|
1183
|
-
if (checkAICCValidFormat(content, aicc_regex.CMIString256)) {
|
|
1184
|
-
this._content = content;
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* Getter for _location
|
|
1190
|
-
* @return {string}
|
|
1191
|
-
*/
|
|
1192
|
-
get location(): string {
|
|
1193
|
-
return this._location;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
/**
|
|
1197
|
-
* Setter for _location
|
|
1198
|
-
* @param {string} location
|
|
1199
|
-
*/
|
|
1200
|
-
set location(location: string) {
|
|
1201
|
-
if (checkAICCValidFormat(location, aicc_regex.CMIString256)) {
|
|
1202
|
-
this._location = location;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
/**
|
|
1207
|
-
* Getter for _time
|
|
1208
|
-
* @return {string}
|
|
1209
|
-
*/
|
|
1210
|
-
get time(): string {
|
|
1211
|
-
return this._time;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
/**
|
|
1215
|
-
* Setting for _time
|
|
1216
|
-
* @param {string} time
|
|
1217
|
-
*/
|
|
1218
|
-
set time(time: string) {
|
|
1219
|
-
if (checkAICCValidFormat(time, aicc_regex.CMITime)) {
|
|
1220
|
-
this._time = time;
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
/**
|
|
1225
|
-
* toJSON for cmi.evaluation.comments.n object
|
|
1226
|
-
* @return {
|
|
1227
|
-
* {
|
|
1228
|
-
* content: string,
|
|
1229
|
-
* location: string,
|
|
1230
|
-
* time: string
|
|
1231
|
-
* }
|
|
1232
|
-
* }
|
|
1233
|
-
*/
|
|
1234
|
-
toJSON(): {
|
|
1235
|
-
content: string;
|
|
1236
|
-
location: string;
|
|
1237
|
-
time: string;
|
|
1238
|
-
} {
|
|
1239
|
-
this.jsonString = true;
|
|
1240
|
-
const result = {
|
|
1241
|
-
content: this.content,
|
|
1242
|
-
location: this.location,
|
|
1243
|
-
time: this.time,
|
|
1244
|
-
};
|
|
1245
|
-
delete this.jsonString;
|
|
1246
|
-
return result;
|
|
1247
|
-
}
|
|
1248
|
-
}
|