adapt-authoring-contentplugin 1.5.0 → 1.5.2

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
@@ -108,7 +108,7 @@ class ContentPluginModule extends AbstractApiModule {
108
108
  if (courses.length) {
109
109
  throw this.app.errors.CONTENTPLUGIN_IN_USE.setData({ courses })
110
110
  }
111
- const [pluginData] = await this.find({ _id })
111
+ const pluginData = await this.findOne({ _id })
112
112
  // unregister any schemas
113
113
  const jsonschema = await this.app.waitForModule('jsonschema')
114
114
  const schemaPaths = await glob(`src/*/${pluginData.name}/schema/*.schema.json`, { cwd: this.framework.path, absolute: true })
@@ -304,9 +304,9 @@ class ContentPluginModule extends AbstractApiModule {
304
304
  * @returns Resolves with plugin DB data
305
305
  */
306
306
  async installPlugin (pluginName, versionOrPath, options = { strict: false, force: false }) {
307
- const [pluginData] = await this.find({ name: String(pluginName) }, { includeUpdateInfo: true })
307
+ const pluginData = await this.findOne({ name: String(pluginName) }, { includeUpdateInfo: true, strict: false })
308
308
  const { name, version, sourcePath, isLocalInstall } = await this.processPluginFiles({ ...pluginData, sourcePath: versionOrPath })
309
- const [existingPlugin] = await this.find({ name })
309
+ const existingPlugin = await this.findOne({ name }, { strict: false })
310
310
 
311
311
  if (existingPlugin) {
312
312
  if (!options.force && semver.lte(version, existingPlugin.version)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-authoring-contentplugin",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Module for managing framework plugins",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-contentplugin",
6
6
  "repository": "github:adapt-security/adapt-authoring-contentplugin",
@@ -10,6 +10,7 @@
10
10
  "main": "index.js",
11
11
  "type": "module",
12
12
  "dependencies": {
13
+ "adapt-authoring-api": "^3.0.0",
13
14
  "adapt-authoring-core": "^2.0.0",
14
15
  "adapt-cli": "^3.3.3",
15
16
  "glob": "^13.0.0",
package/lib/apidefs.js DELETED
@@ -1,67 +0,0 @@
1
- export default {
2
- update: {
3
- post: {
4
- summary: 'Update a single content plugin',
5
- parameters: [{ name: '_id', in: 'path', description: 'Content plugin _id', required: true }],
6
- responses: {
7
- 200: {
8
- description: '',
9
- content: {
10
- 'application/json': {
11
- schema: { $ref: '#components/schemas/contentplugin' }
12
- }
13
- }
14
- }
15
- }
16
- }
17
- },
18
- uses: {
19
- get: {
20
- summary: 'Return courses using a single content plugin',
21
- parameters: [{ name: '_id', in: 'path', description: 'Content plugin _id', required: true }],
22
- responses: {
23
- 200: {
24
- description: '',
25
- content: {
26
- 'application/json': {
27
- schema: {
28
- type: 'array',
29
- items: { $ref: '#components/schemas/course' }
30
- }
31
- }
32
- }
33
- }
34
- }
35
- }
36
- },
37
- install: {
38
- post: {
39
- summary: 'Import an Adapt course',
40
- requestBody: {
41
- content: {
42
- 'application/json': {
43
- schema: {
44
- $schema: 'https://json-schema.org/draft/2020-12/schema',
45
- type: 'object',
46
- properties: {
47
- name: { type: 'string' },
48
- version: { type: 'string' },
49
- force: { type: 'Boolean', default: false }
50
- }
51
- }
52
- }
53
- }
54
- },
55
- responses: {
56
- 200: {
57
- description: '',
58
- content: {
59
- 'application/json': {
60
- schema: { $ref: '#components/schemas/contentplugin' }
61
- }
62
- }
63
- }
64
- }
65
- }
66
- }
67
- }