scorm-again 1.7.1 → 2.1.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.
- package/.babelrc +18 -7
- package/.github/dependabot.yml +5 -0
- package/.github/workflows/main.yml +79 -0
- package/.github/workflows/stale.yml +14 -0
- package/.jsdoc.json +4 -5
- package/.mocharc.json +8 -0
- package/.run/{Mocha Unit Tests.run.xml → Mocha Unit Tests (watch).run.xml } +6 -3
- package/.run/Template Mocha.run.xml +17 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +183 -71
- package/dist/aicc.js +3822 -7030
- package/dist/aicc.js.map +1 -1
- package/dist/aicc.min.js +2 -40
- package/dist/aicc.min.js.map +1 -0
- package/dist/scorm-again.js +5965 -10498
- package/dist/scorm-again.js.map +1 -1
- package/dist/scorm-again.min.js +2 -52
- package/dist/scorm-again.min.js.map +1 -0
- package/dist/scorm12.js +3028 -5373
- package/dist/scorm12.js.map +1 -1
- package/dist/scorm12.min.js +2 -34
- package/dist/scorm12.min.js.map +1 -0
- package/dist/scorm2004.js +4054 -6693
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +2 -40
- package/dist/scorm2004.min.js.map +1 -0
- package/eslint.config.js +21 -0
- package/package.json +76 -34
- package/results.json +34254 -0
- package/src/AICC.ts +72 -0
- package/src/BaseAPI.ts +1300 -0
- package/src/Scorm12API.ts +387 -0
- package/src/Scorm2004API.ts +688 -0
- package/src/cmi/aicc/attempts.ts +94 -0
- package/src/cmi/aicc/cmi.ts +100 -0
- package/src/cmi/aicc/core.ts +360 -0
- package/src/cmi/aicc/evaluation.ts +157 -0
- package/src/cmi/aicc/paths.ts +180 -0
- package/src/cmi/aicc/student_data.ts +86 -0
- package/src/cmi/aicc/student_demographics.ts +367 -0
- package/src/cmi/aicc/student_preferences.ts +176 -0
- package/src/cmi/aicc/tries.ts +116 -0
- package/src/cmi/aicc/validation.ts +25 -0
- package/src/cmi/common/array.ts +77 -0
- package/src/cmi/common/base_cmi.ts +46 -0
- package/src/cmi/common/score.ts +203 -0
- package/src/cmi/common/validation.ts +60 -0
- package/src/cmi/scorm12/cmi.ts +224 -0
- package/src/cmi/scorm12/interactions.ts +368 -0
- package/src/cmi/scorm12/nav.ts +54 -0
- package/src/cmi/scorm12/objectives.ts +112 -0
- package/src/cmi/scorm12/student_data.ts +130 -0
- package/src/cmi/scorm12/student_preference.ts +158 -0
- package/src/cmi/scorm12/validation.ts +48 -0
- package/src/cmi/scorm2004/adl.ts +272 -0
- package/src/cmi/scorm2004/cmi.ts +599 -0
- package/src/cmi/scorm2004/comments.ts +163 -0
- package/src/cmi/scorm2004/interactions.ts +466 -0
- package/src/cmi/scorm2004/learner_preference.ts +152 -0
- package/src/cmi/scorm2004/objectives.ts +212 -0
- package/src/cmi/scorm2004/score.ts +78 -0
- package/src/cmi/scorm2004/validation.ts +42 -0
- package/src/constants/api_constants.ts +318 -0
- package/src/constants/default_settings.ts +81 -0
- package/src/constants/enums.ts +5 -0
- package/src/constants/error_codes.ts +88 -0
- package/src/constants/language_constants.ts +394 -0
- package/src/constants/regex.ts +97 -0
- package/src/constants/{response_constants.js → response_constants.ts} +69 -62
- package/src/exceptions.ts +154 -0
- package/src/exports/aicc.js +1 -1
- package/src/exports/scorm-again.js +3 -3
- package/src/exports/scorm12.js +1 -1
- package/src/exports/scorm2004.js +1 -1
- package/src/helpers/scheduled_commit.ts +42 -0
- package/src/interfaces/IBaseAPI.ts +35 -0
- package/src/types/api_types.ts +32 -0
- package/src/utilities/debounce.ts +31 -0
- package/src/utilities.ts +338 -0
- package/tea.yaml +6 -0
- package/test/{AICC.spec.js → AICC.spec.ts} +79 -71
- package/test/Scorm12API.spec.ts +833 -0
- package/test/Scorm2004API.spec.ts +1298 -0
- package/test/api_helpers.ts +176 -0
- package/test/cmi/aicc_cmi.spec.ts +845 -0
- package/test/cmi/{scorm12_cmi.spec.js → scorm12_cmi.spec.ts} +253 -271
- package/test/cmi/scorm2004_cmi.spec.ts +1031 -0
- package/test/cmi_helpers.ts +207 -0
- package/test/exceptions.spec.ts +79 -0
- package/test/field_values.ts +202 -0
- package/test/types/api_types.spec.ts +126 -0
- package/test/utilities/debounce.spec.ts +56 -0
- package/test/utilities.spec.ts +322 -0
- package/tsconfig.json +18 -0
- package/webpack.config.js +65 -0
- package/.circleci/config.yml +0 -99
- package/.codeclimate.yml +0 -7
- package/.eslintrc.js +0 -36
- package/src/.flowconfig +0 -11
- package/src/AICC.js +0 -68
- package/src/BaseAPI.js +0 -1275
- package/src/Scorm12API.js +0 -308
- package/src/Scorm2004API.js +0 -572
- package/src/cmi/aicc_cmi.js +0 -1141
- package/src/cmi/common.js +0 -328
- package/src/cmi/scorm12_cmi.js +0 -1312
- package/src/cmi/scorm2004_cmi.js +0 -1692
- package/src/constants/api_constants.js +0 -218
- package/src/constants/error_codes.js +0 -87
- package/src/constants/language_constants.js +0 -76
- package/src/constants/regex.js +0 -84
- package/src/exceptions.js +0 -104
- package/src/utilities.js +0 -242
- package/test/Scorm12API.spec.js +0 -528
- package/test/Scorm2004API.spec.js +0 -775
- package/test/abstract_classes.spec.js +0 -17
- package/test/api_helpers.js +0 -128
- package/test/cmi/aicc_cmi.spec.js +0 -684
- package/test/cmi/scorm2004_cmi.spec.js +0 -1066
- package/test/cmi_helpers.js +0 -161
- package/test/exceptions.spec.js +0 -71
- package/test/field_values.js +0 -353
- package/test/utilities.spec.js +0 -339
- package/webpack.js +0 -78
package/.babelrc
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"presets": [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
[
|
|
4
|
+
"@babel/preset-env",
|
|
5
|
+
{
|
|
6
|
+
"corejs": "3",
|
|
7
|
+
"useBuiltIns": "entry",
|
|
8
|
+
"targets": {
|
|
9
|
+
"browsers": [
|
|
10
|
+
"edge >= 16",
|
|
11
|
+
"safari >= 9",
|
|
12
|
+
"firefox >= 57",
|
|
13
|
+
"ie >= 11",
|
|
14
|
+
"ios >= 9",
|
|
15
|
+
"chrome >= 49"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"@babel/preset-typescript"
|
|
10
21
|
]
|
|
11
22
|
}
|
package/.github/dependabot.yml
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Node.js CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
# Checkout repository
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
# Set up Node.js
|
|
22
|
+
- name: Setup Node.js
|
|
23
|
+
uses: actions/setup-node@v4
|
|
24
|
+
with:
|
|
25
|
+
node-version: 20
|
|
26
|
+
cache: 'yarn'
|
|
27
|
+
|
|
28
|
+
# Install dependencies
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: yarn install
|
|
31
|
+
|
|
32
|
+
# Create required directories
|
|
33
|
+
- name: Create directories
|
|
34
|
+
run: mkdir -p reports dist docs test-results
|
|
35
|
+
|
|
36
|
+
# Run Mocha tests
|
|
37
|
+
- name: Run tests with Mocha
|
|
38
|
+
run: |
|
|
39
|
+
export TS_NODE_COMPILER_OPTIONS="{\"module\":\"commonjs\"}"
|
|
40
|
+
yarn run test:coverage
|
|
41
|
+
|
|
42
|
+
# Upload test results to GitHub
|
|
43
|
+
- uses: dorny/test-reporter@v1
|
|
44
|
+
with:
|
|
45
|
+
name: Test Reporter
|
|
46
|
+
path: test-results.json
|
|
47
|
+
reporter: mocha-json
|
|
48
|
+
|
|
49
|
+
# Run ESLint
|
|
50
|
+
- name: Run ESLint
|
|
51
|
+
run: |
|
|
52
|
+
./node_modules/.bin/eslint ./src --format junit --output-file ./reports/eslint/eslint.xml
|
|
53
|
+
|
|
54
|
+
# Generate code coverage report and upload to Code Climate
|
|
55
|
+
- name: Upload Code Coverage Report
|
|
56
|
+
uses: paambaati/codeclimate-action@v9.0.0
|
|
57
|
+
env:
|
|
58
|
+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
59
|
+
with:
|
|
60
|
+
coverageCommand: yarn run test:coverage
|
|
61
|
+
coverageLocations: |
|
|
62
|
+
${{github.workspace}}/coverage/lcov.info:lcov
|
|
63
|
+
debug: 'true'
|
|
64
|
+
|
|
65
|
+
# Format code with Prettier
|
|
66
|
+
- name: Format code with Prettier
|
|
67
|
+
run: yarn run prettier
|
|
68
|
+
|
|
69
|
+
# Build the project
|
|
70
|
+
- name: Build project
|
|
71
|
+
run: yarn run compile
|
|
72
|
+
|
|
73
|
+
- name: Commit and Push Dist Folder
|
|
74
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
75
|
+
uses: stefanzweifel/git-auto-commit-action@v5
|
|
76
|
+
with:
|
|
77
|
+
commit_message: '[skip ci] Add dist folder'
|
|
78
|
+
file_pattern: 'dist/*.* src/**/*.* test/**/*.* src/*.* test/*.*'
|
|
79
|
+
skip_dirty_check: false
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
name: 'Close stale issues'
|
|
2
|
+
on:
|
|
3
|
+
schedule:
|
|
4
|
+
- cron: '30 1 * * *'
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
stale:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/stale@v9
|
|
11
|
+
with:
|
|
12
|
+
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
|
13
|
+
days-before-stale: 30
|
|
14
|
+
days-before-close: 5
|
package/.jsdoc.json
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
],
|
|
5
5
|
"babel": {
|
|
6
6
|
"presets": [
|
|
7
|
-
"@babel/preset-env"
|
|
8
|
-
"@babel/preset-flow"
|
|
7
|
+
"@babel/preset-env"
|
|
9
8
|
],
|
|
10
9
|
"plugins": [
|
|
11
|
-
"@babel/plugin-
|
|
12
|
-
"@babel/plugin-
|
|
13
|
-
"@babel/plugin-
|
|
10
|
+
"@babel/plugin-transform-class-properties",
|
|
11
|
+
"@babel/plugin-transform-private-methods",
|
|
12
|
+
"@babel/plugin-transform-optional-chaining"
|
|
14
13
|
]
|
|
15
14
|
}
|
|
16
15
|
}
|
package/.mocharc.json
ADDED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
<component name="ProjectRunConfigurationManager">
|
|
2
|
-
<configuration default="false" name="Mocha Unit Tests" type="mocha-javascript-test-runner">
|
|
2
|
+
<configuration default="false" name="Mocha Unit Tests (watch)" type="mocha-javascript-test-runner">
|
|
3
3
|
<node-interpreter>project</node-interpreter>
|
|
4
4
|
<node-options />
|
|
5
5
|
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
6
6
|
<working-directory>$PROJECT_DIR$</working-directory>
|
|
7
7
|
<pass-parent-env>true</pass-parent-env>
|
|
8
|
+
<envs>
|
|
9
|
+
<env name="TS_NODE_COMPILER_OPTIONS" value=""{\"module\":\"commonjs\"}"" />
|
|
10
|
+
</envs>
|
|
8
11
|
<ui>bdd</ui>
|
|
9
|
-
<extra-mocha-options>--watch --
|
|
12
|
+
<extra-mocha-options>--watch --import=tsx</extra-mocha-options>
|
|
10
13
|
<test-kind>PATTERN</test-kind>
|
|
11
|
-
<test-pattern>test/**/*.spec.
|
|
14
|
+
<test-pattern>test/**/*.spec.ts</test-pattern>
|
|
12
15
|
<method v="2" />
|
|
13
16
|
</configuration>
|
|
14
17
|
</component>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="true" type="mocha-javascript-test-runner">
|
|
3
|
+
<node-interpreter>project</node-interpreter>
|
|
4
|
+
<node-options />
|
|
5
|
+
<working-directory />
|
|
6
|
+
<pass-parent-env>true</pass-parent-env>
|
|
7
|
+
<envs>
|
|
8
|
+
<env name="TS_NODE_COMPILER_OPTIONS" value=""{\"module\":\"commonjs\"}"" />
|
|
9
|
+
</envs>
|
|
10
|
+
<ui />
|
|
11
|
+
<extra-mocha-options>--import=tsx</extra-mocha-options>
|
|
12
|
+
<test-kind>DIRECTORY</test-kind>
|
|
13
|
+
<test-directory />
|
|
14
|
+
<recursive>false</recursive>
|
|
15
|
+
<method v="2" />
|
|
16
|
+
</configuration>
|
|
17
|
+
</component>
|
package/CONTRIBUTING.md
CHANGED
|
@@ -6,7 +6,7 @@ I'm really glad you're reading this, because this project could definitely benef
|
|
|
6
6
|
|
|
7
7
|
I have written 1700+ test cases for the project, but testing is nowhere near what it should be. I try to add test cases as I have time or as an issue comes up. For pull requests, please create test cases for any new code that gets added.
|
|
8
8
|
|
|
9
|
-
If you would like to contribute, but don't know where to get started, we could
|
|
9
|
+
If you would like to contribute, but don't know where to get started, we could absolutely use more test cases. The CMI test cases are pretty well covered, but there are always edge cases to think of, and the API test cases are definitely lacking. They are more difficult to create and setup, but obviously cover the bulk of the functionality as well.
|
|
10
10
|
|
|
11
11
|
## Submitting changes
|
|
12
12
|
|