scorm-again 3.1.3 → 3.1.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.
Files changed (34) hide show
  1. package/dist/esm/scorm-again.js +1257 -236
  2. package/dist/esm/scorm-again.js.map +1 -1
  3. package/dist/esm/scorm-again.min.js +1 -1
  4. package/dist/esm/scorm-again.min.js.map +1 -1
  5. package/dist/esm/scorm12.js +14 -3
  6. package/dist/esm/scorm12.js.map +1 -1
  7. package/dist/esm/scorm12.min.js +1 -1
  8. package/dist/esm/scorm12.min.js.map +1 -1
  9. package/dist/esm/scorm2004.js +1257 -236
  10. package/dist/esm/scorm2004.js.map +1 -1
  11. package/dist/esm/scorm2004.min.js +1 -1
  12. package/dist/esm/scorm2004.min.js.map +1 -1
  13. package/dist/scorm-again.js +1619 -449
  14. package/dist/scorm-again.js.map +1 -1
  15. package/dist/scorm-again.min.js +1 -1
  16. package/dist/scorm12.js +54 -14
  17. package/dist/scorm12.js.map +1 -1
  18. package/dist/scorm12.min.js +1 -1
  19. package/dist/scorm2004.js +1614 -444
  20. package/dist/scorm2004.js.map +1 -1
  21. package/dist/scorm2004.min.js +1 -1
  22. package/dist/types/Scorm2004API.d.ts +12 -0
  23. package/dist/types/cmi/scorm2004/completion_status_evaluation.d.ts +7 -0
  24. package/dist/types/cmi/scorm2004/sequencing/activity.d.ts +47 -5
  25. package/dist/types/cmi/scorm2004/sequencing/handlers/rte_data_transfer.d.ts +1 -0
  26. package/dist/types/cmi/scorm2004/sequencing/handlers/termination_handler.d.ts +1 -0
  27. package/dist/types/cmi/scorm2004/sequencing/objectives/global_objective_synchronizer.d.ts +17 -1
  28. package/dist/types/cmi/scorm2004/sequencing/sequencing_rules.d.ts +6 -1
  29. package/dist/types/cmi/scorm2004/sequencing/traversal/flow_traversal_service.d.ts +5 -2
  30. package/dist/types/constants/regex.d.ts +1 -0
  31. package/dist/types/types/api_types.d.ts +12 -0
  32. package/dist/types/types/sequencing_types.d.ts +13 -0
  33. package/dist/types/utilities/core.d.ts +4 -1
  34. package/package.json +1 -1
