adapt-authoring-jsonschema 1.4.3 → 1.4.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.
@@ -1,4 +1,4 @@
1
- name: Standard.js formatting check
1
+ name: Lint
2
2
  on: push
3
3
  jobs:
4
4
  default:
@@ -9,4 +9,4 @@ jobs:
9
9
  with:
10
10
  node-version: 'lts/*'
11
11
  - run: npm install
12
- - run: npx standard
12
+ - run: npx standard
@@ -1,6 +1,6 @@
1
1
  export default class SchemasReference {
2
- constructor (app, config, dir, utils) {
3
- this.app = app
2
+ constructor (appData, config, dir, utils) {
3
+ this.appData = appData
4
4
  this.utils = utils
5
5
  }
6
6
 
@@ -12,10 +12,10 @@ export default class SchemasReference {
12
12
  }
13
13
 
14
14
  async loadSchemas () {
15
- const schema = await this.app.waitForModule('jsonschema')
16
- return Object.keys(schema.schemas)
15
+ const { schemas, raw } = this.appData.schemas
16
+ return Object.keys(schemas)
17
17
  .sort((a, b) => a.localeCompare(b))
18
- .reduce((schemas, s) => Object.assign(schemas, { [s]: schema.schemas[s].raw }), {})
18
+ .reduce((m, s) => Object.assign(m, { [s]: raw[s] }), {})
19
19
  }
20
20
 
21
21
  generateList () {
@@ -60,7 +60,7 @@ class JsonSchemaModule extends AbstractModule {
60
60
  }
61
61
  })
62
62
 
63
- this.onReady()
63
+ this._schemasRegistered = this.onReady()
64
64
  .then(() => this.app.waitForModule('config', 'errors'))
65
65
  .then(() => {
66
66
  // Update library options from config
@@ -226,6 +226,7 @@ class JsonSchemaModule extends AbstractModule {
226
226
  * @return {Promise<Schema>} The schema instance
227
227
  */
228
228
  async getSchema (schemaName, options = {}) {
229
+ await this._schemasRegistered
229
230
  try {
230
231
  return await this._library.getSchema(schemaName, options)
231
232
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-authoring-jsonschema",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "Module to add support for the JSON schema specification",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-jsonschema",
6
6
  "license": "GPL-3.0",