scorm-again 1.5.3 → 1.7.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/.circleci/config.yml +4 -9
- package/.run/Mocha Unit Tests.run.xml +14 -0
- package/.run/compile.run.xml +12 -0
- package/README.md +12 -3
- package/dist/aicc.js +7362 -0
- package/dist/aicc.js.map +1 -0
- package/dist/aicc.min.js +40 -0
- package/dist/scorm-again.js +1353 -1006
- package/dist/scorm-again.js.map +1 -1
- package/dist/scorm-again.min.js +52 -41
- package/dist/scorm12.js +5610 -0
- package/dist/scorm12.js.map +1 -0
- package/dist/scorm12.min.js +34 -0
- package/dist/scorm2004.js +7011 -0
- package/dist/scorm2004.js.map +1 -0
- package/dist/scorm2004.min.js +40 -0
- package/package.json +36 -28
- package/src/BaseAPI.js +71 -39
- package/src/Scorm12API.js +8 -15
- package/src/Scorm2004API.js +5 -8
- package/src/cmi/aicc_cmi.js +73 -35
- package/src/cmi/common.js +27 -21
- package/src/cmi/scorm12_cmi.js +24 -8
- package/src/cmi/scorm2004_cmi.js +67 -47
- package/src/constants/api_constants.js +8 -0
- package/src/constants/response_constants.js +2 -2
- package/src/exceptions.js +77 -6
- package/src/exports/aicc.js +3 -0
- package/src/exports/scorm-again.js +7 -0
- package/src/exports/scorm12.js +3 -0
- package/src/exports/scorm2004.js +3 -0
- package/test/Scorm2004API.spec.js +37 -7
- package/test/api_helpers.js +4 -4
- package/test/cmi_helpers.js +3 -3
- package/test/exceptions.spec.js +59 -4
- package/webpack.js +78 -0
- package/gruntfile.js +0 -87
- package/src/exports.js +0 -7
package/.circleci/config.yml
CHANGED
|
@@ -19,11 +19,6 @@ jobs:
|
|
|
19
19
|
steps:
|
|
20
20
|
- checkout
|
|
21
21
|
|
|
22
|
-
# Update npm
|
|
23
|
-
- run:
|
|
24
|
-
name: update-npm
|
|
25
|
-
command: 'sudo npm install -g npm@latest'
|
|
26
|
-
|
|
27
22
|
# Download and cache dependencies
|
|
28
23
|
- restore_cache:
|
|
29
24
|
keys:
|
|
@@ -31,7 +26,7 @@ jobs:
|
|
|
31
26
|
# fallback to using the latest cache if no exact match is found
|
|
32
27
|
- v1-dependencies-
|
|
33
28
|
|
|
34
|
-
- run:
|
|
29
|
+
- run: yarn install
|
|
35
30
|
|
|
36
31
|
- save_cache:
|
|
37
32
|
paths:
|
|
@@ -42,7 +37,7 @@ jobs:
|
|
|
42
37
|
|
|
43
38
|
# Run mocha
|
|
44
39
|
- run:
|
|
45
|
-
name:
|
|
40
|
+
name: yarn test
|
|
46
41
|
command: ./node_modules/.bin/nyc ./node_modules/.bin/mocha --require @babel/register --recursive --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=test-results/mocha/results.xml
|
|
47
42
|
when: always
|
|
48
43
|
|
|
@@ -78,7 +73,7 @@ jobs:
|
|
|
78
73
|
|
|
79
74
|
# run babel compile
|
|
80
75
|
- run: git config user.email "jputney@noverant.com" && git config user.name "Jonathan Putney"
|
|
81
|
-
- run: ./node_modules/.bin/
|
|
76
|
+
- run: ./node_modules/.bin/webpack --bail --config webpack.js
|
|
82
77
|
- run: git add --all dist/
|
|
83
78
|
|
|
84
79
|
# run jsdoc
|
|
@@ -101,4 +96,4 @@ jobs:
|
|
|
101
96
|
|
|
102
97
|
- store_artifacts: # upload test coverage as artifact
|
|
103
98
|
path: ./coverage/lcov.info
|
|
104
|
-
prefix: tests
|
|
99
|
+
prefix: tests
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="Mocha Unit Tests" type="mocha-javascript-test-runner">
|
|
3
|
+
<node-interpreter>project</node-interpreter>
|
|
4
|
+
<node-options />
|
|
5
|
+
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
6
|
+
<working-directory>$PROJECT_DIR$</working-directory>
|
|
7
|
+
<pass-parent-env>true</pass-parent-env>
|
|
8
|
+
<ui>bdd</ui>
|
|
9
|
+
<extra-mocha-options>--watch --require @babel/register</extra-mocha-options>
|
|
10
|
+
<test-kind>PATTERN</test-kind>
|
|
11
|
+
<test-pattern>test/**/*.spec.js</test-pattern>
|
|
12
|
+
<method v="2" />
|
|
13
|
+
</configuration>
|
|
14
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="compile" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="compile" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<envs />
|
|
10
|
+
<method v="2" />
|
|
11
|
+
</configuration>
|
|
12
|
+
</component>
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://circleci.com/gh/jcputney/scorm-again) [](https://codeclimate.com/github/jcputney/scorm-again) [](https://codeclimate.com/github/jcputney/scorm-again/trends/test_coverage_total) [](https://codeclimate.com/github/jcputney/scorm-again/trends/technical_debt) [ ](https://app.snyk.io/org/jcputney/projects?origin[]=github)   [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NF5MPZJAV26LE) [](https://gitter.im/jcputney/scorm-again)
|
|
1
|
+
[](https://circleci.com/gh/jcputney/scorm-again) [](https://codeclimate.com/github/jcputney/scorm-again) [](https://codeclimate.com/github/jcputney/scorm-again/trends/test_coverage_total) [](https://codeclimate.com/github/jcputney/scorm-again/trends/technical_debt) [ ](https://app.snyk.io/org/jcputney/projects?origin[]=github)   [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NF5MPZJAV26LE) [](https://gitter.im/jcputney/scorm-again) [](https://www.npmjs.com/package/scorm-again)
|
|
2
2
|
|
|
3
3
|
# SCORM Again
|
|
4
4
|
This project was created to modernize the SCORM JavaScript runtime, and to provide a stable, tested platform for running AICC, SCORM 1.2, and SCORM 2004 modules. This module is designed to be LMS agnostic, and is written to be able to be run without a backing LMS, logging all function calls and data instead of committing, if an LMS endpoint is not configured.
|
|
@@ -17,6 +17,11 @@ To begin with, you include either the `scorm-again.js` or `scorm-again.min.js` f
|
|
|
17
17
|
<script type="text/javascript" src="/dist/scorm-again.js"></script>
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Or, if you would like to only pull in one API, you include either the `aicc.js`, `scorm12.js` or `scorm2004.js` files or their minified versions on your launching page:
|
|
21
|
+
```html
|
|
22
|
+
<script type="text/javascript" src="/dist/scorm2004.js"></script>
|
|
23
|
+
```
|
|
24
|
+
|
|
20
25
|
Or, if you would like to install the library using your package manager, you can do the following:
|
|
21
26
|
```sh
|
|
22
27
|
npm install scorm-again
|
|
@@ -54,7 +59,11 @@ The APIs include several settings to customize the functionality of each API:
|
|
|
54
59
|
| `mastery_override` | false | true/false | (SCORM 1.2) Used to override a module's `cmi.core.lesson_status` so that a pass/fail is determined based on a mastery score and the user's raw score, rather than using whatever status is provided by the module. An example of this would be if a module is published using a `Complete/Incomplete` final status, but the LMS always wants to receive a `Passed/Failed` for quizzes, then we can use this setting to override the given final status. |
|
|
55
60
|
| `selfReportSessionTime` | false | true/false | Should the API override the default `session_time` reported by the module? Useful when modules don't properly report time. |
|
|
56
61
|
| `alwaysSendTotalTime` | false | true/false | Should the API always send `total_time` when committing to the LMS |
|
|
62
|
+
| `xhrWithCredentials` | false | true/false | Sets the withCredentials flag on the request to the LMS |
|
|
63
|
+
| `xhrHeaders` | {} | Object | This allows setting of additional headers on the request to the LMS where the key should be the header name and the value is the value of the header you want to send |
|
|
57
64
|
| `responseHandler` | function | | A function to properly tranform the response from the LMS to the correct format. The APIs expect the result from the LMS to be in the following format (errorCode is optional): `{ "result": true, "errorCode": 0 }` |
|
|
65
|
+
| `requestHandler` | function | | A function to transform the commit object before sending it to `lmsCommitUrl`. By default it's the identity function (no transformation). |
|
|
66
|
+
| `onLogMessage` | function | | A function to be called whenever a message is logged. Defaults to console.{error,warn,info,debug,log} |
|
|
58
67
|
|
|
59
68
|
## Initial Values
|
|
60
69
|
|
|
@@ -261,8 +270,8 @@ I welcome any and all feedback and contributions to this project! I'm sure it wo
|
|
|
261
270
|
#### Setup and Development
|
|
262
271
|
You will need `node` installed on your local machine, and you'll have to run `npm install` in the repo directory before starting development.
|
|
263
272
|
|
|
264
|
-
To run a build, you need to just run the `
|
|
273
|
+
To run a build, you need to just run the `yarn run compile` command in the root of the project.
|
|
265
274
|
|
|
266
|
-
Similarly, to run the tests, you just run the `
|
|
275
|
+
Similarly, to run the tests, you just run the `yarn test` command.
|
|
267
276
|
|
|
268
277
|
Before submitting pull requests, please also run `eslint ./src --fix` against your code first, otherwise your pull request build could fail.
|