scorm-again 1.7.1 → 2.1.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/.babelrc +18 -7
- package/.github/dependabot.yml +5 -0
- package/.github/workflows/main.yml +79 -0
- package/.github/workflows/stale.yml +14 -0
- package/.jsdoc.json +4 -5
- package/.mocharc.json +8 -0
- package/.run/{Mocha Unit Tests.run.xml → Mocha Unit Tests (watch).run.xml } +6 -3
- package/.run/Template Mocha.run.xml +17 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +183 -71
- package/dist/aicc.js +3822 -7030
- package/dist/aicc.js.map +1 -1
- package/dist/aicc.min.js +2 -40
- package/dist/aicc.min.js.map +1 -0
- package/dist/scorm-again.js +5965 -10498
- package/dist/scorm-again.js.map +1 -1
- package/dist/scorm-again.min.js +2 -52
- package/dist/scorm-again.min.js.map +1 -0
- package/dist/scorm12.js +3028 -5373
- package/dist/scorm12.js.map +1 -1
- package/dist/scorm12.min.js +2 -34
- package/dist/scorm12.min.js.map +1 -0
- package/dist/scorm2004.js +4054 -6693
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +2 -40
- package/dist/scorm2004.min.js.map +1 -0
- package/eslint.config.js +21 -0
- package/package.json +76 -34
- package/results.json +34254 -0
- package/src/AICC.ts +72 -0
- package/src/BaseAPI.ts +1300 -0
- package/src/Scorm12API.ts +387 -0
- package/src/Scorm2004API.ts +688 -0
- 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/api_constants.ts +318 -0
- package/src/constants/default_settings.ts +81 -0
- package/src/constants/enums.ts +5 -0
- package/src/constants/error_codes.ts +88 -0
- package/src/constants/language_constants.ts +394 -0
- package/src/constants/regex.ts +97 -0
- package/src/constants/{response_constants.js → response_constants.ts} +69 -62
- package/src/exceptions.ts +154 -0
- package/src/exports/aicc.js +1 -1
- package/src/exports/scorm-again.js +3 -3
- package/src/exports/scorm12.js +1 -1
- package/src/exports/scorm2004.js +1 -1
- package/src/helpers/scheduled_commit.ts +42 -0
- package/src/interfaces/IBaseAPI.ts +35 -0
- package/src/types/api_types.ts +32 -0
- package/src/utilities/debounce.ts +31 -0
- package/src/utilities.ts +338 -0
- package/tea.yaml +6 -0
- package/test/{AICC.spec.js → AICC.spec.ts} +79 -71
- package/test/Scorm12API.spec.ts +833 -0
- package/test/Scorm2004API.spec.ts +1298 -0
- package/test/api_helpers.ts +176 -0
- package/test/cmi/aicc_cmi.spec.ts +845 -0
- package/test/cmi/{scorm12_cmi.spec.js → scorm12_cmi.spec.ts} +253 -271
- package/test/cmi/scorm2004_cmi.spec.ts +1031 -0
- package/test/cmi_helpers.ts +207 -0
- package/test/exceptions.spec.ts +79 -0
- package/test/field_values.ts +202 -0
- package/test/types/api_types.spec.ts +126 -0
- package/test/utilities/debounce.spec.ts +56 -0
- package/test/utilities.spec.ts +322 -0
- package/tsconfig.json +18 -0
- package/webpack.config.js +65 -0
- package/.circleci/config.yml +0 -99
- package/.codeclimate.yml +0 -7
- package/.eslintrc.js +0 -36
- package/src/.flowconfig +0 -11
- package/src/AICC.js +0 -68
- package/src/BaseAPI.js +0 -1275
- package/src/Scorm12API.js +0 -308
- package/src/Scorm2004API.js +0 -572
- package/src/cmi/aicc_cmi.js +0 -1141
- package/src/cmi/common.js +0 -328
- package/src/cmi/scorm12_cmi.js +0 -1312
- package/src/cmi/scorm2004_cmi.js +0 -1692
- package/src/constants/api_constants.js +0 -218
- package/src/constants/error_codes.js +0 -87
- package/src/constants/language_constants.js +0 -76
- package/src/constants/regex.js +0 -84
- package/src/exceptions.js +0 -104
- package/src/utilities.js +0 -242
- package/test/Scorm12API.spec.js +0 -528
- package/test/Scorm2004API.spec.js +0 -775
- package/test/abstract_classes.spec.js +0 -17
- package/test/api_helpers.js +0 -128
- package/test/cmi/aicc_cmi.spec.js +0 -684
- package/test/cmi/scorm2004_cmi.spec.js +0 -1066
- package/test/cmi_helpers.js +0 -161
- package/test/exceptions.spec.js +0 -71
- package/test/field_values.js +0 -353
- package/test/utilities.spec.js +0 -339
- package/webpack.js +0 -78
package/src/AICC.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import Scorm12API from "./Scorm12API";
|
|
2
|
+
import { CMI } from "./cmi/aicc/cmi";
|
|
3
|
+
|
|
4
|
+
import { BaseCMI } from "./cmi/common/base_cmi";
|
|
5
|
+
import { CMITriesObject } from "./cmi/aicc/tries";
|
|
6
|
+
import { CMIAttemptRecordsObject } from "./cmi/aicc/attempts";
|
|
7
|
+
import { CMIEvaluationCommentsObject } from "./cmi/aicc/evaluation";
|
|
8
|
+
import { NAV } from "./cmi/scorm12/nav";
|
|
9
|
+
import { CMIPathsObject } from "./cmi/aicc/paths";
|
|
10
|
+
import { Settings } from "./types/api_types";
|
|
11
|
+
import { stringMatches } from "./utilities";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The AICC API class
|
|
15
|
+
*/
|
|
16
|
+
export default class AICC extends Scorm12API {
|
|
17
|
+
/**
|
|
18
|
+
* Constructor to create AICC API object
|
|
19
|
+
* @param {Settings} settings
|
|
20
|
+
*/
|
|
21
|
+
constructor(settings?: Settings) {
|
|
22
|
+
super(settings);
|
|
23
|
+
|
|
24
|
+
this.cmi = new CMI();
|
|
25
|
+
this.nav = new NAV();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Gets or builds a new child element to add to the array.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} CMIElement
|
|
32
|
+
* @param {any} value
|
|
33
|
+
* @param {boolean} foundFirstIndex
|
|
34
|
+
* @return {BaseCMI | null}
|
|
35
|
+
*/
|
|
36
|
+
getChildElement(
|
|
37
|
+
CMIElement: string,
|
|
38
|
+
value: any,
|
|
39
|
+
foundFirstIndex: boolean,
|
|
40
|
+
): BaseCMI | null {
|
|
41
|
+
let newChild = super.getChildElement(CMIElement, value, foundFirstIndex);
|
|
42
|
+
|
|
43
|
+
if (!newChild) {
|
|
44
|
+
if (stringMatches(CMIElement, "cmi\\.evaluation\\.comments\\.\\d+")) {
|
|
45
|
+
newChild = new CMIEvaluationCommentsObject();
|
|
46
|
+
} else if (
|
|
47
|
+
stringMatches(CMIElement, "cmi\\.student_data\\.tries\\.\\d+")
|
|
48
|
+
) {
|
|
49
|
+
newChild = new CMITriesObject();
|
|
50
|
+
} else if (
|
|
51
|
+
stringMatches(CMIElement, "cmi\\.student_data\\.attempt_records\\.\\d+")
|
|
52
|
+
) {
|
|
53
|
+
newChild = new CMIAttemptRecordsObject();
|
|
54
|
+
} else if (stringMatches(CMIElement, "cmi\\.paths\\.\\d+")) {
|
|
55
|
+
newChild = new CMIPathsObject();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return newChild;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Replace the whole API with another
|
|
64
|
+
*
|
|
65
|
+
* @param {AICC} newAPI
|
|
66
|
+
*/
|
|
67
|
+
replaceWithAnotherScormAPI(newAPI: AICC) {
|
|
68
|
+
// Data Model
|
|
69
|
+
this.cmi = newAPI.cmi;
|
|
70
|
+
this.nav = newAPI.nav;
|
|
71
|
+
}
|
|
72
|
+
}
|