adapt-authoring-spoortracking 1.1.2 → 1.2.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.
@@ -8,6 +8,5 @@ jobs:
8
8
  - uses: actions/setup-node@master
9
9
  with:
10
10
  node-version: 'lts/*'
11
- cache: 'npm'
12
11
  - run: npm install
13
12
  - run: npx standard
@@ -10,6 +10,5 @@ jobs:
10
10
  - uses: actions/setup-node@v4
11
11
  with:
12
12
  node-version: 'lts/*'
13
- cache: 'npm'
14
13
  - run: npm install
15
14
  - run: npm test
@@ -1,4 +1,5 @@
1
1
  import { AbstractModule } from 'adapt-authoring-core'
2
+ import { loadRouteConfig, registerRoutes } from 'adapt-authoring-server'
2
3
  /**
3
4
  * Module for making course content compatible with spoor
4
5
  * @memberof spoortracking
@@ -11,18 +12,9 @@ class SpoorTrackingModule extends AbstractModule {
11
12
 
12
13
  content.preInsertHook.tap(this.insertTrackingId.bind(this))
13
14
 
14
- server.api.createChildRouter('spoortracking').addRoute({
15
- route: '/reset/:_courseId',
16
- handlers: { post: this.resetTrackingHandler.bind(this) },
17
- meta: {
18
- post: {
19
- summary: 'Reset course tracking IDs',
20
- description: 'Fully resets all tracking IDs for a single course.',
21
- responses: { 204: {} }
22
- }
23
- }
24
- })
25
- auth.secureRoute('/api/spoortracking/reset/:_courseId', 'post', ['write:content'])
15
+ const config = await loadRouteConfig(this.rootDir, this)
16
+ const router = server.api.createChildRouter(config.root)
17
+ registerRoutes(router, config.routes, auth)
26
18
  }
27
19
 
28
20
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-authoring-spoortracking",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Module for making course content compatible with spoor",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-spoortracking",
6
6
  "license": "GPL-3.0",
@@ -11,12 +11,12 @@
11
11
  "test": "node --test 'tests/**/*.spec.js'"
12
12
  },
13
13
  "dependencies": {
14
- "adapt-authoring-core": "^2.0.0"
14
+ "adapt-authoring-core": "^2.0.0",
15
+ "adapt-authoring-server": "^2.1.0"
15
16
  },
16
17
  "peerDependencies": {
17
- "adapt-authoring-auth": "^1.0.7",
18
- "adapt-authoring-content": "^2.0.0",
19
- "adapt-authoring-server": "^2.0.0"
18
+ "adapt-authoring-auth": "^2.0.0",
19
+ "adapt-authoring-content": "^2.0.0"
20
20
  },
21
21
  "peerDependenciesMeta": {
22
22
  "adapt-authoring-auth": {
@@ -24,9 +24,6 @@
24
24
  },
25
25
  "adapt-authoring-content": {
26
26
  "optional": true
27
- },
28
- "adapt-authoring-server": {
29
- "optional": true
30
27
  }
31
28
  },
32
29
  "devDependencies": {
package/routes.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "root": "spoortracking",
3
+ "routes": [
4
+ {
5
+ "route": "/reset/:_courseId",
6
+ "handlers": { "post": "resetTrackingHandler" },
7
+ "permissions": { "post": ["write:content"] },
8
+ "meta": {
9
+ "post": {
10
+ "summary": "Reset course tracking IDs",
11
+ "description": "Fully resets all tracking IDs for a single course.",
12
+ "responses": { "204": {} }
13
+ }
14
+ }
15
+ }
16
+ ]
17
+ }