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.
Files changed (77) hide show
  1. package/.github/workflows/stale.yml +14 -0
  2. package/.run/{Mocha Unit Tests.run.xml → Mocha Unit Tests (watch).run.xml } +1 -1
  3. package/.run/Template Mocha.run.xml +17 -0
  4. package/README.md +180 -72
  5. package/dist/aicc.js +1520 -1149
  6. package/dist/aicc.js.map +1 -1
  7. package/dist/aicc.min.js +1 -1
  8. package/dist/aicc.min.js.map +1 -1
  9. package/dist/scorm-again.js +2812 -2205
  10. package/dist/scorm-again.js.map +1 -1
  11. package/dist/scorm-again.min.js +1 -1
  12. package/dist/scorm-again.min.js.map +1 -1
  13. package/dist/scorm12.js +1129 -842
  14. package/dist/scorm12.js.map +1 -1
  15. package/dist/scorm12.min.js +1 -1
  16. package/dist/scorm12.min.js.map +1 -1
  17. package/dist/scorm2004.js +1921 -1564
  18. package/dist/scorm2004.js.map +1 -1
  19. package/dist/scorm2004.min.js +1 -1
  20. package/dist/scorm2004.min.js.map +1 -1
  21. package/package.json +20 -17
  22. package/src/AICC.ts +15 -17
  23. package/src/BaseAPI.ts +283 -420
  24. package/src/Scorm12API.ts +133 -41
  25. package/src/Scorm2004API.ts +224 -120
  26. package/src/cmi/aicc/attempts.ts +94 -0
  27. package/src/cmi/aicc/cmi.ts +100 -0
  28. package/src/cmi/aicc/core.ts +360 -0
  29. package/src/cmi/aicc/evaluation.ts +157 -0
  30. package/src/cmi/aicc/paths.ts +180 -0
  31. package/src/cmi/aicc/student_data.ts +86 -0
  32. package/src/cmi/aicc/student_demographics.ts +367 -0
  33. package/src/cmi/aicc/student_preferences.ts +176 -0
  34. package/src/cmi/aicc/tries.ts +116 -0
  35. package/src/cmi/aicc/validation.ts +25 -0
  36. package/src/cmi/common/array.ts +77 -0
  37. package/src/cmi/common/base_cmi.ts +46 -0
  38. package/src/cmi/common/score.ts +203 -0
  39. package/src/cmi/common/validation.ts +60 -0
  40. package/src/cmi/scorm12/cmi.ts +224 -0
  41. package/src/cmi/scorm12/interactions.ts +368 -0
  42. package/src/cmi/scorm12/nav.ts +54 -0
  43. package/src/cmi/scorm12/objectives.ts +112 -0
  44. package/src/cmi/scorm12/student_data.ts +130 -0
  45. package/src/cmi/scorm12/student_preference.ts +158 -0
  46. package/src/cmi/scorm12/validation.ts +48 -0
  47. package/src/cmi/scorm2004/adl.ts +272 -0
  48. package/src/cmi/scorm2004/cmi.ts +599 -0
  49. package/src/cmi/scorm2004/comments.ts +163 -0
  50. package/src/cmi/scorm2004/interactions.ts +466 -0
  51. package/src/cmi/scorm2004/learner_preference.ts +152 -0
  52. package/src/cmi/scorm2004/objectives.ts +212 -0
  53. package/src/cmi/scorm2004/score.ts +78 -0
  54. package/src/cmi/scorm2004/validation.ts +42 -0
  55. package/src/constants/default_settings.ts +82 -0
  56. package/src/constants/enums.ts +17 -0
  57. package/src/constants/regex.ts +2 -2
  58. package/src/constants/response_constants.ts +2 -0
  59. package/src/exceptions.ts +22 -1
  60. package/src/helpers/scheduled_commit.ts +42 -0
  61. package/src/interfaces/IBaseAPI.ts +35 -0
  62. package/src/types/api_types.ts +50 -0
  63. package/src/utilities/debounce.ts +31 -0
  64. package/src/utilities.ts +56 -0
  65. package/test/AICC.spec.ts +11 -1
  66. package/test/Scorm12API.spec.ts +372 -9
  67. package/test/Scorm2004API.spec.ts +558 -2
  68. package/test/cmi/aicc_cmi.spec.ts +188 -11
  69. package/test/cmi/scorm12_cmi.spec.ts +5 -5
  70. package/test/cmi/scorm2004_cmi.spec.ts +8 -8
  71. package/test/cmi_helpers.ts +1 -1
  72. package/test/types/api_types.spec.ts +126 -0
  73. package/test/utilities/debounce.spec.ts +56 -0
  74. package/src/cmi/aicc_cmi.ts +0 -1248
  75. package/src/cmi/common.ts +0 -411
  76. package/src/cmi/scorm12_cmi.ts +0 -1426
  77. package/src/cmi/scorm2004_cmi.ts +0 -1874
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scorm-again",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004",
5
5
  "main": "dist/scorm-again.min.js",
6
6
  "type": "module",
@@ -20,33 +20,33 @@
20
20
  "test": "test"
21
21
  },
