adapt-authoring-adaptframework 2.0.2 → 2.0.3

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,5 +1,6 @@
1
1
  import _ from 'lodash'
2
2
  import { App, Hook, ensureDir, writeJson } from 'adapt-authoring-core'
3
+ import { parse as parseObjectId } from 'adapt-authoring-mongodb'
3
4
  import { createWriteStream } from 'fs'
4
5
  import AdaptCli from 'adapt-cli'
5
6
  import { log, logDir, logMemory, copyFrameworkSource } from './utils.js'
@@ -254,10 +255,10 @@ class AdaptFrameworkBuild {
254
255
  * @return {Promise}
255
256
  */
256
257
  async loadAssetData () {
257
- const [assets, courseassets, mongodb, tags] = await App.instance.waitForModule('assets', 'courseassets', 'mongodb', 'tags')
258
+ const [assets, courseassets, tags] = await App.instance.waitForModule('assets', 'courseassets', 'tags')
258
259
 
259
260
  const caRecs = await courseassets.find({ courseId: this.courseId })
260
- const uniqueAssetIds = new Set(caRecs.map(c => mongodb.ObjectId.parse(c.assetId)))
261
+ const uniqueAssetIds = new Set(caRecs.map(c => parseObjectId(c.assetId)))
261
262
  const usedAssets = await assets.find({ _id: { $in: [...uniqueAssetIds] } })
262
263
 
263
264
  const usedTagIds = new Set(usedAssets.reduce((m, a) => [...m, ...(a.tags ?? [])], []))
@@ -1,4 +1,5 @@
1
1
  import { App, Hook, spawn, readJson, writeJson } from 'adapt-authoring-core'
2
+ import { parse as parseObjectId } from 'adapt-authoring-mongodb'
2
3
  import fs from 'fs/promises'
3
4
  import { glob } from 'glob'
4
5
  import octopus from 'adapt-octopus'
@@ -877,8 +878,7 @@ class AdaptFrameworkImport {
877
878
  }
878
879
  let _courseId
879
880
  try {
880
- const { ObjectId } = await App.instance.waitForModule('mongodb')
881
- _courseId = ObjectId.parse(this.idMap[this.contentJson.course._id])
881
+ _courseId = parseObjectId(this.idMap[this.contentJson.course._id])
882
882
  } catch (e) {}
883
883
  if (_courseId) {
884
884
  tasks.push(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-authoring-adaptframework",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Adapt framework integration for the Adapt authoring tool",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-adaptframework",
6
6
  "license": "GPL-3.0",