scorm-again 1.7.1 → 2.0.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/.jsdoc.json +4 -5
- package/.mocharc.json +8 -0
- package/.run/Mocha Unit Tests.run.xml +5 -2
- package/CONTRIBUTING.md +1 -1
- package/README.md +14 -1
- package/dist/aicc.js +3661 -7170
- 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 +5671 -10695
- 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 +2871 -5433
- 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 +3868 -6797
- 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 +72 -34
- package/results.json +34254 -0
- package/src/{AICC.js → AICC.ts} +27 -21
- package/src/BaseAPI.ts +1449 -0
- package/src/Scorm12API.ts +360 -0
- package/src/{Scorm2004API.js → Scorm2004API.ts} +245 -163
- package/src/cmi/aicc_cmi.ts +1248 -0
- package/src/cmi/common.ts +411 -0
- package/src/cmi/scorm12_cmi.ts +1426 -0
- package/src/cmi/scorm2004_cmi.ts +1874 -0
- package/src/constants/api_constants.ts +318 -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} +67 -62
- package/src/exceptions.ts +133 -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/{utilities.js → utilities.ts} +114 -74
- package/tea.yaml +6 -0
- package/test/{AICC.spec.js → AICC.spec.ts} +70 -72
- package/test/Scorm12API.spec.ts +580 -0
- package/test/Scorm2004API.spec.ts +812 -0
- package/test/api_helpers.ts +176 -0
- package/test/cmi/{aicc_cmi.spec.js → aicc_cmi.spec.ts} +193 -209
- package/test/cmi/{scorm12_cmi.spec.js → scorm12_cmi.spec.ts} +251 -269
- 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/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/BaseAPI.js +0 -1275
- package/src/Scorm12API.js +0 -308
- 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/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/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.js → AICC.ts}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import Scorm12API from './Scorm12API';
|
|
1
|
+
import Scorm12API from "./Scorm12API";
|
|
3
2
|
import {
|
|
4
3
|
CMI,
|
|
5
4
|
CMIAttemptRecordsObject,
|
|
6
5
|
CMIEvaluationCommentsObject,
|
|
7
6
|
CMITriesObject,
|
|
8
|
-
} from
|
|
9
|
-
import {NAV} from
|
|
7
|
+
} from "./cmi/aicc_cmi";
|
|
8
|
+
import { NAV } from "./cmi/scorm12_cmi";
|
|
9
|
+
import { Settings } from "./BaseAPI";
|
|
10
|
+
import { BaseCMI } from "./cmi/common";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* The AICC API class
|
|
@@ -14,16 +15,10 @@ import {NAV} from './cmi/scorm12_cmi';
|
|
|
14
15
|
export default class AICC extends Scorm12API {
|
|
15
16
|
/**
|
|
16
17
|
* Constructor to create AICC API object
|
|
17
|
-
* @param {
|
|
18
|
+
* @param {Settings} settings
|
|
18
19
|
*/
|
|
19
|
-
constructor(settings
|
|
20
|
-
|
|
21
|
-
...{
|
|
22
|
-
mastery_override: false,
|
|
23
|
-
}, ...settings,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
super(finalSettings);
|
|
20
|
+
constructor(settings?: Settings) {
|
|
21
|
+
super(settings);
|
|
27
22
|
|
|
28
23
|
this.cmi = new CMI();
|
|
29
24
|
this.nav = new NAV();
|
|
@@ -35,19 +30,30 @@ export default class AICC extends Scorm12API {
|
|
|
35
30
|
* @param {string} CMIElement
|
|
36
31
|
* @param {any} value
|
|
37
32
|
* @param {boolean} foundFirstIndex
|
|
38
|
-
* @return {
|
|
33
|
+
* @return {BaseCMI | null}
|
|
39
34
|
*/
|
|
40
|
-
getChildElement(
|
|
35
|
+
getChildElement(
|
|
36
|
+
CMIElement: string,
|
|
37
|
+
value: any,
|
|
38
|
+
foundFirstIndex: boolean,
|
|
39
|
+
): BaseCMI | null {
|
|
41
40
|
let newChild = super.getChildElement(CMIElement, value, foundFirstIndex);
|
|
42
41
|
|
|
43
42
|
if (!newChild) {
|
|
44
|
-
if (
|
|
43
|
+
if (
|
|
44
|
+
this.stringMatches(CMIElement, "cmi\\.evaluation\\.comments\\.\\d+")
|
|
45
|
+
) {
|
|
45
46
|
newChild = new CMIEvaluationCommentsObject();
|
|
46
|
-
} else if (
|
|
47
|
-
|
|
47
|
+
} else if (
|
|
48
|
+
this.stringMatches(CMIElement, "cmi\\.student_data\\.tries\\.\\d+")
|
|
49
|
+
) {
|
|
48
50
|
newChild = new CMITriesObject();
|
|
49
|
-
} else if (
|
|
50
|
-
|
|
51
|
+
} else if (
|
|
52
|
+
this.stringMatches(
|
|
53
|
+
CMIElement,
|
|
54
|
+
"cmi\\.student_data\\.attempt_records\\.\\d+",
|
|
55
|
+
)
|
|
56
|
+
) {
|
|
51
57
|
newChild = new CMIAttemptRecordsObject();
|
|
52
58
|
}
|
|
53
59
|
}
|
|
@@ -60,7 +66,7 @@ export default class AICC extends Scorm12API {
|
|
|
60
66
|
*
|
|
61
67
|
* @param {AICC} newAPI
|
|
62
68
|
*/
|
|
63
|
-
replaceWithAnotherScormAPI(newAPI) {
|
|
69
|
+
replaceWithAnotherScormAPI(newAPI: AICC) {
|
|
64
70
|
// Data Model
|
|
65
71
|
this.cmi = newAPI.cmi;
|
|
66
72
|
this.nav = newAPI.nav;
|