scorm-again 3.0.3 → 3.0.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/README.md +19 -4
- package/dist/esm/scorm-again.js +133 -68
- 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 +20 -5
- 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 +133 -68
- 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 +261 -166
- 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 +14 -6
- 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 +261 -166
- 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/interaction_delimiters.d.ts +4 -0
- package/package.json +46 -25
package/dist/scorm12.js
CHANGED
|
@@ -1906,7 +1906,13 @@ this.Scorm12API = (function () {
|
|
|
1906
1906
|
if (!scorm2004) {
|
|
1907
1907
|
if (isFinalAttribute) {
|
|
1908
1908
|
if (typeof attribute === "undefined" || !this.context.checkObjectHasProperty(refObject, attribute)) {
|
|
1909
|
-
|
|
1909
|
+
if (attribute === "_children") {
|
|
1910
|
+
this.context.throwSCORMError(CMIElement, getErrorCode(this.context.errorCodes, "CHILDREN_ERROR"));
|
|
1911
|
+
} else if (attribute === "_count") {
|
|
1912
|
+
this.context.throwSCORMError(CMIElement, getErrorCode(this.context.errorCodes, "COUNT_ERROR"));
|
|
1913
|
+
} else {
|
|
1914
|
+
this.context.throwSCORMError(CMIElement, invalidErrorCode, invalidErrorMessage);
|
|
1915
|
+
}
|
|
1910
1916
|
return {
|
|
1911
1917
|
error: true
|
|
1912
1918
|
};
|
|
@@ -2114,7 +2120,8 @@ this.Scorm12API = (function () {
|
|
|
2114
2120
|
getNumericLevel(level) {
|
|
2115
2121
|
if (level === void 0) return LogLevelEnum.NONE;
|
|
2116
2122
|
if (typeof level === "number") return level;
|
|
2117
|
-
|
|
2123
|
+
const normalized = typeof level === "string" ? level.toUpperCase() : level;
|
|
2124
|
+
switch (normalized) {
|
|
2118
2125
|
case "1":
|
|
2119
2126
|
case "DEBUG":
|
|
2120
2127
|
return LogLevelEnum.DEBUG;
|
|
@@ -2495,7 +2502,7 @@ ${stackTrace}`);
|
|
|
2495
2502
|
* @param {Function} apiLog - The logging function
|
|
2496
2503
|
*/
|
|
2497
2504
|
constructor(settings, error_codes, apiLog) {
|
|
2498
|
-
this
|
|
2505
|
+
__publicField$c(this, "apiLog", apiLog);
|
|
2499
2506
|
__publicField$c(this, "settings");
|
|
2500
2507
|
__publicField$c(this, "error_codes");
|
|
2501
2508
|
__publicField$c(this, "storeName", "scorm_again_offline_data");
|
|
@@ -3993,19 +4000,20 @@ ${stackTrace}`);
|
|
|
3993
4000
|
if (errorCode === 143) returnValue = global_constants.SCORM_FALSE;
|
|
3994
4001
|
} else {
|
|
3995
4002
|
const result = this.storeData(false);
|
|
3996
|
-
|
|
4003
|
+
const errorCode = result.errorCode ?? 0;
|
|
4004
|
+
if (errorCode > 0) {
|
|
3997
4005
|
if (result.errorMessage) {
|
|
3998
4006
|
this.apiLog("commit", `Commit failed with error: ${result.errorMessage}`, LogLevelEnum.ERROR);
|
|
3999
4007
|
}
|
|
4000
4008
|
if (result.errorDetails) {
|
|
4001
4009
|
this.apiLog("commit", `Error details: ${JSON.stringify(result.errorDetails)}`, LogLevelEnum.DEBUG);
|
|
4002
4010
|
}
|
|
4003
|
-
this.throwSCORMError("api",
|
|
4011
|
+
this.throwSCORMError("api", errorCode);
|
|
4004
4012
|
}
|
|
4005
4013
|
const resultValue = result?.result ?? global_constants.SCORM_FALSE;
|
|
4006
4014
|
returnValue = typeof resultValue === "boolean" ? String(resultValue) : resultValue;
|
|
4007
4015
|
this.apiLog(callbackName, " Result: " + returnValue, LogLevelEnum.DEBUG, "HttpRequest");
|
|
4008
|
-
if (checkTerminated) this.lastErrorCode = "0";
|
|
4016
|
+
if (checkTerminated && errorCode === 0) this.lastErrorCode = "0";
|
|
4009
4017
|
this.processListeners(callbackName);
|
|
4010
4018
|
if (this.settings.enableOfflineSupport && this._offlineStorageService && this._offlineStorageService.isDeviceOnline() && this._courseId) {
|
|
4011
4019
|
this._offlineStorageService.hasPendingOfflineData(this._courseId).then(hasPendingData => {
|