@@ -32,6 +32,16 @@ declare class Scorm2004API extends BaseAPI {
32
32
  GetErrorString: (CMIErrorCode: string | number) => string;
33
33
  GetDiagnostic: (CMIErrorCode: string | number) => string;
34
34
  reset(settings?: Settings): void;
35
+ private applyCurrentActivityLaunchData;
36
+ private applyDeliveredActivityLaunchData;
37
+ private applyActivityLaunchData;
38
+ private applyCurrentActivityObjectiveData;
39
+ private seedCurrentActivityObjectives;
40
+ private seedObjectiveReadMapValues;
41
+ private applyObjectiveReadStateToCMI;
42
+ private getSeedableObjectiveId;
43
+ private findOrSeedCMIObjective;
44
+ private getActivityObjectiveSuccessStatus;
35
45
  get version(): string;
36
46
  get globalObjectives(): CMIObjectivesObject[];
37
47
  set _globalObjectives(objectives: CMIObjectivesObject[]);
@@ -47,6 +57,7 @@ declare class Scorm2004API extends BaseAPI {
47
57
  lmsGetErrorString(CMIErrorCode: string | number): string;
48
58
  lmsGetDiagnostic(CMIErrorCode: string | number): string;
49
59
  setCMIValue(CMIElement: string, value: any): string;
60
+ private currentActivityAllowsGlobalObjectiveWrites;
50
61
  getChildElement(CMIElement: string, value: any, foundFirstIndex: boolean): BaseCMI | null;
51
62
  validateCorrectResponse(CMIElement: string, value: any): void;
52
63
  private _peekCMIValue;
@@ -63,6 +74,7 @@ declare class Scorm2004API extends BaseAPI {
63
74
  private configureSequencingControls;
64
75
  private configureRollupRules;
65
76
  private initializeSequencingService;
77
+ private buildSequencingEventListeners;
66
78
  getSequencingService(): SequencingService | null;
67
79
  setSequencingEventListeners(listeners: SequencingEventListeners): void;
68
80
  updateSequencingConfiguration(config: SequencingConfiguration): void;
@@ -0,0 +1,7 @@
1
+ export type CompletionStatusThresholdInput = {
2
+ completionThreshold?: number | string | null | undefined;
3
+ progressMeasure?: number | string | null | undefined;
4
+ storedCompletionStatus?: string | null | undefined;
5
+ };
6
+ export declare function evaluateCompletionStatusFromThreshold({ completionThreshold, progressMeasure, storedCompletionStatus, }: CompletionStatusThresholdInput): string;
7
+ //# sourceMappingURL=completion_status_evaluation.d.ts.map
@@ -34,6 +34,12 @@ export interface ActivityObjectiveState {
34
34
  satisfiedStatus: boolean;
35
35
  measureStatus: boolean;
36
36
  normalizedMeasure: number;
37
+ rawScore: string;
38
+ rawScoreKnown: boolean;
39
+ minScore: string;
40
+ minScoreKnown: boolean;
41
+ maxScore: string;
42
+ maxScoreKnown: boolean;
37
43
  progressMeasure: number;
38
44
  progressMeasureStatus: boolean;
39
45
  completionStatus: CompletionStatus;
@@ -41,6 +47,18 @@ export interface ActivityObjectiveState {
41
47
  minNormalizedMeasure?: number | null;
42
48
  progressStatus: boolean;
43
49
  }
50
+ export interface ActivityObjectiveScoreState {
51
+ rawScore?: string;
52
+ minScore?: string;
53
+ maxScore?: string;
54
+ }
55
+ export interface ActivityObjectiveReadState extends ActivityObjectiveScoreState {
56
+ satisfiedStatus?: boolean;
57
+ normalizedMeasure?: number;
58
+ progressMeasure?: number;
59
+ completionStatus?: CompletionStatus;
60
+ }
61
+ export type ActivityObjectiveDirtyProperty = "satisfiedStatus" | "normalizedMeasure" | "completionStatus" | "progressMeasure" | "rawScore" | "minScore" | "maxScore";
44
62
  export type RollupConsiderationRequirement = "always" | "ifAttempted" | "ifNotSkipped" | "ifNotSuspended";
45
63
  export interface RollupConsiderationsConfig {
46
64
  requiredForSatisfied: RollupConsiderationRequirement;
@@ -68,6 +86,12 @@ export declare class ActivityObjective {
68
86
  private _satisfiedStatusKnown;
69
87
  private _measureStatus;
70
88
  private _normalizedMeasure;
89
+ private _rawScore;
90
+ private _rawScoreKnown;
91
+ private _minScore;
92
+ private _minScoreKnown;
93
+ private _maxScore;
94
+ private _maxScoreKnown;
71
95
  private _progressMeasure;
72
96
  private _progressMeasureStatus;
73
97
  private _completionStatus;
@@ -76,6 +100,9 @@ export declare class ActivityObjective {
76
100
  private _normalizedMeasureDirty;
77
101
  private _completionStatusDirty;
78
102
  private _progressMeasureDirty;
103
+ private _rawScoreDirty;
104
+ private _minScoreDirty;
105
+ private _maxScoreDirty;
79
106
  constructor(id: string, options?: ActivityObjectiveOptions);
80
107
  get id(): string;
81
108
  get description(): string | null;
@@ -95,6 +122,18 @@ export declare class ActivityObjective {
95
122
  set measureStatus(value: boolean);
96
123
  get normalizedMeasure(): number;
97
124
  set normalizedMeasure(value: number);
125
+ get rawScore(): string;
126
+ set rawScore(value: string);
127
+ get rawScoreKnown(): boolean;
128
+ set rawScoreKnown(value: boolean);
129
+ get minScore(): string;
130
+ set minScore(value: string);
131
+ get minScoreKnown(): boolean;
132
+ set minScoreKnown(value: boolean);
133
+ get maxScore(): string;
134
+ set maxScore(value: string);
135
+ get maxScoreKnown(): boolean;
136
+ set maxScoreKnown(value: boolean);
98
137
  get progressMeasure(): number;
99
138
  set progressMeasure(value: number);
100
139
  get progressMeasureStatus(): boolean;
@@ -103,10 +142,12 @@ export declare class ActivityObjective {
103
142
  set completionStatus(value: CompletionStatus);
104
143
  get progressStatus(): boolean;
105
144
  set progressStatus(value: boolean);
106
- isDirty(property: 'satisfiedStatus' | 'normalizedMeasure' | 'completionStatus' | 'progressMeasure'): boolean;
107
- clearDirty(property: 'satisfiedStatus' | 'normalizedMeasure' | 'completionStatus' | 'progressMeasure'): void;
145
+ isDirty(property: ActivityObjectiveDirtyProperty): boolean;
146
+ clearDirty(property: ActivityObjectiveDirtyProperty): void;
108
147
  clearAllDirty(): void;
109
148
  initializeFromCMI(satisfiedStatus: boolean, normalizedMeasure: number, measureStatus: boolean): void;
149
+ initializeScoreFromCMI(score: ActivityObjectiveScoreState): void;
150
+ applyReadMappedState(state: ActivityObjectiveReadState): void;
110
151
  resetState(): void;
111
152
  updateFromActivity(activity: Activity): void;
112
153
  applyToActivity(activity: Activity): void;
@@ -321,10 +362,10 @@ export declare class Activity extends BaseCMI {
321
362
  } | null;
322
363
  getAllObjectives(): ActivityObjective[];
323
364
  private updatePrimaryObjectiveFromActivity;
324
- isObjectiveDirty(property: 'satisfiedStatus' | 'normalizedMeasure' | 'measureStatus'): boolean;
325
- clearObjectiveDirty(property: 'satisfiedStatus' | 'normalizedMeasure' | 'measureStatus'): void;
365
+ isObjectiveDirty(property: "satisfiedStatus" | "normalizedMeasure" | "measureStatus"): boolean;
366
+ clearObjectiveDirty(property: "satisfiedStatus" | "normalizedMeasure" | "measureStatus"): void;
326
367
  clearAllObjectiveDirty(): void;
327
- setPrimaryObjectiveState(satisfiedStatus: boolean, measureStatus: boolean, normalizedMeasure: number, progressMeasure: number, progressMeasureStatus: boolean, completionStatus: CompletionStatus): void;
368
+ setPrimaryObjectiveState(satisfiedStatus: boolean, measureStatus: boolean, normalizedMeasure: number, progressMeasure: number, progressMeasureStatus: boolean, completionStatus: CompletionStatus, objectiveProgressStatus?: boolean): void;
328
369
  getObjectiveStateSnapshot(): {
329
370
  primary: ActivityObjectiveState | null;
330
371
  objectives: ActivityObjectiveState[];
@@ -333,6 +374,7 @@ export declare class Activity extends BaseCMI {
333
374
  primary: ActivityObjectiveState | null;
334
375
  objectives: ActivityObjectiveState[];
335
376
  }): void;
377
+ private applyObjectiveScoreSnapshot;
336
378
  getAvailableChildren(): Activity[];
337
379
  setProcessedChildren(processedChildren: Activity[]): void;
338
380
  resetProcessedChildren(): void;
@@ -43,5 +43,6 @@ export declare class RteDataTransferService {
43
43
  transferPrimaryObjective(activity: Activity, cmiData: CMIDataForTransfer): void;
44
44
  transferNonPrimaryObjectives(activity: Activity, cmiData: CMIDataForTransfer): void;
45
45
  normalizeScore(score: ScoreData): number | null;
46
+ private getObjectiveScoreState;
46
47
  }
47
48
  //# sourceMappingURL=rte_data_transfer.d.ts.map
@@ -40,6 +40,7 @@ export declare class TerminationHandler {
40
40
  };
41
41
  evaluatePostConditions(activity: Activity): PostConditionResult;
42
42
  private handleMultiLevelExit;
43
+ private applyAncestorExitActionRules;
43
44
  private processExitAtLevel;
44
45
  cleanupSuspendedActivity(): void;
45
46
  private terminateAll;
@@ -1,4 +1,4 @@
1
- import { Activity, ActivityObjective, ObjectiveMapInfo } from "../activity";
1
+ import { Activity, ActivityObjective, ActivityObjectiveReadState, ObjectiveMapInfo } from "../activity";
2
2
  import { CompletionStatus } from "../../../../constants/enums";
3
3
  export type EventCallback = (eventType: string, data?: unknown) => void;
4
4
  export interface GlobalObjective {
@@ -7,6 +7,12 @@ export interface GlobalObjective {
7
7
  satisfiedStatusKnown: boolean;
8
8
  normalizedMeasure: number;
9
9
  normalizedMeasureKnown: boolean;
10
+ rawScore: string;
11
+ rawScoreKnown: boolean;
12
+ minScore: string;
13
+ minScoreKnown: boolean;
14
+ maxScore: string;
15
+ maxScoreKnown: boolean;
10
16
  progressMeasure: number;
11
17
  progressMeasureKnown: boolean;
12
18
  completionStatus: CompletionStatus;
@@ -27,6 +33,12 @@ export interface LocalObjectiveState {
27
33
  satisfiedStatus: boolean;
28
34
  measureStatus: boolean;
29
35
  normalizedMeasure: number;
36
+ rawScore: string;
37
+ rawScoreKnown: boolean;
38
+ minScore: string;
39
+ minScoreKnown: boolean;
40
+ maxScore: string;
41
+ maxScoreKnown: boolean;
30
42
  progressMeasure: number;
31
43
  progressMeasureStatus: boolean;
32
44
  completionStatus: CompletionStatus;
@@ -41,8 +53,12 @@ export declare class GlobalObjectiveSynchronizer {
41
53
  syncGlobalObjectivesReadPhase(activity: Activity, globalObjectives: Map<string, GlobalObjective>): void;
42
54
  synchronizeGlobalObjectives(activity: Activity, globalObjectives: Map<string, GlobalObjective>): void;
43
55
  syncObjectiveState(activity: Activity, objective: ActivityObjective, mapInfo: ObjectiveMapInfo, globalObjective: GlobalObjective): void;
56
+ static getGlobalObjectiveReadState(activity: Activity, objective: ActivityObjective, mapInfo: ObjectiveMapInfo, globalObjective: GlobalObjective): ActivityObjectiveReadState;
57
+ private applyGlobalObjectiveReadState;
44
58
  ensureGlobalObjectiveEntry(globalObjectives: Map<string, GlobalObjective>, targetId: string, objective: ActivityObjective): GlobalObjective;
45
59
  createDefaultMapInfo(objective: ActivityObjective): ObjectiveMapInfo;
60
+ private hasKnownSatisfiedStatus;
61
+ private canWriteGlobalObjectives;
46
62
  getLocalObjectiveState(activity: Activity, objective: ActivityObjective, isPrimary: boolean): LocalObjectiveState;
47
63
  updateActivityAttemptData(activity: Activity, globalObjective: GlobalObjective, objective: ActivityObjective): void;
48
64
  }
@@ -36,6 +36,11 @@ export declare enum RuleActionType {
36
36
  PREVIOUS = "previous",
37
37
  EXIT = "exit"
38
38
  }
39
+ export type RuleConditionEvaluation = boolean | "unknown";
40
+ export declare function kleeneNot(value: RuleConditionEvaluation): RuleConditionEvaluation;
41
+ export declare function kleeneAnd(values: RuleConditionEvaluation[]): RuleConditionEvaluation;
42
+ export declare function kleeneOr(values: RuleConditionEvaluation[]): RuleConditionEvaluation;
43
+ export declare function combineRuleConditionResults(values: RuleConditionEvaluation[], conditionCombination: string | RuleConditionOperator): RuleConditionEvaluation;
39
44
  export declare class RuleCondition extends BaseCMI {
40
45
  private _condition;
41
46
  private _operator;
@@ -56,7 +61,7 @@ export declare class RuleCondition extends BaseCMI {
56
61
  get referencedObjective(): string | null;
57
62
  set referencedObjective(objectiveId: string | null);
58
63
  private resolveReferencedObjective;
59
- evaluate(activity: Activity): boolean;
64
+ evaluate(activity: Activity): RuleConditionEvaluation;
60
65
  private evaluateTimeLimitExceeded;
61
66
  private evaluateOutsideAvailableTimeRange;
62
67
  private parseISO8601Duration;
@@ -6,16 +6,19 @@ export interface FlowTreeTraversalResult {
6
6
  activity: Activity | null;
7
7
  endSequencingSession: boolean;
8
8
  exception?: string;
9
+ direction?: FlowSubprocessMode;
10
+ forwardOnlyCluster?: Activity;
9
11
  }
10
12
  export declare class FlowTraversalService {
11
13
  private activityTree;
12
14
  private ruleEngine;
13
15
  constructor(activityTree: ActivityTree, ruleEngine: RuleEvaluationEngine);
14
16
  flowSubprocess(fromActivity: Activity, direction: FlowSubprocessMode): FlowSubprocessResult;
15
- flowTreeTraversalSubprocess(fromActivity: Activity, direction: FlowSubprocessMode, skipChildren?: boolean): FlowTreeTraversalResult;
17
+ flowTreeTraversalSubprocess(fromActivity: Activity, direction: FlowSubprocessMode, skipChildren?: boolean, forwardTraversalBoundary?: Activity | null): FlowTreeTraversalResult;
16
18
  private traverseForward;
17
19
  private traverseBackward;
18
- private getLastDescendant;
20
+ private getBackwardTraversalEntry;
21
+ private isDescendantOfOrSelf;
19
22
  flowActivityTraversalSubprocess(activity: Activity, _direction: boolean, considerChildren: boolean, mode: FlowSubprocessMode): Activity | null;
20
23
  checkActivityProcess(activity: Activity): boolean;
21
24
  ensureSelectionAndRandomization(activity: Activity): void;
@@ -34,6 +34,7 @@ export declare const scorm2004_regex: {
34
34
  CMIString64000: string;
35
35
  CMILang: string;
36
36
  CMILangString250: string;
37
+ CMILangString: string;
37
38
  CMILangcr: string;
38
39
  CMILangString250cr: string;
39
40
  CMILangString4000: string;
@@ -175,6 +175,12 @@ export type GlobalObjectiveMapEntry = {
175
175
  satisfiedStatusKnown?: boolean;
176
176
  normalizedMeasure?: number;
177
177
  normalizedMeasureKnown?: boolean;
178
+ rawScore?: string;
179
+ rawScoreKnown?: boolean;
180
+ minScore?: string;
181
+ minScoreKnown?: boolean;
182
+ maxScore?: string;
183
+ maxScoreKnown?: boolean;
178
184
  progressMeasure?: number;
179
185
  progressMeasureKnown?: boolean;
180
186
  completionStatus?: string;
@@ -187,6 +193,12 @@ export type GlobalObjectiveMapEntry = {
187
193
  writeProgressMeasure?: boolean;
188
194
  readCompletionStatus?: boolean;
189
195
  writeCompletionStatus?: boolean;
196
+ readRawScore?: boolean;
197
+ writeRawScore?: boolean;
198
+ readMinScore?: boolean;
199
+ writeMinScore?: boolean;
200
+ readMaxScore?: boolean;
201
+ writeMaxScore?: boolean;
190
202
  lastUpdated?: string;
191
203
  };
192
204
  //# sourceMappingURL=api_types.d.ts.map
@@ -17,6 +17,16 @@ export type AdlRollupConsiderationsSettings = {
17
17
  requiredForIncomplete?: AdlRollupConsiderationRequirement;
18
18
  measureSatisfactionIfActive?: boolean;
19
19
  };
20
+ export type CompletionThresholdSettings = {
21
+ completedByMeasure?: boolean;
22
+ minProgressMeasure?: number;
23
+ progressWeight?: number;
24
+ };
25
+ export type DeliveryControlsSettings = {
26
+ tracked?: boolean;
27
+ completionSetByContent?: boolean;
28
+ objectiveSetByContent?: boolean;
29
+ };
20
30
  export type ActivitySettings = {
21
31
  id: string;
22
32
  title: string;
@@ -38,8 +48,10 @@ export type ActivitySettings = {
38
48
  objectives?: ObjectiveSettings[];
39
49
  sequencingRules?: SequencingRulesSettings;
40
50
  sequencingControls?: SequencingControlsSettings;
51
+ deliveryControls?: DeliveryControlsSettings;
41
52
  rollupRules?: RollupRulesSettings;
42
53
  rollupConsiderations?: AdlRollupConsiderationsSettings;
54
+ completionThreshold?: CompletionThresholdSettings;
43
55
  selectionRandomizationState?: SelectionRandomizationStateSettings;
44
56
  hideLmsUi?: HideLmsUiItem[];
45
57
  sequencingCollectionRefs?: string | string[];
@@ -109,6 +121,7 @@ export type SequencingControlsSettings = {
109
121
  reorderChildren?: boolean;
110
122
  completionSetByContent?: boolean;
111
123
  objectiveSetByContent?: boolean;
124
+ tracked?: boolean;
112
125
  };
113
126
  export type SelectionRandomizationStateSettings = {
114
127
  childOrder?: string[];
@@ -15,7 +15,10 @@ export declare function unflatten(data: StringKeyMap): object;
15
15
  export declare function countDecimals(num: number): number;
16
16
  export declare function formatMessage(functionName: string, message: string, CMIElement?: string): string;
17
17
  export declare function stringMatches(str: string | null | undefined, tester: string): boolean;
18
- export declare function memoize<T extends (...args: any[]) => any>(fn: T, keyFn?: (...args: Parameters<T>) => string): T;
18
+ export declare function memoize<T extends (...args: any[]) => any>(fn: T, keyFn?: (...args: Parameters<T>) => string, options?: {
19
+ maxEntries?: number;
20
+ maxKeyLength?: number;
21
+ }): T;
19
22
  export type ParsedNavigationRequest = {
20
23
  command: string;
21
24
  targetActivityId: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scorm-again",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "A modern SCORM JavaScript run-time library for SCORM 1.2 and SCORM 2004",
5
5
  "main": "dist/scorm-again.js",
6
6
  "types": "index.d.ts",