22
22
  "devDependencies": {
23
- "@babel/cli": "^7.25.7",
24
- "@babel/core": "^7.25.7",
25
- "@babel/eslint-parser": "^7.25.7",
26
- "@babel/node": "^7.25.7",
27
- "@babel/preset-env": "^7.25.7",
28
- "@babel/preset-typescript": "^7.25.7",
23
+ "@babel/cli": "^7.25.9",
24
+ "@babel/core": "^7.25.9",
25
+ "@babel/eslint-parser": "^7.25.9",
26
+ "@babel/node": "^7.25.9",
27
+ "@babel/preset-env": "^7.25.9",
28
+ "@babel/preset-typescript": "^7.25.9",
29
29
  "@eslint/eslintrc": "^3.1.0",
30
- "@eslint/js": "^9.12.0",
30
+ "@eslint/js": "^9.13.0",
31
31
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
32
32
  "@types/eslint__js": "^8.42.3",
33
- "@types/expect": "^24.3.0",
34
- "@types/mocha": "^10.0.8",
33
+ "@types/mocha": "^10.0.9",
35
34
  "@types/sinon": "^17.0.3",
36
35
  "babel-eslint": "^11.0.0-beta.2",
37
36
  "babel-loader": "^9.2.1",
38
37
  "babelify": "^10.0.0",
39
38
  "browserify": "^17.0.1",
40
39
  "c8": "^10.1.2",
41
- "eslint": "^9.12.0",
40
+ "c8-as-nyc": "^1.1.11",
41
+ "eslint": "^9.13.0",
42
42
  "eslint-formatter-junit": "^8.40.0",
43
43
  "eslint-plugin-import": "^2.31.0",
44
- "eslint-plugin-jsdoc": "^50.3.1",
44
+ "eslint-plugin-jsdoc": "^50.4.3",
45
45
  "eslint-webpack-plugin": "^4.2.0",
46
46
  "expect": "^29.7.0",
47
47
  "fetch-pretender": "https://github.com/jcputney/fetch-pretender#master",
48
- "globals": "^15.10.0",
49
- "jsdoc": "^4.0.3",
48
+ "globals": "^15.11.0",
49
+ "jsdoc": "^4.0.4",
50
50
  "jsdoc-babel": "^0.5.0",
51
51
  "minimist": "^1.2.8",
52
52
  "miragejs": "^0.2.0-alpha.3",
@@ -58,8 +58,8 @@
58
58
  "terser-webpack-plugin": "^5.3.10",
59
59
  "ts-loader": "^9.5.1",
60
60
  "tsx": "^4.19.1",
61
- "typescript": "^5.6.2",
62
- "typescript-eslint": "^8.8.0",
61
+ "typescript": "^5.6.3",
62
+ "typescript-eslint": "^8.11.0",
63
63
  "webpack": "^5.91.0",
64
64
  "webpack-cli": "^5.1.4"
65
65
  },
@@ -94,7 +94,10 @@
94
94
  "src/**/*.ts"
95
95
  ],
96
96
  "exclude": [
97
- "test/**/*.*"
97
+ "test/**/*.*",
98
+ "src/exports/*.*",
99
+ "src/interfaces/*.*",
100
+ "src/types/*.*"
98
101
  ],
99
102
  "extension": [
100
103
  ".ts"
package/src/AICC.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import Scorm12API from "./Scorm12API";
2
- import {
3
- CMI,
4
- CMIAttemptRecordsObject,
5
- CMIEvaluationCommentsObject,
6
- CMITriesObject,
7
- } from "./cmi/aicc_cmi";
8
- import { NAV } from "./cmi/scorm12_cmi";
9
- import { Settings } from "./BaseAPI";
10
- import { BaseCMI } from "./cmi/common";
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";
11
12
 
12
13
  /**
13
14
  * The AICC API class
@@ -40,21 +41,18 @@ export default class AICC extends Scorm12API {
40
41
  let newChild = super.getChildElement(CMIElement, value, foundFirstIndex);
41
42
 
42
43
  if (!newChild) {
43
- if (
44
- this.stringMatches(CMIElement, "cmi\\.evaluation\\.comments\\.\\d+")
45
- ) {
44
+ if (stringMatches(CMIElement, "cmi\\.evaluation\\.comments\\.\\d+")) {
46
45
  newChild = new CMIEvaluationCommentsObject();
47
46
  } else if (
48
- this.stringMatches(CMIElement, "cmi\\.student_data\\.tries\\.\\d+")
47
+ stringMatches(CMIElement, "cmi\\.student_data\\.tries\\.\\d+")
49
48
  ) {
50
49
  newChild = new CMITriesObject();
51
50
  } else if (
52
- this.stringMatches(
53
- CMIElement,
54
- "cmi\\.student_data\\.attempt_records\\.\\d+",
55
- )
51
+ stringMatches(CMIElement, "cmi\\.student_data\\.attempt_records\\.\\d+")
56
52
  ) {
57
53
  newChild = new CMIAttemptRecordsObject();
54
+ } else if (stringMatches(CMIElement, "cmi\\.paths\\.\\d+")) {
55
+ newChild = new CMIPathsObject();
58
56
  }
59
57
  }
60
58