scorm-again 2.5.0 → 2.6.1
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/aicc.js +657 -489
- package/dist/aicc.js.map +1 -1
- package/dist/aicc.min.js +1 -1
- package/dist/aicc.min.js.map +1 -1
- package/dist/esm/aicc.js +670 -489
- package/dist/esm/aicc.js.map +1 -1
- package/dist/esm/aicc.min.js +1 -1
- package/dist/esm/aicc.min.js.map +1 -1
- package/dist/esm/scorm-again.js +1113 -729
- package/dist/esm/scorm-again.js.map +1 -1
- package/dist/esm/scorm-again.min.js +1 -1
- package/dist/esm/scorm-again.min.js.map +1 -1
- package/dist/esm/scorm12.js +512 -394
- package/dist/esm/scorm12.js.map +1 -1
- package/dist/esm/scorm12.min.js +1 -1
- package/dist/esm/scorm12.min.js.map +1 -1
- package/dist/esm/scorm2004.js +678 -452
- package/dist/esm/scorm2004.js.map +1 -1
- package/dist/esm/scorm2004.min.js +1 -1
- package/dist/esm/scorm2004.min.js.map +1 -1
- package/dist/scorm-again.js +1100 -728
- 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 +500 -394
- 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 +665 -452
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +1 -1
- package/dist/scorm2004.min.js.map +1 -1
- package/dist_test.html +208 -0
- package/package.json +14 -14
- package/src/AICC.ts +6 -3
- package/src/BaseAPI.ts +43 -37
- package/src/Scorm12API.ts +17 -23
- package/src/Scorm2004API.ts +99 -42
- package/src/ScormAgain.ts +3 -7
- package/src/cmi/aicc/attempts.ts +22 -12
- package/src/cmi/aicc/cmi.ts +2 -2
- package/src/cmi/aicc/core.ts +44 -26
- package/src/cmi/aicc/evaluation.ts +31 -12
- package/src/cmi/aicc/paths.ts +29 -15
- package/src/cmi/aicc/student_data.ts +14 -5
- package/src/cmi/aicc/student_demographics.ts +31 -24
- package/src/cmi/aicc/student_preferences.ts +11 -11
- package/src/cmi/aicc/tries.ts +24 -14
- package/src/cmi/aicc/validation.ts +3 -4
- package/src/cmi/common/array.ts +17 -5
- package/src/cmi/common/base_cmi.ts +3 -1
- package/src/cmi/common/score.ts +16 -13
- package/src/cmi/scorm12/cmi.ts +25 -10
- package/src/cmi/scorm12/interactions.ts +62 -28
- package/src/cmi/scorm12/nav.ts +13 -5
- package/src/cmi/scorm12/objectives.ts +28 -18
- package/src/cmi/scorm12/student_data.ts +15 -8
- package/src/cmi/scorm12/student_preference.ts +20 -13
- package/src/cmi/scorm12/validation.ts +7 -7
- package/src/cmi/scorm2004/adl.ts +141 -25
- package/src/cmi/scorm2004/cmi.ts +50 -55
- package/src/cmi/scorm2004/comments.ts +21 -20
- package/src/cmi/scorm2004/interactions.ts +73 -32
- package/src/cmi/scorm2004/learner_preference.ts +20 -13
- package/src/cmi/scorm2004/objectives.ts +41 -16
- package/src/cmi/scorm2004/score.ts +22 -11
- package/src/cmi/scorm2004/validation.ts +4 -4
- package/src/constants/api_constants.ts +8 -19
- package/src/constants/default_settings.ts +6 -5
- package/src/constants/error_codes.ts +5 -12
- package/src/constants/regex.ts +4 -10
- package/src/constants/response_constants.ts +1 -2
- package/src/exceptions/aicc_exceptions.ts +29 -0
- package/src/exceptions/scorm12_exceptions.ts +29 -0
- package/src/exceptions/scorm2004_exceptions.ts +29 -0
- package/src/exceptions.ts +0 -81
- package/src/types/api_types.ts +3 -2
- package/test/AICC.spec.ts +114 -43
- package/test/Scorm12API.spec.ts +60 -39
- package/test/Scorm2004API.spec.ts +165 -80
- package/test/cmi/aicc_cmi.spec.ts +6 -9
- package/test/cmi/scorm12_cmi.spec.ts +8 -8
- package/test/cmi/scorm2004_cmi.spec.ts +8 -9
- package/test/exceptions.spec.ts +11 -9
- package/test/types/api_types.spec.ts +3 -3
- package/test/utilities.spec.ts +1 -4
- package/webpack.config.js +5 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it } from "mocha";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { aicc_constants } from "../../src/constants/api_constants";
|
|
3
|
+
import { scorm12_errors } from "../../src/constants/error_codes";
|
|
4
4
|
import { CMI } from "../../src/cmi/aicc/cmi";
|
|
5
5
|
import * as h from "../cmi_helpers";
|
|
6
6
|
import { expect } from "expect";
|
|
@@ -13,13 +13,10 @@ import { NAV } from "../../src/cmi/scorm12/nav";
|
|
|
13
13
|
import { CMIPathsObject } from "../../src/cmi/aicc/paths";
|
|
14
14
|
import { CMIStudentDemographics } from "../../src/cmi/aicc/student_demographics";
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const type_mismatch = scorm12_error_codes.TYPE_MISMATCH;
|
|
21
|
-
const write_only = scorm12_error_codes.WRITE_ONLY_ELEMENT;
|
|
22
|
-
const read_only = scorm12_error_codes.READ_ONLY_ELEMENT;
|
|
16
|
+
const invalid_set = scorm12_errors.INVALID_SET_VALUE;
|
|
17
|
+
const type_mismatch = scorm12_errors.TYPE_MISMATCH;
|
|
18
|
+
const write_only = scorm12_errors.WRITE_ONLY_ELEMENT;
|
|
19
|
+
const read_only = scorm12_errors.READ_ONLY_ELEMENT;
|
|
23
20
|
|
|
24
21
|
describe("AICC CMI Tests", () => {
|
|
25
22
|
describe("CMI Spec Tests", () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from "expect";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import { scorm12_constants } from "../../src/constants/api_constants";
|
|
4
|
+
import { scorm12_errors } from "../../src/constants/error_codes";
|
|
5
5
|
import { CMI } from "../../src/cmi/scorm12/cmi";
|
|
6
6
|
import * as h from "../cmi_helpers";
|
|
7
7
|
import { scorm12Values } from "../field_values";
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
CMIInteractionsObjectivesObject,
|
|
13
13
|
} from "../../src/cmi/scorm12/interactions";
|
|
14
14
|
|
|
15
|
-
const scorm12 =
|
|
16
|
-
const scorm12_error_codes =
|
|
15
|
+
const scorm12 = scorm12_constants;
|
|
16
|
+
const scorm12_error_codes = scorm12;
|
|
17
17
|
|
|
18
|
-
const invalid_set =
|
|
19
|
-
const type_mismatch =
|
|
20
|
-
const write_only =
|
|
21
|
-
const read_only =
|
|
18
|
+
const invalid_set = scorm12_errors.INVALID_SET_VALUE;
|
|
19
|
+
const type_mismatch = scorm12_errors.TYPE_MISMATCH;
|
|
20
|
+
const write_only = scorm12_errors.WRITE_ONLY_ELEMENT;
|
|
21
|
+
const read_only = scorm12_errors.READ_ONLY_ELEMENT;
|
|
22
22
|
|
|
23
23
|
const cmi = () => {
|
|
24
24
|
return new CMI();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it } from "mocha";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { scorm2004_errors } from "../../src/constants/error_codes";
|
|
3
|
+
import { scorm2004_constants } from "../../src/constants/api_constants";
|
|
4
4
|
import { CMI } from "../../src/cmi/scorm2004/cmi";
|
|
5
5
|
import * as h from "../cmi_helpers";
|
|
6
6
|
import { expect } from "expect";
|
|
@@ -14,12 +14,9 @@ import { CMICommentsObject } from "../../src/cmi/scorm2004/comments";
|
|
|
14
14
|
import { CMIObjectivesObject } from "../../src/cmi/scorm2004/objectives";
|
|
15
15
|
import { ADL } from "../../src/cmi/scorm2004/adl";
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const read_only = scorm2004_error_codes.READ_ONLY_ELEMENT;
|
|
21
|
-
const write_only = scorm2004_error_codes.WRITE_ONLY_ELEMENT;
|
|
22
|
-
const type_mismatch = scorm2004_error_codes.TYPE_MISMATCH;
|
|
17
|
+
const read_only = scorm2004_errors.READ_ONLY_ELEMENT;
|
|
18
|
+
const write_only = scorm2004_errors.WRITE_ONLY_ELEMENT;
|
|
19
|
+
const type_mismatch = scorm2004_errors.TYPE_MISMATCH;
|
|
23
20
|
|
|
24
21
|
const cmi = () => {
|
|
25
22
|
return new CMI();
|
|
@@ -1023,7 +1020,9 @@ describe("SCORM 2004 CMI Tests", () => {
|
|
|
1023
1020
|
|
|
1024
1021
|
it("should export JSON", () => {
|
|
1025
1022
|
const cmi = adl();
|
|
1026
|
-
expect(JSON.stringify(cmi)).toEqual(
|
|
1023
|
+
expect(JSON.stringify(cmi)).toEqual(
|
|
1024
|
+
'{"nav":{"request":"_none_"},"data":{}}',
|
|
1025
|
+
);
|
|
1027
1026
|
});
|
|
1028
1027
|
});
|
|
1029
1028
|
});
|
package/test/exceptions.spec.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { describe, it } from "mocha";
|
|
2
2
|
import { expect } from "expect";
|
|
3
|
+
import { ValidationError } from "../src/exceptions";
|
|
3
4
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "../src/exceptions";
|
|
9
|
-
import
|
|
5
|
+
aicc_constants,
|
|
6
|
+
scorm12_constants,
|
|
7
|
+
scorm2004_constants,
|
|
8
|
+
} from "../src/constants/api_constants";
|
|
9
|
+
import { AICCValidationError } from "../src/exceptions/aicc_exceptions";
|
|
10
|
+
import { Scorm12ValidationError } from "../src/exceptions/scorm12_exceptions";
|
|
11
|
+
import { Scorm2004ValidationError } from "../src/exceptions/scorm2004_exceptions";
|
|
10
12
|
|
|
11
|
-
const scorm12_errors =
|
|
12
|
-
const aicc_errors =
|
|
13
|
-
const scorm2004_errors =
|
|
13
|
+
const scorm12_errors = scorm12_constants.error_descriptions;
|
|
14
|
+
const aicc_errors = aicc_constants.error_descriptions;
|
|
15
|
+
const scorm2004_errors = scorm2004_constants.error_descriptions;
|
|
14
16
|
|
|
15
17
|
type CheckValidationMessage = {
|
|
16
18
|
errorClass: any;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { expect } from "expect";
|
|
2
2
|
import * as sinon from "sinon";
|
|
3
|
+
import { SinonStub } from "sinon";
|
|
3
4
|
import { LogLevel, ResultObject, Settings } from "../../src/types/api_types";
|
|
4
|
-
import
|
|
5
|
+
import { global_constants } from "../../src/constants/api_constants";
|
|
5
6
|
import { LogLevelEnum } from "../../src/constants/enums";
|
|
6
7
|
import { DefaultSettings } from "../../src/constants/default_settings";
|
|
7
|
-
import { SinonStub } from "sinon";
|
|
8
8
|
|
|
9
9
|
describe("Settings Type", () => {
|
|
10
10
|
const defaultSettings: Settings = {
|
|
@@ -25,7 +25,7 @@ describe("Settings Type", () => {
|
|
|
25
25
|
responseHandler: async (response: Response): Promise<ResultObject> => {
|
|
26
26
|
const httpResult = JSON.parse(await response.text());
|
|
27
27
|
return {
|
|
28
|
-
result: httpResult.result ||
|
|
28
|
+
result: httpResult.result || global_constants.SCORM_FALSE,
|
|
29
29
|
errorCode:
|
|
30
30
|
httpResult.errorCode !== undefined ? httpResult.errorCode : 101,
|
|
31
31
|
};
|
package/test/utilities.spec.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { expect } from "expect";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
3
|
import * as Utilities from "../src/utilities";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const scorm12_regex = Regex.scorm12;
|
|
7
|
-
const scorm2004_regex = Regex.scorm2004;
|
|
4
|
+
import { scorm12_regex, scorm2004_regex } from "../src/constants/regex";
|
|
8
5
|
|
|
9
6
|
describe("Utility Tests", () => {
|
|
10
7
|
describe("getSecondsAsHHMMSS()", () => {
|
package/webpack.config.js
CHANGED
|
@@ -32,6 +32,7 @@ const commonConfig = {
|
|
|
32
32
|
rules: [TSLoader],
|
|
33
33
|
},
|
|
34
34
|
optimization: {
|
|
35
|
+
usedExports: false,
|
|
35
36
|
minimize: true,
|
|
36
37
|
minimizer: [
|
|
37
38
|
new TerserPlugin({
|
|
@@ -41,6 +42,9 @@ const commonConfig = {
|
|
|
41
42
|
output: {
|
|
42
43
|
comments: false,
|
|
43
44
|
},
|
|
45
|
+
compress: {
|
|
46
|
+
passes: 3,
|
|
47
|
+
},
|
|
44
48
|
},
|
|
45
49
|
}),
|
|
46
50
|
],
|
|
@@ -63,7 +67,7 @@ const cjsConfig = {
|
|
|
63
67
|
output: {
|
|
64
68
|
path: path.resolve(__dirname, "dist"),
|
|
65
69
|
filename: "[name].js",
|
|
66
|
-
libraryTarget: "
|
|
70
|
+
libraryTarget: "window",
|
|
67
71
|
environment: {
|
|
68
72
|
arrowFunction: false,
|
|
69
73
|
},
|