scorm-again 2.6.3 → 2.6.5
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/.claude/.claude/settings.local.json +13 -0
- package/.claude/settings.local.json +33 -0
- package/dist/aicc.js +38 -22
- 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 +38 -22
- 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 +79 -47
- 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 +35 -20
- 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 +69 -41
- 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 +79 -47
- 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 +35 -20
- 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 +69 -41
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +1 -1
- package/dist/scorm2004.min.js.map +1 -1
- package/dist/types/cmi/scorm2004/adl.d.ts +8 -2
- package/dist/types/cmi/scorm2004/cmi.d.ts +1 -1
- package/package.json +1 -1
- package/src/BaseAPI.ts +56 -33
- package/src/Scorm12API.ts +3 -2
- package/src/Scorm2004API.ts +31 -24
- package/src/cmi/aicc/attempts.ts +3 -3
- package/src/cmi/aicc/core.ts +30 -12
- package/src/cmi/aicc/evaluation.ts +1 -1
- package/src/cmi/aicc/student_data.ts +1 -1
- package/src/cmi/aicc/student_demographics.ts +13 -13
- package/src/cmi/aicc/student_preferences.ts +1 -1
- package/src/cmi/aicc/tries.ts +3 -3
- package/src/cmi/aicc/validation.ts +1 -1
- package/src/cmi/common/array.ts +1 -1
- package/src/cmi/common/score.ts +3 -3
- package/src/cmi/common/validation.ts +2 -2
- package/src/cmi/scorm12/cmi.ts +12 -4
- package/src/cmi/scorm12/interactions.ts +27 -11
- package/src/cmi/scorm12/objectives.ts +4 -4
- package/src/cmi/scorm12/student_data.ts +12 -4
- package/src/cmi/scorm12/student_preference.ts +3 -1
- package/src/cmi/scorm12/validation.ts +5 -3
- package/src/cmi/scorm2004/adl.ts +39 -22
- package/src/cmi/scorm2004/cmi.ts +47 -17
- package/src/cmi/scorm2004/comments.ts +11 -5
- package/src/cmi/scorm2004/interactions.ts +25 -23
- package/src/cmi/scorm2004/learner_preference.ts +3 -1
- package/src/cmi/scorm2004/objectives.ts +5 -5
- package/src/cmi/scorm2004/score.ts +3 -3
- package/src/cmi/scorm2004/validation.ts +2 -2
- package/src/exceptions/aicc_exceptions.ts +4 -4
- package/src/exceptions/scorm12_exceptions.ts +4 -4
- package/src/exceptions/scorm2004_exceptions.ts +4 -4
- package/src/utilities.ts +3 -3
- package/test/BaseAPI.requestHandler.spec.ts +126 -0
- package/test/Scorm12API.spec.ts +45 -0
- package/test/Scorm2004API.spec.ts +43 -0
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"mcp__sequential-thinking__sequentialthinking",
|
|
5
|
+
"Bash(grep:*)",
|
|
6
|
+
"Bash(npm run lint)",
|
|
7
|
+
"Bash(npm run prettier:*)",
|
|
8
|
+
"Bash(npm run build:*)",
|
|
9
|
+
"Bash(npm install)",
|
|
10
|
+
"Bash(npm test:*)",
|
|
11
|
+
"Bash(mv:*)",
|
|
12
|
+
"Bash(npx tsc:*)",
|
|
13
|
+
"Bash(npm run test:coverage:*)",
|
|
14
|
+
"Bash(npm run test:*)",
|
|
15
|
+
"Bash(git add:*)",
|
|
16
|
+
"Bash(ls:*)",
|
|
17
|
+
"Bash(git stash push:*)",
|
|
18
|
+
"Bash(npx playwright test:*)",
|
|
19
|
+
"Bash(pdftotext:*)",
|
|
20
|
+
"Bash(npm run lint:*)",
|
|
21
|
+
"Bash(find:*)",
|
|
22
|
+
"Bash(sed:*)",
|
|
23
|
+
"Bash(node:*)",
|
|
24
|
+
"Bash(rg:*)",
|
|
25
|
+
"Bash(rm:*)",
|
|
26
|
+
"Bash(npm run compile:dev:*)",
|
|
27
|
+
"Bash(open test-logging.html)",
|
|
28
|
+
"mcp__github__get_issue",
|
|
29
|
+
"Bash(yarn run:*)"
|
|
30
|
+
],
|
|
31
|
+
"deny": []
|
|
32
|
+
}
|
|
33
|
+
}
|
package/dist/aicc.js
CHANGED
|
@@ -417,6 +417,10 @@ var BaseAPI = (function () {
|
|
|
417
417
|
: this._error_codes.GENERAL;
|
|
418
418
|
for (var idx = 0; idx < structure.length; idx++) {
|
|
419
419
|
var attribute = structure[idx];
|
|
420
|
+
if (!attribute) {
|
|
421
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
422
|
+
return api_constants.global_constants.SCORM_FALSE;
|
|
423
|
+
}
|
|
420
424
|
if (idx === structure.length - 1) {
|
|
421
425
|
if (scorm2004 && attribute.substring(0, 8) === "{target=") {
|
|
422
426
|
if (this.isInitialized()) {
|
|
@@ -447,7 +451,7 @@ var BaseAPI = (function () {
|
|
|
447
451
|
break;
|
|
448
452
|
}
|
|
449
453
|
if (refObject instanceof array.CMIArray) {
|
|
450
|
-
var index = parseInt(structure[idx + 1], 10);
|
|
454
|
+
var index = parseInt(structure[idx + 1] || "0", 10);
|
|
451
455
|
if (!isNaN(index)) {
|
|
452
456
|
var item = refObject.childArray[index];
|
|
453
457
|
if (item) {
|
|
@@ -491,6 +495,10 @@ var BaseAPI = (function () {
|
|
|
491
495
|
: this._error_codes.GENERAL;
|
|
492
496
|
for (var idx = 0; idx < structure.length; idx++) {
|
|
493
497
|
attribute = structure[idx];
|
|
498
|
+
if (!attribute) {
|
|
499
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
494
502
|
if (!scorm2004) {
|
|
495
503
|
if (idx === structure.length - 1) {
|
|
496
504
|
if (!this._checkObjectHasProperty(refObject, attribute)) {
|
|
@@ -516,7 +524,7 @@ var BaseAPI = (function () {
|
|
|
516
524
|
break;
|
|
517
525
|
}
|
|
518
526
|
if (refObject instanceof array.CMIArray) {
|
|
519
|
-
var index = parseInt(structure[idx + 1], 10);
|
|
527
|
+
var index = parseInt(structure[idx + 1] || "", 10);
|
|
520
528
|
if (!isNaN(index)) {
|
|
521
529
|
var item = refObject.childArray[index];
|
|
522
530
|
if (item) {
|
|
@@ -554,17 +562,18 @@ var BaseAPI = (function () {
|
|
|
554
562
|
return this.currentState === api_constants.global_constants.STATE_TERMINATED;
|
|
555
563
|
};
|
|
556
564
|
BaseAPI.prototype.on = function (listenerName, callback) {
|
|
565
|
+
var _a, _c;
|
|
557
566
|
if (!callback)
|
|
558
567
|
return;
|
|
559
568
|
var listenerFunctions = listenerName.split(" ");
|
|
560
569
|
for (var i = 0; i < listenerFunctions.length; i++) {
|
|
561
|
-
var listenerSplit = listenerFunctions[i].split(".");
|
|
562
|
-
if (listenerSplit.length === 0)
|
|
570
|
+
var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
|
|
571
|
+
if (!listenerSplit || listenerSplit.length === 0)
|
|
563
572
|
return;
|
|
564
573
|
var functionName = listenerSplit[0];
|
|
565
574
|
var CMIElement = null;
|
|
566
575
|
if (listenerSplit.length > 1) {
|
|
567
|
-
CMIElement =
|
|
576
|
+
CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
|
|
568
577
|
}
|
|
569
578
|
this.listenerArray.push({
|
|
570
579
|
functionName: functionName,
|
|
@@ -575,17 +584,18 @@ var BaseAPI = (function () {
|
|
|
575
584
|
}
|
|
576
585
|
};
|
|
577
586
|
BaseAPI.prototype.off = function (listenerName, callback) {
|
|
587
|
+
var _a, _c;
|
|
578
588
|
if (!callback)
|
|
579
589
|
return;
|
|
580
590
|
var listenerFunctions = listenerName.split(" ");
|
|
581
591
|
var _loop_1 = function (i) {
|
|
582
|
-
var listenerSplit = listenerFunctions[i].split(".");
|
|
583
|
-
if (listenerSplit.length === 0)
|
|
592
|
+
var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
|
|
593
|
+
if (!listenerSplit || listenerSplit.length === 0)
|
|
584
594
|
return { value: void 0 };
|
|
585
595
|
var functionName = listenerSplit[0];
|
|
586
596
|
var CMIElement = null;
|
|
587
597
|
if (listenerSplit.length > 1) {
|
|
588
|
-
CMIElement =
|
|
598
|
+
CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
|
|
589
599
|
}
|
|
590
600
|
var removeIndex = this_1.listenerArray.findIndex(function (obj) {
|
|
591
601
|
return obj.functionName === functionName &&
|
|
@@ -605,15 +615,16 @@ var BaseAPI = (function () {
|
|
|
605
615
|
}
|
|
606
616
|
};
|
|
607
617
|
BaseAPI.prototype.clear = function (listenerName) {
|
|
618
|
+
var _a, _c;
|
|
608
619
|
var listenerFunctions = listenerName.split(" ");
|
|
609
620
|
var _loop_2 = function (i) {
|
|
610
|
-
var listenerSplit = listenerFunctions[i].split(".");
|
|
611
|
-
if (listenerSplit.length === 0)
|
|
621
|
+
var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
|
|
622
|
+
if (!listenerSplit || (listenerSplit === null || listenerSplit === void 0 ? void 0 : listenerSplit.length) === 0)
|
|
612
623
|
return { value: void 0 };
|
|
613
624
|
var functionName = listenerSplit[0];
|
|
614
625
|
var CMIElement = null;
|
|
615
626
|
if (listenerSplit.length > 1) {
|
|
616
|
-
CMIElement =
|
|
627
|
+
CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
|
|
617
628
|
}
|
|
618
629
|
this_2.listenerArray = this_2.listenerArray.filter(function (obj) {
|
|
619
630
|
return obj.functionName !== functionName && obj.CMIElement !== CMIElement;
|
|
@@ -780,6 +791,7 @@ var BaseAPI = (function () {
|
|
|
780
791
|
errorCode: this.error_codes.GENERAL,
|
|
781
792
|
};
|
|
782
793
|
if (immediate) {
|
|
794
|
+
params = this.settings.requestHandler(params);
|
|
783
795
|
this.performFetch(url, params).then(function (response) { return (0,tslib_es6.__awaiter)(_this, void 0, void 0, function () {
|
|
784
796
|
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
785
797
|
switch (_a.label) {
|
|
@@ -1095,14 +1107,16 @@ var Scorm12Impl = (function (_super) {
|
|
|
1095
1107
|
Scorm12Impl.prototype.validateCorrectResponse = function (_CMIElement, _value) {
|
|
1096
1108
|
};
|
|
1097
1109
|
Scorm12Impl.prototype.getLmsErrorMessageDetails = function (errorNumber, detail) {
|
|
1110
|
+
var _a, _b;
|
|
1098
1111
|
var basicMessage = "No Error";
|
|
1099
1112
|
var detailMessage = "No Error";
|
|
1100
1113
|
errorNumber = String(errorNumber);
|
|
1101
1114
|
if (_constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber]) {
|
|
1102
1115
|
basicMessage =
|
|
1103
|
-
_constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber].basicMessage
|
|
1116
|
+
((_a = _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber]) === null || _a === void 0 ? void 0 : _a.basicMessage) ||
|
|
1117
|
+
"General Error";
|
|
1104
1118
|
detailMessage =
|
|
1105
|
-
_constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber].detailMessage;
|
|
1119
|
+
((_b = _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber]) === null || _b === void 0 ? void 0 : _b.detailMessage) || "";
|
|
1106
1120
|
}
|
|
1107
1121
|
return detail ? detailMessage : basicMessage;
|
|
1108
1122
|
};
|
|
@@ -1487,8 +1501,8 @@ function checkValidFormat(value, regexPattern, errorCode, errorClass, allowEmpty
|
|
|
1487
1501
|
function checkValidRange(value, rangePattern, errorCode, errorClass) {
|
|
1488
1502
|
var ranges = rangePattern.split("#");
|
|
1489
1503
|
value = value * 1.0;
|
|
1490
|
-
if (value >= ranges[0]) {
|
|
1491
|
-
if (ranges[1] === "*" || value <= ranges[1]) {
|
|
1504
|
+
if (ranges[0] && value >= ranges[0]) {
|
|
1505
|
+
if (ranges[1] && (ranges[1] === "*" || value <= ranges[1])) {
|
|
1492
1506
|
return true;
|
|
1493
1507
|
}
|
|
1494
1508
|
else {
|
|
@@ -3083,11 +3097,12 @@ var Scorm12ValidationError = (function (_super) {
|
|
|
3083
3097
|
(0,tslib__WEBPACK_IMPORTED_MODULE_1__.__extends)(Scorm12ValidationError, _super);
|
|
3084
3098
|
function Scorm12ValidationError(errorCode) {
|
|
3085
3099
|
var _this = this;
|
|
3100
|
+
var _a, _b, _c, _d, _e;
|
|
3086
3101
|
if ({}.hasOwnProperty.call(scorm12_errors, String(errorCode))) {
|
|
3087
|
-
_this = _super.call(this, errorCode, scorm12_errors[String(errorCode)].basicMessage, scorm12_errors[String(errorCode)].detailMessage) || this;
|
|
3102
|
+
_this = _super.call(this, errorCode, ((_a = scorm12_errors[String(errorCode)]) === null || _a === void 0 ? void 0 : _a.basicMessage) || "Unknown error", (_b = scorm12_errors[String(errorCode)]) === null || _b === void 0 ? void 0 : _b.detailMessage) || this;
|
|
3088
3103
|
}
|
|
3089
3104
|
else {
|
|
3090
|
-
_this = _super.call(this, 101, scorm12_errors["101"].basicMessage, scorm12_errors["101"].detailMessage) || this;
|
|
3105
|
+
_this = _super.call(this, 101, (_d = (_c = scorm12_errors["101"]) === null || _c === void 0 ? void 0 : _c.basicMessage) !== null && _d !== void 0 ? _d : "General error", (_e = scorm12_errors["101"]) === null || _e === void 0 ? void 0 : _e.detailMessage) || this;
|
|
3091
3106
|
}
|
|
3092
3107
|
return _this;
|
|
3093
3108
|
}
|
|
@@ -3157,7 +3172,7 @@ function getSecondsAsISODuration(seconds) {
|
|
|
3157
3172
|
var duration = "P";
|
|
3158
3173
|
var remainder = seconds;
|
|
3159
3174
|
for (var designationsKey in designations) {
|
|
3160
|
-
var current_seconds = designations[designationsKey];
|
|
3175
|
+
var current_seconds = designations[designationsKey] || 1;
|
|
3161
3176
|
var value = Math.floor(remainder / current_seconds);
|
|
3162
3177
|
remainder = remainder % current_seconds;
|
|
3163
3178
|
if (countDecimals(remainder) > 2) {
|
|
@@ -3264,7 +3279,7 @@ function unflatten(data) {
|
|
|
3264
3279
|
var m = regex.exec(p);
|
|
3265
3280
|
while (m) {
|
|
3266
3281
|
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
|
|
3267
|
-
prop = m[2] || m[1];
|
|
3282
|
+
prop = m[2] || m[1] || "";
|
|
3268
3283
|
m = regex.exec(p);
|
|
3269
3284
|
}
|
|
3270
3285
|
cur[prop] = data[p];
|
|
@@ -3276,7 +3291,7 @@ function countDecimals(num) {
|
|
|
3276
3291
|
if (Math.floor(num) === num || String(num).indexOf(".") < 0)
|
|
3277
3292
|
return 0;
|
|
3278
3293
|
var parts = num.toString().split(".")[1];
|
|
3279
|
-
return parts.length || 0;
|
|
3294
|
+
return (parts === null || parts === void 0 ? void 0 : parts.length) || 0;
|
|
3280
3295
|
}
|
|
3281
3296
|
function formatMessage(functionName, message, CMIElement) {
|
|
3282
3297
|
var baseLength = 20;
|
|
@@ -3812,11 +3827,12 @@ var AICCValidationError = (function (_super) {
|
|
|
3812
3827
|
(0,tslib_es6.__extends)(AICCValidationError, _super);
|
|
3813
3828
|
function AICCValidationError(errorCode) {
|
|
3814
3829
|
var _this = this;
|
|
3830
|
+
var _a, _b, _c, _d;
|
|
3815
3831
|
if ({}.hasOwnProperty.call(aicc_errors, String(errorCode))) {
|
|
3816
|
-
_this = _super.call(this, errorCode, aicc_errors[String(errorCode)].basicMessage, aicc_errors[String(errorCode)].detailMessage) || this;
|
|
3832
|
+
_this = _super.call(this, errorCode, ((_a = aicc_errors[String(errorCode)]) === null || _a === void 0 ? void 0 : _a.basicMessage) || "Unknown rror", (_b = aicc_errors[String(errorCode)]) === null || _b === void 0 ? void 0 : _b.detailMessage) || this;
|
|
3817
3833
|
}
|
|
3818
3834
|
else {
|
|
3819
|
-
_this = _super.call(this, 101, aicc_errors["101"].basicMessage, aicc_errors["101"].detailMessage) || this;
|
|
3835
|
+
_this = _super.call(this, 101, ((_c = aicc_errors["101"]) === null || _c === void 0 ? void 0 : _c.basicMessage) || "General error", (_d = aicc_errors["101"]) === null || _d === void 0 ? void 0 : _d.detailMessage) || this;
|
|
3820
3836
|
}
|
|
3821
3837
|
return _this;
|
|
3822
3838
|
}
|