scorm-again 2.6.2 → 2.6.3

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/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Scorm12Impl } from "./src/Scorm12API";
1
+ import { Scorm12API as Scorm12Impl } from "./src/Scorm12API";
2
2
  import { CMI as Scorm12CMI } from "./src/cmi/scorm12/cmi";
3
3
  import { NAV as Scorm12NAV } from "./src/cmi/scorm12/nav";
4
4
  import { CMI as Scorm2004CMI } from "./src/cmi/scorm2004/cmi";
5
5
  import { ADL as Scorm2004ADL } from "./src/cmi/scorm2004/adl";
6
6
  import { Settings } from "./src/types/api_types";
7
- import { Scorm2004Impl } from "./src/Scorm2004API";
8
- import { AICCImpl } from "./src/AICC";
7
+ import { Scorm2004API as Scorm2004Impl } from "./src/Scorm2004API";
8
+ import { AICC as AICCImpl } from "./src/AICC";
9
9
 
10
10
  declare class Scorm12API extends Scorm12Impl {
11
11
  constructor(settings?: Settings);
@@ -21,6 +21,13 @@ declare class Scorm12API extends Scorm12Impl {
21
21
  LMSGetErrorString: (CMIErrorCode: string) => string;
22
22
  LMSGetDiagnostic: (CMIErrorCode: string) => string;
23
23
 
24
+ loadFromJSON: (json: any, CMIElement?: string) => void;
25
+ loadFromFlattenedJSON: (json: any, CMIElement?: string) => void;
26
+ on: (listenerName: string, callback: Function) => void;
27
+ off: (listenerName: string, callback: Function) => void;
28
+ clear: (listenerName: string) => void;
29
+
30
+
24
31
  /**
25
32
  * Called when the API needs to be reset
26
33
  */
@@ -41,6 +48,13 @@ declare class Scorm2004API extends Scorm2004Impl {
41
48
  GetErrorString: (CMIErrorCode: string) => string;
42
49
  GetDiagnostic: (CMIErrorCode: string) => string;
43
50
 
51
+ loadFromJSON: (json: any, CMIElement?: string) => void;
52
+ loadFromFlattenedJSON: (json: any, CMIElement?: string) => void;
53
+ on: (listenerName: string, callback: Function) => void;
54
+ off: (listenerName: string, callback: Function) => void;
55
+ clear: (listenerName: string) => void;
56
+
57
+
44
58
  /**
45
59
  * Called when the API needs to be reset
46
60
  */
@@ -61,6 +75,13 @@ declare class AICC extends AICCImpl {
61
75
  LMSGetErrorString: (CMIErrorCode: string) => string;
62
76
  LMSGetDiagnostic: (CMIErrorCode: string) => string;
63
77
 
78
+ loadFromJSON: (json: any, CMIElement?: string) => void;
79
+ loadFromFlattenedJSON: (json: any, CMIElement?: string) => void;
80
+ on: (listenerName: string, callback: Function) => void;
81
+ off: (listenerName: string, callback: Function) => void;
82
+ clear: (listenerName: string) => void;
83
+
84
+
64
85
  /**
65
86
  * Called when the API needs to be reset
66
87
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scorm-again",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "description": "A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004",
5
5
  "main": "dist/scorm-again.js",
6
6
  "types": "index.d.ts",
package/src/BaseAPI.ts CHANGED
@@ -1145,8 +1145,9 @@ export default abstract class BaseAPI implements IBaseAPI {
1145
1145
  const response = await this.performFetch(url, params);
1146
1146
 
1147
1147
  return this.transformResponse(response);
1148
- } catch (e) {
1149
- this.apiLog("processHttpRequest", e, LogLevelEnum.ERROR);
1148
+ } catch (e: unknown) {
1149
+ const message = e instanceof Error ? e.message : String(e);
1150
+ this.apiLog("processHttpRequest", message, LogLevelEnum.ERROR);
1150
1151
  api.processListeners("CommitError");
1151
1152
  return genericError;
1152
1153
  }
@@ -9,7 +9,14 @@ export const scorm12_regex = {
9
9
  CMIDecimal: "^-?([0-9]{0,3})(.[0-9]*)?$",
10
10
 
11
11
  CMIIdentifier: "^[\\u0021-\\u007E\\s]{0,255}$",
12
- CMIFeedback: "^.{0,255}$",
12
+ // Allow storing larger responses for interactions
13
+ // Some content packages may exceed the 255 character limit
14
+ // defined in the SCORM 1.2 specification. The previous
15
+ // expression truncated these values which resulted in
16
+ // a "101: General Exception" being thrown when long
17
+ // answers were supplied. To support these packages we
18
+ // relax the limitation and accept any length string.
19
+ CMIFeedback: "^.*$",
13
20
  // This must be redefined
14
21
  CMIIndex: "[._](\\d+).",
15
22
  // Vocabulary Data Type Definition